Sfoglia il codice sorgente

加入 组织隶属 小区功能

wuxw 6 anni fa
parent
commit
2380de35e6

+ 1 - 0
Api/src/main/java/com/java110/api/listener/org/SaveOrgListener.java

@@ -31,6 +31,7 @@ public class SaveOrgListener extends AbstractServiceApiListener {
         Assert.hasKeyAndValue(reqJson, "orgName", "必填,请填写组织名称");
         Assert.hasKeyAndValue(reqJson, "orgLevel", "必填,请填写报修人名称");
         Assert.hasKeyAndValue(reqJson, "parentOrgId", "必填,请选择上级ID");
+        Assert.hasKeyAndValue(reqJson, "belongCommunityId", "必填,请选择隶属小区");
         //Assert.hasKeyAndValue(reqJson, "description", "必填,请填写描述");
         Assert.hasKeyAndValue(reqJson, "storeId", "必填,请填写商户ID");
 

+ 1 - 0
Api/src/main/java/com/java110/api/listener/org/UpdateOrgListener.java

@@ -29,6 +29,7 @@ public class UpdateOrgListener extends AbstractServiceApiListener {
         Assert.hasKeyAndValue(reqJson, "orgName", "必填,请填写组织名称");
         Assert.hasKeyAndValue(reqJson, "orgLevel", "必填,请填写报修人名称");
         Assert.hasKeyAndValue(reqJson, "parentOrgId", "必填,请选择上级ID");
+        Assert.hasKeyAndValue(reqJson, "belongCommunityId", "必填,请选择隶属小区");
         //Assert.hasKeyAndValue(reqJson, "description", "必填,请填写描述");
         Assert.hasKeyAndValue(reqJson, "storeId", "必填,请填写商户ID");
 

+ 85 - 6
Api/src/main/java/com/java110/api/listener/store/SaveStoreServiceListener.java

@@ -99,6 +99,11 @@ public class SaveStoreServiceListener extends AbstractServiceApiDataFlowListener
         businesses.add(addStaff(paramObj));
         //添加公司级组织
         businesses.add(addOrg(paramObj));
+        //公司总部
+        businesses.add(addOrgHeadCompany(paramObj));
+        //总部办公室
+        businesses.add(addOrgHeadPart(paramObj));
+        businesses.add(addStaffOrg(paramObj));
 
 
         String paramInObj = super.restToCenterProtocol(businesses, dataFlowContext.getRequestCurrentHeaders()).toJSONString();
@@ -129,6 +134,7 @@ public class SaveStoreServiceListener extends AbstractServiceApiDataFlowListener
 
     }
 
+
     /**
      * 用户赋权
      *
@@ -210,7 +216,7 @@ public class SaveStoreServiceListener extends AbstractServiceApiDataFlowListener
     private JSONObject refreshParamIn(JSONObject paramObj) {
 
         String storeId = GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_storeId);
-        paramObj.put("storeId",storeId);
+        paramObj.put("storeId", storeId);
         if (paramObj.containsKey("businessStore")) {
             JSONObject businessStoreObj = paramObj.getJSONObject("businessStore");
             businessStoreObj.put("storeId", storeId);
@@ -265,20 +271,74 @@ public class SaveStoreServiceListener extends AbstractServiceApiDataFlowListener
     /**
      * 添加一级组织信息
      *
-     * @param paramInJson     接口调用放传入入参
+     * @param paramInJson 接口调用放传入入参
      * @return 订单服务能够接受的报文
      */
     private JSONObject addOrg(JSONObject paramInJson) {
 
         String orgId = GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_orgId);
+        paramInJson.put("levelOneOrgId", orgId);
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_ORG);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ + 3);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONObject businessOrg = new JSONObject();
+        businessOrg.put("orgName", paramInJson.getJSONObject("businessStore").getString("name"));
+        businessOrg.put("orgLevel", "1");
+        businessOrg.put("parentOrgId", orgId);
+        businessOrg.put("belongCommunityId", "9999");
+        businessOrg.put("orgId", orgId);
+        businessOrg.put("storeId", paramInJson.getString("storeId"));
+        //计算 应收金额
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessOrg", businessOrg);
+        return business;
+    }
+
+    /**
+     * 添加公司总部
+     *
+     * @param paramInJson 接口调用放传入入参
+     * @return 订单服务能够接受的报文
+     */
+    private JSONObject addOrgHeadCompany(JSONObject paramInJson) {
+
+        String orgId = GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_orgId);
+        paramInJson.put("levelTwoOrgId", orgId);
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_ORG);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ + 4);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONObject businessOrg = new JSONObject();
+        businessOrg.put("orgName", "公司总部");
+        businessOrg.put("orgLevel", "2");
+        businessOrg.put("parentOrgId", paramInJson.getString("levelOneOrgId"));
+        businessOrg.put("belongCommunityId", "9999");
+        businessOrg.put("orgId", orgId);
+        businessOrg.put("storeId", paramInJson.getString("storeId"));
+        //计算 应收金额
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessOrg", businessOrg);
+        return business;
+    }
+
+    /**
+     * 添加公司总部
+     *
+     * @param paramInJson 接口调用放传入入参
+     * @return 订单服务能够接受的报文
+     */
+    private JSONObject addOrgHeadPart(JSONObject paramInJson) {
+
+        String orgId = GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_orgId);
+        paramInJson.put("levelThreeOrgId", orgId);
         JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
         business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_ORG);
