Jelajahi Sumber

自定义栏位修改

zhuliu 9 bulan lalu
induk
melakukan
22f3fe4d8d

+ 1 - 5
src/views/project/patentCollection/index.vue

@@ -644,11 +644,7 @@ export default {
       if(change){
         this.customList = await this.$commonJS.getCustomField('patent', { projectId: this.projectId, taskId: this.taskId })
         this.getColumn()
-        this.$refs.customFields.getAllCountColumns()
-        setTimeout(()=>{
-          this.$refs.customFields.refreshOptions(1)
-        },500)
-        
+        this.$refs.customFields.refreshField()
       }
     },
     //获取显示栏位

+ 18 - 5
src/views/report/components/patentList/components/customFields/index.vue

@@ -118,6 +118,19 @@ export default {
     this.getAllCountColumns()
   },
   methods: {
+    //刷新栏位
+    async refreshField(){
+      var index = this.field.findIndex(item=>{
+        return item.filedKind == 0
+      })
+      if(index != -1){
+        await this.getShowCountColumns()
+      }
+      this.getAllCountColumns()
+      setTimeout(()=>{
+        this.refreshOptions(1)
+      },500)
+    },
     // 条件改变时刷新已打开的折叠面板
     refreshOptions(sign) {
       for (let i = 0; i < this.activeName.length; i++) {
@@ -502,6 +515,7 @@ export default {
     },
     // 给数据添加ifHidden
     handleFiled(data) {
+      var field = []
       for (var i = 0; i < data.length; i++) {
         data[i].check = []
         // 分类选择:获取树类型
@@ -517,12 +531,10 @@ export default {
         }
         this.getSelect(data[i])
         for (var j = 0; j < this.showField.length; j++) {
-          if (data[i].name == this.showField[j].name && data[i].filedKind == this.showField[j].filedKind) {
+          if (data[i].value == this.showField[j].value && data[i].filedKind == this.showField[j].filedKind) {
             data[i].ifHidden = false
-            
-            // this.field.push(data[i])
-            this.$set(this.field,j,data[i])
-            // this.field[j] = data[i]
+            field[j] = data[i]
+            // this.$set(field,j,data[i])
             
             //查统计todo统计接口
           //  this.esCountAnalysis(data[i])
@@ -536,6 +548,7 @@ export default {
           this.filedAll.push(data[i])
         }
       }
+      this.field = field.filter(Boolean)
       this.$store.commit('SET_SYSTEM_FIELD',this.filedAll)
     },