index.vue 16 KB

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