index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <div class="ele-border-lighter form-content" v-loading="loading">
  5. <search-quotation @search="reload"> </search-quotation>
  6. <!-- 数据表格 -->
  7. <ele-pro-table
  8. ref="table"
  9. :columns="columns"
  10. :datasource="datasource"
  11. height="calc(100vh - 375px)"
  12. full-height="calc(100vh - 116px)"
  13. tool-class="ele-toolbar-form"
  14. :selection.sync="selection"
  15. :page-size="20"
  16. @columns-change="handleColumnChange"
  17. :cache-key="cacheKeyUrl"
  18. >
  19. <!-- 表头工具栏 -->
  20. <template v-slot:toolbar v-if="!purchasePlanId">
  21. <el-button
  22. size="small"
  23. type="primary"
  24. icon="el-icon-plus"
  25. class="ele-btn-icon"
  26. @click="openEdit('add', {})"
  27. >
  28. 新建
  29. </el-button>
  30. <el-button
  31. size="small"
  32. type="primary"
  33. icon="el-icon-plus"
  34. class="ele-btn-icon"
  35. @click="addGenerateContract('')"
  36. :disabled="selection?.length === 0"
  37. >
  38. 生成合同
  39. </el-button>
  40. <el-button
  41. size="small"
  42. type="danger"
  43. el-icon-delete
  44. class="ele-btn-icon"
  45. @click="allDelBtn"
  46. >
  47. 批量删除
  48. </el-button>
  49. </template>
  50. <!-- 查看详情列 -->
  51. <template v-slot:inquiryCode="{ row }">
  52. <el-link type="primary" :underline="false" @click="openDetail(row)">
  53. {{ row.inquiryCode }}</el-link
  54. >
  55. </template>
  56. <!-- 查看详情列 -->
  57. <template v-slot:planCode="{ row }" v-if="!purchasePlanId">
  58. <el-link
  59. type="primary"
  60. :underline="false"
  61. @click="openPlanDetail(row)"
  62. >
  63. {{ row.planCode }}</el-link
  64. >
  65. </template>
  66. <!-- 状态 -->
  67. <template v-slot:status="{ row }">
  68. {{ getStatus(row.status) }}
  69. </template>
  70. <!-- 操作列 -->
  71. <template v-slot:action="{ row }">
  72. <el-link
  73. type="primary"
  74. :underline="false"
  75. icon="el-icon-edit"
  76. @click="openEdit('edit', row)"
  77. v-if="
  78. (isNeed_process_is_close && [0, 3].includes(row.status)) ||
  79. !isNeed_process_is_close
  80. "
  81. >
  82. 修改
  83. </el-link>
  84. <el-link
  85. type="primary"
  86. :underline="false"
  87. icon="el-icon-plus"
  88. @click="sub(row)"
  89. v-if="isNeed_process_is_close && [0, 3].includes(row.status)"
  90. >
  91. 提交
  92. </el-link>
  93. <el-link
  94. type="primary"
  95. :underline="false"
  96. icon="el-icon-plus"
  97. @click="addGenerateContract([row])"
  98. v-if="[2].includes(row.status)"
  99. >
  100. 生成合同
  101. </el-link>
  102. <el-popconfirm
  103. class="ele-action"
  104. title="确定要删除此信息吗?"
  105. @confirm="remove([row.id])"
  106. v-if="
  107. ([0, 3].includes(row.status) && isNeed_process_is_close) ||
  108. !isNeed_process_is_close
  109. "
  110. >
  111. <template v-slot:reference>
  112. <el-link type="danger" :underline="false" icon="el-icon-delete">
  113. 删除
  114. </el-link>
  115. </template>
  116. </el-popconfirm>
  117. </template>
  118. </ele-pro-table>
  119. </div>
  120. </el-card>
  121. <!-- <add-dialog ref="addDialogRef" @done="reload"></add-dialog>-->
  122. <detail-dialog ref="contactDetailDialogRef"></detail-dialog>
  123. <planDetaillog ref="planDetaillogRef"></planDetaillog>
  124. <!-- 多选删除弹窗 -->
  125. <pop-modal
  126. :visible.sync="delVisible"
  127. content="是否确定删除?"
  128. @done="commitBtn"
  129. />
  130. <addContractBookDialog
  131. ref="addContractBookDialogRef"
  132. :categoryTreeList="treeList"
  133. ></addContractBookDialog>
  134. <generate-contracts-dialog
  135. v-if="generateContractsDialogFlag"
  136. ref="generateContractsDialogRef"
  137. :generate-contracts-dialog-flag.sync="generateContractsDialogFlag"
  138. ></generate-contracts-dialog>
  139. <process-submit-dialog
  140. api-fun-name="purchaseinquiryStatusAPI"
  141. :processSubmitDialogFlag.sync="processSubmitDialogFlag"
  142. v-if="processSubmitDialogFlag"
  143. ref="processSubmitDialogRef"
  144. @reload="reload"
  145. ></process-submit-dialog>
  146. </div>
  147. </template>
  148. <script>
  149. import searchQuotation from './components/searchIndex.vue';
  150. import addDialog from './components/addDialog.vue';
  151. import generateContractsDialog from '@/views/purchasingManage/inquiryManage/components/generateContractsDialog.vue';
  152. import addContractBookDialog from '@/views/contractManage/contractBook/components/addDialog.vue';
  153. import detailDialog from './components/detailDialog.vue';
  154. import planDetaillog from '../../purchasingManage/purchasePlanManage/components/detailDialog.vue';
  155. import popModal from '@/components/pop-modal';
  156. import dictMixins from '@/mixins/dictMixins';
  157. import { contactTypeTree } from '@/api/saleManage/contact';
  158. import {
  159. getTableList,
  160. deleteInformation,
  161. generateContract
  162. } from '@/api/purchasingManage/inquiryManage';
  163. import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
  164. import tabMixins from '@/mixins/tableColumnsMixin';
  165. export default {
  166. mixins: [dictMixins, tabMixins],
  167. components: {
  168. processSubmitDialog,
  169. searchQuotation,
  170. popModal,
  171. addDialog,
  172. detailDialog,
  173. planDetaillog,
  174. addContractBookDialog,
  175. generateContractsDialog
  176. },
  177. props: {
  178. purchasePlanId: '',
  179. sonPurchasePlanIds: {
  180. type: Array,
  181. default: () => {
  182. return [];
  183. }
  184. }
  185. },
  186. data() {
  187. return {
  188. selection: [], //单选中集合
  189. delVisible: false, //批量删除弹框状态
  190. generateContractsDialogFlag: false,
  191. processSubmitDialogFlag: false,
  192. loading: false, // 加载状态
  193. treeList: [],
  194. columns: [
  195. {
  196. width: 45,
  197. type: 'selection',
  198. columnKey: 'selection',
  199. align: 'center'
  200. },
  201. {
  202. columnKey: 'index',
  203. label: '序号',
  204. type: 'index',
  205. width: 55,
  206. align: 'center',
  207. showOverflowTooltip: true,
  208. fixed: 'left'
  209. },
  210. {
  211. prop: 'inquiryCode',
  212. slot: 'inquiryCode',
  213. label: '采购询价编码',
  214. align: 'center',
  215. showOverflowTooltip: true,
  216. sortable: true,
  217. minWidth: 200
  218. },
  219. {
  220. prop: 'inquiryName',
  221. label: '采购询价名称',
  222. align: 'center',
  223. showOverflowTooltip: true,
  224. minWidth: 200
  225. },
  226. {
  227. prop: 'planCode',
  228. slot: 'planCode',
  229. label: '采购计划编码',
  230. align: 'center',
  231. showOverflowTooltip: true,
  232. sortable: true,
  233. minWidth: 200
  234. },
  235. {
  236. prop: 'planName',
  237. label: '采购计划名称',
  238. align: 'center',
  239. showOverflowTooltip: true,
  240. minWidth: 200
  241. },
  242. {
  243. prop: 'productNames',
  244. label: '产品名称',
  245. align: 'center',
  246. showOverflowTooltip: true,
  247. minWidth: 140
  248. },
  249. // {
  250. // prop: 'supplierNames',
  251. // label: '供应商名称',
  252. // align: 'center',
  253. // showOverflowTooltip: true,
  254. // minWidth: 200
  255. // },
  256. {
  257. prop: 'winnerSupples',
  258. label: '中标供应商',
  259. align: 'center',
  260. showOverflowTooltip: true,
  261. minWidth: 200
  262. },
  263. // {
  264. // prop: 'requireDeptName',
  265. // label: '需求部门',
  266. // align: 'center',
  267. // slot: 'requireDeptName',
  268. // showOverflowTooltip: true,
  269. // minWidth: 200
  270. // },
  271. // {
  272. // prop: 'requireUserName',
  273. // label: '需求人',
  274. // align: 'center',
  275. // showOverflowTooltip: true,
  276. // minWidth: 140
  277. // },
  278. // {
  279. // prop: 'responsibleName',
  280. // label: '负责人',
  281. // align: 'center',
  282. // showOverflowTooltip: true,
  283. // minWidth: 120
  284. // },
  285. // {
  286. // prop: 'detailCount',
  287. // label: '明细条数',
  288. // align: 'center',
  289. // showOverflowTooltip: true,
  290. // minWidth: 140
  291. // },
  292. // {
  293. // prop: 'finishDate',
  294. // label: '完成日期',
  295. // align: 'center',
  296. // showOverflowTooltip: true,
  297. // minWidth: 140
  298. // },
  299. {
  300. prop: 'createTime',
  301. label: '创建时间',
  302. align: 'center',
  303. showOverflowTooltip: true,
  304. minWidth: 180
  305. },
  306. {
  307. prop: 'status',
  308. label: '状态',
  309. align: 'center',
  310. slot: 'status',
  311. showOverflowTooltip: true,
  312. minWidth: 120
  313. },
  314. {
  315. prop: 'remark',
  316. label: '备注',
  317. align: 'center',
  318. showOverflowTooltip: true,
  319. minWidth: 170
  320. },
  321. {
  322. columnKey: 'action',
  323. label: '操作',
  324. width: 230,
  325. align: 'center',
  326. resizable: false,
  327. slot: 'action',
  328. showOverflowTooltip: true,
  329. fixed: 'right'
  330. }
  331. ],
  332. cacheKeyUrl: 'eos-151ba34e-inquiryManage'
  333. };
  334. },
  335. computed: {},
  336. created() {
  337. this.getTreeData();
  338. },
  339. methods: {
  340. /* 表格数据源 */
  341. datasource({ page, limit, where, order }) {
  342. if (this.purchasePlanId) {
  343. where['planId'] = this.purchasePlanId;
  344. }
  345. if(this.sonPurchasePlanIds){
  346. where['planIds'] = this.sonPurchasePlanIds;
  347. }
  348. return getTableList({
  349. pageNum: page,
  350. size: limit,
  351. ...where
  352. });
  353. },
  354. //获取合同分类
  355. async getTreeData() {
  356. try {
  357. this.treeLoading = true;
  358. const res = await contactTypeTree({ id: '20' });
  359. this.treeLoading = false;
  360. if (res?.code === '0') {
  361. this.treeList = res.data;
  362. return this.treeList;
  363. }
  364. } catch (error) {}
  365. this.treeLoading = false;
  366. },
  367. /* 刷新表格 */
  368. reload(where) {
  369. this.$refs.table.reload({ page: 1, where });
  370. },
  371. //新增合同
  372. async addGenerateContract(row = []) {
  373. let list = row.length ? row : this.selection;
  374. let { verify, text, ids, isOnly } = this.verify(list);
  375. if (!verify) {
  376. this.$message.warning(text);
  377. return;
  378. }
  379. if (isOnly) {
  380. let contractInfo = await generateContract({
  381. inquiryIds: ids,
  382. supplierId: list[0].winnerSuppleIds
  383. });
  384. contractInfo.contractVO.contractName = list[0].inquiryName;
  385. await this.$refs.addContractBookDialogRef.open(
  386. 'add',
  387. contractInfo,
  388. true,
  389. 'inquiryManage'
  390. );
  391. } else {
  392. this.generateContractsDialogFlag = true;
  393. this.$nextTick(() => {
  394. this.$refs.generateContractsDialogRef.open(...list);
  395. });
  396. }
  397. },
  398. //新增编辑
  399. openEdit(type, row) {
  400. // this.$refs.addDialogRef.open(type, row, row.id);
  401. // this.$refs.addDialogRef.$refs.form &&
  402. // this.$refs.addDialogRef.$refs.form.clearValidate();
  403. this.$router.push({
  404. path: '/purchasingManage/inquiryManage/components/addDialog',
  405. query: {
  406. id: row.id ? row.id : null,
  407. type,
  408. t: new Date().getTime()
  409. }
  410. });
  411. },
  412. //批量删除
  413. allDelBtn() {
  414. if (this.selection.length === 0) return;
  415. let flag = this.selection.some((item) => [1, 2].includes(item.status));
  416. if (flag)
  417. return this.$message.warning(
  418. '抱歉已审核、审核中的数据不能删除,请检查'
  419. );
  420. this.delVisible = true;
  421. },
  422. //删除接口
  423. remove(delData) {
  424. deleteInformation(delData).then((res) => {
  425. this.$message.success('删除成功!');
  426. this.reload();
  427. });
  428. },
  429. //删除弹框确定
  430. commitBtn() {
  431. const dataId = this.selection.map((v) => v.id);
  432. this.remove(dataId);
  433. },
  434. //查看详情
  435. openDetail(row) {
  436. this.$refs.contactDetailDialogRef.open(row);
  437. },
  438. //查看详情
  439. openPlanDetail(row) {
  440. this.$refs.planDetaillogRef.open(row);
  441. },
  442. // 合同验证
  443. verify(list) {
  444. console.log(list);
  445. let verify = true;
  446. let text = '';
  447. let ids = [];
  448. let isOnly = true;
  449. if (list.length == 0) {
  450. verify = false;
  451. text = '请至少选择一条数据';
  452. }
  453. if (list.length > 1) {
  454. if (list.some((item) => item.winnerSuppleIds.split(',').length > 1)) {
  455. verify = false;
  456. text = '多核价单且含有多个核价清单的数据不允许批量生成合同';
  457. } else if (
  458. list.some(
  459. (item) =>
  460. !item.winnerSuppleIds.split(',').filter((item) => item).length
  461. )
  462. ) {
  463. verify = false;
  464. text = '所选核价单中标供应商为空';
  465. } else if (
  466. list.some(
  467. (item) =>
  468. this.selection[0].winnerSuppleIds !== item.winnerSuppleIds
  469. )
  470. ) {
  471. verify = false;
  472. text = '所选核价单中标供应商不一致';
  473. } else {
  474. isOnly = true;
  475. }
  476. } else {
  477. isOnly =
  478. list[0].winnerSuppleIds.split(',').filter((item) => item).length ==
  479. 1;
  480. if (
  481. !list[0].winnerSuppleIds.split(',').filter((item) => item).length
  482. ) {
  483. verify = false;
  484. text = '核价单中标供应商为空';
  485. }
  486. }
  487. if (verify) {
  488. ids = list.map((item) => item.id);
  489. }
  490. return { verify, text, ids, isOnly };
  491. },
  492. sub(res) {
  493. this.processSubmitDialogFlag = true;
  494. this.$nextTick(() => {
  495. let params = {
  496. businessId: res.id,
  497. businessKey: 'purchase_inquiry_approve',
  498. formCreateUserId: res.createUserId,
  499. variables: {
  500. businessCode: res.inquiryCode,
  501. businessName: res.inquiryName,
  502. businessType: '采购核价'
  503. }
  504. // callBackMethodType : '1',
  505. // callBackMethod : 'proTargetPlanApproveApiImpl.updatePlanApprovalStatus',
  506. // pcHandle : '/bpm/handleTask/components/project-manage/plan-manage/submit.vue',
  507. // pcView : '/bpm/handleTask/components/project-manage/plan-manage/detailDialog.vue',
  508. // miniHandle : '',
  509. // miniView : '',
  510. };
  511. this.$refs.processSubmitDialogRef.init(params);
  512. });
  513. // submit({
  514. // businessId: res.id
  515. // })
  516. // .then((res) => {
  517. // this.$message.success('提交成功');
  518. // this.reload();
  519. // })
  520. // .catch((e) => {
  521. // this.$message.error(e.message);
  522. // });
  523. },
  524. //获取状态
  525. getStatus(status) {
  526. return status == 0
  527. ? '未提交'
  528. : status == 1
  529. ? '审核中'
  530. : status == 2
  531. ? '审核通过'
  532. : status == 3
  533. ? '审核不通过'
  534. : '';
  535. }
  536. }
  537. };
  538. </script>
  539. <style lang="scss" scoped>
  540. :deep(.el-link--inner) {
  541. margin-left: 0px !important;
  542. }
  543. .sys-organization-list {
  544. height: calc(100vh - 264px);
  545. box-sizing: border-box;
  546. border-width: 1px;
  547. border-style: solid;
  548. overflow: auto;
  549. }
  550. .sys-organization-list :deep(.el-tree-node__content) {
  551. height: 40px;
  552. & > .el-tree-node__expand-icon {
  553. margin-left: 10px;
  554. }
  555. }
  556. </style>