detail.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <div>
  3. <basic-container v-show="show" class="page-crad">
  4. <avue-crud ref="crud" :option="option" :data="dataList" :page.sync="page" :search.sync="search"
  5. @search-change="searchChange" @current-change="currentChange" @size-change="sizeChange"
  6. @refresh-change="refreshChange" @on-load="onLoad" :table-loading="loading" @saveColumn="saveColumn"
  7. @resetColumn="resetColumn" :cell-style="cellStyle" @search-criteria-switch="searchCriteriaSwitch">
  8. <template slot-scope="{ row,index}" slot="corpId">
  9. <span>{{ row.corpName }}</span>
  10. </template>
  11. <template slot="corpIdSearch">
  12. <crop-select v-model="search.corpId" corpType="KH" :refresh="false"></crop-select>
  13. </template>
  14. <template slot-scope="{ row, index }" slot="menu">
  15. <el-button type="text" size="small" :disabled="row.status>0" @click.stop="rowView(row, index)">
  16. 查看详情
  17. </el-button>
  18. </template>
  19. </avue-crud>
  20. </basic-container>
  21. </div>
  22. </template>
  23. <script>
  24. import { option } from "./js/optionList";
  25. import { getfinancingDetailsList } from "@/api/basicData/financingLedger";
  26. export default {
  27. name: "index",
  28. data() {
  29. return {
  30. show: true,
  31. loading: false,
  32. form: {},
  33. search: {},
  34. detailData: {},
  35. dataList: [],
  36. selectionList: [],
  37. page: {
  38. pageSize: 10,
  39. currentPage: 1,
  40. total: 0,
  41. pageSizes: [10, 50, 100, 200, 300, 400, 500]
  42. },
  43. option: {},
  44. };
  45. },
  46. async created() {
  47. this.option = await this.getColumnData(this.getColumnName(194), option);
  48. // this.getWorkDicts("in_section").then(res => {
  49. // this.findObject(this.option.column, "inSection").dicData = res.data.data;
  50. // this.$refs.crud.init();
  51. // });
  52. this.option.height = window.innerHeight - 210;
  53. },
  54. methods: {
  55. searchCriteriaSwitch(type) {
  56. if (type) {
  57. this.option.height = this.option.height - 46;
  58. } else {
  59. this.option.height = this.option.height + 46;
  60. }
  61. this.$refs.crud.getTableHeight();
  62. },
  63. cellStyle() {
  64. return "padding:0;height:40px;";
  65. },
  66. //点击搜索按钮触发
  67. searchChange(params, done) {
  68. this.page.currentPage = 1;
  69. this.onLoad(this.page, params);
  70. done();
  71. },
  72. refreshChange() {
  73. this.onLoad(this.page, this.search);
  74. },
  75. newAdd() {
  76. this.show = false;
  77. },
  78. rowView(row) {
  79. this.$router.push({
  80. path: "/salesManagement/outStock/index",
  81. query: {
  82. generateId: row.id
  83. }
  84. });
  85. },
  86. onLoad(page, params = {}) {
  87. this.loading = true;
  88. this.dataList.forEach(item => {
  89. this.$refs.crud.toggleRowExpansion(item, false);
  90. });
  91. getfinancingDetailsList(
  92. page.currentPage,
  93. page.pageSize,
  94. Object.assign(params, this.search)
  95. )
  96. .then(res => {
  97. if (res.data.data.records) {
  98. res.data.data.records.forEach(e => {
  99. e.itemLoading = true;
  100. });
  101. }
  102. this.dataList = res.data.data.records ? res.data.data.records : [];
  103. this.page.total = res.data.data.total;
  104. })
  105. .finally(() => {
  106. this.loading = false;
  107. });
  108. },
  109. editOpen(row, status) {
  110. this.detailData = {
  111. id: row.id,
  112. status: status
  113. };
  114. this.show = false;
  115. },
  116. currentChange(val) {
  117. this.page.currentPage = val;
  118. },
  119. sizeChange(val) {
  120. this.page.currentPage = 1;
  121. this.page.pageSize = val;
  122. },
  123. async saveColumn() {
  124. const inSave = await this.saveColumnData(
  125. this.getColumnName(194),
  126. this.option
  127. );
  128. if (inSave) {
  129. this.$nextTick(() => {
  130. this.$refs.crud.doLayout();
  131. });
  132. this.$message.success("保存成功");
  133. //关闭窗口
  134. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  135. }
  136. },
  137. async resetColumn() {
  138. this.option = option;
  139. const inSave = await this.delColumnData(this.getColumnName(194), option);
  140. if (inSave) {
  141. this.$nextTick(() => {
  142. this.$refs.crud.doLayout();
  143. });
  144. this.$message.success("重置成功");
  145. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  146. }
  147. },
  148. //返回列表
  149. backToList() {
  150. this.detailData = this.$options.data().detailData;
  151. this.show = true;
  152. this.onLoad(this.page, this.search);
  153. }
  154. }
  155. };
  156. </script>
  157. <style scoped>
  158. .page-crad ::v-deep .basic-container__card {
  159. height: 94.2vh;
  160. }
  161. </style>