index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <div>
  3. <basic-container v-show="show" class="page-crad">
  4. <avue-crud ref="crud" :option="option" :data="dataList" v-model="form" :page.sync="page"
  5. :search.sync="search" @search-change="searchChange" @current-change="currentChange"
  6. @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad" :table-loading="loading"
  7. @saveColumn="saveColumn" @resetColumn="resetColumn" :cell-style="cellStyle"
  8. @selection-change="selectionChange" @search-criteria-switch="searchCriteriaSwitch">
  9. <template slot-scope="{row}" slot="ffeeslabel">
  10. <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(row, 1)">{{
  11. row.ffeeslabel
  12. }}
  13. </span>
  14. </template>
  15. </avue-crud>
  16. </basic-container>
  17. <detail-page @goBack="goBack" :detailData="detailData" v-if="!show"></detail-page>
  18. </div>
  19. </template>
  20. <script>
  21. import option from "./config/mainList.json";
  22. import detailPage from "./detailsPage";
  23. import _ from "lodash";
  24. export default {
  25. name: "customerInformation",
  26. data() {
  27. return {
  28. search: {},
  29. form: {},
  30. option: {},
  31. dataList: [{
  32. ffeeslabel: '1111'
  33. }],
  34. page: {
  35. pageSize: 20,
  36. currentPage: 1,
  37. total: 0,
  38. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  39. },
  40. show: true,
  41. detailData: {},
  42. loading: false,
  43. searchShow: true,
  44. selectionList: [],
  45. };
  46. },
  47. components: { detailPage },
  48. async created() {
  49. this.option = await this.getColumnData(this.getColumnName(179), option);
  50. this.option.height = window.innerHeight - 210;
  51. },
  52. methods: {
  53. searchCriteriaSwitch(type) {
  54. if (type) {
  55. this.option.height = this.option.height - 191;
  56. } else {
  57. this.option.height = this.option.height + 191;
  58. }
  59. this.$refs.crud.getTableHeight();
  60. },
  61. cellStyle() {
  62. return "padding:0;height:40px;";
  63. },
  64. selectionChange(list) {
  65. this.selectionList = list;
  66. },
  67. editOpen(row, status) {
  68. this.detailData = {
  69. id: row.id,
  70. status: status
  71. };
  72. this.show = false;
  73. },
  74. //点击搜索按钮触发
  75. searchChange(params, done) {
  76. this.page.currentPage = 1;
  77. this.onLoad(this.page, params);
  78. done();
  79. },
  80. currentChange(val) {
  81. this.page.currentPage = val;
  82. },
  83. sizeChange(val) {
  84. this.page.currentPage = 1;
  85. this.page.pageSize = val;
  86. },
  87. onLoad(page, params) {
  88. // let data = this.deepClone(Object.assign(params, this.search));
  89. // this.loading = true;
  90. // getList(page.currentPage, page.pageSize, data)
  91. // .then(res => {
  92. // this.dataList = res.data.data.records ? res.data.data.records : [];
  93. // this.page.total = res.data.data.total;
  94. // })
  95. // .finally(() => {
  96. // this.loading = false;
  97. // });
  98. },
  99. refreshChange() {
  100. this.onLoad(this.page, this.search);
  101. },
  102. newAdd() {
  103. this.show = false;
  104. },
  105. goBack() {
  106. if (this.$route.query.id) {
  107. this.$router.$avueRouter.closeTag(this.$route.fullPath);
  108. this.$router.push({
  109. path: "/analyze/inventory/index"
  110. });
  111. }
  112. this.detailData = this.$options.data().detailData;
  113. this.show = true;
  114. this.onLoad(this.page, this.search);
  115. },
  116. async saveColumn() {
  117. const inSave = await this.saveColumnData(
  118. this.getColumnName(179),
  119. this.option
  120. );
  121. if (inSave) {
  122. this.$nextTick(() => {
  123. this.$refs.crud.doLayout();
  124. });
  125. this.$message.success("保存成功");
  126. //关闭窗口
  127. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  128. }
  129. },
  130. async resetColumn() {
  131. this.option = option;
  132. const inSave = await this.delColumnData(this.getColumnName(179), this.option);
  133. if (inSave) {
  134. this.$nextTick(() => {
  135. this.$refs.crud.doLayout();
  136. });
  137. this.$message.success("重置成功");
  138. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  139. }
  140. }
  141. }
  142. };
  143. </script>
  144. <style scoped>
  145. ::v-deep .select-component {
  146. display: flex;
  147. }
  148. .page-crad ::v-deep .basic-container__card {
  149. height: 94.2vh;
  150. }
  151. .itemTable ::v-deep .el-table {
  152. width: 738px;
  153. }
  154. </style>