IntelligentRecognition/ah-jjsp-web/bns/js/dutyTask/voiCheckRecord.js

249 lines
7.9 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

let form, layer, table, tableIns, laydate,checkProNo;
let pageNum = 1, limitSize = 50; // 默认第一页分页数量为10
let user = getUser();
layui.use(['form', 'layer', 'table', 'laydate'], function () {
form = layui.form;
layer = layui.layer;
table = layui.table;
laydate = layui.laydate;
laydate.render({
elem: '#createTime', //指定元素 元素选择器
type: 'date', //选择时间类型 可选值:year(年) month(年月) date(年月日) time(时分秒) datetime(年月日时分秒)
trigger: 'click',
range: true,
format: 'yyyy-MM-dd', //时间格式 常用时间格式:yyyy-MM-dd HH:mm:ss
btns: ['now', 'confirm', 'clear'], //选择框右下角显示的按钮 清除-现在-确定
done: function (value, date) { //时间回调
}
});
$('#createTime').val(getStartTime() + " - " + getEndTime())
setOrgData();
initTable();
})
/*初始化表格*/
function initTable() {
let loadingMsg = layer.msg("数据加载中,请稍候...", { icon: 16, scrollbar: false, time: 0, });
tableIns = table.render({
elem: "#todayTaskTable",
id: "todayTaskTable",
height: "full-70",
url: dataUrl + "proteam/pot/superStatistics/getVoiCheckLists?token=" + token,
page: {
layout: ['prev', 'page', 'next', 'skip', 'count', 'limit'],
groups: 5, //只显示 5 个连续页码
limits: [30, 50, 100],
limit: 50,
curr: 1
},
method: 'POST',
where: {
'createTime': $('#createTime').val(),
'keyWord': '',
'org': '',
'issUser': '',
},
response: {
statusCode: 200 //重新规定成功的状态码为 200table 组件默认为 0
},
parseData: function (res) { // res 即为原始返回的数据
return {
"code": res.code,
"msg": res.msg,
"count": res.count,
"data": res.data,
"limit": res.limit,
"curr": res.curr
};
},
cols: [[
//表头
{
title: "序号",
width: '80',
unresize: true,
align: "center",
templet: function (d) {
return d.LAY_NUM;
}
},
{
field: "ticketNo",
title: "作业票号",
width: '300',
unresize: false,
align: "center",
},
{
field: "proName",
title: "工程名称",
width: '220',
unresize: false,
align: "center",
},
{
field: "riskLevel",
title: "风险等级",
width: '120',
unresize: false,
align: "center",
templet: function (d) {
return setRiskLevelColor(d.riskLevel);
}
},
{
field: "org",
title: "违章单位",
width: '120',
unresize: false,
align: "center",
},
{
field: "type",
title: "违章类型",
width: '120',
unresize: false,
align: "center",
},
{
field: "levelId",
title: "违章等级",
width: '120',
unresize: false,
align: "center",
templet: function (d) {
if (d.levelId === '严重违章') {
return '<span style="color: #ff5d5d;">' + d.levelId + '</span>';
}
return '<span>' + d.levelId + '</span>';
}
},
{
field: "createTime",
title: "督查日期",
width: '150',
unresize: false,
align: "center",
},
{
field: "issUser",
title: "督查人",
width: '150',
unresize: false,
align: "center",
},
{
field: "status",
title: "审核状态",
width: '150',
unresize: false,
align: "center",
},
{
field: "remark",
title: "审核意见",
width: '200',
unresize: false,
align: "center",
templet: function (d) {
let remark = d.remark;
if(remark){
let remarkArr = remark.split('@');
if(remarkArr.length > 1){
return remarkArr[1];
}else{
return remark;
}
}else{
return '';
}
}
},
{
title: "操作",
width: '120',
unresize: false,
align: "center",
templet: function (d) {
if(d.status === '待审核'){
return "<a onclick=\"noticeSheet2('" + d.id + "','" + d.classId + "','1')\">审核</a>";
}else{
return "<a onclick=\"noticeSheet2('" + d.id + "','" + d.classId + "','2')\">查看</a>"
}
}
},
]],
done: function (res, curr, count) {
layer.close(loadingMsg);
table.resize("todayTaskTable");
pageNum = res.curr, limitSize = res.limit;
},
});
}
// 查询/重置
function query(type) {
if (type === 2) {
$('#createTime').val(getStartTime() + " - " + getEndTime())
$('#keyWord').val('');
$('#issUser').val('');
$('#orgId').val('');
$('input[name="proType"]').prop('checked', true);
}
let pattern = new RegExp("[%_<>]");
if (pattern.test($("#keyWord").val())) {
$("#keyWord").val('');
return layer.msg('关键字查询包含特殊字符,请重新输入', { icon: 2, time: 2000 });
}
if (pattern.test($("#issUser").val())) {
$("#issUser").val('');
return layer.msg('督查人查询包含特殊字符,请重新输入', { icon: 2, time: 2000 });
}
layui.form.render();
reloadData();
}
// 刷新表格
function reloadData(type) {
table.reload('todayTaskTable', {
where: {
'createTime': getStartTime() + " - " + getEndTime(),
'keyWord': $('#keyWord').val(),
'issUser': $('#issUser').val(),
'org': $('#orgId').val()
},
page: {
curr: type ? pageNum : '1',
limit: limitSize,
groups: 5, //只显示 5 个连续页码
},
});
}
// 建管单位赋值
function setOrgData() {
let orgList = getOrgSelect();
let html = '<option value="">请选择</option>'
$.each(orgList, function (index, item) {
html += '<option value="' + item.code + '">' + item.name + '</option>'
})
$('#orgId').empty().append(html);
layui.form.render();
}
// 值长审核页 / 查看页
function noticeSheet2(id, classId, type) {
let layerIndex = layer.open({
type: 2,
title: false,
closeBtn: 0,
content: "../../html/dutyTask/violation/noticeSheetCheck.html",
shadeClose: false,
area: ['740px', '780px'],
move: false,
success: function () {
let iframeWin = window["layui-layer-iframe" + layerIndex];
iframeWin.setParams(id, classId, type);
}
});
}