Browse Source

拆分特征时设置特征id

zhuliu 1 year ago
parent
commit
e568d281fa
1 changed files with 16 additions and 2 deletions
  1. 16 2
      src/views/report/components/splitPage/splitPage.vue

+ 16 - 2
src/views/report/components/splitPage/splitPage.vue

@@ -495,6 +495,18 @@ export default {
         this.checkList = []
       }
     },
+
+    //获取最大的特征id
+    getMaxFeatureId(){
+      var arr = this.tableData.sort((a,b)=>{
+        return a.featureId - b.featureId
+      })
+      if(arr && arr.length>0){
+        return arr[arr.length-1].featureId
+      }
+      return 0
+      
+    },
     // 拆分
     split() {
       //不能同时拆分
@@ -510,13 +522,15 @@ export default {
         if (!splitDisable) {
           return false
         }
-        var rowId = Math.floor((Math.random() * 9999) + 1000);
+        // var rowId = Math.floor((Math.random() * 9999) + 1000);
+        var rowId = this.getMaxFeatureId()
         var arr = this.columnMerge()
         this.scopeRow.forEach((rowItem, rowIndex) => {
           rowItem.ifChange=true
           // 将字段的值给到拆分新数据
           var splitAdd = JSON.parse(JSON.stringify(rowItem))
-          splitAdd.featureId = rowItem.featureId + rowId + "a"
+          // splitAdd.featureId = rowItem.featureId + rowId + "a"
+          splitAdd.featureId = Number(rowId) + 10
           // 将部分展示字段置为空
           for (let i = 0; i < arr.length; i++) {
             splitAdd[arr[i]] = ''