index.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <div>
  3. <basic-container v-if="show">
  4. <avue-crud
  5. :option="option"
  6. :search.sync="search"
  7. v-model="form"
  8. :table-loading="loading"
  9. :data="dataList"
  10. ref="crud"
  11. :key="key"
  12. @on-load="onLoad"
  13. @search-change="searchChange"
  14. @refresh-change="refreshChange"
  15. @resetColumn="resetColumnTwo('crud','option','optionList',239)"
  16. @saveColumn="saveColumnTwo('crud','option','optionList',239)"
  17. :page.sync="page">
  18. <template slot="corpNameSearch">
  19. <crop-select v-model="search.corpId" corpType="KH"/>
  20. </template>
  21. <template slot-scope="scope" slot="amount">
  22. <span style="color: #409EFF;cursor: pointer"
  23. @click.stop="beforeOpenPage(scope.row, scope.index,'YING')">{{ scope.row.amount }}</span>
  24. </template>
  25. <template slot-scope="scope" slot="settlementAmount">
  26. <span style="color: #409EFF;cursor: pointer"
  27. @click.stop="beforeOpenPage(scope.row, scope.index,'YI')">{{ scope.row.settlementAmount }}</span>
  28. </template>
  29. <template slot-scope="scope" slot="menuLeft">
  30. <el-button type="warning"
  31. icon="el-icon-plus"
  32. size="small"
  33. @click="outExport"
  34. >导出
  35. </el-button>
  36. </template>
  37. </avue-crud>
  38. </basic-container>
  39. <detail-page
  40. ref="detail"
  41. @goBack="goBack"
  42. :detailData="detailData"
  43. v-else
  44. ></detail-page>
  45. </div>
  46. </template>
  47. <script>
  48. import {getList} from "@/api/accountBalance/index.js";
  49. import detailPage from "./detailPage.vue";
  50. import {getToken} from "@/util/auth";
  51. export default {
  52. name: "index",
  53. components:{
  54. detailPage
  55. },
  56. data() {
  57. return {
  58. loading: false,
  59. show:true,
  60. search: {},
  61. form: {},
  62. detailData: {},
  63. dataList: [],
  64. page: {
  65. pageSize: 20,
  66. currentPage: 1,
  67. total: 0,
  68. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  69. },
  70. key: 0,
  71. option: {},
  72. optionList: {
  73. viewBtn: false,
  74. editBtn: false,
  75. delBtn: false,
  76. addBtn: false,
  77. index: true,
  78. span: 8,
  79. border: true,
  80. height: "auto",
  81. searchMenuPosition: "right",
  82. align: "center",
  83. menuWidth: 140,
  84. searchSpan: 8,
  85. searchIcon: true,
  86. searchIndex: 2,
  87. highlightCurrentRow: true,
  88. dialogWidth: "70%",
  89. menu: false,
  90. showSummary: true,
  91. sumColumnList: [{
  92. name: 'amount',
  93. type: 'sum',
  94. decimals: 2
  95. },{
  96. name: 'settlementAmount',
  97. type: 'sum',
  98. decimals: 2
  99. },{
  100. name: 'balance',
  101. type: 'sum',
  102. decimals: 2
  103. },{
  104. name: 'inOverpayment',
  105. type: 'sum',
  106. decimals: 2
  107. }],
  108. column: [{
  109. label: '客户',
  110. prop: 'corpName',
  111. search: true,
  112. overHidden: true,
  113. }, {
  114. label: '本期应收',
  115. prop: 'amount',
  116. overHidden: true,
  117. }, {
  118. label: '本期已收',
  119. prop: 'settlementAmount',
  120. overHidden: true,
  121. }, {
  122. label: '余额(总)',
  123. prop: 'balance',
  124. overHidden: true,
  125. }, {
  126. label: '日期',
  127. prop: 'createDateList',
  128. search: true,
  129. showColumn: false,
  130. hide: true,
  131. type: "date",
  132. searchRange: true,
  133. searchDefaultTime: ["00:00:00", "23:59:59"],
  134. format: "yyyy-MM-dd",
  135. valueFormat: "yyyy-MM-dd HH:mm:ss"
  136. },{
  137. label: '溢付款余额',
  138. prop: 'inOverpayment',
  139. overHidden: true,
  140. }]
  141. }
  142. }
  143. },
  144. async created() {
  145. this.option = await this.getColumnData(this.getColumnName(239), this.optionList);
  146. this.key++
  147. let i = 0;
  148. this.option.column.forEach(item => {
  149. if (item.search) i++
  150. })
  151. if (i % 3 !== 0) {
  152. const num = 3 - Number(i % 3)
  153. this.option.searchMenuSpan = num * 8;
  154. this.option.searchMenuPosition = "right";
  155. }
  156. },
  157. methods: {
  158. goBack(){
  159. this.show = true;
  160. this.onLoad(this.page,this.search)
  161. },
  162. //导出
  163. outExport() {
  164. this.$confirm('是否导出列表?', '提示', {
  165. confirmButtonText: '确定',
  166. cancelButtonText: '取消',
  167. type: 'warning'
  168. }).then(() => {
  169. let queryParams = this.search
  170. const routeData = this.$router.resolve({
  171. path: '/api/trade-finance/acc/selBillBalanceExport', //跳转目标窗口的地址
  172. query: {
  173. 'Blade-Auth': getToken(),
  174. ...queryParams,//括号内是要传递给新窗口的参数
  175. billType: "收费"
  176. }
  177. })
  178. window.open(routeData.href.slice(1, routeData.href.length));
  179. }).catch(() => {
  180. this.$message({
  181. type: 'info',
  182. message: '已取消' //
  183. });
  184. })
  185. },
  186. beforeOpenPage(row, index, chargePay) {
  187. this.show = false
  188. this.detailData = {
  189. ...row,
  190. chargePay: chargePay,
  191. createDateList: this.search.createDateList
  192. }
  193. },
  194. //刷新
  195. refreshChange() {
  196. this.onLoad(this.page, this.search)
  197. },
  198. searchChange(params, done) {
  199. done();
  200. this.onLoad(this.page, params)
  201. },
  202. onLoad(page, params = {}) {
  203. params = {
  204. ...params,
  205. current: page.currentPage,
  206. size: page.pageSize,
  207. billType:"收费"
  208. }
  209. this.loading = true
  210. getList(params).then(res => {
  211. this.dataList = res.data.data.records
  212. this.page.total = res.data.data.total
  213. this.loading = false
  214. }).finally(() => {
  215. this.loading = false
  216. })
  217. },
  218. //自定义列保存
  219. async saveColumnTwo(ref, option, optionBack, code) {
  220. /**
  221. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  222. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  223. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  224. */
  225. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  226. if (inSave) {
  227. this.$message.success("保存成功");
  228. //关闭窗口
  229. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  230. }
  231. },
  232. //自定义列重置
  233. async resetColumnTwo(ref, option, optionBack, code) {
  234. this[option] = this[optionBack];
  235. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  236. if (inSave) {
  237. this.$message.success("重置成功");
  238. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  239. }
  240. }
  241. }
  242. }
  243. </script>
  244. <style scoped>
  245. </style>