index.vue 7.3 KB

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