index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  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:finadvance: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:finadvance: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:finadvance:submit')"
  50. type="primary"
  51. :underline="false"
  52. @click="handleSubmit(row)"
  53. >
  54. 提交
  55. </el-link>
  56. <el-popconfirm
  57. v-if="$hasPermission('eom:finadvance: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:finadvance: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="handleCollect(row)"
  82. >
  83. 收款
  84. </el-link>
  85. <el-link
  86. v-if="$hasPermission('eom:finadvance:complete') && row.status == 0"
  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. <collect-dialog ref="collectDialogRef" @done="reload"></collect-dialog>
  103. </div>
  104. </template>
  105. <script>
  106. import searchForm from './components/searchForm.vue';
  107. import addDialog from './components/addDialog.vue';
  108. import collectDialog from './components/collectDialog.vue';
  109. import tabMixins from '@/mixins/tableColumnsMixin';
  110. import { paymentStatus, reviewStatus } from '@/enum/dict';
  111. import {
  112. advanceReceiptPageList,
  113. deleteAdvanceReceipt,submit,approve, withdraw, completeInfo
  114. } from '@/api/financialManage/advanceReceipt';
  115. export default {
  116. mixins: [tabMixins],
  117. components: {
  118. searchForm,
  119. addDialog,
  120. collectDialog
  121. },
  122. data() {
  123. return {
  124. selection: [],
  125. loading: false,
  126. columns: [
  127. {
  128. width: 45,
  129. type: 'selection',
  130. columnKey: 'selection',
  131. align: 'center'
  132. },
  133. {
  134. columnKey: 'index',
  135. label: '序号',
  136. type: 'index',
  137. width: 55,
  138. align: 'center',
  139. showOverflowTooltip: true,
  140. fixed: 'left'
  141. },
  142. {
  143. prop: 'code',
  144. label: '预收款项编码',
  145. slot: 'code',
  146. align: 'center',
  147. sortable: true,
  148. showOverflowTooltip: true,
  149. minWidth: 180
  150. },
  151. {
  152. prop: 'contactName',
  153. label: '客户名称',
  154. align: 'center',
  155. showOverflowTooltip: true,
  156. minWidth: 160
  157. },
  158. {
  159. prop: 'advanceDate',
  160. label: '预收日期',
  161. align: 'center',
  162. showOverflowTooltip: true,
  163. minWidth: 120
  164. },
  165. {
  166. prop: 'advanceTotalPrice',
  167. label: '预收金额',
  168. align: 'center',
  169. showOverflowTooltip: true,
  170. minWidth: 120
  171. },
  172. {
  173. prop: 'confirmedTotalPrice',
  174. label: '预收款确收金额',
  175. align: 'center',
  176. showOverflowTooltip: true,
  177. minWidth: 140
  178. },
  179. {
  180. prop: 'reconciledAmount',
  181. label: '已对账确收金额',
  182. align: 'center',
  183. showOverflowTooltip: true,
  184. minWidth: 140
  185. },
  186. {
  187. prop: 'unreconciledAmount',
  188. label: '未对账确收金额',
  189. align: 'center',
  190. showOverflowTooltip: true,
  191. minWidth: 140
  192. },
  193. {
  194. prop: 'uncollectedAdvanceAmount',
  195. label: '预收款未收金额',
  196. align: 'center',
  197. showOverflowTooltip: true,
  198. minWidth: 140
  199. },
  200. {
  201. prop: 'uncollectedToReceivableAmount',
  202. label: '未收转应收金额',
  203. align: 'center',
  204. showOverflowTooltip: true,
  205. minWidth: 140
  206. },
  207. {
  208. prop: 'collectionStatus',
  209. label: '收款状态',
  210. align: 'center',
  211. showOverflowTooltip: true,
  212. minWidth: 100,
  213. formatter: (_row, _column, cellValue) => {
  214. return (
  215. paymentStatus.find((item) => item.value == cellValue)?.label ||
  216. ''
  217. );
  218. }
  219. },
  220. {
  221. prop: 'status',
  222. label: '状态',
  223. align: 'center',
  224. showOverflowTooltip: true,
  225. minWidth: 100,
  226. formatter: (_row, _column, cellValue) => {
  227. if (cellValue === 0) return '未完结';
  228. if (cellValue === 1) return '已完结';
  229. if (cellValue === 2) return '已完结转应收';
  230. return '';
  231. }
  232. },
  233. {
  234. prop: 'approvalStatus',
  235. label: '审核状态',
  236. align: 'center',
  237. showOverflowTooltip: true,
  238. minWidth: 100,
  239. formatter: (_row, _column, cellValue) => {
  240. return reviewStatus[_row.approvalStatus];
  241. }
  242. },
  243. {
  244. prop: 'accountingSubjectName',
  245. label: '会计科目',
  246. align: 'center',
  247. showOverflowTooltip: true,
  248. minWidth: 100
  249. },
  250. {
  251. prop: 'sourceType',
  252. label: '来源类型',
  253. align: 'center',
  254. showOverflowTooltip: true,
  255. minWidth: 100,
  256. formatter: (_row, _column, cellValue) => {
  257. if (cellValue === 2) return '合同';
  258. if (cellValue === 3) return '销售订单';
  259. return '';
  260. }
  261. },
  262. {
  263. prop: 'sourceCode',
  264. label: '来源编码',
  265. align: 'center',
  266. showOverflowTooltip: true,
  267. minWidth: 100
  268. },
  269. {
  270. prop: 'fundTypeName',
  271. label: '款项类型',
  272. align: 'center',
  273. showOverflowTooltip: true,
  274. minWidth: 100
  275. },
  276. {
  277. prop: 'collectionConditionName',
  278. label: '收款条件',
  279. align: 'center',
  280. showOverflowTooltip: true,
  281. minWidth: 100
  282. },
  283. {
  284. prop: 'createUserName',
  285. label: '创建人',
  286. align: 'center',
  287. showOverflowTooltip: true,
  288. minWidth: 100
  289. },
  290. {
  291. prop: 'createTime',
  292. label: '创建时间',
  293. align: 'center',
  294. showOverflowTooltip: true,
  295. minWidth: 100
  296. },
  297. {
  298. columnKey: 'action',
  299. label: '操作',
  300. width: 260,
  301. align: 'center',
  302. resizable: false,
  303. slot: 'action',
  304. showOverflowTooltip: true,
  305. fixed: 'right'
  306. }
  307. ],
  308. cacheKeyUrl: 'eos-advanceReceipt-list'
  309. };
  310. },
  311. methods: {
  312. /* 表格数据源 */
  313. datasource({ page, limit, where }) {
  314. return advanceReceiptPageList({
  315. pageNum: page,
  316. size: limit,
  317. ...where
  318. });
  319. },
  320. /* 刷新表格 */
  321. reload(where) {
  322. this.$refs.table.reload({ page: 1, where });
  323. },
  324. // 新增编辑
  325. openEdit(type, row) {
  326. this.$refs.addDialogRef.open(type, row);
  327. },
  328. // 查看详情
  329. openDetail(row) {
  330. this.$refs.addDialogRef.open('detail', row);
  331. },
  332. // 删除
  333. remove(delData) {
  334. deleteAdvanceReceipt(delData).then(() => {
  335. this.$message.success('删除成功!');
  336. this.reload();
  337. });
  338. },
  339. // 提交
  340. handleSubmit(row) {
  341. this.$confirm('确定要提交该预收款吗?', '提示', {
  342. type: 'warning'
  343. }).then(() => {
  344. submit({
  345. id: row.id
  346. }).then((res) => {
  347. // TODO: 调用提交接口
  348. this.$message.success('提交成功');
  349. this.reload();
  350. });
  351. }).catch(() => {
  352. // this.$message.info('已取消提交');
  353. });;
  354. },
  355. // 收款
  356. handleCollect(row) {
  357. this.$refs.collectDialogRef.open(row);
  358. },
  359. // 撤销
  360. handleRevoke(row) {
  361. this.$confirm('确定要撤销该预收款吗?', '提示', {
  362. type: 'warning'
  363. }).then(() => {
  364. withdraw({
  365. id: row.id
  366. })
  367. .then((res) => {
  368. // TODO: 调用撤销接口
  369. this.$message.success('撤销成功');
  370. this.reload();
  371. }).catch(() => {
  372. // this.$message.info('已取消撤销');
  373. });
  374. });
  375. },
  376. // 完结
  377. handleComplete(row) {
  378. this.$confirm('确定要完结该预收款吗?', '提示', {
  379. type: 'warning'
  380. }).then(() => {
  381. completeInfo({
  382. id: row.id
  383. }).then((res) => {
  384. // TODO: 调用完结接口
  385. this.$message.success('完结成功');
  386. this.reload();
  387. });
  388. }).catch(() => {
  389. // this.$message.info('已取消完结');
  390. });
  391. }
  392. }
  393. };
  394. </script>
  395. <style lang="scss" scoped>
  396. :deep(.el-link--inner) {
  397. margin-left: 0px !important;
  398. }
  399. </style>