浏览代码

fix: 时间表格的文本行值重复

Karsa 1 年之前
父节点
当前提交
aa982d25de
共有 1 个文件被更改,包括 5 次插入9 次删除
  1. 5 9
      src/views/datasheet_manage/components/CustomTable.vue

+ 5 - 9
src/views/datasheet_manage/components/CustomTable.vue

@@ -505,18 +505,14 @@ export default {
 
       //如果有文本行 文本行的数据长度也要增加
       if(this.config.textRowData.length) {
-        let cell_len = this.config.textRowData[0].length - 1;
-        console.log(cell_len)
-        let row = new Array(this.config.data.length-cell_len).fill('').map(_ =>({
+        let cell_item = {
           ShowValue: '',
           Value: '',
           DataType: 3,
           DataTime: '',
-        }))
-        this.config.textRowData.forEach(_ => {
-          row.forEach(cell=> {
-            _.push(cell)
-          })
+        }
+        this.config.textRowData.forEach(row => {
+            row.push(_.cloneDeep(cell_item))
             
         })
       }
@@ -591,7 +587,7 @@ export default {
           DataType: 3,
           DataTime: '',
         }))
-        this.config.textRowData.push(row)
+        this.config.textRowData.push(_.cloneDeep(row))
         console.log(this.config.textRowData)
     },