Преглед на файлове

Revert "修改bug"

This reverts commit 1d3b3ba28402b7f6e4fc5ad6bb6c8ecf3fa379ba.
yumeng преди 1 месец
родител
ревизия
8d64b14313
променени са 1 файла, в които са добавени 78 реда и са изтрити 79 реда
  1. 78 79
      src/views/modules/material/accountCheckBytedance.vue

+ 78 - 79
src/views/modules/material/accountCheckBytedance.vue

@@ -250,62 +250,54 @@ export default {
       if(!this.isMultiagent){
         var dataArr = data.map(item=>{
           return {
-            accountId:item.key.split('@')[0],
-            userName:item.key.split('@')[2],
-            userId:item.key.split('@')[1],
+            accountId:item.id.split('@')[0],
+            userName:item.id.split('@')[2],
+            userId:item.id.split('@')[1],
           }
         })
         this.showEdit = false
         this.$emit('synchro', {treeData:dataArr,shieldBackwardSwitch:this.shieldBackwardSwitch,isMultiagent:this.isMultiagent})
       }else{
-        // 勾选快手ID即默认同步其下全部账户:已加载的直接取子节点,未加载的调接口展开
         var dataArr = []
-        var tasks = []
-        var coveredUserIds = []
-        data.forEach((item) => {
-          if (item.level !== 1) return
-          var userId = item.key.split('@')[1]
-          coveredUserIds.push(userId)
-          if (item.childNodes && item.childNodes.length > 0) {
-            item.childNodes.forEach((c) => {
-              dataArr.push({
-                accountId: c.key.split('@')[0],
-                userId: userId,
-              })
-            })
-          } else {
-            tasks.push(
-              getAction('/ctop/userAllocation/getAccountIdListByUserId', {
-                userId: userId,
-              }).then((res) => {
-                if (res.code == 0 && res.result) {
-                  res.result.forEach((r) => {
-                    dataArr.push({
-                      accountId: r.accountId,
-                      userId: userId,
-                    })
-                  })
+        if(this.productId == 8640280){
+          for (let i = 0; i < data.length; i++) {
+            getAction('/ctop/userAllocation/getAccountIdListByUserId', {
+              userId: data[i].id.split('@')[1],
+            }).then((res) => {
+              dataArr.push(...res.result.map((item) => {
+                return {
+                  accountId:item.accountId,
+                  userId:data[i].id.split('@')[1],
                 }
-              })
-            )
-          }
-        })
-        // 未按快手ID全选、直接勾选的单个账户也一并带上
-        data.forEach((item) => {
-          if (item.level === 1) return
-          var userId = item.key.split('@')[1]
-          if (coveredUserIds.indexOf(userId) === -1) {
-            dataArr.push({
-              accountId: item.key.split('@')[0],
-              userId: userId,
+              }))
+
+               
             })
+            
           }
-        })
-        Promise.all(tasks).then(() => {
+          setTimeout(()=>{
+            this.showEdit = false
+            this.$emit('synchro', {treeData:dataArr,shieldBackwardSwitch:this.shieldBackwardSwitch,isMultiagent:this.isMultiagent})
+          },data.length*600)
+        }else{
+          dataArr = data.map(item=>{
+          
+              return {
+                accountId:item.id.split('@')[0],
+                userId:item.id.split('@')[1],
+              }
+
+          })
           this.showEdit = false
           this.$emit('synchro', {treeData:dataArr,shieldBackwardSwitch:this.shieldBackwardSwitch,isMultiagent:this.isMultiagent})
-        })
+        }
+         
+
       }
+      
+      // console.log(dataArr)
+     
+      
     },
     close() {
       // this.$refs.tree.setCheckedKeys([])
@@ -315,42 +307,48 @@ export default {
     },
     ...mapGetters(['nickname', 'avatar', 'userInfo']),
     update(node, id) {
-      // 开启"同步全部账户"后,勾选快手ID时自动加载并全选其下全部账户
-      if (!this.isMultiagent || node.level !== 1 || !node.checked) {
-        return
-      }
-      var userId = node.key.split('@')[1]
-      var tree = this.$refs.tree
-      if (node.childNodes && node.childNodes.length > 0) {
-        tree.setChecked(node.childNodes.map((c) => c.key), true)
-        return
-      }
-      getAction('/ctop/userAllocation/getAccountIdListByUserId', {
-        userId: userId,
-      }).then((res) => {
-        if (res.code == 0 && res.result && res.result.length > 0) {
-          var children = res.result.map((item) => {
-            return {
-              id: item.accountId + '@' + userId,
-              label:
-                (item.userName.length == 2
-                  ? item.userName + '\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0'
-                  : item.userName.length == 3
-                  ? item.userName + '\xa0\xa0\xa0\xa0'
-                  : item.userName) +
-                '\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0' +
-                item.accountId +
-                '\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0' +
-                item.authName,
-              disabled: false,
-            }
-          })
-          tree.updateKeyChildren(node.key, children)
-          this.$nextTick(() => {
-            tree.setChecked(children.map((c) => c.id), true)
-          })
-        }
+
+      
+      this.$nextTick(()=>{
+          // if(node.children.length>0){
+
+          // }else{
+            // getAction('/ctop/userAllocation/getAccountIdListByUserId', {
+            //   userId: node.id.split('@')[1],
+            // }).then((res) => {
+            //   console.log(res)
+            //   if (res.code == 0) {
+            //       if (res.result.length > 0&&node.children.length == 0) {
+            //         node.children = res.result.map((item) => {
+            //           return {
+            //             id: item.accountId,
+            //             label:
+            //               (item.userName.length == 2
+            //                 ? item.userName + '\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0'
+            //                 : item.userName.length == 3
+            //                 ? item.userName + '\xa0\xa0\xa0\xa0'
+            //                 : item.userName) +
+            //               '\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0' +
+            //               item.accountId +
+            //               '\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0' +
+            //               item.authName,
+            //             disabled: this.isMultiagent,
+            //             children:null
+            //           }
+            //         })
+
+            //       } else {
+            //         node.children = null
+            //       }
+            //     } else {
+            //     }
+            // })
+          // }
+
+
       })
+      
+
     },
     emitValue() {
       // this.$emit('update:appId', this.value)
@@ -416,6 +414,7 @@ export default {
               id: item.accountId+'@'+item.userId+'@'+item.userName,
               label: item.userId+'-'+item.projectName,
               children: [],
+              disabled:this.isMultiagent&&this.productId!=8640280
             }
           })
         } else {