index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  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 - 385px)"
  12. full-height="calc(100vh - 116px)"
  13. tool-class="ele-toolbar-form"
  14. :selection.sync="selection"
  15. cache-key="eomContactPageTable"
  16. >
  17. <!-- 表头工具栏 -->
  18. <template v-slot:toolbar>
  19. <el-button
  20. size="small"
  21. type="primary"
  22. icon="el-icon-plus"
  23. class="ele-btn-icon"
  24. @click="handleAddOrEditAccount('add', '')"
  25. >
  26. 新建
  27. </el-button>
  28. <el-button
  29. size="small"
  30. type="danger"
  31. el-icon-delete
  32. class="ele-btn-icon"
  33. @click="allDelBtn"
  34. :disabled="selection?.length === 0"
  35. >
  36. 批量删除
  37. </el-button>
  38. </template>
  39. <!-- 查看详情列 -->
  40. <template v-slot:statementNo="{ row }">
  41. <el-link
  42. type="primary"
  43. :underline="false"
  44. @click="openorderDetail(row, 'statementNo')"
  45. >
  46. {{ row.statementNo }}
  47. </el-link
  48. >
  49. </template>
  50. <template v-slot:orderNo="{ row }">
  51. <el-link
  52. type="primary"
  53. :underline="false"
  54. @click="openorderDetail(row, 'orderNo')"
  55. >
  56. {{ row.orderNo }}
  57. </el-link
  58. >
  59. </template>
  60. <!-- 操作列 -->
  61. <template v-slot:action="{ row }">
  62. <el-link
  63. type="primary"
  64. :underline="false"
  65. icon="el-icon-edit"
  66. @click="handleAddOrEditAccount('update',row)"
  67. v-if="[0, 3].includes(row.reviewStatus)"
  68. >
  69. 修改
  70. </el-link>
  71. <el-link
  72. type="primary"
  73. :underline="false"
  74. icon="el-icon-plus"
  75. @click="accountstatementSubmit(row)"
  76. v-if="[0, 3].includes(row.reviewStatus)"
  77. >
  78. 提交
  79. </el-link>
  80. <el-popconfirm
  81. class="ele-action"
  82. title="确定要删除此信息吗?"
  83. @confirm="remove([row.id])"
  84. v-if="[0, 3].includes(row.reviewStatus)"
  85. >
  86. <template v-slot:reference>
  87. <el-link type="danger" :underline="false" icon="el-icon-delete">
  88. 删除
  89. </el-link>
  90. </template>
  91. </el-popconfirm>
  92. <el-link
  93. type="primary"
  94. :underline="false"
  95. icon="el-icon-download"
  96. @click="handleExport(row)"
  97. v-if="[2].includes(row.reviewStatus)">
  98. 导出
  99. </el-link>
  100. </template>
  101. </ele-pro-table>
  102. </div>
  103. </el-card>
  104. <order-detail-dialog ref="orderDetailDialogRef"></order-detail-dialog>
  105. <add-account-dialog
  106. v-if="addAccountDialogFlag"
  107. :addAccountDialogFlag.sync="addAccountDialogFlag"
  108. ref="accountDialogRef"
  109. @done="reload"
  110. ></add-account-dialog>
  111. <add-return-goods-dialog
  112. ref="addReturnGoodsRef"
  113. @done="reload"
  114. ></add-return-goods-dialog>
  115. <!-- 多选删除弹窗 -->
  116. <pop-modal
  117. :visible.sync="delVisible"
  118. content="是否确定删除?"
  119. @done="commitBtn"
  120. />
  121. <!--对账单详情 -->
  122. <detail-dialog :detailDialogFlag.sync="detailDialogFlag" ref="detailDialogRef"></detail-dialog>
  123. </div>
  124. </template>
  125. <script>
  126. import searchTable from './components/searchTable.vue';
  127. import addAccountDialog from './components/addAccountDialog.vue';
  128. import popModal from '@/components/pop-modal';
  129. import {reviewStatusEnum} from '@/enum/dict';
  130. import orderDetailDialog from '@/views/saleManage/saleOrder/components/detailDialog.vue';
  131. import addReturnGoodsDialog from '@/views/saleManage/saleOrder/returnGoods/components/addReturnGoodsDialog';
  132. import detailDialog from './components/detailDialog.vue'
  133. import {
  134. getAccountstatementList,
  135. submit,
  136. deletetAccountstatement, submitAccountStatementApproveAPI, accountStatementExportAPI
  137. } from '@/api/saleManage/accountstatement';
  138. import dictMixins from '@/mixins/dictMixins';
  139. export default {
  140. mixins: [dictMixins],
  141. components: {
  142. searchTable,
  143. popModal,
  144. addReturnGoodsDialog,
  145. orderDetailDialog,
  146. addAccountDialog,
  147. detailDialog
  148. },
  149. data() {
  150. return {
  151. addAccountDialogFlag: false,
  152. detailDialogFlag: false,
  153. activeComp: 'saleorder',
  154. tabOptions: [
  155. {key: 'saleorder', name: '销售订单'},
  156. {key: 'invoice', name: '发货单'},
  157. {key: 'returnorder', name: '退货单'}
  158. ],
  159. selection: [], //单选中集合
  160. delVisible: false, //批量删除弹框状态
  161. loading: false, // 加载状态
  162. columns: [
  163. {
  164. width: 45,
  165. type: 'selection',
  166. columnKey: 'selection',
  167. align: 'center'
  168. },
  169. {
  170. columnKey: 'index',
  171. label: '序号',
  172. type: 'index',
  173. width: 55,
  174. align: 'center',
  175. showOverflowTooltip: true,
  176. fixed: 'left'
  177. },
  178. {
  179. prop: 'statementNo',
  180. label: '对账单编码',
  181. align: 'center',
  182. slot: 'statementNo',
  183. showOverflowTooltip: true,
  184. minWidth: 200
  185. },
  186. {
  187. prop: 'contactName',
  188. label: '客户名称',
  189. align: 'center',
  190. showOverflowTooltip: true,
  191. minWidth: 180
  192. },
  193. {
  194. prop: 'projectName',
  195. label: '项目名称',
  196. align: 'center',
  197. showOverflowTooltip: true,
  198. minWidth: 200
  199. },
  200. {
  201. prop: 'startDate',
  202. label: '对账开始日期',
  203. align: 'center',
  204. slot: 'startDate',
  205. showOverflowTooltip: true,
  206. minWidth: 200
  207. },
  208. {
  209. prop: 'endDate',
  210. label: '对账结束日期',
  211. align: 'center',
  212. slot: 'endDate',
  213. showOverflowTooltip: true,
  214. minWidth: 200
  215. },
  216. {
  217. prop: 'amountTotalPrice',
  218. label: '合计总金额',
  219. align: 'center',
  220. showOverflowTooltip: true,
  221. minWidth: 130
  222. },
  223. {
  224. prop: 'amountReceivablePrice',
  225. label: '应收款金额',
  226. align: 'center',
  227. showOverflowTooltip: true,
  228. minWidth: 130
  229. },
  230. {
  231. prop: 'reviewStatus',
  232. label: '状态',
  233. align: 'center',
  234. showOverflowTooltip: true,
  235. minWidth: 200,
  236. formatter: (_row, _column, cellValue) => {
  237. return reviewStatusEnum[_row.reviewStatus].label;
  238. }
  239. },
  240. {
  241. prop: 'replied',
  242. label: '是否回执',
  243. align: 'center',
  244. slot: 'replied',
  245. showOverflowTooltip: true,
  246. minWidth: 200,
  247. formatter: (_row, _column, cellValue) => {
  248. return _row.replied ? '是' : '否';
  249. }
  250. },
  251. {
  252. prop: 'createTime',
  253. label: '创建时间',
  254. align: 'center',
  255. showOverflowTooltip: true,
  256. minWidth: 170
  257. },
  258. {
  259. columnKey: 'action',
  260. label: '操作',
  261. width: 230,
  262. align: 'center',
  263. resizable: false,
  264. slot: 'action',
  265. showOverflowTooltip: true,
  266. fixed: 'right'
  267. }
  268. ]
  269. };
  270. },
  271. computed: {},
  272. methods: {
  273. /* 表格数据源 */
  274. datasource({page, limit, where, order}) {
  275. return getAccountstatementList({
  276. pageNum: page,
  277. size: limit,
  278. type: 1,
  279. ...where
  280. });
  281. },
  282. /* 刷新表格 */
  283. reload(where) {
  284. this.$refs.table.reload({page: 1, where});
  285. },
  286. //新增编辑
  287. handleAddOrEditAccount(type, row) {
  288. this.addAccountDialogFlag = true
  289. this.$nextTick(() => {
  290. this.$refs.accountDialogRef.open(type, row, '1')
  291. })
  292. },
  293. //导出
  294. async handleExport(row) {
  295. let data = await accountStatementExportAPI(row.id)
  296. saveAs(data.data,'应收对账单')
  297. },
  298. //批量删除
  299. allDelBtn() {
  300. if (this.selection.length === 0) return;
  301. let flag = this.selection.some(item => [1, 2].includes(item.reviewStatus))
  302. if (flag) return this.$message.warning('抱歉已审核、审核中的数据不能删除,请检查')
  303. this.delVisible = true;
  304. },
  305. //删除接口
  306. remove(delData) {
  307. deletetAccountstatement(delData).then((res) => {
  308. this.$message.success('删除成功!');
  309. this.reload();
  310. });
  311. },
  312. //删除弹框确定
  313. commitBtn() {
  314. const dataId = this.selection.map((v) => v.id);
  315. this.remove(dataId);
  316. },
  317. accountstatementSubmit(res) {
  318. submitAccountStatementApproveAPI({
  319. businessId: res.id,
  320. type: '1'
  321. }).then((res) => {
  322. this.$message.success('提交成功!');
  323. this.reload();
  324. });
  325. },
  326. //查看详情
  327. openorderDetail(row, type) {
  328. if (type === 'statementNo') {
  329. this.detailDialogFlag = true
  330. this.$nextTick(() => {
  331. this.$refs.detailDialogRef.open('view', row, '1')
  332. })
  333. }
  334. if (type === 'orderNo') {
  335. this.$refs.orderDetailDialogRef.open({id: row.orderId});
  336. }
  337. }
  338. }
  339. };
  340. </script>
  341. <style lang="scss" scoped>
  342. .ele-body {
  343. padding-top: 0;
  344. padding-bottom: 0;
  345. }
  346. :deep .el-card__body {
  347. padding: 0;
  348. }
  349. :deep(.el-link--inner) {
  350. margin-left: 0px !important;
  351. }
  352. .sys-organization-list {
  353. height: calc(100vh - 264px);
  354. box-sizing: border-box;
  355. border-width: 1px;
  356. border-style: solid;
  357. overflow: auto;
  358. }
  359. .sys-organization-list :deep(.el-tree-node__content) {
  360. height: 40px;
  361. & > .el-tree-node__expand-icon {
  362. margin-left: 10px;
  363. }
  364. }
  365. .switch_left ul .active {
  366. border-top: 4px solid var(--color-primary);
  367. color: var(--color-primary-5);
  368. }
  369. .switch {
  370. padding-bottom: 20px;
  371. }
  372. .el-dropdown-link {
  373. cursor: pointer;
  374. color: var(--color-primary-5);
  375. }
  376. .el-icon-arrow-down {
  377. font-size: 12px;
  378. }
  379. </style>