소스 검색

组织管理功能

git-svn-id: https://192.168.57.71/svn/jsgkj@1215 931142cf-59ea-a443-aa0e-51397b428577
ld_zhouk 8 년 전
부모
커밋
8582fc2c42

+ 21 - 3
gkaqv2/trunk/modules/web/src/main/java/com/xt/js/gkaq/web/ctl/OrgCtl.java

@@ -4,6 +4,8 @@ import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
 import java.util.List;
 
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.subject.Subject;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -14,10 +16,12 @@ import org.springframework.web.bind.annotation.ResponseBody;
 
 import com.alibaba.fastjson.JSONArray;
 import com.xt.js.gkaq.common.BaseCtl;
+import com.xt.js.gkaq.common.Constants;
 import com.xt.js.gkaq.common.log.annotation.SysLog;
 import com.xt.js.gkaq.frame.model.ComboBoxDto;
 import com.xt.js.gkaq.frame.model.OrgModel;
 import com.xt.js.gkaq.frame.model.OrgModelDto;
+import com.xt.js.gkaq.frame.model.UserModel;
 import com.xt.js.gkaq.frame.service.OrgService;
 import com.xt.js.gkaq.web.vo.OrgVo;
 import com.yuanxd.tools.pagehelper.PageHelper;
@@ -52,9 +56,16 @@ public class OrgCtl extends BaseCtl {
      */
     @RequestMapping("tree")
     @ResponseBody
-    public String initOrgTree() {
-
-        List<OrgModel> list = orgService.initOrgTree();
+    public String initOrgTree(boolean allFlag) {
+        // 当前用户下的组织
+        Subject subject = SecurityUtils.getSubject();
+        UserModel user = (UserModel) subject.getPrincipal();
+        String pid = "";
+        if (!Constants.USER_TYPE_SA.equals(user.getRylx())) {
+            pid = user.getOrgid();
+        }
+        
+        List<OrgModel> list = orgService.initOrgTree(pid, allFlag);
         return JSONArray.toJSONString(list);
     }
 
@@ -87,6 +98,13 @@ public class OrgCtl extends BaseCtl {
         }
         if (StringUtils.isNotEmpty(vo.getPid())) {
             model.setPid(vo.getPid());
+        } else {
+            // 当前用户下的组织
+            Subject subject = SecurityUtils.getSubject();
+            UserModel user = (UserModel) subject.getPrincipal();
+            if (!Constants.USER_TYPE_SA.equals(user.getRylx())) {
+                model.setPid(user.getOrgid());
+            }
         }
         List<OrgModelDto> list = orgService.findAllByCond(model);
         PageInfo<OrgModelDto> pageResult = new PageInfo<>(list);

+ 3 - 3
gkaqv2/trunk/modules/web/src/main/resources/log4j/log4j.xml

@@ -128,8 +128,8 @@
 			<param name="LevelMax" value="FATAL" />
 		</filter>
 	</appender>
-    <logger name="com.xt.dsp">
-		<level value="INFO" />
+    <logger name="com.xt.js.gkaq">
+		<level value="DEBUG" />
 	</logger>
     <logger name="com.ibatis">
 		<level value="DEBUG" />
@@ -139,7 +139,7 @@
 	</logger>
 	<root>
 		<!-- 设置输出范围,默认只输出ERROR以上的,ERROR级别, FATAL级别的LOG -->
-		<priority value="INFO" />
+		<priority value="ERROR" />
 		<!-- 上边设置的输出通道,使用的在这里定义 -->
 		<appender-ref ref="STDOUT" />
 		<appender-ref ref="DEBUG" />

+ 1 - 1
gkaqv2/trunk/modules/web/src/main/webapp/WEB-INF/view/frame/org.jsp

@@ -114,7 +114,7 @@
                                 <div class="form-group">
                                     <label class="col-sm-2 control-label" for="orgType">×éÖŻŔŕĐÍ</label>
                                     <div class="col-sm-9">
-                                        <select class="selectpicker form-control" id="orgType" name="orgType">
+                                        <select class="selectpicker form-control" id="orgType" name="orgType" onchange="changeSzdSel()">
                                             <option value="" selected="selected">ÇëŃĄÔń...</option>
                                         </select>
                                     </div>

+ 13 - 1
gkaqv2/trunk/modules/web/src/main/webapp/static/js/common/common.js

@@ -369,4 +369,16 @@ $.formatString = function (str) {
         str = str.replace("{" + i + "}", arguments[i + 1]);
     }
     return str;
-};
+};
+
+if (typeof constData == "undefined") {
+    var constData = {};
+    // 订单状态
+    constData.orgType_0 = "省局";
+    constData.orgType_1 = "所在地";
+    constData.orgType_2 = "市局";
+    constData.orgType_3 = "县局";
+    constData.orgType_4 = "站所";
+    constData.orgType_8 = "企业";
+    constData.orgType_9 = "科室";
+}

+ 8 - 1
gkaqv2/trunk/modules/web/src/main/webapp/static/js/frame/dict.js

@@ -338,6 +338,11 @@ function save() {
         return;
     }
 
