瀏覽代碼

Merge remote-tracking branch 'origin/1.2.2' into 1.2.2

threethousanddream 2 月之前
父節點
當前提交
03393ba2e4

+ 26 - 13
src/components/Generator/components/InputTable/index.vue

@@ -488,16 +488,16 @@ export default {
         //   this.addRowList = filteredData.map(row => row.reduce((p, c) => (p[c.__vModel__] = c.value, p), {}))
         // }
         // const formMethod = primaryId ? NewupdateModel : NewAddModel
-        NewupdateModel(this.modeId, params, primaryId, this.config.dbLinkId, 2).then((res) => {
-          this.$message({
-            message: res.data.msg,
-            type: 'success',
-            duration: 1500,
-            onClose: () => {
-              this.getInData()
-            }
-          })
-        })
+        // NewupdateModel(this.modeId, params, primaryId, this.config.dbLinkId, 2).then((res) => {
+        //   this.$message({
+        //     message: res.data.msg,
+        //     type: 'success',
+        //     duration: 1500,
+        //     onClose: () => {
+        //       this.getInData()
+        //     }
+        //   })
+        // })
       }
 
       if (['JNPF-Amount', 'el-input-number'].includes(tag)) {
@@ -614,8 +614,21 @@ export default {
       const checkCol = (col) => col.required && !this.checkData(col) && (res = col.valid = false)
       filteredData.forEach((row) => row.forEach(checkCol))
       // 将新增数据过滤出来返回给主表
-      let filterData = this.filterAddData(filteredData)
-      return res ? filterData.map((row) => row.reduce((p, c) => ((p[c.__vModel__] = c.value), p), {})) : false
+      // let filterData = this.filterAddData(filteredData)
+      return res ? filteredData.map((row, index) => {
+        // 初始化一个空对象用于存储结果
+        let resultObj = {};
+        // 遍历每一行的数据
+        row.forEach(item => {
+          // 如果 resultObj 为空,则初始化 idKey
+          if (Object.keys(resultObj).length === 0) {
+            resultObj.idKey = item.idKey || null ;
+          }
+          // 将 value 与 __vModel__ 关联
+          resultObj[item.__vModel__] = item.value;
+        });
+        return resultObj;
+      }) : false
     },
     /**
      * 根据formid获取完整组件配置
@@ -760,7 +773,7 @@ export default {
       if (!Array.isArray(this.tableFormData)) {
         this.tableFormData = []
       }
-      this.tableFormData.unshift(this.getEmptyRow(val, flag,relationFlag))
+      this.tableFormData.push(this.getEmptyRow(val, flag,relationFlag))
       if (!createFlag){
         this.clearAddRowFlag(index)
       }

+ 2 - 0
src/components/Generator/parser/Parser.vue

@@ -703,6 +703,8 @@ export default {
       const rowData = rowRes.data.data
       // 获取当前表格信息
       const rowDetailData = await detail(this.modelId, rowData.dbLinkId)
+      localStorage.setItem("BROWSER_associationData", JSON.stringify(rowDetailData.associationData));
+      localStorage.setItem("BROWSER_associationColumnDict", JSON.stringify(rowDetailData.associationColumnDict));
 
       function isEmptyObject(obj) {
         return Object.keys(obj).length === 0

文件差異過大導致無法顯示
+ 2 - 2
src/utils/request.js


+ 3 - 1
src/views/basic/dynamicModel/list/Form.vue

@@ -585,7 +585,9 @@ export default {
               item[i.__vModel__] = item[i.__vModel__].map(q => (q > 0 ? q : q.id)).filter(Boolean).join(';');
             }
           })
-          result.push({ dbLink: key, id: '', oldData: null, data: JSON.stringify(item),...serialincData })
+          // 使用Object.assign创建一个新对象,不包含idKey属性
+          let newObj = Object.assign({}, item, { idKey: undefined });
+          result.push({ dbLink: key, id: item.idKey, oldData: null, data: JSON.stringify(newObj),...serialincData })
         })
       }
       return result