index.vue 15 KB

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