+//    if (isNull($("#pid").val()) && $("#leaf").val() == 'Y') {
+//        layer.alert("没有父编码,不能指定为末级编码!");
+//        return;
+//    }
+
     $.ajax({
         type : "post",
         url : basePath + '/dict/save',
@@ -348,7 +353,9 @@ function save() {
             if (data && data.success == true) {
                 layer.alert("数据已成功保存!");
                 closeWin();
-                dictTree.reAsyncChildNodes(null, "refresh");
+                if (isNull($("#id").val()) && $("#leaf").val() != 'Y') {
+                    dictTree.reAsyncChildNodes(null, "refresh");
+                }
                 searchRecord();
             } else {
                 layer.alert("数据保存失败!");

+ 1 - 1
gkaqv2/trunk/modules/web/src/main/webapp/static/js/frame/group.js

@@ -33,7 +33,7 @@ view : {
 async : {
     enable : true,
     type : 'post',
-    url : basePath + "/org/tree"
+    url : basePath + "/org/tree?allFlag=true"
 },
 data : {
     // 简单的数据源

+ 52 - 14
gkaqv2/trunk/modules/web/src/main/webapp/static/js/frame/org.js

@@ -10,7 +10,7 @@ var setting = {
   async : {
       enable : true,
       type : 'post',
-      url : basePath + "/org/tree"
+      url : basePath + "/org/tree?allFlag=false"
   },
   data : {
       // 简单的数据源
@@ -148,7 +148,7 @@ function initGrid() {
         datatype : "json",
         height : "auto",
         colNames : [
-                '唯一标识', '组织名称', '组织编码', '上级组织', '上级组织编码', '上级组织名称', '组织类型', '所在地编码', '所在地名称', '行政区划', '等级', '备注', '排序'
+                '唯一标识', '组织名称', '组织编码', '上级组织', '上级组织名称', '上级组织编码', '组织类型', '所在地名称', '所在地编码', '行政区划', '等级', '备注', '排序'
         ],
         colModel : [
                 {
@@ -171,28 +171,35 @@ function initGrid() {
                     hidden : true,
                     sortable : false
                 }, {
-                    name : 'pcode',
-                    index : 'pcode',
+                    name : 'pname',
+                    index : 'pname',
                     hidden : true,
                     sortable : false
                 }, {
-                    name : 'pname',
-                    index : 'pname',
+                    name : 'pcode',
+                    index : 'pcode',
                     hidden : true,
                     sortable : false
                 }, {
                     name : 'orgType',
                     index : 'orgType',
+                    sortable : false,
+                    formatter : function(cellvalue, options, rowObject) {
+                        var val = eval('constData.orgType_' + cellvalue);
+                        if (isNull(val)) {
+                            val = cellvalue;
+                        }
+                        return val;
+                    }
+                }, {
+                    name : 'szdName',
+                    index : 'szdName',
                     sortable : false
                 }, {
                     name : 'szd',
                     index : 'szd',
                     sortable : false
                 }, {
-                    name : 'szdName',
-                    index : 'szdName',
-                    sortable : false
-                }, {
                     name : 'xzqh',
                     index : 'xzqh',
                     sortable : false
@@ -201,13 +208,13 @@ function initGrid() {
                     index : 'level',
                     sortable : false
                 }, {
-                    name : 'sortno',
-                    index : 'sortno',
-                    sortable : false
-                }, {
                     name : 'remark',
                     index : 'remark',
                     sortable : false
+                }, {
+                    name : 'sortno',
+                    index : 'sortno',
+                    sortable : false
                 }
         ],
         rowNum : _rowNum, // 每页显示记录数
@@ -257,6 +264,7 @@ function addInfo() {
     $('#orgType').selectpicker('refresh');
     $('#szd').selectpicker('refresh');
     $('#xzqh').selectpicker('refresh');
+    $('#szd').prop('disabled', true);
 
     //获取选择行
     var nodes = orgTree.getSelectedNodes();
@@ -268,6 +276,9 @@ function addInfo() {
         $("#pid").val(node.id);
         $("#pcode").val(node.code);
         $("#pname").val(node.name);
+        $("#szd").selectpicker('val', node.szd);
+        $("#szdName").val(node.szdName);
+        $("#xzqh").selectpicker('val', node.xzqh);
     }
     // 弹出模态框
     showModelDialog("editWin", "新增");
@@ -304,6 +315,7 @@ function editInfo() {
                 $("#szdName").val(data.szdName);
                 $("#xzqh").selectpicker('val', data.xzqh);
                 $("#level").val(data.level);
+                changeSzdSel();
                 showModelDialog("editWin", "编辑");
             },
             error : function(XMLHttpRequest, textStatus, errorThrown) {
@@ -375,6 +387,22 @@ function save() {
         return;
     }
 
+    var orgType = $("#orgType").selectpicker('val');
+    if (isNull($("#pid").val()) && (orgType != '0' && orgType != '1')) {
+        $("#szd").selectpicker('val', '');
+        $("#szdName").val('');
+        layer.alert("未指定上级组织,组织类型必须指定为省局或所在地!");
+        return;
+    }
+    
+    if (!isNull($("#pid").val()) && (orgType == '0' || orgType == '1')) {
+        var node = orgTree.getSelectedNodes()[0];
+        $("#szd").selectpicker('val', node.szd);
+        $("#szdName").val(node.szdName);
+        layer.alert("已存在上级组织,组织类型不能指定为省局或所在地!");
+        return;
+    }
+
     $.ajax({
         type : "post",
         url : basePath + '/org/save',
@@ -442,4 +470,14 @@ function xzqhSelect() {
 
 function changeSzd() {
     $('#szdName').val($("#szd").find("option:selected").text());
+}
+
+function changeSzdSel() {
+    var orgType = $("#orgType").selectpicker('val');
+    if (orgType == '0' || orgType == '1') {
+        $('#szd').prop('disabled', false);
+    } else {
+        $('#szd').prop('disabled', true);
+    }
+    $("#level").val(orgType);
 }

+ 1 - 1
gkaqv2/trunk/modules/web/src/main/webapp/static/js/user/index.js

@@ -10,7 +10,7 @@ var setting = {
     async : {
         enable : true,
         type : 'post',
-        url : basePath + "/org/tree"
+        url : basePath + "/org/tree?allFlag=true"
     },
     data : {
         // 简单的数据源