优化业务/系统字典功能,数据类型数量可改变,可任意组合菜单(作用域必须单独),页面自动设定权限,组合菜单时数据类型超过1种,列表页面条件搜索添加数据类型条件。

修订校验时浏览器的兼容问题,
This commit is contained in:
zhangshilin
2018-03-31 17:23:11 +08:00
parent 894661a8b8
commit aa84684b3b
19 changed files with 330 additions and 666 deletions

View File

@@ -43,6 +43,13 @@ public class ServiceDictInfo extends BaseEntity<ServiceDictInfo>{
private String showSequence; //显示序号
/**
* 封装参数数据类型,
*
*/
private List<Integer> conditionType;
public Integer getServiceDictId() {
return serviceDictId;
}
@@ -159,6 +166,12 @@ public class ServiceDictInfo extends BaseEntity<ServiceDictInfo>{
public void setShowSequence(String showSequence) {
this.showSequence = showSequence;
}
public List<Integer> getConditionType() {
return conditionType;
}
public void setConditionType(List<Integer> conditionType) {
this.conditionType = conditionType;
}
@JsonIgnore
public static void sortList(List<ServiceDictInfo> list, List<ServiceDictInfo> sourcelist, Integer parentId, boolean cascade){
for (int i=0; i<sourcelist.size(); i++){

View File

@@ -40,6 +40,12 @@ public class SysDictInfo extends BaseEntity<SysDictInfo>{
private String showSequence; //显示序号
/**
* 封装参数数据类型,
*
*/
private List<Integer> conditionType;
public Integer getSysDictId() {
return sysDictId;
@@ -155,6 +161,12 @@ public class SysDictInfo extends BaseEntity<SysDictInfo>{
public String getShowSequence() {
return showSequence;
}
public List<Integer> getConditionType() {
return conditionType;
}
public void setConditionType(List<Integer> conditionType) {
this.conditionType = conditionType;
}
@JsonIgnore
public static void sortList(List<SysDictInfo> list, List<SysDictInfo> sourcelist, Integer parentId, boolean cascade){
for (int i=0; i<sourcelist.size(); i++){

View File

@@ -1,5 +1,6 @@
package com.nis.util;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -69,64 +70,84 @@ public class ConfigDictUtils {
return number1+(number2-1)*number3;
}
/**
* 根据数据类型编码取出数据类型
* @param dictKey
* 根据数据类型编码取出数据类型标题国际化
* (2018-03-30修订获取的国际化改为类型的国际化)
* @param dictKey 数据的字典标识
* @param intArr
* @return
*/
public static String getItemTypeByNo(String dictKey, List intArr){
String result = "";
String value = DictUtils.getDictLabel(dictKey,intArr.get(0).toString());
if(value.trim().equals("classification")){
result = "classification_manage";
public static List<String> getItemTypeByNo(String dictKey, List intArr){
List<String> itemValueList = Lists.newArrayList();
if(intArr==null||intArr.size()==0){
List<SysDataDictionaryItem> itemList = DictUtils.getDictList(dictKey);
if(!StringUtil.isEmpty(itemList)){
for(SysDataDictionaryItem sd:itemList){
itemValueList.add(sd.getItemValue());
}
if(value.trim().equals("attribute")){
result = "attribute_manage";
}
if(value.trim().equals("label")){
result = "label_manage";
}else{
for(Object itemCode:intArr){
itemValueList.add(DictUtils.getDictLabel(dictKey,itemCode.toString()));
}
if(value.trim().equals("area")){
result = "area_manage";
}
if(value.trim().equals("isp")){
result = "isp_manage";
}
if(value.trim().equals("scope")){
result = "feature_scope_manage";
}
return result;
return itemValueList;
}
/**
* 根据数据类型编码取出权限标识码
* @param dictKey
* @param dictKey 数据的字典标识
* @param intArr
* @return
*/
public static String getPermissionByNo(String dictKey, List intArr){
String result = "";
String value = DictUtils.getDictLabel(dictKey,intArr.get(0).toString());
if(value.trim().equals("classification")){
result = "classification";
List<String> itemValueList = Lists.newArrayList();
StringBuffer sb = new StringBuffer("");
itemValueList=getItemTypeByNo(dictKey,intArr);
if(!StringUtil.isEmpty(itemValueList)){
for(String itermvalue:itemValueList){
sb.append(itermvalue);
}
if(value.trim().equals("attribute")){
result = "attribute";
}
if(value.trim().equals("label")){
result = "label";
}
if(value.trim().equals("area")){
result = "area";
}
if(value.trim().equals("isp")){
result = "isp";
}
if(value.trim().equals("scope")){
result = "scope";
}
return result;
return sb.toString();
}
/**
* 根据数据类型标识取出数据类型的itemCode
* @param dictKey 数据的字典标识
* @param intArr
* @return
*/
public static List<Integer> getAllType(String dictKey){
List<Integer> itemCodeList = Lists.newArrayList();
List<SysDataDictionaryItem> itemList = DictUtils.getDictList(dictKey);
if(!StringUtil.isEmpty(itemList)){
for(SysDataDictionaryItem sd:itemList){
itemCodeList.add(Integer.valueOf(sd.getItemCode()));
}
}
return itemCodeList;
}
/**
* 根据传入数据拆分数据类型参数
* @param dictKey 数据的字典标识
* @param itType 传入参数
* @return
*/
public static List<Integer> dealTypeCondition(String dictKey,String itType ){
List<Integer> intArr = Lists.newArrayList();
if(StringUtil.isEmpty(itType)){
intArr = ConfigDictUtils.getAllType(dictKey);
}else{
String[] strArr = itType.split("-");
Integer[] tempArr = new Integer[strArr.length];
for(int i=0;i<strArr.length;i++){
tempArr[i] = Integer.valueOf(strArr[i]);
}
intArr = Arrays.asList(tempArr);
}
return intArr;
}
}

View File

@@ -23,6 +23,7 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.nis.domain.Page;
import com.nis.domain.basics.ServiceDictInfo;
import com.nis.util.ConfigDictUtils;
import com.nis.util.Configurations;
import com.nis.util.StringUtil;
import com.nis.util.StringUtils;
@@ -44,21 +45,6 @@ public class ServiceDictInfoController extends BaseController {
}
/**
* 根据serviceDictId查出配置对象
* @param serviceDictId
* @param request
* @param response
* @param model
* @return
*/
@ResponseBody
@RequestMapping(value = "loadDataDict")
public ServiceDictInfo loadDataDict(@RequestParam(required=false) Integer serviceDictId,HttpServletRequest request, HttpServletResponse response, Model model){
return serviceDictInfoService.getDictById(serviceDictId);
}
/**
* 查询业务辅助表-业务字典信息列表(无条件分页查询)
@@ -69,16 +55,11 @@ public class ServiceDictInfoController extends BaseController {
* @param model
* @return
*/
@RequiresPermissions(value={"basics:classification:view","basics:attribute:view","basics:label:view"},logical=Logical.OR)
@RequiresPermissions(value={"basics:classification:view","basics:attribute:view","basics:label:view","basics:classificationattribute:edit"},logical=Logical.OR)
@RequestMapping(value = {"list", ""})
public String list(String itType, ServiceDictInfo serviceDictInfo,HttpServletRequest request, HttpServletResponse response, Model model) {
//处理数据
String[] strArr = itType.split("-");
Integer[] intArr = new Integer[strArr.length];
for(int i=0;i<strArr.length;i++){
intArr[i] = Integer.valueOf(strArr[i]);
}
List<Integer> intArr = ConfigDictUtils.dealTypeCondition(Configurations.getStringProperty("SERVICE_DICT_ITM_TYPE", ""), itType);
String searchType = null;
String searchContent = null;
if(!StringUtils.isBlank(serviceDictInfo.getItemCode())){
@@ -93,12 +74,15 @@ public class ServiceDictInfoController extends BaseController {
model.addAttribute("searchContent", searchContent);
Page<ServiceDictInfo> pageCondition = new Page<ServiceDictInfo>(request, response);
//查询符合条件总数
List<ServiceDictInfo> allList = serviceDictInfoService.findAllServiceDictInfo(serviceDictInfo,intArr,pageCondition.getOrderBy());
model.addAttribute("showTotalCount", allList.size());
//查出顶层分页数据
Page<ServiceDictInfo> page = serviceDictInfoService.findTopDictList(pageCondition, serviceDictInfo,intArr);
// 植入序号
for (int i = 0; i < page.getList().size(); i++) {
page.getList().get(i).setShowSequence("" + (i + 1 + ((page.getPageNo() - 1) * page.getPageSize())));
@@ -129,7 +113,7 @@ public class ServiceDictInfoController extends BaseController {
//处理下级序号
ServiceDictInfo.addChildrenSeq(list, 0);
model.addAttribute("itType", itType);
model.addAttribute("intArr", Arrays.asList(intArr));
model.addAttribute("intArr", intArr);
model.addAttribute("list", list);
return "/basics/serviceDictList";
}
@@ -141,7 +125,7 @@ public class ServiceDictInfoController extends BaseController {
* @param model
* @return
*/
@RequiresPermissions(value={"basics:classification:edit","basics:attribute:edit","basics:label:edit"},logical=Logical.OR)
@RequiresPermissions(value={"basics:classification:edit","basics:attribute:edit","basics:label:edit","basics:classificationattribute:edit"},logical=Logical.OR)
@RequestMapping(value={"form"})
public String form(ServiceDictInfo serviceDictInfo, Model model,String doAction,String itType) {
if(doAction!=null&&doAction.equals("0")){
@@ -152,12 +136,8 @@ public class ServiceDictInfoController extends BaseController {
parent.setServiceDictId(0);
serviceDictInfo.setParent(parent);
}
String[] strArr = itType.split("-");
Integer[] intArr = new Integer[strArr.length];
for(int i=0;i<strArr.length;i++){
intArr[i] = Integer.valueOf(strArr[i]);
}
model.addAttribute("intArr", Arrays.asList(intArr));
List<Integer> intArr = ConfigDictUtils.dealTypeCondition(Configurations.getStringProperty("SERVICE_DICT_ITM_TYPE", ""), itType);
model.addAttribute("intArr", intArr);
model.addAttribute("serviceDictInfo", serviceDictInfo);
model.addAttribute("itType", itType);
return "/basics/serviceDictForm";
@@ -236,10 +216,6 @@ public class ServiceDictInfoController extends BaseController {
map.put("id", serviceDictInfo.getServiceDictId());
map.put("pId", serviceDictInfo.getParent().getServiceDictId());
map.put("name",serviceDictInfo.getItemValue());
/*if(serviceDictInfo.getParent().getServiceDictId()!=0){
ServiceDictInfo parent = serviceDictInfoService.getDictById(serviceDictInfo.getParent().getServiceDictId());
//map.put("placeholder",parent.getItemType().toString());
}*/
mapList.add(map);
}
@@ -296,7 +272,7 @@ public class ServiceDictInfoController extends BaseController {
*/
@ResponseBody
@RequestMapping(value = "ajaxChildrenType")
public boolean ajaxChildrenType(Integer parent,Integer newItemType) {
public boolean ajaxChildrenType(Integer parent,Integer itemType) {
if(parent==null){
return true;
}
@@ -306,7 +282,7 @@ public class ServiceDictInfoController extends BaseController {
return true;
}else{
for(ServiceDictInfo serviceDictInfo:list){
if(serviceDictInfo.getItemType()==newItemType){
if(serviceDictInfo.getItemType()==itemType){
return true;
}
}
@@ -386,9 +362,8 @@ public class ServiceDictInfoController extends BaseController {
return true;
}
}else{
ServiceDictInfo c = serviceDictInfoService.getDictById(currentId);
if(p.getLevelNo()<max){
//查出该所有下级的层级数之和
//查出该节点所有下级的层级数之和
List<ServiceDictInfo> list = serviceDictInfoService.getDictByParentId(currentId);
if(list==null||list.size()==0){
return true;

View File

@@ -1,6 +1,7 @@
package com.nis.web.controller.basics;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -22,6 +23,7 @@ import com.google.common.collect.Maps;
import com.nis.domain.Page;
import com.nis.domain.basics.ServiceDictInfo;
import com.nis.domain.basics.SysDictInfo;
import com.nis.util.ConfigDictUtils;
import com.nis.util.Configurations;
import com.nis.util.StringUtil;
import com.nis.util.StringUtils;
@@ -43,21 +45,6 @@ public class SysDictInfoController extends BaseController {
}
/**
* 根据sysDictId查出配置对象
* @param sysDictId
* @param request
* @param response
* @param model
* @return
*/
@ResponseBody
@RequestMapping(value = "loadDataDict")
public SysDictInfo loadDataDict(@RequestParam(required=false) Integer sysDictId,HttpServletRequest request, HttpServletResponse response, Model model){
return sysDictInfoService.getDictById(sysDictId);
}
/**
* 查询业务辅助表-生效范围系统字典信息列表(无条件分页查询)
@@ -71,13 +58,9 @@ public class SysDictInfoController extends BaseController {
@RequestMapping(value = {"list", ""})
public String list(String itType, SysDictInfo sysDictInfo,HttpServletRequest request, HttpServletResponse response, Model model) {
//处理数据
String[] strArr = itType.split("-");
Integer[] intArr = new Integer[strArr.length];
for(int i=0;i<strArr.length;i++){
intArr[i] = Integer.valueOf(strArr[i]);
}
if(intArr.length==1){
model.addAttribute("specType", intArr[0]);
List<Integer> intArr = ConfigDictUtils.dealTypeCondition(Configurations.getStringProperty("SYS_DICT_ITM_TYPE", ""), itType);
if(intArr.size()==1){
model.addAttribute("specType", intArr.get(0));
}
String searchType = null;
String searchContent = null;
@@ -127,7 +110,7 @@ public class SysDictInfoController extends BaseController {
//处理下级序号
SysDictInfo.addChildrenSeq(list, 0);
model.addAttribute("itType", itType);
model.addAttribute("intArr", Arrays.asList(intArr));
model.addAttribute("intArr", intArr);
model.addAttribute("list", list);
return "/basics/sysDictList";
}
@@ -145,20 +128,16 @@ public class SysDictInfoController extends BaseController {
model.addAttribute("specType", sysDictInfo.getItemType());
return "/basics/sysDictInfo";
}
if (sysDictInfo.getParent() == null || sysDictInfo.getParent().getSysDictId() == null) {
if (sysDictInfo==null||sysDictInfo.getParent() == null || sysDictInfo.getParent().getSysDictId() == null) {
SysDictInfo parent = new SysDictInfo();
parent.setSysDictId(0);
sysDictInfo.setParent(parent);
}
String[] strArr = itType.split("-");
Integer[] intArr = new Integer[strArr.length];
for(int i=0;i<strArr.length;i++){
intArr[i] = Integer.valueOf(strArr[i]);
List<Integer> intArr = ConfigDictUtils.dealTypeCondition(Configurations.getStringProperty("SYS_DICT_ITM_TYPE", ""), itType);
if(intArr.size()==1){
model.addAttribute("specType", intArr.get(0));
}
if(intArr.length==1){
model.addAttribute("specType", intArr[0]);
}
model.addAttribute("intArr", Arrays.asList(intArr));
model.addAttribute("intArr", intArr);
model.addAttribute("sysDictInfo", sysDictInfo);
model.addAttribute("itType", itType);
return "/basics/sysDictForm";
@@ -298,7 +277,7 @@ public class SysDictInfoController extends BaseController {
*/
@ResponseBody
@RequestMapping(value = "ajaxChildrenType")
public boolean ajaxChildrenType(Integer parent,Integer newItemType) {
public boolean ajaxChildrenType(Integer parent,Integer itemType) {
if(parent==null){
return true;
}
@@ -308,7 +287,7 @@ public class SysDictInfoController extends BaseController {
return true;
}else{
for(SysDictInfo sysDictInfo:list){
if(sysDictInfo.getItemType()==newItemType){
if(sysDictInfo.getItemType()==itemType){
return true;
}
}
@@ -388,14 +367,41 @@ public class SysDictInfoController extends BaseController {
return true;
}
}else{
SysDictInfo c = sysDictInfoService.getDictById(currentId);
if((p.getLevelNo()+c.getLevelNo())<(max+1)){
if(p.getLevelNo()<max){
//查出该节点所有下级的层级数之和
List<SysDictInfo> list = sysDictInfoService.getDictByParentId(currentId);
if(list==null||list.size()==0){
return true;
}
List<SysDictInfo> resultList = Lists.newArrayList();
List<Integer> intList = Lists.newArrayList();
allTreeNode(1,list,resultList);
for(SysDictInfo se:resultList){
intList.add(se.getLevelNo());
}
int x = Collections.max(intList);
if((p.getLevelNo()+x)<(max+1)){
return true;
}
}
}
}
return false;
}
/**
* 查出所该节点下有树形子节点
*/
private void allTreeNode(int levelNo, List<SysDictInfo> list, List<SysDictInfo> resultList) {
if(list!=null&&list.size()>0){
for(SysDictInfo se:list){
se.setLevelNo(levelNo+1);
resultList.add(se);
List<SysDictInfo> newList = sysDictInfoService.getDictByParentId(se.getSysDictId());
allTreeNode(se.getLevelNo(),newList,resultList);
}
}
}
}

View File

@@ -13,34 +13,22 @@ import com.nis.web.dao.MyBatisDao;
public interface ServiceDictInfoDao extends CrudDao<ServiceDictInfo> {
/**
* 查询顶层字典列表==
* 查询顶层字典列表
* @param serviceDictInfo
* @return
*/
List<ServiceDictInfo> findTopDictList(ServiceDictInfo serviceDictInfo);
/**
* 查询顶层字典列表(!=
* @param serviceDictInfo
* @return
*/
List<ServiceDictInfo> findTopDictListN(ServiceDictInfo serviceDictInfo);
/**
* findAllServiceDictInfo
*/
/**
* 查询所有字典列表==
* 查询所有符合条件的字典列表
* @param serviceDictInfo
* @return
*/
List<ServiceDictInfo> findAllServiceDictInfo(@Param("serviceDictInfo")ServiceDictInfo serviceDictInfo,@Param("orderBy")String orderBy);
/**
* 查所有字典列表(!=
* @param serviceDictInfo
* @return
*/
List<ServiceDictInfo> findAllServiceDictInfoN(@Param("serviceDictInfo")ServiceDictInfo serviceDictInfo,@Param("orderBy")String orderBy);
/**
* 查出所有有效数据
* 查所有有效数据父级(!=0)
*/
List<ServiceDictInfo> findAllDictList(ServiceDictInfo serviceDictInfo);
/**

View File

@@ -72,10 +72,16 @@
<!-- 查询顶层分页列表 (==)-->
<!-- 查询顶层分页列表-->
<select id="findTopDictList" resultMap="dictResultMap" parameterType="com.nis.domain.basics.ServiceDictInfo">
SELECT * FROM service_dict_info s WHERE s.is_valid=1
<if test="conditionType != null and conditionType.size()>0 " >
AND s.item_type in
<foreach collection="conditionType" item="singleType" index="index"
open="(" close=")" separator=",">
#{singleType}
</foreach>
</if>
<if test="itemCode != null and itemCode != '' " >
AND s.item_code like '%${itemCode}%'
</if>
@@ -99,6 +105,13 @@
</if>
AND s.parent_id not in (
SELECT s2.service_dict_id FROM service_dict_info s2 WHERE s2.is_valid=1
<if test="conditionType != null and conditionType.size()>0 " >
AND s2.item_type in
<foreach collection="conditionType" item="singleType" index="index"
open="(" close=")" separator=",">
#{singleType}
</foreach>
</if>
<if test="itemCode != null and itemCode != '' " >
AND s2.item_code like '%${itemCode}%'
</if>
@@ -132,70 +145,18 @@
</select>
<!-- 查询顶层分页列表 (!=)-->
<select id="findTopDictListN" resultMap="dictResultMap" parameterType="com.nis.domain.basics.ServiceDictInfo">
SELECT * FROM service_dict_info s WHERE s.is_valid=1
<if test="itemCode != null and itemCode != '' " >
AND s.item_code like '%${itemCode}%'
</if>
<if test="itemValue!= null and itemValue != '' " >
AND s.item_value like '%${itemValue}%'
</if>
<if test="itemType != null and itemType != '' " >
AND s.item_type != ${itemType}
</if>
<if test="beginDate !=null" >
AND s.create_time &gt;= #{beginDate,jdbcType=TIMESTAMP}
</if>
<if test="endDate !=null" >
AND s.create_time &lt;= #{endDate,jdbcType=TIMESTAMP}
</if>
<if test="editBeginDate !=null" >
AND edit_time &gt;= #{editBeginDate,jdbcType=TIMESTAMP}
</if>
<if test="editEndDate !=null" >
AND edit_time &lt;= #{editEndDate,jdbcType=TIMESTAMP}
</if>
AND s.parent_id not in (
SELECT s2.service_dict_id FROM service_dict_info s2 WHERE s2.is_valid=1
<if test="itemCode != null and itemCode != '' " >
AND s2.item_code like '%${itemCode}%'
</if>
<if test="itemValue!= null and itemValue != '' " >
AND s2.item_value like '%${itemValue}%'
</if>
<if test="itemType != null and itemType != '' " >
AND s2.item_type != ${itemType}
</if>
<if test="beginDate !=null" >
AND s2.create_time &gt;= #{beginDate,jdbcType=TIMESTAMP}
</if>
<if test="endDate !=null" >
AND s2.create_time &lt;= #{endDate,jdbcType=TIMESTAMP}
</if>
<if test="editBeginDate !=null" >
AND edit_time &gt;= #{editBeginDate,jdbcType=TIMESTAMP}
</if>
<if test="editEndDate !=null" >
AND edit_time &lt;= #{editEndDate,jdbcType=TIMESTAMP}
</if>
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY s.${page.orderBy}
</when>
<otherwise>
ORDER BY s.create_time desc
</otherwise>
</choose>
</select>
<!-- 查询所有列表 (==)-->
<!-- 查询所有符合条件列表-->
<select id="findAllServiceDictInfo" resultMap="dictResultMap">
SELECT * FROM service_dict_info WHERE is_valid=1
<if test="serviceDictInfo.conditionType != null and serviceDictInfo.conditionType.size()>0 " >
AND item_type in
<foreach collection="serviceDictInfo.conditionType" item="singleType" index="index"
open="(" close=")" separator=",">
#{singleType}
</foreach>
</if>
<if test="serviceDictInfo.itemValue != null and serviceDictInfo.itemValue != '' " >
AND item_value like '%${serviceDictInfo.itemValue}%'
</if>
@@ -227,42 +188,7 @@
</choose>
</select>
<!--所有列表 (!=)-->
<select id="findAllServiceDictInfoN" resultMap="dictResultMap">
SELECT * FROM service_dict_info WHERE is_valid=1
<if test="serviceDictInfo.itemValue != null and serviceDictInfo.itemValue != '' " >
AND item_value like '%${serviceDictInfo.itemValue}%'
</if>
<if test="serviceDictInfo.itemCode != null and serviceDictInfo.itemCode != '' " >
AND item_code like '%${serviceDictInfo.itemCode}%'
</if>
<if test="serviceDictInfo.itemType != null and serviceDictInfo.itemType != '' " >
AND item_type != #{serviceDictInfo.itemType}
</if>
<if test="serviceDictInfo.beginDate !=null" >
AND create_time &gt;= #{serviceDictInfo.beginDate,jdbcType=TIMESTAMP}
</if>
<if test="serviceDictInfo.endDate !=null" >
AND create_time &lt;= #{serviceDictInfo.endDate,jdbcType=TIMESTAMP}
</if>
<if test="serviceDictInfo.editBeginDate !=null" >
AND edit_time &gt;= #{serviceDictInfo.editBeginDate,jdbcType=TIMESTAMP}
</if>
<if test="serviceDictInfo.editEndDate !=null" >
AND edit_time &lt;= #{serviceDictInfo.editEndDate,jdbcType=TIMESTAMP}
</if>
<choose>
<when test="orderBy != null and orderBy != ''">
ORDER BY ${orderBy}
</when>
<otherwise>
ORDER BY create_time desc
</otherwise>
</choose>
</select>
<!-- 查出所有 -->
<!--所有有效(父级(!=0))字典信息 -->
<select id="findAllDictList" resultType="serviceDictInfo">
SELECT
<include refid="serviceDictInfoColumns"/>

View File

@@ -14,29 +14,17 @@ public interface SysDictInfoDao extends CrudDao<SysDictInfo> {
/**
* 查询顶层字典列表==)
* 查询顶层字典列表
* @param sysDictInfo
* @return
*/
List<SysDictInfo> findTopDictList(SysDictInfo sysDictInfo);
/**
* 查询顶层字典列表(!=
* @param sysDictInfo
* @return
*/
List<SysDictInfo> findTopDictListN(SysDictInfo sysDictInfo);
/**
* 查询所有字典列表(含条件查询(==)
* 查询所有符合条件的字典列表
* @param sysDictInfo
* @return
*/
List<SysDictInfo> findAllSysDictInfo(@Param("sysDictInfo")SysDictInfo sysDictInfo,@Param("orderBy")String orderBy);
/**
* 查询所有字典列表(含条件查询(!=)
* @param sysDictInfo
* @return
*/
List<SysDictInfo> findAllSysDictInfoN(@Param("sysDictInfo")SysDictInfo sysDictInfo,@Param("orderBy")String orderBy);
/**
* 查出所有有效数据
* @param sysDictInfo

View File

@@ -50,7 +50,7 @@
LEFT JOIN sys_dict_info p ON p.sys_dict_id = s.parent_id
</sql>
<!-- 查出所有 -->
<!-- 查出所有 有效数据-->
<select id="findAllDictList" resultType="sysDictInfo">
SELECT
<include refid="sysDictInfoColumns"/>
@@ -59,10 +59,16 @@
WHERE s.is_valid =1
</select>
<!-- 查询顶层分页(==) -->
<!-- 查询顶层分页 -->
<select id="findTopDictList" resultMap="dictResultMap" parameterType="com.nis.domain.basics.SysDictInfo">
SELECT * FROM sys_dict_info s WHERE s.is_valid=1
<if test="conditionType != null and conditionType.size()>0 " >
AND s.item_type in
<foreach collection="conditionType" item="singleType" index="index"
open="(" close=")" separator=",">
#{singleType}
</foreach>
</if>
<if test="itemCode != null and itemCode != '' " >
AND s.item_code like '%${itemCode}%'
</if>
@@ -86,6 +92,13 @@
</if>
AND s.parent_id not in (
SELECT s2.sys_dict_id FROM sys_dict_info s2 WHERE s2.is_valid=1
<if test="conditionType != null and conditionType.size()>0 " >
AND s2.item_type in
<foreach collection="conditionType" item="singleType" index="index"
open="(" close=")" separator=",">
#{singleType}
</foreach>
</if>
<if test="itemCode != null and itemCode != '' " >
AND s2.item_code like '%${itemCode}%'
</if>
@@ -119,103 +132,19 @@
</select>
<!-- 查询顶层分页(!=) -->
<select id="findTopDictListN" resultMap="dictResultMap" parameterType="com.nis.domain.basics.SysDictInfo">
SELECT * FROM sys_dict_info s WHERE s.is_valid=1
<if test="itemCode != null and itemCode != '' " >
AND s.item_code like '%${itemCode}%'
</if>
<if test="itemValue!= null and itemValue != '' " >
AND s.item_value like '%${itemValue}%'
</if>
<if test="itemType != null and itemType != '' " >
AND s.item_type != ${itemType}
</if>
<if test="beginDate !=null" >
AND s.create_time &gt;= #{beginDate,jdbcType=TIMESTAMP}
</if>
<if test="endDate !=null" >
AND s.create_time &lt;= #{endDate,jdbcType=TIMESTAMP}
</if>
<if test="editBeginDate !=null" >
AND edit_time &gt;= #{editBeginDate,jdbcType=TIMESTAMP}
</if>
<if test="editEndDate !=null" >
AND edit_time &lt;= #{editEndDate,jdbcType=TIMESTAMP}
</if>
AND s.parent_id not in (
SELECT s2.sys_dict_id FROM sys_dict_info s2 WHERE s2.is_valid=1
<if test="itemCode != null and itemCode != '' " >
AND s2.item_code like '%${itemCode}%'
</if>
<if test="itemValue!= null and itemValue != '' " >
AND s2.item_value like '%${itemValue}%'
</if>
<if test="itemType != null and itemType != '' " >
AND s2.item_type != ${itemType}
</if>
<if test="beginDate !=null" >
AND s2.create_time &gt;= #{beginDate,jdbcType=TIMESTAMP}
</if>
<if test="endDate !=null" >
AND s2.create_time &lt;= #{endDate,jdbcType=TIMESTAMP}
</if>
<if test="editBeginDate !=null" >
AND edit_time &gt;= #{editBeginDate,jdbcType=TIMESTAMP}
</if>
<if test="editEndDate !=null" >
AND edit_time &lt;= #{editEndDate,jdbcType=TIMESTAMP}
</if>
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY s.${page.orderBy}
</when>
<otherwise>
ORDER BY s.create_time desc
</otherwise>
</choose>
</select>
<!-- 查询所有(==) -->
<!-- 查询所有符合条件列表 -->
<select id="findAllSysDictInfo" resultMap="dictResultMap">
SELECT * FROM sys_dict_info WHERE is_valid=1
<if test="sysDictInfo.itemType != null and sysDictInfo.itemType != '' " >
AND item_type = ${sysDictInfo.itemType}
<if test="sysDictInfo.conditionType != null and sysDictInfo.conditionType.size()>0 " >
AND item_type in
<foreach collection="sysDictInfo.conditionType" item="singleType" index="index"
open="(" close=")" separator=",">
#{singleType}
</foreach>
</if>
<if test="sysDictInfo.itemCode != null and sysDictInfo.itemCode != '' " >
AND item_code like '%${sysDictInfo.itemCode}%'
</if>
<if test="sysDictInfo.itemValue!= null and sysDictInfo.itemValue != '' " >
AND item_value like '%${sysDictInfo.itemValue}%'
</if>
<if test="sysDictInfo.beginDate !=null" >
AND create_time &gt;= #{sysDictInfo.beginDate,jdbcType=TIMESTAMP}
</if>
<if test="sysDictInfo.endDate !=null" >
AND create_time &lt;= #{sysDictInfo.endDate,jdbcType=TIMESTAMP}
</if>
<if test="sysDictInfo.editBeginDate !=null" >
AND edit_time &gt;= #{sysDictInfo.editBeginDate,jdbcType=TIMESTAMP}
</if>
<if test="sysDictInfo.editEndDate !=null" >
AND edit_time &lt;= #{sysDictInfo.editEndDate,jdbcType=TIMESTAMP}
</if>
<choose>
<when test="orderBy != null and orderBy != ''">
ORDER BY ${orderBy}
</when>
<otherwise>
ORDER BY create_time desc
</otherwise>
</choose>
</select>
<!-- 查询所有(!=) -->
<select id="findAllSysDictInfoN" resultMap="dictResultMap">
SELECT * FROM sys_dict_info WHERE is_valid=1
<if test="sysDictInfo.itemType != null and sysDictInfo.itemType != '' " >
AND item_type = ${sysDictInfo.itemType}
@@ -247,7 +176,6 @@
</otherwise>
</choose>
</select>
<!-- 根据主键查询字典详细信息 -->
<select id="getDictById" resultType="com.nis.domain.basics.SysDictInfo">

View File

@@ -12,6 +12,8 @@ import com.nis.domain.Page;
import com.nis.domain.SysMenu;
import com.nis.domain.SysUser;
import com.nis.domain.basics.ServiceDictInfo;
import com.nis.util.ConfigDictUtils;
import com.nis.util.Configurations;
import com.nis.util.Constants;
import com.nis.util.StringUtil;
import com.nis.web.dao.basics.ServiceDictInfoDao;
@@ -30,89 +32,29 @@ public class ServiceDictInfoService extends BaseService{
* @param serviceDictInfo
* @return
*/
public Page<ServiceDictInfo> findTopDictList(Page<ServiceDictInfo> page, ServiceDictInfo serviceDictInfo,Integer[] itType) {
public Page<ServiceDictInfo> findTopDictList(Page<ServiceDictInfo> page, ServiceDictInfo serviceDictInfo,List<Integer> itType) {
// 设置分页参数
serviceDictInfo.setPage(page);
List<ServiceDictInfo> parentList = Lists.newArrayList();
Integer tempType = 0;
if(serviceDictInfo.getItemType()!=null){
tempType = serviceDictInfo.getItemType();
}
//查出顶层分页查询
if(itType.length==1){
serviceDictInfo.setItemType(itType[0]);
parentList = serviceDictInfoDao.findTopDictList(serviceDictInfo);
}
if(itType.length==2){
if(tempType!=0){
parentList = serviceDictInfoDao.findTopDictList(serviceDictInfo);
}else{
List<Integer> tempList = Lists.newArrayList();
tempList.add(1);tempList.add(2);tempList.add(3);
//Map<String,String> map = DictUtils.getDictOption("SERVICE_DICT_ITM_TYPE");
if(tempList.contains(itType[0])){
tempList.remove(itType[0]);
}
if(tempList.contains(itType[1])){
tempList.remove(itType[1]);
}
serviceDictInfo.setItemType(tempList.get(0));
parentList = serviceDictInfoDao.findTopDictListN(serviceDictInfo);
}
}
serviceDictInfo.setConditionType(itType);
List<ServiceDictInfo> parentList = serviceDictInfoDao.findTopDictList(serviceDictInfo);
ServiceDictInfo sd = new ServiceDictInfo();
sd.setServiceDictId(0);
for(ServiceDictInfo se:parentList){
se.setParent(sd);
}
if(tempType!=0){
serviceDictInfo.setItemType(tempType);
}else{
serviceDictInfo.setItemType(null);
}
page.setList(parentList);
return page;
}
/**
* 查询所有数据
* 根据条件查询所有数据
* @param serviceDictInfo
* @param itType
* @return
*/
public List<ServiceDictInfo> findAllServiceDictInfo(ServiceDictInfo serviceDictInfo,Integer[] itType,String orderBy){
List<ServiceDictInfo> list = Lists.newArrayList();
Integer tempType = 0;
if(serviceDictInfo.getItemType()!=null){
tempType = serviceDictInfo.getItemType();
}
if(itType.length==1){
serviceDictInfo.setItemType(itType[0]);
list = serviceDictInfoDao.findAllServiceDictInfo(serviceDictInfo,orderBy);
}
if(itType.length==2){
if(tempType!=0){
list = serviceDictInfoDao.findAllServiceDictInfo(serviceDictInfo,orderBy);
}else{
List<Integer> tempIntegerList = Lists.newArrayList();
tempIntegerList.add(1);tempIntegerList.add(2);tempIntegerList.add(3);
//Map<String,String> map = DictUtils.getDictOption("SERVICE_DICT_ITM_TYPE");
if(tempIntegerList.contains(itType[0])){
tempIntegerList.remove(itType[0]);
}
if(tempIntegerList.contains(itType[1])){
tempIntegerList.remove(itType[1]);
}
serviceDictInfo.setItemType(tempIntegerList.get(0));
list = serviceDictInfoDao.findAllServiceDictInfoN(serviceDictInfo,orderBy);
}
}
if(tempType!=0){
serviceDictInfo.setItemType(tempType);
}else{
serviceDictInfo.setItemType(null);
}
return list;
public List<ServiceDictInfo> findAllServiceDictInfo(ServiceDictInfo serviceDictInfo,List<Integer> itType,String orderBy){
serviceDictInfo.setConditionType(itType);;
return serviceDictInfoDao.findAllServiceDictInfo(serviceDictInfo,orderBy);
}
@@ -136,14 +78,11 @@ public class ServiceDictInfoService extends BaseService{
*/
public List<ServiceDictInfo> findAllNoLeafDictList(String itType) {
List<ServiceDictInfo> list = Lists.newArrayList();
String[] strArr = itType.split("-");
Integer[] intArr = new Integer[strArr.length];
for(int i=0;i<strArr.length;i++){
intArr[i] = Integer.valueOf(strArr[i]);
List<ServiceDictInfo> tempList = serviceDictInfoDao.findAllNoLeafDictList(intArr[i]);
for(ServiceDictInfo serviceDictInfo:tempList){
list.add(serviceDictInfo);
}
List<Integer> intArr = ConfigDictUtils.dealTypeCondition(Configurations.getStringProperty("SERVICE_DICT_ITM_TYPE", ""), itType);
for(Integer intType:intArr){
List<ServiceDictInfo> tempList = serviceDictInfoDao.findAllNoLeafDictList(intType);
list.addAll(tempList);
}
return list;
}

View File

@@ -11,6 +11,8 @@ import com.google.common.collect.Lists;
import com.nis.domain.Page;
import com.nis.domain.SysUser;
import com.nis.domain.basics.SysDictInfo;
import com.nis.util.ConfigDictUtils;
import com.nis.util.Configurations;
import com.nis.util.StringUtil;
import com.nis.web.dao.basics.SysDictInfoDao;
import com.nis.web.security.UserUtils;
@@ -25,99 +27,39 @@ public class SysDictInfoService extends BaseService{
/**
* 查询顶层分页(含条件查询,考虑排序接入可行性)
* 查询顶层分页()
* @param page
* @param sysDictInfo
* @param itType
* @return
*/
public Page<SysDictInfo> findTopDictList(Page<SysDictInfo> page, SysDictInfo sysDictInfo, Integer[] itType) {
public Page<SysDictInfo> findTopDictList(Page<SysDictInfo> page, SysDictInfo sysDictInfo, List<Integer> itType) {
// 设置分页参数
sysDictInfo.setPage(page);
//根据条件查询符合数据
List<SysDictInfo> allList = Lists.newArrayList();
Integer tempType = 0;
if(sysDictInfo.getItemType()!=null){
tempType = sysDictInfo.getItemType();
}
if(itType.length==1){
sysDictInfo.setItemType(itType[0]);
allList = sysDictInfoDao.findTopDictList(sysDictInfo);
}
if(itType.length==2){
if(tempType!=0){
allList = sysDictInfoDao.findTopDictList(sysDictInfo);
}else{
List<Integer> tempIntegerList = Lists.newArrayList();
tempIntegerList.add(1);tempIntegerList.add(2);tempIntegerList.add(3);
if(tempIntegerList.contains(itType[0])){
tempIntegerList.remove(itType[0]);
}
if(tempIntegerList.contains(itType[1])){
tempIntegerList.remove(itType[1]);
}
sysDictInfo.setItemType(tempIntegerList.get(0));
allList = sysDictInfoDao.findTopDictListN(sysDictInfo);
}
}
//allList = sysDictInfoDao.findDictTopSearchList(sysDictInfo);
if(tempType!=0){
sysDictInfo.setItemType(tempType);
}else{
sysDictInfo.setItemType(null);
}
sysDictInfo.setConditionType(itType);
List<SysDictInfo> allList = sysDictInfoDao.findTopDictList(sysDictInfo);
SysDictInfo tempSe = new SysDictInfo();
tempSe.setSysDictId(0);
for(SysDictInfo se:allList){
se.setParent(tempSe);
}
page.setList(allList);
return page;
}
/**
* 查询所有数据
* 根据条件查询所有数据
* @param page
* @param sysDictInfo
* @param intArr
* @return
*/
public List<SysDictInfo> findAllSysDictInfo(SysDictInfo sysDictInfo, Integer[] itType,String orderBy) {
public List<SysDictInfo> findAllSysDictInfo(SysDictInfo sysDictInfo, List<Integer> itType,String orderBy) {
List<SysDictInfo> list = Lists.newArrayList();
Integer tempType = 0;
if(sysDictInfo.getItemType()!=null){
tempType = sysDictInfo.getItemType();
}
if(itType.length==1){
sysDictInfo.setItemType(itType[0]);
list = sysDictInfoDao.findAllSysDictInfo(sysDictInfo,orderBy);
}
if(itType.length==2){
if(tempType!=0){
list = sysDictInfoDao.findAllSysDictInfo(sysDictInfo,orderBy);
}else{
List<Integer> tempIntegerList = Lists.newArrayList();
tempIntegerList.add(1);tempIntegerList.add(2);tempIntegerList.add(3);
if(tempIntegerList.contains(itType[0])){
tempIntegerList.remove(itType[0]);
}
if(tempIntegerList.contains(itType[1])){
tempIntegerList.remove(itType[1]);
}
sysDictInfo.setItemType(tempIntegerList.get(0));
list = sysDictInfoDao.findAllSysDictInfoN(sysDictInfo,orderBy);
}
}
if(tempType!=0){
sysDictInfo.setItemType(tempType);
}else{
sysDictInfo.setItemType(null);
}
return list;
sysDictInfo.setConditionType(itType);
return sysDictInfoDao.findAllSysDictInfo(sysDictInfo,orderBy);
}
@@ -244,14 +186,10 @@ public class SysDictInfoService extends BaseService{
*/
public List<SysDictInfo> findAllNoLeafDictList(String itType) {
List<SysDictInfo> list = Lists.newArrayList();
String[] strArr = itType.split("-");
Integer[] intArr = new Integer[strArr.length];
for(int i=0;i<strArr.length;i++){
intArr[i] = Integer.valueOf(strArr[i]);
List<SysDictInfo> tempList = sysDictInfoDao.findAllNoLeafDictList(intArr[i]);
for(SysDictInfo sysDictInfo:tempList){
list.add(sysDictInfo);
}
List<Integer> intArr = ConfigDictUtils.dealTypeCondition(Configurations.getStringProperty("SYS_DICT_ITM_TYPE", ""), itType);
for(Integer intType:intArr){
List<SysDictInfo> tempList = sysDictInfoDao.findAllNoLeafDictList(intType);
list.addAll(tempList);
}
return list;
}

View File

@@ -235,7 +235,11 @@ jdbc.hive.AName=xa_dfbhit_hive
jdbc.hive.BName=xa_z2_mesalog_hive
maxPageSize=100000
#允许配置最大层级
#\u5141\u8bb8\u914d\u7f6e\u6700\u5927\u5c42\u7ea7
maxLevelNo=4
#上下级显示间隔标识符
#\u4e0a\u4e0b\u7ea7\u663e\u793a\u95f4\u9694\u6807\u8bc6\u7b26
childrenMark=.
#\u4e1a\u52a1\u5b57\u5178\u5728\u8bcd\u5178\u4e2d\u7684\u6807\u8bc6
SERVICE_DICT_ITM_TYPE=SERVICE_DICT_ITM_TYPE
#\u7cfb\u7edf\u5b57\u5178\u5728\u8bcd\u5178\u4e2d\u7684\u6807\u8bc6
SYS_DICT_ITM_TYPE=SYS_DICT_ITM_TYPE

View File

@@ -4,7 +4,7 @@
<head>
<link rel="stylesheet" type="text/css" href="${ctxStatic}/pages/css/dictInfo.css" />
<script type="text/javascript" src="${ctxStatic}/pages/scripts/dict.js"></script>
<title>配置管理</title>
<title></title>
<script type="text/javascript">
//上级选择数据类型自动改变
function serviceDictInfoTreeselectCallBack(){
@@ -16,10 +16,10 @@
url:'${ctx}/basics/serviceDictInfo/ajaxItemType',
data:{parent:parent},
success:function(data){
$("#itemType option").each(function(){
$(this).attr("selected",false);
});
$("#itemType").find("option[value='"+data+"']").attr("selected",true);
$("#itemTypeCheckChild").val(data);
if(data==0){
$("#itemTypeCheckChild").prop("selectedIndex",0);
}
}
});
@@ -46,51 +46,22 @@
}
$(document).ready(function() {
$("#serviceDictInfoId").on('onchange',errorShow);
//层级校验
/* jQuery.validator.addMethod("isLevelNoSure",function(value,element){
var flagIsLevelNoSure = false;
$.ajax({
type:'post',
async:false,
url:'${ctx}/basics/serviceDictInfo/isLevelTotalSure',
data:{parentId:$(".singleClass").val(),currentId:'${serviceDictInfo.serviceDictId}'},
success:function(data){
flagIsLevelNoSure = data;
}
});
return flagIsLevelNoSure;
},"选择此配置上下层级数将超过最大层级"); */
//类型选择与上级是否冲突
jQuery.validator.addMethod("typeSame",function(value,element){
var flagTypeSame=false;
var parentCondition = $("#serviceDictInfoId").val();
var childCondition = $("#itemTypeCheckChild option:selected").val();
$.ajax({
type:'post',
async:false,
url:'${ctx}/basics/serviceDictInfo/ajaxType',
data:{parent:$("#serviceDictInfoId").val(),child:$("#itemTypeCheckChild option:selected").val()},
data:{parent:parentCondition,child:childCondition},
success:function(data){
flagTypeSame=data;
}
});
return flagTypeSame;
},"请选择正确的数据类型");
//校验更改数据类型后校验数据类型是否与下级冲突
jQuery.validator.addMethod("typeChild",function(value,element){
var flagTypeChild=false;
$.ajax({
type:'post',
async:false,
url:'${ctx}/basics/serviceDictInfo/ajaxChildrenType',
data:{parent:"${serviceDictInfo.serviceDictId}",newItemType:$("#itemTypeCheckChild option:selected").val()},
success:function(data){
flagTypeChild=data;
}
});
return flagTypeChild;
},"该配置包含下级配置,数据类型更改后上下级类型不一致");
//校验叶子节点有下级不得更改为叶子节点
jQuery.validator.addMethod("leafChange",function(value,element){
var flagLeafChange=false;
@@ -106,33 +77,10 @@
return flagLeafChange;
},"该配置包含下级配置,不得改为叶子节点");
//校验叶子节点无上级不得选为叶子节点
jQuery.validator.addMethod("leafHasTree",function(value,element){
var flagLeafHasTree=false;
$.ajax({
type:'post',
async:false,
url:'${ctx}/basics/serviceDictInfo/ajaxLeafHasTree',
data:{serviceDictId:"${serviceDictInfo.serviceDictId}",newIsLeaf:$("#isLeaf option:selected").val(),parentId:$("#serviceDictInfoId").val()},
success:function(data){
flagLeafHasTree=data;
}
});
return flagLeafHasTree;
},"该配置上级为根节点,不得设为叶子节点");
$("#name").focus();
$("#inputForm").validate({
//ignore:[],
//需验证 item_code item_value
rules: {
/* 'parent.itemValue':{
isLevelNoSure:true
}, */
'itemCode':{
//isLevelNoSure:true,
required:true,
remote:'${ctx}/basics/serviceDictInfo/isItemCodeRepeat?oldItemCode=${serviceDictInfo.itemCode}',
maxlength:64
@@ -142,12 +90,11 @@
maxlength:64
},
'itemType':{
typeSame:true,
typeChild:true
remote:'${ctx}/basics/serviceDictInfo/ajaxChildrenType?parent=${serviceDictInfo.serviceDictId}',
typeSame:true
},
'isLeaf':{
leafChange:true
//leafHasTree:true
},
'itemDesc':{
maxlength:128
@@ -155,11 +102,7 @@
},
messages: {
/* 'parent.itemValue':{
isLevelNoSure:'<spring:message code="isLevelNoSure"/>'
}, */
'itemCode':{
//isLevelNoSure:"选择此配置上下层级数将超过四级",
required:'<spring:message code="required"/>',
remote:'<spring:message code="repeat"/>',
maxlength:'<spring:message code="maxlength_64"/>'
@@ -169,12 +112,11 @@
maxlength:'<spring:message code="maxlength_64"/>'
},
'itemType':{
typeSame:'<spring:message code="typeSame"/>',
typeChild:'<spring:message code="typeChild"/>'
remote:'<spring:message code="typeChild"/>',
typeSame:'<spring:message code="typeSame"/>'
},
'isLeaf':{
leafChange:'<spring:message code="leafChange"/>'
//leafHasTree:'该配置上级为根节点,不得设为叶子节点'
},
'itemDesc':{
maxlength:'<spring:message code="maxlength_128"/>'

View File

@@ -2,7 +2,7 @@
<%@ include file="/WEB-INF/include/taglib.jsp"%>
<html>
<head>
<title>配置信息</title>
<title></title>
<link href="${ctxStatic}/global/plugins/treeTable/themes/vsStyle/treeTable.min.css" rel="stylesheet" type="text/css" />
<script src="${ctxStatic}/global/plugins/treeTable/jquery.treeTable.min.js" type="text/javascript"></script>
<script src="${ctxStatic}/pages/scripts/dict.js" type="text/javascript"></script>
@@ -78,6 +78,7 @@
$("#resetBtn").on("click",function(){
$(".Wdate").attr("value",'');
$("#searchForm")[0].reset();
$("#itemType").val("");
});
//筛选功能初始化
@@ -109,16 +110,14 @@
<div class="theme-panel hidden-xs hidden-sm">
<button type="button" class="btn btn-default" onclick="javascript:window.location='${ctx}/basics/serviceDictInfo/list?itType=${itType}'"><spring:message code="refresh"></spring:message></button>
<shiro:hasPermission name="basics:${permission_type}:edit">
<button type="button" class="btn btn-primary"
onClick="javascript:window.location='${ctx}/basics/serviceDictInfo/form?itType=${itType}'">
<i class="fa fa-plus"></i>
<spring:message code="add"></spring:message>
</button>
<button type="button" class="btn btn-primary" onClick="javascript:window.location='${ctx}/basics/serviceDictInfo/form?itType=${itType}'"><i class="fa fa-plus"></i><spring:message code="add"></spring:message></button>
</shiro:hasPermission>
</div>
<h3 class="page-title">
<spring:message code="${fns:getItemTypeByNo('SERVICE_DICT_ITM_TYPE',intArr)}"/>
<c:forEach items="${fns:getItemTypeByNo('SERVICE_DICT_ITM_TYPE',intArr)}" var="shows">
<spring:message code="${shows}" />
</c:forEach>
<small><spring:message code="date_list"/></small>
</h3>
@@ -139,6 +138,23 @@
<sys:tableSort id="orderBy" name="orderBy" value="${page.orderBy}" callback="page();"/>
<!-- 搜索内容与操作按钮栏 -->
<div class="col-md-12">
<c:if test="${intArr.size()>1}">
<div class="pull-left">
<div class="input-group">
<div class="input-group-btn">
<form:select path="itemType" class="selectpicker select2 input-small">
<form:option value=""><spring:message code="item_type"/></form:option>
<c:forEach items="${fns:getDictList('SERVICE_DICT_ITM_TYPE')}" var="dict">
<c:forEach items="${intArr}" var="itTemp">
<c:if test="${dict.itemCode eq itTemp}">
<form:option value="${dict.itemCode}" ><spring:message code="${dict.itemValue}"/></form:option>
</c:if>
</c:forEach>
</c:forEach>
</form:select>
</div></div>
</div>
</c:if>
<div class="pull-left">
<div class="input-group">
<div class="input-group-btn">
@@ -169,8 +185,6 @@
<i class="fa fa-trash"></i><spring:message code="delete" /></button>
</shiro:hasPermission>
<a class="btn btn-icon-only btn-default setfields tooltips"
data-container="body" data-placement="top" data-original-title="<spring:message code="custom_columns" />" href="javascript:;">
<i class="icon-wrench"></i>

View File

@@ -16,57 +16,31 @@
url:'${ctx}/basics/sysDictInfo/ajaxItemType',
data:{parent:parent},
success:function(data){
$("#itemType option").each(function(){
$(this).attr("selected",false);
});
$("#itemType").find("option[value='"+data+"']").attr("selected",true);
$("#itemType").val(data);
if(data==0){
$("#itemType").prop("selectedIndex",0);
}
}
});
}
$(document).ready(function() {
//类型选择与上级是否冲突
jQuery.validator.addMethod("typeSame",function(value,element){
var parentCondition = $("#sysDictInfoId").val();
var childCondition = $("#itemType option:selected").val();
var flag=false;
$.ajax({
type:'post',
async:false,
url:'${ctx}/basics/sysDictInfo/ajaxType',
data:{parent:$("#sysDictInfoId").val(),child:$("#itemType option:selected").val()},
data:{parent:parentCondition,child:childCondition},
success:function(data){
flag=data;
}
});
return flag;
},"请选择正确的数据类型");
//选择此配置上下层级数将超过四级
jQuery.validator.addMethod("isLevelNoSure",function(value,element){
var flag=false;
$.ajax({
type:'post',
async:false,
url:'${ctx}/basics/sysDictInfo/isLevelTotalSure',
data:{parentId:$(".singleClass").val(),currentId:'${sysDictInfo.sysDictId}'},
success:function(data){
flag=data;
}
});
return flag;
},"选择此配置上下层级数将超过最大层级");
//校验更改数据类型后校验数据类型是否与下级冲突
jQuery.validator.addMethod("typeChild",function(value,element){
var flag=false;
$.ajax({
type:'post',
async:false,
url:'${ctx}/basics/sysDictInfo/ajaxChildrenType',
data:{parent:"${sysDictInfo.sysDictId}",newItemType:$("#itemType option:selected").val()},
success:function(data){
flag=data;
}
});
return flag;
},"该配置包含下级配置,数据类型更改后上下级类型不一致");
//校验叶子节点有下级不得更改为叶子节点
jQuery.validator.addMethod("leafChange",function(value,element){
var flag=false;
@@ -82,30 +56,9 @@
return flag;
},"该配置包含下级配置,不得改为叶子节点");
//校验叶子节点无上级不得选为叶子节点
jQuery.validator.addMethod("leafHasTree",function(value,element){
var flag=false;
$.ajax({
type:'post',
async:false,
url:'${ctx}/basics/sysDictInfo/ajaxLeafHasTree',
data:{sysDictId:"${sysDictInfo.sysDictId}",newIsLeaf:$("#isLeaf option:selected").val(),parentId:$("#sysDictInfoId").val()},
success:function(data){
flag=data;
}
});
return flag;
},"该配置上级为根节点,不得设为叶子节点");
$("#name").focus();
$("#inputForm").validate({
//需验证 item_code item_value
rules: {
'parent.itemValue':{
isLevelNoSure:true
},
'itemCode':{
required:true,
remote:'${ctx}/basics/sysDictInfo/isItemCodeRepeat?oldItemCode=${sysDictInfo.itemCode}',
@@ -116,12 +69,11 @@
maxlength:64
},
'itemType':{
typeSame:true,
typeChild:true
remote:'${ctx}/basics/sysDictInfo/ajaxChildrenType?parent=${sysDictInfo.sysDictId}',
typeSame:true
},
'isLeaf':{
leafChange:true
//leafHasTree:true
},
'itemDesc':{
maxlength:128
@@ -129,9 +81,6 @@
},
messages: {
'parent.itemValue':{
isLevelNoSure:'<spring:message code="isLevelNoSure"/>'
},
'itemCode':{
required:'<spring:message code="required"/>',
remote:'<spring:message code="repeat"/>',
@@ -142,12 +91,11 @@
maxlength:'<spring:message code="maxlength_64"/>'
},
'itemType':{
typeSame:'<spring:message code="typeSame"/>',
typeChild:'<spring:message code="typeChild"/>'
remote:'<spring:message code="typeChild"/>',
typeSame:'<spring:message code="typeSame"/>'
},
'isLeaf':{
leafChange:'<spring:message code="leafChange"/>'
//leafHasTree:'该配置上级为根节点,不得设为叶子节点'
},
'itemDesc':{
maxlength:'<spring:message code="maxlength_128"/>'
@@ -185,7 +133,7 @@
<h3 class="page-title">
<spring:message code="effect_range"/>
<spring:message code="configuration_manage"/>
</h3>
<div class="row">
@@ -211,7 +159,7 @@
<form:form id="inputForm" modelAttribute="sysDictInfo" action="${ctx}/basics/sysDictInfo/saveOrUpdate?itType=${itType}" method="post" class="form-horizontal">
<form:hidden path="sysDictId"/>
<sys:message content="${message}"/>
<c:if test="${specType != null and specType!=3 }">
<c:if test="${specType == null or specType!=3 }">
<div class="form-group">
<label class="col-md-3 control-label"><spring:message code="superior_config"/>:</label>
<div class="col-md-4">
@@ -250,7 +198,7 @@
<c:if test="${specType != null and specType==3 }">
<form:hidden path="isLeaf" value="1"/>
</c:if>
<c:if test="${specType != null and specType!=3 }">
<c:if test="${specType == null or specType!=3}">
<div class="form-group">
<label class="col-md-3 control-label"><font color="red">*</font><spring:message code="is_leaf"/>:</label>
<div class="col-md-4">

View File

@@ -38,7 +38,7 @@
<form:form id="inputForm" modelAttribute="sysDictInfo" action="${ctx}/basics/sysDictInfo/saveOrUpdate" method="post" class="form-horizontal">
<form:hidden path="sysDictId"/>
<sys:message content="${message}"/>
<c:if test="${specType != null and specType!=3 }">
<c:if test="${specType == null or specType!=3 }">
<div class="form-group">
<label class="col-md-3 control-label"><font color="red">*</font><spring:message code="superior_config"/>:</label>
<div class="col-md-4">
@@ -71,7 +71,7 @@
<input value="${sysDictInfo.itemValue}" maxlength="50" class="form-control" readonly="readonly"/>
</div>
</div>
<c:if test="${specType != null and specType!=3 }">
<c:if test="${specType == null or specType!=3 }">
<div class="form-group">
<label class="col-md-3 control-label"><font color="red">*</font><spring:message code="is_leaf"/>:</label>
<div class="col-md-4">

View File

@@ -2,7 +2,7 @@
<%@ include file="/WEB-INF/include/taglib.jsp"%>
<html>
<head>
<title>配置信息</title>
<title></title>
<link href="${ctxStatic}/global/plugins/treeTable/themes/vsStyle/treeTable.min.css" rel="stylesheet" type="text/css" />
<script src="${ctxStatic}/global/plugins/treeTable/jquery.treeTable.min.js" type="text/javascript"></script>
<script src="${ctxStatic}/pages/scripts/dict.js" type="text/javascript"></script>
@@ -81,6 +81,7 @@
$("#resetBtn").on("click",function(){
$(".Wdate").attr("value",'');
$("#searchForm")[0].reset();
$("#itemType").val("");
});
//筛选功能初始化
@@ -119,7 +120,9 @@
</div>
<h3 class="page-title">
<spring:message code="${fns:getItemTypeByNo('SYS_DICT_ITM_TYPE',intArr)}"/>
<c:forEach items="${fns:getItemTypeByNo('SYS_DICT_ITM_TYPE',intArr)}" var="shows">
<spring:message code="${shows}" />
</c:forEach>
<small><spring:message code="date_list"/></small>
</h3>
@@ -140,6 +143,26 @@
<sys:tableSort id="orderBy" name="orderBy" value="${page.orderBy}" callback="page();"/>
<!-- 搜索内容与操作按钮栏 -->
<div class="col-md-12">
<c:if test="${intArr.size()>1}">
<div class="pull-left">
<div class="input-group">
<div class="input-group-btn">
<form:select path="itemType" class="selectpicker select2 input-small">
<form:option value=""><spring:message code="item_type"/></form:option>
<c:forEach items="${fns:getDictList('SYS_DICT_ITM_TYPE')}" var="dict">
<c:forEach items="${intArr}" var="itTemp">
<c:if test="${dict.itemCode eq itTemp}">
<form:option value="${dict.itemCode}" ><spring:message code="${dict.itemValue}"/></form:option>
</c:if>
</c:forEach>
</c:forEach>
</form:select>
</div></div>
</div>
</c:if>
<div class="pull-left">
<div class="input-group">
<div class="input-group-btn">
@@ -166,11 +189,13 @@
<i class="fa fa-edit"></i> <spring:message code="edit"/> </button>
<button type="button" class="btn btn-default" onclick="cmd('${ctx}/basics/sysDictInfo/delete?itType=${itType}')">
<i class="fa fa-trash"></i> <spring:message code="delete"/> </button>
</shiro:hasPermission>
<a class="btn btn-icon-only btn-default setfields tooltips"
data-container="body" data-placement="top" data-original-title="<spring:message code="custom_columns" />" href="javascript:;">
<i class="icon-wrench"></i>
</a>
</shiro:hasPermission>
</div>
</div>
<!-- /搜索内容与操作按钮栏-->
@@ -257,7 +282,7 @@
<th><spring:message code="config_content"/></th>
<th><spring:message code="desc"/></th>
<th><spring:message code="item_type"/></th>
<c:if test="${specType != null and specType!=3 }">
<c:if test="${specType == null or specType!=3 }">
<th><spring:message code="is_leaf"/></th>
</c:if>
<th><spring:message code="creator"/></th>
@@ -276,7 +301,7 @@
<td>${sysDictInfo.itemValue}</td>
<td title="${sysDictInfo.itemDesc}">${fns:abbr(sysDictInfo.itemDesc,15)}</td>
<td><spring:message code='${fns:getDictLabel("SYS_DICT_ITM_TYPE",sysDictInfo.itemType,"0")}'/></td>
<c:if test="${specType != null and specType!=3 }">
<c:if test="${specType == null or specType!=3 }">
<td><spring:message code='${fns:getDictLabel("INT_YES_NO",sysDictInfo.isLeaf,"0")}'/></td>
</c:if>
<td><c:if test="${sysDictInfo.sysDictCreator != null}">

View File

@@ -43,7 +43,7 @@
if(mulitId!=""){
confirmx("<spring:message code='confirm_message'/>", url+"?mulitId="+mulitId);
}else{
alert("<spring:message code='one_more'/>");
top.$.jBox.tip("<spring:message code='check_one'/>", "<spring:message code='info'/>");
}
}
//修改

View File

@@ -226,10 +226,7 @@ function selectP(){
<div class="portlet-title">
<div class="caption">
<i class="fa fa-gift"></i>
<shiro:hasPermission name="sys:menu:edit">${not empty specificServiceHostCfg.hostId?'修改':'添加'}</shiro:hasPermission>
<shiro:lacksPermission name="sys:menu:edit">
<spring:message code="show" />
</shiro:lacksPermission>
<c:if test="${not empty specificServiceHostCfg.hostId}"><spring:message code='edit'/></c:if><c:if test="${empty specificServiceHostCfg.hostId}"><spring:message code='add'/></c:if></div>
</div>
<div class="tools"></div>
</div>