let voiTypeIdParam, user = getUser(),form, layer;
function setParams(voiTypeId) {
voiTypeIdParam = voiTypeId;
layui.use(['form', 'layer'], function () {
layer = layui.layer;
form = layui.form;
getTicketNo();
form.render();
});
}
// 查询
function inquery() {
let pattern = new RegExp("[%_<>]");
if (pattern.test($("#keyWord").val())) {
$("#keyWord").val('');
return layer.msg('关键字查询包含特殊字符,请重新输入', {
icon: 2,
time: 2000 //2秒关闭(如果不配置,默认是3秒)
});
}
getTicketNo();
}
//获取站班会数据
function getTicketNo() {
let params = {
params: $('#keyWord').val(),
currentUserId: user.userId + '',
isSup: user.isSup,
}
$.ajax({
headers: {
"encrypt": sm3(JSON.stringify(params))
},
type: "post",
url: dataUrl + 'proteam/pot/superStatistics/getTicketNo?token=' + token,
data: params,
success: function (result) {
if(result.code === 200){
initClassTable(result.data);
}else if(result.code === 500){
return layer.alert(data.msg, {icon: 2})
}else if(result.code === 401){
logout(1);
}
}, error: function () {
initClassTable(null);
}
});
}
// 初始化表格数据
function initClassTable(data) {
let html = ' | 作业票编号 | 工程名称 |
';
html += '
'
if (data !== null && data.length > 0) {
data.forEach((item, index) => {
html += '' +
' | ' +
'' + item.ticketNo + ' | ' +
'' + item.proName + ' | ' +
'
';
});
} else {
html += '| 暂无数据 |
';
}
html += ''
$('.classTable').empty().append(html);
}
//双击选中
function dbSel(that){
let flag = $(that).find('input').prop("checked");
if(flag){
$(that).find('input').prop("checked",false);
}else{
$(that).find('input').prop("checked",true);
}
}
// 单个选中
function sel(selectStatus, that) {
if (selectStatus) {
$(that).prop('checked', true);
} else {
$(that).prop('checked', false);
}
}
// 获取复选框选中的值
function selData() {
let list = [];
$("input[name='check']").each(function (i, n) {
if (n.checked === true) {
let ticketNo = $(n).parent().parent().find('td').eq(1).html();
let classId = $(n).parent().parent().find('td').eq(1).attr("classId");
let org = $(n).parent().parent().find('td').eq(1).attr("org");
let riskLevel = $(n).parent().parent().find('td').eq(1).attr("riskLevel");
let teamName = $(n).parent().parent().find('td').eq(1).attr("teamName");
let bidCode = $(n).parent().parent().find('td').eq(1).attr("bidCode");
let signCode = $(n).parent().parent().find('td').eq(1).attr("signCode");
let proName = $(n).parent().parent().find('td').eq(2).html();
let obj = {
'ticketNo': ticketNo,
'proName': proName,
'classId': classId,
'org': org,
'riskLevel':riskLevel,
'teamName':teamName,
'bidCode':bidCode,
'signCode':signCode
};
list.push(obj);
}
});
return list;
}
// 保存
function save() {
let name = '';
let list = selData();
if (list.length === 0) {
return layer.msg('请选择作业票编号', {icon: 7});
}
closePage(1, list[0].classId, list[0].ticketNo, list[0].proName, list[0].org,list[0].riskLevel,list[0].teamName,list[0].bidCode,list[0].signCode);
}
// 关闭页面
function closePage(type, classId, ticketNo, proName, org,riskLevel,teamName,bidCode,signCode) {
let index = parent.layer.getFrameIndex(window.name); //先得到当前 iframe层的索引
parent.layer.close(index); //再执行关闭
if (type === 1) {
parent.setTicketInfo(classId, ticketNo, proName, org,riskLevel,teamName,bidCode,signCode);
}
}