index.vue 16 KB

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