engin_list.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  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. :operationColumnWidth="200"
  12. :fieldBeansHook="fieldBeansHook"
  13. >
  14. <EditDateDialog :is-show.sync="isShowEditDateDialog" :date-form.sync="dateForm" />
  15. <Popu v-if="!showPage">
  16. <el-page-header slot="head" :content="content" @back="handleClose" />
  17. <EnginDetail v-if="isShowDetail" :list-item="queryItem" @backListFormDetail="backList" />
  18. <EnginForm v-if="isShowForm" :list-item="queryItem" @backListFormDetail="backList" />
  19. <EnginExamine v-if="isShowExamine" :list-item="queryItem" @backListFormDetail="backList" />
  20. </Popu>
  21. </template-page>
  22. </template>
  23. <script>
  24. import TemplatePage from '@/components/template/template-page-1.vue'
  25. import Popu from '@/components/template/popu.vue'
  26. import add_callback_mixin from '@/components/template/add_callback_mixin.js'
  27. import {
  28. getEnginList,
  29. applyEngin,
  30. withdrawEngin,
  31. deleteEngin,
  32. editDateEngin,
  33. abandonEngin,
  34. v2EnginInfoOrderList,
  35. v2EnginInfoOrderListExport
  36. } from '@/api/supply/engin'
  37. import { getSalesmanList, getTypeList } from '@/api/common'
  38. import EnginDetail from '@/views/supply/engin/components/engin_detail'
  39. import EnginForm from '@/views/supply/engin/components/engin_form'
  40. import EnginExamine from '@/views/supply/engin/components/engin_examine'
  41. import EditDateDialog from '@/components/Common/edit-date-dialog'
  42. import { getNoRebateWalletList } from '@/api/policy_list'
  43. let that
  44. export default {
  45. mixins: [add_callback_mixin],
  46. components: {
  47. EnginDetail,
  48. EnginForm,
  49. EnginExamine,
  50. EditDateDialog,
  51. TemplatePage,
  52. Popu,
  53. add_callback_mixin
  54. },
  55. filters: {
  56. statusFilter(val) {
  57. const obj = that.statusList.find(o => o.value == val)
  58. return obj ? obj.label : ''
  59. }
  60. },
  61. data() {
  62. return {
  63. showPage: true,
  64. content: '商用工程信息单',
  65. // 关闭新增弹窗
  66. handleClose: this.addOff(() => {
  67. this.showPage = true
  68. this.isShowForm = false
  69. this.$refs.pageRef.refreshList()
  70. }),
  71. // 事件组合
  72. optionsEvensGroup: [
  73. [
  74. [
  75. {
  76. name: '新增',
  77. click: this.addOn(() => {
  78. this.toForm()
  79. })
  80. }
  81. ]
  82. ]
  83. ],
  84. // 表格属性
  85. tableAttributes: {
  86. // 启用勾选列
  87. selectColumn: true
  88. },
  89. // 表格事件
  90. tableEvents: {
  91. 'selection-change': this.selectionChange
  92. },
  93. recordSelected: [],
  94. currentPage: 1, // 当前页码
  95. pageSize: 10, // 每页数量
  96. listTotal: 0, // 列表总数
  97. dataList: null, // 列表数据
  98. listLoading: false, // 列表加载loading
  99. screenForm: {
  100. // 筛选表单数据
  101. orderNum: '',
  102. enginNum: '',
  103. loginNum: '',
  104. enginName: '',
  105. date: [],
  106. dealer: '',
  107. company: '',
  108. createMan: '',
  109. examineMan: '',
  110. status: '',
  111. salesMan: '',
  112. model: '',
  113. orderDate: [],
  114. isClose: '',
  115. isDirectTransfer: null,
  116. examineStatus: ''
  117. },
  118. statusList: [
  119. { label: '已保存', value: 'SAVE' },
  120. { label: '待审核', value: 'WAIT' },
  121. { label: '审核通过', value: 'OK' },
  122. // // { label: '审核驳回', value: 'FAIL' },,
  123. { label: '已关闭', value: 'CLOSE' }
  124. ],
  125. salesmanList: [],
  126. transfer: [
  127. { label: '是', value: true },
  128. { label: '否', value: false }
  129. ],
  130. queryItem: {},
  131. isShowDetail: false,
  132. isShowForm: false,
  133. isShowExamine: false,
  134. isCollapse: true,
  135. editId: null,
  136. NoRebateWalletList: [],
  137. typeList: [],
  138. isShowEditDateDialog: false,
  139. dateForm: {
  140. date: ''
  141. }
  142. }
  143. },
  144. computed: {
  145. isDealer() {
  146. return JSON.parse(localStorage.getItem('supply_user')).isCustomer
  147. }
  148. // exParams() {
  149. // return {
  150. // enginInfoNo: this.screenForm.orderNum,
  151. // projectNo: this.screenForm.enginNum,
  152. // enginSignType: this.screenForm.loginNum,
  153. // projectName: this.screenForm.enginName,
  154. // startOrderDate: this.screenForm.orderDate ? this.screenForm.orderDate[0] : '',
  155. // endOrderDate: this.screenForm.orderDate ? this.screenForm.orderDate[1] : '',
  156. // startContractExpireDate: this.screenForm.date ? this.screenForm.date[0] : '',
  157. // endContractExpireDate: this.screenForm.date ? this.screenForm.date[1] : '',
  158. // customerKeyword: this.screenForm.dealer,
  159. // useUnit: this.screenForm.company,
  160. // createName: this.screenForm.createMan,
  161. // confirmName: this.screenForm.examineMan,
  162. // examineStatus: this.screenForm.examineStatus,
  163. // isClose: this.screenForm.isClose,
  164. // serviceId: this.screenForm.salesMan,
  165. // specification: this.screenForm.model,
  166. // isDirectTransfer: this.screenForm.isDirectTransfer
  167. // }
  168. // }
  169. },
  170. watch: {
  171. dataList: {
  172. handler(newValue, oldValue) {
  173. if (newValue && newValue.length) {
  174. newValue.forEach((item, index) => {
  175. this.dataList[index].compute_kdQty = this.computeAllowQty(item.qty, item.hasOrderQty)
  176. })
  177. }
  178. },
  179. immediate: true,
  180. deep: true
  181. }
  182. },
  183. beforeCreate() {
  184. that = this
  185. },
  186. created() {
  187. this.getSalesmanList()
  188. // this.getList()
  189. },
  190. methods: {
  191. // 列表请求函数
  192. getList: v2EnginInfoOrderList,
  193. // 列表导出函数
  194. exportList: v2EnginInfoOrderListExport,
  195. // 表格列解析渲染数据更改
  196. columnParsing(item, defaultData) {
  197. return defaultData
  198. },
  199. // 监听勾选变化
  200. selectionChange(data) {
  201. this.recordSelected = data
  202. },
  203. fieldBeansHook(val) {
  204. if (this.isDealer) {
  205. let res = val.filter(v => v.jname !== 'powerCategory' && v.jname !== 'geLiInerNote' && v.jname !== 'geLiNote')
  206. return res
  207. } else {
  208. return val
  209. }
  210. },
  211. operation() {
  212. return (h, { row, index, column }) => {
  213. return (
  214. <div class="operation-btns">
  215. {this.$checkBtnRole('apply', this.$route.meta.roles) && row.examineStatus === 'SAVE' ? (
  216. <el-popconfirm
  217. onOnConfirm={async () => {
  218. this.handleSubmit(row.enginInfoId)
  219. }}
  220. title="是否确定需要申请该项内容?"
  221. >
  222. <el-button slot="reference" size="mini" type="text">
  223. 申请
  224. </el-button>
  225. </el-popconfirm>
  226. ) : (
  227. ''
  228. )}
  229. {this.$checkBtnRole('apply', this.$route.meta.roles) && row.examineStatus === 'WAIT' ? (
  230. <el-popconfirm
  231. onOnConfirm={async () => {
  232. this.handleWithdraw(row.enginInfoId)
  233. }}
  234. title="是否确定需要撤回该项内容?"
  235. >
  236. <el-button slot="reference" size="mini" type="text">
  237. 撤回
  238. </el-button>
  239. </el-popconfirm>
  240. ) : (
  241. ''
  242. )}
  243. {this.$checkBtnRole('examine', this.$route.meta.roles) && row.examineStatus === 'OK' ? (
  244. <el-popconfirm
  245. onOnConfirm={async () => {
  246. this.handleAbandon(row.enginInfoId)
  247. }}
  248. title="是否确定需要弃审该项内容?"
  249. >
  250. <el-button slot="reference" size="mini" type="text">
  251. 弃审
  252. </el-button>
  253. </el-popconfirm>
  254. ) : (
  255. ''
  256. )}
  257. {this.$checkBtnRole('edit', this.$route.meta.roles) &&
  258. (!this.isDealer || (this.isDealer && row.examineStatus === 'SAVE')) ? (
  259. <el-button
  260. size="mini"
  261. type="text"
  262. onClick={async () => {
  263. this.toForm(row)
  264. }}
  265. >
  266. 编辑
  267. </el-button>
  268. ) : (
  269. ''
  270. )}
  271. {this.$checkBtnRole('examine', this.$route.meta.roles) && row.examineStatus === 'WAIT' ? (
  272. <el-button
  273. size="mini"
  274. type="text"
  275. onClick={async () => {
  276. this.toExamine(row)
  277. }}
  278. >
  279. 审批
  280. </el-button>
  281. ) : (
  282. ''
  283. )}
  284. <el-button
  285. size="mini"
  286. type="text"
  287. onClick={async () => {
  288. this.toDetail(row)
  289. }}
  290. >
  291. 详情
  292. </el-button>
  293. {this.$checkBtnRole('del', this.$route.meta.roles) && row.examineStatus !== 'OK' ? (
  294. <el-popconfirm
  295. onOnConfirm={async () => {
  296. this.handleDelete(row.enginInfoId)
  297. }}
  298. title="是否确定需要删除该项内容?"
  299. >
  300. <el-button slot="reference" size="mini" type="text">
  301. 删除
  302. </el-button>
  303. </el-popconfirm>
  304. ) : (
  305. ''
  306. )}
  307. </div>
  308. )
  309. }
  310. },
  311. // 获取业务员列表
  312. getSalesmanList() {
  313. getSalesmanList({
  314. pageNum: 1,
  315. pageSize: -1,
  316. isCustomer: 0,
  317. status: true
  318. }).then(res => {
  319. this.salesmanList = res.data.records
  320. })
  321. getNoRebateWalletList({
  322. walletName: ''
  323. }).then(res => {
  324. console.log(res)
  325. this.NoRebateWalletList = res.data
  326. })
  327. getTypeList({ pageNum: 1, pageSize: -1 }).then(res => {
  328. this.typeList = res.data.records
  329. // console.log(this.typeList)
  330. })
  331. },
  332. // 查询列表
  333. // getList() {
  334. // this.listLoading = true
  335. // const params = {
  336. // pageNum: this.currentPage,
  337. // pageSize: this.pageSize,
  338. // enginInfoNo: this.screenForm.orderNum,
  339. // projectNo: this.screenForm.enginNum,
  340. // enginSignType: this.screenForm.loginNum,
  341. // projectName: this.screenForm.enginName,
  342. // startOrderDate: this.screenForm.orderDate ? this.screenForm.orderDate[0] : '',
  343. // endOrderDate: this.screenForm.orderDate ? this.screenForm.orderDate[1] : '',
  344. // startContractExpireDate: this.screenForm.date ? this.screenForm.date[0] : '',
  345. // endContractExpireDate: this.screenForm.date ? this.screenForm.date[1] : '',
  346. // customerKeyword: this.screenForm.dealer,
  347. // useUnit: this.screenForm.company,
  348. // createName: this.screenForm.createMan,
  349. // confirmName: this.screenForm.examineMan,
  350. // examineStatus: this.screenForm.examineStatus,
  351. // isClose: this.screenForm.isClose,
  352. // serviceId: this.screenForm.salesMan,
  353. // specification: this.screenForm.model,
  354. // isDirectTransfer: this.screenForm.isDirectTransfer
  355. // }
  356. // getEnginList(params).then(res => {
  357. // res.data.records.forEach(item => {
  358. // item.sums1 = ['qty', 'hasOrderQty', 'compute_kdQty']
  359. // item.sums2 = ['totalAmount', 'price']
  360. // })
  361. // this.dataList = res.data.records
  362. // this.listTotal = res.data.total
  363. // this.listLoading = false
  364. // })
  365. // },
  366. // 提交筛选表单
  367. // submitScreenForm() {
  368. // this.currentPage = 1
  369. // this.getList()
  370. // },
  371. // // 重置筛选表单
  372. // resetScreenForm() {
  373. // this.$refs.screenForm.resetFields()
  374. // this.currentPage = 1
  375. // this.getList()
  376. // },
  377. // // 更改每页数量
  378. // handleSizeChange(val) {
  379. // this.pageSize = val
  380. // this.currentPage = 1
  381. // this.getList()
  382. // },
  383. // // 更改当前页
  384. // handleCurrentChange(val) {
  385. // this.currentPage = val
  386. // this.getList()
  387. // },
  388. // 进入表单
  389. toForm(item) {
  390. this.queryItem = item
  391. this.showPage = false
  392. this.isShowForm = true
  393. },
  394. // 进入审批
  395. toExamine(item) {
  396. this.queryItem = item
  397. this.showPage = false
  398. this.isShowExamine = true
  399. },
  400. // 进入详情
  401. toDetail(item) {
  402. this.queryItem = item
  403. this.showPage = false
  404. this.isShowDetail = true
  405. },
  406. backList() {
  407. this.queryItem = {}
  408. this.isShowDetail = false
  409. this.isShowForm = false
  410. this.isShowExamine = false
  411. this.showPage = true
  412. },
  413. // 申请
  414. handleSubmit(id) {
  415. applyEngin({ id }).then(res => {
  416. this.$refs.pageRef.refreshList()
  417. this.$message.success('申请成功')
  418. })
  419. },
  420. // 撤回
  421. handleWithdraw(id) {
  422. withdrawEngin({ id }).then(res => {
  423. this.$refs.pageRef.refreshList()
  424. this.$message.success('撤回成功')
  425. })
  426. },
  427. // 弃审
  428. handleAbandon(id) {
  429. abandonEngin({ id }).then(res => {
  430. this.$refs.pageRef.refreshList()
  431. this.$message.success('弃审成功')
  432. })
  433. },
  434. // 删除
  435. handleDelete(id) {
  436. deleteEngin({ ids: id }).then(res => {
  437. this.$refs.pageRef.refreshList()
  438. this.$message.success('删除成功')
  439. })
  440. },
  441. // 打开 修改订单日期
  442. editDate(item) {
  443. this.editId = item.enginInfoId
  444. this.dateForm.date = item.orderDate.slice(0, 10)
  445. this.isShowEditDateDialog = true
  446. },
  447. // 提交 修改订单日期
  448. submitDateForm() {
  449. editDateEngin({
  450. enginInfoId: this.editId,
  451. orderDate: this.dateForm.date + ' 00:00:00'
  452. }).then(res => {
  453. this.isShowEditDateDialog = false
  454. this.getList()
  455. this.$successMsg('修改成功')
  456. })
  457. },
  458. computeAllowQty(qty = 0, hasOrderQty = 0) {
  459. const allowQty = qty - hasOrderQty
  460. if (allowQty < 0) {
  461. return 0
  462. }
  463. return allowQty
  464. }
  465. }
  466. }
  467. </script>
  468. <style lang="scss" scoped></style>