Yannay месяцев назад: 2
Родитель
Сommit
e19e574857
1 измененных файлов с 23 добавлено и 4 удалено
  1. 23 4
      pages/orderDetailNew/components/pageFour.vue

+ 23 - 4
pages/orderDetailNew/components/pageFour.vue

@@ -552,7 +552,10 @@ export default {
552
         handleSelectOrg(item) {
552
         handleSelectOrg(item) {
553
             console.log(item.uuid, '当前选择的行的uuid')
553
             console.log(item.uuid, '当前选择的行的uuid')
554
             this.currentEditItem = item.uuid
554
             this.currentEditItem = item.uuid
555
-            this.showOrgPicker = true
555
+            // this.showOrgPicker = true
556
+            this.showPersonPicker = true
557
+            //把当前的组织赋值给当前的组件
558
+            this.columnsPersonList = this.columnsOrgList//获取到的分成人名单
556
         },
559
         },
557
         //选择当前的分成人
560
         //选择当前的分成人
558
         handleSelectPerson(item) {
561
         handleSelectPerson(item) {
@@ -561,15 +564,31 @@ export default {
561
             //获取当前选择组织的分成人名单
564
             //获取当前选择组织的分成人名单
562
             // 获取当前行的关联id
565
             // 获取当前行的关联id
563
             const deptId = item.deptId
566
             const deptId = item.deptId
564
-            const org = this.columnsOrgList[0].find(org => org.id == deptId)
565
-            console.log(org, '当前选择的行的组织')
567
+            //递归查找当前选择的组织
568
+            const org = this.findOrg(this.columnsOrgList[0], deptId)
569
+            // const org = this.columnsOrgList[0].find(org => org.id == deptId)
570
+            console.log(org, '当前选择的组织')
566
             if (org) {
571
             if (org) {
567
                 this.columnsPersonList = [org.children]
572
                 this.columnsPersonList = [org.children]
568
             }
573
             }
569
             // 把当前选择组织的分成人名单赋值给当前行的分成人选项列表
574
             // 把当前选择组织的分成人名单赋值给当前行的分成人选项列表
570
-
571
             this.showPersonPicker = true
575
             this.showPersonPicker = true
572
         },
576
         },
577
+        //递归查找当前选择的组织
578
+        findOrg(orgList, deptId) {
579
+            for (const org of orgList) {
580
+                if (org.id == deptId) {
581
+                    return org
582
+                }
583
+                if (org.children && org.children.length > 0) {
584
+                    const found = this.findOrg(org.children, deptId)
585
+                    if (found) {
586
+                        return found
587
+                    }
588
+                }
589
+            }
590
+            return null
591
+        },
573
 
592
 
574
         //确认选择组织
593
         //确认选择组织
575
         handleOrgConfirmOrg({ columnIndex, value, values },) {
594
         handleOrgConfirmOrg({ columnIndex, value, values },) {