Yannay преди 2 месеца
родител
ревизия
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 552
         handleSelectOrg(item) {
553 553
             console.log(item.uuid, '当前选择的行的uuid')
554 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 561
         handleSelectPerson(item) {
@@ -561,15 +564,31 @@ export default {
561 564
             //获取当前选择组织的分成人名单
562 565
             // 获取当前行的关联id
563 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 571
             if (org) {
567 572
                 this.columnsPersonList = [org.children]
568 573
             }
569 574
             // 把当前选择组织的分成人名单赋值给当前行的分成人选项列表
570
-
571 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 594
         handleOrgConfirmOrg({ columnIndex, value, values },) {