bug修复

This commit is contained in:
liang.chao 2025-05-29 16:45:04 +08:00
parent daa39f2b6c
commit 386973a62d
2 changed files with 158 additions and 147 deletions

View File

@ -4,7 +4,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>评价人员新增</title> <title>评价人员新增</title>
<link rel="stylesheet" href="../../../layui/css/layui.css" media="all" /> <link rel="stylesheet" href="../../../layui/css/layui.css" media="all"/>
</head> </head>
<style> <style>
.layui-form-label { .layui-form-label {
@ -34,74 +34,75 @@
<body> <body>
<div style="padding: 10px"> <div style="padding: 10px">
<form class="layui-form" action="#"> <form class="layui-form" action="#">
<div class="layui-form-item"> <div class="layui-form-item">
<!-- <div class="layui-inline"> <!-- <div class="layui-inline">
<label class="layui-form-label" style="width: 150px"><span style="color: red">*</span>企业名称:</label> <label class="layui-form-label" style="width: 150px"><span style="color: red">*</span>企业名称:</label>
<div class="layui-input-inline" style="width: 60%"> <div class="layui-input-inline" style="width: 60%">
<input type="text" lay-affix="clear" id="enterpriseName" name="enterpriseName" <input type="text" lay-affix="clear" id="enterpriseName" name="enterpriseName"
autocomplete="off" class="layui-input" lay-verify="required" maxlength="20"> autocomplete="off" class="layui-input" lay-verify="required" maxlength="20">
</div>
</div>-->
<div class="layui-form-item" style="width: 90%">
<label class="layui-form-label" style="width: 150px"><span style="color: red">*</span>身份证号码:</label>
<div class="layui-input-inline" style="width: 60%">
<input class="layui-input" id="idCard" name="idCard" lay-verify="required\|idCard"
lay-affix="clear" autocomplete="off" maxlength="18">
</div>
</div> </div>
<div class="layui-form-item" style="width: 90%"> </div>-->
<label class="layui-form-label" style="width: 150px"><span style="color: red">*</span>姓名:</label> <div class="layui-form-item" style="width: 90%">
<div class="layui-input-inline" style="width: 60%"> <label class="layui-form-label" style="width: 150px"><span
<!-- <input class="layui-input" id="userName" name="userName" lay-verify="required" style="color: red">*</span>身份证号码:</label>
lay-affix="clear" autocomplete="off" onclick="showPersonPage()" maxlength="30" readonly> --> <div class="layui-input-inline" style="width: 60%">
<input class="layui-input" id="name" name="name" lay-verify="required" lay-affix="clear" <input class="layui-input" id="idCard" name="idCard" lay-verify="required\|idCard"
autocomplete="off" maxlength="30"> lay-affix="clear" autocomplete="off" maxlength="18">
</div>
</div>
<div class="layui-form-item" style="width: 90%">
<label class="layui-form-label" style="width: 150px"><span style="color: red">*</span>性别:</label>
<div class="layui-input-inline" style="width: 60%">
<select id="sex" name="sex" class="layui-select" lay-search>
<option value="1"></option>
<option value="2"></option>
</select>
</div>
</div>
<div class="layui-form-item" style="width: 90%">
<label class="layui-form-label" style="width: 150px"><span style="color: red">*</span>联系电话:</label>
<div class="layui-input-inline" style="width: 60%">
<input class="layui-input" id="phone" name="phone" lay-verify="required\|phone"
lay-affix="clear" autocomplete="off" maxlength="11">
</div>
</div>
<div class="layui-form-item" style="width: 90%">
<label class="layui-form-label" style="width: 150px"><span style="color: red">*</span>系统角色:</label>
<div class="layui-input-inline" style="width: 60%">
<select id="roleId" name="roleId" class="layui-select" lay-filter="changeOrg" lay-search
lay-verify="required" style="height: 360px;"></select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label" style="width: 150px"><span
style="color: red">*</span>所属项目/部门:</label>
<div class="layui-input-inline" style="width: 60%">
<select id="deptId" name="deptId" class="layui-select" lay-filter="changeOrg" lay-search
lay-verify="required" style="height: 360px;" disabled></select>
</div>
</div> </div>
</div> </div>
<button type="submit" id="formSubmit" class="layui-btn formSubmit" lay-submit="" lay-filter="formSubmit" <div class="layui-form-item" style="width: 90%">
style="display: none;"></button> <label class="layui-form-label" style="width: 150px"><span style="color: red">*</span>姓名:</label>
</form> <div class="layui-input-inline" style="width: 60%">
<!-- <input class="layui-input" id="userName" name="userName" lay-verify="required"
lay-affix="clear" autocomplete="off" onclick="showPersonPage()" maxlength="30" readonly> -->
<input class="layui-input" id="name" name="name" lay-verify="required" lay-affix="clear"
autocomplete="off" maxlength="30">
</div>
</div>
<div class="layui-form-item" style="width: 90%">
<label class="layui-form-label" style="width: 150px"><span style="color: red">*</span>性别:</label>
<div class="layui-input-inline" style="width: 60%">
<select id="sex" name="sex" class="layui-select" lay-search>
<option value="1"></option>
<option value="2"></option>
</select>
</div>
</div>
<div class="layui-form-item" style="width: 90%">
<label class="layui-form-label" style="width: 150px"><span style="color: red">*</span>联系电话:</label>
<div class="layui-input-inline" style="width: 60%">
<input class="layui-input" id="phone" name="phone" lay-verify="required\|phone"
lay-affix="clear" autocomplete="off" maxlength="11">
</div>
</div>
<div class="layui-form-item" style="width: 90%">
<label class="layui-form-label" style="width: 150px"><span style="color: red">*</span>系统角色:</label>
<div class="layui-input-inline" style="width: 60%">
<select id="roleId" name="roleId" class="layui-select" lay-filter="changeRole" lay-search
lay-verify="required" style="height: 360px;"></select>
</div> </div>
</div>
<div class="layui-form-item">
<label class="layui-form-label" style="width: 150px"><span
style="color: red">*</span>所属项目/部门:</label>
<div class="layui-input-inline" style="width: 60%">
<select id="deptId" name="deptId" class="layui-select" lay-filter="changeOrg" lay-search
lay-verify="required" style="height: 360px;"></select>
</div>
</div>
</div>
<button type="submit" id="formSubmit" class="layui-btn formSubmit" lay-submit="" lay-filter="formSubmit"
style="display: none;"></button>
</form>
</div>
</body> </body>
@ -128,11 +129,7 @@
if (list && list.length > 0) { if (list && list.length > 0) {
$.each(list, function (index, item) { $.each(list, function (index, item) {
//html += "<option value='" + item[code] + "' item='" + JSON.stringify(item) + "'>" + item[nameCode] + "</option>"; //html += "<option value='" + item[code] + "' item='" + JSON.stringify(item) + "'>" + item[nameCode] + "</option>";
if (item.name === '发展运营中心'){ html += "<option value='" + item.id + "'>" + item.name + "</option>";
html += "<option value='" + item.id + "' selected>" + item.name + "</option>";
}else {
html += "<option value='" + item.id + "'>" + item.name + "</option>";
}
}); });
} }
@ -177,40 +174,49 @@
}, },
}) })
form.render(); form.render();
form.on('select(changeRole)', function (obj) {
if (obj.value == 5) {
$('#deptId').val(7); // 设置为发展运营中心
$('#deptId').attr('disabled', 'disabled');
} else {
$('#deptId').val("");
}
layui.form.render('select'); // 刷新下拉框
});
// 提交事件 // 提交事件
form.on('submit(formSubmit)', function (data) { form.on('submit(formSubmit)', function (data) {
//对身份证和手机号验证 //对身份证和手机号验证
if ($('#idCard').val() == null || $('#idCard').val() == "") { if ($('#idCard').val() == null || $('#idCard').val() == "") {
layer.msg("请输入身份证号", { icon: 2, time: 2000 }); layer.msg("请输入身份证号", {icon: 2, time: 2000});
return false; return false;
} }
if (!checkPsidno($("#idCard").val())) { if (!checkPsidno($("#idCard").val())) {
layer.msg("身份证号码格式不正确", { icon: 2, time: 2000 }); layer.msg("身份证号码格式不正确", {icon: 2, time: 2000});
return false; return false;
} }
if ($('#name').val() == null || $('#name').val() == "") { if ($('#name').val() == null || $('#name').val() == "") {
layer.msg("请输入姓名", { icon: 2, time: 2000 }); layer.msg("请输入姓名", {icon: 2, time: 2000});
return false; return false;
} }
if ($('#sex').val() == null || $('#sex').val() == "") { if ($('#sex').val() == null || $('#sex').val() == "") {
layer.msg("请选择性别", { icon: 2, time: 2000 }); layer.msg("请选择性别", {icon: 2, time: 2000});
return false; return false;
} }
if ($('#phone').val() == null || $('#phone').val() == "") { if ($('#phone').val() == null || $('#phone').val() == "") {
layer.msg("请输入手机号", { icon: 2, time: 2000 }); layer.msg("请输入手机号", {icon: 2, time: 2000});
return false; return false;
} }
if (!phone_reg($("#phone").val())) { if (!phone_reg($("#phone").val())) {
layer.msg("手机号码格式不正确", { icon: 2, time: 2000 }); layer.msg("手机号码格式不正确", {icon: 2, time: 2000});
return false; return false;
} }
if ($('#roleId').val() == null || $('#roleId').val() == "") { if ($('#roleId').val() == null || $('#roleId').val() == "") {
layer.msg("请选择角色", { icon: 2, time: 2000 }); layer.msg("请选择角色", {icon: 2, time: 2000});
return false; return false;
} }
if ($('#deptId').val() == null || $('#deptId').val() == "") { if ($('#deptId').val() == null || $('#deptId').val() == "") {
layer.msg("请选择所属部门", { icon: 2, time: 2000 }); layer.msg("请选择所属部门", {icon: 2, time: 2000});
return false; return false;
} }
@ -222,12 +228,12 @@
}, },
success: function (res) { success: function (res) {
if (res.res === 1) { if (res.res === 1) {
layer.msg('新增成功', { icon: 6 }); layer.msg('新增成功', {icon: 6});
var i = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引 var i = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
parent.searchTable(); parent.searchTable();
parent.layer.close(i); parent.layer.close(i);
} else if (res.res === 0) { } else if (res.res === 0) {
layer.msg(res.resMsg, { icon: 5 }); layer.msg(res.resMsg, {icon: 5});
} }
} }
}); });
@ -279,17 +285,17 @@
} //post请求必须加where post请求需要的参数 } //post请求必须加where post请求需要的参数
, cellMinWidth: 80, , cellMinWidth: 80,
cols: [[ //标题栏 cols: [[ //标题栏
{ type: 'checkbox', fixed: 'left' }, {type: 'checkbox', fixed: 'left'},
{ {
field: 'number', width: 80, title: '序号', align: 'center', type: 'numbers' field: 'number', width: 80, title: '序号', align: 'center', type: 'numbers'
}, },
{ field: 'idCard', title: '身份证号', align: 'center', minWidth: 180 }, {field: 'idCard', title: '身份证号', align: 'center', minWidth: 180},
{ field: 'name', title: '姓名', align: 'center', minWidth: 160 }, {field: 'name', title: '姓名', align: 'center', minWidth: 160},
{ field: 'sex', title: '性别', align: 'center', minWidth: 80 }, {field: 'sex', title: '性别', align: 'center', minWidth: 80},
{ field: 'phone', title: '联系电话', align: 'center', minWidth: 160 }, {field: 'phone', title: '联系电话', align: 'center', minWidth: 160},
{ field: 'deptName', title: '所属部门/项目', align: 'center', minWidth: 160 }, {field: 'deptName', title: '所属部门/项目', align: 'center', minWidth: 160},
{ field: 'roleName', title: '系统角色', align: 'center', minWidth: 160 }, {field: 'roleName', title: '系统角色', align: 'center', minWidth: 160},
{ field: 'createTime', title: '创建日期', align: 'center', minWidth: 160 }, {field: 'createTime', title: '创建日期', align: 'center', minWidth: 160},
]] ]]
, page: true //开启分页 , page: true //开启分页
, loading: true //数据加载中。。。 , loading: true //数据加载中。。。

