Browse Source

风险评估保存报错问题修复

shenqilong 8 months ago
parent
commit
32d7c25e28
1 changed files with 24 additions and 1 deletions
  1. 24 1
      src/views/platform/risk/riskDetail.vue

+ 24 - 1
src/views/platform/risk/riskDetail.vue

@@ -1001,9 +1001,10 @@ export default {
 
 
                 // 新增
                 // 新增
                 if (addedIds.length > 0) {
                 if (addedIds.length > 0) {
+                    const paramWhere = this.getParams(JSON.parse(JSON.stringify(addedIds)))
                     const params = {
                     const params = {
                         tableName: 't_fxsbpgb2',
                         tableName: 't_fxsbpgb2',
-                        paramWhere: addedIds
+                        paramWhere: paramWhere
                     }
                     }
                     console.log(params)
                     console.log(params)
                     await this.$common.request('add', params)
                     await this.$common.request('add', params)
@@ -1055,6 +1056,28 @@ export default {
                 this.$message.warning(error.message)
                 this.$message.warning(error.message)
                 throw new Error(error.message)
                 throw new Error(error.message)
             }
             }
+        },
+        getParams (inputArray) {
+            const allKeys = new Set()
+            inputArray.forEach(obj => {
+                Object.keys(obj).forEach(key => {
+                    allKeys.add(key)
+                })
+            })
+
+            const standardizedArray = inputArray.map(obj => {
+                const newObj = {}
+                for (const key of allKeys) {
+                    if (key in obj) {
+                        newObj[key] = obj[key]
+                    } else {
+                        newObj[key] = ''
+                    }
+                }
+                return newObj
+            })
+
+            return standardizedArray
         }
         }
     }
     }