Explorar o código

优化前台 组织架构选择问题

wuxw %!s(int64=6) %!d(string=hai) anos
pai
achega
24b9c74b53

+ 22 - 3
WebService/src/main/resources/components/orgPackage/org-manage/orgManage.js

@@ -11,6 +11,7 @@
                 orgs: [],
                 total: 0,
                 records: 1,
+                currentSelectOrgId:"-1",
                 moreCondition: false,
                 showBelongCommunity:false,
                 orgName: '',
@@ -88,14 +89,17 @@
                     selectedBackColor: '#1ab394'
                 });
                 $('#orgTree').on('nodeSelected', function (event, data) {
-                    //console.log(event,data);
+                    console.log(event,data);
+                    vc.component.orgManageInfo.currentSelectOrgId = data.orgId;
                     vc.component.orgManageInfo.conditions.orgLevel = (parseInt(data.orgLevel) + 1);
                     vc.component.orgManageInfo.conditions.parentOrgId = data.orgId;
                     vc.component.orgManageInfo.currentBelongCommunityId = data.belongCommunityId;
                     vc.component._listOrgs(DEFAULT_PAGE, DEFAULT_ROWS);
                 });
-                $('#orgTree').treeview("selectNode", [0]);
-
+//                if(vc.component.orgManageInfo.currentSelectOrgId == '-1'){
+//                    console.log('是否进入');
+//                    $('#orgTree').treeview("selectNode", [0]);
+//                }
             },
             _loadBranchOrgTrees: function () {
                 //默认查询分公司组织信息
@@ -122,6 +126,18 @@
                     function (json, res) {
                         var _tmpOrgs = JSON.parse(json).orgs;
                         _tmpOrgs.forEach(function (_item) {
+                            var _selected = false;
+                            var _currentSelectOrgId = vc.component.orgManageInfo.currentSelectOrgId;
+                            if(_currentSelectOrgId == '-1' && _orgLevel == 1){
+                                _selected = true;
+                                vc.component.orgManageInfo.currentSelectOrgId = _item.orgId;
+                                vc.component.orgManageInfo.conditions.orgLevel = (parseInt(_item.orgLevel) + 1);
+                                vc.component.orgManageInfo.conditions.parentOrgId = _item.orgId;
+                                vc.component.orgManageInfo.currentBelongCommunityId = _item.belongCommunityId;
+                                vc.component._listOrgs(DEFAULT_PAGE, DEFAULT_ROWS);
+                            }else if(_item.orgId == vc.component.orgManageInfo.currentSelectOrgId){
+                                _selected = true;
+                            }
                             _nodes.push({
                                 orgId: _item.orgId,
                                 orgLevel: _orgLevel,
@@ -129,6 +145,9 @@
                                 belongCommunityId:_item.belongCommunityId,
                                 href: function (_item) {
                                 },
+                                state:{
+                                    selected:_selected
+                                },
                                 tags: [0],
                                 nodes: []
                             });