index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  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' : '300px'"
  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
  22. @search="reload"
  23. :contactData="contactData"
  24. ></search-contract>
  25. <!-- 数据表格 -->
  26. <ele-pro-table
  27. ref="table"
  28. :columns="columns"
  29. :datasource="datasource"
  30. height="calc(100vh - 375px)"
  31. full-height="calc(100vh - 116px)"
  32. tool-class="ele-toolbar-form"
  33. :selection.sync="selection"
  34. cache-key="eomContactPageTable"
  35. >
  36. <!-- 表头工具栏 -->
  37. <template v-slot:toolbar>
  38. <el-button
  39. size="small"
  40. type="primary"
  41. icon="el-icon-plus"
  42. class="ele-btn-icon"
  43. @click="openEdit('add', {})"
  44. >
  45. 新建
  46. </el-button>
  47. <el-button
  48. size="small"
  49. type="danger"
  50. el-icon-delete
  51. class="ele-btn-icon"
  52. @click="allDelBtn"
  53. :disabled="selection?.length === 0"
  54. >
  55. 批量删除
  56. </el-button>
  57. <!-- <el-button-->
  58. <!-- size="small"-->
  59. <!-- type="primary"-->
  60. <!-- class="ele-btn-icon"-->
  61. <!-- @click="contractBatchSubmit"-->
  62. <!-- :disabled="selection?.length === 0"-->
  63. <!-- >-->
  64. <!-- 批量提交-->
  65. <!-- </el-button>-->
  66. </template>
  67. <!-- 查看详情列 -->
  68. <template v-slot:contractName="{ row }">
  69. <el-link
  70. type="primary"
  71. :underline="false"
  72. @click="openDetail(row)"
  73. >
  74. {{ row.contractName }}
  75. </el-link>
  76. </template>
  77. <!-- 操作列 -->
  78. <template v-slot:action="{ row }">
  79. <el-link
  80. type="primary"
  81. v-if="(isNeed_process_is_close&&[0, 3].includes(row.status))||!isNeed_process_is_close"
  82. :underline="false"
  83. icon="el-icon-edit"
  84. @click="openEdit('edit', row)"
  85. >
  86. 修改
  87. </el-link>
  88. <el-link
  89. type="primary"
  90. v-if="isNeed_process_is_close&&[0, 3].includes(row.status)"
  91. :underline="false"
  92. icon="el-icon-plus"
  93. @click="contractBookSubmit(row)"
  94. >
  95. 提交
  96. </el-link>
  97. <el-link
  98. type="primary"
  99. v-if="[2].includes(row.status) && !row.hasGeneratedOrder"
  100. :underline="false"
  101. icon="el-icon-plus"
  102. @click="handleGenerateOrder(row)"
  103. >
  104. 生成订单
  105. </el-link>
  106. <el-popconfirm
  107. v-if="(isNeed_process_is_close&&[0, 3].includes(row.status))||!isNeed_process_is_close"
  108. class="ele-action"
  109. title="确定要删除此信息吗?"
  110. @confirm="remove([row.id])"
  111. >
  112. <template v-slot:reference>
  113. <el-link
  114. type="danger"
  115. :underline="false"
  116. icon="el-icon-delete"
  117. >
  118. 删除
  119. </el-link>
  120. </template>
  121. </el-popconfirm>
  122. </template>
  123. </ele-pro-table>
  124. </div>
  125. </template>
  126. </ele-split-layout>
  127. </el-card>
  128. <add-dialog
  129. ref="addDialogRef"
  130. @done="reload"
  131. :categoryTreeList="treeList"
  132. :contactData="contactData"
  133. :businessOpportunityData="businessOpportunityData"
  134. ></add-dialog>
  135. <detail-dialog ref="contactDetailDialogRef"></detail-dialog>
  136. <!-- 多选删除弹窗 -->
  137. <pop-modal
  138. :visible.sync="delVisible"
  139. content="是否确定删除?"
  140. @done="commitBtn"
  141. />
  142. <saleOrderAddDialog
  143. ref="saleOrderAddDialogRef"
  144. @done="reload"
  145. ></saleOrderAddDialog>
  146. <supplierAddDialog
  147. ref="supplierAddDialogRef"
  148. @done="reload"
  149. ></supplierAddDialog>
  150. <autogenerate-dialog
  151. ref="autogenerateDialogRef"
  152. @handleSubmit="saleOrderSubmit"
  153. @reload="reload"
  154. ></autogenerate-dialog>
  155. <process-submit-dialog api-fun-name="contractStatusAPI" :processSubmitDialogFlag.sync="processSubmitDialogFlag" v-if="processSubmitDialogFlag" ref="processSubmitDialogRef" @reload="reload"></process-submit-dialog>
  156. </div>
  157. </template>
  158. <script>
  159. import searchContract from './components/searchContract.vue';
  160. import addDialog from './components/addDialog.vue';
  161. import detailDialog from './components/detailDialog.vue';
  162. import popModal from '@/components/pop-modal';
  163. import AssetTree from '@/components/AssetTree';
  164. import { reviewStatus } from '@/enum/dict';
  165. import { contactTypeTree } from '@/api/saleManage/contact';
  166. import saleOrderAddDialog from '@/views/saleManage/saleOrder/components/addDialog.vue';
  167. import supplierAddDialog from '@/views/purchasingManage/purchaseOrder/components/addDialog.vue';
  168. import { submit as saleOrderSubmitAPI } from '@/api/saleManage/saleorder';
  169. import {
  170. getTableList,
  171. submit,
  172. deleteInformation,
  173. batchSubmitAPI
  174. } from '@/api/contractManage/contractBook';
  175. import dictMixins from '@/mixins/dictMixins';
  176. import autogenerateDialog from '@/BIZComponents/autogenerateDialog.vue';
  177. import processSubmitDialog from "@/BIZComponents/processSubmitDialog/processSubmitDialog.vue";
  178. export default {
  179. mixins: [dictMixins],
  180. components: {
  181. processSubmitDialog,
  182. autogenerateDialog,
  183. AssetTree,
  184. searchContract,
  185. popModal,
  186. addDialog,
  187. detailDialog,
  188. saleOrderAddDialog,
  189. supplierAddDialog
  190. },
  191. //客户管理数据
  192. props: {
  193. contactData: {
  194. type: Object,
  195. default: () => {
  196. return {};
  197. }
  198. },
  199. businessOpportunityData: {
  200. type: Object,
  201. default: () => {
  202. return {};
  203. }
  204. }
  205. },
  206. data() {
  207. return {
  208. selection: [], //单选中集合
  209. delVisible: false, //批量删除弹框状态
  210. loading: false, // 加载状态
  211. processSubmitDialogFlag: false,
  212. treeList: [], //左边分类数据
  213. columns: [
  214. {
  215. width: 45,
  216. type: 'selection',
  217. columnKey: 'selection',
  218. align: 'center'
  219. },
  220. {
  221. columnKey: 'index',
  222. label: '序号',
  223. type: 'index',
  224. width: 55,
  225. align: 'center',
  226. showOverflowTooltip: true,
  227. fixed: 'left'
  228. },
  229. {
  230. prop: 'contractName',
  231. label: '合同名称',
  232. align: 'center',
  233. slot: 'contractName',
  234. showOverflowTooltip: true,
  235. minWidth: 200
  236. },
  237. {
  238. prop: 'categoryName',
  239. label: '合同分类',
  240. align: 'center',
  241. showOverflowTooltip: true,
  242. minWidth: 140
  243. },
  244. {
  245. prop: 'productNames',
  246. label: '产品名称',
  247. align: 'center',
  248. showOverflowTooltip: true,
  249. minWidth: 140
  250. },
  251. {
  252. prop: 'partaName',
  253. label: '甲方名称',
  254. align: 'center',
  255. showOverflowTooltip: true,
  256. minWidth: 150
  257. },
  258. {
  259. prop: 'partaLinkName',
  260. label: '甲方联系人',
  261. align: 'center',
  262. showOverflowTooltip: true,
  263. minWidth: 130
  264. },
  265. {
  266. prop: 'partaTel',
  267. label: '甲方联系电话',
  268. align: 'center',
  269. showOverflowTooltip: true,
  270. minWidth: 130
  271. },
  272. {
  273. prop: 'partbName',
  274. label: '乙方名称',
  275. align: 'center',
  276. showOverflowTooltip: true,
  277. minWidth: 130
  278. },
  279. {
  280. prop: 'partbLinkName',
  281. label: '乙方联系人',
  282. align: 'center',
  283. showOverflowTooltip: true,
  284. minWidth: 130
  285. },
  286. {
  287. prop: 'partbTel',
  288. label: '乙方联系电话',
  289. align: 'center',
  290. showOverflowTooltip: true,
  291. minWidth: 130
  292. },
  293. {
  294. prop: 'contractNo',
  295. label: '编码',
  296. align: 'center',
  297. showOverflowTooltip: true,
  298. minWidth: 170
  299. },
  300. {
  301. prop: 'contractNumber',
  302. label: '合同编号',
  303. align: 'center',
  304. showOverflowTooltip: true,
  305. minWidth: 200
  306. },
  307. {
  308. prop: 'enabled',
  309. label: '是否可用',
  310. align: 'center',
  311. showOverflowTooltip: true,
  312. minWidth: 140,
  313. formatter: (_row, _column, cellValue) => {
  314. return _row.enabled ? '是' : '否';
  315. }
  316. },
  317. {
  318. prop: 'contractStartDate',
  319. label: '签订日期',
  320. align: 'center',
  321. showOverflowTooltip: true,
  322. minWidth: 140
  323. },
  324. {
  325. prop: 'contractEndDate',
  326. label: '结束日期',
  327. align: 'center',
  328. showOverflowTooltip: true,
  329. minWidth: 140
  330. },
  331. {
  332. prop: 'receiptPaymentType',
  333. label: '收付款类型',
  334. align: 'center',
  335. showOverflowTooltip: true,
  336. minWidth: 130,
  337. formatter: (_row, _column, cellValue) => {
  338. return _row.receiptPaymentType == 1 ? '固定' : '分期';
  339. }
  340. },
  341. {
  342. prop: 'totalPrice',
  343. label: '合同总金额',
  344. align: 'center',
  345. showOverflowTooltip: true,
  346. minWidth: 130
  347. },
  348. {
  349. prop: 'status',
  350. label: '审核状态',
  351. align: 'center',
  352. showOverflowTooltip: true,
  353. minWidth: 100,
  354. formatter: (_row, _column, cellValue) => {
  355. return reviewStatus[_row.status];
  356. }
  357. },
  358. {
  359. prop: 'createUserName',
  360. label: '创建人',
  361. align: 'center',
  362. showOverflowTooltip: true,
  363. minWidth: 80
  364. },
  365. {
  366. prop: 'createTime',
  367. label: '创建时间',
  368. align: 'center',
  369. showOverflowTooltip: true,
  370. minWidth: 150
  371. },
  372. {
  373. columnKey: 'action',
  374. label: '操作',
  375. width: 230,
  376. align: 'center',
  377. resizable: false,
  378. slot: 'action',
  379. showOverflowTooltip: true,
  380. fixed: 'right'
  381. }
  382. ]
  383. };
  384. },
  385. computed: {},
  386. created() {
  387. this.requestDict('客户状态');
  388. this.getTreeData();
  389. },
  390. methods: {
  391. //点击左边分类
  392. handleNodeClick(data, node) {
  393. // this.curNodeData = data;
  394. this.reload({ categoryId: data.id });
  395. },
  396. /* 表格数据源 */
  397. datasource({ page, limit, where, order }) {
  398. if (this.businessOpportunityData.id) {
  399. where['opportunityId'] = this.businessOpportunityData.id;
  400. }
  401. if (this.contactData.id) {
  402. where['contactId'] = this.contactData.id;
  403. }
  404. return getTableList({
  405. pageNum: page,
  406. size: limit,
  407. ...where
  408. });
  409. },
  410. //获取左边分类
  411. async getTreeData() {
  412. try {
  413. this.treeLoading = true;
  414. const res = await contactTypeTree({ id: '20' });
  415. this.treeLoading = false;
  416. if (res?.code === '0') {
  417. this.treeList = res.data;
  418. return this.treeList;
  419. }
  420. } catch (error) {}
  421. this.treeLoading = false;
  422. },
  423. /* 刷新表格 */
  424. reload(where) {
  425. this.$refs.table.reload({ page: 1, where });
  426. },
  427. //新增编辑
  428. openEdit(type, row) {
  429. this.$refs.addDialogRef.open(type, row);
  430. this.$refs.addDialogRef.$refs.form &&
  431. this.$refs.addDialogRef.$refs.form.clearValidate();
  432. },
  433. //批量删除
  434. allDelBtn() {
  435. if (this.selection.length === 0) return;
  436. let flag = this.selection.some((item) => [1, 2].includes(item.status));
  437. if (flag)
  438. return this.$message.warning('抱歉已审核、审核中的数据不能删除,请检查');
  439. this.delVisible = true;
  440. },
  441. //删除接口
  442. remove(delData) {
  443. deleteInformation(delData).then((res) => {
  444. this.$message.success('删除成功!');
  445. this.reload();
  446. });
  447. },
  448. //删除弹框确定
  449. commitBtn() {
  450. const dataId = this.selection.map((v) => v.id);
  451. this.remove(dataId);
  452. },
  453. contractBookSubmit(res) {
  454. this.processSubmitDialogFlag = true
  455. let key = res.type == 1?'sales_contract_approve':'contract_approve_2'
  456. this.$nextTick(()=>{
  457. let params = {
  458. businessId:res.id,
  459. businessKey : key,
  460. formCreateUserId: res.createUserId,
  461. variables:{
  462. businessType: res.type
  463. },
  464. // callBackMethodType : '1',
  465. // callBackMethod : 'proTargetPlanApproveApiImpl.updatePlanApprovalStatus',
  466. // pcHandle : '/bpm/handleTask/components/project-manage/plan-manage/submit.vue',
  467. // pcView : '/bpm/handleTask/components/project-manage/plan-manage/detailDialog.vue',
  468. // miniHandle : '',
  469. // miniView : '',
  470. }
  471. this.$refs.processSubmitDialogRef.init(params)
  472. })
  473. // submit({
  474. // businessId: res.id,
  475. // businessType: res.type
  476. // }).then((res) => {
  477. // this.$message.success('提交成功!');
  478. // this.reload();
  479. // });
  480. },
  481. contractBatchSubmit() {
  482. if (this.selection.some((item) => ![0, 3].includes(item.status)))
  483. return this.$message.warning('审核中、已提交数据不能再次提交,请检查');
  484. let arr = this.selection.map((item) => {
  485. return {
  486. businessId: item.id,
  487. businessType: item.type
  488. };
  489. });
  490. batchSubmitAPI(arr).then((res) => {
  491. this.$message.success('提交成功!');
  492. this.reload();
  493. });
  494. },
  495. //
  496. handleGenerateOrder(row) {
  497. //1销售2是采购
  498. let refName =
  499. row.type == '1' ? 'saleOrderAddDialogRef' : 'supplierAddDialogRef';
  500. this.$refs[refName].contractOpen(row);
  501. this.$refs[refName].$refs.form &&
  502. this.$refs[refName].$refs.form.clearValidate();
  503. },
  504. //销售订单审批
  505. saleOrderSubmit(id) {
  506. saleOrderSubmitAPI({
  507. businessId: id
  508. }).then(() => {
  509. this.$refs.saleOrderAddDialogRef &&
  510. this.$refs.saleOrderAddDialogRef.cancel();
  511. this.$message.success('提交成功');
  512. this.reload();
  513. });
  514. },
  515. //查看详情
  516. openDetail(row) {
  517. this.$refs.contactDetailDialogRef.open(row);
  518. }
  519. }
  520. };
  521. </script>
  522. <style lang="scss" scoped>
  523. :deep(.el-link--inner) {
  524. margin-left: 0px !important;
  525. }
  526. .sys-organization-list {
  527. height: calc(100vh - 225px);
  528. box-sizing: border-box;
  529. border-width: 1px;
  530. border-style: solid;
  531. overflow: auto;
  532. }
  533. .sys-organization-list :deep(.el-tree-node__content) {
  534. height: 40px;
  535. & > .el-tree-node__expand-icon {
  536. margin-left: 10px;
  537. }
  538. }
  539. </style>