-        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ+3);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ + 5);
         business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
         JSONObject businessOrg = new JSONObject();
-        businessOrg.put("orgName",paramInJson.getJSONObject("businessStore").getString("name"));
-        businessOrg.put("orgLevel","1");
-        businessOrg.put("parentOrgId",orgId);
+        businessOrg.put("orgName", "总部办公室");
+        businessOrg.put("orgLevel", "3");
+        businessOrg.put("parentOrgId", paramInJson.getString("levelTwoOrgId"));
+        businessOrg.put("belongCommunityId", "9999");
         businessOrg.put("orgId", orgId);
         businessOrg.put("storeId", paramInJson.getString("storeId"));
         //计算 应收金额
@@ -286,4 +346,23 @@ public class SaveStoreServiceListener extends AbstractServiceApiDataFlowListener
         return business;
     }
 
+
+    private JSONObject addStaffOrg(JSONObject paramInJson) {
+
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_ORG_STAFF_REL);
+        business.put(CommonConstant.HTTP_SEQ,  DEFAULT_SEQ + 6);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONArray businessOrgStaffRels = new JSONArray();
+        JSONObject businessOrgStaffRel = new JSONObject();
+        businessOrgStaffRel.put("relId", "-1");
+        businessOrgStaffRel.put("storeId", paramInJson.getString("storeId"));
+        businessOrgStaffRel.put("staffId", paramInJson.getJSONObject("businessStore").getString("userId"));
+        businessOrgStaffRel.put("orgId", paramInJson.getString("levelThreeOrgId"));
+        businessOrgStaffRel.put("relCd", StoreUserRelConstant.REL_ADMIN);
+        businessOrgStaffRels.add(businessOrgStaffRel);
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessOrgStaffRel", businessOrgStaffRels);
+
+        return business;
+    }
 }

+ 2 - 1
UserService/src/main/java/com/java110/user/listener/org/AbstractOrgBusinessServiceDataFlowListener.java

@@ -44,6 +44,7 @@ public abstract class AbstractOrgBusinessServiceDataFlowListener extends Abstrac
         businessOrgInfo.put("orgLevel", businessOrgInfo.get("org_level"));
         businessOrgInfo.put("storeId", businessOrgInfo.get("store_id"));
         businessOrgInfo.put("orgId", businessOrgInfo.get("org_id"));
+        businessOrgInfo.put("belongCommunityId", businessOrgInfo.get("belong_community_id"));
         businessOrgInfo.remove("bId");
         businessOrgInfo.put("statusCd", statusCd);
     }
@@ -75,7 +76,7 @@ public abstract class AbstractOrgBusinessServiceDataFlowListener extends Abstrac
         currentOrgInfo.put("orgLevel", currentOrgInfo.get("org_level"));
         currentOrgInfo.put("storeId", currentOrgInfo.get("store_id"));
         currentOrgInfo.put("orgId", currentOrgInfo.get("org_id"));
-
+        currentOrgInfo.put("belongCommunityId", currentOrgInfo.get("belong_community_id"));
 
         currentOrgInfo.put("operate", StatusConstant.OPERATE_DEL);
         getOrgServiceDaoImpl().saveBusinessOrgInfo(currentOrgInfo);

+ 1 - 0
WebService/src/main/java/com/java110/web/smo/org/impl/AddOrgSMOImpl.java

