Forráskód Böngészése

再次修复wbs树问题

admin 3 éve
szülő
commit
7450347966
1 módosított fájl, 13 hozzáadás és 12 törlés
  1. 13 12
      src/views/exctab/excelmodel/excelmodel.vue

+ 13 - 12
src/views/exctab/excelmodel/excelmodel.vue

@@ -238,7 +238,7 @@
                   <td style="width:50%;">{{val.tableName}}</td>
                   <td style="text-align: center;height:30px;">
                     <el-button
-                      v-if="val.isLinkTable==1"
+                      v-if="val.isLinkTable!==2"
                       type="info"
                       size="small"
                       @click="relation(index)"
@@ -324,7 +324,7 @@ export default {
             const { data: res } = await wbstree({ parentId: node.data.id, wbsId: this.excelForm.wbsId, wbsType: this.excelForm.wbsType })
             console.log(res);
             if (res.code === 200) {
-              if (Array.isArray(res.data)) {
+              if (res.msg != '未查询到信息') {
                 res.data.forEach((val) => {
                   if (!val.hasChildren) {
                     val.leaf = true
@@ -413,26 +413,27 @@ export default {
       const { data: res } = await wbstree({ parentId: 0, wbsId: this.excelForm.wbsId, wbsType: this.excelForm.wbsType })
       console.log(res);
       if (res.code === 200) {
-        res.data.forEach((val) => {
-          if (!val.hasChildren) {
-            val.leaf = true
-          }
-        })
-        this.wbsdata = res.data
+        if (res.msg != "未查询到信息") {
+          res.data.forEach((val) => {
+            if (!val.hasChildren) {
+              val.leaf = true
+            }
+          })
+          this.wbsdata = res.data
+        }
       }
     },
     async selectByNodeTable (id, wbsType) {//wbs树获取表
       const { data: res } = await selectByNodeTable({ id, wbsType })
       console.log(res);
       if (res.code === 200) {
-        console.log(Array.isArray(res.data));
-        if (Array.isArray(res.data)) {
+        if (res.msg == "未查询到信息") {
+          this.tableData = []
+        } else {
           this.tableData = res.data
           this.tableData.forEach(val => {
             val.changeTable = val.isLinkTable
           })
-        } else {
-          this.tableData = []
         }
       }
     },