index.vue 15 KB

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