index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <div>
  3. <basic-container>
  4. <avue-crud
  5. :option="option"
  6. :data="dataList"
  7. ref="crud"
  8. v-model="form"
  9. :page.sync="page"
  10. :search.sync="search"
  11. @search-change="searchChange"
  12. @current-change="currentChange"
  13. @size-change="sizeChange"
  14. @refresh-change="refreshChange"
  15. @on-load="onLoad"
  16. :table-loading="loading"
  17. @saveColumn="saveColumn"
  18. @resetColumn="resetColumn"
  19. @expand-change="expandChange"
  20. >
  21. <template slot-scope="scope" slot="expand">
  22. <el-table :data="scope.row.insideList" v-loading="scope.row.loading">
  23. <el-table-column label="发货单号" prop="billNo" align="center" show-overflow-tooltip width="200"></el-table-column>
  24. <el-table-column label="订单号" prop="orderNo" align="center" show-overflow-tooltip width="200"></el-table-column>
  25. <el-table-column label="金额" prop="overpayment" align="center" show-overflow-tooltip width="200"></el-table-column>
  26. <el-table-column label="消费类型" prop="overpaymentType" align="center" show-overflow-tooltip width="200">
  27. <template slot-scope="scope">
  28. <span>{{ scope.row.overpaymentType == 0? '增加': '消费' }}</span>
  29. </template>
  30. </el-table-column>
  31. <el-table-column label="创建时间" prop="createTime" align="center" show-overflow-tooltip width="200"></el-table-column>
  32. <el-table-column label="创建人" prop="createUserName" align="center" show-overflow-tooltip width="200"></el-table-column>
  33. </el-table>
  34. </template>
  35. <template slot="corpIdSearch">
  36. <crop-select
  37. v-model="search.corpId"
  38. corpType="KH"
  39. ></crop-select>
  40. </template>
  41. <template slot-scope="scope" slot="corpId">
  42. {{ scope.row.corpName }}
  43. </template>
  44. </avue-crud>
  45. </basic-container>
  46. </div>
  47. </template>
  48. <script>
  49. import option from './config/mainList.json';
  50. import {getList, overpaymentDetail} from '@/api/maintenance/overpayment';
  51. export default {
  52. name: "index",
  53. data() {
  54. return {
  55. option: {},
  56. dataList: [],
  57. form: {},
  58. page: {
  59. pageSize: 10,
  60. pagerCount: 5,
  61. total: 0,
  62. },
  63. search: {},
  64. loading: false,
  65. }
  66. },
  67. async created() {
  68. // this.option = option
  69. this.option = await this.getColumnData(this.getColumnName(53), option);
  70. let i = 0;
  71. this.option.column.forEach(item => {
  72. if (item.search) i++
  73. })
  74. if (i % 3 !== 0){
  75. const num = 3 - Number(i % 3)
  76. this.option.searchMenuSpan = num * 8;
  77. this.option.searchMenuPosition = "right";
  78. }
  79. },
  80. methods: {
  81. searchChange(params, done) {
  82. this.onLoad(this.page, params);
  83. done();
  84. },
  85. currentChange(val) {
  86. this.page.currentPage = val;
  87. },
  88. sizeChange(val) {
  89. this.page.currentPage = 1;
  90. this.page.pageSize = val;
  91. },
  92. refreshChange() {
  93. this.dataList.forEach(item => {
  94. this.$refs.crud.toggleRowExpansion(item, false)
  95. })
  96. this.page.currentPage = 1;
  97. this.onLoad(this.page, this.search);
  98. },
  99. onLoad(page, params) {
  100. this.loading = true;
  101. getList(page.currentPage, page.pageSize, params)
  102. .then(res => {
  103. this.dataList = res.data.data.records ? res.data.data.records : [];
  104. this.page.total = res.data.data.total;
  105. if (this.page.total) {
  106. this.option.height = window.innerHeight - 260;
  107. }
  108. this.dataList.forEach(item => {
  109. this.$set(item,'insideList',[])
  110. this.$set(item,'loading', true)
  111. })
  112. })
  113. .finally(() => {
  114. this.loading = false;
  115. });
  116. },
  117. // 表格展开触发
  118. expandChange(row, index) {
  119. if (row.loading) {
  120. overpaymentDetail({pid: row.id}).then(res => {
  121. row.insideList = res.data.data? res.data.data.records: []
  122. row.loading = false
  123. })
  124. }
  125. },
  126. async saveColumn() {
  127. const inSave = await this.saveColumnData(
  128. this.getColumnName(53),
  129. this.option
  130. );
  131. if (inSave) {
  132. this.$message.success("保存成功");
  133. //关闭窗口
  134. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  135. }
  136. },
  137. async resetColumn() {
  138. const inSave = await this.delColumnData(
  139. this.getColumnName(53),
  140. option
  141. );
  142. if (inSave) {
  143. this.$message.success("重置成功");
  144. this.option = option;
  145. //关闭窗口
  146. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  147. }
  148. },
  149. },
  150. }
  151. </script>
  152. <style scoped>
  153. /deep/ .el-table__expanded-cell .el-table__header-wrapper .cell {
  154. font-size: 8px !important;
  155. }
  156. /deep/ .el-table__body-wrapper .cell {
  157. font-size: 8px;
  158. }
  159. </style>