@@ -34,6 +34,7 @@ public class AddOrgSMOImpl extends AbstractComponentSMO implements IAddOrgSMO {
         Assert.hasKeyAndValue(paramIn, "orgName", "必填,请填写组织名称");
         Assert.hasKeyAndValue(paramIn, "orgLevel", "必填,请填写报修人名称");
         Assert.hasKeyAndValue(paramIn, "parentOrgId", "必填,请选择上级ID");
+        Assert.hasKeyAndValue(paramIn, "belongCommunityId", "必填,请选择隶属小区");
         //Assert.hasKeyAndValue(paramIn, "description", "必填,请填写描述");
 
 

+ 2 - 0
WebService/src/main/java/com/java110/web/smo/org/impl/EditOrgSMOImpl.java

@@ -33,6 +33,8 @@ public class EditOrgSMOImpl extends AbstractComponentSMO implements IEditOrgSMO
         Assert.hasKeyAndValue(paramIn, "orgName", "必填,请填写组织名称");
         Assert.hasKeyAndValue(paramIn, "orgLevel", "必填,请填写报修人名称");
         Assert.hasKeyAndValue(paramIn, "parentOrgId", "必填,请选择上级ID");
+        Assert.hasKeyAndValue(paramIn, "belongCommunityId", "必填,请选择隶属小区");
+
         //Assert.hasKeyAndValue(paramIn, "description", "必填,请填写描述");
 
 

+ 11 - 0
WebService/src/main/resources/components/orgPackage/add-org/addOrg.html

@@ -32,6 +32,17 @@
                                         <option v-for="parentOrg in addOrgInfo.parentOrg" :value="parentOrg.orgId">{{parentOrg.orgName}}</option>
                                     </select></div>
                             </div>
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-form-label">隶属小区</label>
+                                <div class="col-sm-10">
+                                    <select class="custom-select" v-model="addOrgInfo.belongCommunityId" v-bind:disabled="addOrgInfo.orgLevel == 3">
+                                        <option selected disabled value="">必填,请选择隶属小区</option>
+                                        <option  value="9999">入驻所有小区</option>
+                                        <option v-for="belongCommunity in addOrgInfo.belongCommunitys" :value="belongCommunity.belongCommunityId">
+                                            {{belongCommunity.name}}
+                                        </option>
+                                    </select></div>
+                            </div>
                             <div class="form-group row">
                                 <label class="col-sm-2 col-form-label">描述</label>
                                 <div class="col-sm-10">

+ 131 - 107
WebService/src/main/resources/components/orgPackage/add-org/addOrg.js

@@ -1,109 +1,130 @@
-(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(){
+        watch: {
+            "addOrgInfo.orgLevel":
+                {//深度监听,可监听到对象、数组的变化
+                    handler(val, oldVal) {
+                        vc.component._addOrgListParentOrgInfo();
+                    }
+                    ,
+                    deep: true
+                }
+        }
+        ,
+        _initMethod: function () {
 
-         },
-         _initEvent:function(){
-            vc.on('addOrg','openAddOrgModal',function(_param){
-                if(_param.hasOwnProperty('parentOrgId')){
+        }
+        ,
+        _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:"num",
-                            param:"",
-                            errInfo:"组织级别错误"
+                        {
+                            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:"maxLength",
-                            param:"200",
-                            errInfo:"描述不能为空"
+                    'addOrgInfo.belongCommunityId': [
+                        {
+                            limit: "required",
+                            param: "",
+                            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,67 +132,70 @@
                     '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:'',
-                    parentOrg:[]
-            };
-            },
-            _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,
                     }
-                 };
-
-               //发送get请求
-               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('请求失败处理');
-                             }
-                           );
+                };
+
+                //发送get请求
+                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('请求失败处理');
+                    }
+                );
             }
         }
-    });
+    })
+    ;
 
 })(window.vc);

+ 11 - 0
WebService/src/main/resources/components/orgPackage/edit-org/editOrg.html

@@ -31,6 +31,17 @@
                                         <option v-for="parentOrg in editOrgInfo.parentOrg" :value="parentOrg.orgId">{{parentOrg.orgName}}</option>
                                     </select></div>
                             </div>
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-form-label">隶属小区</label>
+                                <div class="col-sm-10">
+                                    <select class="custom-select" v-model="editOrgInfo.belongCommunityId" v-bind:disabled="addOrgInfo.orgLev el == 3">
+                                        <option selected disabled value="">必填,请选择隶属小区</option>
+                                        <option  value="9999">入驻所有小区</option>
+                                        <option v-for="belongCommunity in editOrgInfo.belongCommunitys" :value="belongCommunity.belongCommunityId">
+                                            {{belongCommunity.name}}
+                                        </option>
+                                    </select></div>
+                            </div>
                             <div class="form-group row">
                                 <label class="col-sm-2 col-form-label">描述</label>
                                 <div class="col-sm-10">

+ 112 - 99
WebService/src/main/resources/components/orgPackage/edit-org/editOrg.js

