软测单独项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

180 lines
7.5 KiB

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>设备管理--方亚智慧安全社区后台管理</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet" href="../../layui/css/layui.css" media="all" />
<link rel="stylesheet" href="../../css/public.css" media="all" />
<link rel="stylesheet" href="../../css/ztree/metro/ztree.css">
<script src="../../js/jquery-2.1.3.min.js" type="text/javascript"></script>
<script src="../../js/jq_extend.js"></script>
<script src="../../js/jquery.cookie.js" type="text/javascript"></script>
</head>
<body>
<blockquote class="layui-elem-quote quoteBox">
<form class="layui-form">
<div class="layui-inline">
<a class="layui-btn layui-btn-normal empconfig">人员配置</a>
</div>
</form>
</blockquote>
<table id="shiftsMansList" lay-filter="shiftsMansList"></table>
<!--操作-->
<script type="text/html" id="shiftsMansBar">
<a lay-event="del"><img src="../../images/del.png" style="height:20px; width:20px; margin-right: 20px; cursor:pointer;" title="删除" /></a>
</script>
<script type="text/javascript" src="../../layui/layui.js"></script>
<script type="text/javascript">
layui.config({
base: '../../js/'
}).use(['ztree', 'form', 'layer', 'table', 'laytpl', "laydate", "upload"], function () {
var form = layui.form,
layer = parent.layer === undefined ? layui.layer : top.layer,
$ = layui.jquery,
laytpl = layui.laytpl,
table = layui.table,
laydate = layui.laydate,
upload = layui.upload;
var OrgId = JSON.parse(window.sessionStorage.getItem("userInfo")).OrgID;
//OrgId = "fc21743dcaad4225b8be141dd47d8a2f";
var mansuids = [];
//系统列表
table.render({
elem: '#shiftsMansList',
url: '../../ashx/FireShiftsHandler.ashx',
where: { Action: 'ShiftsMansList', OrgId: OrgId, random: new Date().getTime() },
cellMinWidth: 95,
page: false,
height: "full-125",
id: "shiftsMansListTable",
cols: [[
{ field: 'EMP_NAME', title: '姓名', minWidth: 80, align: "center" },
{ field: 'EMP_MOBILE', title: '联系方式', minWidth: 240, align: "center" },
{ fixed: 'right', title: '操作', align: 'center', toolbar: '#shiftsMansBar' }
]],
done: function (res, curr, count) {
mansuids = [];
for (var i = 0; i < res.data.length; i++) {
mansuids.push(res.data[i].USERS_UID);
}
}
});
//监听工具条
table.on('tool(shiftsMansList)', function (obj) {
var data = obj.data;
var layEvent = obj.event;
if (layEvent == 'del') {//删除
Del(data);
}
});
//table重新加载
function reload() {
table.reload("shiftsMansListTable", {
where: {
Action: 'ShiftsMansList',
OrgId: OrgId,
random: new Date().getTime() //随机参数
}
})
}
function Del(edit) {
layer.confirm('确定要删除选中的人员?', { icon: 3, title: '提示信息' }, function (index) {
//提交信息
$.post("../../ashx/FireShiftsHandler.ashx", {
Action: "DelShiftsMans",
id: edit.ID,
random: new Date().getTime() //随机参数
}, function (res) {
res = $.parseJSON(res);
console.log(res);
if (res.code == 1) {
top.layer.msg(res.msg);
reload();
ArryRemove(mansuids, edit.ID);
} else {
top.layer.msg(res.msg);
}
});
});
}
function ArryRemove(arr,item) {
var index = arr.indexOf(item);
if (index > -1) {
arr.splice(index, 1);
}
};
//人员配置
$(".empconfig").click(function () {
layui.layer.open({
type: 2,
title: '人员选择',
area: ['260px', '420px'],
content: 'ShiftsMansTree.html',
btn: ['确定'],
success: function (layero, index) {
var pid = $("#acc_pplId").val();
var body = layui.layer.getChildFrame('body', index);
body.find("#treeID").val(pid);
},
yes: function (index, layero) {
var iframeWin = window[layero.find('iframe')[0]['name']];
var datas = iframeWin.window.returnData();
datas = JSON.parse(datas);
var treeId = "", treeName = "", count = 0, temporary = [];;
var dataContend = [];
for (var i = 0; i < datas.length; i++) {
if (datas[i].TYPE == "emp") {
if (mansuids.indexOf(datas[i].ID) == -1) {
var acc_pplobj = new Object();
acc_pplobj.USERS_UID = datas[i].ID;
acc_pplobj.EMP_NAME = datas[i].NAME;
acc_pplobj.EMP_MOBILE = datas[i].MOBILE;
dataContend.push(acc_pplobj);
temporary.push(datas[i].ID);
}
}
}
Add(dataContend, temporary);
layui.layer.close(index); //如果设定了yes回调,需进行手工关闭
}
})
})
function Add(dataContend, temporary) {
//提交信息
$.post("../../ashx/FireShiftsHandler.ashx", {
Action: "AddShiftsMans",
OrgId: OrgId,
dataContend: JSON.stringify(dataContend),
random: new Date().getTime() //随机参数
}, function (res) {
res = $.parseJSON(res);
if (res.code == 1) {
top.layer.msg(res.msg);
mansuids.push.apply(mansuids, temporary);
reload();
} else {
top.layer.msg(res.msg);
}
})
}
})
</script>
</body>
</html>