Explorar o código

列配置修改

yusheng hai 6 meses
pai
achega
a398e5b503

+ 6 - 2
src/mixins/tableColumnsMixin.js

@@ -3,12 +3,15 @@ import request from '@/utils/request';
 export default {
   data() {
     return {
-      newColumns: []
+      newColumns: [],
+      tabMixinsInit: true //进入页面是否默认请求列配置
     };
   },
   created() {
     //从服务器获取缓存列表配置
-    this.getTabColumns();
+    if (this.tabMixinsInit) {
+      this.getTabColumns();
+    }
     // 创建防抖函数并绑定this
     this.debouncedHandleColumnChange = this.debounce(
       this.handleColumnChangeImpl,
@@ -35,6 +38,7 @@ export default {
 
     // 获取table-column配置
     async getTabColumns() {
+      console.log(1);
       const res = await this.getByTableId(this.cacheKeyUrl);
       if (res?.columnConfig?.length > 0) {
         //对比接口返回和本地columns

+ 1 - 0
src/views/productionPlan/index.vue

@@ -506,6 +506,7 @@
         pageType: 'add',
         dialogTitle: '',
         isBindPlan: false,
+        tabMixinsInit:false,
         statusOpt: {
           first: [
             { label: '所有状态', value: '3,2' },

+ 2 - 4
src/views/saleOrder/index.vue

@@ -156,7 +156,7 @@
   } from '@/api/saleOrder';
   import dictMixins from '@/mixins/dictMixins';
   import { debounce } from 'lodash';
-  import { Alert } from 'element-ui';
+
   import tabMixins from '@/mixins/tableColumnsMixin';
 
   export default {
@@ -176,7 +176,7 @@
         loading: false,
         activeName: 'first',
         selection: [],
-
+        tabMixinsInit:false,
         columns: [],
         cacheKeyUrl: 'c32a9c7d-aps-saleOrder-index',
         columnsVersion: 1,
@@ -683,9 +683,7 @@
               showOverflowTooltip: true
             };
           });
-          // console.log(this._newColumns, 'newRes');
           this.columns = [...this.columns, ...newRes, ...privateColumn];
-          // console.log(this.newColumns, 'productCode')
           this.getTabColumns();
           // this.$forceUpdate();
         });

+ 1 - 0
src/views/workOrder/index.vue

@@ -308,6 +308,7 @@
         dispatchVisible: false,
         selectionMap: {},
         detailsVisible: false,
+        tabMixinsInit:false,
         tabValue: '1',
         treeId: [],
         tableHeight: 'calc(100vh - 345px)'