index.vue 15 KB

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