Ver Fonte

添加数据项

ws há 1 ano atrás
pai
commit
878191492c

+ 43 - 39
chuanyi_client2/src/components/CustomDialog/DataSourceItem.vue

@@ -515,9 +515,9 @@ export default {
     loadGroupDataItemNode(node, resolve) {
       if (node.level === 0) {
           // setTimeout(() => {
-          //     this.getDataItemByDataSource()
+              this.getDataItemByDataSource()
           // }, 200)
-
+		// console.log(this.itemDataListByTree)
           // return resolve(this.itemDataListByTree)
       }
       let itemNames = []
@@ -623,44 +623,48 @@ export default {
       if (this.tempItemList && this.tempItemList.length > 0) {
         this.chooseItemDataListByTree = this.tempItemList
       }
-      const loading = showLoading(this, '加载中,请稍候···')
-      getNextAllItem(id, null).then(res => {
-        loading.close()
-        let data = res.data
+	  this.$nextTick(() => {
+	    // 区分驱动返回数据类型
+	    this.hasLeavesFlag = 1
+	  })
+      // const loading = showLoading(this, '加载中,请稍候···')
+      // getNextAllItem(id, null).then(res => {
+      //   loading.close()
+      //   let data = res.data
 
-        let leaves = []
-        if (data.leaves && data.leaves.length > 0) {
-          data.leaves.forEach((t) => {
-            t.label = t.itemName
-            t.value = t.itemReadName
-            t.checked = false
-            leaves.push(t)
-          })
-        }
-        this.leavesList = leaves
-        console.log(33, this.leavesList)
-        this.leavesListF = JSON.parse(JSON.stringify(this.leavesList))
-        let items = []
-        if (data.label && data.label.length > 0) {
-          data.label.forEach((t) => {
-            items.push({
-              'dataSourceId': id,
-              'label': t.itemName,
-              'leaf': false,
-              'children': []
-            })
-          })
-        }
-        this.$nextTick(() => {
-          // 区分驱动返回数据类型
-          this.hasLeavesFlag = 1
-          this.itemDataListByTree = items
-          this.itemDataListByTreeF = JSON.parse(JSON.stringify(this.itemDataListByTree))
-        })
-      }).catch((e) => {
-        loading.close()
-        showAlertWin(this, null, e)
-      })
+      //   let leaves = []
+      //   if (data.leaves && data.leaves.length > 0) {
+      //     data.leaves.forEach((t) => {
+      //       t.label = t.itemName
+      //       t.value = t.itemReadName
+      //       t.checked = false
+      //       leaves.push(t)
+      //     })
+      //   }
+      //   this.leavesList = leaves
+      //   console.log(33, this.leavesList)
+      //   this.leavesListF = JSON.parse(JSON.stringify(this.leavesList))
+      //   let items = []
+      //   if (data.label && data.label.length > 0) {
+      //     data.label.forEach((t) => {
+      //       items.push({
+      //         'dataSourceId': id,
+      //         'label': t.itemName,
+      //         'leaf': false,
+      //         'children': []
+      //       })
+      //     })
+      //   }
+      //   this.$nextTick(() => {
+      //     // 区分驱动返回数据类型
+      //     this.hasLeavesFlag = 1
+      //     this.itemDataListByTree = items
+      //     this.itemDataListByTreeF = JSON.parse(JSON.stringify(this.itemDataListByTree))
+      //   })
+      // }).catch((e) => {
+      //   loading.close()
+      //   showAlertWin(this, null, e)
+      // })
     },
     /** 获取右侧数据源类型列表 */
     getDataSourceList() {