@@ -1,98 +1,111 @@
-(function(vc,vm){
+(function (vc, vm) {
 
     vc.extends({
-        data:{
-            editOrgInfo:{
-                orgId:'',
-                orgName:'',
-                orgLevel:'',
-                parentOrgId:'',
-                description:'',
-                parentOrg:[]
+        data: {
+            editOrgInfo: {
+                orgId: '',
+                orgName: '',
+                orgLevel: '',
+                parentOrgId: '',
+                belongCommunityId: '',
+                description: '',
+                parentOrg: []
 
             }
         },
-        watch:{
-            "editOrgInfo.orgLevel":{//深度监听,可监听到对象、数组的变化
-                handler(val, oldVal){
-                   vc.component._editOrgListParentOrgInfo();
+        watch: {
+            "editOrgInfo.orgLevel": {//深度监听,可监听到对象、数组的变化
+                handler(val, oldVal) {
+                    vc.component._editOrgListParentOrgInfo();
                 },
-                deep:true
+                deep: true
             }
-         },
-         _initMethod:function(){
+        },
+        _initMethod: function () {
             vc.component._editOrgListParentOrgInfo();
-         },
-         _initEvent:function(){
-             vc.on('editOrg','openEditOrgModal',function(_params){
+        },
+        _initEvent: function () {
+            vc.on('editOrg', 'openEditOrgModal', function (_params) {
                 vc.component.refreshEditOrgInfo();
                 $('#editOrgModel').modal('show');
-                vc.copyObject(_params, vc.component.editOrgInfo );
+                vc.copyObject(_params, vc.component.editOrgInfo);
                 vc.component.editOrgInfo.communityId = vc.getCurrentCommunity().communityId;
             });
         },
-        methods:{
-            editOrgValidate:function(){
-                        return vc.validate.validate({
-                            editOrgInfo:vc.component.editOrgInfo
-                        },{
-                            'editOrgInfo.orgName':[
-{
-                            limit:"required",
-                            param:"",
-                            errInfo:"组织名称不能为空"
+        methods: {
+            editOrgValidate: function () {
+                return vc.validate.validate({
+                    editOrgInfo: vc.component.editOrgInfo
+                }, {
+                    'editOrgInfo.orgName': [
+                        {
+                            limit: "required",
+                            param: "",
+                            errInfo: "组织名称不能为空"
                         },
- {
-                            limit:"maxin",
-                            param:"2,50",
-                            errInfo:"组织名称长度为2至50"
+                        {
+                            limit: "maxin",
+                            param: "2,50",
+                            errInfo: "组织名称长度为2至50"
                         },
                     ],
-                        'editOrgInfo.orgLevel':[
+                    'editOrgInfo.orgLevel': [
                         {
-                            limit:"required",
-                            param:"",
-                            errInfo:"组织级别不能为空"
+                            limit: "required",
+                            param: "",
+                            errInfo: "组织级别不能为空"
                         },
                         {
-                            limit:"num",
-                            param:"",
-                            errInfo:"组织级别错误"
+                            limit: "num",
+                            param: "",
+                            errInfo: "组织级别错误"
                         },
                     ],
-                    'editOrgInfo.parentOrgId':[
-                    {
-                            limit:"required",
-                            param:"",
-                            errInfo:"上级ID不能为空"
+                    'editOrgInfo.parentOrgId': [
+                        {
+                            limit: "required",
+                            param: "",
+                            errInfo: "上级ID不能为空"
                         },
                         {
-                            limit:"num",
-                            param:"",
-                            errInfo:"上级ID不正确"
+                            limit: "num",
+                            param: "",
+                            errInfo: "上级ID不正确"
                         },
                     ],
-                        'editOrgInfo.description':[
+                    'editOrgInfo.description': [
 
-                     {
-                            limit:"maxLength",
-                            param:"200",
-                            errInfo:"描述不能为空"
+                        {
+                            limit: "maxLength",
+                            param: "200",
+                            errInfo: "描述不能为空"
                         },
                     ],
-                    'editOrgInfo.orgId':[
-                    {
-                            limit:"required",
-                            param:"",
-                            errInfo:"组织ID不能为空"
+                    'editOrgInfo.belongCommunityId': [
+                        {
+                            limit: "required",
+                            param: "",
+                            errInfo: "隶属小区不能为空"
+                        },
+                        {
+                            limit: "num",
+                            param: "",
+                            errInfo: "隶属小区不正确"
+                        },
+                    ],
+                    'editOrgInfo.orgId': [
+                        {
+                            limit: "required",
+                            param: "",
+                            errInfo: "组织ID不能为空"
                         }]
 
-                        });
-             },
-            editOrg:function(){
-                if(!vc.component.editOrgValidate()){
+                });
+            },
+            editOrg: function () {
+                if (!vc.component.editOrgValidate()) {
                     vc.message(vc.validate.errInfo);
-                    return ;
+                    return;
                 }
 
                 vc.http.post(
@@ -100,64 +113,64 @@
                     'update',
                     JSON.stringify(vc.component.editOrgInfo),
                     {
-                        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
                             $('#editOrgModel').modal('hide');
-                             vc.emit('orgManage','listOrg',{});
-                            return ;
+                            vc.emit('orgManage', 'listOrg', {});
+                            return;
                         }
                         vc.message(json);
-                     },
-                     function(errInfo,error){
+                    },
+                    function (errInfo, error) {
                         console.log('请求失败处理');
 
                         vc.message(errInfo);
-                     });
+                    });
             },
-            refreshEditOrgInfo:function(){
-                vc.component.editOrgInfo= {
-                    orgId:'',
-                    orgName:'',
-                    orgLevel:'',
-                    parentOrgId:'',
-                    description:'',
-                    parentOrg:[]
+            refreshEditOrgInfo: function () {
+                vc.component.editOrgInfo = {
+                    orgId: '',
+                    orgName: '',
+                    orgLevel: '',
+                    parentOrgId: '',
+                    description: '',
+                    parentOrg: []
                 }
             },
-            _editOrgListParentOrgInfo:function(){
+            _editOrgListParentOrgInfo: function () {
 
 
                 var _tmpOrgLevel = vc.component.editOrgInfo.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,
                     }
-                 };
+                };
 
-               //发送get请求
-               vc.http.get('editOrg',
-                            'list',
-                             param,
-                             function(json,res){
-                                var _orgManageInfo=JSON.parse(json);
-                                vc.component.editOrgInfo.parentOrg = _orgManageInfo.orgs;
-                             },function(errInfo,error){
-                                console.log('请求失败处理');
-                             }
-                           );
+                //发送get请求
+                vc.http.get('editOrg',
+                    'list',
+                    param,
+                    function (json, res) {
+                        var _orgManageInfo = JSON.parse(json);
+                        vc.component.editOrgInfo.parentOrg = _orgManageInfo.orgs;
+                    }, function (errInfo, error) {
+                        console.log('请求失败处理');
+                    }
+                );
             }
         }
     });
 
-})(window.vc,window.vc.component);
+})(window.vc, window.vc.component);

+ 141 - 137
WebService/src/main/resources/components/orgPackage/org-manage/orgManage.js

@@ -1,211 +1,215 @@
 /**
-    入驻小区
-**/
-(function(vc){
+ 入驻小区
+ **/
+(function (vc) {
     var DEFAULT_PAGE = 1;
     var DEFAULT_ROWS = 10;
     var ALL_ROWS = 100;
     vc.extends({
-        data:{
-            orgManageInfo:{
-                orgs:[],
-                total:0,
-                records:1,
-                moreCondition:false,
-                orgName:'',
-                headOrg:[],
-                branchOrg:[],
-                orgTree:[],
-                conditions:{
-                    orgId:'',
-                    orgName:'',
-                    communityId:'',
-                    orgLevel:'',
-                    parentOrgId:'',
+        data: {
+            orgManageInfo: {
+                orgs: [],
+                total: 0,
+                records: 1,
+                moreCondition: false,
+                orgName: '',
+                headOrg: [],
+                branchOrg: [],
+                orgTree: [],
+                currentBelongCommunityId:'',
+                conditions: {
+                    orgId: '',
+                    orgName: '',
+                    communityId: '',
+                    orgLevel: '',
+                    parentOrgId: '',
                 }
             }
         },
-        watch:{
-            "orgManageInfo.conditions.headOrgId":{//深度监听,可监听到对象、数组的变化
-                handler(val, oldVal){
-                   vc.component._getOrgsByOrgLevel(DEFAULT_PAGE, DEFAULT_ROWS,2,val);
+        watch: {
+            "orgManageInfo.conditions.headOrgId": {//深度监听,可监听到对象、数组的变化
+                handler(val, oldVal) {
+                    vc.component._getOrgsByOrgLevel(DEFAULT_PAGE, DEFAULT_ROWS, 2, val);
 
-                   vc.component.orgManageInfo.conditions.parentOrgId = val;
+                    vc.component.orgManageInfo.conditions.parentOrgId = val;
 
-                   vc.component.orgManageInfo.conditions.branchOrgId = '';
+                    vc.component.orgManageInfo.conditions.branchOrgId = '';
 
-                   vc.component._listOrgs(DEFAULT_PAGE, DEFAULT_ROWS);
+                    vc.component._listOrgs(DEFAULT_PAGE, DEFAULT_ROWS);
 
                 },
-                deep:true
+                deep: true
             },
-            "orgManageInfo.conditions.branchOrgId":{//深度监听,可监听到对象、数组的变化
-                handler(val, oldVal){
-                    if(val == ''){
+            "orgManageInfo.conditions.branchOrgId": {//深度监听,可监听到对象、数组的变化
+                handler(val, oldVal) {
+                    if (val == '') {
                         vc.component.orgManageInfo.conditions.parentOrgId = vc.component.orgManageInfo.conditions.headOrgId;
-                    }else{
+                    } else {
                         vc.component.orgManageInfo.conditions.parentOrgId = val;
                     }
-                   vc.component._listOrgs(DEFAULT_PAGE, DEFAULT_ROWS);
+                    vc.component._listOrgs(DEFAULT_PAGE, DEFAULT_ROWS);
                 },
-                deep:true
+                deep: true
             }
-         },
-        _initMethod:function(){
+        },
+        _initMethod: function () {
             //只查 查询总公司级组织
             vc.component.orgManageInfo.orgTree = [];
-            vc.component._listOrgTrees(vc.component.orgManageInfo.orgTree,'1', '',function(){
+            vc.component._listOrgTrees(vc.component.orgManageInfo.orgTree, '1', '', function () {
                 vc.component._loadBranchOrgTrees();
             });
-            vc.component._getOrgsByOrgLevel(DEFAULT_PAGE, DEFAULT_ROWS,1,'');
+            vc.component._getOrgsByOrgLevel(DEFAULT_PAGE, DEFAULT_ROWS, 1, '');
 
 
         },
-        _initEvent:function(){
-            
-            vc.on('orgManage','listOrg',function(_param){
-                  //vc.copyObject(_param, vc.component.orgManageInfo.conditions);
-                  vc.component._listOrgs(DEFAULT_PAGE, DEFAULT_ROWS);
+        _initEvent: function () {
+
+            vc.on('orgManage', 'listOrg', function (_param) {
+                //vc.copyObject(_param, vc.component.orgManageInfo.conditions);
+                vc.component._listOrgs(DEFAULT_PAGE, DEFAULT_ROWS);
             });
-             vc.on('pagination','page_event',function(_currentPage){
-                vc.component._listOrgs(_currentPage,DEFAULT_ROWS);
+            vc.on('pagination', 'page_event', function (_currentPage) {
+                vc.component._listOrgs(_currentPage, DEFAULT_ROWS);
             });
 
         },
-        methods:{
-            _refreshOrgTree:function(){
+        methods: {
+            _refreshOrgTree: function () {
                 $('#orgTree').treeview({
-                          data: vc.component.orgManageInfo.orgTree,
-                          selectedBackColor:'#1ab394'
+                    data: vc.component.orgManageInfo.orgTree,
+                    selectedBackColor: '#1ab394'
                 });
-                $('#orgTree').on('nodeSelected', function(event, data) {
+                $('#orgTree').on('nodeSelected', function (event, data) {
                     //console.log(event,data);
                     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]);
+                $('#orgTree').treeview("selectNode", [0]);
 
             },
-            _loadBranchOrgTrees:function(){
+            _loadBranchOrgTrees: function () {
                 //默认查询分公司组织信息
                 vc.component._listOrgTrees(vc.component.orgManageInfo.orgTree[0].nodes,
-                                        '2',
-                                        vc.component.orgManageInfo.orgTree[0].orgId,
-                                        function(_tmpOrgs){
-                                            vc.component._refreshOrgTree();
-                                        });
+                    '2',
+                    vc.component.orgManageInfo.orgTree[0].orgId,
+                    function (_tmpOrgs) {
+                        vc.component._refreshOrgTree();
+                    });
             },
-            _listOrgTrees:function(_nodes,_orgLevel,_parentOrgId,_callback){
+            _listOrgTrees: function (_nodes, _orgLevel, _parentOrgId, _callback) {
                 var param = {
-                    params:{
-                        page:DEFAULT_PAGE,
-                        row:ALL_ROWS,
-                        orgLevel:_orgLevel,
-                        parentOrgId:_parentOrgId
+                    params: {
+                        page: DEFAULT_PAGE,
+                        row: ALL_ROWS,
+                        orgLevel: _orgLevel,
+                        parentOrgId: _parentOrgId
                     }
-               };
-               //发送get请求
-               vc.http.get('orgManage',
-                            'list',
-                             param,
-                             function(json,res){
-                                var _tmpOrgs =JSON.parse(json).orgs;
-                                _tmpOrgs.forEach(function (_item) {
-                                    _nodes.push({
-                                        orgId:_item.orgId,
-                                        orgLevel:_orgLevel,
-                                        text:_item.orgLevelName + '|' +_item.orgName,
-                                        href:function(_item){},
-                                        tags:[0],
-                                        nodes:[]
-                                    });
-                                    _callback();
-                                });
-                             },function(errInfo,error){
-                                console.log('请求失败处理');
-                             }
-                           );
+                };
+                //发送get请求
+                vc.http.get('orgManage',
+                    'list',
+                    param,
+                    function (json, res) {
+                        var _tmpOrgs = JSON.parse(json).orgs;
+                        _tmpOrgs.forEach(function (_item) {
+                            _nodes.push({
+                                orgId: _item.orgId,
+                                orgLevel: _orgLevel,
+                                text: _item.orgLevelName + '|' + _item.orgName,
+                                href: function (_item) {
+                                },
+                                tags: [0],
+                                nodes: []
+                            });
+                            _callback();
+                        });
+                    }, function (errInfo, error) {
+                        console.log('请求失败处理');
+                    }
+                );
             },
-            _listOrgs:function(_page, _rows){
+            _listOrgs: function (_page, _rows) {
 
                 vc.component.orgManageInfo.conditions.page = _page;
                 vc.component.orgManageInfo.conditions.row = _rows;
                 var param = {
-                    params:vc.component.orgManageInfo.conditions
-               };
-
-               //发送get请求
-               vc.http.get('orgManage',
-                            'list',
-                             param,
-                             function(json,res){
-                                var _orgManageInfo=JSON.parse(json);
-                                vc.component.orgManageInfo.total = _orgManageInfo.total;
-                                vc.component.orgManageInfo.records = _orgManageInfo.records;
-                                vc.component.orgManageInfo.orgs = _orgManageInfo.orgs;
-                                vc.emit('pagination','init',{
-                                     total:vc.component.orgManageInfo.records,
-                                     currentPage:_page
-                                 });
-                             },function(errInfo,error){
-                                console.log('请求失败处理');
-                             }
-                           );
+                    params: vc.component.orgManageInfo.conditions
+                };
+
+                //发送get请求
+                vc.http.get('orgManage',
+                    'list',
+                    param,
+                    function (json, res) {
+                        var _orgManageInfo = JSON.parse(json);
+                        vc.component.orgManageInfo.total = _orgManageInfo.total;
+                        vc.component.orgManageInfo.records = _orgManageInfo.records;
+                        vc.component.orgManageInfo.orgs = _orgManageInfo.orgs;
+                        vc.emit('pagination', 'init', {
+                            total: vc.component.orgManageInfo.records,
+                            currentPage: _page
+                        });
+                    }, function (errInfo, error) {
+                        console.log('请求失败处理');
+                    }
+                );
             },
-            _openAddOrgModal:function(){
-                vc.emit('addOrg','openAddOrgModal',{
+            _openAddOrgModal: function () {
+                vc.emit('addOrg', 'openAddOrgModal', {
                     parentOrgId: vc.component.orgManageInfo.conditions.parentOrgId,
-                    orgLevel: vc.component.orgManageInfo.conditions.orgLevel
+                    orgLevel: vc.component.orgManageInfo.conditions.orgLevel,
+                    belongCommunityId: vc.component.orgManageInfo.currentBelongCommunityId
                 });
             },
-            _openEditOrgModel:function(_org){
-                vc.emit('editOrg','openEditOrgModal',_org);
+            _openEditOrgModel: function (_org) {
+                vc.emit('editOrg', 'openEditOrgModal', _org);
             },
-            _openDeleteOrgModel:function(_org){
-                vc.emit('deleteOrg','openDeleteOrgModal',_org);
+            _openDeleteOrgModel: function (_org) {
+                vc.emit('deleteOrg', 'openDeleteOrgModal', _org);
             },
-            _queryOrgMethod:function(){
+            _queryOrgMethod: function () {
                 vc.component._listOrgs(DEFAULT_PAGE, DEFAULT_ROWS);
 
             },
-            _moreCondition:function(){
-                if(vc.component.orgManageInfo.moreCondition){
+            _moreCondition: function () {
+                if (vc.component.orgManageInfo.moreCondition) {
                     vc.component.orgManageInfo.moreCondition = false;
-                }else{
+                } else {
                     vc.component.orgManageInfo.moreCondition = true;
                 }
             },
 
-            _getOrgsByOrgLevel:function(_page, _rows,_orgLevel,_parentOrgId){
+            _getOrgsByOrgLevel: function (_page, _rows, _orgLevel, _parentOrgId) {
 
                 var param = {
-                    params:{
+                    params: {
                         page: _page,
                         row: _rows,
-                        orgLevel:_orgLevel,
+                        orgLevel: _orgLevel,
                         parentOrgId: _parentOrgId
                     }
-                 };
-
-               //发送get请求
-               vc.http.get('orgManage',
-                            'list',
-                             param,
-                             function(json,res){
-                                var _orgManageInfo=JSON.parse(json);
-                                if(_orgLevel == 1){
-                                     vc.component.orgManageInfo.headOrg = _orgManageInfo.orgs;
-                                }else{
-                                     vc.component.orgManageInfo.branchOrg = _orgManageInfo.orgs;
-                                }
-                             },function(errInfo,error){
-                                console.log('请求失败处理');
-                             }
-                           );
+                };
+
+                //发送get请求
+                vc.http.get('orgManage',
+                    'list',
+                    param,
+                    function (json, res) {
+                        var _orgManageInfo = JSON.parse(json);
+                        if (_orgLevel == 1) {
+                            vc.component.orgManageInfo.headOrg = _orgManageInfo.orgs;
+                        } else {
+                            vc.component.orgManageInfo.branchOrg = _orgManageInfo.orgs;
+                        }
+                    }, function (errInfo, error) {
+                        console.log('请求失败处理');
+                    }
+                );
             }
 
-             
+
         }
     });
 })(window.vc);

+ 10 - 0
java110-bean/src/main/java/com/java110/dto/org/OrgDto.java

@@ -21,6 +21,7 @@ public class OrgDto extends PageDto implements Serializable {
     private String orgLevel;
     private String storeId;
     private String orgId;
+    private String belongCommunityId;
 
     private String parentOrgName;
 
@@ -112,4 +113,13 @@ public class OrgDto extends PageDto implements Serializable {
     public void setParentOrgName(String parentOrgName) {
         this.parentOrgName = parentOrgName;
     }
+
+
+    public String getBelongCommunityId() {
+        return belongCommunityId;
+    }
+
+    public void setBelongCommunityId(String belongCommunityId) {
+        this.belongCommunityId = belongCommunityId;
+    }
 }

+ 9 - 0
java110-bean/src/main/java/com/java110/vo/api/org/ApiOrgDataVo.java

@@ -10,6 +10,7 @@ public class ApiOrgDataVo implements Serializable {
     private String orgLevel;
     private String parentOrgId;
     private String parentOrgName;
+    private String belongCommunityId;
     private String description;
 
     private String orgLevelName;
@@ -69,4 +70,12 @@ public class ApiOrgDataVo implements Serializable {
     public void setParentOrgName(String parentOrgName) {
         this.parentOrgName = parentOrgName;
     }
+
+    public String getBelongCommunityId() {
+        return belongCommunityId;
+    }
+
+    public void setBelongCommunityId(String belongCommunityId) {
+        this.belongCommunityId = belongCommunityId;
+    }
 }

+ 23 - 6
java110-db/src/main/resources/mapper/user/OrgServiceDaoImplMapper.xml

@@ -7,9 +7,9 @@
     <!-- 保存组织信息 add by wuxw 2018-07-03 -->
     <insert id="saveBusinessOrgInfo" parameterType="Map">
         insert into business_org(
-        org_name,operate,parent_org_id,description,org_level,store_id,b_id,org_id
+        org_name,operate,parent_org_id,description,org_level,store_id,b_id,org_id,belong_community_id
         ) values (
-        #{orgName},#{operate},#{parentOrgId},#{description},#{orgLevel},#{storeId},#{bId},#{orgId}
+        #{orgName},#{operate},#{parentOrgId},#{description},#{orgLevel},#{storeId},#{bId},#{orgId},#{belongCommunityId}
         )
     </insert>
 
@@ -18,7 +18,7 @@
     <select id="getBusinessOrgInfo" parameterType="Map" resultType="Map">
         select t.org_name,t.org_name orgName,t.operate,t.parent_org_id,t.parent_org_id
         parentOrgId,t.description,t.org_level,t.org_level orgLevel,t.store_id,t.store_id storeId,t.b_id,t.b_id
-        bId,t.org_id,t.org_id orgId
+        bId,t.org_id,t.org_id orgId,t.belong_community_id ,t.belong_community_id belongCommunityId
         from business_org t
         where 1 =1
         <if test="orgName !=null and orgName != ''">
@@ -45,6 +45,9 @@
         <if test="orgId !=null and orgId != ''">
             and t.org_id= #{orgId}
         </if>
+        <if test="belongCommunityId !=null and belongCommunityId != ''">
+            and t.belong_community_id= #{belongCommunityId}
+        </if>
 
     </select>
 
@@ -52,8 +55,9 @@
     <!-- 保存组织信息至 instance表中 add by wuxw 2018-07-03 -->
     <insert id="saveOrgInfoInstance" parameterType="Map">
         insert into u_org(
-        org_name,parent_org_id,description,org_level,status_cd,store_id,b_id,org_id
-        ) select t.org_name,t.parent_org_id,t.description,t.org_level,'0',t.store_id,t.b_id,t.org_id from business_org t
+        org_name,parent_org_id,description,org_level,status_cd,store_id,b_id,org_id,belong_community_id
+        ) select t.org_name,t.parent_org_id,t.description,t.org_level,'0',t.store_id,t.b_id,t.org_id,t.belong_community_id
+        from business_org t
         where 1=1
         <if test="orgName !=null and orgName != ''">
             and t.org_name= #{orgName}
@@ -77,6 +81,9 @@
         <if test="orgId !=null and orgId != ''">
             and t.org_id= #{orgId}
         </if>
+        <if test="belongCommunityId !=null and belongCommunityId != ''">
+            and t.belong_community_id= #{belongCommunityId}
+        </if>
 
     </insert>
 
@@ -85,7 +92,8 @@
     <select id="getOrgInfo" parameterType="Map" resultType="Map">
         select t.org_name,t.org_name orgName,t.parent_org_id,t.parent_org_id
         parentOrgId,t.description,t.org_level,t.org_level orgLevel,td.name orgLevelName,t.status_cd,t.status_cd
-        statusCd,t.store_id,t.store_id storeId,t.b_id,t.b_id bId,t.org_id,t.org_id orgId,uo.org_name parentOrgName
+        statusCd,t.store_id,t.store_id storeId,t.b_id,t.b_id bId,t.org_id,t.org_id orgId,uo.org_name parentOrgName,
+        t.belong_community_id ,t.belong_community_id belongCommunityId
         from u_org t,t_dict td,u_org uo
         where 1 =1
         and t.org_level = td.status_cd
@@ -117,6 +125,9 @@
         <if test="orgId !=null and orgId != ''">
             and t.org_id= #{orgId}
         </if>
+        <if test="belongCommunityId !=null and belongCommunityId != ''">
+            and t.belong_community_id= #{belongCommunityId}
+        </if>
         <if test="page != -1 and page != null ">
             limit #{page}, #{row}
         </if>
@@ -142,6 +153,9 @@
         <if test="orgLevel !=null and orgLevel != ''">
             , t.org_level= #{orgLevel}
         </if>
+        <if test="belongCommunityId !=null and belongCommunityId != ''">
+            , t.belong_community_id= #{belongCommunityId}
+        </if>
         <if test="storeId !=null and storeId != ''">
             , t.store_id= #{storeId}
         </if>
@@ -189,6 +203,9 @@
         <if test="orgId !=null and orgId != ''">
             and t.org_id= #{orgId}
         </if>
+        <if test="belongCommunityId !=null and belongCommunityId != ''">
+            and t.belong_community_id= #{belongCommunityId}
+        </if>
 
 
     </select>