index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <ele-split-layout
  5. :width="contactData?.id || businessOpportunityData?.id ? '0' : '210px'"
  6. allow-collapse
  7. :right-style="{ overflow: 'hidden' }"
  8. >
  9. <div>
  10. <div class="ele-border-lighter sys-organization-list">
  11. <AssetTree
  12. @handleNodeClick="handleNodeClick"
  13. id="20"
  14. :isFirstRefreshTable="false"
  15. ref="treeList"
  16. />
  17. </div>
  18. </div>
  19. <template v-slot:content>
  20. <div class="ele-border-lighter form-content" v-loading="loading">
  21. <search-contract @search="reload"></search-contract>
  22. <!-- 数据表格 -->
  23. <ele-pro-table
  24. ref="table"
  25. :columns="columns"
  26. :datasource="datasource"
  27. height="calc(100vh - 375px)"
  28. full-height="calc(100vh - 116px)"
  29. tool-class="ele-toolbar-form"
  30. :selection.sync="selection"
  31. :page-size="20"
  32. @columns-change="handleColumnChange"
  33. :cache-key="cacheKeyUrl"
  34. >
  35. <!-- 表头工具栏 -->
  36. <template v-slot:toolbar>
  37. <div class="flex-end">
  38. <div>
  39. <el-button
  40. size="small"
  41. type="primary"
  42. icon="el-icon-plus"
  43. class="ele-btn-icon"
  44. @click="openEdit('add', {})"
  45. >
  46. 新建
  47. </el-button>
  48. <el-button
  49. size="small"
  50. type="danger"
  51. el-icon-delete
  52. class="ele-btn-icon"
  53. @click="allDelBtn"
  54. :disabled="selection?.length === 0"
  55. >
  56. 批量删除
  57. </el-button>
  58. <!-- <el-button
  59. type="primary"
  60. size="small"
  61. icon="el-icon-upload2"
  62. @click="uploadFile"
  63. >导入</el-button
  64. > -->
  65. <!-- v-if="$hasPermission('eom:contract:import')" -->
  66. </div>
  67. <div class="title">
  68. 合同总金额:{{ extInfo.contractTotalPrice }}元
  69. </div>
  70. </div>
  71. </template>
  72. <!-- 查看详情列 -->
  73. <template v-slot:contractName="{ row }">
  74. <el-link
  75. type="primary"
  76. :underline="false"
  77. @click="openDetail(row)"
  78. >
  79. {{ row.contractName }}
  80. </el-link>
  81. </template>
  82. <!-- 操作列 -->
  83. <template v-slot:action="{ row }">
  84. <el-link
  85. type="primary"
  86. v-if="
  87. (isNeed_process_is_close && [0, 3].includes(row.status)) ||
  88. !isNeed_process_is_close
  89. "
  90. :underline="false"
  91. icon="el-icon-edit"
  92. @click="openEdit('edit', row)"
  93. >
  94. 修改
  95. </el-link>
  96. <el-link
  97. type="primary"
  98. v-if="isNeed_process_is_close && [0, 3].includes(row.status)"
  99. :underline="false"
  100. icon="el-icon-plus"
  101. @click="contractBookSubmit(row)"
  102. >
  103. 提交
  104. </el-link>
  105. <!-- 销售订单 -->
  106. <el-link
  107. type="primary"
  108. v-if="
  109. [2].includes(row.status) &&
  110. !row.hasGeneratedOrder &&
  111. row.type == 1
  112. "
  113. :underline="false"
  114. icon="el-icon-plus"
  115. @click="handleGenerateOrder(row)"
  116. >
  117. 生成订单
  118. </el-link>
  119. <!-- 采购订单 -->
  120. <el-link
  121. type="primary"
  122. v-if="
  123. [2].includes(row.status) &&
  124. row.type == 2 &&
  125. ((isAddPurchaseOrder == 1 && !row.hasGeneratedOrder) ||
  126. isAddPurchaseOrder == 0)
  127. "
  128. :underline="false"
  129. icon="el-icon-plus"
  130. @click="handleGenerateOrder(row)"
  131. >
  132. 生成订单
  133. </el-link>
  134. <el-link
  135. type="primary"
  136. v-if="[2].includes(row.status) && !row.hasInvoiceApply"
  137. :underline="false"
  138. icon="el-icon-plus"
  139. @click="invoiceManage(row)"
  140. >
  141. 新增发票
  142. </el-link>
  143. <jimureport
  144. v-if="
  145. [2].includes(row.status) &&
  146. $hasPermission('eom:contractBook:print')
  147. "
  148. :businessId="row.id"
  149. businessCode="erpcontractprint"
  150. style="margin-left: 5px"
  151. ></jimureport>
  152. <el-popconfirm
  153. v-if="
  154. (isNeed_process_is_close && [0, 3].includes(row.status)) ||
  155. !isNeed_process_is_close
  156. "
  157. class="ele-action"
  158. title="确定要删除此信息吗?"
  159. @confirm="remove([row.id])"
  160. >
  161. <template v-slot:reference>
  162. <el-link
  163. type="danger"
  164. :underline="false"
  165. icon="el-icon-delete"
  166. >
  167. 删除
  168. </el-link>
  169. </template>
  170. </el-popconfirm>
  171. </template>
  172. </ele-pro-table>
  173. </div>
  174. </template>
  175. </ele-split-layout>
  176. </el-card>
  177. <add-dialog
  178. ref="addDialogRef"
  179. @done="reload"
  180. :categoryTreeList="treeList"
  181. :contactData="contactData"
  182. :businessOpportunityData="businessOpportunityData"
  183. :curNodeData="curNodeData"
  184. :isRequired="isRequired"
  185. ></add-dialog>
  186. <detail-dialog ref="contactDetailDialogRef"></detail-dialog>
  187. <!-- 多选删除弹窗 -->
  188. <pop-modal
  189. :visible.sync="delVisible"
  190. content="是否确定删除?"
  191. @done="commitBtn"
  192. />
  193. <saleOrderAddDialog
  194. ref="saleOrderAddDialogRef"
  195. @done="reload"
  196. ></saleOrderAddDialog>
  197. <supplierAddDialog
  198. ref="supplierAddDialogRef"
  199. @done="reload"
  200. ></supplierAddDialog>
  201. <autogenerate-dialog
  202. ref="autogenerateDialogRef"
  203. @handleSubmit="saleOrderSubmit"
  204. @reload="reload"
  205. ></autogenerate-dialog>
  206. <process-submit-dialog
  207. api-fun-name="contractStatusAPI"
  208. :processSubmitDialogFlag.sync="processSubmitDialogFlag"
  209. v-if="processSubmitDialogFlag"
  210. ref="processSubmitDialogRef"
  211. @reload="reload"
  212. ></process-submit-dialog>
  213. <addInvoiceManage
  214. :add-or-edit-dialog-flag.sync="addOrEditDialogFlag"
  215. ref="addOrEditDialogRef"
  216. v-if="addOrEditDialogFlag"
  217. @reload="reload"
  218. ></addInvoiceManage>
  219. <importDialog
  220. ref="importDialogRef"
  221. @success="reload"
  222. :fileUrl="'/eom/contract/importTemplate'"
  223. :isWeb="false"
  224. fileName="合同台账导入模板"
  225. apiUrl="/eom/contract/importFile"
  226. />
  227. </div>
  228. </template>
  229. <script>
  230. import searchContract from './components/searchContract.vue';
  231. import addDialog from './components/addDialog.vue';
  232. import detailDialog from './components/detailDialog.vue';
  233. import popModal from '@/components/pop-modal';
  234. import jimureport from '@/components/jimureport/browseModal.vue';
  235. import AssetTree from '@/components/AssetTree';
  236. import { reviewStatus } from '@/enum/dict';
  237. import { contactTypeTree } from '@/api/saleManage/contact';
  238. import saleOrderAddDialog from '@/views/saleManage/saleOrder/components/addDialog.vue';
  239. import supplierAddDialog from '@/views/purchasingManage/purchaseOrder/components/addDialog.vue';
  240. import { submit as saleOrderSubmitAPI } from '@/api/saleManage/saleorder';
  241. import tabMixins from '@/mixins/tableColumnsMixin';
  242. import {
  243. getTableList,
  244. deleteInformation,
  245. batchSubmitAPI
  246. } from '@/api/contractManage/contractBook';
  247. import dictMixins from '@/mixins/dictMixins';
  248. import autogenerateDialog from '@/BIZComponents/autogenerateDialog.vue';
  249. import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
  250. import addInvoiceManage from '@/views/financialManage/invoiceManage/components/addOrEditDialog.vue';
  251. import { parameterGetByCode } from '@/api/main/index.js';
  252. import importDialog from '@/components/upload/import-dialog.vue';
  253. export default {
  254. mixins: [dictMixins, tabMixins],
  255. components: {
  256. processSubmitDialog,
  257. autogenerateDialog,
  258. AssetTree,
  259. searchContract,
  260. popModal,
  261. addDialog,
  262. detailDialog,
  263. saleOrderAddDialog,
  264. supplierAddDialog,
  265. addInvoiceManage,
  266. jimureport,
  267. importDialog
  268. },
  269. //客户管理数据
  270. props: {
  271. contactData: {
  272. type: Object,
  273. default: () => {
  274. return {};
  275. }
  276. },
  277. businessOpportunityData: {
  278. type: Object,
  279. default: () => {
  280. return {};
  281. }
  282. }
  283. },
  284. data() {
  285. return {
  286. selection: [], //单选中集合
  287. delVisible: false, //批量删除弹框状态
  288. loading: false, // 加载状态
  289. processSubmitDialogFlag: false,
  290. addOrEditDialogFlag: false,
  291. treeList: [], //左边分类数据
  292. extInfo: {},
  293. isAddPurchaseOrder: 0,
  294. columns: [
  295. {
  296. width: 45,
  297. type: 'selection',
  298. columnKey: 'selection',
  299. align: 'center'
  300. },
  301. {
  302. columnKey: 'index',
  303. label: '序号',
  304. type: 'index',
  305. width: 55,
  306. align: 'center',
  307. showOverflowTooltip: true,
  308. fixed: 'left'
  309. },
  310. {
  311. prop: 'contractName',
  312. label: '合同名称',
  313. align: 'center',
  314. slot: 'contractName',
  315. showOverflowTooltip: true,
  316. minWidth: 200
  317. },
  318. {
  319. prop: 'categoryName',
  320. label: '合同分类',
  321. align: 'center',
  322. showOverflowTooltip: true,
  323. minWidth: 140
  324. },
  325. {
  326. prop: 'dversion',
  327. label: '版本号',
  328. align: 'center',
  329. showOverflowTooltip: true,
  330. minWidth: 80
  331. },
  332. {
  333. prop: 'productNames',
  334. label: '产品名称',
  335. align: 'center',
  336. showOverflowTooltip: true,
  337. minWidth: 140
  338. },
  339. {
  340. prop: 'partaName',
  341. label: '甲方名称',
  342. align: 'center',
  343. showOverflowTooltip: true,
  344. minWidth: 150
  345. },
  346. {
  347. prop: 'partaLinkName',
  348. label: '甲方联系人',
  349. align: 'center',
  350. showOverflowTooltip: true,
  351. minWidth: 130
  352. },
  353. {
  354. prop: 'partaTel',
  355. label: '甲方联系电话',
  356. align: 'center',
  357. showOverflowTooltip: true,
  358. minWidth: 130
  359. },
  360. {
  361. prop: 'partbName',
  362. label: '乙方名称',
  363. align: 'center',
  364. showOverflowTooltip: true,
  365. minWidth: 130
  366. },
  367. {
  368. prop: 'partbLinkName',
  369. label: '乙方联系人',
  370. align: 'center',
  371. showOverflowTooltip: true,
  372. minWidth: 130
  373. },
  374. {
  375. prop: 'partbTel',
  376. label: '乙方联系电话',
  377. align: 'center',
  378. showOverflowTooltip: true,
  379. minWidth: 130
  380. },
  381. {
  382. prop: 'contractNo',
  383. label: '编码',
  384. align: 'center',
  385. showOverflowTooltip: true,
  386. minWidth: 170
  387. },
  388. {
  389. prop: 'contractNumber',
  390. label: '合同编号',
  391. align: 'center',
  392. showOverflowTooltip: true,
  393. minWidth: 200
  394. },
  395. {
  396. prop: 'enabled',
  397. label: '是否可用',
  398. align: 'center',
  399. showOverflowTooltip: true,
  400. minWidth: 140,
  401. formatter: (_row, _column, cellValue) => {
  402. return _row.enabled ? '是' : '否';
  403. }
  404. },
  405. {
  406. prop: 'contractStartDate',
  407. label: '签订日期',
  408. align: 'center',
  409. showOverflowTooltip: true,
  410. minWidth: 140
  411. },
  412. {
  413. prop: 'contractEndDate',
  414. label: '结束日期',
  415. align: 'center',
  416. showOverflowTooltip: true,
  417. minWidth: 140
  418. },
  419. {
  420. prop: 'receiptPaymentType',
  421. label: '收付款类型',
  422. align: 'center',
  423. showOverflowTooltip: true,
  424. minWidth: 130,
  425. formatter: (_row, _column, cellValue) => {
  426. return _row.receiptPaymentType == 1 ? '固定' : '分期';
  427. }
  428. },
  429. {
  430. prop: 'discountTotalPrice',
  431. label: '合同总金额',
  432. align: 'center',
  433. showOverflowTooltip: true,
  434. minWidth: 130
  435. },
  436. {
  437. prop: 'status',
  438. label: '审核状态',
  439. align: 'center',
  440. showOverflowTooltip: true,
  441. minWidth: 100,
  442. formatter: (_row, _column, cellValue) => {
  443. return reviewStatus[_row.status];
  444. }
  445. },
  446. {
  447. prop: 'createUsername',
  448. label: '创建人',
  449. align: 'center',
  450. showOverflowTooltip: true,
  451. minWidth: 120
  452. },
  453. {
  454. prop: 'createTime',
  455. label: '创建时间',
  456. align: 'center',
  457. showOverflowTooltip: true,
  458. minWidth: 150
  459. },
  460. {
  461. columnKey: 'action',
  462. label: '操作',
  463. width: 250,
  464. align: 'center',
  465. resizable: false,
  466. slot: 'action',
  467. showOverflowTooltip: true,
  468. fixed: 'right'
  469. }
  470. ],
  471. cacheKeyUrl: 'eos-2310d377-contract-contractBook',
  472. curNodeData: {},
  473. isRequired: true
  474. };
  475. },
  476. computed: {},
  477. created() {
  478. this.requestDict('客户状态');
  479. this.getTreeData();
  480. parameterGetByCode({
  481. code: 'order_person_info'
  482. }).then((res) => {
  483. if (res.value) {
  484. this.isRequired = res.value === '1';
  485. }
  486. });
  487. parameterGetByCode({
  488. code: 'eom_contractBook_add_purchaseOrder'
  489. }).then((res) => {
  490. if (res.value) {
  491. this.isAddPurchaseOrder = res.value || 0;
  492. }
  493. });
  494. if (this.$route.query.isView) {
  495. this.$nextTick(() => {
  496. this.openDetail({
  497. id: this.$route.query.id
  498. });
  499. const url = new URL(window.location.href);
  500. url.search = ''; // 清空查询参数
  501. window.history.pushState({}, '', url.href);
  502. });
  503. }
  504. },
  505. methods: {
  506. //点击左边分类
  507. handleNodeClick(data, node) {
  508. if (node.level != 1) {
  509. this.curNodeData = data;
  510. this.curNodeData.level = node.level;
  511. this.curNodeData['parentCode'] =
  512. node.level == 3 ? node.parent.data.code : '';
  513. }
  514. this.reload({ categoryId: data.id });
  515. },
  516. /* 表格数据源 */
  517. async datasource({ page, limit, where, order }) {
  518. if (this.businessOpportunityData.id) {
  519. where['opportunityId'] = this.businessOpportunityData.id;
  520. }
  521. if (this.contactData.id) {
  522. where['contactId'] = this.contactData.id;
  523. }
  524. const data = await getTableList({
  525. pageNum: page,
  526. size: limit,
  527. ...where
  528. });
  529. this.extInfo = data.extInfo;
  530. return data;
  531. },
  532. //获取左边分类
  533. async getTreeData() {
  534. try {
  535. this.treeLoading = true;
  536. const res = await contactTypeTree({ id: '20' });
  537. this.treeLoading = false;
  538. if (res?.code === '0') {
  539. this.treeList = res.data;
  540. return this.treeList;
  541. }
  542. } catch (error) {}
  543. this.treeLoading = false;
  544. },
  545. /* 刷新表格 */
  546. reload(where) {
  547. this.$refs.table.reload({ page: 1, where });
  548. },
  549. invoiceManage(row) {
  550. this.addOrEditDialogFlag = true;
  551. this.$nextTick(() => {
  552. this.$refs.addOrEditDialogRef.createInvoice1(row, row.type, 2);
  553. });
  554. },
  555. //新增编辑
  556. openEdit(type, row) {
  557. this.$refs.addDialogRef.open(type, row);
  558. this.$refs.addDialogRef.$refs.form &&
  559. this.$refs.addDialogRef.$refs.form.clearValidate();
  560. },
  561. //批量删除
  562. allDelBtn() {
  563. if (this.selection.length === 0) return;
  564. let flag = this.selection.some((item) => [1, 2].includes(item.status));
  565. if (flag)
  566. return this.$message.warning(
  567. '抱歉已审核、审核中的数据不能删除,请检查'
  568. );
  569. this.delVisible = true;
  570. },
  571. //删除接口
  572. remove(delData) {
  573. deleteInformation(delData).then((res) => {
  574. this.$message.success('删除成功!');
  575. this.reload();
  576. });
  577. },
  578. //删除弹框确定
  579. commitBtn() {
  580. const dataId = this.selection.map((v) => v.id);
  581. this.remove(dataId);
  582. },
  583. contractBookSubmit(res) {
  584. this.processSubmitDialogFlag = true;
  585. let key =
  586. res.type == 1 ? 'sales_contract_approve' : 'contract_approve_2';
  587. this.$nextTick(() => {
  588. let params = {
  589. businessId: res.id,
  590. businessKey: key,
  591. formCreateUserId: res.createUserId,
  592. variables: {
  593. businessType: res.categoryName,
  594. businessCode: res.contractNumber,
  595. businessName: res.contractName
  596. }
  597. };
  598. this.$refs.processSubmitDialogRef.init(params);
  599. });
  600. // submit({
  601. // businessId: res.id,
  602. // businessType: res.type
  603. // }).then((res) => {
  604. // this.$message.success('提交成功!');
  605. // this.reload();
  606. // });
  607. },
  608. contractBatchSubmit() {
  609. if (this.selection.some((item) => ![0, 3].includes(item.status)))
  610. return this.$message.warning(
  611. '审核中、已提交数据不能再次提交,请检查'
  612. );
  613. let arr = this.selection.map((item) => {
  614. return {
  615. businessId: item.id,
  616. businessType: item.type
  617. };
  618. });
  619. batchSubmitAPI(arr).then((res) => {
  620. this.$message.success('提交成功!');
  621. this.reload();
  622. });
  623. },
  624. //
  625. handleGenerateOrder(row) {
  626. //1销售2是采购
  627. let refName =
  628. row.type == '1' ? 'saleOrderAddDialogRef' : 'supplierAddDialogRef';
  629. this.$refs[refName].contractOpen(row);
  630. this.$refs[refName].$refs.form &&
  631. this.$refs[refName].$refs.form.clearValidate();
  632. },
  633. //销售订单审批
  634. saleOrderSubmit(id) {
  635. saleOrderSubmitAPI({
  636. businessId: id
  637. }).then(() => {
  638. this.$refs.saleOrderAddDialogRef &&
  639. this.$refs.saleOrderAddDialogRef.cancel();
  640. this.$message.success('提交成功');
  641. this.reload();
  642. });
  643. },
  644. //查看详情
  645. openDetail(row) {
  646. this.$refs.contactDetailDialogRef.open(row);
  647. },
  648. uploadFile() {
  649. this.$refs.importDialogRef.open();
  650. },
  651. }
  652. };
  653. </script>
  654. <style lang="scss" scoped>
  655. :deep(.el-link--inner) {
  656. margin-left: 0px !important;
  657. }
  658. .sys-organization-list {
  659. height: calc(100vh - 225px);
  660. box-sizing: border-box;
  661. border-width: 1px;
  662. border-style: solid;
  663. overflow: auto;
  664. }
  665. .sys-organization-list :deep(.el-tree-node__content) {
  666. height: 40px;
  667. & > .el-tree-node__expand-icon {
  668. margin-left: 10px;
  669. }
  670. }
  671. .flex-end {
  672. display: flex;
  673. align-items: center;
  674. .title {
  675. font-size: 14px;
  676. flex: 1;
  677. display: flex;
  678. padding-right: 20px;
  679. justify-content: flex-end;
  680. }
  681. }
  682. </style>