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

View File

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