policy_list.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  1. <template>
  2. <template-page
  3. ref="pageRef"
  4. :getList="getList"
  5. :operation="operation()"
  6. :optionsEvensGroup="optionsEvensGroup"
  7. :exportList="exportList"
  8. :columnParsing="columnParsing"
  9. :tableAttributes="tableAttributes"
  10. :tableEvents="tableEvents"
  11. >
  12. <Popu v-if="isShow !== 1">
  13. <el-page-header slot="head" :content="content" @back="handleClose" />
  14. <AddPolicy
  15. v-if="isShow === 2"
  16. @close="handleClose"
  17. @upDataIsFlag="upDataIsFlag"
  18. :isShow="isShow"
  19. :isFlag="isFlag"
  20. />
  21. <EditPolicy
  22. v-if="isShow === 3"
  23. :id="id"
  24. @close="handleClose"
  25. @upDataIsFlag="upDataIsFlag"
  26. :isShow="isShow"
  27. :isFlag="isFlag"
  28. />
  29. <Details v-if="isShow === 4" @close="handleClose" :id="id" :isShow="isShow" />
  30. <Examine v-if="isShow === 5" @close="handleClose" :id="id" :isShow="isShow" />
  31. </Popu>
  32. </template-page>
  33. </template>
  34. <script>
  35. import TemplatePage from '@/components/template/template-page-1.vue'
  36. import Popu from '@/components/template/popu.vue'
  37. import add_callback_mixin from '@/components/template/add_callback_mixin.js'
  38. import {
  39. cancelPolicy,
  40. cloneList,
  41. deletePolicy,
  42. getCrList,
  43. getId,
  44. getList,
  45. getpolicySubmit,
  46. getTypeList,
  47. toExamine,
  48. setAbandon,
  49. policyListV2,
  50. policyListV2Export
  51. } from '@/api/policy_list'
  52. // import Minxin from '@/mixin'
  53. import { downloadFiles, handleImport } from '@/utils/util'
  54. import AddPolicy from './components/AddPolicy'
  55. import EditPolicy from './components/editPolicy'
  56. import AddModel from './components/AddModel'
  57. import Pagination from './components/Pagination'
  58. import AddCondition from './components/AddCondition'
  59. import Details from './components/details.vue'
  60. import Examine from './components/Examine'
  61. import { mapState } from 'vuex'
  62. export default {
  63. mixins: [add_callback_mixin],
  64. data() {
  65. return {
  66. showPage: true,
  67. // 事件组合
  68. optionsEvensGroup: [
  69. [
  70. [
  71. {
  72. name: '新增',
  73. click: this.addOn(() => {
  74. this.hanlenewInfo()
  75. })
  76. }
  77. ]
  78. ]
  79. ],
  80. // 表格属性
  81. tableAttributes: {
  82. // 启用勾选列
  83. selectColumn: false
  84. },
  85. // 表格事件
  86. tableEvents: {
  87. 'selection-change': this.selectionChange
  88. },
  89. recordSelected: [],
  90. //
  91. id: '',
  92. code: '',
  93. codeId: '',
  94. listLoading: false,
  95. policyId: '',
  96. CrList: [],
  97. isShow: 1,
  98. dataList: [],
  99. screenForm: {
  100. code: '',
  101. createBy: '',
  102. endCreateTime: '',
  103. endTime1: '',
  104. endTime2: '',
  105. examineBy: '',
  106. remark: '',
  107. startCreateTime: '',
  108. startTime1: '',
  109. startTime2: '',
  110. status: '',
  111. title: '',
  112. type: '',
  113. customerId: '',
  114. specification: '',
  115. customerNumber: ''
  116. },
  117. fileList: [],
  118. statusOptions: [
  119. {
  120. value: true,
  121. label: '已生效'
  122. },
  123. {
  124. value: false,
  125. label: '未生效'
  126. }
  127. ],
  128. typeOptions: [
  129. {
  130. vlaue: 'PROVISION',
  131. label: '配提'
  132. },
  133. {
  134. value: 'LIMIT',
  135. label: '限量'
  136. }
  137. ],
  138. typeList: [],
  139. value: '',
  140. imageUrl: '',
  141. baseURL: '',
  142. isFlag: '',
  143. isCollapse: true
  144. }
  145. },
  146. created() {
  147. const customerParams = {
  148. pageNum: 1,
  149. pageSize: -1,
  150. keyword: '',
  151. region: ''
  152. }
  153. // 获取经销商列表
  154. getCrList(customerParams).then(res => {
  155. this.CrList = res.data.records
  156. })
  157. },
  158. computed: mapState({
  159. comCode: state => state.sales.code,
  160. content() {
  161. const textArr = ['新增', '编辑', '详情', '审核']
  162. return textArr[this.isShow - 2]
  163. }
  164. }),
  165. methods: {
  166. // 列表请求函数
  167. getList: policyListV2,
  168. // 列表导出函数
  169. exportList: policyListV2Export,
  170. // 表格列解析渲染数据更改
  171. columnParsing(item, defaultData) {
  172. return defaultData
  173. },
  174. // 监听勾选变化
  175. selectionChange(data) {
  176. this.recordSelected = data
  177. },
  178. upDataIsFlag() {
  179. this.isFlag = 1
  180. },
  181. handleClose() {
  182. this.addOff(() => {
  183. this.isShow = 1
  184. this.showPage = true
  185. this.$refs.pageRef.refreshList()
  186. })()
  187. },
  188. operation() {
  189. return (h, { row, index, column }) => {
  190. return (
  191. <div class="operation-btns">
  192. {row.examineStatus == '保存' ? (
  193. <el-button
  194. size="mini"
  195. type="text"
  196. onClick={async () => {
  197. this.isShow = 3
  198. this.id = row.id
  199. }}
  200. >
  201. 编辑
  202. </el-button>
  203. ) : (
  204. ''
  205. )}
  206. <el-button
  207. size="mini"
  208. type="text"
  209. onClick={async () => {
  210. this.isShow = 4
  211. this.id = row.id
  212. this.code = row.code
  213. }}
  214. >
  215. 详情
  216. </el-button>
  217. {row.examineStatus == '待审核' && this.$checkBtnRole('examine', this.$route.meta.roles) ? (
  218. <el-button
  219. size="mini"
  220. type="text"
  221. onClick={async () => {
  222. this.isShow = 5
  223. this.id = row.id
  224. this.code = row.code
  225. this.policyId = row.policyId
  226. }}
  227. >
  228. 审核
  229. </el-button>
  230. ) : (
  231. ''
  232. )}
  233. {row.examineStatus == '保存' ? (
  234. <el-popconfirm
  235. onOnConfirm={async () => {
  236. this.handlesubmit(row)
  237. }}
  238. title="是否确定需要提审该项内容?"
  239. >
  240. <el-button slot="reference" size="mini" type="text">
  241. 提审
  242. </el-button>
  243. </el-popconfirm>
  244. ) : (
  245. ''
  246. )}
  247. {row.examineStatus == '审核通过' && row.status ? (
  248. <el-popconfirm
  249. onOnConfirm={async () => {
  250. this.handleNullify(row)
  251. }}
  252. title="是否确定需要作废该项内容?"
  253. >
  254. <el-button slot="reference" size="mini" type="text">
  255. 作废
  256. </el-button>
  257. </el-popconfirm>
  258. ) : (
  259. ''
  260. )}
  261. {row.examineStatus == '审核通过' ? (
  262. <el-popconfirm
  263. onOnConfirm={async () => {
  264. this.handleClone(row)
  265. }}
  266. title="是否确定需要克隆该项内容?"
  267. >
  268. <el-button slot="reference" size="mini" type="text">
  269. 克隆
  270. </el-button>
  271. </el-popconfirm>
  272. ) : (
  273. ''
  274. )}
  275. {row.examineStatus != '审核通过' ? (
  276. <el-popconfirm
  277. onOnConfirm={async () => {
  278. this.hanleDelete(row.id)
  279. }}
  280. title="是否确定需要删除该项内容?"
  281. >
  282. <el-button slot="reference" size="mini" type="text">
  283. 删除
  284. </el-button>
  285. </el-popconfirm>
  286. ) : (
  287. ''
  288. )}
  289. {row.examineStatus == '审核通过' ? (
  290. <el-popconfirm
  291. onOnConfirm={async () => {
  292. this.hanleAbandon(row.id)
  293. }}
  294. title="是否确定需要弃审该项内容?"
  295. >
  296. <el-button slot="reference" size="mini" type="text">
  297. 弃审
  298. </el-button>
  299. </el-popconfirm>
  300. ) : (
  301. ''
  302. )}
  303. </div>
  304. )
  305. }
  306. },
  307. tableRowClassName({ row, rowIndex }) {
  308. // || row.examineStatus=='FAIL'
  309. if (row.status == 0) {
  310. return 'warning-row'
  311. }
  312. return ''
  313. },
  314. hanlenewInfo() {
  315. console.log()
  316. getId().then(res => {
  317. this.$store.commit('sales/setId', res.data)
  318. this.isShow = 2
  319. })
  320. },
  321. handleClone(row) {
  322. cloneList({ policyId: row.id }).then(res => {
  323. this.$refs.pageRef.refreshList()
  324. this.$message.success('克隆成功')
  325. })
  326. },
  327. // getList() {
  328. // this.listLoading = true
  329. // const params = {
  330. // pageNum: this.currentPage,
  331. // pageSize: this.pageSize,
  332. // code: this.screenForm.code,
  333. // type: this.screenForm.type,
  334. // createBy: this.screenForm.createBy,
  335. // endCreateTime: this.screenForm.endCreateTime,
  336. // endTime1: this.screenForm.endTime1,
  337. // endTime2: this.screenForm.endTime2,
  338. // examineBy: this.screenForm.examineBy,
  339. // remark: this.screenForm.remark,
  340. // startCreateTime: this.screenForm.startCreateTime,
  341. // startTime1: this.screenForm.startTime1,
  342. // startTime2: this.screenForm.startTime2,
  343. // status: this.screenForm.status,
  344. // title: this.screenForm.title,
  345. // customerId: this.screenForm.customerId,
  346. // customerNumber: this.screenForm.customerNumber,
  347. // specification: this.screenForm.specification
  348. // }
  349. // getList(params).then(res => {
  350. // this.dataList = res.data.records
  351. // console.log(this.dataList)
  352. // this.listTotal = res.data.total
  353. // this.listLoading = false
  354. // })
  355. // // 产品类型
  356. // // const paramsType = {
  357. // // pageNum: 1,
  358. // // pageSize: 10,
  359. // // saleCdoe: '',
  360. // // saleName: '',
  361. // // stauts: ''
  362. // // }
  363. // // getTypeList(paramsType).then(res => {
  364. // // this.typeList = res.data.records
  365. // // })
  366. // },
  367. hanleAbandon(id) {
  368. setAbandon({ policyId: id }).then(res => {
  369. this.$refs.pageRef.refreshList()
  370. this.$message.success('弃审成功')
  371. })
  372. },
  373. hanleDelete(id) {
  374. this.hanleDeleteAllPromise(id).then(ids => {
  375. deletePolicy({
  376. id: ids[0]
  377. }).then(res => {
  378. this.$refs.pageRef.refreshList()
  379. this.$message.success('删除成功')
  380. })
  381. })
  382. },
  383. hanleDeleteAllPromise(id) {
  384. return new Promise((resolve, reject) => {
  385. const ids = id ? [id] : this.ids
  386. if (!ids.length) {
  387. this.$errorMsg('请选择删除内容')
  388. return
  389. }
  390. resolve(ids)
  391. })
  392. },
  393. // 作废
  394. handleNullify(row) {
  395. cancelPolicy({ id: row.id }).then(res => {
  396. this.$refs.pageRef.refreshList()
  397. this.$message.success('作废成功')
  398. })
  399. },
  400. // 导出文档
  401. handleExport() {
  402. const screenData = {
  403. customerTel: this.diaLogForm.customerTel,
  404. logisticsCompany: this.diaLogForm.logisticsCompany
  405. }
  406. downloadFiles('policy/export', screenData)
  407. },
  408. // 导入
  409. async handleImport(param) {
  410. this.importLoading = true
  411. const file = param.file
  412. console.log(file, 123)
  413. const formData = new FormData()
  414. formData.append('file', file)
  415. const result = await handleImport('/policy/material/import', formData)
  416. this.importLoading = false
  417. this.importFileList = []
  418. if (result.code == 200) {
  419. this.$alert('导入成功', '导入成功', {
  420. confirmButtonText: '确定'
  421. })
  422. this.getList()
  423. } else {
  424. this.$alert('导入失败', '导入失败', {
  425. confirmButtonText: '确定'
  426. })
  427. }
  428. },
  429. handlesubmit(e) {
  430. getpolicySubmit({ policyId: e.id }).then(res => {
  431. this.$refs.pageRef.refreshList()
  432. this.$message.success('提审成功')
  433. })
  434. },
  435. hanleExamine(e) {
  436. if (e.examineStatus == 'WAIT') {
  437. toExamine({
  438. examineRemark: e.id,
  439. examineStatus: 'WAIT',
  440. policyId: e.id
  441. }).then(res => {
  442. this.$successMsg('已提交')
  443. })
  444. } else {
  445. this.$errorMsg('未满足条件')
  446. }
  447. }
  448. },
  449. components: {
  450. TemplatePage,
  451. Popu,
  452. Examine,
  453. Details,
  454. AddModel,
  455. AddPolicy,
  456. EditPolicy,
  457. Pagination,
  458. AddCondition
  459. }
  460. }
  461. </script>
  462. <style lang="scss" scoped>
  463. ::v-deep .el-table .warning-row {
  464. background: oldlace;
  465. }
  466. // ::v-deep .el-table .success-row {
  467. // background: #f0f9eb;
  468. // }
  469. .btn {
  470. width: 80px;
  471. }
  472. .mpd {
  473. padding: 20px 0 0 0;
  474. }
  475. .select_height {
  476. width: 100%;
  477. }
  478. .import-btn {
  479. margin: 0 10px;
  480. }
  481. .header {
  482. display: flex;
  483. height: 50px;
  484. align-items: center;
  485. }
  486. .fr {
  487. margin: 20px 0;
  488. }
  489. </style>