基础管理
This commit is contained in:
parent
5e2a7ca68f
commit
36b086c294
|
|
@ -0,0 +1,199 @@
|
||||||
|
let form, layer, table, tableIns;
|
||||||
|
let pageNum = 1, limitSize = 10; // 默认第一页,分页数量为10
|
||||||
|
layui.use(['form', 'layer', 'table', 'laydate'], function () {
|
||||||
|
form = layui.form;
|
||||||
|
layer = layui.layer;
|
||||||
|
table = layui.table;
|
||||||
|
layui.form.render();
|
||||||
|
pages(1, 10, 1);
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
function pages(pageNum, pageSize, typeNum) {
|
||||||
|
let params = getReqParams(pageNum, pageSize, typeNum);
|
||||||
|
let url = dataUrl + "/teamconfigs/getListTemp"
|
||||||
|
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: [
|
||||||
|
[
|
||||||
|
{type: 'checkbox', width: '5%', fixed: 'left'},
|
||||||
|
//表头
|
||||||
|
{title: "序号", width: 80, unresize: true, align: "center",
|
||||||
|
templet: function (d) {
|
||||||
|
return (page - 1) * limit + d.LAY_INDEX;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{field: "teamConfigId", title: "ID", unresize: true, align: "center",hide:true},
|
||||||
|
{field: "teamConfigName", title: "姓名", unresize: true, align: "center"},
|
||||||
|
{field: "teamConfigJobNumber", title: "工号", unresize: true, align: "center"},
|
||||||
|
{field: "teamConfigSex", title: "性别", unresize: true, align: "center",
|
||||||
|
templet: function (d) {
|
||||||
|
if (d.teamConfigSex == 0) {
|
||||||
|
return "女";
|
||||||
|
} else if (d.teamConfigSex == 1) {
|
||||||
|
return "男";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// {field: "teamConfigTeamId", title: "班组id", unresize: true, align: "center"},
|
||||||
|
{field: "teamConfigPhone", title: "联系电话", unresize: true, align: "center"},
|
||||||
|
{title: "操作", unresize: true, width: 300, align: "center",
|
||||||
|
templet: function (d) {
|
||||||
|
|
||||||
|
let html = '';
|
||||||
|
let add="<a class=\"layui-icon layui-icon-edit\" style='cursor:pointer;' title='添加到该班组' onclick=\"addData('" + areaIdParam + "','" + d.teamConfigId + "')\"></a>"
|
||||||
|
html=add;
|
||||||
|
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 + "",
|
||||||
|
keyWord: $('#keyWord').val(),
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
obj = {
|
||||||
|
page: '1',
|
||||||
|
limit: '10',
|
||||||
|
keyWord: '',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
console.log(obj)
|
||||||
|
obj={
|
||||||
|
encryptedData:encryptCBC(JSON.stringify(obj))
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询/重置
|
||||||
|
function query() {
|
||||||
|
let pattern = new RegExp("[%_<>]");
|
||||||
|
pageNum = 1;
|
||||||
|
pages(1, limitSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
function reloadData() {
|
||||||
|
pages(pageNum, limitSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取选中的数据
|
||||||
|
function getCheckedValues() {
|
||||||
|
let data = table.checkStatus("table_data").data;
|
||||||
|
let ids = []
|
||||||
|
if (data.length === 0) {
|
||||||
|
return ids;
|
||||||
|
}
|
||||||
|
for (let i = 0; i < data.length; i++) {
|
||||||
|
ids.push(data[i].teamConfigId);
|
||||||
|
}
|
||||||
|
return ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 批量添加
|
||||||
|
function batchAddData() {
|
||||||
|
let ids = getCheckedValues();
|
||||||
|
console.log(ids);
|
||||||
|
let id = areaIdParam;
|
||||||
|
if (ids.length === 0) {
|
||||||
|
return layer.msg('至少添加一行数据', {icon: 7})
|
||||||
|
} else {
|
||||||
|
addTeamConfigData(ids.toString(),id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*修改用户*/
|
||||||
|
function addData(id,teamConfigId) {
|
||||||
|
layer.confirm("确定添加到该班组吗?", {
|
||||||
|
move: false
|
||||||
|
}, function () {
|
||||||
|
let loadingMsg = layer.msg('数据添加中,请稍候...', {icon: 16, scrollbar: false, time: 0});
|
||||||
|
let url = dataUrl + "/teamconfigs/addById";
|
||||||
|
let params = {
|
||||||
|
'id':id,
|
||||||
|
'teamConfigId': teamConfigId
|
||||||
|
}
|
||||||
|
console.log(params);
|
||||||
|
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 setParams(params){
|
||||||
|
let obj = JSON.parse(params)
|
||||||
|
console.log(obj)
|
||||||
|
areaIdParam = obj.id
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,177 @@
|
||||||
|
let form, layer, dtree, util, idParam, phoneParam,statusParam;
|
||||||
|
let arr = ['background', 'web', 'mobile', 'wx'];
|
||||||
|
let background, web, mobile, wx;
|
||||||
|
let data = [], appResList = [];
|
||||||
|
// 角色下拉选
|
||||||
|
let roleList;
|
||||||
|
getTeamSelected();
|
||||||
|
function setParams(params) {
|
||||||
|
idParam = JSON.parse(params).customId;
|
||||||
|
// statusParam = 0;
|
||||||
|
console.log(idParam)
|
||||||
|
layui.config({
|
||||||
|
base: "../../../js/layui-v2.6.8/dtree/", //此处路径请自行处理, 可以使用绝对路径
|
||||||
|
}).extend({
|
||||||
|
dtree: 'dtree'
|
||||||
|
}).use(['form', 'layer', 'util'], function () {
|
||||||
|
layer = layui.layer;
|
||||||
|
form = layui.form;
|
||||||
|
util = layui.util;
|
||||||
|
form.on('submit(formData)', function (data) {
|
||||||
|
data.field.id = $('#id').val();
|
||||||
|
// data.field.customStatus = $('#customStatus').val();
|
||||||
|
// data.field.type = !$('#id').val() ? '1' : '2';
|
||||||
|
saveData(data);
|
||||||
|
});
|
||||||
|
// form.on('switch',function(data){
|
||||||
|
// if(data.elem.checked==true){
|
||||||
|
// statusParam = 1;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// });
|
||||||
|
form.verify(
|
||||||
|
{
|
||||||
|
required: function (value, item) {
|
||||||
|
let customPhone = $('#customPhone').val();
|
||||||
|
if(customPhone){
|
||||||
|
if (!(/^1[3456789]\d{9}$/.test(customPhone))) {
|
||||||
|
return '请输入正确的手机号';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
// if (idParam) {
|
||||||
|
// getFormbyId();
|
||||||
|
// }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据id获取用户信息
|
||||||
|
function getFormbyId() {
|
||||||
|
let loadingMsg = layer.msg("数据加载中,请稍候...", {icon: 16, scrollbar: false, time: 0,});
|
||||||
|
let url = dataUrl + "/customs/getCustomId?token=" + tokens;
|
||||||
|
let params = {
|
||||||
|
customId: idParam
|
||||||
|
}
|
||||||
|
params={
|
||||||
|
encryptedData:encryptCBC(JSON.stringify(params))
|
||||||
|
}
|
||||||
|
|
||||||
|
ajaxRequest(url, "POST", params, true, function () {
|
||||||
|
}, function (result) {
|
||||||
|
layer.close(loadingMsg); // 关闭提示层
|
||||||
|
if (result.code === 200) {
|
||||||
|
setFormData(result.data);
|
||||||
|
} else {
|
||||||
|
layer.alert(result.msg, {icon: 2})
|
||||||
|
}
|
||||||
|
}, function (xhr) {
|
||||||
|
layer.close(loadingMsg); // 关闭提示层
|
||||||
|
error(xhr)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置表单内容
|
||||||
|
function setFormData(data) {
|
||||||
|
if (data) {
|
||||||
|
form.val('formInfo',data)
|
||||||
|
// if(data.customStatus == 1){
|
||||||
|
// $("#customStatus").prop("checked", 1);
|
||||||
|
// }else{
|
||||||
|
// $("#customStatus").prop("checked", 0);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
deptId = data.deptId;
|
||||||
|
pid = data.pid
|
||||||
|
console.log(data)
|
||||||
|
form.render();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveData2() {
|
||||||
|
$('#formSubmit').trigger('click')
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存数据
|
||||||
|
function saveData(data) {
|
||||||
|
let loadingMsg = layer.msg('数据上传中,请稍候...', {icon: 16, scrollbar: false, time: 0});
|
||||||
|
|
||||||
|
let params = data.field;
|
||||||
|
params.customId = idParam;
|
||||||
|
// params.customStatus = statusParam;
|
||||||
|
let path_url = '';
|
||||||
|
path_url = 'addDeptCustom';
|
||||||
|
|
||||||
|
let url = dataUrl + "/customs/" + path_url + "?token=" + tokens;
|
||||||
|
|
||||||
|
params = {
|
||||||
|
encryptedData: encryptCBC(JSON.stringify(params))
|
||||||
|
}
|
||||||
|
|
||||||
|
ajaxRequest(url, "POST", params, true, function () {
|
||||||
|
$('.save').addClass("layui-btn-disabled").attr("disabled", true);
|
||||||
|
$('.cancel').addClass("layui-btn-disabled").attr("disabled", true);
|
||||||
|
}, function (result) {
|
||||||
|
console.log(result)
|
||||||
|
layer.close(loadingMsg); // 关闭提示层
|
||||||
|
if (result.code === 200) {
|
||||||
|
parent.layer.msg(result.msg, {icon: 1,time:1000},function (){
|
||||||
|
closePage(1);
|
||||||
|
})
|
||||||
|
// closePage(1);
|
||||||
|
// parent.layer.msg(result.data, {icon: 1});
|
||||||
|
} else if (result.code === 500) {
|
||||||
|
layer.alert(result.msg, {icon: 2})
|
||||||
|
$('.save').removeClass("layui-btn-disabled").attr("disabled", false);
|
||||||
|
$('.cancel').removeClass("layui-btn-disabled").attr("disabled", false);
|
||||||
|
} else if (result.code === 204) {
|
||||||
|
layer.alert(result.msg, {icon: 2})
|
||||||
|
$('.save').removeClass("layui-btn-disabled").attr("disabled", false);
|
||||||
|
$('.cancel').removeClass("layui-btn-disabled").attr("disabled", false);
|
||||||
|
}
|
||||||
|
}, function (xhr) {
|
||||||
|
layer.close(loadingMsg); // 关闭提示层
|
||||||
|
$('.save').removeClass("layui-btn-disabled").attr("disabled", false);
|
||||||
|
$('.cancel').removeClass("layui-btn-disabled").attr("disabled", false);
|
||||||
|
error(xhr)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 关闭页面
|
||||||
|
function closePage(type) {
|
||||||
|
let index = parent.layer.getFrameIndex(window.name); //先得到当前 iframe层的索引
|
||||||
|
parent.layer.close(index); //再执行关闭
|
||||||
|
if (type === 1) {
|
||||||
|
parent.reloadData()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function getTeamSelected() {
|
||||||
|
debugger
|
||||||
|
let url = dataUrl + '/customs/all';
|
||||||
|
ajaxRequest(url, "POST", null, true, function () {
|
||||||
|
}, function (result) {
|
||||||
|
if (result.code === 200) {
|
||||||
|
setSelectValue(result.data, 'pid');
|
||||||
|
// return result.data
|
||||||
|
} else {
|
||||||
|
layer.alert(result.msg, {icon: 2})
|
||||||
|
}
|
||||||
|
}, function (xhr) {
|
||||||
|
error(xhr)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/*下拉选表单赋值*/
|
||||||
|
// function setSelectValue(list, selectName) {
|
||||||
|
// let html = '<option value="" selected>请选择</option>';
|
||||||
|
// $.each(list, function (index, item) {
|
||||||
|
// html += '<option value="' + item.pid + '">' + item.customName + '</option>';
|
||||||
|
// })
|
||||||
|
// $('#' + selectName).empty().append(html);
|
||||||
|
// layui.form.render();
|
||||||
|
// }
|
||||||
|
|
@ -0,0 +1,63 @@
|
||||||
|
// 智慧楼宇区域树
|
||||||
|
function getDTreeData() {
|
||||||
|
let dataList = [];
|
||||||
|
let url = dataUrl + "/teamconfigs/getTeamTree";
|
||||||
|
ajaxRequest(url, "POST", null, false, function () {
|
||||||
|
}, function (result) {
|
||||||
|
if (result.status === 200) {
|
||||||
|
dataList = result.data;
|
||||||
|
} else if (result.status === 500) {
|
||||||
|
layer.alert(result.msg, {icon: 2, move: false})
|
||||||
|
}
|
||||||
|
}, function (xhr) {
|
||||||
|
error(xhr)
|
||||||
|
});
|
||||||
|
return dataList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*批量添加*/
|
||||||
|
function addTeamConfigData(ids,id) {
|
||||||
|
layer.confirm("确定添加吗?", {
|
||||||
|
move: false
|
||||||
|
}, function () {
|
||||||
|
let loadingMsg = layer.msg('数据添加中,请稍候...', {icon: 16, scrollbar: false, time: 0});
|
||||||
|
let url = dataUrl + "/teamconfigs/addTeamConfigData"
|
||||||
|
console.log(ids)
|
||||||
|
let obj = {
|
||||||
|
'id':id,
|
||||||
|
'teamConfigIdTemp': ids
|
||||||
|
}
|
||||||
|
// console.log(params)
|
||||||
|
params = {
|
||||||
|
encryptedData: encryptCBC(JSON.stringify(obj))
|
||||||
|
}
|
||||||
|
console.log(params)
|
||||||
|
ajaxRequest(url, "POST", params, true, function () {
|
||||||
|
}, function (result) {
|
||||||
|
layer.close(loadingMsg); // 关闭提示层
|
||||||
|
if (result.status === 200) {
|
||||||
|
parent.layer.msg(result.msg, {icon: 1,time:1000},function (){
|
||||||
|
closePageTemp(1);
|
||||||
|
})
|
||||||
|
|
||||||
|
} else if (result.status === 500) {
|
||||||
|
layer.alert(result.msg, {icon: 2})
|
||||||
|
}
|
||||||
|
}, function (xhr) {
|
||||||
|
layer.close(loadingMsg); // 关闭提示层
|
||||||
|
error(xhr)
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function reloadTableData() {
|
||||||
|
pages(pageNum, limitSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
function closePageTemp(type) {
|
||||||
|
let index = parent.layer.getFrameIndex(window.name); //先得到当前 iframe层的索引
|
||||||
|
parent.layer.close(index); //再执行关闭
|
||||||
|
if (type === 1) {
|
||||||
|
parent.reloadTableData()()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,185 @@
|
||||||
|
function pages(pageNum, pageSize, typeNum) {
|
||||||
|
let params = getReqParams(pageNum, pageSize, typeNum);
|
||||||
|
$.ajax({
|
||||||
|
url: dataUrl + "/teamconfigs/getList",
|
||||||
|
headers: {
|
||||||
|
"token": tokens
|
||||||
|
},
|
||||||
|
data: params,
|
||||||
|
type: 'POST',
|
||||||
|
async: false,
|
||||||
|
success: function (result) {
|
||||||
|
if (result.status === 200) {
|
||||||
|
if (result.data) {
|
||||||
|
initTable(result.data, result.limit, result.curr)
|
||||||
|
laypages(result.count, result.curr, result.limit)
|
||||||
|
}
|
||||||
|
} else if (result.status === 500) {
|
||||||
|
layer.alert(result.msg, {icon: 2})
|
||||||
|
}
|
||||||
|
}, error: 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(pageNum, limitSize, 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: "teamConfigId", title: "ID", unresize: true, align: "center",hide:true},
|
||||||
|
{field: "teamConfigName", title: "姓名", unresize: true, align: "center"},
|
||||||
|
{field: "teamConfigJobNumber", title: "工号", unresize: true, align: "center"},
|
||||||
|
{field: "teamConfigSex", title: "性别", unresize: true, align: "center",
|
||||||
|
templet: function (d) {
|
||||||
|
if (d.teamConfigSex == 0) {
|
||||||
|
return "女";
|
||||||
|
} else if (d.teamConfigSex == 1) {
|
||||||
|
return "男";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{field: "teamConfigPhone", title: "联系电话", unresize: true, align: "center"},
|
||||||
|
{title: "操作", unresize: true, width: 300, align: "center",
|
||||||
|
templet: function (d) {
|
||||||
|
|
||||||
|
let html = '';
|
||||||
|
let del="<a class=\"layui-icon layui-icon-delete\" style='cursor:pointer;' title='从该班组中移除' onclick=\"delData('" + d.teamConfigId + "')\"></a>"
|
||||||
|
html=del;
|
||||||
|
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 + "",
|
||||||
|
id: areaIdParam,
|
||||||
|
parentId: parentIdParam,
|
||||||
|
level: levelParam,
|
||||||
|
keyWord: $('#keyWord').val(),
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
obj = {
|
||||||
|
page: '1',
|
||||||
|
limit: '10',
|
||||||
|
id: areaIdParam,
|
||||||
|
parentId: parentIdParam,
|
||||||
|
level: levelParam,
|
||||||
|
keyWord: '',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
console.log(obj)
|
||||||
|
obj={
|
||||||
|
encryptedData:encryptCBC(JSON.stringify(obj))
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
function reloadTableData() {
|
||||||
|
pages(pageNum, limitSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询/重置
|
||||||
|
function query() {
|
||||||
|
let pattern = new RegExp("[%_<>]");
|
||||||
|
if (pattern.test($("#keyWord").val())) {
|
||||||
|
$("#keyWord").val('');
|
||||||
|
return layer.msg('关键字查询包含特殊字符,请重新输入', {
|
||||||
|
icon: 2,
|
||||||
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
pageNum = 1;
|
||||||
|
pages(1, limitSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*移除用户*/
|
||||||
|
function delData(teamConfigId) {
|
||||||
|
layer.confirm("确定移除吗?", {
|
||||||
|
move: false
|
||||||
|
}, function () {
|
||||||
|
let loadingMsg = layer.msg('数据移除中,请稍候...', {icon: 16, scrollbar: false, time: 0});
|
||||||
|
let url = dataUrl + "/teamconfigs/delById";
|
||||||
|
let params = {
|
||||||
|
'teamConfigId': teamConfigId
|
||||||
|
}
|
||||||
|
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 addTeamConfigData(id) {
|
||||||
|
console.log(areaIdParam)
|
||||||
|
if (levelParam !== '2') {
|
||||||
|
return layer.msg('请选择班组后添加成员', {icon: 7});
|
||||||
|
}
|
||||||
|
let title = '新增成员'
|
||||||
|
|
||||||
|
let param = {
|
||||||
|
'id': areaIdParam,
|
||||||
|
}
|
||||||
|
openIframe2("addOrEditTeamConfigData", title, "child/teamConfigDataForm.html", '1300px', '600px', param);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
let form, layer, dtree, table, tableIns, areaTree, util, dtreeData = [], jsonData = null;
|
||||||
|
let pageNum = 1, limitSize = 10; // 默认第一页,分页数量为10
|
||||||
|
let roomTypeList = [];
|
||||||
|
// 当前选中的节点id和父节点id
|
||||||
|
let areaIdParam = null, parentIdParam = null, levelParam = null;
|
||||||
|
layui.config({
|
||||||
|
base: "../../js/layui-v2.6.8/dtree/", //此处路径请自行处理, 可以使用绝对路径
|
||||||
|
}).extend({
|
||||||
|
dtree: 'dtree'
|
||||||
|
}).use(['form', 'layer', 'table', 'dtree', 'util'], function () {
|
||||||
|
layer = layui.layer;
|
||||||
|
form = layui.form;
|
||||||
|
table = layui.table;
|
||||||
|
dtree = layui.dtree;
|
||||||
|
util = layui.util;
|
||||||
|
form.render();
|
||||||
|
dtreeData = getDTreeData();
|
||||||
|
areaTree = dtree.render({
|
||||||
|
elem: "#areaTree",
|
||||||
|
// scroll: "#left",
|
||||||
|
width: "98%", // 指定树的宽度
|
||||||
|
dataFormat: "list",
|
||||||
|
data: dtreeData,
|
||||||
|
line: true, // 显示树线
|
||||||
|
// skin: "laySimple",
|
||||||
|
toolbar: true,
|
||||||
|
icon: "-1", // 隐藏二级图标
|
||||||
|
toolbarWay: "follow",
|
||||||
|
toolbarShow: [],
|
||||||
|
|
||||||
|
done: function (result, $ul, first) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dtree.on('node("areaTree")', function (obj) {
|
||||||
|
console.log(obj)
|
||||||
|
areaIdParam = obj.param.nodeId, parentIdParam = obj.param.parentId, levelParam = obj.param.level;
|
||||||
|
pageNum = 1, limitSize = 10; // 默认第一页,分页数量为10
|
||||||
|
pages(1, 10, 1);
|
||||||
|
});
|
||||||
|
|
||||||
|
pages(1, 10, 1);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
赋值新增节点
|
||||||
|
function reloadData(data) {
|
||||||
|
jsonData = data;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,182 @@
|
||||||
|
let form, layer, table, tableIns;
|
||||||
|
let pageNum = 1, limitSize = 10; // 默认第一页,分页数量为10
|
||||||
|
layui.use(['form', 'layer', 'table', 'laydate'], function () {
|
||||||
|
form = layui.form;
|
||||||
|
layer = layui.layer;
|
||||||
|
table = layui.table;
|
||||||
|
layui.form.render();
|
||||||
|
// getRoleSelected();
|
||||||
|
pages(1, 10, 1);
|
||||||
|
})
|
||||||
|
|
||||||
|
function pages(pageNum, pageSize, typeNum) {
|
||||||
|
let params = getReqParams(pageNum, pageSize, typeNum);
|
||||||
|
let url = dataUrl + "/expers/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: "devId", title: "ID", unresize: true, align: "center",hide:true},
|
||||||
|
{field: "devName", title: "设备名称", unresize: true, align: "center"},
|
||||||
|
{field: "devModule", title: "设备型号", unresize: true, align: "center"},
|
||||||
|
{field: "devCode", title: "设备编号", unresize: true, align: "center"},
|
||||||
|
{field: "contractDate", title: "合同生效日期", unresize: true, align: "center"},
|
||||||
|
{field: "createTime", title: "创建时间", unresize: true, align: "center"},
|
||||||
|
{field: "updateTime", title: "更新时间", unresize: true, align: "center"},
|
||||||
|
{field: "dataSource", title: "数据来源", unresize: true, align: "center",
|
||||||
|
templet: function (d) {
|
||||||
|
if (d.dataSource == 0) {
|
||||||
|
return "新增";
|
||||||
|
} else if (d.dataSource == 1) {
|
||||||
|
return "实验配置";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{title: "操作", unresize: true, width: 300, align: "center",
|
||||||
|
templet: function (d) {
|
||||||
|
|
||||||
|
let html = '';
|
||||||
|
let del="<a class=\"layui-icon layui-icon-delete\" style='cursor:pointer;' title='删除' onclick=\"delData('" + d.devId + "')\"></a>"
|
||||||
|
let edit="<a class=\"layui-icon layui-icon-edit\" style='cursor:pointer;' title='修改' onclick=\"addData('" + d.devId + "')\"></a>";
|
||||||
|
html=edit+del;
|
||||||
|
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 + "",
|
||||||
|
keyWord: $('#keyWord').val(),
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
obj = {
|
||||||
|
page: '1',
|
||||||
|
limit: '10',
|
||||||
|
keyWord: '',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
console.log(obj)
|
||||||
|
obj={
|
||||||
|
encryptedData:encryptCBC(JSON.stringify(obj))
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function reloadData() {
|
||||||
|
pages(pageNum, limitSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询/重置
|
||||||
|
function query() {
|
||||||
|
let pattern = new RegExp("[%_<>]");
|
||||||
|
pageNum = 1;
|
||||||
|
pages(1, limitSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增/修改实验设备
|
||||||
|
function addData(devId) {
|
||||||
|
console.log()
|
||||||
|
let title = '新增实验设备'
|
||||||
|
if (devId) {
|
||||||
|
title = '修改实验设备';
|
||||||
|
}
|
||||||
|
let param = {
|
||||||
|
'devId': devId
|
||||||
|
}
|
||||||
|
openIframe2("addOrEditFormDevice", title, "deviceAddForm.html", '1000px', '700px', param);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*删除设备*/
|
||||||
|
function delData(devId) {
|
||||||
|
layer.confirm("确定删除吗?", {
|
||||||
|
move: false
|
||||||
|
}, function () {
|
||||||
|
let loadingMsg = layer.msg('数据删除中,请稍候...', {icon: 16, scrollbar: false, time: 0});
|
||||||
|
let url = dataUrl + "/expers/delById";
|
||||||
|
let params = {
|
||||||
|
'devId': devId
|
||||||
|
}
|
||||||
|
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)
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,134 @@
|
||||||
|
let form, layer, dtree, util, idParam, phoneParam;
|
||||||
|
let arr = ['background', 'web', 'mobile', 'wx'];
|
||||||
|
let background, web, mobile, wx;
|
||||||
|
let data = [], appResList = [];
|
||||||
|
// 角色下拉选
|
||||||
|
let roleList;
|
||||||
|
|
||||||
|
|
||||||
|
layui.use(['laydate'],function(){
|
||||||
|
var laydate = layui.laydate;
|
||||||
|
// 渲染
|
||||||
|
laydate.render({
|
||||||
|
elem: '#contractDate',
|
||||||
|
type: 'datetime'
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function setParams(params) {
|
||||||
|
idParam = JSON.parse(params).devId;
|
||||||
|
console.log(idParam)
|
||||||
|
layui.config({
|
||||||
|
base: "../../../js/layui-v2.6.8/dtree/", //此处路径请自行处理, 可以使用绝对路径
|
||||||
|
}).extend({
|
||||||
|
dtree: 'dtree'
|
||||||
|
}).use(['form', 'layer', 'util'], function () {
|
||||||
|
layer = layui.layer;
|
||||||
|
form = layui.form;
|
||||||
|
util = layui.util;
|
||||||
|
form.on('submit(formData)', function (data) {
|
||||||
|
data.field.id = $('#id').val();
|
||||||
|
saveData(data);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (idParam) {
|
||||||
|
getFormbyId();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据id获取设备信息
|
||||||
|
function getFormbyId() {
|
||||||
|
let loadingMsg = layer.msg("数据加载中,请稍候...", {icon: 16, scrollbar: false, time: 0,});
|
||||||
|
let url = dataUrl + "/expers/getDeviceId?token=" + tokens;
|
||||||
|
let params = {
|
||||||
|
devId: idParam
|
||||||
|
}
|
||||||
|
params={
|
||||||
|
encryptedData:encryptCBC(JSON.stringify(params))
|
||||||
|
}
|
||||||
|
|
||||||
|
ajaxRequest(url, "POST", params, true, function () {
|
||||||
|
}, function (result) {
|
||||||
|
layer.close(loadingMsg); // 关闭提示层
|
||||||
|
if (result.code === 200) {
|
||||||
|
setFormData(result.data);
|
||||||
|
} else {
|
||||||
|
layer.alert(result.msg, {icon: 2})
|
||||||
|
}
|
||||||
|
}, function (xhr) {
|
||||||
|
layer.close(loadingMsg); // 关闭提示层
|
||||||
|
error(xhr)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置表单内容
|
||||||
|
function setFormData(data) {
|
||||||
|
if (data) {
|
||||||
|
form.val('formInfo',data)
|
||||||
|
devId = data.devId
|
||||||
|
form.render();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveData2() {
|
||||||
|
$('#formSubmit').trigger('click')
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存数据
|
||||||
|
function saveData(data) {
|
||||||
|
let loadingMsg = layer.msg('数据上传中,请稍候...', {icon: 16, scrollbar: false, time: 0});
|
||||||
|
|
||||||
|
let params = data.field;
|
||||||
|
params.devId = idParam;
|
||||||
|
// params.customStatus = statusParam;
|
||||||
|
let path_url='';
|
||||||
|
if(params.devId==null || params.devId ==''){
|
||||||
|
path_url='addDevice';
|
||||||
|
}else{
|
||||||
|
path_url="updateDevice";
|
||||||
|
}
|
||||||
|
let url = dataUrl + "/expers/"+path_url+"?token=" + tokens;
|
||||||
|
|
||||||
|
params={
|
||||||
|
encryptedData:encryptCBC(JSON.stringify(params))
|
||||||
|
}
|
||||||
|
|
||||||
|
ajaxRequest(url, "POST", params, true, function () {
|
||||||
|
$('.save').addClass("layui-btn-disabled").attr("disabled", true);
|
||||||
|
$('.cancel').addClass("layui-btn-disabled").attr("disabled", true);
|
||||||
|
}, function (result) {
|
||||||
|
console.log(result)
|
||||||
|
layer.close(loadingMsg); // 关闭提示层
|
||||||
|
if (result.code === 200) {
|
||||||
|
closePage(1);
|
||||||
|
parent.layer.msg(result.data, {icon: 1});
|
||||||
|
} else if (result.code === 500) {
|
||||||
|
layer.alert(result.msg, {icon: 2})
|
||||||
|
$('.save').removeClass("layui-btn-disabled").attr("disabled", false);
|
||||||
|
$('.cancel').removeClass("layui-btn-disabled").attr("disabled", false);
|
||||||
|
}else if (result.code === 204) {
|
||||||
|
layer.alert(result.msg, {icon: 2})
|
||||||
|
$('.save').removeClass("layui-btn-disabled").attr("disabled", false);
|
||||||
|
$('.cancel').removeClass("layui-btn-disabled").attr("disabled", false);
|
||||||
|
}
|
||||||
|
}, function (xhr) {
|
||||||
|
layer.close(loadingMsg); // 关闭提示层
|
||||||
|
$('.save').removeClass("layui-btn-disabled").attr("disabled", false);
|
||||||
|
$('.cancel').removeClass("layui-btn-disabled").attr("disabled", false);
|
||||||
|
error(xhr)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 关闭页面
|
||||||
|
function closePage(type) {
|
||||||
|
let index = parent.layer.getFrameIndex(window.name); //先得到当前 iframe层的索引
|
||||||
|
parent.layer.close(index); //再执行关闭
|
||||||
|
if (type === 1) {
|
||||||
|
parent.reloadData()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,195 @@
|
||||||
|
let form, layer, table, tableIns,idParam,customNumParam;
|
||||||
|
let pageNum = 1, limitSize = 10; // 默认第一页,分页数量为10
|
||||||
|
|
||||||
|
function setParams(params) {
|
||||||
|
idParam = JSON.parse(params).id;
|
||||||
|
customNumParam = JSON.parse(params).customNum;
|
||||||
|
layui.use(['form', 'layer', 'table', 'laydate'], function () {
|
||||||
|
form = layui.form;
|
||||||
|
layer = layui.layer;
|
||||||
|
table = layui.table;
|
||||||
|
layui.form.render();
|
||||||
|
getDevSelected();
|
||||||
|
pages(1, 10, 1);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function pages(pageNum, pageSize, typeNum) {
|
||||||
|
let params = getReqParams(pageNum, pageSize, typeNum);
|
||||||
|
let url = dataUrl + "/experimental/getDetailList"
|
||||||
|
ajaxRequest(url, "POST", params, true, function () {
|
||||||
|
}, function (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: "devTypeName", title: "样品类型", unresize: true, align: "center"},
|
||||||
|
{field: "devModule", title: "规格型号", unresize: true, align: "center"},
|
||||||
|
{field: "sampleQuantity", title: "样品数量", unresize: true, align: "center"},
|
||||||
|
{field: "", title: "状态", unresize: true, align: "center"},
|
||||||
|
{field: "causeOfRejection", title: "驳回原因", unresize: true, align: "center"},
|
||||||
|
{title: "原始记录", unresize: true, width: 300, align: "center",
|
||||||
|
templet: function (d) {
|
||||||
|
var html = '';
|
||||||
|
let search="<a class=\"layui-icon \" style='cursor:pointer;' title='查看' style=\"color: blue;\" onclick=\"checkData('" + d.experId + "','" + d.sampleId + "','"+ d.devTypeCode+"')\">查看</a>";
|
||||||
|
if (d.status == "待试验" || d.status == "待提交" || d.status == "审阅不通过" || d.status == "审核不通过" || d.status == "审批不通过") {
|
||||||
|
let edit="<a class=\"layui-icon \" style='cursor:pointer;' title='编制' style=\"color: blue;\" onclick=\"addData('" + d.experId + "','" + d.sampleId + "','"+ d.devTypeCode+"')\">编制</a>";
|
||||||
|
html=search+edit;
|
||||||
|
} else {
|
||||||
|
html=search;
|
||||||
|
}
|
||||||
|
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) {
|
||||||
|
// console.log(idParam)
|
||||||
|
let obj = {};
|
||||||
|
if (!type) {
|
||||||
|
obj = {
|
||||||
|
page: page + "",
|
||||||
|
limit: limit + "",
|
||||||
|
devTypeCode: $('#devId').val(),
|
||||||
|
id: idParam
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
obj = {
|
||||||
|
page: '1',
|
||||||
|
limit: '10',
|
||||||
|
devTypeCode: '',
|
||||||
|
id: idParam
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// console.log(obj)
|
||||||
|
obj={
|
||||||
|
encryptedData:encryptCBC(JSON.stringify(obj))
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询/重置
|
||||||
|
function query() {
|
||||||
|
pageNum = 1;
|
||||||
|
pages(1, limitSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
function reloadData() {
|
||||||
|
pages(pageNum, limitSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查看
|
||||||
|
function checkData(experId,sampleId,devTypeCode) {
|
||||||
|
let param = {
|
||||||
|
'experId': experId,
|
||||||
|
'sampleId': sampleId,
|
||||||
|
'devTypeCode':devTypeCode,
|
||||||
|
'customNum':customNumParam
|
||||||
|
}
|
||||||
|
openIframeMax("testCheck.html", "查看试验", "testCheck.html", '80%', '100%', param);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 试验新增、修改
|
||||||
|
function addData(experId,sampleId,devTypeCode) {
|
||||||
|
let title = '新增试验'
|
||||||
|
if (experId!=null && experId!='null') {
|
||||||
|
title = '修改试验';
|
||||||
|
}
|
||||||
|
let param = {
|
||||||
|
'experId': experId,
|
||||||
|
'sampleId': sampleId,
|
||||||
|
'devTypeCode':devTypeCode,
|
||||||
|
'customNum':customNumParam
|
||||||
|
}
|
||||||
|
openIframeMax("testForm", title, "testForm.html", '80%', '100%', param);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDevSelected() {
|
||||||
|
let url = dataUrl + '/sys/select/getDicts';
|
||||||
|
let obj = {
|
||||||
|
'code':"dev_code"
|
||||||
|
}
|
||||||
|
let params = {
|
||||||
|
encryptedData: encryptCBC(JSON.stringify(obj))
|
||||||
|
}
|
||||||
|
|
||||||
|
ajaxRequest(url, "POST", params, true, function () {
|
||||||
|
}, function (result) {
|
||||||
|
if (result.code === 200) {
|
||||||
|
setSelectValue(result.data, 'devId');
|
||||||
|
// return result.data
|
||||||
|
} else {
|
||||||
|
layer.alert(result.msg, {icon: 2})
|
||||||
|
}
|
||||||
|
}, function (xhr) {
|
||||||
|
error(xhr)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/*下拉选表单赋值*/
|
||||||
|
function setSelectValue(list, selectName) {
|
||||||
|
let html = '<option value="" selected>请选设备类型</option>';
|
||||||
|
$.each(list, function (index, item) {
|
||||||
|
html += '<option value="' + item.value + '">' + item.name + '</option>';
|
||||||
|
})
|
||||||
|
$('#' + selectName).empty().append(html);
|
||||||
|
layui.form.render();
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,239 @@
|
||||||
|
let form, layer, table, tableIns;
|
||||||
|
let pageNum = 1, limitSize = 10; // 默认第一页,分页数量为10
|
||||||
|
let selectedIds = []; // 存储选中项的ID
|
||||||
|
layui.use(['form', 'layer', 'table', 'laydate'], function () {
|
||||||
|
form = layui.form;
|
||||||
|
layer = layui.layer;
|
||||||
|
table = layui.table;
|
||||||
|
var laydate = layui.laydate;
|
||||||
|
// 渲染
|
||||||
|
laydate.render({
|
||||||
|
elem: '#ID-laydate-rangeLinked',
|
||||||
|
range: ['#startTime', '#endTime'],
|
||||||
|
rangeLinked: true // 开启日期范围选择时的区间联动标注模式 --- 2.8+ 新增
|
||||||
|
});
|
||||||
|
layui.form.render();
|
||||||
|
getDevSelected();
|
||||||
|
pages(1, 10, 1);
|
||||||
|
})
|
||||||
|
|
||||||
|
function pages(pageNum, pageSize, typeNum) {
|
||||||
|
let params = getReqParams(pageNum, pageSize, typeNum);
|
||||||
|
let url = dataUrl + "/primaryDatas/getList"
|
||||||
|
ajaxRequest(url, "POST", params, true, function () {
|
||||||
|
}, function (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: [
|
||||||
|
[
|
||||||
|
{type: 'checkbox', fixed: 'left'},
|
||||||
|
//表头
|
||||||
|
{title: "序号", width: 80, unresize: true, align: "center",
|
||||||
|
templet: function (d) {
|
||||||
|
return (page - 1) * limit + d.LAY_INDEX;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{field: "customName", title: "送样单位", unresize: true, align: "center"},
|
||||||
|
{field: "sampleTime", title: "送样时间", unresize: true, align: "center"},
|
||||||
|
{field: "sampleDev", title: "送样设备", unresize: true, align: "center"},
|
||||||
|
{field: "customNum", title: "送样数量", unresize: true, align: "center"},
|
||||||
|
{field: "sampleDate", title: "收样时间", unresize: true, align: "center"},
|
||||||
|
{field: "sampleUserName", title: "收样人", unresize: true, align: "center"},
|
||||||
|
{field: "experTime", title: "试验时间", unresize: true, align: "center"},
|
||||||
|
{field: "teamName", title: "试验班组", unresize: true, align: "center"},
|
||||||
|
{title: "操作", unresize: true, width: 300, align: "center",
|
||||||
|
templet: function (d) {
|
||||||
|
return '<a href="#" style="color: blue;" onclick="testClick(\'' + d.id + '\',\''+d.customNum+'\')">查看</a>';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
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");
|
||||||
|
// 每次分页完成后,根据selectedIds选中复选框
|
||||||
|
/*$.each(res.data, function(i, item){
|
||||||
|
if($.inArray(item.id, selectedIds) !== -1){
|
||||||
|
table.checkRow(item);
|
||||||
|
}
|
||||||
|
});*/
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// 监听单个复选框的选中和取消事件
|
||||||
|
table.on('checkbox(table_data)', function (obj) {
|
||||||
|
if (obj.checked) {
|
||||||
|
selectedIds.push(obj.data.id);
|
||||||
|
} else {
|
||||||
|
var index = selectedIds.indexOf(obj.data.id);
|
||||||
|
if (index > -1) {
|
||||||
|
selectedIds.splice(index, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// 获取头部复选框元素
|
||||||
|
var headerCheckbox = $('input[name="layTableCheckbox"]');
|
||||||
|
|
||||||
|
// 监听头部复选框的change事件
|
||||||
|
headerCheckbox.on('change', function() {
|
||||||
|
if ($(this).is(':checked')) {
|
||||||
|
// 全选操作
|
||||||
|
table.checkAll('table_data');
|
||||||
|
selectedIds = table.cache.table_data.map(function(item) {
|
||||||
|
return item.id;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// 全不选操作
|
||||||
|
table.uncheckAll('table_data');
|
||||||
|
selectedIds = [];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 获取参数
|
||||||
|
function getReqParams(page, limit, type) {
|
||||||
|
let obj = {};
|
||||||
|
if (!type) {
|
||||||
|
obj = {
|
||||||
|
page: page + "",
|
||||||
|
limit: limit + "",
|
||||||
|
devTypeCode: $('#devId').val(),
|
||||||
|
keyWord: $('#keyWord').val(),
|
||||||
|
sampleUserName: $('#sampleUserName').val(),
|
||||||
|
startTime: $('#startTime').val(),
|
||||||
|
endTime: $('#endTime').val(),
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
obj = {
|
||||||
|
page: '1',
|
||||||
|
limit: '10',
|
||||||
|
devTypeCode: '',
|
||||||
|
keyWord: '',
|
||||||
|
sampleUserName: '',
|
||||||
|
startTime: '',
|
||||||
|
endTime:''
|
||||||
|
};
|
||||||
|
}
|
||||||
|
obj={
|
||||||
|
encryptedData:encryptCBC(JSON.stringify(obj))
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询/重置
|
||||||
|
function query() {
|
||||||
|
pageNum = 1;
|
||||||
|
pages(1, limitSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
function reloadData() {
|
||||||
|
pages(pageNum, limitSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 试验标准新增、修改
|
||||||
|
function testClick(id,customNum) {
|
||||||
|
let title = '试验'
|
||||||
|
let param = {
|
||||||
|
'id': id,
|
||||||
|
'customNum':customNum
|
||||||
|
}
|
||||||
|
openIframeMax("primaryDataList", title, "child/primaryDataList.html", '100%', '100%', param);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDevSelected() {
|
||||||
|
let url = dataUrl + '/sys/select/getDicts';
|
||||||
|
let obj = {
|
||||||
|
'code':"dev_code"
|
||||||
|
}
|
||||||
|
let params = {
|
||||||
|
encryptedData: encryptCBC(JSON.stringify(obj))
|
||||||
|
}
|
||||||
|
|
||||||
|
ajaxRequest(url, "POST", params, true, function () {
|
||||||
|
}, function (result) {
|
||||||
|
if (result.code === 200) {
|
||||||
|
setSelectValue(result.data, 'devId');
|
||||||
|
// return result.data
|
||||||
|
} else {
|
||||||
|
layer.alert(result.msg, {icon: 2})
|
||||||
|
}
|
||||||
|
}, function (xhr) {
|
||||||
|
error(xhr)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/*下拉选表单赋值*/
|
||||||
|
function setSelectValue(list, selectName) {
|
||||||
|
let html = '<option value="" selected>请选设备类型</option>';
|
||||||
|
$.each(list, function (index, item) {
|
||||||
|
html += '<option value="' + item.value + '">' + item.name + '</option>';
|
||||||
|
})
|
||||||
|
$('#' + selectName).empty().append(html);
|
||||||
|
layui.form.render();
|
||||||
|
}
|
||||||
|
|
||||||
|
function commitCheckTestData(){
|
||||||
|
console.log(selectedIds);
|
||||||
|
let url = dataUrl + '/experimental/commitCheckTestData';
|
||||||
|
let obj = {
|
||||||
|
'ids':selectedIds
|
||||||
|
}
|
||||||
|
let params = {
|
||||||
|
encryptedData: encryptCBC(JSON.stringify(obj))
|
||||||
|
}
|
||||||
|
|
||||||
|
ajaxRequest(url, "POST", params, true, function () {
|
||||||
|
}, function (result) {
|
||||||
|
if (result.code === 200) {
|
||||||
|
console.log("数据",result.data)
|
||||||
|
// return result.data
|
||||||
|
} else {
|
||||||
|
layer.alert(result.msg, {icon: 2})
|
||||||
|
}
|
||||||
|
}, function (xhr) {
|
||||||
|
error(xhr)
|
||||||
|
});
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue