소스 검색

账户管理-默认选中第一个服务商

ZhangWenQiang 4 년 전
부모
커밋
c8fefa2868
1개의 변경된 파일12개의 추가작업 그리고 10개의 파일을 삭제
  1. 12 10
      src/views/hwaccount/HwSubcontractorList.vue

+ 12 - 10
src/views/hwaccount/HwSubcontractorList.vue

@@ -69,16 +69,18 @@
             this.treeDataSource = res.result
             // update-begin- --- author:wangshuai ------ date:20200102 ---- for:去除默认选中第一条数据、默认展开所有第一级
             // 默认选中第一条数据、默认展开所有第一级
-            // if (res.result.length > 0) {
-            //   this.expandedKeys = []
-            //   res.result.forEach((item, index) => {
-            //     if (index === 0) {
-            //       this.selectedKeys = [item.id]
-            //       this.emitInput(item.id)
-            //     }
-            //     this.expandedKeys.push(item.id)
-            //   })
-            // }
+            if (res.result.length > 0) {
+              this.expandedKeys = []
+              res.result.forEach((item, index) => {
+                if (index === 0) {
+                  this.selectedKeys = [item.subcontractorId]
+                  let subcontractorId = item.subcontractorId
+                  let cpType = item.cpType
+                  this.emitInput(subcontractorId, cpType)
+                  this.expandedKeys.push(item.subcontractorId)
+                }
+              })
+            }
            // update-end- --- author:wangshuai ------ date:20200102 ---- for:去除默认选中第一条数据、默认展开所有第一级
           } else {
             this.$message.warn(res.message)