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-table @search="reload"></search-table>
  6. <!-- 数据表格 -->
  7. <ele-pro-table
  8. ref="table"
  9. :columns="columns"
  10. :datasource="datasource"
  11. height="calc(100vh - 355px)"
  12. style="margin-bottom: 10px"
  13. full-height="calc(100vh - 116px)"
  14. tool-class="ele-toolbar-form"
  15. :selection.sync="selection"
  16. :page-size="20"
  17. @columns-change="handleColumnChange"
  18. :cache-key="cacheKeyUrl"
  19. >
  20. <!-- 表头工具栏 -->
  21. <template v-slot:toolbar>
  22. <el-button
  23. size="small"
  24. type="primary"
  25. icon="el-icon-plus"
  26. class="ele-btn-icon"
  27. @click="handleAddOrEditAccount('add', '')"
  28. >
  29. 新建
  30. </el-button>
  31. <el-button
  32. size="small"
  33. type="danger"
  34. el-icon-delete
  35. class="ele-btn-icon"
  36. @click="allDelBtn"
  37. :disabled="selection?.length === 0"
  38. >
  39. 批量删除
  40. </el-button>
  41. </template>
  42. <!-- 查看详情列 -->
  43. <template v-slot:statementNo="{ row }">
  44. <el-link
  45. type="primary"
  46. :underline="false"
  47. @click="openorderDetail(row, 'statementNo')"
  48. >
  49. {{ row.statementNo }}
  50. </el-link>
  51. </template>
  52. <template v-slot:orderNo="{ row }">
  53. <el-link
  54. type="primary"
  55. :underline="false"
  56. @click="openorderDetail(row, 'orderNo')"
  57. >
  58. {{ row.orderNo }}
  59. </el-link>
  60. </template>
  61. <!-- 操作列 -->
  62. <template v-slot:action="{ row }">
  63. <el-link
  64. type="primary"
  65. :underline="false"
  66. icon="el-icon-edit"
  67. @click="handleAddOrEditAccount('update', row)"
  68. v-if="
  69. (isNeed_process_is_close &&
  70. [0, 3].includes(row.reviewStatus)) ||
  71. !isNeed_process_is_close
  72. "
  73. >
  74. 修改
  75. </el-link>
  76. <el-link
  77. type="primary"
  78. :underline="false"
  79. icon="el-icon-plus"
  80. @click="accountstatementSubmit(row)"
  81. v-if="
  82. isNeed_process_is_close && [0, 3].includes(row.reviewStatus)
  83. "
  84. >
  85. 提交
  86. </el-link>
  87. <el-popconfirm
  88. class="ele-action"
  89. title="确定要删除此信息吗?"
  90. @confirm="remove([row.id])"
  91. v-if="
  92. (isNeed_process_is_close &&
  93. [0, 3].includes(row.reviewStatus)) ||
  94. !isNeed_process_is_close
  95. "
  96. >
  97. <template v-slot:reference>
  98. <el-link type="danger" :underline="false" icon="el-icon-delete">
  99. 删除
  100. </el-link>
  101. </template>
  102. </el-popconfirm>
  103. <!-- <el-link-->
  104. <!-- type="primary"-->
  105. <!-- :underline="false"-->
  106. <!-- icon="el-icon-download"-->
  107. <!-- @click="handleExport(row)"-->
  108. <!-- v-if="[2].includes(row.reviewStatus)">-->
  109. <!-- 导出-->
  110. <!-- </el-link>-->
  111. <el-link
  112. size="small"
  113. type="primary"
  114. :underline="false"
  115. icon="el-icon-plus"
  116. class="ele-btn-icon"
  117. v-if="[2].includes(row.reviewStatus)"
  118. @click="handleAddInvoice(row)"
  119. >
  120. 新增发票
  121. </el-link>
  122. </template>
  123. </ele-pro-table>
  124. </div>
  125. </el-card>
  126. <order-detail-dialog ref="orderDetailDialogRef"></order-detail-dialog>
  127. <add-account-dialog
  128. v-if="addAccountDialogFlag"
  129. :addAccountDialogFlag.sync="addAccountDialogFlag"
  130. ref="accountDialogRef"
  131. :contactData="contactData"
  132. :saleOrderData="saleOrderData"
  133. @done="reload"
  134. ></add-account-dialog>
  135. <add-return-goods-dialog
  136. ref="addReturnGoodsRef"
  137. @done="reload"
  138. ></add-return-goods-dialog>
  139. <!-- 多选删除弹窗 -->
  140. <pop-modal
  141. :visible.sync="delVisible"
  142. content="是否确定删除?"
  143. @done="commitBtn"
  144. />
  145. <!--对账单详情 -->
  146. <detail-dialog
  147. :detailDialogFlag.sync="detailDialogFlag"
  148. v-if="detailDialogFlag"
  149. ref="detailDialogRef"
  150. ></detail-dialog>
  151. <!-- 创建发票选择采购对账单信息 对账明细 -->
  152. <accountInfoDialog
  153. ref="accountInfoDialogRef"
  154. v-if="accountInfoDialogFlag"
  155. :account-info-dialog-flag.sync="accountInfoDialogFlag"
  156. @getAccountInfo="getAccountInfo"
  157. ></accountInfoDialog>
  158. <!-- 新增发票-->
  159. <add-invoice-dialog
  160. :add-or-edit-dialog-flag.sync="addInvoiceDialogFlag"
  161. ref="addInvoiceDialogRef"
  162. v-if="addInvoiceDialogFlag"
  163. @reload="reload"
  164. ></add-invoice-dialog>
  165. <process-submit-dialog
  166. :processSubmitDialogFlag.sync="processSubmitDialogFlag"
  167. v-if="processSubmitDialogFlag"
  168. ref="processSubmitDialogRef"
  169. @reload="reload"
  170. ></process-submit-dialog>
  171. </div>
  172. </template>
  173. <script>
  174. import searchTable from './components/searchTable.vue';
  175. import addAccountDialog from './components/addAccountDialog.vue';
  176. import popModal from '@/components/pop-modal';
  177. import { reviewStatus } from '@/enum/dict';
  178. import orderDetailDialog from '@/views/saleManage/saleOrder/components/detailDialog.vue';
  179. import addReturnGoodsDialog from '@/views/saleManage/saleOrder/returnGoods/components/addReturnGoodsDialog';
  180. import detailDialog from './components/detailDialog.vue';
  181. import {
  182. getAccountstatementList,
  183. submit,
  184. deletetAccountstatement,
  185. submitAccountStatementApproveAPI,
  186. accountStatementExportAPI
  187. } from '@/api/saleManage/accountstatement';
  188. import dictMixins from '@/mixins/dictMixins';
  189. import AccountInfoDialog from '@/views/financialManage/invoiceManage/components/accountInfoDialog.vue';
  190. import addInvoiceDialog from '@/views/financialManage/invoiceManage/components/addOrEditDialog.vue';
  191. import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
  192. import tabMixins from '@/mixins/tableColumnsMixin';
  193. export default {
  194. mixins: [dictMixins,tabMixins],
  195. components: {
  196. processSubmitDialog,
  197. addInvoiceDialog,
  198. AccountInfoDialog,
  199. searchTable,
  200. popModal,
  201. addReturnGoodsDialog,
  202. orderDetailDialog,
  203. addAccountDialog,
  204. detailDialog
  205. },
  206. provide() {
  207. return {
  208. invoiceType: () => ''
  209. };
  210. },
  211. //客户管理数据
  212. props: {
  213. contactData: {
  214. type: Object,
  215. default: () => {
  216. return {};
  217. }
  218. },
  219. saleOrderData: {
  220. type: Object,
  221. default: () => {
  222. return {};
  223. }
  224. }
  225. },
  226. data() {
  227. return {
  228. addAccountDialogFlag: false,
  229. detailDialogFlag: false,
  230. addInvoiceDialogFlag: false,
  231. accountInfoDialogFlag: false,
  232. processSubmitDialogFlag: false,
  233. currentRow: {},
  234. activeComp: 'saleorder',
  235. tabOptions: [
  236. { key: 'saleorder', name: '销售订单' },
  237. { key: 'invoice', name: '发货单' },
  238. { key: 'returnorder', name: '退货单' }
  239. ],
  240. selection: [], //单选中集合
  241. delVisible: false, //批量删除弹框状态
  242. loading: false, // 加载状态
  243. columns: [
  244. {
  245. width: 45,
  246. type: 'selection',
  247. columnKey: 'selection',
  248. align: 'center'
  249. },
  250. {
  251. columnKey: 'index',
  252. label: '序号',
  253. type: 'index',
  254. width: 55,
  255. align: 'center',
  256. showOverflowTooltip: true,
  257. fixed: 'left'
  258. },
  259. {
  260. prop: 'statementNo',
  261. label: '对账单编码',
  262. align: 'center',
  263. slot: 'statementNo',
  264. sortable: true,
  265. showOverflowTooltip: true,
  266. minWidth: 200
  267. },
  268. {
  269. prop: 'contactName',
  270. label: '客户名称',
  271. align: 'center',
  272. showOverflowTooltip: true,
  273. minWidth: 180
  274. },
  275. {
  276. prop: 'dateType',
  277. label: '对账方式',
  278. align: 'center',
  279. showOverflowTooltip: true,
  280. minWidth: 150,
  281. formatter: (_row, _column, cellValue) => {
  282. return cellValue==1?'按年度':cellValue==2?'按季度':cellValue==3?'按月度':'按时间段'
  283. }
  284. },
  285. {
  286. prop: 'startDate',
  287. label: '对账开始日期',
  288. align: 'center',
  289. slot: 'startDate',
  290. showOverflowTooltip: true,
  291. minWidth: 200
  292. },
  293. {
  294. prop: 'endDate',
  295. label: '对账结束日期',
  296. align: 'center',
  297. slot: 'endDate',
  298. showOverflowTooltip: true,
  299. minWidth: 200
  300. },
  301. {
  302. prop: 'amountTotalPrice',
  303. label: '总金额',
  304. align: 'center',
  305. showOverflowTooltip: true,
  306. minWidth: 130
  307. },
  308. {
  309. prop: 'amountReceivablePrice',
  310. label: '应收金额',
  311. align: 'center',
  312. showOverflowTooltip: true,
  313. minWidth: 130
  314. },
  315. {
  316. prop: 'amountPayablePrice',
  317. label: '应付金额',
  318. align: 'center',
  319. showOverflowTooltip: true,
  320. minWidth: 130
  321. },
  322. {
  323. prop: 'reviewStatus',
  324. label: '状态',
  325. align: 'center',
  326. showOverflowTooltip: true,
  327. minWidth: 200,
  328. formatter: (_row, _column, cellValue) => {
  329. return reviewStatus[_row.reviewStatus];
  330. }
  331. },
  332. {
  333. prop: 'replied',
  334. label: '是否回执',
  335. align: 'center',
  336. slot: 'replied',
  337. showOverflowTooltip: true,
  338. minWidth: 200,
  339. formatter: (_row, _column, cellValue) => {
  340. return _row.replied ? '是' : '否';
  341. }
  342. },
  343. {
  344. prop: 'createUserName',
  345. label: '创建人',
  346. align: 'center',
  347. showOverflowTooltip: true,
  348. minWidth: 80
  349. },
  350. {
  351. prop: 'createTime',
  352. label: '创建时间',
  353. align: 'center',
  354. showOverflowTooltip: true,
  355. minWidth: 170
  356. },
  357. {
  358. columnKey: 'action',
  359. label: '操作',
  360. width: 230,
  361. align: 'center',
  362. resizable: false,
  363. slot: 'action',
  364. showOverflowTooltip: true,
  365. fixed: 'right'
  366. }
  367. ],
  368. cacheKeyUrl:'eos-b5bbaa6e-saleManage-accountstatement',
  369. };
  370. },
  371. computed: {},
  372. methods: {
  373. /* 表格数据源 */
  374. datasource({ page, limit, where, order }) {
  375. if (this.contactData.id) {
  376. where['contactId'] = this.contactData.id;
  377. }
  378. if (this.saleOrderData.id) {
  379. where['orderCode'] = this.saleOrderData.orderNo;
  380. }
  381. return getAccountstatementList({
  382. pageNum: page,
  383. size: limit,
  384. type: 1,
  385. ...where
  386. });
  387. },
  388. /* 刷新表格 */
  389. reload(where) {
  390. this.$refs.table.reload({ page: 1, where });
  391. },
  392. //新增编辑
  393. handleAddOrEditAccount(type, row) {
  394. this.addAccountDialogFlag = true;
  395. this.$nextTick(() => {
  396. this.$refs.accountDialogRef.open(type, row, '1');
  397. });
  398. },
  399. //导出
  400. async handleExport(row) {
  401. let data = await accountStatementExportAPI(row.id);
  402. saveAs(data.data, '应收对账单');
  403. },
  404. /*新增发票*/
  405. handleAddInvoice(row) {
  406. this.currentRow = row;
  407. this.accountInfoDialogFlag = true;
  408. this.$nextTick(() => {
  409. this.$refs.accountInfoDialogRef.createInvoice(
  410. row,
  411. 'add',
  412. 'saleOrder'
  413. );
  414. });
  415. },
  416. /*新增发票选择对账单信息回调*/
  417. getAccountInfo(row) {
  418. this.currentRow.children = row;
  419. setTimeout(() => {
  420. this.addInvoiceDialogFlag = true;
  421. this.$nextTick(() => {
  422. this.$refs.addInvoiceDialogRef.createInvoice(
  423. {},
  424. 1,
  425. this.currentRow
  426. );
  427. });
  428. }, 400);
  429. },
  430. //批量删除
  431. allDelBtn() {
  432. if (this.selection.length === 0) return;
  433. let flag = this.selection.some((item) =>
  434. [1, 2].includes(item.reviewStatus)
  435. );
  436. if (flag)
  437. return this.$message.warning(
  438. '抱歉已审核、审核中的数据不能删除,请检查'
  439. );
  440. this.delVisible = true;
  441. },
  442. //删除接口
  443. remove(delData) {
  444. deletetAccountstatement(delData).then((res) => {
  445. this.$message.success('删除成功!');
  446. this.reload();
  447. });
  448. },
  449. //删除弹框确定
  450. commitBtn() {
  451. const dataId = this.selection.map((v) => v.id);
  452. this.remove(dataId);
  453. },
  454. accountstatementSubmit(res) {
  455. this.processSubmitDialogFlag = true;
  456. this.$nextTick(() => {
  457. let params = {
  458. businessId: res.id,
  459. businessKey: 'sales_account_statement_approve',
  460. formCreateUserId: res.createUserId,
  461. variables: {
  462. type: '1',
  463. businessCode: res.statementNo,
  464. businessName: res.contactName,
  465. businessType: '对账单'
  466. }
  467. // callBackMethodType : '1',
  468. // callBackMethod : 'proTargetPlanApproveApiImpl.updatePlanApprovalStatus',
  469. // pcHandle : '/bpm/handleTask/components/project-manage/plan-manage/submit.vue',
  470. // pcView : '/bpm/handleTask/components/project-manage/plan-manage/detailDialog.vue',
  471. // miniHandle : '',
  472. // miniView : '',
  473. };
  474. this.$refs.processSubmitDialogRef.init(params);
  475. });
  476. // submitAccountStatementApproveAPI({
  477. // businessId: res.id,
  478. // type: '1'
  479. // }).then((res) => {
  480. // this.$message.success('提交成功!');
  481. // this.reload();
  482. // });
  483. },
  484. //查看详情
  485. openorderDetail(row, type) {
  486. if (type === 'statementNo') {
  487. this.detailDialogFlag = true;
  488. this.$nextTick(() => {
  489. this.$refs.detailDialogRef.open('view', row, '1');
  490. });
  491. }
  492. if (type === 'orderNo') {
  493. this.$refs.orderDetailDialogRef.open({ id: row.orderId });
  494. }
  495. }
  496. }
  497. };
  498. </script>
  499. <style lang="scss" scoped>
  500. .ele-body {
  501. padding-top: 0;
  502. padding-bottom: 0;
  503. }
  504. :deep .el-card__body {
  505. padding: 0;
  506. }
  507. :deep(.el-link--inner) {
  508. margin-left: 0px !important;
  509. }
  510. .sys-organization-list {
  511. height: calc(100vh - 264px);
  512. box-sizing: border-box;
  513. border-width: 1px;
  514. border-style: solid;
  515. overflow: auto;
  516. }
  517. .sys-organization-list :deep(.el-tree-node__content) {
  518. height: 40px;
  519. & > .el-tree-node__expand-icon {
  520. margin-left: 10px;
  521. }
  522. }
  523. .switch_left ul .active {
  524. border-top: 4px solid var(--color-primary);
  525. color: var(--color-primary-5);
  526. }
  527. .switch {
  528. padding-bottom: 20px;
  529. }
  530. .el-dropdown-link {
  531. cursor: pointer;
  532. color: var(--color-primary-5);
  533. }
  534. .el-icon-arrow-down {
  535. font-size: 12px;
  536. }
  537. </style>