Sfoglia il codice sorgente

数据映射修改

duy 6 giorni fa
parent
commit
2d2d1be3e2
1 ha cambiato i file con 7 aggiunte e 46 eliminazioni
  1. 7 46
      src/views/tentative/components/dataMap.vue

+ 7 - 46
src/views/tentative/components/dataMap.vue

@@ -124,52 +124,10 @@ export default {
     };
   },
   watch: {
-    curItem: {
-      handler(newVal, oldVal) {
-        if (
-          this.curItem.elementId &&
-          this.curItem.elementKey &&
-          this.curItem.htmlKeyName &&
-          this.curItem.trialTabId &&
-          this.curItem.trialTabName
-        ) {
-          const newItem = Object.assign({}, newVal);
-          const isContained = this.containsObject(
-            this.clickArr,
-            "htmlKeyName",
-            newItem.htmlKeyName
-          );
-        
-          
-          if (isContained) {
-            this.clickArr.forEach((ele) => {
-              if (ele.htmlKeyName === newItem.htmlKeyName) {
-                ele.elementId = newItem.elementId;
-                ele.elementKey = newItem.elementKey;
-                ele.htmlKeyName = newItem.htmlKeyName;
-                ele.trialTabId = newItem.trialTabId;
-                ele.trialTabName = newItem.trialTabName;
-              }
-            });
-          } else {
-            this.clickArr.push(newItem);
-          }
-        }
-        // 在这里执行你想要的操作
-      },
-      deep: true, // 指定为深度监听,
-    },
+ 
   },
   methods: {
-    // 判断数组中是否包含目标对象的函数
-    containsObject(array, keyName, targetValue) {
-      for (let i = 0; i < array.length; i++) {
-        if (array[i][keyName] === targetValue) {
-          return true;
-        }
-      }
-      return false;
-    },
+  
     async getExcelHtmlCol(classId, form) {
       //获取excel模板
       const { data: res } = await getLinkHtml({ classId });
@@ -273,8 +231,7 @@ export default {
             }
           });
         }
-        this.clickKeyname =
-          target.getAttribute("keyname") || target1.getAttribute("keyname");
+        this.clickKeyname = target.getAttribute("keyname") || target1.getAttribute("keyname");
           this.$set(this.curItem, "htmlKeyName", this.clickKeyname);
           this.listArr.forEach((ele)=>{
             ele.htmlKeyName= this.clickKeyname
@@ -371,6 +328,10 @@ export default {
       });
       if (res.code === 200) {
         this.listArr = res.data.length>0?res.data:[{}]
+          this.listArr.forEach((ele)=>{
+            ele.htmlKeyName= this.clickKeyname
+        
+          })
         this.formoptions.forEach((ele)=>{
          this.listArr.forEach(async(eleItem,eleIndex)=>{
           if(ele.pkeyId===eleItem.trialTabId){