基础管理

This commit is contained in:
jjLv 2024-07-25 15:40:17 +08:00
parent 58abac89e1
commit 4bf5a2ce74
13 changed files with 203 additions and 160 deletions

View File

@ -46,7 +46,7 @@ public class CustomController {
@PostMapping(value = "getList")
@DecryptAndVerify(decryptedClass = BaseCustom.class)//加解密统一管理
@LogAnnotation(operModul = "基础管理-客户管理", operation = "查询列表", operDesc = "系统级事件",operType="查询")
@LogAnnotation(operModul = "基础管理-单位管理", operation = "查询单位列表", operDesc = "系统级事件",operType="查询")
@PreAuthorize("@pms.hasPermission('base:custom:query')" )
public ServerResponse listCustoms(EncryptedReq<BaseCustom> data) {
PageHelper.startPage(data.getData().getPage(), data.getData().getLimit());
@ -68,25 +68,18 @@ public class CustomController {
return customService.getCustomId(data.getData());
}
// @PostMapping(value = "addCustom")
// @DecryptAndVerify(decryptedClass = BaseCustom.class)//加解密统一管理
// @LogAnnotation(operModul = "系统管理-任务管理", operation = "新增任务", operDesc = "业务级事件",operType="新增")
// @PreAuthorize("@pms.hasPermission('sys:task:update')")
// public ServerResponse addCustom(EncryptedReq<BaseCustom> data) {
// return customService.addCustom(data.getData());
// }
@PostMapping(value = "updateCustom")
@DecryptAndVerify(decryptedClass = BaseCustom.class)//加解密统一管理
@LogAnnotation(operModul = "基础管理-客户管理", operation = "修改客户", operDesc = "系统级事件",operType="修改")
@LogAnnotation(operModul = "基础管理-客户管理", operation = "修改单位客户", operDesc = "系统级事件",operType="修改")
@PreAuthorize("@pms.hasPermission('base:custom:add')")
public ServerResponse updateCustom(EncryptedReq<BaseCustom> data) {
try {
// int status = data.getData().getCustomStatus();
BaseCustom u = customService.getCustom(data.getData().getCustomName(),data.getData().getCustomId());
if (u != null) {
return ServerResponse.createErroe("客户名称 “"+data.getData().getCustomName() + "” 已存在");
return ServerResponse.createErroe("单位客户名称 “"+data.getData().getCustomName() + "” 已存在");
}
// if(StringHelper.isNotEmpty(data.getData().getCustomPhone())){
// BaseCustom u2 = customService.getCustomPhone(data.getData().getCustomPhone(),data.getData().getCustomId());
@ -110,7 +103,7 @@ public class CustomController {
try {
BaseCustom u = customService.getAdd(data.getData().getCustomName());
if (u != null) {
return ServerResponse.createErroe("客户名称 “"+data.getData().getCustomName() + "” 已存在");
return ServerResponse.createErroe("单位客户名称 “"+data.getData().getCustomName() + "” 已存在");
}
customService.add(data.getData());
Long id = customService.getCustomNewId(data.getData().getCustomName());
@ -129,9 +122,9 @@ public class CustomController {
public ServerResponse delCustom(EncryptedReq<BaseCustom> data) {
try {
if (customService.delCustom(data.getData().getCustomId())== 1){
return ServerResponse.createBySuccessMsg("注销成功");
return ServerResponse.createBySuccessMsg("删除成功");
}else {
return ServerResponse.createErroe("注销失败");
return ServerResponse.createErroe("删除失败");
}
}catch (Exception e){
log.error(e.toString(),e);
@ -171,9 +164,9 @@ public class CustomController {
@PreAuthorize("@pms.hasPermission('base:custom:add')")
public ServerResponse addDeptCustom(EncryptedReq<BaseCustom> data) {
try {
BaseCustom u = customService.getAddDept(data.getData().getCustomId(),data.getData().getCustomName());
BaseCustom u = customService.getAddDept(data.getData());
if (u != null) {
return ServerResponse.createErroe("客户名称 “"+data.getData().getCustomName() + "” 已存在");
return ServerResponse.createErroe("部门客户名称 “"+data.getData().getCustomName() + "” 已存在");
}
customService.addDept(data.getData());
return ServerResponse.createBySuccessMsg("添加成功");
@ -182,4 +175,38 @@ public class CustomController {
}
return ServerResponse.createErroe("添加失败");
}
@PostMapping(value = "getListDept")
@DecryptAndVerify(decryptedClass = BaseCustom.class)//加解密统一管理
@LogAnnotation(operModul = "基础管理-部门管理", operation = "查询部门列表", operDesc = "系统级事件",operType="查询")
@PreAuthorize("@pms.hasPermission('base:custom:query')" )
public ServerResponse listCustomsDept(EncryptedReq<BaseCustom> data) {
PageHelper.startPage(data.getData().getPage(), data.getData().getLimit());
try {
List<BaseCustom> list = customService.listDept(data.getData());
PageInfo<BaseCustom> pageInfo = new PageInfo<>(list);
return ServerResponse.createSuccessPage(pageInfo,data.getData().getPage(),data.getData().getLimit());
} catch (Exception e) {
log.error(e.toString(),e);
}
return ServerResponse.createErrorPage(data.getData().getPage(),data.getData().getLimit());
}
@PostMapping(value = "updateDeptCustom")
@DecryptAndVerify(decryptedClass = BaseCustom.class)//加解密统一管理
@LogAnnotation(operModul = "基础管理-部门管理", operation = "修改部门客户", operDesc = "系统级事件",operType="修改")
@PreAuthorize("@pms.hasPermission('base:custom:add')")
public ServerResponse updateDeptCustom(EncryptedReq<BaseCustom> data) {
try {
BaseCustom u = customService.getDeptCustom(data.getData().getCustomName(),data.getData().getCustomId());
if (u != null) {
return ServerResponse.createErroe("部门客户名称 “"+data.getData().getCustomName() + "” 已存在");
}
customService.updateCustom(data.getData());
return ServerResponse.createBySuccessMsg("操作成功");
}catch (Exception e){
log.error(e.toString(),e);
}
return ServerResponse.createErroe("操作失败");
}
}

View File

@ -13,10 +13,25 @@ public interface CustomDao {
List<BaseCustom> list(BaseCustom custom);
/**
* 查找部门列表
* @param custom
* @return
*/
List<BaseCustom> listDept(BaseCustom custom);
BaseCustom getCustomId(BaseCustom custom);
BaseCustom getCustom(String customName,Long customId);
/**
* 查询该条部门客户信息
* @param customName
* @param customId
* @return
*/
BaseCustom getDeptCustom(String customName,Long customId);
BaseCustom getCustomPid(int pId,Long customId);
BaseCustom getCustomPhone(String customPhone,Long customId);
@ -25,7 +40,7 @@ public interface CustomDao {
BaseCustom getAdd(String customName);
BaseCustom getAddDept(Long customId, String customName);
BaseCustom getAddDept(BaseCustom data);
int add(BaseCustom custom);

View File

@ -14,10 +14,25 @@ public interface CustomService {
List<BaseCustom> list(BaseCustom custom);
/**
* 查找部门列表
* @param custom
* @return
*/
List<BaseCustom> listDept(BaseCustom custom);
ServerResponse getCustomId(BaseCustom custom);
BaseCustom getCustom(String customName,Long customId);
/**
* 查询该条部门客户信息
* @param customName
* @param customId
* @return
*/
BaseCustom getDeptCustom(String customName,Long customId);
BaseCustom getCustomPid(int pId,Long customId);
BaseCustom getCustomPhone(String customPhone,Long customId);
@ -36,7 +51,7 @@ public interface CustomService {
List<BaseCustom> customList(String name);
BaseCustom getAddDept(Long customId, String customName);
BaseCustom getAddDept(BaseCustom data);
Long getCustomNewId(String customName);

View File

@ -31,6 +31,16 @@ public class CustomServiceImpl implements CustomService {
return customDao.list(custom);
}
/**
* 查找部门列表
* @param custom
* @return
*/
@Override
public List<BaseCustom> listDept(BaseCustom custom) {
return customDao.listDept(custom);
}
@Override
public ServerResponse getCustomId(BaseCustom custom) {
try{
@ -51,6 +61,22 @@ public class CustomServiceImpl implements CustomService {
return null;
}
/**
* 查询该条部门客户信息
* @param customName
* @param customId
* @return
*/
@Override
public BaseCustom getDeptCustom(String customName,Long customId) {
try{
return customDao.getDeptCustom(customName,customId);
}catch (Exception e){
log.error(e.toString(),e);
}
return null;
}
@Override
public BaseCustom getCustomPid(int pId,Long customId) {
try{
@ -91,9 +117,9 @@ public class CustomServiceImpl implements CustomService {
}
@Override
public BaseCustom getAddDept(Long customId,String customName) {
public BaseCustom getAddDept(BaseCustom data) {
try{
return customDao.getAddDept(customId,customName);
return customDao.getAddDept(data);
}catch (Exception e){
log.error(e.toString(),e);
}

View File

@ -26,6 +26,18 @@
order by id ASC
</select>
<select id="listDept" parameterType="com.bonus.aqgqj.basis.entity.vo.BaseCustom" resultMap="BaseCustomResult">
select id,custom_name,dept_id,p_id,custom_type,custom_user,custom_phone
from tb_custom
<where>
del_flag = 0 and dept_id = 1 and p_id = #{pId}
<if test="customName != null and customName != ''">
and custom_name like concat('%', #{customName}, '%')
</if>
</where>
order by id ASC
</select>
<select id="getCustomId" parameterType="com.bonus.aqgqj.basis.entity.vo.BaseCustom" resultMap="BaseCustomResult">
select id,custom_name,p_id,dept_id,custom_type,custom_user,custom_phone
from tb_custom
@ -38,6 +50,12 @@
where custom_name = #{customName} and id != #{customId} and dept_id = 0
</select>
<select id="getDeptCustom" resultMap="BaseCustomResult">
select id,custom_name,custom_type,custom_user,custom_phone
from tb_custom
where custom_name = #{customName} and id != #{customId} and dept_id = 1
</select>
<select id="getCustomPid" resultMap="BaseCustomResult">
select id,custom_name,p_id,custom_type,custom_user,custom_phone
from tb_custom
@ -48,13 +66,13 @@
<select id="getAdd" resultMap="BaseCustomResult">
select id,custom_name,custom_type,custom_user,custom_phone
from tb_custom
where custom_name = #{customName} and dept_id = 0
where custom_name = #{customName} and dept_id = 0 and del_flag = 0
</select>
<select id="getAddDept" resultMap="BaseCustomResult">
select id,custom_name,custom_type,custom_user,custom_phone
from tb_custom
where custom_name = #{customName} and dept_id = 1
where custom_name = #{customName} and dept_id = 1 and p_id = #{pId} and del_flag = 0
</select>
<select id="getCustomPhone" resultMap="BaseCustomResult">
@ -83,7 +101,7 @@
<insert id="addDept" parameterType="com.bonus.aqgqj.basis.entity.vo.BaseCustom" >
insert into tb_custom(custom_name,p_id,dept_id,custom_type,custom_user,custom_phone,create_time,del_flag
)values (
#{customName},#{customId},1,#{customType},#{customUser},#{customPhone},now(),0
#{customName},#{pId},1,#{customType},#{customUser},#{customPhone},now(),0
)
</insert>

View File

@ -1,4 +1,5 @@
let form, layer, table, tableIns;
let deptPid = null
let pageNum = 1, limitSize = 10; // 默认第一页分页数量为10
layui.use(['form', 'layer', 'table', 'laydate'], function () {
form = layui.form;
@ -66,8 +67,8 @@ function initTable(dataList, limit, page) {
}
},
{field: "customId", title: "ID", unresize: true, align: "center",hide:true},
{field: "customName", title: "客户名称", unresize: true, align: "center"},
{field: "deptId", title: "组织类型", unresize: true, align: "center",
{field: "customName", title: "单位名称", unresize: true, align: "center"},
{field: "deptId", title: "组织类型", unresize: true, align: "center",hide:true,
templet: function (d) {
if (d.deptId == 0) {
return "单位";
@ -87,7 +88,7 @@ function initTable(dataList, limit, page) {
let html = '';
let del="<a class=\"layui-icon layui-icon-delete\" style='cursor:pointer;' title='删除' onclick=\"delData('" + d.customId + "')\"></a>"
let edit="<a class=\"layui-icon layui-icon-edit\" style='cursor:pointer;' title='修改' onclick=\"addData('" + d.customId + "')\"></a>";
let add="<a class=\"layui-icon layui-icon-username\" style='cursor:pointer;' title='添加部门' onclick=\"addDataTemp('" + d.customId + "')\"></a>";
let add="<a class=\"layui-icon layui-icon-username\" style='cursor:pointer;' title='部门管理' onclick=\"addDataTemp('" + d.customId + "')\"></a>";
html=edit+del+add;
return html;
}
@ -112,12 +113,14 @@ function getReqParams(page, limit, type) {
page: page + "",
limit: limit + "",
customName: $('#customName').val(),
pid:deptPid
};
} else {
obj = {
page: '1',
limit: '10',
customName: '',
pid:deptPid
};
}
console.log(obj)
@ -167,11 +170,12 @@ function addData(customId) {
function addDataTemp(customId) {
console.log()
let title = '新增部门客户'
let title = '部门管理'
let param = {
'customId': customId
'customId': customId,
'pid': customId
}
openIframe2("addOrEditFormUser", title, "customAddDeptForm.html", '800px', '500px', param);
openIframe2("addOrEditFormDept", title, "customDept.html", '100%', '100%', param);
}
/*删除用户*/
@ -228,3 +232,9 @@ function setSelectValue(list, selectName) {
$('#' + selectName).empty().append(html);
layui.form.render();
}
// function setParams(params){
// let obj = JSON.parse(params)
// console.log(obj)
// deptPid = obj.customId
// }

View File

@ -2,12 +2,10 @@ let form, layer, dtree, util, idParam, phoneParam,statusParam;
let arr = ['background', 'web', 'mobile', 'wx'];
let background, web, mobile, wx;
let data = [], appResList = [];
// 角色下拉选
let roleList;
getTeamSelected();
function setParams(params) {
idParam = JSON.parse(params).customId;
// statusParam = 0;
deptPid = JSON.parse(params).pid;
console.log(idParam)
layui.config({
base: "../../../js/layui-v2.6.8/dtree/", //此处路径请自行处理, 可以使用绝对路径
@ -19,31 +17,17 @@ function setParams(params) {
util = layui.util;
form.on('submit(formData)', function (data) {
data.field.id = $('#id').val();
// data.field.customStatus = $('#customStatus').val();
// data.field.type = !$('#id').val() ? '1' : '2';
let customPhone = $('#customPhone').val();
if(customPhone){
if (!(/^1[3456789]\d{9}$/.test(customPhone))) {
return layer.alert("请输入正确的手机号", {icon: 2})
}
}
saveData(data);
});
// form.on('switch',function(data){
// if(data.elem.checked==true){
// statusParam = 1;
// }
//
// });
form.verify(
{
required: function (value, item) {
let customPhone = $('#customPhone').val();
if(customPhone){
if (!(/^1[3456789]\d{9}$/.test(customPhone))) {
return '请输入正确的手机号';
}
}
}
},
);
// if (idParam) {
// getFormbyId();
// }
if (idParam) {
getFormbyId();
}
});
}
@ -76,12 +60,6 @@ function getFormbyId() {
function setFormData(data) {
if (data) {
form.val('formInfo',data)
// if(data.customStatus == 1){
// $("#customStatus").prop("checked", 1);
// }else{
// $("#customStatus").prop("checked", 0);
//
// }
deptId = data.deptId;
pid = data.pid
console.log(data)
@ -101,10 +79,15 @@ function saveData(data) {
let params = data.field;
params.customId = idParam;
params.pid = deptPid;
// console(params)
// params.customStatus = statusParam;
let path_url = '';
if(params.customId==null || params.customId ==''){
path_url = 'addDeptCustom';
}else{
path_url="updateDeptCustom";
}
let url = dataUrl + "/customs/" + path_url + "?token=" + tokens;
params = {
@ -165,13 +148,3 @@ function getTeamSelected() {
error(xhr)
});
}
/*下拉选表单赋值*/
// function setSelectValue(list, selectName) {
// let html = '<option value="" selected>请选择</option>';
// $.each(list, function (index, item) {
// html += '<option value="' + item.pid + '">' + item.customName + '</option>';
// })
// $('#' + selectName).empty().append(html);
// layui.form.render();
// }

View File

@ -20,27 +20,32 @@ function setParams(params) {
form.on('submit(formData)', function (data) {
data.field.id = $('#id').val();
// data.field.customStatus = $('#customStatus').val();
// data.field.type = !$('#id').val() ? '1' : '2';
// data.field.type = !$('#id').val() ? '1' : '2';
let customPhone = $('#customPhone').val();
if(customPhone){
if (!(/^1[3456789]\d{9}$/.test(customPhone))) {
return layer.alert("请输入正确的手机号", {icon: 2})
}
}
saveData(data);
});
form.on('switch',function(data){
if(data.elem.checked==true){
statusParam = 1;
}
});
form.verify(
{
required: function (value, item) {
let customPhone = $('#customPhone').val();
if(customPhone){
if (!(/^1[3456789]\d{9}$/.test(customPhone))) {
return '请输入正确的手机号';
}
}
}
},
);
// form.on('switch',function(data){
// if(data.elem.checked==true){
// statusParam = 1;
// }
// });
// form.verify(
// {
// required: function (value, item) {
// let customPhone = $('#customPhone').val();
// if(customPhone){
// if (!(/^1[3456789]\d{9}$/.test(customPhone))) {
// return '请输入正确的手机号';
// }
// }
// }
// },
// );
if (idParam) {
getFormbyId();
}

View File

@ -18,28 +18,14 @@ function setParams(params) {
util = layui.util;
form.on('submit(formData)', function (data) {
data.field.id = $('#id').val();
// data.field.customStatus = $('#customStatus').val();
// data.field.type = !$('#id').val() ? '1' : '2';
let teamLeaderPhone = $('#teamLeaderPhone').val();
if(teamLeaderPhone){
if (!(/^1[3456789]\d{9}$/.test(teamLeaderPhone))) {
return layer.alert("请输入正确的手机号", {icon: 2})
}
}
saveData(data);
});
// form.on('switch',function(data){
// if(data.elem.checked==true){
// statusParam = 1;
// }
//
// });
form.verify(
{
required: function (value, item) {
let teamLeaderPhone = $('#teamLeaderPhone').val();
if(teamLeaderPhone){
if (!(/^1[3456789]\d{9}$/.test(teamLeaderPhone))) {
return '请输入正确的手机号';
}
}
}
},
);
if (idParam) {
getFormbyId();
}

View File

@ -19,14 +19,6 @@
<form class="layui-form" onsubmit="return false;" lay-filter="formInfo">
<input hidden id="id" name="id">
<!-- <div class="layui-form-item" style="margin-top: 2%;">-->
<!-- <label class="layui-form-label"><i style="padding: 0 10px;">*</i>上级菜单</label>-->
<!-- <div class="layui-input-inline">-->
<!-- <select class="form-control input-sm" name="pid" id="pid">-->
<!-- </select>-->
<!-- </div>-->
<!-- </div>-->
<div class="layui-form-item" style="margin-top: 2%;">
<label class="layui-form-label"><i style="padding: 0 10px;">*</i>客户名称</label>
<div class="layui-input-inline">
@ -35,17 +27,6 @@
</div>
</div>
<!-- <div class="layui-form-item" style="margin-top: 2%;">-->
<!-- <label class="layui-form-label"><i style="padding: 0 10px;">*</i>组织类型</label>-->
<!-- <div class="layui-input-inline">-->
<!-- <select class="form-control input-sm" name="deptId" id="deptId">-->
<!-- <option value="0">单位</option>-->
<!-- <option value="1">部门</option>-->
<!-- </select>-->
<!-- </div>-->
<!-- </div>-->
<div class="layui-form-item" style="margin-top: 2%;">
<label class="layui-form-label"><i style="padding: 0 10px;">*</i>客户类型</label>
<div class="layui-input-inline">

View File

@ -18,15 +18,13 @@
<div id="main-box">
<form class="layui-form" onsubmit="return false;" lay-filter="formInfo">
<input hidden id="id" name="id">
<!-- <div class="layui-form-item" style="margin-top: 2%;">-->
<!-- <label class="layui-form-label"><i style="padding: 0 10px;">*</i>上级菜单</label>-->
<!-- <div class="layui-input-inline">-->
<!-- <select class="form-control input-sm" name="pid" id="pid">-->
<!-- </select>-->
<!-- </div>-->
<!-- </div>-->
<div class="layui-form-item" style="margin-top: 2%;">
<label class="layui-form-label"><i style="padding: 0 10px;">*</i>任务名称</label>
<div class="layui-input-inline">
<input class="layui-input" id="taskName" name="taskName" autocomplete="off"
lay-verify="required" maxlength="30">
</div>
</div>
<div class="layui-form-item" style="margin-top: 2%;">
<label class="layui-form-label"><i style="padding: 0 10px;">*</i>客户名称</label>
<div class="layui-input-inline">
@ -35,17 +33,6 @@
</div>
</div>
<!-- <div class="layui-form-item" style="margin-top: 2%;">-->
<!-- <label class="layui-form-label"><i style="padding: 0 10px;">*</i>组织类型</label>-->
<!-- <div class="layui-input-inline">-->
<!-- <select class="form-control input-sm" name="deptId" id="deptId">-->
<!-- <option value="0">单位</option>-->
<!-- <option value="1">部门</option>-->
<!-- </select>-->
<!-- </div>-->
<!-- </div>-->
<div class="layui-form-item" style="margin-top: 2%;">
<label class="layui-form-label"><i style="padding: 0 10px;">*</i>客户类型</label>
<div class="layui-input-inline">

View File

@ -20,7 +20,7 @@
<div class="layui-form-item">
<div class="layui-inline" style="padding: 0 0 0 10px;">
<div class="layui-input-inline">
<input type="text" id="customName" maxlength="50" class="layui-input" autocomplete="off" placeholder="请输入客户名称">
<input type="text" id="customName" maxlength="50" class="layui-input" autocomplete="off" placeholder="请输入单位名称">
</div>
</div>

View File

@ -2,15 +2,15 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="../../../../js/layui-v2.6.8/css/layui.css">
<link rel="stylesheet" href="../../../../css/table-common2.css">
<script src="../../../../js/libs/jquery-2.1.1.min.js" charset="UTF-8" type="text/javascript"></script>
<script src="../../../../js/layui-v2.6.8/layui.js" charset="UTF-8" type="text/javascript"></script>
<script src="../../../../js/publicJs.js"></script>
<script src="../../../../js/commonUtils.js"></script>
<script src="../../../../js/openIframe.js"></script>
<script src="../../../../js/my/aes.js"></script>
<script src="../../../../js/ajaxRequest.js"></script>
<link rel="stylesheet" href="../../../js/layui-v2.6.8/css/layui.css">
<link rel="stylesheet" href="../../../css/table-common2.css">
<script src="../../../js/libs/jquery-2.1.1.min.js" charset="UTF-8" type="text/javascript"></script>
<script src="../../../js/layui-v2.6.8/layui.js" charset="UTF-8" type="text/javascript"></script>
<script src="../../../js/publicJs.js"></script>
<script src="../../../js/commonUtils.js"></script>
<script src="../../../js/openIframe.js"></script>
<script src="../../../js/my/aes.js"></script>
<script src="../../../js/ajaxRequest.js"></script>
<title>试验</title>
</head>
<body>
@ -38,5 +38,5 @@
</div>
</div>
</body>
<script src="../../../../js/basis/standard/child/testList.js" charset="UTF-8" type="text/javascript"></script>
<script src="../../../js/basis/standard/child/testList.js" charset="UTF-8" type="text/javascript"></script>
</html>