增加分包人员逻辑修改
This commit is contained in:
parent
cbf785f14f
commit
6d3f0b1719
|
|
@ -1,117 +1,190 @@
|
|||
let layer, treeTable, tableIns, table;
|
||||
const token = localStorage.getItem("token");
|
||||
|
||||
layui.use(['layer', 'treeTable', 'table'], function () {
|
||||
layui.use(["layer", "treeTable", "table"], function () {
|
||||
layer = layui.layer;
|
||||
treeTable = layui.treeTable;
|
||||
table = layui.table;
|
||||
initTreeTable()
|
||||
|
||||
initTreeTable();
|
||||
});
|
||||
|
||||
// 搜索/重置
|
||||
function searchTable(type) {
|
||||
if (type === 1) {
|
||||
|
||||
} else if (type === 2) {
|
||||
$('#keyWord').val('')
|
||||
$("#keyWord").val("");
|
||||
}
|
||||
table.reload('ID-treeTable-demo', {
|
||||
url: ctxPath + '/evaluatePerson/getPersonList',
|
||||
table.reload("ID-treeTable-demo", {
|
||||
url: ctxPath + "/evaluatePerson/getPersonList",
|
||||
page: {
|
||||
curr: 1
|
||||
curr: 1,
|
||||
},
|
||||
where: {
|
||||
keyWord: $("#keyWord").val(),
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化树表格
|
||||
function initTreeTable() {
|
||||
tableIns = table.render({
|
||||
elem: '#ID-treeTable-demo',
|
||||
id: 'ID-treeTable-demo',
|
||||
url: `${ctxPath}` + '/evaluatePerson/getPersonList',
|
||||
method: 'get' //方式默认是get
|
||||
, toolbar: 'default' //开启工具栏,此处显示默认图标,可以自定义模板,详见文档
|
||||
, where: {} //post请求必须加where ,post请求需要的参数
|
||||
, cellMinWidth: 80,
|
||||
cols: [[
|
||||
{ field: 'number', width: 80, title: '序号', align: 'center', type: 'numbers' },
|
||||
{ field: 'name', title: '姓名', width: '10%', unresize: true, align: "center" },
|
||||
{ field: 'sex', title: '性别', width: '10%', unresize: true, align: "center" },
|
||||
{ field: 'idCard', title: '身份证号码', width: '20%', unresize: true, align: "center", templet: d => maskSensitiveInfo(d.idCard, 'idCard') },
|
||||
{ field: 'phone', title: '联系电话', width: '15%', unresize: true, align: "center", templet: d => maskSensitiveInfo(d.phone, 'phone') },
|
||||
{ field: 'deptName', title: '所属部门/项目', width: '15%', unresize: true, align: "center" },
|
||||
{ field: 'roleName', title: '系统角色', width: '10%', unresize: true, align: "center" },
|
||||
{
|
||||
fixed: 'right', title: '操作', align: 'center', templet: d => {
|
||||
let html = "";
|
||||
html += '<a lay-event="edit" style="color: #009688;cursor: pointer;font-size: 15px" id="edit">修改</a>';
|
||||
html += '<a lay-event="del" style="color: #009688;cursor: pointer;font-size: 15px;margin-left: 10px" id="del">删除</a>';
|
||||
return html;
|
||||
}
|
||||
},
|
||||
]]
|
||||
, page: true //开启分页
|
||||
, loading: true //数据加载中。。。
|
||||
, limits: [10, 20, 100] //一页选择显示3,5或10条数据
|
||||
, limit: 10 //一页显示5条数据
|
||||
, response: {
|
||||
statusCode: 200 //规定成功的状态码,默认:0
|
||||
}, parseData: function (res) { //将原始数据解析成 table 组件所规定的数据,res为从url中get到的数据
|
||||
elem: "#ID-treeTable-demo",
|
||||
id: "ID-treeTable-demo",
|
||||
url: `${ctxPath}` + "/evaluatePerson/getPersonList",
|
||||
method: "get", //方式默认是get
|
||||
toolbar: "default", //开启工具栏,此处显示默认图标,可以自定义模板,详见文档
|
||||
where: {}, //post请求必须加where ,post请求需要的参数
|
||||
cellMinWidth: 80,
|
||||
cols: [
|
||||
[
|
||||
{
|
||||
field: "number",
|
||||
width: 80,
|
||||
title: "序号",
|
||||
align: "center",
|
||||
type: "numbers",
|
||||
},
|
||||
{
|
||||
field: "name",
|
||||
title: "姓名",
|
||||
width: "10%",
|
||||
unresize: true,
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
field: "sex",
|
||||
title: "性别",
|
||||
width: "10%",
|
||||
unresize: true,
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
field: "idCard",
|
||||
title: "身份证号码",
|
||||
width: "20%",
|
||||
unresize: true,
|
||||
align: "center",
|
||||
templet: (d) => maskSensitiveInfo(d.idCard, "idCard"),
|
||||
},
|
||||
{
|
||||
field: "phone",
|
||||
title: "联系电话",
|
||||
width: "15%",
|
||||
unresize: true,
|
||||
align: "center",
|
||||
templet: (d) => maskSensitiveInfo(d.phone, "phone"),
|
||||
},
|
||||
{
|
||||
field: "deptName",
|
||||
title: "所属部门/项目",
|
||||
width: "15%",
|
||||
unresize: true,
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
field: "roleName",
|
||||
title: "系统角色",
|
||||
width: "10%",
|
||||
unresize: true,
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
fixed: "right",
|
||||
title: "操作",
|
||||
align: "center",
|
||||
templet: (d) => {
|
||||
let html = "";
|
||||
html +=
|
||||
'<a lay-event="edit" style="color: #009688;cursor: pointer;font-size: 15px" id="edit">修改</a>';
|
||||
html +=
|
||||
'<a lay-event="del" style="color: #009688;cursor: pointer;font-size: 15px;margin-left: 10px" id="del">删除</a>';
|
||||
return html;
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
page: true, //开启分页
|
||||
loading: true, //数据加载中。。。
|
||||
limits: [10, 20, 100], //一页选择显示3,5或10条数据
|
||||
limit: 10, //一页显示5条数据
|
||||
response: {
|
||||
statusCode: 200, //规定成功的状态码,默认:0
|
||||
},
|
||||
parseData: function (res) {
|
||||
//将原始数据解析成 table 组件所规定的数据,res为从url中get到的数据
|
||||
let result;
|
||||
if (res.data !== '' && res.data != null && res.data !== "null") {
|
||||
if (res.data !== "" && res.data != null && res.data !== "null") {
|
||||
if (this.page.curr) {
|
||||
result = res.data.slice(this.limit * (this.page.curr - 1), this.limit * this.page.curr);
|
||||
result = res.data.slice(
|
||||
this.limit * (this.page.curr - 1),
|
||||
this.limit * this.page.curr
|
||||
);
|
||||
} else {
|
||||
result = res.data.slice(0, this.limit);
|
||||
}
|
||||
}
|
||||
return {
|
||||
"code": res.code, //解析接口状态
|
||||
"msg": res.msg, //解析提示文本
|
||||
"count": res.count, //解析数据长度
|
||||
"data": result, //解析数据列表
|
||||
code: res.code, //解析接口状态
|
||||
msg: res.msg, //解析提示文本
|
||||
count: res.count, //解析数据长度
|
||||
data: result, //解析数据列表
|
||||
};
|
||||
},
|
||||
toolbar: "#toolbar"
|
||||
toolbar: "#toolbar",
|
||||
});
|
||||
table.on('tool(test)', function (obj) {
|
||||
table.on("tool(test)", function (obj) {
|
||||
var data = obj.data; //当前行数据
|
||||
var rowIndex = obj.index;
|
||||
var layEvent = obj.event; //当前点击的事件名
|
||||
if (layEvent === 'edit') {
|
||||
if (layEvent === "edit") {
|
||||
edit(data);
|
||||
}
|
||||
if (layEvent === 'del') {
|
||||
if (layEvent === "del") {
|
||||
del(data.id);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function del(data) {
|
||||
layer.confirm('确认删除吗?', function (index) {
|
||||
layer.confirm("确认删除吗?", function (index) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ctxPath + '/evaluatePerson/deletePersonById',
|
||||
data: {id: data},
|
||||
url: ctxPath + "/evaluatePerson/deletePersonById",
|
||||
data: { id: data },
|
||||
success: function (data) {
|
||||
layer.close(index);
|
||||
if (data.res === 1) {
|
||||
layer.msg(data.resMsg, {icon: 1, time: 2000});
|
||||
layer.msg(data.resMsg, { icon: 1, time: 2000 });
|
||||
searchTable(1);
|
||||
} else {
|
||||
layer.msg(data.resMsg, {icon: 2, time: 2000});
|
||||
layer.msg(data.resMsg, { icon: 2, time: 2000 });
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function add() {
|
||||
openPage('新增人员', './EvaluatePersonAdd.html?id=0&type=add');
|
||||
// openPage('新增人员', './EvaluatePersonAdd.html?id=0&type=add');
|
||||
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: "新增企业",
|
||||
content: "./EvaluatePersonAdd.html?id=0",
|
||||
btn: ["确定"],
|
||||
maxmin: false,
|
||||
area: ["60%", "65%"],
|
||||
success: function (layero, index) {},
|
||||
yes: function (index, layero) {
|
||||
//提交子页面时执行
|
||||
// 获取弹出层中的form表单元素
|
||||
var formSubmit = layer.getChildFrame("form", index);
|
||||
// 查找class样式为submitBtn的按钮
|
||||
let submited = formSubmit.find("button.formSubmit");
|
||||
// 触发点击事件,会对表单进行验证,验证成功则提交表单,失败则返回错误信息
|
||||
submited.click();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function edit(data) {
|
||||
|
|
@ -119,21 +192,20 @@ function edit(data) {
|
|||
//如果是查看页面,不需要弹出层的确定按钮
|
||||
const layerOptions = {
|
||||
type: 2,
|
||||
title: '修改人员',
|
||||
content: './editPerson.html',
|
||||
title: "修改人员",
|
||||
content: "./editPerson.html",
|
||||
maxmin: false,
|
||||
area: ['40%', '60%'],
|
||||
success: function (layero, index) {
|
||||
}
|
||||
area: ["40%", "60%"],
|
||||
success: function (layero, index) {},
|
||||
};
|
||||
|
||||
layerOptions.btn = ["确定"];
|
||||
layerOptions.yes = function (index, layero) {
|
||||
//提交子页面时执行
|
||||
// 获取弹出层中的form表单元素
|
||||
const formSubmit = layer.getChildFrame('form', index);
|
||||
const formSubmit = layer.getChildFrame("form", index);
|
||||
// 查找class样式为submitBtn的按钮
|
||||
const submited = formSubmit.find('button.subBtn');
|
||||
const submited = formSubmit.find("button.subBtn");
|
||||
// 触发点击事件,会对表单进行验证,验证成功则提交表单,失败则返回错误信息
|
||||
submited.click();
|
||||
};
|
||||
|
|
@ -147,24 +219,23 @@ function openPage(title, url) {
|
|||
title: title,
|
||||
content: url,
|
||||
maxmin: false,
|
||||
area: ['90%', '95%'],
|
||||
success: function (layero, index) {
|
||||
}
|
||||
area: ["90%", "95%"],
|
||||
success: function (layero, index) {},
|
||||
};
|
||||
|
||||
if (title === '查看人员') {
|
||||
if (title === "查看人员") {
|
||||
layer.open(layerOptions);
|
||||
} else {
|
||||
layerOptions.btn = ["确定"];
|
||||
layerOptions.yes = function (index, layero) {
|
||||
//提交子页面时执行
|
||||
// 获取弹出层中的form表单元素
|
||||
const formSubmit = layer.getChildFrame('form', index);
|
||||
const formSubmit = layer.getChildFrame("form", index);
|
||||
// 查找class样式为submitBtn的按钮
|
||||
const submited = formSubmit.find('button.subBtn');
|
||||
const submited = formSubmit.find("button.subBtn");
|
||||
// 触发点击事件,会对表单进行验证,验证成功则提交表单,失败则返回错误信息
|
||||
submited.click();
|
||||
};
|
||||
layer.open(layerOptions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,274 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns="http://www.w3.org/1999/html">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>评价人员新增</title>
|
||||
<link rel="stylesheet" href="../../../layui/css/layui.css" media="all"/>
|
||||
</head>
|
||||
<style>
|
||||
.layui-form-label {
|
||||
position: relative;
|
||||
float: left;
|
||||
display: block;
|
||||
padding: 9px 15px;
|
||||
width: 100%;
|
||||
font-weight: 400;
|
||||
line-height: 20px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.layui-table-cell .layui-btn {
|
||||
vertical-align: inherit;
|
||||
margin-top: -8px;
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
.layui-table {
|
||||
width: 100%;
|
||||
margin: 0 0 !important;
|
||||
background-color: #fff;
|
||||
color: #5f5f5f;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<form class="layui-form" action="" onsubmit="return false">
|
||||
<div class="content" style="margin-top: 10px;display: flex">
|
||||
<div class="left"
|
||||
style="border: 1px solid grey;width: 20%;height: 98vh;overflow-x: hidden;overflow-y: hidden;display:
|
||||
flex;flex-direction: column">
|
||||
<span style="margin-left: 10px;">部门列表:</span>
|
||||
<div id="orgTree" style="height: 98vh;border: yellow;overflow-x: hidden;overflow-y: auto;"></div>
|
||||
</div>
|
||||
<div class="right" style="width: 79.5%;margin-left: 0.5%;overflow-y: auto;height: 98vh;">
|
||||
<div class="layui-inline" style="width: 100%;display: flex">
|
||||
<input type="text" name="keyWord" id="keyWord"
|
||||
style="width: 40%"
|
||||
placeholder="请输入关键字"
|
||||
autocomplete="off"
|
||||
class="layui-input">
|
||||
<button type="button" class="layui-btn layui-bg-blue" style="margin-left: 10px;"
|
||||
onclick="searchTable(1)">查询
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-bg-blue" onclick="searchTable(2)">重置</button>
|
||||
</div>
|
||||
<table id="baseTable" class="layui-table" lay-filter="filterTable"></table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" style="display: none">
|
||||
<div class="layui-input-block">
|
||||
<button type="submit" class="layui-btn subBtn" id="commit" lay-submit lay-filter="formDemo">提交
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<script src="../../../js/publicJs.js"></script>
|
||||
<script src="../../../js/common_methon.js"></script>
|
||||
<script type="text/javascript" src="../../../js/libs/jquery-2.1.1.min.js"></script>
|
||||
<script type="text/javascript" src="../../../js/jq.js"></script>
|
||||
<script type="text/javascript" src="../../../js/my/permission.js"></script>
|
||||
<script src="../../../js/common_methon.js"></script>
|
||||
<script src="../../../js/common.js"></script>
|
||||
<script src="../../../layui/layui.js"></script>
|
||||
<script type="text/javascript">
|
||||
let form, table, tree;
|
||||
let alreadyChooseTrees = [];
|
||||
let selectData = [];
|
||||
layui.use(['table', 'form', 'tree'], function () {
|
||||
table = layui.table;
|
||||
form = layui.form;
|
||||
tree = layui.tree;
|
||||
initTree()
|
||||
renderTable()
|
||||
table.on('checkbox(filterTable)', function (obj) {
|
||||
if (obj.type === 'all') {
|
||||
if (obj.checked) {
|
||||
selectData = table.cache.baseTable;
|
||||
} else {
|
||||
selectData = [];
|
||||
}
|
||||
} else {
|
||||
if (obj.checked) {
|
||||
selectData.push(obj.data);
|
||||
} else {
|
||||
selectData = selectData.filter(function (item) {
|
||||
return item.id !== obj.data.id;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
if (getUrlParam("type") !== 'add') {
|
||||
// getDataDetails()
|
||||
if (getUrlParam("type") === 'view') {
|
||||
let layuiTreeCheck = $("input[name^='layuiTreeCheck']");
|
||||
layuiTreeCheck.prop("disabled", true);
|
||||
layuiTreeCheck.next(".layui-form-checkbox").addClass(".layui-checkbox-disbaled layui-disabled");
|
||||
$("input[name^='layTableCheckbox']").prop("disabled", true);
|
||||
}
|
||||
}
|
||||
// 验证成功后才会执行下面的操作
|
||||
form.on('submit(formDemo)', function (data) {
|
||||
submitData();
|
||||
});
|
||||
});
|
||||
|
||||
function initTree() {
|
||||
$.ajax({
|
||||
url: ctxPath + "/evaluatePerson/getDeptTree",
|
||||
type: 'POST',
|
||||
async: false,
|
||||
success: function (data) {
|
||||
tree.render({
|
||||
elem: '#orgTree',
|
||||
showCheckbox: true,
|
||||
data: data.obj,
|
||||
id: 'orgTree',
|
||||
checkChild: false,
|
||||
oncheck: function (obj) {
|
||||
alreadyChooseTrees = [];
|
||||
var checkData = tree.getChecked('orgTree')[0];
|
||||
if (checkData) {
|
||||
alreadyChooseTrees.push(checkData.id);
|
||||
if (checkData.children.length > 0) {
|
||||
handleData(checkData.children); //开始递归调用
|
||||
}
|
||||
}
|
||||
renderTable()
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function renderTable() {
|
||||
tableIns = table.render({
|
||||
elem: '#baseTable',
|
||||
id: 'baseTable',
|
||||
url: ctxPath + '/evaluatePerson/getUserList',
|
||||
method: 'get' //方式默认是get
|
||||
, toolbar: 'default' //开启工具栏,此处显示默认图标,可以自定义模板,详见文档
|
||||
, where: {
|
||||
keyWord: $("#keyWord").val(),
|
||||
id: alreadyChooseTrees.join(","),
|
||||
type:'team'
|
||||
} //post请求必须加where ,post请求需要的参数
|
||||
, cellMinWidth: 80,
|
||||
cols: [[ //标题栏
|
||||
{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},
|
||||
]]
|
||||
, page: true //开启分页
|
||||
, loading: true //数据加载中。。。
|
||||
, limits: [10, 20, 100] //一页选择显示3,5或10条数据
|
||||
, limit: 10 //一页显示5条数据
|
||||
, response: {
|
||||
statusCode: 200 //规定成功的状态码,默认:0
|
||||
},
|
||||
done: function (res, curr, count, origin) {
|
||||
res.data.forEach(function (item) {
|
||||
selectData.forEach(function (selectItem) {
|
||||
if (item.id === selectItem.id) {
|
||||
//设置选中
|
||||
var index = item.LAY_INDEX;
|
||||
table.setRowChecked('baseTable', {
|
||||
index: index, // 选中行的下标。 0 表示第一行
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
},
|
||||
parseData: function (res) { //将原始数据解析成 table 组件所规定的数据,res为从url中get到的数据
|
||||
let result;
|
||||
if (res.data !== '' && res.data != null && res.data !== "null") {
|
||||
if (this.page.curr) {
|
||||
result = res.data.slice(this.limit * (this.page.curr - 1), this.limit * this.page.curr);
|
||||
} else {
|
||||
result = res.data.slice(0, this.limit);
|
||||
}
|
||||
}
|
||||
return {
|
||||
"code": res.code, //解析接口状态
|
||||
"msg": res.msg, //解析提示文本
|
||||
"count": res.count, //解析数据长度
|
||||
"data": result, //解析数据列表
|
||||
};
|
||||
},
|
||||
toolbar: "#toolbar"
|
||||
});
|
||||
}
|
||||
|
||||
function searchTable(type) {
|
||||
if (type === 1) {
|
||||
} else {
|
||||
$("#keyWord").val("");
|
||||
}
|
||||
table.reload('baseTable', {
|
||||
url: ctxPath + '/evaluatePerson/getUserList',
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: {
|
||||
keyWord: $("#keyWord").val(),
|
||||
id: alreadyChooseTrees.join(",")
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function submitData() {
|
||||
if (selectData.length === 0) {
|
||||
layer.msg("请先选择人员!", {icon: 0});
|
||||
return;
|
||||
}
|
||||
localStorage.setItem("personList", JSON.stringify(selectData));
|
||||
//如果是查看页面,不需要弹出层的确定按钮
|
||||
const layerOptions = {
|
||||
type: 2,
|
||||
title: '新增人员',
|
||||
content: 'addPerson.html',
|
||||
maxmin: false,
|
||||
area: ['90%', '95%'],
|
||||
success: function (layero, index) {
|
||||
},
|
||||
end: function () {
|
||||
//关闭弹出层时执行
|
||||
searchTable(1);
|
||||
selectData = [];
|
||||
localStorage.removeItem("personList");
|
||||
}
|
||||
};
|
||||
layerOptions.btn = ["确定"];
|
||||
layerOptions.yes = function (index, layero) {
|
||||
//提交子页面时执行
|
||||
// 获取弹出层中的form表单元素
|
||||
const formSubmit = layer.getChildFrame('form', index);
|
||||
// 查找class样式为submitBtn的按钮
|
||||
const submited = formSubmit.find('button.subBtn');
|
||||
// 触发点击事件,会对表单进行验证,验证成功则提交表单,失败则返回错误信息
|
||||
submited.click();
|
||||
};
|
||||
layer.open(layerOptions);
|
||||
}
|
||||
|
||||
function handleData(data) {
|
||||
data.forEach(function (item, i) {
|
||||
alreadyChooseTrees.push(item.id);
|
||||
if (item.children && item.children.length > 0) {
|
||||
handleData(item.children);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
|
@ -1,9 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns="http://www.w3.org/1999/html">
|
||||
|
||||
<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 {
|
||||
|
|
@ -30,40 +31,66 @@
|
|||
color: #5f5f5f;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<form class="layui-form" action="" onsubmit="return false">
|
||||
<div class="content" style="margin-top: 10px;display: flex">
|
||||
<div class="left"
|
||||
style="border: 1px solid grey;width: 20%;height: 98vh;overflow-x: hidden;overflow-y: hidden;display:
|
||||
flex;flex-direction: column">
|
||||
<span style="margin-left: 10px;">部门列表:</span>
|
||||
<div id="orgTree" style="height: 98vh;border: yellow;overflow-x: hidden;overflow-y: auto;"></div>
|
||||
</div>
|
||||
<div class="right" style="width: 79.5%;margin-left: 0.5%;overflow-y: auto;height: 98vh;">
|
||||
<div class="layui-inline" style="width: 100%;display: flex">
|
||||
<input type="text" name="keyWord" id="keyWord"
|
||||
style="width: 40%"
|
||||
placeholder="请输入关键字"
|
||||
autocomplete="off"
|
||||
class="layui-input">
|
||||
<button type="button" class="layui-btn layui-bg-blue" style="margin-left: 10px;"
|
||||
onclick="searchTable(1)">查询
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-bg-blue" onclick="searchTable(2)">重置</button>
|
||||
</div>
|
||||
<table id="baseTable" class="layui-table" lay-filter="filterTable"></table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" style="display: none">
|
||||
<div class="layui-input-block">
|
||||
<button type="submit" class="layui-btn subBtn" id="commit" lay-submit lay-filter="formDemo">提交
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<body>
|
||||
|
||||
<form class="layui-form" action="#">
|
||||
|
||||
<div class="layui-form-item" style="margin-top: 1%;">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required_icon">*</span>身份证号码</label>
|
||||
<div class="layui-input-inline">
|
||||
<input class="layui-input" id="idCard" name="idCard" lay-verify="required\|idCard" lay-affix="clear"
|
||||
autocomplete="off" maxlength="18">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required_icon">*</span>姓名</label>
|
||||
<div class="layui-input-inline">
|
||||
<!-- <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">
|
||||
<label class="layui-form-label"><span class="required_icon">*</span>性别</label>
|
||||
<div class="layui-input-inline">
|
||||
<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">
|
||||
<label class="layui-form-label"><span class="required_icon">*</span>联系电话</label>
|
||||
<div class="layui-input-inline">
|
||||
<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">
|
||||
<label class="layui-form-label"><span class="required_icon">*</span>系统角色</label>
|
||||
<div class="layui-input-inline">
|
||||
<select id="roleId" name="roleId" class="layui-select" lay-search lay-verify="required"
|
||||
style="height: 360px;"></select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required_icon">*</span>所属项目/部门</label>
|
||||
<div class="layui-input-inline">
|
||||
<select id="deptId" name="deptId" class="layui-select" 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="formData"
|
||||
style="display: none;"></button>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
<script src="../../../js/publicJs.js"></script>
|
||||
<script src="../../../js/common_methon.js"></script>
|
||||
|
|
@ -78,40 +105,78 @@
|
|||
let alreadyChooseTrees = [];
|
||||
let selectData = [];
|
||||
layui.use(['table', 'form', 'tree'], function () {
|
||||
table = layui.table;
|
||||
form = layui.form;
|
||||
tree = layui.tree;
|
||||
initTree()
|
||||
renderTable()
|
||||
table.on('checkbox(filterTable)', function (obj) {
|
||||
if (obj.type === 'all') {
|
||||
if (obj.checked) {
|
||||
selectData = table.cache.baseTable;
|
||||
} else {
|
||||
selectData = [];
|
||||
layui.use(['form', 'laydate'], function () {
|
||||
var form = layui.form;
|
||||
var laydate = layui.laydate;
|
||||
form.verify({
|
||||
idCard: function (value, item) {
|
||||
if (!checkPsidno(value)) {
|
||||
return '请输入正确的身份证号';
|
||||
}
|
||||
},
|
||||
phone: function (value, item) {
|
||||
if (!phone_reg(value)) {
|
||||
return '请输入正确的手机号';
|
||||
}
|
||||
},
|
||||
})
|
||||
form.render();
|
||||
// 提交事件
|
||||
form.on('submit(formSubmit)', function (data) {
|
||||
//对身份证和手机号验证
|
||||
if ($('#idCard').val() == null || $('#idCard').val() == "") {
|
||||
layer.msg("请输入身份证号", { icon: 2, time: 2000 });
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (obj.checked) {
|
||||
selectData.push(obj.data);
|
||||
} else {
|
||||
selectData = selectData.filter(function (item) {
|
||||
return item.id !== obj.data.id;
|
||||
});
|
||||
if (!checkPsidno($("#idCard").val())) {
|
||||
layer.msg("身份证号码格式不正确", { icon: 2, time: 2000 });
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (getUrlParam("type") !== 'add') {
|
||||
// getDataDetails()
|
||||
if (getUrlParam("type") === 'view') {
|
||||
let layuiTreeCheck = $("input[name^='layuiTreeCheck']");
|
||||
layuiTreeCheck.prop("disabled", true);
|
||||
layuiTreeCheck.next(".layui-form-checkbox").addClass(".layui-checkbox-disbaled layui-disabled");
|
||||
$("input[name^='layTableCheckbox']").prop("disabled", true);
|
||||
}
|
||||
}
|
||||
// 验证成功后才会执行下面的操作
|
||||
form.on('submit(formDemo)', function (data) {
|
||||
submitData();
|
||||
|
||||
if ($('#name').val() == null || $('#name').val() == "") {
|
||||
layer.msg("请输入姓名", { icon: 2, time: 2000 });
|
||||
return false;
|
||||
}
|
||||
if ($('#sex').val() == null || $('#name').val() == "") {
|
||||
layer.msg("请选择性别", { icon: 2, time: 2000 });
|
||||
return false;
|
||||
}
|
||||
if ($('#phone').val() == null || $('#phone').val() == "") {
|
||||
layer.msg("请输入手机号", { icon: 2, time: 2000 });
|
||||
return false;
|
||||
}
|
||||
if (!phone_reg($("#phone").val())) {
|
||||
layer.msg("手机号码格式不正确", { icon: 2, time: 2000 });
|
||||
return false;
|
||||
}
|
||||
if ($('#roleId').val() == null || $('#roleId').val() == "") {
|
||||
layer.msg("请选择角色", { icon: 2, time: 2000 });
|
||||
return false;
|
||||
}
|
||||
if ($('#deptId').val() == null || $('#deptId').val() == "") {
|
||||
layer.msg("请选择所属部门", { icon: 2, time: 2000 });
|
||||
return false;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: ctxPath + '/evaluatePerson/addPersonInfo',
|
||||
type: 'POST',
|
||||
data: {
|
||||
personList: JSON.stringify(data)
|
||||
},
|
||||
success: function (res) {
|
||||
if (res.res === 1) {
|
||||
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 });
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -154,21 +219,21 @@
|
|||
, where: {
|
||||
keyWord: $("#keyWord").val(),
|
||||
id: alreadyChooseTrees.join(","),
|
||||
type:'team'
|
||||
type: 'team'
|
||||
} //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 //数据加载中。。。
|
||||
|
|
@ -229,40 +294,42 @@
|
|||
}
|
||||
|
||||
function submitData() {
|
||||
if (selectData.length === 0) {
|
||||
layer.msg("请先选择人员!", {icon: 0});
|
||||
return;
|
||||
}
|
||||
localStorage.setItem("personList", JSON.stringify(selectData));
|
||||
//如果是查看页面,不需要弹出层的确定按钮
|
||||
const layerOptions = {
|
||||
type: 2,
|
||||
title: '新增人员',
|
||||
content: 'addPerson.html',
|
||||
maxmin: false,
|
||||
area: ['90%', '95%'],
|
||||
success: function (layero, index) {
|
||||
},
|
||||
end: function () {
|
||||
//关闭弹出层时执行
|
||||
searchTable(1);
|
||||
selectData = [];
|
||||
localStorage.removeItem("personList");
|
||||
}
|
||||
};
|
||||
layerOptions.btn = ["确定"];
|
||||
layerOptions.yes = function (index, layero) {
|
||||
//提交子页面时执行
|
||||
// 获取弹出层中的form表单元素
|
||||
const formSubmit = layer.getChildFrame('form', index);
|
||||
// 查找class样式为submitBtn的按钮
|
||||
const submited = formSubmit.find('button.subBtn');
|
||||
// 触发点击事件,会对表单进行验证,验证成功则提交表单,失败则返回错误信息
|
||||
submited.click();
|
||||
};
|
||||
layer.open(layerOptions);
|
||||
|
||||
// if (selectData.length === 0) {
|
||||
// layer.msg("请先选择人员!", { icon: 0 });
|
||||
// return;
|
||||
// }
|
||||
// localStorage.setItem("personList", JSON.stringify(selectData));
|
||||
// //如果是查看页面,不需要弹出层的确定按钮
|
||||
// const layerOptions = {
|
||||
// type: 2,
|
||||
// title: '新增人员',
|
||||
// content: 'addPerson.html',
|
||||
// maxmin: false,
|
||||
// area: ['90%', '95%'],
|
||||
// success: function (layero, index) {
|
||||
// },
|
||||
// end: function () {
|
||||
// //关闭弹出层时执行
|
||||
// searchTable(1);
|
||||
// selectData = [];
|
||||
// localStorage.removeItem("personList");
|
||||
// }
|
||||
// };
|
||||
// layerOptions.btn = ["确定"];
|
||||
// layerOptions.yes = function (index, layero) {
|
||||
// //提交子页面时执行
|
||||
// // 获取弹出层中的form表单元素
|
||||
// const formSubmit = layer.getChildFrame('form', index);
|
||||
// // 查找class样式为submitBtn的按钮
|
||||
// const submited = formSubmit.find('button.subBtn');
|
||||
// // 触发点击事件,会对表单进行验证,验证成功则提交表单,失败则返回错误信息
|
||||
// submited.click();
|
||||
// };
|
||||
// layer.open(layerOptions);
|
||||
}
|
||||
|
||||
|
||||
function handleData(data) {
|
||||
data.forEach(function (item, i) {
|
||||
alreadyChooseTrees.push(item.id);
|
||||
|
|
@ -271,4 +338,46 @@
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
function setSelectValue(list, selectName, code, nameCode) {
|
||||
let html = '<option value="">请选择</option>';
|
||||
if (list && list.length > 0) {
|
||||
$.each(list, function (index, item) {
|
||||
html +=
|
||||
"<option value='" +
|
||||
item[code] +
|
||||
"' item='" +
|
||||
JSON.stringify(item) +
|
||||
"'>" +
|
||||
item[nameCode] +
|
||||
"</option>";
|
||||
});
|
||||
}
|
||||
$("#" + selectName)
|
||||
.empty()
|
||||
.append(html);
|
||||
layui.form.render();
|
||||
}
|
||||
|
||||
|
||||
function getRoleSelect() {
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: ctxPath + '/evaluatePerson/getRoleSelect',
|
||||
async: false,
|
||||
success: function (data) {
|
||||
setSelectValue(result.obj, "personInChargeId", "id", "roleId");
|
||||
}
|
||||
});
|
||||
}
|
||||
function getDeptSelect() {
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: ctxPath + '/evaluatePerson/getDeptSelect',
|
||||
async: false,
|
||||
success: function (data) {
|
||||
setSelectValue(result.obj, "personInChargeId", "id", "deptId");
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
Loading…
Reference in New Issue