index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  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-form @search="reload"> </search-form>
  6. <!-- 数据表格 -->
  7. <ele-pro-table
  8. ref="table"
  9. :columns="columns"
  10. :datasource="datasource"
  11. height="calc(100vh - 375px)"
  12. full-height="calc(100vh - 116px)"
  13. tool-class="ele-toolbar-form"
  14. :selection.sync="selection"
  15. :page-size="20"
  16. @columns-change="handleColumnChange"
  17. :cache-key="cacheKeyUrl"
  18. >
  19. <!-- 表头工具栏 -->
  20. <template v-slot:toolbar>
  21. <el-button
  22. v-if="$hasPermission('eom:finprepay:save')"
  23. size="small"
  24. type="primary"
  25. icon="el-icon-plus"
  26. class="ele-btn-icon"
  27. @click="openEdit('add', {})"
  28. >
  29. 新增
  30. </el-button>
  31. </template>
  32. <template v-slot:code="{ row }">
  33. <el-link type="primary" :underline="false" @click="openDetail(row)">
  34. {{ row.code }}
  35. </el-link>
  36. </template>
  37. <!-- 操作列 -->
  38. <template v-slot:action="{ row }">
  39. <template v-if="row.approvalStatus === 0">
  40. <el-link
  41. v-if="$hasPermission('eom:finprepay:update')"
  42. type="primary"
  43. :underline="false"
  44. @click="openEdit('edit', row)"
  45. >
  46. 修改
  47. </el-link>
  48. <el-link
  49. v-if="$hasPermission('eom:finprepay:submit')"
  50. type="primary"
  51. :underline="false"
  52. @click="handleSubmit(row)"
  53. >
  54. 提交
  55. </el-link>
  56. <el-popconfirm
  57. v-if="$hasPermission('eom:finprepay:delete')"
  58. class="ele-action"
  59. title="确定要删除此信息吗?"
  60. @confirm="remove([row.id])"
  61. >
  62. <template v-slot:reference>
  63. <el-link type="danger" :underline="false">删除</el-link>
  64. </template>
  65. </el-popconfirm>
  66. </template>
  67. <template v-else-if="row.approvalStatus === 1">
  68. <el-link
  69. v-if="$hasPermission('eom:finprepay:withdraw')"
  70. type="warning"
  71. :underline="false"
  72. @click="handleRevoke(row)"
  73. >
  74. 撤销
  75. </el-link>
  76. </template>
  77. <template v-else-if="row.approvalStatus === 2">
  78. <el-link
  79. type="primary"
  80. :underline="false"
  81. @click="handlePay(row)"
  82. >
  83. 付款
  84. </el-link>
  85. <el-link
  86. v-if="$hasPermission('eom:finprepay:complete')"
  87. type="success"
  88. :underline="false"
  89. @click="handleComplete(row)"
  90. >
  91. 完结
  92. </el-link>
  93. </template>
  94. <template v-else>
  95. <span>--</span>
  96. </template>
  97. </template>
  98. </ele-pro-table>
  99. </div>
  100. </el-card>
  101. <add-dialog ref="addDialogRef" @done="reload"></add-dialog>
  102. <pay-dialog ref="payDialogRef" @done="reload"></pay-dialog>
  103. <detail-dialog ref="detailDialogRef"></detail-dialog>
  104. <process-submit-dialog
  105. :isNotNeedProcess="false"
  106. :processSubmitDialogFlag.sync="processSubmitDialogFlag"
  107. isCloseRefresh="false"
  108. v-if="processSubmitDialogFlag"
  109. ref="processSubmitDialogRef"
  110. @reload="reload"
  111. ></process-submit-dialog>
  112. </div>
  113. </template>
  114. <script>
  115. import searchForm from './components/searchForm.vue';
  116. import addDialog from './components/addDialog.vue';
  117. import payDialog from './components/payDialog.vue';
  118. import detailDialog from './components/detailDialog.vue';
  119. import tabMixins from '@/mixins/tableColumnsMixin';
  120. import { paymentType, reviewStatus } from '@/enum/dict';
  121. import {
  122. prepaymentPageList,
  123. deletePrepayment,
  124. getPrepaymentInfo,
  125. withdrawPrepayment,
  126. completeInfo
  127. } from '@/api/financialManage/prepayment';
  128. import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
  129. export default {
  130. mixins: [tabMixins],
  131. components: {
  132. searchForm,
  133. addDialog,
  134. payDialog,
  135. detailDialog,
  136. processSubmitDialog
  137. },
  138. data() {
  139. return {
  140. selection: [],
  141. loading: false,
  142. processSubmitDialogFlag: false,
  143. columns: [
  144. {
  145. width: 45,
  146. type: 'selection',
  147. columnKey: 'selection',
  148. align: 'center'
  149. },
  150. {
  151. columnKey: 'index',
  152. label: '序号',
  153. type: 'index',
  154. width: 55,
  155. align: 'center',
  156. showOverflowTooltip: true,
  157. fixed: 'left'
  158. },
  159. {
  160. prop: 'code',
  161. label: '预付款项编码',
  162. align: 'center',
  163. sortable: true,
  164. slot: 'code',
  165. showOverflowTooltip: true,
  166. minWidth: 180
  167. },
  168. {
  169. prop: 'contactName',
  170. label: '供应商名称',
  171. align: 'center',
  172. showOverflowTooltip: true,
  173. minWidth: 160
  174. },
  175. {
  176. prop: 'prepayDate',
  177. label: '预付日期',
  178. align: 'center',
  179. showOverflowTooltip: true,
  180. minWidth: 120
  181. },
  182. {
  183. prop: 'prepayTotalPrice',
  184. label: '预付金额',
  185. align: 'center',
  186. showOverflowTooltip: true,
  187. minWidth: 120
  188. },
  189. {
  190. prop: 'confirmedTotalPrice',
  191. label: '预付款确付金额',
  192. align: 'center',
  193. showOverflowTooltip: true,
  194. minWidth: 140
  195. },
  196. {
  197. prop: 'reconciledAmount',
  198. label: '已对账确付金额',
  199. align: 'center',
  200. showOverflowTooltip: true,
  201. minWidth: 140
  202. },
  203. {
  204. prop: 'unreconciledAmount',
  205. label: '未对账确付金额',
  206. align: 'center',
  207. showOverflowTooltip: true,
  208. minWidth: 140
  209. },
  210. {
  211. prop: 'unpaidAdvanceAmount',
  212. label: '预付款未付金额',
  213. align: 'center',
  214. showOverflowTooltip: true,
  215. minWidth: 140
  216. },
  217. {
  218. prop: 'unpaidToPayableAmount',
  219. label: '未付转应付金额',
  220. align: 'center',
  221. showOverflowTooltip: true,
  222. minWidth: 140
  223. },
  224. {
  225. prop: 'paymentStatus',
  226. label: '付款状态',
  227. align: 'center',
  228. showOverflowTooltip: true,
  229. minWidth: 100,
  230. formatter: (_row, _column, cellValue) => {
  231. return paymentType.find(item => item.value == cellValue)?.label || '';
  232. }
  233. },
  234. {
  235. prop: 'status',
  236. label: '状态',
  237. align: 'center',
  238. showOverflowTooltip: true,
  239. minWidth: 100,
  240. formatter: (_row, _column, cellValue) => {
  241. if (cellValue === 0) return '未完结';
  242. if (cellValue === 1) return '已完结';
  243. if (cellValue === 2) return '已完结转应收';
  244. return '';
  245. }
  246. },
  247. {
  248. prop: 'approvalStatus',
  249. label: '审核状态',
  250. align: 'center',
  251. showOverflowTooltip: true,
  252. minWidth: 100,
  253. formatter: (_row, _column, cellValue) => {
  254. return reviewStatus[_row.approvalStatus];
  255. }
  256. },
  257. {
  258. prop: 'accountingSubjectName',
  259. label: '会计科目',
  260. align: 'center',
  261. showOverflowTooltip: true,
  262. minWidth: 100
  263. },
  264. {
  265. prop: 'sourceTyp',
  266. label: '来源类型',
  267. align: 'center',
  268. showOverflowTooltip: true,
  269. minWidth: 100,
  270. formatter: (_row, _column, cellValue) => {
  271. if (cellValue === 2) return '合同';
  272. if (cellValue === 3) return '采购订单';
  273. return '';
  274. }
  275. },
  276. {
  277. prop: 'sourceCode',
  278. label: '来源编码',
  279. align: 'center',
  280. showOverflowTooltip: true,
  281. minWidth: 100
  282. },
  283. {
  284. prop: 'fundTypeName',
  285. label: '款项类型',
  286. align: 'center',
  287. showOverflowTooltip: true,
  288. minWidth: 100
  289. },
  290. {
  291. prop: 'paymentConditionName',
  292. label: '付款条件',
  293. align: 'center',
  294. showOverflowTooltip: true,
  295. minWidth: 100
  296. },
  297. {
  298. prop: 'createUserName',
  299. label: '创建人',
  300. align: 'center',
  301. showOverflowTooltip: true,
  302. minWidth: 100
  303. },
  304. {
  305. prop: 'createTime',
  306. label: '创建时间',
  307. align: 'center',
  308. showOverflowTooltip: true,
  309. minWidth: 100
  310. },
  311. {
  312. columnKey: 'action',
  313. label: '操作',
  314. width: 240,
  315. align: 'center',
  316. resizable: false,
  317. slot: 'action',
  318. showOverflowTooltip: true,
  319. fixed: 'right'
  320. }
  321. ],
  322. cacheKeyUrl: 'eos-prepayment-list'
  323. };
  324. },
  325. methods: {
  326. /* 表格数据源 */
  327. datasource({ page, limit, where }) {
  328. return prepaymentPageList({
  329. pageNum: page,
  330. size: limit,
  331. ...where
  332. });
  333. },
  334. /* 刷新表格 */
  335. reload(where) {
  336. this.$refs.table.reload({ page: 1, where });
  337. },
  338. // 新增编辑
  339. openEdit(type, row) {
  340. this.$refs.addDialogRef.open(type, row);
  341. },
  342. // 查看详情
  343. openDetail(row) {
  344. this.$refs.addDialogRef.open('detail', row);
  345. },
  346. // 删除
  347. remove(delData) {
  348. deletePrepayment(delData).then(() => {
  349. this.$message.success('删除成功!');
  350. this.reload();
  351. });
  352. },
  353. // 提交
  354. async handleSubmit(res) {
  355. // this.$confirm('确定要提交该预付款吗?', '提示', { type: 'warning' }).then(() => {
  356. // // TODO: 调用提交接口
  357. // this.$message.success('提交成功');
  358. // this.reload();
  359. // });
  360. const data = await getPrepaymentInfo(res.id);
  361. this.processSubmitDialogFlag = true;
  362. let key = 'fin_prepay_approve';
  363. this.$nextTick(() => {
  364. let params = {
  365. businessId: data.id,
  366. businessKey: key,
  367. formCreateUserId: data.createUserId,
  368. variables: {
  369. businessCode: data.code,
  370. fundType: data.fundTypeName,
  371. sourceType: data.sourceType,
  372. businessType: '预付款项'
  373. }
  374. };
  375. this.$refs.processSubmitDialogRef.init(params);
  376. });
  377. },
  378. // 付款
  379. handlePay(row) {
  380. this.$refs.payDialogRef.open(row);
  381. },
  382. // 撤销
  383. handleRevoke(row) {
  384. this.$confirm('确定要撤销该预付款吗?', '提示', { type: 'warning' }).then(() => {
  385. // TODO: 调用撤销接口
  386. withdrawPrepayment({
  387. id: row.id
  388. }).then(() => {
  389. this.$message.success('撤销成功');
  390. this.reload();
  391. });
  392. })
  393. },
  394. // 完结
  395. handleComplete(row) {
  396. this.$confirm('确定要完结该预付款吗?', '提示', { type: 'warning' }).then(() => {
  397. completeInfo({
  398. id: row.id
  399. }).then(() => {
  400. // TODO: 调用完结接口
  401. this.$message.success('完结成功');
  402. this.reload();
  403. });
  404. });
  405. }
  406. }
  407. };
  408. </script>
  409. <style lang="scss" scoped>
  410. :deep(.el-link--inner) {
  411. margin-left: 0px !important;
  412. }
  413. </style>