IntelligentRecognition/ah-jjsp-web/.svn/pristine/cc/ccac0faf6bcb31172388a0077df...

140 lines
4.5 KiB
Plaintext
Raw 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 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 = '<thead><tr><td></td><td>作业票编号</td><td>工程名称</td></tr></thead>';
html += '<tbody>'
if (data !== null && data.length > 0) {
data.forEach((item, index) => {
html += '<tr ondblclick="dbSel(this)">' +
'<td><input onclick="sel(this.checked,this)" name="check" type="radio"></td>' +
'<td classId="' + item.classId + '" org = "' + item.org + '" riskLevel = "' + item.riskLevel + '" teamName = "' + item.teamName + '" bidCode = "' + item.bidCode + '" signCode = "' + item.signCode + '">' + item.ticketNo + '</td>' +
'<td>' + item.proName + '</td>' +
'</tr>';
});
} else {
html += '<tr><td colspan="3">暂无数据</td></tr>';
}
html += '</tbody>'
$('.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);
}
}