modify_list.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  1. <template>
  2. <template-page
  3. ref="pageRef"
  4. :get-list="getList"
  5. :operation="operation()"
  6. :options-evens-group="optionsEvensGroup"
  7. :export-list="exportList"
  8. :column-parsing="columnParsing"
  9. :table-attributes="tableAttributes"
  10. :table-events="tableEvents"
  11. >
  12. <ExamineDialog :is-show.sync="isShowExamineDialog" :examine-form.sync="examineForm" @submit="submitExamineForm" />
  13. <Popu v-if="show !== 1">
  14. <!-- <el-page-header slot="head" :content="content" @back="handleClose" /> -->
  15. <ModifyListApply v-if="show === 2 || show == 5" :cid="cid" :show="show" @back="handleClose" />
  16. <ModifyListApproval v-if="show === 3" :detail="detail" @back="handleClose" />
  17. <ModifyListDetail v-if="show === 4" :detail="detail" @back="handleClose" />
  18. </Popu>
  19. </template-page>
  20. </template>
  21. <script>
  22. import TemplatePage from '@/components/template/template-page-1.vue'
  23. import Popu from '@/components/template/popu.vue'
  24. import import_mixin from '@/components/template/import_mixin.js'
  25. import add_callback_mixin from '@/components/template/add_callback_mixin.js'
  26. import ModifyListApply from './components/modify_list-apply.vue'
  27. import ModifyListApproval from './components/modify_list-approval.vue'
  28. import ModifyListDetail from './components/modify_list-detail.vue'
  29. import ExamineDialog from '@/components/Common/examine-dialog'
  30. // import Mixin from '@/mixin/index'
  31. import {
  32. getPriceSubmit,
  33. getProductRricedel,
  34. getProductRriceDetail,
  35. getTypeList,
  36. examineData,
  37. v2ProductUpdPriceList,
  38. v2ProductUpdPriceListExport,
  39. productUpdPriceDownload,
  40. productUpdPriceReview,
  41. productUpdPriceMaterialImport
  42. } from '@/api/basic_data/material'
  43. // import { downloadFiles, handleImport } from '@/utils/util'
  44. import { getCategoryList } from '@/api/common'
  45. export default {
  46. components: {
  47. ExamineDialog,
  48. ModifyListApply,
  49. ModifyListApproval,
  50. ModifyListDetail,
  51. TemplatePage,
  52. Popu
  53. },
  54. mixins: [import_mixin, add_callback_mixin],
  55. data() {
  56. return {
  57. handleClose: this.addOff(() => {
  58. if (this.show === 2 || this.show === 5) {
  59. this.cid = ''
  60. this.show = 1
  61. }
  62. this.show = 1
  63. this.$refs.pageRef.refreshList()
  64. }),
  65. // 事件组合
  66. optionsEvensGroup: [
  67. [
  68. [
  69. {
  70. name: '新增',
  71. click: this.addOn(() => {
  72. this.addFn()
  73. })
  74. }
  75. ]
  76. ],
  77. [
  78. [
  79. {
  80. name: '批量删除',
  81. click: async() => {
  82. if (this.recordSelected.length === 0) {
  83. this.$message.error('请选择需要删除的数据')
  84. return
  85. }
  86. this.hanleDeleteAll()
  87. },
  88. isRole: this.$checkBtnRole('del', this.$route.meta.roles)
  89. }
  90. ]
  91. ],
  92. [
  93. [
  94. {
  95. name: '批量审批',
  96. click: async() => {
  97. this.batchExamine()
  98. }
  99. }
  100. ]
  101. ],
  102. [
  103. [
  104. {
  105. name: '',
  106. render: this.importButton(productUpdPriceMaterialImport, '导入', {
  107. billType: 'GENERAL'
  108. })
  109. }
  110. ]
  111. ],
  112. [
  113. [
  114. {
  115. name: '导入模版',
  116. click: () => {
  117. productUpdPriceDownload({}, `${this.$route.meta.title}`)
  118. .then(() => {
  119. this.$message({
  120. message: '下载成功',
  121. type: 'success'
  122. })
  123. })
  124. .catch(() => {
  125. this.$message.error('下载失败')
  126. })
  127. }
  128. }
  129. ]
  130. ]
  131. ],
  132. // 表格属性
  133. tableAttributes: {
  134. // 启用勾选列
  135. selectColumn: true
  136. },
  137. // 表格事件
  138. tableEvents: {
  139. 'selection-change': this.selectionChange
  140. },
  141. recordSelected: [],
  142. //
  143. baseURL: '',
  144. importFileList: [],
  145. importLoading: false,
  146. show: 1,
  147. currentPage: 1, // 当前页码
  148. pageSize: 10, // 每页数量
  149. listTotal: 0, // 列表总数
  150. dataList: [
  151. {
  152. baseUnitId: '',
  153. batchPrice: '',
  154. billId: '',
  155. endDate: '',
  156. id: null,
  157. isPromote: '',
  158. isPublish: '',
  159. materialId: '',
  160. materialName: '',
  161. materialNumber: '',
  162. parentId: '',
  163. qty: '',
  164. rebateUseRate: '',
  165. retailPrice: '',
  166. saleTypeId: '',
  167. specification: '',
  168. startDate: '',
  169. wallets: []
  170. }
  171. ],
  172. screenForm: {
  173. materialName: '',
  174. materialNumber: '',
  175. startDate: '',
  176. materialOldNumber: '',
  177. saleTypeId: '',
  178. k3CategoryNumber: '',
  179. specification: ''
  180. },
  181. liDetail: {},
  182. detail: {},
  183. obj: {
  184. baseUnitId: '',
  185. batchPrice: '',
  186. billId: '',
  187. endDate: '',
  188. id: null,
  189. isPromote: '',
  190. isPublish: '',
  191. materialId: '4',
  192. materialName: '',
  193. materialNumber: '',
  194. parentId: '',
  195. qty: '',
  196. rebateUseRate: '',
  197. retailPrice: '',
  198. saleTypeId: '',
  199. specification: '',
  200. startDate: '',
  201. wallets: []
  202. },
  203. cid: '',
  204. typeList: [],
  205. dictList: [],
  206. isCollapse: true,
  207. isShowExamineDialog: false,
  208. examineForm: {
  209. status: 'OK',
  210. remark: ''
  211. }
  212. }
  213. },
  214. computed: {
  215. exParams() {
  216. return {
  217. materialName: this.screenForm.materialName,
  218. materialNumber: this.screenForm.materialNumber,
  219. startDate: this.screenForm.startDate
  220. }
  221. },
  222. comWallets() {
  223. return e => {
  224. const map = new Map()
  225. for (const item of e) {
  226. map.set(item.walletId, item)
  227. }
  228. return [...map.values()]
  229. }
  230. }
  231. },
  232. mounted() {
  233. const params = {
  234. pageNum: 1,
  235. pageSize: -1,
  236. saleCode: '',
  237. saleName: '',
  238. status: ''
  239. }
  240. getTypeList(params).then(res => {
  241. this.typeList = res.data.records
  242. })
  243. getCategoryList({ pageNum: 1, pageSize: -1 }).then(res => {
  244. this.dictList = res.data.records
  245. console.log(this.dictList, 777777)
  246. })
  247. },
  248. methods: {
  249. // 列表请求函数
  250. getList: v2ProductUpdPriceList,
  251. // 列表导出函数
  252. exportList: v2ProductUpdPriceListExport,
  253. // 表格列解析渲染数据更改
  254. columnParsing(defaultData) {
  255. return defaultData
  256. },
  257. // 监听勾选变化
  258. selectionChange(data) {
  259. this.recordSelected = data
  260. },
  261. operation() {
  262. return (h, { row }) => {
  263. console.log(row)
  264. return (
  265. <div class='operation-btns'>
  266. {row.examineStatus == '保存' ? (
  267. <el-popconfirm
  268. onOnConfirm={async() => {
  269. this.handleGetPriceSubmit(row.updPriceBillId)
  270. }}
  271. title='是否确定需要提审该项内容?'
  272. >
  273. <el-button slot='reference' size='mini' type='text'>
  274. 提审
  275. </el-button>
  276. </el-popconfirm>
  277. ) : (
  278. ''
  279. )}
  280. {row.examineStatus == '待审核' ? (
  281. <el-popconfirm
  282. onOnConfirm={async() => {
  283. this.approvalFn(row.updPriceBillId)
  284. }}
  285. title='是否确定需要审批该项内容?'
  286. >
  287. <el-button slot='reference' size='mini' type='text'>
  288. 审批
  289. </el-button>
  290. </el-popconfirm>
  291. ) : (
  292. ''
  293. )}
  294. {row.examineStatus == '保存' ? (
  295. <el-button
  296. size='mini'
  297. type='text'
  298. onClick={async() => {
  299. this.editFn(row.updPriceBillId, row)
  300. }}
  301. >
  302. 编辑
  303. </el-button>
  304. ) : (
  305. ''
  306. )}
  307. {row.examineStatus == '审核通过' ? (
  308. <el-popconfirm
  309. onOnConfirm={async() => {
  310. productUpdPriceReview({ id: row.updPriceBillId }).then(() => {
  311. this.$successMsg('弃审成功')
  312. this.$refs.pageRef.refreshList()
  313. })
  314. }}
  315. title='是否确定需要审批该项内容?'
  316. >
  317. <el-button slot='reference' size='mini' type='text'>
  318. 弃审
  319. </el-button>
  320. </el-popconfirm>
  321. ) : (
  322. ''
  323. )}
  324. <el-button
  325. size='mini'
  326. type='text'
  327. onClick={async() => {
  328. this.detailFn(row.updPriceBillId)
  329. }}
  330. >
  331. 详情
  332. </el-button>
  333. </div>
  334. )
  335. }
  336. },
  337. formatterType(row) {
  338. for (let i = 0; i < this.typeList.length; i++) {
  339. if (this.typeList[i].id == row.saleTypeId) {
  340. return this.typeList[i].saleName
  341. }
  342. }
  343. },
  344. addFn() {
  345. this.show = 2
  346. },
  347. hanleDeleteAllPromise(id) {
  348. return new Promise((resolve) => {
  349. const ids = id ? [id] : this.recordSelected.map(v => v.updPriceBillId)
  350. if (!ids.length) {
  351. this.$errorMsg('请选择删除内容')
  352. return
  353. }
  354. resolve(ids)
  355. })
  356. },
  357. hanleDeleteAll(id) {
  358. this.hanleDeleteAllPromise(id).then(ids => {
  359. getProductRricedel(ids).then(() => {
  360. this.$successMsg('删除成功')
  361. // this.getList()
  362. this.$refs.pageRef.refreshList()
  363. })
  364. })
  365. },
  366. // 打开 批量审批
  367. batchExamine() {
  368. if (this.recordSelected.length) {
  369. this.isShowExamineDialog = true
  370. return
  371. }
  372. this.$errorMsg('请选择审核项')
  373. },
  374. // 提交 批量审批
  375. submitExamineForm() {
  376. // let ids = this.dis.map(item => {
  377. // return item
  378. // });
  379. const ids = [...new Set(this.recordSelected.map(v => v.updPriceBillId))]
  380. examineData({
  381. ids: ids.join(','),
  382. examineStatus: this.examineForm.status,
  383. examineRemark: this.examineForm.remark
  384. }).then(() => {
  385. this.isShowExamineDialog = false
  386. this.$successMsg('修改成功')
  387. // this.getList()
  388. this.$refs.pageRef.refreshList()
  389. })
  390. },
  391. handleGetPriceSubmit(id) {
  392. console.log(id)
  393. getPriceSubmit({ ids: id }).then(() => {
  394. this.$successMsg('已提审')
  395. // this.getList()
  396. this.$refs.pageRef.refreshList()
  397. })
  398. },
  399. approvalFn(id) {
  400. getProductRriceDetail({ id }).then(res => {
  401. this.detail = res.data
  402. this.show = 3
  403. })
  404. },
  405. detailFn(id) {
  406. getProductRriceDetail({ id }).then(res => {
  407. this.detail = res.data
  408. this.show = 4
  409. })
  410. },
  411. // getList() {
  412. // this.listLoading = true
  413. // console.log(456654)
  414. // let params = {
  415. // pageNum: this.currentPage,
  416. // pageSize: this.pageSize,
  417. // materialName: this.screenForm.materialName,
  418. // materialNumber: this.screenForm.materialNumber,
  419. // startDate: this.screenForm.startDate,
  420. // materialOldNumber: this.screenForm.materialOldNumber,
  421. // saleTypeId: this.screenForm.saleTypeId,
  422. // k3CategoryNumber: this.screenForm.k3CategoryNumber,
  423. // specification: this.screenForm.specification
  424. // }
  425. // getProductRriceList(params).then(res => {
  426. // this.dataList = res.data.records
  427. // this.listTotal = res.data.total
  428. // this.listLoading = false
  429. // })
  430. // },
  431. editFn(id, row) {
  432. this.cid = id
  433. this.show = 5
  434. // this.diaLogForm = {
  435. // id,
  436. // composeNumber: row.composeNumber,
  437. // items: row.items === undefined ? [] : row.items,
  438. // materialId: row.materialId,
  439. // orgNumber: row.orgNumber,
  440. // productModel: row.productModel,
  441. // productVolume: row.productVolume,
  442. // };
  443. // this.showDialogForm = true;
  444. },
  445. hanleInfo() {
  446. if (this.type === 1) {
  447. getProductAdd(this.diaLogForm).then(() => {
  448. this.$successMsg('保存成功')
  449. console.log(params, 123)
  450. this.getList()
  451. })
  452. } else if (this.type === 2) {
  453. const params = {
  454. ...this.diaLogForm
  455. }
  456. console.log(params, 123)
  457. getProductEdit(params).then(() => {
  458. this.$successMsg('编辑成功')
  459. this.getList()
  460. })
  461. this.diaLogForm.id = null
  462. }
  463. this.showDialogForm = false
  464. },
  465. hanleDelete(id) {
  466. this.hanleDeleteAllPromise(id).then(ids => {
  467. getProductDel(ids).then(() => {
  468. this.$successMsg('删除成功')
  469. })
  470. })
  471. },
  472. handleExport() {
  473. const screenData = {
  474. customerName: this.screenForm.customerName,
  475. freeDay: this.screenForm.freeDay,
  476. toll: this.screenForm.toll
  477. }
  478. downloadFiles('product-compose/export', screenData)
  479. },
  480. resetInfo() {
  481. this.diaLogForm = {
  482. composeNumber: '',
  483. id: '',
  484. items: [],
  485. materialId: '',
  486. orgNumber: 0,
  487. productModel: '',
  488. productVolume: ''
  489. }
  490. },
  491. // 导入
  492. async handleImport(param) {
  493. this.importLoading = true
  494. const file = param.file
  495. const formData = new FormData()
  496. formData.append('file', file)
  497. const result = await handleImport('/product-upd-price/material/import', formData)
  498. this.importLoading = false
  499. this.importFileList = []
  500. if (result.code === 200) {
  501. this.$alert('成功处理记录数:' + result.data, '导入成功', {
  502. confirmButtonText: '确定'
  503. })
  504. this.getList()
  505. } else {
  506. this.$alert(result.message, '导入失败', {
  507. confirmButtonText: '确定'
  508. })
  509. }
  510. },
  511. // 下载经销商模板
  512. hanleDownloadFiles() {
  513. downloadFiles('product-upd-price/download')
  514. },
  515. tableRowClassName({ row }) {
  516. // || row.examineStatus=='FAIL'
  517. if (this.ids.includes(row.updPriceBillId)) {
  518. return 'warning-row'
  519. }
  520. return ''
  521. }
  522. }
  523. }
  524. </script>
  525. <style lang="scss" scoped>
  526. ::v-deep .el-select--small {
  527. width: 100%;
  528. }
  529. ::v-deep .el-table .warning-row {
  530. background: oldlace;
  531. }
  532. .import-btn {
  533. display: inline-block;
  534. margin: 0 10px;
  535. }
  536. </style>