2025-01-16 18:42:07 +08:00
|
|
|
let form, table, laydate;
|
|
|
|
|
let tableIns;
|
|
|
|
|
let pageNum = 1; // 定义分页
|
|
|
|
|
layui.use(["form", "table", 'laydate'], function () {
|
|
|
|
|
form = layui.form;
|
|
|
|
|
table = layui.table;
|
|
|
|
|
laydate = layui.laydate;
|
|
|
|
|
laydate.render({
|
|
|
|
|
elem: '#ID-laydate-rangeLinked',
|
|
|
|
|
range: ['#startDay', '#endDay'],
|
|
|
|
|
rangeLinked: true
|
|
|
|
|
});
|
|
|
|
|
initTable();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 查询/重置
|
|
|
|
|
function queryTable(type) {
|
|
|
|
|
if (type === 1) {
|
|
|
|
|
let keyWord = $('#keyWord').val();
|
|
|
|
|
let flag = checkValue(keyWord);
|
|
|
|
|
if (flag) {
|
|
|
|
|
$('#keyWord').val('');
|
|
|
|
|
return layer.msg('关键字查询包含特殊字符,请重新输入', { icon: 2 });
|
|
|
|
|
}
|
|
|
|
|
reloadTable(1);
|
|
|
|
|
} else if (type === 2) {
|
|
|
|
|
$('#keyWord').val('');
|
|
|
|
|
$('#xmZt').val('');
|
|
|
|
|
$('#dataSource').val('');
|
|
|
|
|
layui.form.render();
|
|
|
|
|
reloadTable(1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 刷新页面数据
|
|
|
|
|
function reloadData() {
|
|
|
|
|
reloadTable(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 重载表格
|
|
|
|
|
function reloadTable(pageNum) {
|
|
|
|
|
table.reload("currentTableId", {
|
|
|
|
|
page: {
|
|
|
|
|
curr: pageNum ? pageNum : 1,
|
|
|
|
|
},
|
|
|
|
|
where: {
|
|
|
|
|
encryptedData: JSON.stringify({
|
|
|
|
|
'keyWord': $('#keyWord').val(),
|
|
|
|
|
'xmZt': $('#xmZt').val(),
|
|
|
|
|
'dataSource': $('#dataSource').val(),
|
|
|
|
|
}),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 初始化表格
|
|
|
|
|
function initTable() {
|
|
|
|
|
tableIns = table.render({
|
|
|
|
|
elem: "#currentTableId",
|
|
|
|
|
id: 'currentTableId',
|
|
|
|
|
headers: {
|
|
|
|
|
authorization: sessionStorage.getItem("gz-token"),
|
|
|
|
|
},
|
|
|
|
|
height: "full-170",
|
|
|
|
|
url: dataUrl + "backstage/pro/getProList",
|
|
|
|
|
where: {
|
|
|
|
|
encryptedData: JSON.stringify({
|
|
|
|
|
'keyWord': $('#keyWord').val(),
|
|
|
|
|
'xmZt': $('#xmZt').val(),
|
|
|
|
|
'dataSource': $('#dataSource').val(),
|
|
|
|
|
}),
|
|
|
|
|
},
|
|
|
|
|
request: {
|
|
|
|
|
pageName: 'pageNum',
|
|
|
|
|
limitName: 'pageSize'
|
|
|
|
|
},
|
|
|
|
|
parseData: function (res) { // res 即为原始返回的数据
|
|
|
|
|
if(res.code === 401){
|
|
|
|
|
closeWindowOpen();
|
|
|
|
|
}
|
|
|
|
|
return {
|
|
|
|
|
"code": 0, // 解析接口状态
|
|
|
|
|
"msg": '获取成功', // 解析提示文本
|
|
|
|
|
"count": res.total, // 解析数据长度
|
|
|
|
|
"data": res.list // 解析数据列表
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
cols: [
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
width: '6.9%',
|
|
|
|
|
title: "序号",
|
|
|
|
|
align: "center",
|
|
|
|
|
templet: function (d) {
|
|
|
|
|
return d.LAY_NUM;
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: "bmname",
|
|
|
|
|
width: '8%',
|
|
|
|
|
title: "分公司",
|
|
|
|
|
unresize: true,
|
|
|
|
|
align: "center",
|
2025-01-21 10:29:34 +08:00
|
|
|
sort:true,
|
2025-01-16 18:42:07 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: "bdname",
|
|
|
|
|
width: '12%',
|
|
|
|
|
title: "标段工程名称",
|
|
|
|
|
unresize: true,
|
|
|
|
|
align: "center",
|
2025-01-21 10:29:34 +08:00
|
|
|
sort:true,
|
2025-01-16 18:42:07 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: "projectcategory",
|
|
|
|
|
width: '8%',
|
|
|
|
|
title: "工程类别",
|
|
|
|
|
unresize: true,
|
|
|
|
|
align: "center",
|
2025-01-21 10:29:34 +08:00
|
|
|
sort:true,
|
2025-01-16 18:42:07 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: "voltagelevel",
|
|
|
|
|
width: '8%',
|
|
|
|
|
title: "电压等级",
|
|
|
|
|
unresize: true,
|
|
|
|
|
align: "center",
|
2025-01-21 10:29:34 +08:00
|
|
|
sort:true,
|
2025-01-16 18:42:07 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: "constructionsite",
|
|
|
|
|
width: '12%',
|
|
|
|
|
title: "施工地点",
|
|
|
|
|
unresize: true,
|
|
|
|
|
align: "center",
|
2025-01-21 10:29:34 +08:00
|
|
|
sort:true,
|
2025-01-16 18:42:07 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: "starttime",
|
|
|
|
|
width: '9%',
|
|
|
|
|
title: "计划开工日期",
|
|
|
|
|
unresize: true,
|
|
|
|
|
align: "center",
|
2025-01-21 10:29:34 +08:00
|
|
|
sort:true,
|
2025-01-16 18:42:07 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: "completiontime",
|
|
|
|
|
width: '9%',
|
|
|
|
|
title: "计划竣工日期",
|
|
|
|
|
unresize: true,
|
|
|
|
|
align: "center",
|
2025-01-21 10:29:34 +08:00
|
|
|
sort:true,
|
2025-01-16 18:42:07 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: "xmZt",
|
|
|
|
|
width: '8%',
|
|
|
|
|
title: "项目状态",
|
|
|
|
|
unresize: true,
|
|
|
|
|
align: "center",
|
2025-01-21 10:29:34 +08:00
|
|
|
sort:true,
|
2025-01-16 18:42:07 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: "dataSource",
|
|
|
|
|
width: '8%',
|
|
|
|
|
title: "数据来源",
|
|
|
|
|
unresize: true,
|
|
|
|
|
align: "center",
|
2025-01-21 10:29:34 +08:00
|
|
|
sort:true,
|
2025-01-16 18:42:07 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: "操作",
|
|
|
|
|
width: '11%',
|
|
|
|
|
align: "center",
|
|
|
|
|
unresize: true,
|
|
|
|
|
templet: function (d) {
|
|
|
|
|
let html = "";
|
|
|
|
|
html += "<a onclick='addOrUpdateBidPro(" + JSON.stringify(d) + ",3)'>详情</a>";
|
|
|
|
|
if (d.dataSource === '施工平台') {
|
|
|
|
|
html += "<div class='splitLine'>|</div><a onclick='addOrUpdateBidPro(" + JSON.stringify(d) + ",4)'>补充</a>";
|
|
|
|
|
} else if (d.dataSource === '自建') {
|
|
|
|
|
html += "<div class='splitLine'>|</div><a onclick='addOrUpdateBidPro(" + JSON.stringify(d) + ",2)'>修改</a>";
|
|
|
|
|
html += "<div class='splitLine'>|</div><a style='color:#f56c6c;' onclick='delData(" + JSON.stringify(d) + ")'>删除</a>";
|
|
|
|
|
}
|
|
|
|
|
return html;
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
limits: [10, 15, 20, 25, 50, 100],
|
|
|
|
|
limit: 10,
|
|
|
|
|
page: true,
|
|
|
|
|
done: function (res, curr, count) {
|
|
|
|
|
pageNum = tableIns.config.page.curr;
|
|
|
|
|
table.resize("currentTableId");
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 导出
|
|
|
|
|
function exportExcel() {
|
|
|
|
|
let params = {
|
|
|
|
|
'keyWord': $('#keyWord').val(),
|
|
|
|
|
'xmZt': $('#xmZt').val(),
|
|
|
|
|
'dataSource': $('#dataSource').val(),
|
|
|
|
|
}
|
|
|
|
|
let url = dataUrl + "backstage/pro/export";
|
|
|
|
|
exportExcelUtil(url, '标段工程', JSON.stringify(params));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 新增/修改/详情
|
|
|
|
|
function addOrUpdateBidPro(obj, type) {
|
|
|
|
|
let title = '', content = '',width = '50%',height = '95%';
|
|
|
|
|
if (type === 1) {
|
|
|
|
|
title = '新增';
|
|
|
|
|
content = './child/bid_pro_form.html';
|
|
|
|
|
} else if (type === 2) {
|
|
|
|
|
title = '修改';
|
|
|
|
|
content = './child/bid_pro_form.html';
|
|
|
|
|
} else if (type === 3) {
|
|
|
|
|
title = '详情';
|
|
|
|
|
content = './child/bid_pro_detail.html';
|
|
|
|
|
width = '92%',height = '92%';
|
|
|
|
|
} else if (type === 4) {
|
|
|
|
|
title = '补充';
|
|
|
|
|
content = './child/bid_pro_supplement.html';
|
|
|
|
|
}
|
|
|
|
|
obj.type = type;
|
|
|
|
|
openIframeByParamObj("addOrUpdateBidPro", title, content, width, height, obj);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 删除标段工程
|
|
|
|
|
function delData(data) {
|
|
|
|
|
layer.confirm("确定删除此条数据吗?", { 'title': '操作提示', move: false }, function () {
|
|
|
|
|
let loadingMsg = layer.msg('数据删除中,请稍候...', { icon: 16, scrollbar: false, time: 0 });
|
|
|
|
|
let url = dataUrl + "backstage/pro/delPro"
|
|
|
|
|
let obj = { 'id': data.id }
|
|
|
|
|
let params = {
|
|
|
|
|
encryptedData: JSON.stringify(obj)
|
|
|
|
|
}
|
|
|
|
|
ajaxRequest(url, "POST", params, true, function () {
|
|
|
|
|
}, function (result) {
|
|
|
|
|
console.error(result);
|
|
|
|
|
layer.close(loadingMsg); // 关闭提示层
|
|
|
|
|
if (result.code === 200) {
|
|
|
|
|
layer.msg(result.msg, { icon: 1 })
|
|
|
|
|
queryTable(1);
|
|
|
|
|
} else {
|
|
|
|
|
layer.msg(result.msg, { icon: 2 })
|
|
|
|
|
}
|
|
|
|
|
}, function (xhr) {
|
|
|
|
|
layer.close(loadingMsg); // 关闭提示层
|
|
|
|
|
error(xhr)
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 高级筛选
|
|
|
|
|
function highSearch() {
|
|
|
|
|
|
|
|
|
|
}
|