View File

@ -5,67 +5,67 @@
<title>编辑人员信息</title> <title>编辑人员信息</title>
<link rel="stylesheet" href="../../../layui/css/layui.css"/> <link rel="stylesheet" href="../../../layui/css/layui.css"/>
<style> <style>
.layui-input-inline{ .layui-input-inline {
width: 80% !important; width: 80% !important;
} }
</style> </style>
</head> </head>
<body> <body>
<form class="layui-form" action="" onsubmit="return false"> <form class="layui-form" action="" onsubmit="return false">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label"><span style="color: red">*</span>姓名</label> <label class="layui-form-label"><span style="color: red">*</span>姓名</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<input type="text" name="name" id="name" maxlength="30" lay-verify="required" autocomplete="off" <input type="text" name="name" id="name" maxlength="30" lay-verify="required" autocomplete="off"
class="layui-input"> class="layui-input">
</div>
</div> </div>
<div class="layui-form-item"> </div>
<label class="layui-form-label"><span style="color: red">*</span>性别</label> <div class="layui-form-item">
<div class="layui-input-inline"> <label class="layui-form-label"><span style="color: red">*</span>性别</label>
<select class="layui-select" id="sex" name="sex" lay-verify="required"> <div class="layui-input-inline">
<option value="1"></option> <select class="layui-select" id="sex" name="sex" lay-verify="required">
<option value="0"></option> <option value="1"></option>
</select> <option value="0"></option>
</div> </select>
</div> </div>
<!-- <div class="layui-form-item"> </div>
<label class="layui-form-label"><span style="color: red">*</span>身份证号</label> <!-- <div class="layui-form-item">
<div class="layui-input-inline"> <label class="layui-form-label"><span style="color: red">*</span>身份证号</label>
<input type="text" name="idCard" id="idCard" lay-verify="required|idCard" autocomplete="off" <div class="layui-input-inline">
class="layui-input" maxlength="18"> <input type="text" name="idCard" id="idCard" lay-verify="required|idCard" autocomplete="off"
</div> class="layui-input" maxlength="18">
</div>--> </div>
<div class="layui-form-item"> </div>-->
<label class="layui-form-label"><span style="color: red">*</span>手机号</label> <div class="layui-form-item">
<div class="layui-input-inline"> <label class="layui-form-label"><span style="color: red">*</span>手机号</label>
<input type="text" name="phone" id="phone" lay-verify="required|phone" autocomplete="off" <div class="layui-input-inline">
class="layui-input" maxlength="11"> <input type="text" name="phone" id="phone" lay-verify="required|phone" autocomplete="off"
</div> class="layui-input" maxlength="11">
</div> </div>
<div class="layui-form-item"> </div>
<label class="layui-form-label"><span style="color: red">*</span>角色</label> <div class="layui-form-item">
<div class="layui-input-inline"> <label class="layui-form-label"><span style="color: red">*</span>角色</label>
<select id="roleId" style="width: 100%;" name="roleId" lay-filter="role" class="layui-select" <div class="layui-input-inline">
lay-search <select id="roleId" style="width: 100%;" name="roleId" lay-filter="role" class="layui-select"
lay-verify="required"> lay-search
</select> lay-verify="required">
</div> </select>
</div> </div>
<div class="layui-form-item"> </div>
<label class="layui-form-label"><span style="color: red">*</span>所属部门/项目</label> <div class="layui-form-item">
<div class="layui-input-inline"> <label class="layui-form-label"><span style="color: red">*</span>所属部门/项目</label>
<select id="deptId" style="width: 100%;" name="deptId" class="layui-select" lay-search <div class="layui-input-inline">
lay-verify="required"> <select id="deptId" style="width: 100%;" name="deptId" class="layui-select" lay-search
</select> lay-verify="required">
</div> </select>
</div> </div>
<div class="layui-form-item" style="display: none"> </div>
<div class="layui-input-block"> <div class="layui-form-item" style="display: none">
<button type="submit" class="layui-btn subBtn" id="commit" lay-submit lay-filter="formDemo">提交 <div class="layui-input-block">
</button> <button type="submit" class="layui-btn subBtn" id="commit" lay-submit lay-filter="formDemo">提交
</div> </button>
</div> </div>
</form> </div>
</form>
</body> </body>
</html> </html>
@ -104,12 +104,12 @@
}); });
// select 事件 // select 事件
form.on('select(role)', function(data){ form.on('select(role)', function (data) {
var elem = data.elem; // 获得 select 原始 DOM 对象 var elem = data.elem; // 获得 select 原始 DOM 对象
var value = data.value; // 获得被选中的值 var value = data.value; // 获得被选中的值
//获取name //获取name
var name = $(elem).find("option:selected").text(); var name = $(elem).find("option:selected").text();
changeDept(value,name); changeDept(value, name);
layui.form.render('select'); layui.form.render('select');
}); });
@ -120,12 +120,12 @@
$("#sex").val(data.sex === '男' ? 1 : 0); $("#sex").val(data.sex === '男' ? 1 : 0);
$("#idCard").val(data.idCard); $("#idCard").val(data.idCard);
$("#phone").val(data.phone); $("#phone").val(data.phone);
changeDept(data.roleId,""); changeDept(data.roleId, "");
layui.form.render(); layui.form.render();
} }
function changeDept(value,name){ function changeDept(value, name) {
let elem =$("#deptId"); let elem = $("#deptId");
if (value == '7' || name === '项目经理') { if (value == '7' || name === '项目经理') {
//清空部门 //清空部门
elem.empty(); elem.empty();
@ -135,9 +135,12 @@
elem.removeAttr("lay-verify"); elem.removeAttr("lay-verify");
//删除所属部门/项目前面的* //删除所属部门/项目前面的*
$(".layui-form-label:eq(5)").html("所属部门/项目"); $(".layui-form-label:eq(5)").html("所属部门/项目");
}else{ } else if (value == 5) {
$('#deptId').val(7); // 设置为发展运营中心
$('#deptId').attr('disabled', 'disabled');
} else {
elem.removeAttr("disabled"); elem.removeAttr("disabled");
elem.attr("lay-verify","required"); elem.attr("lay-verify", "required");
elem.removeClass('layui-disabled'); elem.removeClass('layui-disabled');
$(".layui-form-label:eq(5)").html("<span style='color: red'>*</span>所属部门/项目"); $(".layui-form-label:eq(5)").html("<span style='color: red'>*</span>所属部门/项目");
getDeptSelect(); getDeptSelect();
@ -150,22 +153,23 @@
url: ctxPath + '/evaluatePerson/getRoleSelect', url: ctxPath + '/evaluatePerson/getRoleSelect',
async: false, async: false,
success: function (data) { success: function (data) {
setSelectValue(data, 'roleId',personInfo.roleId); setSelectValue(data, 'roleId', personInfo.roleId);
} }
}); });
} }
function getDeptSelect(){
function getDeptSelect() {
$.ajax({ $.ajax({
type: 'post', type: 'post',
url: ctxPath + '/evaluatePerson/getDeptSelect', url: ctxPath + '/evaluatePerson/getDeptSelect',
async: false, async: false,
success: function (data) { success: function (data) {
setSelectValue(data, 'deptId',personInfo.deptId); setSelectValue(data, 'deptId', personInfo.deptId);
} }
}); });
} }
function setSelectValue(list, selectName,id) { function setSelectValue(list, selectName, id) {
let html = '<option value="">请选择</option>'; let html = '<option value="">请选择</option>';
if (list && list.length > 0) { if (list && list.length > 0) {
$.each(list, function (index, item) { $.each(list, function (index, item) {
@ -181,7 +185,7 @@
layui.form.render(); layui.form.render();
} }
function submit(data){ function submit(data) {
data.id = personInfo.id; data.id = personInfo.id;
$.ajax({ $.ajax({
type: 'post', type: 'post',
@ -197,6 +201,7 @@
} }
}); });
} }
function closePage() { function closePage() {
let index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe层的索引 let index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe层的索引
parent.searchTable(1) parent.searchTable(1)