系统类目编辑的问题
This commit is contained in:
parent
b651fb021a
commit
a8ea092e24
|
|
@ -59,7 +59,7 @@ spring:
|
|||
time-zone: GMT+8
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
profiles:
|
||||
active: druid
|
||||
active: dev
|
||||
# 文件上传
|
||||
servlet:
|
||||
multipart:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,137 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<head>
|
||||
<th:block th:include="include :: header('修改部门')" />
|
||||
</head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-dept-edit" th:object="${goodsCategory}">
|
||||
<input name="goodsCategoryId" type="hidden" th:field="*{goodsCategoryId}" />
|
||||
<input id="treeId" name="parentCategoryId" type="hidden" th:field="*{parentCategoryId}" />
|
||||
<!-- <div class="form-group">-->
|
||||
<!-- <label class="col-sm-3 control-label">上级部门:</label>-->
|
||||
<!-- <div class="col-sm-8">-->
|
||||
<!-- <div class="input-group">-->
|
||||
<!-- <input class="form-control" type="text" id="treeName" onclick="selectDeptTree()" readonly="true" th:field="*{parentName}">-->
|
||||
<!-- <span class="input-group-addon"><i class="fa fa-search"></i></span>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">上级类目:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<input class="form-control" type="text" onclick="selectDeptTree()" id="treeName" readonly="true" th:value="${goodsCategoryName}" required>
|
||||
<span class="input-group-addon"><i class="fa fa-search"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">类别名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="goodsCategoryName" th:field="*{goodsCategoryName}" id="goodsCategoryName" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">类别编码:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="goodsCategoryCode" th:field="*{goodsCategoryCode}" id="goodsCategoryCode" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">显示排序:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="categorySort" th:field="*{categorySort}" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">类目类别:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="radio-box" th:each="dict : ${@dict.getType('goods_category_type')}">
|
||||
<input type="radio" th:id="${dict.dictCode}" name="type" th:value="${dict.dictValue}" th:checked="${dict.default}">
|
||||
<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">类目状态:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="radio-box" th:each="dict : ${@dict.getType('sys_normal_disable')}">
|
||||
<input type="radio" th:id="${dict.dictCode}" name="status" th:value="${dict.dictValue}" th:checked="${dict.default}">
|
||||
<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<script type="text/javascript">
|
||||
var prefix = ctx + "goods/category";
|
||||
|
||||
$("#form-dept-edit").validate({
|
||||
onkeyup: false,
|
||||
rules:{
|
||||
deptName:{
|
||||
remote: {
|
||||
url: prefix + "/checkDeptNameUnique",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: {
|
||||
"parentCategoryId": function() {
|
||||
return $("input[name='parentCategoryId']").val();
|
||||
},
|
||||
"goodsCategoryName" : function() {
|
||||
return $.common.trim($("#goodsCategoryName").val());
|
||||
}
|
||||
},
|
||||
dataFilter: function(data, type) {
|
||||
return $.validate.unique(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
categorySort:{
|
||||
digits:true
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
"goodsCategoryName": {
|
||||
remote: "类目已经存在"
|
||||
}
|
||||
},
|
||||
focusCleanup: true
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/edit", $('#form-dept-edit').serialize());
|
||||
}
|
||||
}
|
||||
|
||||
/*部门管理-修改-选择部门树*/
|
||||
function selectDeptTree() {
|
||||
var treeId = $("#treeId").val();
|
||||
if ($.common.isEmpty(treeId)) {
|
||||
$.modal.alertWarning("请先添加用户所属的类目!");
|
||||
return;
|
||||
}
|
||||
var options = {
|
||||
title: '类目选择',
|
||||
width: "380",
|
||||
url: prefix + "/selectGoodsCategoryTree/" + treeId,
|
||||
callBack: doSubmit
|
||||
};
|
||||
$.modal.openOptions(options);
|
||||
}
|
||||
|
||||
function doSubmit(index, layero){
|
||||
var tree = layero.find("iframe")[0].contentWindow.$._tree;
|
||||
if ($.tree.notAllowLastLevel(tree)) {
|
||||
var body = $.modal.getChildFrame(index);
|
||||
$("#treeId").val(body.find('#treeId').val());
|
||||
$("#treeName").val(body.find('#treeName').val());
|
||||
$.modal.close(index);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -74,7 +74,7 @@ public class GoodsCategoryServiceImpl implements GoodsCategoryService {
|
|||
if (category == null) {
|
||||
return false;
|
||||
}
|
||||
return category.getGoodsCategoryId().equals(goodsCategory.getGoodsCategoryId());
|
||||
return !category.getGoodsCategoryId().equals(goodsCategory.getGoodsCategoryId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -83,7 +83,7 @@ public class GoodsCategoryServiceImpl implements GoodsCategoryService {
|
|||
if (category == null) {
|
||||
return false;
|
||||
}
|
||||
return category.getGoodsCategoryId().equals(goodsCategory.getGoodsCategoryId());
|
||||
return !category.getGoodsCategoryId().equals(goodsCategory.getGoodsCategoryId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@
|
|||
<if test="goodsCategoryCode != null and goodsCategoryCode != ''">goods_category_code = #{goodsCategoryCode},</if>
|
||||
<if test="goodsCategoryName != null and goodsCategoryName != ''">goods_category_name = #{goodsCategoryName},</if>
|
||||
<if test="parentCategoryId != null and parentCategoryId != ''">parent_category_id = #{parentCategoryId},</if>
|
||||
<if test="categorySort != null and categorySort != ''">category_sort = #{categorySort},</if>
|
||||
<if test="level != null and level != ''">level = #{level},</if>
|
||||
<if test="type != null and type != ''">type = #{type},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
|
|
@ -79,6 +80,7 @@
|
|||
<if test="goodsCategoryCode != null and goodsCategoryCode != ''">goods_category_code,</if>
|
||||
<if test="goodsCategoryName != null and goodsCategoryName != ''">goods_category_name,</if>
|
||||
<if test="parentCategoryId != null and parentCategoryId != ''">parent_category_id,</if>
|
||||
<if test="categorySort != null and categorySort != ''">category_sort,</if>
|
||||
<if test="level != null and level != ''">level,</if>
|
||||
<if test="type != null and type != ''">type,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
|
|
@ -89,6 +91,7 @@
|
|||
<if test="goodsCategoryCode != null and goodsCategoryCode != ''">#{goodsCategoryCode},</if>
|
||||
<if test="goodsCategoryName != null and goodsCategoryName != ''">#{goodsCategoryName},</if>
|
||||
<if test="parentCategoryId != null and parentCategoryId != ''">#{parentCategoryId},</if>
|
||||
<if test="categorySort != null and categorySort != ''">#{categorySort},</if>
|
||||
<if test="level != null and level != ''">#{level},</if>
|
||||
<if test="type != null and type != ''">#{type},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
|
|
|
|||
Loading…
Reference in New Issue