84 lines
3.0 KiB
JavaScript
84 lines
3.0 KiB
JavaScript
let table, layer, form;
|
|
layui.use(['layer', 'table', 'form'], function () {
|
|
layer = layui.layer;
|
|
table = layui.table;
|
|
form = layui.form;
|
|
// 响应成功后的拦截器
|
|
$.ajaxSetup({
|
|
beforeSend: function (xhr, options) {
|
|
var originalSuccess = options.success
|
|
options.success = function (data, textStatus, jqXhr) {
|
|
data = modifyResponseData(data);
|
|
// success(data,textStatus, jqXhr);
|
|
originalSuccess.apply(this, arguments)
|
|
}
|
|
}
|
|
})
|
|
initTable(1, parent.$('#bidPro').val());
|
|
});
|
|
|
|
/* 切换数据 */
|
|
function changeData(that, type) {
|
|
const bidCode = parent.$('#bidPro').val();
|
|
$(".ul-box li").each(function () {
|
|
if ($(this).hasClass("check")) {
|
|
$(this).removeClass("check").addClass("nocheck");
|
|
}
|
|
});
|
|
var tableElem = $('#demo2').parents('.layui-table-view');
|
|
tableElem.remove();
|
|
$(that).removeClass("nocheck").addClass("check");
|
|
if (type === 1 || type === 2 || type === 3 || type === 6 || type === 12) {
|
|
initTable(type, bidCode);
|
|
$('#right-table-box').removeAttr('style');
|
|
$('#no-data-box').css({ 'display': 'none' });
|
|
$('#right-box').css({ 'display': 'none' });
|
|
}
|
|
|
|
}
|
|
|
|
|
|
function initTable(type, bidCode) {
|
|
const url = commonUrl + "screen/largeScreen/dataAnalysis/getEngqualityAnalysis";
|
|
table.render({
|
|
elem: '#demo2',
|
|
url: url,
|
|
skin: 'line',
|
|
page: true,
|
|
height: 'full-100',
|
|
headers: {
|
|
"decrypt": "decrypt",
|
|
"Authorization": token
|
|
},
|
|
where: {
|
|
bidCode: bidCode,
|
|
type: type
|
|
},
|
|
cols: [setCols(type)],
|
|
initComplete: function () {
|
|
// 在表格渲染完成后,重新渲染序号列
|
|
var that = this.elem.next();
|
|
var tool = that.children('.layui-table-box').children('.layui-table-fixed').children('.layui-table-body').children('.layui-table');
|
|
tool.find("tr").each(function (index, item) {
|
|
$(this).find('td[data-field="LAY_TABLE_INDEX"]').text(index + 1);
|
|
});
|
|
},
|
|
done: function (res, curr, count, origin) {
|
|
// console.log(res);
|
|
}
|
|
})
|
|
|
|
function setCols(type) {
|
|
if (type === 1) { // 工程质量分析
|
|
return [
|
|
{ type: 'numbers', title: '序号', width: '10%' }, // 添加序号列
|
|
{ field: 'projectName', title: '工程名称', align: 'center', width: '15%' },
|
|
{ field: 'projectNumber', title: '工程编号', align: 'center', width: '15%' },
|
|
{ field: 'projectAddress', title: '项目地址', align: 'center', width: '15%' },
|
|
{ field: 'contractorName', title: '合同编号', align: 'center', width: '15%' },
|
|
{ field: 'qualityLevel', title: '质量等级', align: 'center', width: '15%' },
|
|
{ field: 'isContract', title: '是否签订合同', align: 'center', width: '15%' },
|
|
];
|
|
}
|
|
}
|
|
} |