yn_hxy_web/hxy-web/js/dataStatistics/staff/staffList.js

172 lines
5.1 KiB
JavaScript

var pers = []
var table,form
layui.use(['form','layer','table'], function () {
table = layui.table;
form = layui.form;
// 触发submit提交 按钮点击或者表单被执行提交时触发
form.on('submit(query)', function (data) {
console.log("搜索")
// 对表格进行重载。id 即 table表格的id
data.field.yjId=localStorage.getItem("selectyj");
data.field.subId=localStorage.getItem("selectSubCom");
table.reload('table', {
// //设定异步数据接口的额外参数
page:{curr : 1}
,where: data.field
})
return false; // 阻止表单跳转。如果需要表单跳转,去掉这段即可。
});
form.on('submit(reset)', function () {
console.log("重置")
$('#userName').val('');
$('#yjName').val('');
$('#proName').val('');
$('#contractState').val('');
$('#userState').val('');
form.render();
let obj = {
userName:'',
yjName:'',
proName:'',
userState:'',
contractState:'',
yjId:localStorage.getItem("selectyj"),
subId:localStorage.getItem("selectSubCom")
}
// 对表格进行重载。id 即 table表格的id
table.reload('table', {
// //设定异步数据接口的额外参数
page:{curr : 1}
,where: obj
})
return false; // 阻止表单跳转。如果需要表单跳转,去掉这段即可。
});
init();
});
/**
* 初始化数据
*/
function init(){
<<<<<<< HEAD
var yjId=localStorage.getItem("selectyj");
var subId=localStorage.getItem("selectSubCom");
console.log(yjId,"yjId")
console.log(subId,"subId")
// 渲染表格
table.render({
elem: '#table',
url: PATH_URL + "/personbase/getList",
=======
var subComId = $(window.parent.document).find("select[id='subComId']").val();
// 渲染表格
table.render({
elem: '#table',
where: {
fgsId: subComId
},
// url: "/sys/achievement",
>>>>>>> e368ceeff701decf9d8a09e1b31bb567ab6d0496
page: true,
method:'post',
where:{yjId:yjId,subId:subId},
skin: 'line', // 表格样式
// data: tableData,
cols: [[
{
title: '序号',
field: 'zizeng',
align: 'center',
type: 'numbers'
},
{field:'userName', title: '姓 名',align: 'center',},
{field:'sex', title: '性别',align: 'center',},
{field:'beBorn', title: '出生年月',align: 'center',},
{field:'healthStatus', title: '健康状况',align: 'center',},
{field:'degree', title: '文化程度',align: 'center',},
{field:'proName', title: '管辖线路名称',align: 'center'},
{field:'gtName', title: '范围、基数',align: 'center',width:170},
{field:'address', title: '住址',align: 'center', },
{field:'tel', title: '联系电话',align: 'center', },
{field:'idNumber', title: '身份证号',align: 'center',},
{field:'startTime', title: '协议起始日期',align: 'center',},
{field:'endTime', title: '协议终止日期',align: 'center',},
{field:'yjName', title: '所属运检站',align: 'center',},
{field:'subName', title: '所属分公司',align: 'center',},
{
field: '',
title: '人员状态',
align: 'center',
templet: function(d){
var personStatus = d.userState;
var text;
var color;
var html = "";
if(personStatus == '1'){
text = '在职';
color = '#19BE6B';
}
if(personStatus == '2'){
text = '离职';
color = '#F56C6C';
}
html += "<span style='display: flex;justify-content: center;align-items: center'>"
html += `<span style='width: 5px;height: 5px;background: ${color};border-radius: 50%'></span>&nbsp;&nbsp;`
html += `<span>${text}</span>`
html += "</span>"
return html;
},
},
{
field: '',
title: '人员状态',
align: 'center',
templet: function(d){
var contractStatus = d.contractState;
var text;
var color;
var html = "";
if(contractStatus == '1'){
text = '已签订';
color = '#19BE6B';
}
if(contractStatus == '0'){
text = '未签订';
color = '#F56C6C';
}
if(contractStatus == '2'){
text = '已过期';
color = '#F56C6C';
}
if(contractStatus == '3'){
text = '临期预警';
color = '#FF9900';
}
html += "<span style='display: flex;justify-content: center;align-items: center'>"
html += `<span style='width: 5px;height: 5px;background: ${color};border-radius: 50%'></span>&nbsp;&nbsp;`
html += `<span>${text}</span>`
html += "</span>"
return html;
},
},
]],
});
}
//导出
function exportData() {
// let search1 = $('#search1').val();
// let search2 = $('#search2').val();
window.location.href = oiPlanUrl + "/monthlyPlanSubmission/export?token=" + token;
}