Qukatie 9 месяцев назад
Родитель
Сommit
117d4be92a
1 измененных файлов с 31 добавлено и 3 удалено
  1. 31 3
      src/views/boxManagement/boxPoolDynamics/index.vue

+ 31 - 3
src/views/boxManagement/boxPoolDynamics/index.vue

@@ -15,7 +15,8 @@
                         :search.sync="query2" v-model="form2" id="out-table" :header-cell-class-name="headerClassName"
                         ref="crud2" @search-change="searchChange2" @search-reset="searchReset2"
                         @current-change="currentChange2" @size-change="sizeChange2" @refresh-change="refreshChange2"
-                        @on-load="onLoad2">
+                        @on-load="onLoad2" @resetColumn="resetColumn('crud2', 'option2', 'optionBack2', 466)"
+                        @saveColumn="saveColumn('crud2', 'option2', 'optionBack2', 466)">
                         <template slot="menuLeft">
                             <!-- <el-button type="primary" plain size="small"
                                 @click="allClick('空箱出场(EDI)')">空箱出场(EDI)</el-button> -->
@@ -231,7 +232,8 @@ export default {
                     },
                 ]
             },
-            option2: {
+            option2:{},
+            optionBack2:{
                 height: 'auto',
                 calcHeight: 30,
                 menuWidth: 70,
@@ -413,7 +415,8 @@ export default {
     components: {
         detailsPage
     },
-    created() {
+    async created() {
+        this.option2 = await this.getColumnData(this.getColumnName(466), this.optionBack2);
     },
     methods: {
         uploadBefore(file, done, loading) {
@@ -568,6 +571,31 @@ export default {
             })
             window.open(routeData.href.slice(1, routeData.href.length) + '&' + `${this.website.tokenHeader}=${getToken()}`);
         },
+             //自定义列保存
+             async saveColumn(ref, option, optionBack, code) {
+            /**
+             * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
+             * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
+             * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
+             */
+            const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
+            if (inSave) {
+                this.$message.success("保存成功");
+                //关闭窗口
+                this.$refs[ref].$refs.dialogColumn.columnBox = false;
+                this.searchReset()
+            }
+        },
+        //自定义列重置
+        async resetColumn(ref, option, optionBack, code) {
+            this[option] = this[optionBack];
+            const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
+            if (inSave) {
+                this.$message.success("重置成功");
+                this.$refs[ref].$refs.dialogColumn.columnBox = false;
+                this.searchReset()
+            }
+        },
         // 更改表格颜色
         headerClassName(tab) {
             //颜色间隔