Ver código fonte

另存:过滤重复项

洪海涛 4 anos atrás
pai
commit
b6817363aa
1 arquivos alterados com 8 adições e 3 exclusões
  1. 8 3
      src/store/modules/monthlyReport/edit/index.js

+ 8 - 3
src/store/modules/monthlyReport/edit/index.js

@@ -548,9 +548,14 @@ export default {
       const find = (arr) => {
         arr.forEach(elm => {
           if (elm.title === '线上问题') {
-            // console.log(532, elm, rowData)
-            // console.log(elm.content[0].tableRows, rowData)
-            elm.content[0].tableRows.push(rowData[0])
+            const newQuestion = rowData[0].tableItems[1].value
+            const isQuestion = elm.content[0].tableRows.map(elm => elm.tableItems[1]).filter(
+              elm => elm.value === newQuestion
+            )
+            // 判断数据是否冲突
+            if (!isQuestion.length) {
+              elm.content[0].tableRows.push(rowData[0])
+            }
           }
           if (elm.children && elm.children.length) {
             find(elm.children)