959 lines
36 KiB
JavaScript
959 lines
36 KiB
JavaScript
let form, layer, table, tableIns, laydate, formSelects;
|
||
let pageNum = 1, limitSize = 10; // 默认第一页,分页数量为10
|
||
let user = getUser(), riskLevelList, proStatusList, evaluationStatusList, ballStatusList, bidProList, orgList;
|
||
let searchList = [
|
||
{'titleName': '关键字', 'titleCode': 'keyWord', 'isChecked': true, 'isSelect': false},
|
||
{'titleName': '风险等级', 'titleCode': 'riskLevel', 'isChecked': false, 'count': 3, 'isSelect': true},
|
||
{'titleName': '督查人', 'titleCode': 'inspector', 'isChecked': false, 'isSelect': false},
|
||
{'titleName': '评价状态', 'titleCode': 'evaluationStatus', 'isChecked': false, 'isSelect': true},
|
||
{'titleName': '建管单位', 'titleCode': 'buildCode', 'isChecked': true, 'count': 2, 'isSelect': true,'isSearch': true},
|
||
{'titleName': '施工状态', 'titleCode': 'proStatus', 'isChecked': false, 'count': 3, 'isSelect': true},
|
||
{'titleName': '工程名称', 'titleCode': 'bidName', 'isChecked': true, 'count': 1, 'isSelect': true, 'isSearch': true},
|
||
{'titleName': '班组长', 'titleCode': 'foreman', 'isChecked': false, 'isSelect': false},
|
||
{'titleName': '球机状态', 'titleCode': 'ballStatus', 'isChecked': false, 'isSelect': true},
|
||
{'titleName': '日期', 'titleCode': 'ballStatus', 'isChecked': false, 'isSelect': false,'isTime':true}
|
||
];
|
||
//
|
||
var bidNo;
|
||
var crateTime;
|
||
var singleId='';
|
||
function setParams(type,id){
|
||
bidNo=id;
|
||
crateTime=getNowTime();
|
||
if (type===1){
|
||
crateTime=getNowTime();
|
||
}else if(type===2){
|
||
crateTime= getyesDay();
|
||
}
|
||
if(type==3){
|
||
crateTime=getNowTime();
|
||
bidNo='';
|
||
singleId=id;
|
||
}
|
||
console.log(crateTime);
|
||
layui.config({
|
||
base: "../../js/layui/", //此处路径请自行处理, 可以使用绝对路径
|
||
}).extend({
|
||
formSelects: 'formSelects-v4'
|
||
}).use(['form', 'layer', 'table', 'laydate', 'formSelects'], function () {
|
||
form = layui.form;
|
||
layer = layui.layer;
|
||
table = layui.table;
|
||
laydate = layui.laydate;
|
||
formSelects = layui.formSelects;
|
||
laydate.render({
|
||
elem: '#workDay', //指定元素 元素选择器
|
||
type: 'date', //选择时间类型 可选值:year(年) month(年月) date(年月日) time(时分秒) datetime(年月日时分秒)
|
||
trigger: 'click',
|
||
range: true,
|
||
format: 'yyyy-MM-dd', //时间格式 常用时间格式:yyyy-MM-dd HH:mm:ss
|
||
max: Date.parse(new Date()),
|
||
btns: ['now', 'confirm'], //选择框右下角显示的按钮 清除-现在-确定
|
||
});
|
||
checkedDate =crateTime;
|
||
$('#workDay').val(crateTime + " - " + crateTime)
|
||
riskLevelList = getRiskLevelSelect('risk_level');
|
||
proStatusList = getRiskLevelSelect('work_status');
|
||
evaluationStatusList = getRiskLevelSelect('evaluate_status');
|
||
ballStatusList = getRiskLevelSelect('ball_status');
|
||
bidProList = getProSelected('2');
|
||
orgList = getOrgNumAndRate(1);
|
||
setOrg();
|
||
setBidPro();
|
||
setRiskLevel();
|
||
pages(1, 10, 1);
|
||
})
|
||
|
||
}
|
||
|
||
|
||
function pages(pageNum, pageSize, typeNum) {
|
||
let params = getReqParams(pageNum, pageSize, typeNum);
|
||
$.ajax({
|
||
headers: {
|
||
"encrypt": sm3(JSON.stringify(params))
|
||
},
|
||
url: dataUrl + "proteam/pot/todayTask/getTodayTaskList?token=" + token,
|
||
data: params,
|
||
type: 'POST',
|
||
async: false,
|
||
success: function (result) {
|
||
if (result.code === 200) {
|
||
if (result.data) {
|
||
initTable(result.data, result.limit, result.curr)
|
||
laypages(result.count, result.curr, result.limit)
|
||
resetContent()
|
||
}
|
||
} else if (result.code === 500) {
|
||
layer.alert(result.msg, {icon: 2})
|
||
} else if (result.code === 401) {
|
||
logout(1);
|
||
}
|
||
}, error: function () {
|
||
}
|
||
});
|
||
}
|
||
|
||
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) {
|
||
tableIns = table.render({
|
||
elem: "#todayTaskTable",
|
||
height: "full-160",
|
||
data: dataList,
|
||
cols: [
|
||
[
|
||
//表头
|
||
{
|
||
fixed: 'left',
|
||
title: "序号",
|
||
width: 100,
|
||
unresize: true,
|
||
align: "center",
|
||
templet: function (d) {
|
||
return (page - 1) * limit + d.LAY_INDEX;
|
||
}
|
||
},
|
||
{
|
||
fixed: 'left',
|
||
field: "buildCode",
|
||
title: "建管单位",
|
||
width: 120,
|
||
sort: true,
|
||
unresize: false,
|
||
align: "center",
|
||
},
|
||
{
|
||
fixed: 'left',
|
||
field: "bidName",
|
||
title: "工程名称",
|
||
width: 250,
|
||
unresize: false,
|
||
sort: true,
|
||
align: "center",
|
||
},
|
||
{
|
||
fixed: 'left',
|
||
title: "工作内容",
|
||
width: 250,
|
||
unresize: false,
|
||
sort: true,
|
||
align: "center",
|
||
style: "height:101.5px;",
|
||
templet: function (d) {
|
||
if (d.content) {
|
||
if (d.content.length > 60) {
|
||
return '<span title="' + d.content + '">' + d.content.substring(0, 60) + '...</span>'
|
||
} else {
|
||
return '<span title="' + d.content + '">' + d.content + '</span>'
|
||
}
|
||
} else {
|
||
return '';
|
||
}
|
||
}
|
||
},
|
||
{
|
||
field: "riskLevel",
|
||
title: "风险等级",
|
||
width: 120,
|
||
unresize: false,
|
||
sort: true,
|
||
align: "center",
|
||
templet: function (d) {
|
||
return setRiskLevelColor(d.riskLevel);
|
||
}
|
||
},
|
||
{
|
||
title: "视频监控",
|
||
width: 120,
|
||
unresize: false,
|
||
align: "center",
|
||
sort: true,
|
||
templet: function (d) {
|
||
let html = '';
|
||
if (d.ballStatus != null) {
|
||
if (d.ballStatus === '1' && d.workDay === getDate()) {
|
||
html += '<img src="../../img/common-icon/ball-online.png">'
|
||
} else {
|
||
html += '<img src="../../img/common-icon/ball-offline.png">'
|
||
|
||
}
|
||
}
|
||
return html;
|
||
}
|
||
},
|
||
{
|
||
field: "proStatus",
|
||
title: "施工状态",
|
||
width: 120,
|
||
unresize: false,
|
||
sort: true,
|
||
align: "center",
|
||
},
|
||
{
|
||
title: "预警状态",
|
||
width: 150,
|
||
unresize: false,
|
||
sort: true,
|
||
align: "center",
|
||
templet: function (d) {
|
||
let earlyWarningStatus = d.earlyWarningStatus
|
||
let html = '';
|
||
if (earlyWarningStatus) {
|
||
let earlyWarningStatusArr = earlyWarningStatus.split(',');
|
||
$.each(earlyWarningStatusArr, function (index, item) {
|
||
if (item) {
|
||
html += '<span style="color: #FF5D5D;">' + item + '</span><br>';
|
||
}
|
||
})
|
||
} else {
|
||
html = '<span style="color: #14B93B">正常施工</span>'
|
||
}
|
||
return html;
|
||
}
|
||
},
|
||
{
|
||
title: "班组长",
|
||
width: 140,
|
||
unresize: false,
|
||
sort: true,
|
||
align: "center",
|
||
templet: function (d) {
|
||
return '<span>' + setValue2(d.foreman) + '</span><br><span>' + setValue2(d.foremanPhone) + '</span>'
|
||
}
|
||
},
|
||
{
|
||
field: "kgTime",
|
||
title: "开工时长",
|
||
width: 150,
|
||
unresize: false,
|
||
sort: true,
|
||
align: "center",
|
||
},
|
||
{
|
||
field: "kjTime",
|
||
title: "球机在线时长",
|
||
width: 200,
|
||
unresize: false,
|
||
align: "center",
|
||
sort: true,
|
||
templet: function (d) {
|
||
let html = '';
|
||
if (d.isHg === '2') {
|
||
html += '<span style="color: #FF5D5D">' + d.kjTime + '</span>'
|
||
} else {
|
||
html += '<span>' + d.kjTime + '</span>'
|
||
}
|
||
return html;
|
||
}
|
||
},
|
||
{
|
||
title: "评价状态",
|
||
width: 130,
|
||
unresize: false,
|
||
align: "center",
|
||
sort: true,
|
||
templet: function (d) {
|
||
if (d.evaluationStatus === '0') {
|
||
return '<div style="width: 80px;height: 80px;line-height:80px;cursor: pointer;color: #FF5D5D" ' +
|
||
'onclick="openEvalStatus(\'' + d.id + '\',\'' + d.idNumber + '\',\'' + d.teamName + '\',1)"><span>未评价</span></div>';
|
||
} else if (d.evaluationStatus === '1') {
|
||
return '<div style="width: 80px;height: 80px;line-height:80px;cursor: pointer;color: #2F82FB" ' +
|
||
'onclick="openEvalStatus(\'' + d.id + '\',\'' + d.idNumber + '\',\'' + d.teamName + '\',2)"><span>已评价</span></div>';
|
||
}else if (d.evaluationStatus === '0' && user.isSup === '3') {
|
||
return '<span style="color: #FF5D5D;">未评价</span>';
|
||
} else if (d.evaluationStatus === '1' && user.isSup === '3') {
|
||
return '<span style="color: #2F82FB;">已评价</span>';
|
||
}else{
|
||
return '';
|
||
}
|
||
}
|
||
},
|
||
{
|
||
field: "isStop",
|
||
title: "到岗履职",
|
||
width: 150,
|
||
unresize: false,
|
||
sort: true,
|
||
align: "center",
|
||
templet: function (d) {
|
||
return '<span>业主:' + d.yzDuty + '</span><br><span>监理:' + d.jlDuty + '</span><br><span>施工:' + d.sgDuty + '</span>';
|
||
}
|
||
},
|
||
{
|
||
field: "inspector",
|
||
title: "督查人",
|
||
width: 150,
|
||
unresize: false,
|
||
sort: true,
|
||
align: "center",
|
||
},
|
||
{
|
||
field: "supervisionTime",
|
||
title: "督查时长(分)",
|
||
width: 200,
|
||
unresize: false,
|
||
sort: true,
|
||
align: "center",
|
||
},
|
||
{
|
||
title: "违章记录",
|
||
width: 140,
|
||
unresize: false,
|
||
sort: true,
|
||
align: "center",
|
||
templet: function (d) {
|
||
return '<a onclick="openVoiRecord(\''+d.id+'\',\''+d.bidName+'\',\''+d.ticketNo+'\',\''+d.org+'\')">'+d.voiNum+'</a>';
|
||
}
|
||
},
|
||
],
|
||
],
|
||
limit: limit,
|
||
done: function (res, curr, count) {
|
||
$(".layui-table-main tr").each(function (index, val) {
|
||
$($(".layui-table-fixed .layui-table-body tbody tr")[index]).height($(val).height());
|
||
});
|
||
//动态监听表体高度变化,冻结行跟着改变高度
|
||
$(".layui-table-body tr").resize(function () {
|
||
$(".layui-table-body tr").each(function (index, val) {
|
||
$($(".layui-table-fixed .layui-table-body table tr")[index]).height($(val).height());
|
||
});
|
||
});
|
||
//初始化高度,使得冻结行表体高度一致
|
||
$(".layui-table-body tr").each(function (index, val) {
|
||
$($(".layui-table-fixed .layui-table-body table tr")[index]).height($(val).height());
|
||
});
|
||
table.resize("todayTaskTable");
|
||
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");
|
||
},
|
||
});
|
||
table.on('sort(todayTask)',function (obj){
|
||
console.log(obj)
|
||
$(".layui-table-main tr").each(function (index, val) {
|
||
$($(".layui-table-fixed .layui-table-body tbody tr")[index]).height($(val).height());
|
||
});
|
||
//动态监听表体高度变化,冻结行跟着改变高度
|
||
$(".layui-table-body tr").resize(function () {
|
||
$(".layui-table-body tr").each(function (index, val) {
|
||
$($(".layui-table-fixed .layui-table-body table tr")[index]).height($(val).height());
|
||
});
|
||
});
|
||
//初始化高度,使得冻结行表体高度一致
|
||
$(".layui-table-body tr").each(function (index, val) {
|
||
$($(".layui-table-fixed .layui-table-body table tr")[index]).height($(val).height());
|
||
});
|
||
})
|
||
table.on("rowDouble(todayTask)", function (res) {
|
||
let obj = res.data;
|
||
openRemotePatrol(obj.id, obj.puid, obj.tCode, obj.twCode, obj.tdCode, obj.passWay,obj.bidNo);
|
||
});
|
||
}
|
||
|
||
// 打开评价状态页面
|
||
function openEvalStatus(classId,idNumber,teamName,type){
|
||
if(type === 1){ // 新增评价页面
|
||
layer.open({
|
||
title: ['<div style="border-left: 3px solid #2F82FB;display: flex;align-items: center;height: 20px;padding: 0 10px;">班组评价</div>', 'font-size:16px;background-color:#f0f0f0;display: flex;align-items: center;'],
|
||
type: 2,
|
||
content: '../../html/teamInformation/child/teamEvaluateAdd.html',
|
||
area: ['30%', '70%'],
|
||
maxmin: false,
|
||
move: false,
|
||
success: function (layero, index) {
|
||
let body = layer.getChildFrame('body', index);
|
||
let iframeWin = window[layero.find('iframe')[0]['name']];//获得iframe页的窗口对象,执行iframe页的方法:
|
||
iframeWin.setForm(classId, idNumber, teamName);//调用子页面的方法,页面锁定
|
||
},
|
||
end:function (){
|
||
reloadData();
|
||
}
|
||
});
|
||
}else if(type === 2){ // 评价记录页面
|
||
let layerIndex = layer.open({
|
||
id: "teamEvaluateByClass",
|
||
title: false,
|
||
type: 2,
|
||
maxmin: false,
|
||
content: '../teamInformation/child/teamEvaluate.html',
|
||
area: ['100%', '100%'],
|
||
closeBtn: 0,
|
||
success: function (layero, index) {
|
||
let iframeWin = window["layui-layer-iframe" + layerIndex];
|
||
iframeWin.setForm(classId, idNumber, teamName, 2);
|
||
}
|
||
});
|
||
}
|
||
}
|
||
|
||
// 获取参数
|
||
function getReqParams(page, limit, type) {
|
||
let obj = {};
|
||
if (!type) {
|
||
obj = {
|
||
page: page + "",
|
||
limit: limit + "",
|
||
workDay: setValue2($('#workDay').val()),
|
||
buildCode: setValue2(formSelects.value('buildCode', 'val').toString()),
|
||
inspector: setValue2($("#inspector").val()),
|
||
evaluationStatus: setValue2($("#evaluationStatus").val() === '-1' ? '' : $("#evaluationStatus").val()),
|
||
foreman: setValue2($("#foreman").val()),
|
||
riskLevel: setValue2(formSelects.value('riskLevel', 'val').toString()),
|
||
proStatus: setValue2(formSelects.value('proStatus', 'val').toString()),
|
||
bidName: setValue2(formSelects.value('bidName', 'val').toString()),
|
||
ballStatus: setValue2($("#ballStatus").val() === '-1' ? '' : $("#ballStatus").val()),
|
||
keyWord:setValue2($("#keyWord").val()),
|
||
currentUserId: user.userId + '',
|
||
isSup: user.isSup,
|
||
bidNo:bidNo,
|
||
currentUserOrgId: user.orgId
|
||
};
|
||
} else {
|
||
obj = {
|
||
page: '1',
|
||
limit: '10',
|
||
workDay: checkedDate + " - " + checkedDate,
|
||
buildCode: '',
|
||
bidNo:bidNo,
|
||
inspector: '',
|
||
evaluationStatus: '',
|
||
foreman: '',
|
||
riskLevel: '',
|
||
proStatus: '',
|
||
bidName:singleId,
|
||
ballStatus: '',
|
||
keyWord: '',
|
||
currentUserId: user.userId + '',
|
||
isSup: user.isSup,
|
||
currentUserOrgId: user.orgId
|
||
};
|
||
}
|
||
return obj;
|
||
}
|
||
|
||
// 查询/重置
|
||
function query(type) {
|
||
if (type === 2) {
|
||
resetForm();
|
||
}
|
||
let pattern = new RegExp("[%_<>]");
|
||
if (pattern.test($("#foreman").val())) {
|
||
$("#foreman").val('');
|
||
return layer.msg('班组长查询包含特殊字符,请重新输入', {
|
||
icon: 2,
|
||
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
||
});
|
||
}
|
||
if (pattern.test($("#inspector").val())) {
|
||
$("#inspector").val('');
|
||
return layer.msg('督查人查询包含特殊字符,请重新输入', {
|
||
icon: 2,
|
||
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
||
});
|
||
}
|
||
pageNum = 1;
|
||
let buildCode = formSelects.value('buildCode', 'val');
|
||
orgList = getOrgNumAndRate();
|
||
setOrg();
|
||
formSelects.value('buildCode', buildCode)
|
||
pages(1, limitSize)
|
||
resetContent();
|
||
}
|
||
|
||
/*重置查询条件*/
|
||
function resetForm() {
|
||
$('#workDay').val(crateTime+ " - " + crateTime)
|
||
formSelects.value('buildCode', []);
|
||
$("#inspector").val('')
|
||
$("#evaluationStatus").val('-1')
|
||
$("#foreman").val('')
|
||
$("#keyWord").val('')
|
||
formSelects.value('riskLevel', []);
|
||
formSelects.value('proStatus', []);
|
||
formSelects.value('bidName', []);
|
||
$("#ballStatus").val('-1')
|
||
layui.form.render()
|
||
}
|
||
|
||
/*打开远程巡视页面*/
|
||
function openRemotePatrol(id, puid, tCode, twCode, tdCode, passWay,bidNo) {
|
||
if (user.isSup !== '3') {
|
||
addSuper(id, "1");
|
||
}
|
||
let layerIndex = layer.open({
|
||
id: "remotePatrol",
|
||
title: false,
|
||
type: 2,
|
||
maxmin: false,
|
||
content: '../dutyTask/remotePatrol/remotePatrol.html',
|
||
area: ['100%', '100%'],
|
||
closeBtn: 0,
|
||
success: function (layero, index) {
|
||
let iframeWin = window["layui-layer-iframe" + layerIndex];
|
||
iframeWin.setParams(id, puid, tCode, twCode, tdCode, passWay,user.isSup,2,bidNo);
|
||
},
|
||
end: function () {
|
||
if (user.isSup !== '3') {
|
||
addSuper(id, "2");
|
||
}
|
||
}
|
||
});
|
||
}
|
||
|
||
/*添加督查时间*/
|
||
function addSuper(classId, type) {
|
||
let params = {
|
||
classId: classId,
|
||
type: type
|
||
}
|
||
$.ajax({
|
||
headers: {
|
||
"encrypt": sm3(JSON.stringify(params))
|
||
},
|
||
url: dataUrl + 'proteam/pot/supervision/insertSupervision?token=' + token,
|
||
data: params,
|
||
type: 'POST',
|
||
async: true,
|
||
success: function (result) {
|
||
}, error: function () {
|
||
}
|
||
});
|
||
}
|
||
|
||
// 违章记录页面
|
||
function openVoiRecord(id,bidName,ticketNo,buildCode){
|
||
console.log(id + "," + bidName +","+ticketNo + "," +buildCode)
|
||
let layerIndex = layer.open({
|
||
id: "voiRecord",
|
||
title: false,
|
||
type: 2,
|
||
maxmin: false,
|
||
content: '../dutyTask/remotePatrol/voiRecord.html',
|
||
area: ['100%', '100%'],
|
||
closeBtn: 0,
|
||
success: function (layero, index) {
|
||
let iframeWin = window["layui-layer-iframe" + layerIndex];
|
||
iframeWin.setParams(id, bidName, ticketNo, buildCode);
|
||
}
|
||
});
|
||
}
|
||
|
||
// 地市站班会数量和占比
|
||
function getOrgNumAndRate(type) {
|
||
let dataList = [];
|
||
let params = getReqParams(null, null, type);
|
||
$.ajax({
|
||
headers: {
|
||
"encrypt": sm3(JSON.stringify(params))
|
||
},
|
||
url: dataUrl + 'proteam/pot/todayTask/getOrgNumAndRate?token=' + token,
|
||
data: params,
|
||
type: 'POST',
|
||
async: false,
|
||
success: function (result) {
|
||
let data = result.data;
|
||
if (result.code === 500) {
|
||
return layer.alert(data.msg, {icon: 2})
|
||
} else if (result.code === 401) {
|
||
logout(1);
|
||
} else if (result.code === 200) {
|
||
if (data && data.length > 0) {
|
||
$.each(data, function (index, item) {
|
||
dataList.push(item)
|
||
})
|
||
}
|
||
}
|
||
}, error: function () {
|
||
}
|
||
});
|
||
return dataList;
|
||
}
|
||
|
||
/*导出*/
|
||
function exportData() {
|
||
let workDay = setValue2($('#workDay').val()),
|
||
buildCode = setValue2(formSelects.value('buildCode', 'val').toString()),
|
||
inspector = setValue2($("#inspector").val()),
|
||
evaluationStatus = setValue2($("#evaluationStatus").val() === '-1' ? '' : $("#evaluationStatus").val()),
|
||
foreman = setValue2($("#foreman").val()),
|
||
riskLevel = setValue2(formSelects.value('riskLevel', 'val').toString()),
|
||
proStatus = setValue2(formSelects.value('proStatus', 'val').toString()),
|
||
bidName = setValue2(formSelects.value('bidName', 'val').toString()),
|
||
ballStatus = setValue2($("#ballStatus").val() === '-1' ? '' : $("#ballStatus").val()),
|
||
keyWord = setValue2($("#keyWord").val()),
|
||
currentUserId = user.userId + '',
|
||
isSup = user.isSup,
|
||
currentUserOrgId = user.orgId;
|
||
let loadingMsg = layer.msg("数据导出中,请稍候...", {icon: 16, scrollbar: false, time: 0,});
|
||
let url = dataUrl + "proteam/pot/todayTask/exportData?workDay=" + workDay + "&buildCode=" + buildCode + "&inspector=" + inspector +
|
||
"&evaluationStatus=" + evaluationStatus + "&foreman=" + foreman + "&riskLevel=" + riskLevel + "&proStatus=" + proStatus + "&bidName=" + bidName + "&ballStatus=" + ballStatus +
|
||
"&keyWord=" + keyWord + "¤tUserId=" + currentUserId + "&isSup=" + isSup + "¤tUserOrgId=" + currentUserOrgId + "&token=" + token;
|
||
let xhr = new XMLHttpRequest();
|
||
xhr.open("get", url, true);
|
||
xhr.responseType = "blob"; // 转换流
|
||
xhr.setRequestHeader("encrypt",
|
||
sm3(JSON.stringify({
|
||
workDay: workDay,
|
||
buildCode: setValue2(formSelects.value('buildCode', 'val').toString()),
|
||
inspector: setValue2($("#inspector").val()),
|
||
evaluationStatus: setValue2($("#evaluationStatus").val() === '-1' ? '' : $("#evaluationStatus").val()),
|
||
foreman: setValue2($("#foreman").val()),
|
||
riskLevel: setValue2(formSelects.value('riskLevel', 'val').toString()),
|
||
proStatus: setValue2(formSelects.value('proStatus', 'val').toString()),
|
||
bidName: setValue2(formSelects.value('bidName', 'val').toString()),
|
||
ballStatus: setValue2($("#ballStatus").val() === '-1' ? '' : $("#ballStatus").val()),
|
||
keyWord: setValue2($("#keyWord").val()),
|
||
currentUserId: user.userId + '',
|
||
isSup: user.isSup,
|
||
currentUserOrgId: user.orgId
|
||
})));
|
||
xhr.onload = function () {
|
||
layer.close(loadingMsg);
|
||
if (this.status === 200) {
|
||
let blob = this.response;
|
||
var a = document.createElement("a");
|
||
var url = window.URL.createObjectURL(blob);
|
||
a.href = url;
|
||
a.download = "今日任务" + getNowDate() + ".xlsx"; // 文件名
|
||
} else {
|
||
layer.msg("数据发生异常,请稍后重试", {icon: 16, scrollbar: false, time: 2000});
|
||
}
|
||
a.click();
|
||
window.URL.revokeObjectURL(url);
|
||
};
|
||
xhr.send();
|
||
}
|
||
|
||
/*建管单位赋值*/
|
||
function setOrg() {
|
||
let keys = [];
|
||
$.each(orgList, function (index, item) {
|
||
let temp = {
|
||
"name": item.name + "(" + item.num + "," + item.rate + ")",
|
||
"value": item.code,
|
||
"titleName": item.name
|
||
};
|
||
keys.push(temp);
|
||
})
|
||
formSelects.data('buildCode', 'local', {
|
||
arr: keys
|
||
});
|
||
layui.form.render();
|
||
}
|
||
|
||
/*工程赋值*/
|
||
function setPro() {
|
||
let keys = [];
|
||
$.each(signProList, function (index, item) {
|
||
let temp = {
|
||
"name": item.name,
|
||
"value": item.code
|
||
};
|
||
keys.push(temp);
|
||
})
|
||
formSelects.data('proName', 'local', {
|
||
arr: keys
|
||
});
|
||
layui.form.render();
|
||
}
|
||
|
||
/*标段工程赋值*/
|
||
function setBidPro() {
|
||
let keys = [];
|
||
$.each(bidProList, function (index, item) {
|
||
let temp = {
|
||
"name": item.name,
|
||
"value": item.code
|
||
};
|
||
keys.push(temp);
|
||
})
|
||
formSelects.data('bidName', 'local', {
|
||
arr: keys
|
||
});
|
||
formSelects.btns('bidName',['remove'])
|
||
layui.form.render();
|
||
}
|
||
|
||
/* 风险等级赋值 */
|
||
function setRiskLevel() {
|
||
let keys = [];
|
||
$.each(riskLevelList, function (index, item) {
|
||
let temp = {
|
||
"name": item.name,
|
||
"value": item.code
|
||
};
|
||
keys.push(temp);
|
||
})
|
||
formSelects.data('riskLevel', 'local', {
|
||
arr: keys
|
||
});
|
||
layui.form.render();
|
||
}
|
||
|
||
/* 评价状态赋值 */
|
||
function setEvaluationStatu() {
|
||
let html = '<option value="-1" selected>全部</option>';
|
||
$.each(evaluationStatusList, function (index, item) {
|
||
html += '<option value="' + item.id + '">' + item.name + '</option>';
|
||
})
|
||
$('#evaluationStatus').empty().append(html);
|
||
layui.form.render();
|
||
}
|
||
|
||
/* 球机状态赋值 */
|
||
function setBallStauts() {
|
||
let html = '<option value="-1" selected>全部</option>';
|
||
$.each(ballStatusList, function (index, item) {
|
||
html += '<option value="' + item.id + '">' + item.name + '</option>';
|
||
})
|
||
$('#ballStatus').empty().append(html);
|
||
layui.form.render();
|
||
}
|
||
|
||
/* 施工状态赋值 */
|
||
function setProStatus() {
|
||
let keys = [];
|
||
$.each(proStatusList, function (index, item) {
|
||
let temp = {
|
||
"name": item.name,
|
||
"value": item.id
|
||
};
|
||
keys.push(temp);
|
||
})
|
||
formSelects.data('proStatus', 'local', {
|
||
arr: keys
|
||
});
|
||
layui.form.render();
|
||
}
|
||
|
||
/*更多选项*/
|
||
function openMoreOption() {
|
||
let width = getMoreWidth().toFixed(0) + "px";
|
||
let height = getMoreHeight().toFixed(0) + "px";
|
||
let layerIndex = layer.open({
|
||
id: "moreOption",
|
||
title: ['<div style="border-left: 3px solid #2F82FB;display: flex;align-items: center;height: 20px;padding: 0 10px;">选择查询条件</div>', 'font-size:16px;background-color:#f0f0f0;display: flex;align-items: center;'],
|
||
type: 1,
|
||
maxmin: false,
|
||
content: setOptionHtml(),
|
||
area: [width, height],
|
||
move: false,
|
||
shade: 0.1,
|
||
success: function (layero, index) {
|
||
layui.form.render();
|
||
$(window).resize(function () {
|
||
if (autoMoreResizeWidth) autoMoreResizeWidth(index);
|
||
if (autoMoreResizeHeight) autoMoreResizeHeight(index);
|
||
});
|
||
},
|
||
});
|
||
}
|
||
|
||
/*更多选项赋值*/
|
||
function setOptionHtml() {
|
||
let html = '<form class="layui-form option-form" onsubmit="return false;">';
|
||
let cent = '', cent2 = '';
|
||
$.each(searchList, function (index, item) {
|
||
if (index < 5) {
|
||
if (item.isChecked) {
|
||
cent += '<div class="layui-input-inline"><input lay-skin="primary" type="checkbox" name="' + item.titleCode + '" title="' + item.titleName + '" checked></div>'
|
||
} else {
|
||
cent += '<div class="layui-input-inline"><input lay-skin="primary" type="checkbox" name="' + item.titleCode + '" title="' + item.titleName + '"></div>'
|
||
}
|
||
} else {
|
||
if (item.isChecked) {
|
||
cent += '<div class="layui-input-inline"><input lay-skin="primary" type="checkbox" name="' + item.titleCode + '" title="' + item.titleName + '" checked></div>'
|
||
} else {
|
||
cent += '<div class="layui-input-inline"><input lay-skin="primary" type="checkbox" name="' + item.titleCode + '" title="' + item.titleName + '"></div>'
|
||
}
|
||
}
|
||
})
|
||
html += '<div class="layui-form-item" style="margin: 5% 0 0 20px;">' + cent + '</div>'
|
||
html += '<div class="layui-form-item" style="margin: 5% 0 0 20px;">' + cent2 + '</div>'
|
||
html += '<div class="layui-form-item" style="margin-top: 8%;display: flex;align-items: center;justify-content: center;">' +
|
||
'<button class="layui-btn layui-btn-normal layui-btn-sm" onclick="sureOption()">确定</button>' +
|
||
'<button class="layui-btn layui-btn-primary layui-btn-sm" onclick="layer.closeAll()">取消</button>' +
|
||
'</div></form>'
|
||
return html;
|
||
}
|
||
|
||
/*确定更多选项*/
|
||
function sureOption() {
|
||
$("#ttTime").css("display","none");
|
||
let formList = [];
|
||
$('input[type=checkbox]').each(function (index) {
|
||
let html = '';
|
||
searchList[index].isChecked = $(this).prop("checked")
|
||
if ($(this).prop("checked")) {
|
||
formList.push(setOptionForm(searchList[index]))
|
||
}
|
||
})
|
||
setFormHtml(formList);
|
||
layer.closeAll()
|
||
}
|
||
|
||
/*设置更多选项表单*/
|
||
function setOptionForm(item) {
|
||
let html = '';
|
||
if (item.isSelect) {
|
||
html = '<div class="layui-inline ' + item.titleCode + '">' +
|
||
'<label class="layui-form-label">' + item.titleName + ':</label>' +
|
||
'<div class="layui-input-inline">' +
|
||
setSelectSearch(item) +
|
||
'</select>' +
|
||
'</div>' +
|
||
'</div>'
|
||
} else {
|
||
if(item.isTime){
|
||
$("#ttTime").css("display","");
|
||
html = '<div style="display: none;" class="layui-inline ' + 'test' + '">' +
|
||
'<label class="layui-form-label">' + 'test' + ':</label>' +
|
||
'<div class="layui-input-inline">' +
|
||
'<input type="text" readonly placeholder="日期" id="' + 'test' + '" class="layui-input" autocomplete="off" placeholder="请输入' + 'test' + '">' +
|
||
'<img src="../../img/common-icon/date-icon.png" style="position: absolute;top: 20%;left: 86%;">'+
|
||
'</div>' +
|
||
'</div>'
|
||
}else{
|
||
html = '<div class="layui-inline ' + item.titleCode + '">' +
|
||
'<label class="layui-form-label">' + item.titleName + ':</label>' +
|
||
'<div class="layui-input-inline">' +
|
||
'<input type="text" id="' + item.titleCode + '" class="layui-input" autocomplete="off" placeholder="请输入' + item.titleName + '">' +
|
||
'</div>' +
|
||
'</div>'
|
||
}
|
||
}
|
||
return html;
|
||
}
|
||
|
||
/* 设置工程/标段工程下拉选带搜索 */
|
||
function setSelectSearch(item) {
|
||
if (item.isSearch) {
|
||
return '<select class="layui-select" id="' + item.titleCode + '" xm-select="' + item.titleCode + '" xm-select-show-count = "' + item.count + '" xm-select-search="" xm-select-search-type="dl">'
|
||
} else {
|
||
return '<select class="layui-select" id="' + item.titleCode + '" xm-select="' + item.titleCode + '" xm-select-show-count = "' + item.count + '">'
|
||
}
|
||
}
|
||
|
||
/*给表单内容*/
|
||
function setFormHtml(data) {
|
||
let html = '', cent = '', cent2 = '';
|
||
clearBasicForm();
|
||
$('.option-form .layui-form-item').eq(0).empty().css('height', '0px')
|
||
$('.option-form .layui-form-item').eq(1).empty().css('height', '0px')
|
||
if (data.length > 0 && data.length <= 3) {
|
||
if (data.length <= 3) {
|
||
$.each(data, function (index, item) {
|
||
html += item;
|
||
})
|
||
$('.workDay').after(html);
|
||
}
|
||
} else if (data.length > 3) {
|
||
$.each(data, function (index, item) {
|
||
if (index < 3) {
|
||
html += item;
|
||
} else if (index >= 3 && index <= 7) {
|
||
cent += item;
|
||
} else if (index === 8) {
|
||
cent2 = item;
|
||
}
|
||
})
|
||
clearBasicForm();
|
||
$('.workDay').after(html);
|
||
if (cent != '') {
|
||
$('.option-form .layui-form-item').eq(0).css('height', '50px')
|
||
}
|
||
if (cent2 != '') {
|
||
$('.option-form .layui-form-item').eq(1).css('height', '50px')
|
||
}
|
||
$('.option-form .layui-form-item').eq(0).append(cent);
|
||
$('.option-form .layui-form-item').eq(1).append(cent2);
|
||
}
|
||
layui.form.render();
|
||
if (data.length <= 3) {
|
||
$('.table-box').css('height', 'calc(100% - 100px)')
|
||
tableIns.getthat().fullHeightGap = '160'
|
||
} else if (data.length > 3 && data.length <= 8) {
|
||
$('.table-box').css('height', 'calc(100% - 170px)')
|
||
tableIns.getthat().fullHeightGap = '210'
|
||
} else if (data.length === 9) {
|
||
$('.table-box').css('height', 'calc(100% - 220px)')
|
||
tableIns.getthat().fullHeightGap = '260'
|
||
}
|
||
tableIns.resize();
|
||
setRiskLevel();
|
||
setOrg();
|
||
setBidPro();
|
||
setEvaluationStatu();
|
||
setBallStauts();
|
||
setProStatus();
|
||
}
|
||
|
||
/*清空表单的内容*/
|
||
function clearBasicForm() {
|
||
let obj = $('.basic-form .layui-form-item .layui-inline');
|
||
$('.basic-form .layui-form-item .layui-inline').each(function () {
|
||
if ($(this).hasClass('workDay') || $(this).hasClass('btns')) {
|
||
} else {
|
||
let classAttr = $(this).attr('class');
|
||
obj.remove('.' + classAttr.substring(classAttr.indexOf(' ') + 1, classAttr.length));
|
||
}
|
||
})
|
||
}
|
||
|
||
// 重置页面样式
|
||
function resetContent() {
|
||
if ($('.layui-input-inline').length <= 4) {
|
||
$('.table-box').css('height', 'calc(100% - 100px)')
|
||
tableIns.getthat().fullHeightGap = '160'
|
||
} else if ($('.layui-input-inline').length > 4 && $('.layui-input-inline').length <= 9) {
|
||
$('.table-box').css('height', 'calc(100% - 170px)')
|
||
tableIns.getthat().fullHeightGap = '210'
|
||
} else if ($('.layui-input-inline').length === 10) {
|
||
$('.table-box').css('height', 'calc(100% - 220px)')
|
||
tableIns.getthat().fullHeightGap = '260'
|
||
}
|
||
tableIns.resize();
|
||
layui.form.render()
|
||
}
|
||
|
||
function getDate() {
|
||
let date = new Date();
|
||
let year = date.getFullYear();
|
||
let month = date.getMonth() + 1;
|
||
let day = date.getDate();
|
||
if (month < 10) {
|
||
month = "0" + month;
|
||
}
|
||
if (day < 10) {
|
||
day = "0" + day;
|
||
}
|
||
return year + "-" + month + "-" + day;
|
||
}
|
||
// 关闭页面
|
||
function closePage() {
|
||
let index = parent.layer.getFrameIndex(window.name); //先得到当前 iframe层的索引
|
||
parent.layer.close(index); //再执行关闭
|
||
}
|
||
function reloadData() {
|
||
pages(pageNum, limitSize);
|
||
} |