From 4fbdc442a847b3cd2254af2c4b5f6dab651e5b8b Mon Sep 17 00:00:00 2001
From: liubp <1535785116@qq.com>
Date: 星期一, 01 十二月 2025 18:01:08 +0800
Subject: [PATCH] 添加编辑界面取值,添加组织编码展示

---
 public/components/frame/orgTree/orgTree.js |   29 ++++++++++++++++++++++++++++-
 1 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/public/components/frame/orgTree/orgTree.js b/public/components/frame/orgTree/orgTree.js
index 49ce3c7..60c5290 100644
--- a/public/components/frame/orgTree/orgTree.js
+++ b/public/components/frame/orgTree/orgTree.js
@@ -32,13 +32,38 @@
                 vc.http.apiGet('/org.listOrgTree',
                     param,
                     function (json) {
-                        let _orgs = JSON.parse(json).data;
+                        let _orgs = JSON.parse(json).data || [];
+                        if (Array.isArray(_orgs)) {
+                            _orgs = _orgs.map(_org => {
+                                return $that._appendOrgCode(_org);
+                            });
+                        } else {
+                            _orgs = [$that._appendOrgCode(_orgs)];
+                        }
                         $that.orgTreeInfo.orgs = _orgs;
                         $that._initJsTreeFloorUnit();
                     },
                     function () {
                         console.log('璇锋眰澶辫触澶勭悊');
                     });
+            },
+            _appendOrgCode: function (_org) {
+                if (!_org || !_org.text) {
+                    return _org;
+                }
+                if (_org.text) {
+                    let _code = (!_org.orgCode || _org.orgCode === 'CODE') ? '- -' : _org.orgCode;
+                    let _suffix = ' (' + _code + ')';
+                    if (_org.text.indexOf(_suffix) === -1) {
+                        _org.text = _org.text + _suffix;
+                    }
+                }
+                if (Array.isArray(_org.children) && _org.children.length > 0) {
+                    _org.children = _org.children.map(item => {
+                        return $that._appendOrgCode(item);
+                    });
+                }
+                return _org;
             },
             _initJsTreeFloorUnit: function () {
                 let _data = $that.orgTreeInfo.orgs;
@@ -66,6 +91,8 @@
                     }
                     $that.orgTreeInfo.curOrg = data.node.original;
                     $that.orgTreeInfo.curOrg.orgId = $that.orgTreeInfo.curOrg.id;
+                    $that.orgTreeInfo.curOrg.orgName = $that.orgTreeInfo.curOrg.text;
+                    $that.orgTreeInfo.curOrg.description = $that.orgTreeInfo.curOrg.description || '';
                     vc.emit($props.callBackListener, 'switchOrg', {
                         orgId: data.node.original.id,
                         orgName: $that.orgTreeInfo.curOrg.text

--
Gitblit v1.8.0