From 5d09d7360dc19afeba2c117774bcfea20e917d55 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期日, 22 十二月 2019 12:53:49 +0800
Subject: [PATCH] 优化其他小区添加

---
 WebService/src/main/resources/components/orgPackage/add-org/addOrg.js |  264 +++++++++++++++++++++++++++++++---------------------
 1 files changed, 156 insertions(+), 108 deletions(-)

diff --git a/WebService/src/main/resources/components/orgPackage/add-org/addOrg.js b/WebService/src/main/resources/components/orgPackage/add-org/addOrg.js
index 9c2e670..f123f63 100644
--- a/WebService/src/main/resources/components/orgPackage/add-org/addOrg.js
+++ b/WebService/src/main/resources/components/orgPackage/add-org/addOrg.js
@@ -1,109 +1,131 @@
-(function(vc){
+(function (vc) {
 
     vc.extends({
         propTypes: {
-               callBackListener:vc.propTypes.string, //鐖剁粍浠跺悕绉�
-               callBackFunction:vc.propTypes.string //鐖剁粍浠剁洃鍚柟娉�
+            callBackListener: vc.propTypes.string, //鐖剁粍浠跺悕绉�
+            callBackFunction: vc.propTypes.string //鐖剁粍浠剁洃鍚柟娉�
         },
-        data:{
-            addOrgInfo:{
-                orgId:'',
-                orgName:'',
-                orgLevel:'',
-                parentOrgId:'',
-                description:'',
-                parentOrg:[]
+        data: {
+            addOrgInfo: {
+                orgId: '',
+                orgName: '',
+                orgLevel: '',
+                parentOrgId: '',
+                description: '',
+                belongCommunityId: '',
+                parentOrg:[],
+                belongCommunitys:[]
 
             }
         },
-        watch:{
-            "addOrgInfo.orgLevel":{//娣卞害鐩戝惉锛屽彲鐩戝惉鍒板璞°�佹暟缁勭殑鍙樺寲
-                handler(val, oldVal){
-                   vc.component._addOrgListParentOrgInfo();
-                },
-                deep:true
-            }
-         },
-         _initMethod:function(){
-
-         },
-         _initEvent:function(){
-            vc.on('addOrg','openAddOrgModal',function(){
+        watch: {
+            "addOrgInfo.orgLevel":
+                {//娣卞害鐩戝惉锛屽彲鐩戝惉鍒板璞°�佹暟缁勭殑鍙樺寲
+                    handler(val, oldVal) {
+                        vc.component._addOrgListParentOrgInfo();
+                    }
+                    ,
+                    deep: true
+                }
+        }
+        ,
+        _initMethod: function () {
+            //鏌ヨ鍏ラ┗鐨勫皬鍖�
+            vc.component._loadAddEnterCommunitys();
+        }
+        ,
+        _initEvent: function () {
+            vc.on('addOrg', 'openAddOrgModal', function (_param) {
+                if (_param.hasOwnProperty('parentOrgId')) {
+                    vc.component.addOrgInfo.parentOrgId = _param.parentOrgId;
+                    vc.component.addOrgInfo.orgLevel = _param.orgLevel;
+                    if(_param.parentOrgId == 3){ // 閮ㄩ棬鏄笉鑳芥敼灏忓尯鐨勶紝鏄緷璧栧垎鍏徃鐨勫皬鍖轰俊鎭�
+                        vc.component.addOrgInfo.belongCommunityId = _param.belongCommunityId;
+                    }
+                }
                 $('#addOrgModel').modal('show');
             });
-        },
-        methods:{
-            addOrgValidate(){
+        }
+        ,
+        methods: {
+            addOrgValidate() {
                 return vc.validate.validate({
-                    addOrgInfo:vc.component.addOrgInfo
-                },{
-                    'addOrgInfo.orgName':[
-{
-                            limit:"required",
-                            param:"",
-                            errInfo:"缁勭粐鍚嶇О涓嶈兘涓虹┖"
+                    addOrgInfo: vc.component.addOrgInfo
+                }, {
+                    'addOrgInfo.orgName': [
+                        {
+                            limit: "required",
+                            param: "",
+                            errInfo: "缁勭粐鍚嶇О涓嶈兘涓虹┖"
                         },
- {
-                            limit:"maxin",
-                            param:"2,50",
-                            errInfo:"缁勭粐鍚嶇О闀垮害涓�2鑷�50"
+                        {
+                            limit: "maxin",
+                            param: "2,50",
+                            errInfo: "缁勭粐鍚嶇О闀垮害涓�2鑷�50"
                         },
                     ],
-'addOrgInfo.orgLevel':[
-{
-                            limit:"required",
-                            param:"",
-                            errInfo:"缁勭粐绾у埆涓嶈兘涓虹┖"
+                    'addOrgInfo.orgLevel': [
+                        {
+                            limit: "required",
+                            param: "",
+                            errInfo: "缁勭粐绾у埆涓嶈兘涓虹┖"
                         },
- {
-                            limit:"maxin",
-                            param:"2,50",
-                            errInfo:"鎶ヤ慨浜哄悕绉板繀椤诲湪2鑷�50瀛楃涔嬮棿"
+                        {
+                            limit: "num",
+                            param: "",
+                            errInfo: "缁勭粐绾у埆閿欒"
                         },
                     ],
-'addOrgInfo.parentOrgId':[
-{
-                            limit:"required",
-                            param:"",
-                            errInfo:"涓婄骇ID涓嶈兘涓虹┖"
+                    'addOrgInfo.parentOrgId': [
+                        {
+                            limit: "required",
+                            param: "",
+                            errInfo: "涓婄骇ID涓嶈兘涓虹┖"
                         },
- {
-                            limit:"num",
-                            param:"",
-                            errInfo:"涓婄骇ID涓嶆纭�"
+                        {
+                            limit: "num",
+                            param: "",
+                            errInfo: "涓婄骇ID涓嶆纭�"
                         },
                     ],
-'addOrgInfo.description':[
-{
-                            limit:"required",
-                            param:"",
-                            errInfo:"鎻忚堪涓嶈兘涓虹┖"
+                    'addOrgInfo.belongCommunityId': [
+                        {
+                            limit: "required",
+                            param: "",
+                            errInfo: "闅跺睘灏忓尯涓嶈兘涓虹┖"
                         },
- {
-                            limit:"maxLength",
-                            param:"200",
-                            errInfo:"鎻忚堪涓嶈兘涓虹┖"
+                        {
+                            limit: "num",
+                            param: "",
+                            errInfo: "闅跺睘灏忓尯涓嶆纭�"
                         },
                     ],
+                    'addOrgInfo.description': [
 
-
+                        {
+                            limit: "maxLength",
+                            param: "200",
+                            errInfo: "鎻忚堪涓嶈兘涓虹┖"
+                        },
+                    ],
 
 
                 });
-            },
-            saveOrgInfo:function(){
-                if(!vc.component.addOrgValidate()){
+            }
+            ,
+            saveOrgInfo: function () {
+                if (!vc.component.addOrgValidate()) {
                     vc.message(vc.validate.errInfo);
 
-                    return ;
+                    return;
                 }
 
                 vc.component.addOrgInfo.communityId = vc.getCurrentCommunity().communityId;
                 //涓嶆彁浜ゆ暟鎹皢鏁版嵁 鍥炶皟缁欎睛鍚鐞�
-                if(vc.notNull($props.callBackListener)){
-                    vc.emit($props.callBackListener,$props.callBackFunction,vc.component.addOrgInfo);
+                if (vc.notNull($props.callBackListener)) {
+                    vc.emit($props.callBackListener, $props.callBackFunction, vc.component.addOrgInfo);
                     $('#addOrgModel').modal('hide');
-                    return ;
+                    return;
                 }
 
                 vc.http.post(
@@ -111,64 +133,90 @@
                     'save',
                     JSON.stringify(vc.component.addOrgInfo),
                     {
-                        emulateJSON:true
-                     },
-                     function(json,res){
+                        emulateJSON: true
+                    },
+                    function (json, res) {
                         //vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
-                        if(res.status == 200){
+                        if (res.status == 200) {
                             //鍏抽棴model
                             $('#addOrgModel').modal('hide');
                             vc.component.clearAddOrgInfo();
-                            vc.emit('orgManage','listOrg',{});
+                            vc.emit('orgManage', 'listOrg', {});
 
-                            return ;
+                            return;
                         }
                         vc.message(json);
 
-                     },
-                     function(errInfo,error){
+                    },
+                    function (errInfo, error) {
                         console.log('璇锋眰澶辫触澶勭悊');
 
                         vc.message(errInfo);
 
-                     });
-            },
-            clearAddOrgInfo:function(){
+                    });
+            }
+            ,
+            clearAddOrgInfo: function () {
                 vc.component.addOrgInfo = {
-                                            orgName:'',
-                                            orgLevel:'',
-                                            parentOrgId:'',
-                                            description:'',
-            };
-            },
-            _addOrgListParentOrgInfo:function(){
+                    orgName: '',
+                    orgLevel: '',
+                    parentOrgId: '',
+                    description: '',
+                    parentOrg: []
+                };
+            }
+            ,
+            _addOrgListParentOrgInfo: function () {
 
 
                 var _tmpOrgLevel = vc.component.addOrgInfo.orgLevel;
 
-                if(_tmpOrgLevel > 1){
-                    _tmpOrgLevel = _tmpOrgLevel-1;
+                if (_tmpOrgLevel > 1) {
+                    _tmpOrgLevel = _tmpOrgLevel - 1;
                 }
 
                 var param = {
-                    params:{
-                        orgLevel:_tmpOrgLevel
+                    params: {
+                        orgLevel: _tmpOrgLevel,
+                        page: 1,
+                        row: 30,
                     }
-                 };
+                };
 
-               //鍙戦�乬et璇锋眰
-               vc.http.get('orgManage',
-                            'list',
-                             param,
-                             function(json,res){
-                                var _orgManageInfo=JSON.parse(json);
-                                vc.component.addOrgInfo.parentOrg = _orgManageInfo.orgs;
-                             },function(errInfo,error){
-                                console.log('璇锋眰澶辫触澶勭悊');
-                             }
-                           );
+                //鍙戦�乬et璇锋眰
+                vc.http.get('addOrg',
+                    'list',
+                    param,
+                    function (json, res) {
+                        var _orgManageInfo = JSON.parse(json);
+                        vc.component.addOrgInfo.parentOrg = _orgManageInfo.orgs;
+                    }, function (errInfo, error) {
+                        console.log('璇锋眰澶辫触澶勭悊');
+                    }
+                );
+            },
+            _loadAddEnterCommunitys:function () {
+                //belongCommunitys
+                var param = {
+                    params:{
+                        _uid:'mmmllnnjhhjjh'
+                    }
+                }
+
+                //鍙戦�乬et璇锋眰
+                vc.http.get('addOrg',
+                    'listEnterCommunitys',
+                    param,
+                    function (json, res) {
+                        var _enterCommunitys = JSON.parse(json);
+                        vc.component.addOrgInfo.belongCommunitys = _enterCommunitys;
+                    }, function (errInfo, error) {
+                        console.log('璇锋眰澶辫触澶勭悊');
+                    }
+                );
             }
         }
-    });
+    })
+    ;
 
 })(window.vc);

--
Gitblit v1.8.0