基础管理
This commit is contained in:
parent
dec399a218
commit
2fdf9144f2
|
|
@ -5,13 +5,13 @@
|
||||||
<!--新增/修改 组织机构-->
|
<!--新增/修改 组织机构-->
|
||||||
<insert id="addOrUpdateSysOrg">
|
<insert id="addOrUpdateSysOrg">
|
||||||
<if test="type == 1 ">
|
<if test="type == 1 ">
|
||||||
INSERT INTO sys_org(org_name,name,phone,p_id,org_sort,remarks,state)
|
INSERT INTO sys_org(org_name,contacts,contacts_phone,p_id,org_sort,remarks,state)
|
||||||
VALUES (
|
VALUES (
|
||||||
#{orgName},#{name},#{phone},#{parentId},#{orgSort},#{remarks},#{state}
|
#{orgName},#{name},#{phone},#{parentId},#{orgSort},#{remarks},#{state}
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test="type == 2 ">
|
<if test="type == 2 ">
|
||||||
UPDATE sys_org SET org_name = #{orgName},name = #{name},phone = #{phone},p_id = #{parentId},org_sort = #{orgSort},remarks = #{remarks},state = #{state}
|
UPDATE sys_org SET org_name = #{orgName},contacts = #{name},contacts_phone = #{phone},p_id = #{parentId},org_sort = #{orgSort},remarks = #{remarks},state = #{state}
|
||||||
WHERE org_id = #{id}
|
WHERE org_id = #{id}
|
||||||
</if>
|
</if>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
@ -27,8 +27,8 @@
|
||||||
<select id="getOrgList" resultType="com.bonus.aqgqj.system.vo.SysOrgVo">
|
<select id="getOrgList" resultType="com.bonus.aqgqj.system.vo.SysOrgVo">
|
||||||
SELECT so.org_id AS id,
|
SELECT so.org_id AS id,
|
||||||
so.org_name AS orgName,
|
so.org_name AS orgName,
|
||||||
so.name,
|
so.contacts as name,
|
||||||
so.phone,
|
so.contacts_phone as phone,
|
||||||
so.state,
|
so.state,
|
||||||
so.remarks,
|
so.remarks,
|
||||||
so2.org_name AS parentOrgName,
|
so2.org_name AS parentOrgName,
|
||||||
|
|
@ -66,8 +66,8 @@
|
||||||
<select id="getSysOrgById" resultType="com.bonus.aqgqj.system.vo.SysOrgVo">
|
<select id="getSysOrgById" resultType="com.bonus.aqgqj.system.vo.SysOrgVo">
|
||||||
SELECT so.org_id AS id,
|
SELECT so.org_id AS id,
|
||||||
so.org_name AS orgName,
|
so.org_name AS orgName,
|
||||||
so.name AS name,
|
so.contacts AS name,
|
||||||
so.phone,
|
so.contacts_phone as phone,
|
||||||
so.remarks,
|
so.remarks,
|
||||||
so.state,
|
so.state,
|
||||||
p_id AS parentId,
|
p_id AS parentId,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,311 @@
|
||||||
|
let form, layer, dtree, table, tableIns;
|
||||||
|
let pageNum = 1, limitSize = 10; // 默认第一页,分页数量为10
|
||||||
|
let orgData,selectOrgId;
|
||||||
|
|
||||||
|
layui.config({
|
||||||
|
base: "../../js/layui-v2.6.8/dtree/", //此处路径请自行处理, 可以使用绝对路径
|
||||||
|
}).extend({
|
||||||
|
dtree: 'dtree'
|
||||||
|
}).use(['form', 'layer', 'table','dtree', 'laydate'], function () {
|
||||||
|
form = layui.form;
|
||||||
|
layer = layui.layer;
|
||||||
|
table = layui.table;
|
||||||
|
dtree = layui.dtree;
|
||||||
|
layui.form.render();
|
||||||
|
orgData = getOrgTree();
|
||||||
|
pages(1, 10, 1);
|
||||||
|
form.on('switch(is-state)', function (obj) {
|
||||||
|
console.log(obj);
|
||||||
|
let url = dataUrl + "/users/updateEnableState";
|
||||||
|
let params = {
|
||||||
|
'id': this.value,
|
||||||
|
'state': obj.elem.checked ? 1 : 0
|
||||||
|
}
|
||||||
|
params={
|
||||||
|
encryptedData:encryptCBC(JSON.stringify(params))
|
||||||
|
}
|
||||||
|
ajaxRequest(url, "POST", params, true, function () {}, function (result) {
|
||||||
|
console.log(result)
|
||||||
|
reloadData();
|
||||||
|
if (result.status === 200) {
|
||||||
|
parent.layer.msg(result.data, {icon: 1})
|
||||||
|
} else if (result.status === 204) {
|
||||||
|
parent.layer.alert(result.msg, {icon: 2})
|
||||||
|
}
|
||||||
|
}, function (xhr) {
|
||||||
|
error(xhr)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
function pages(pageNum, pageSize, typeNum) {
|
||||||
|
let params = getReqParams(pageNum, pageSize, typeNum);
|
||||||
|
let url = dataUrl + "/users/getList"
|
||||||
|
ajaxRequest(url, "POST", params, true, function () {
|
||||||
|
}, function (result) {
|
||||||
|
console.log(result);
|
||||||
|
if (result.code === 200) {
|
||||||
|
if (result.data) {
|
||||||
|
initTable(result.data, result.limit, result.curr)
|
||||||
|
laypages(result.count, result.curr, result.limit)
|
||||||
|
}
|
||||||
|
} else if (result.code === 500) {
|
||||||
|
layer.alert(result.msg, {icon: 2})
|
||||||
|
}
|
||||||
|
}, function (xhr) {
|
||||||
|
error(xhr)
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function laypages(total, page, limit) {
|
||||||
|
layui.use(['laypage'], function () {
|
||||||
|
let laypage = layui.laypage;
|
||||||
|
laypage.render({
|
||||||
|
elem: 'voi-page',
|
||||||
|
count: total,
|
||||||
|
curr: page,
|
||||||
|
limit: limit,
|
||||||
|
limits: [10, 20, 50, 100, 200, 500],
|
||||||
|
layout: ['prev', 'page', 'next', 'skip', 'count', 'limit'],
|
||||||
|
groups: 5,
|
||||||
|
jump: function (obj, first) {
|
||||||
|
if (!first) {
|
||||||
|
pageNum = obj.curr, limitSize = obj.limit;
|
||||||
|
pages(obj.curr, obj.limit, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/*初始化表格*/
|
||||||
|
function initTable(dataList, limit, page) {
|
||||||
|
let loadingMsg = layer.msg("数据加载中,请稍候...", {icon: 16, scrollbar: false, time: 0,});
|
||||||
|
tableIns = table.render({
|
||||||
|
elem: "#table_data",
|
||||||
|
height: "full-130",
|
||||||
|
data: dataList,
|
||||||
|
limit: limit,
|
||||||
|
cols: [
|
||||||
|
[
|
||||||
|
//表头
|
||||||
|
{title: "序号", width: 80, unresize: true, align: "center",
|
||||||
|
templet: function (d) {
|
||||||
|
return (page - 1) * limit + d.LAY_INDEX;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{field: "loginName", title: "送样单位", unresize: true, align: "center"},
|
||||||
|
{field: "username", title: "送样人", unresize: true, align: "center"},
|
||||||
|
{field: "userCode", title: "送样时间", unresize: true, align: "center"},
|
||||||
|
{field: "orgName", title: "送样设备", unresize: true, align: "center"},
|
||||||
|
{field: "roleName", title: "收样人", unresize: true, align: "center"},
|
||||||
|
{field: "phone", title: "收样时间", unresize: true, align: "center"},
|
||||||
|
{field: "userType", title: "试验班组", unresize: true, align: "center"},
|
||||||
|
{title: "操作", unresize: true, width: 300, align: "center",
|
||||||
|
templet: function (d) {
|
||||||
|
|
||||||
|
let html = '';
|
||||||
|
// let updaetpwd="<a class=\"layui-icon layui-icon-password\" style='cursor:pointer;' title='修改密码' onclick=\"resetPwd('" + d.id + "')\"></a>";
|
||||||
|
let del="<a class=\"layui-icon layui-icon-delete\" style='cursor:pointer;' title='删除' onclick=\"delData('" + d.id + "')\"></a>"
|
||||||
|
let edit="<a class=\"layui-icon layui-icon-edit\" style='cursor:pointer;' title='修改' onclick=\"addData('" + d.id + "')\"></a>";
|
||||||
|
html=edit+del;
|
||||||
|
if(d.delFlag==1){
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
done: function (res, curr, count) {
|
||||||
|
layer.close(loadingMsg);
|
||||||
|
table.resize("table_data");
|
||||||
|
count || this.elem.next(".layui-table-view").find(".layui-table-header").css("display", "inline-block");
|
||||||
|
count || this.elem.next(".layui-table-view").find(".layui-table-box").css("overflow", "auto");
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 获取参数
|
||||||
|
function getReqParams(page, limit, type) {
|
||||||
|
let obj = {};
|
||||||
|
if (!type) {
|
||||||
|
obj = {
|
||||||
|
page: page + "",
|
||||||
|
limit: limit + "",
|
||||||
|
userName: $('#userName').val(),
|
||||||
|
phone: $('#phone').val(),
|
||||||
|
orgId: $('#orgId').val(),
|
||||||
|
userType: $('#userType').val(),
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
obj = {
|
||||||
|
page: '1',
|
||||||
|
limit: '10',
|
||||||
|
userName: '',
|
||||||
|
phone:'',
|
||||||
|
orgId:'',
|
||||||
|
userType: '',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
console.log(obj)
|
||||||
|
obj={
|
||||||
|
encryptedData:encryptCBC(JSON.stringify(obj))
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询/重置
|
||||||
|
function query() {
|
||||||
|
let pattern = new RegExp("[%_<>]");
|
||||||
|
if (pattern.test($("#loginName").val())) {
|
||||||
|
$("#loginName").val('');
|
||||||
|
return layer.msg('用户名查询包含特殊字符,请重新输入', {
|
||||||
|
icon: 2,
|
||||||
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (pattern.test($("#phone").val())) {
|
||||||
|
$("#phone").val('');
|
||||||
|
return layer.msg('手机号查询包含特殊字符,请重新输入', {
|
||||||
|
icon: 2,
|
||||||
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
pageNum = 1;
|
||||||
|
pages(1, limitSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//重置
|
||||||
|
function reset() {
|
||||||
|
pages(1, limitSize, 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function reloadData() {
|
||||||
|
pages(pageNum, limitSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增/修改平台用户
|
||||||
|
function addData(id) {
|
||||||
|
let title = '新增用户'
|
||||||
|
if (id) {
|
||||||
|
title = '修改用户';
|
||||||
|
}
|
||||||
|
let param = {
|
||||||
|
'id': id
|
||||||
|
}
|
||||||
|
openIframe2("addOrEditUser", title, "child/userForm.html", '1000px', '625px', param);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*删除用户*/
|
||||||
|
function delData(id) {
|
||||||
|
layer.confirm("确定删除吗?", {
|
||||||
|
move: false
|
||||||
|
}, function () {
|
||||||
|
let loadingMsg = layer.msg('数据删除中,请稍候...', {icon: 16, scrollbar: false, time: 0});
|
||||||
|
let url = dataUrl + "/users/delById";
|
||||||
|
let params = {
|
||||||
|
'id': id
|
||||||
|
}
|
||||||
|
params={
|
||||||
|
encryptedData:encryptCBC(JSON.stringify(params))
|
||||||
|
}
|
||||||
|
ajaxRequest(url, "POST", params, true, function () {
|
||||||
|
}, function (result) {
|
||||||
|
layer.close(loadingMsg); // 关闭提示层
|
||||||
|
if (result.code === 200) {
|
||||||
|
parent.layer.msg(result.msg, {icon: 1})
|
||||||
|
query()
|
||||||
|
} else if (result.code === 500) {
|
||||||
|
layer.alert(result.msg, {icon: 2})
|
||||||
|
}
|
||||||
|
}, function (xhr) {
|
||||||
|
layer.close(loadingMsg); // 关闭提示层
|
||||||
|
error(xhr)
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 启用/停用/解除锁定
|
||||||
|
function editUserAccountStatus(id, status, type) {
|
||||||
|
let url = dataUrl + "/sys/user/editUserAccountStatus?token=" + token;
|
||||||
|
let params = {
|
||||||
|
'id': id,
|
||||||
|
'accountStatus': status,
|
||||||
|
'type': type
|
||||||
|
}
|
||||||
|
ajaxRequest(url, "POST", params, true, function () {
|
||||||
|
}, function (result) {
|
||||||
|
if (result.code === 200) {
|
||||||
|
if(type){
|
||||||
|
reloadData();
|
||||||
|
}
|
||||||
|
parent.layer.msg(result.msg, {icon: 1})
|
||||||
|
} else if (result.code === 500) {
|
||||||
|
layer.alert(result.msg, {icon: 2})
|
||||||
|
}
|
||||||
|
}, function (xhr) {
|
||||||
|
error(xhr)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 管理员修改密码
|
||||||
|
function resetPwd(id) {
|
||||||
|
let param = {
|
||||||
|
'id': id,
|
||||||
|
'type': '1'
|
||||||
|
}
|
||||||
|
openIframe2("addOrEditUnifyUser", '修改密码', "password.html", '770px', '400px', param);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getOrgTree() {
|
||||||
|
let data = [];
|
||||||
|
let url = dataUrl + '/users/getOrg';
|
||||||
|
ajaxRequest(url, "POST", null, true, function () {
|
||||||
|
}, function (result) {
|
||||||
|
if (result.code === 200) {
|
||||||
|
console.log(result,"getOrgTree")
|
||||||
|
data = result.data;
|
||||||
|
setOrgTree(data)
|
||||||
|
} else {
|
||||||
|
layer.alert(result.msg, {icon: 2})
|
||||||
|
}
|
||||||
|
}, function (xhr) {
|
||||||
|
error(xhr)
|
||||||
|
});
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setOrgTree(data){
|
||||||
|
console.log("data",data)
|
||||||
|
orgTree = dtree.renderSelect({
|
||||||
|
elem: "#orgId",
|
||||||
|
data: data,
|
||||||
|
dataFormat: "list",
|
||||||
|
skin: "laySimple",
|
||||||
|
line: true, // 显示树线
|
||||||
|
checkbar: false, //开启复选框
|
||||||
|
done: function (data, url, first) {
|
||||||
|
console.log($('#orgId').val())
|
||||||
|
if (first) {
|
||||||
|
var params = dtree.dataInit("orgId", $('#orgId').val());
|
||||||
|
var selectParam = dtree.selectVal("orgId");
|
||||||
|
console.log(params)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/*下拉选表单赋值*/
|
||||||
|
function setSelectValue(list, selectName) {
|
||||||
|
let html = '<option value="" selected>单位部门</option>';
|
||||||
|
$.each(list, function (index, item) {
|
||||||
|
html += '<option value="' + item.id + '">' + item.name + '</option>';
|
||||||
|
})
|
||||||
|
$('#' + selectName).empty().append(html);
|
||||||
|
layui.form.render();
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<link rel="stylesheet" href="../../js/layui-v2.6.8/css/layui.css" media="all">
|
||||||
|
<link rel="stylesheet" href="../../js/layui-v2.6.8/dtree/dtree.css">
|
||||||
|
<link rel="stylesheet" href="../../js/layui-v2.6.8/dtree/font/dtreefont.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>
|
||||||
|
<div id="content">
|
||||||
|
<div class="basic-search-box layout">
|
||||||
|
<form class="layui-form basic-form" onsubmit="return false;">
|
||||||
|
<div class="layui-form-item">
|
||||||
|
|
||||||
|
<div class="layui-inline" style="padding: 0 0 0 10px;">
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<select id="devTypeId" name="userType" class="form-control input-sm">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-inline" style="padding: 0 0 0 10px;">
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<input type="text" id="userName" maxlength="30" class="layui-input" autocomplete="off" placeholder="请输入用户名">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="layui-inline btns">
|
||||||
|
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm btn-1" onclick="query(1)">查询
|
||||||
|
</button>
|
||||||
|
<button type="button" class="layui-btn layui-btn-primary layui-btn-sm btn-2"
|
||||||
|
onclick="addData(null)">
|
||||||
|
<div class="layout" style="justify-content: space-around;"><img
|
||||||
|
src="../../img/form/add_icon3.png">
|
||||||
|
<p>新增</p></div>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="table-box" table-responsive style="z-index: 1;">
|
||||||
|
<table id="table_data" class="table" lay-filter="table_data"></table>
|
||||||
|
<div id="voi-page" class="layout"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
<style>
|
||||||
|
.layui-table-init {
|
||||||
|
background-color: transparent !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script type="text/html" id="is-state">
|
||||||
|
<input type="checkbox" name="state" value="{{d.id}}" lay-skin="switch" lay-text="开|关"
|
||||||
|
lay-filter="is-state"
|
||||||
|
{{ d.state== 1 ? 'checked' : '' }}>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script src="../../js/tools/toolsMge.js" charset="UTF-8" type="text/javascript"></script>
|
||||||
|
</html>
|
||||||
Loading…
Reference in New Issue