This commit is contained in:
BianLzhaoMin 2025-07-28 13:21:49 +08:00
parent acacc5f98e
commit 1cee686c16
2 changed files with 733 additions and 705 deletions

View File

@ -1,203 +1,231 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Demo</title>
<link rel="stylesheet" href="../../../layui/css/layui.css"/>
<link rel="stylesheet" href="../../../layui/css/layui.css" />
</head>
<body>
<div class="layui-btn-group" style="margin-top: 10px" id="btnGroup" hidden="hidden">
<button class="layui-btn layui-btn-sm" onclick="initTable(-1)">事业部评价审批</button>
<button class="layui-btn layui-btn-sm" onclick="initTable(0)">项目部评价审批</button>
</div>
<div class="layui-btn-group" style="margin-top: 10px" id="allAudit">
<button class="layui-btn layui-btn-sm" onclick="allAudit(1)">全部通过</button>
<button class="layui-btn layui-btn-sm" onclick="allAudit(2)">全部驳回</button>
</div>
<form class="layui-form layui-form-pane fromData" action="">
<div style="width: 100%;overflow:auto">
<table class="layui-table" id="baseTable" lay-filter="test">
</table>
<div class="layui-btn-group" style="margin-top: 10px" id="btnGroup" hidden="hidden">
<button class="layui-btn layui-btn-sm" onclick="initTable(-1)">事业部评价审批</button>
<button class="layui-btn layui-btn-sm" onclick="initTable(0)">项目部评价审批</button>
</div>
<div class="layui-form-item" style="display: none">
<div class="layui-input-block">
<button type="submit" class="layui-btn subBtn" id="commit" lay-submit lay-filter="formDemo">提交
</button>
<div class="layui-btn-group" style="margin-top: 10px" id="allAudit">
<button class="layui-btn layui-btn-sm" onclick="allAudit(1)">全部通过</button>
<button class="layui-btn layui-btn-sm" onclick="allAudit(2)">全部驳回</button>
</div>
<form class="layui-form layui-form-pane fromData" action="">
<div style="width: 100%;overflow:auto">
<table class="layui-table" id="baseTable" lay-filter="test">
</table>
</div>
</div>
</form>
<script src="../../../js/publicJs.js"></script>
<script src="../../../js/common_methon.js"></script>
<script src="../../../js/common.js"></script>
<script type="text/javascript" src="../../../js/libs/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="../../../js/jq.js"></script>
<script type="text/javascript" src="../../../js/my/permission.js"></script>
<script src="../../../layui/layui.js"></script>
<script>
let headerRows;
let alter = true;
let layer, laydate, table, form;
let tableLoading;
$(function () {
let use1 = layui.use(['layer', 'laydate', 'table', 'form'], function () {
layer = layui.layer;
laydate = layui.laydate;
table = layui.table;
form = layui.form;
//自定义loading
let loginUser = JSON.parse(localStorage.getItem('loginUser'));
if (loginUser) {
if (loginUser.isBusinessDivision) {
if (parseInt(loginUser.isBusinessDivision) === 1) {
$('#btnGroup').show();
} else {
$('#btnGroup').hide();
<div class="layui-form-item" style="display: none">
<div class="layui-input-block">
<button type="submit" class="layui-btn subBtn" id="commit" lay-submit lay-filter="formDemo">提交
</button>
</div>
</div>
</form>
<script src="../../../js/publicJs.js"></script>
<script src="../../../js/common_methon.js"></script>
<script src="../../../js/common.js"></script>
<script type="text/javascript" src="../../../js/libs/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="../../../js/jq.js"></script>
<script type="text/javascript" src="../../../js/my/permission.js"></script>
<script src="../../../layui/layui.js"></script>
<script>
let headerRows;
let alter = true;
let layer, laydate, table, form;
let tableLoading;
let tableRowList = []
$(function () {
let use1 = layui.use(['layer', 'laydate', 'table', 'form'], function () {
layer = layui.layer;
laydate = layui.laydate;
table = layui.table;
form = layui.form;
//自定义loading
let loginUser = JSON.parse(localStorage.getItem('loginUser'));
if (loginUser) {
if (loginUser.isBusinessDivision) {
if (parseInt(loginUser.isBusinessDivision) === 1) {
$('#btnGroup').show();
} else {
$('#btnGroup').hide();
}
}
}
tableLoading = layer.load(2, { shade: [0.1, '#fff'] });
initTable(null);
form.on('submit(formDemo)', function (data) {
getTableData();
return false;
});
});
let use = use1;
// 获取当前页面类型
const typeValue = getUrlParam("type")
// 获取当前用户的组织机构id
const loginUser = localStorage.getItem('loginUser') ? JSON.parse(localStorage.getItem('loginUser')) : null;
if ((loginUser && loginUser.orgType == 1) || typeValue == 2) {
// 隐藏全部审核按钮
$('#allAudit').hide();
}
});
function initTable(deptId) {
getTitle(deptId);
}
function setCols(data, msg) {
tableRowList = JSON.parse(msg)
//重新加载表格 清空之前的表头和内容
table.reload('baseTable', {
cols: []
});
headerRows = [];
headerRows = JSON.parse(data);
// Clear existing headers
const thead = document.querySelector('#baseTable thead');
if (thead) {
thead.innerHTML = '';
} else {
const newThead = document.createElement('thead');
document.querySelector('#baseTable').appendChild(newThead);
}
tableLoading = layer.load(2, {shade: [0.1, '#fff']});
initTable(null);
form.on('submit(formDemo)', function (data) {
getTableData();
return false;
});
});
let use = use1;
// 获取当前页面类型
const typeValue = getUrlParam("type")
// 获取当前用户的组织机构id
const loginUser = localStorage.getItem('loginUser') ? JSON.parse(localStorage.getItem('loginUser')) : null;
if ((loginUser && loginUser.orgType == 1) || typeValue == 2) {
// 隐藏全部审核按钮
$('#allAudit').hide();
}
});
function initTable(deptId) {
getTitle(deptId);
}
function setCols(data, msg) {
//重新加载表格 清空之前的表头和内容
table.reload('baseTable', {
cols: []
});
headerRows = [];
headerRows = JSON.parse(data);
// Clear existing headers
const thead = document.querySelector('#baseTable thead');
if (thead) {
thead.innerHTML = '';
} else {
const newThead = document.createElement('thead');
document.querySelector('#baseTable').appendChild(newThead);
}
//动态生成表头
headerRows.forEach(rowData => {
rowData.forEach(cellData => {
cellData.align = 'center';
if (cellData.title === '序号') {
cellData.type = 'numbers';
}
if (!['审核', '序号', '施工业务外包商', '工程名称'].includes(cellData.title)) {
if (cellData.field.split('-').length === 2) {
cellData.title =
`${cellData.title}<i class="layui-icon layui-icon-tips layui-font-14" lay-event="checkTips"
title="计算方法" style="margin-left: 5px;"></i>`;
//动态生成表头
headerRows.forEach(rowData => {
rowData.forEach(cellData => {
cellData.align = 'center';
if (cellData.title === '序号') {
cellData.type = 'numbers';
}
}
if (cellData.mergeType === "colspan") {
cellData.colspan = cellData.num;
} else if (cellData.mergeType === "rowspan") {
cellData.rowspan = cellData.num;
}
if (cellData.field === 'examineAndApprove') {
cellData.templet = function (d) {
//如果d.isApprove == 1 去除当前行的编辑功能
let text = "";
console.log("======")
console.log("======", getUrlParam("type"))
console.log("======", d.isApprove)
if (getUrlParam("type") == '1') {
if (!['审核', '序号', '施工业务外包商', '工程名称'].includes(cellData.title)) {
if (cellData.field.split('-').length === 2) {
cellData.title =
`${cellData.title}<i class="layui-icon layui-icon-tips layui-font-14" lay-event="checkTips"
title="计算方法" style="margin-left: 5px;"></i>`;
}
}
if (cellData.mergeType === "colspan") {
cellData.colspan = cellData.num;
} else if (cellData.mergeType === "rowspan") {
cellData.rowspan = cellData.num;
}
if (cellData.field === 'examineAndApprove') {
cellData.templet = function (d) {
//如果d.isApprove == 1 去除当前行的编辑功能
let text = "";
console.log("======")
console.log("======", getUrlParam("type"))
console.log("======", d.isApprove)
if (getUrlParam("type") == '1') {
if (d.isApprove == 0) {
text += '<a lay-event="pass" style="color: #009688;cursor: pointer;font-size: 15px"' +
' id="pass">通过</a>';
text +=
'<a lay-event="reject" style="color: #a59e9e;cursor: pointer;font-size: 15px;margin-left: 10px"' +
' id="reject">驳回</a>';
} else if (d.isApprove == 1) {
text += '<span style="color: #009688;font-size: 15px">已通过</span>';
} else if (d.isApprove == 2) {
text += '<span style="color: #a59e9e;font-size: 15px">已驳回</span>';
if (d.isApprove == 0) {
text += '<a lay-event="pass" style="color: #009688;cursor: pointer;font-size: 15px"' +
' id="pass">通过</a>';
text +=
'<a lay-event="reject" style="color: #a59e9e;cursor: pointer;font-size: 15px;margin-left: 10px"' +
' id="reject">驳回</a>';
} else if (d.isApprove == 1) {
text += '<span style="color: #009688;font-size: 15px">已通过</span>';
} else if (d.isApprove == 2) {
text += '<span style="color: #a59e9e;font-size: 15px">已驳回</span>';
}
} else {
if (d.isApprove == 1) {
text += '<span style="color: #009688;font-size: 15px">已通过</span>';
} else if (d.isApprove == 2) {
text += '<span style="color: #a59e9e;font-size: 15px">已驳回</span>';
}
}
} else {
if (d.isApprove == 1) {
text += '<span style="color: #009688;font-size: 15px">已通过</span>';
} else if (d.isApprove == 2) {
text += '<span style="color: #a59e9e;font-size: 15px">已驳回</span>';
return text;
}
}
});
});
table.render({
elem: '#baseTable',
cols: headerRows,
data: JSON.parse(msg), // 使用从 API 获取的数据
//data: msg, // 使用从 API 获取的数据
loading: true,
done: function (res) {
var columsName = ['subName'];//需要合并的列名称 ['business_tenant_name','land','contract_begin','contract_end','history_arrears','period'];
var columsIndex = [1];//需要合并的列索引值 [2,3,5,6,14,15];
merge(res, columsName, columsIndex);
tableLoading && layer.close(tableLoading);
cols.each(function (index, item) {
if (index > 2 && index != cols.length - 1) {
let dataId = $(this).data('field')
if (item1[`${dataId}-file`] && item1[`${dataId}-file`]['fileName'] != '') {
$(this).find('.layui-table-cell').append(`<i class="layui-icon layui-icon-file-b file-icon" data-index="${i}" data-id="${dataId}" style="margin-left:6px;cursor:pointer"></i> `)
}
}
return text;
}
})
}
});
});
table.render({
elem: '#baseTable',
cols: headerRows,
data: JSON.parse(msg), // 使用从 API 获取的数据
//data: msg, // 使用从 API 获取的数据
loading: true,
done: function (res) {
var columsName = ['subName'];//需要合并的列名称 ['business_tenant_name','land','contract_begin','contract_end','history_arrears','period'];
var columsIndex = [1];//需要合并的列索引值 [2,3,5,6,14,15];
merge(res, columsName, columsIndex);
tableLoading && layer.close(tableLoading);
}
});
table.on('tool(test)', function (obj) {
var data = obj.data; //当前行数据
var rowIndex = obj.index;
var layEvent = obj.event; //当前点击的事件名
if (layEvent === 'pass') {
data.isApprove = 1;
audit(obj, 1, data);
}
if (layEvent === 'reject') {
data.isApprove = 2;
audit(obj, 2, data);
}
});
// 表头自定义元素工具事件 --- 2.8.8+
table.on('colTool(test)', function (obj) {
var event = obj.event;
if (event === 'checkTips') {
let text = `<span><span style="color: red">*</span>指标定义及计算方法:</span> ${obj.col.method}`;
text += `<br/><span><span style="color: red">*</span>积分标准:</span> ${obj.col.standard}`;
layer.alert(text, {
title: `${obj.col.title}`,
table.on('tool(test)', function (obj) {
var data = obj.data; //当前行数据
var rowIndex = obj.index;
var layEvent = obj.event; //当前点击的事件名
if (layEvent === 'pass') {
data.isApprove = 1;
audit(obj, 1, data);
}
if (layEvent === 'reject') {
data.isApprove = 2;
audit(obj, 2, data);
}
});
// 表头自定义元素工具事件 --- 2.8.8+
table.on('colTool(test)', function (obj) {
var event = obj.event;
if (event === 'checkTips') {
let text = `<span><span style="color: red">*</span>指标定义及计算方法:</span> ${obj.col.method}`;
text += `<br/><span><span style="color: red">*</span>积分标准:</span> ${obj.col.standard}`;
layer.alert(text, {
title: `${obj.col.title}`,
});
}
});
}
$(document).on('click', '.layui-table-cell', function (e) {
console.log('点击了单元格')
// 判断是否有文件图标
if ($(this).find('.file-icon').length > 0) {
var dataId = $(this).find('.file-icon').data('id');
var dataIndex = $(this).find('.file-icon').data('index');
console.log('File icon clicked', {
dataIndex: dataIndex,
dataId: dataId,
rowData: tableRowList[dataIndex]
});
window.open(ctxPath + "/statics/" + tableRowList[dataIndex][`${dataId}-file`].filePath.split('/upload/')[1])
}
});
}
function allAudit(type) {
let title = type === 1 ? '全部通过' : '全部驳回';
layer.confirm('确定' + title + '吗?', function (index) {
var tableId = 'baseTable';
var allData = table.cache[tableId];
console.log("allData", allData);
function allAudit(type) {
let title = type === 1 ? '全部通过' : '全部驳回';
layer.confirm('确定' + title + '吗?', function (index) {
var tableId = 'baseTable';
var allData = table.cache[tableId];
console.log("allData", allData);
// 如果是驳回操作type === 2先弹出输入框获取驳回原因
if (type === 2) {
let content = `
// 如果是驳回操作type === 2先弹出输入框获取驳回原因
if (type === 2) {
let content = `
<div style="padding: 20px 100px;">
<span style="color: red">*</span>驳回原因:
<div style="display: inline-block; margin-left: 10px;">
@ -205,10 +233,90 @@
</div>
</div>`;
layer.open({
type: 1,
title: title,
content: content,
btn: ['确定', '取消'],
yes: function (index, layero) {
let rejectReason = $('#rejectReason').val();
if (!rejectReason) {
layer.msg('请输入驳回原因');
return;
}
// 关闭输入框后开始处理所有行
layer.close(index);
// 遍历所有行,调用 auditlc 并传入统一的驳回原因
allData.forEach(function (rowData, index) {
var fakeObj = {
data: rowData,
index: index,
config: { id: tableId }
};
rowData.isApprove = 2;
auditlc(fakeObj, 2, rowData, rejectReason);
if (alter == true) {
parent.layer.closeAll();
}
});
}
});
} else if (type === 1) {
// 全部通过的情况,保持不变
allData.forEach(function (rowData, index) {
var fakeObj = {
data: rowData,
index: index,
config: { id: tableId }
};
rowData.isApprove = 1;
auditlc(fakeObj, 1, rowData);
if (alter == true) {
parent.layer.closeAll();
}
});
}
});
}
function audit(obj, type, data) {
let title = type === 1 ? '通过' : '驳回';
if (type === 1) {
layer.confirm('确定' + title + '吗?', function (index) {
$.ajax({
url: ctxPath + '/outsourcer/audit',
type: 'post',
async: false,
data: {
evaluateId: getUrlParam('id'),
id: data.id,
type: type,
detailsId: data.detailsId,
evaluateType: '1'
},
success: function (res) {
if (res.res == '1') {
data.isApprove = 1;
obj.update(data);
layer.msg(title + '成功');
} else {
data.isApprove = 0;
layer.msg(res.resMsg);
}
}
});
});
} else {
let content = '<div style="padding: 20px 100px;"><span style="color: red">*</span>' + title +
'原因:<input type="text" id="rejectReason" autocomplete="off" class="layui-input" lay-verify="required" style="width: 300px;height: 100px"></div>';
layer.open({
type: 1,
title: title,
content: content,
async: false,
btn: ['确定', '取消'],
yes: function (index, layero) {
let rejectReason = $('#rejectReason').val();
@ -216,48 +324,38 @@
layer.msg('请输入驳回原因');
return;
}
// 关闭输入框后开始处理所有行
layer.close(index);
// 遍历所有行,调用 auditlc 并传入统一的驳回原因
allData.forEach(function (rowData, index) {
var fakeObj = {
data: rowData,
index: index,
config: {id: tableId}
};
rowData.isApprove = 2;
auditlc(fakeObj, 2, rowData, rejectReason);
if (alter == true) {
parent.layer.closeAll();
$.ajax({
url: ctxPath + '/outsourcer/audit',
type: 'post',
data: {
id: data.id,
evaluateId: data.evaluateId,
templateId: data.templateId,
detailsId: data.detailsId,
type: type,
rejectReason: rejectReason,
evaluateType: '1'
},
success: function (res) {
layer.close(index);
if (res.res == '1') {
layer.msg(title + '成功');
data.isApprove = 2;
obj.update(data);
} else {
code = 0;
data.isApprove = 0;
layer.msg(res.resMsg);
}
}
});
}
});
} else if (type === 1) {
// 全部通过的情况,保持不变
allData.forEach(function (rowData, index) {
var fakeObj = {
data: rowData,
index: index,
config: {id: tableId}
};
rowData.isApprove = 1;
auditlc(fakeObj, 1, rowData);
if (alter == true) {
parent.layer.closeAll();
}
});
}
});
}
}
function audit(obj, type, data) {
let title = type === 1 ? '通过' : '驳回';
if (type === 1) {
layer.confirm('确定' + title + '吗?', function (index) {
function auditlc(obj, type, data, rejectReason) {
if (type === 1) {
$.ajax({
url: ctxPath + '/outsourcer/audit',
type: 'post',
@ -277,161 +375,91 @@
} else {
data.isApprove = 0;
layer.msg(res.resMsg);
alter = false;
}
}
});
});
} else {
let content = '<div style="padding: 20px 100px;"><span style="color: red">*</span>' + title +
'原因:<input type="text" id="rejectReason" autocomplete="off" class="layui-input" lay-verify="required" style="width: 300px;height: 100px"></div>';
layer.open({
type: 1,
title: title,
content: content,
async: false,
btn: ['确定', '取消'],
yes: function (index, layero) {
let rejectReason = $('#rejectReason').val();
if (!rejectReason) {
layer.msg('请输入驳回原因');
return;
}
$.ajax({
url: ctxPath + '/outsourcer/audit',
type: 'post',
data: {
id: data.id,
evaluateId: data.evaluateId,
templateId: data.templateId,
detailsId: data.detailsId,
type: type,
rejectReason: rejectReason,
evaluateType: '1'
},
success: function (res) {
layer.close(index);
if (res.res == '1') {
layer.msg(title + '成功');
data.isApprove = 2;
obj.update(data);
} else {
code = 0;
data.isApprove = 0;
layer.msg(res.resMsg);
}
} else {
$.ajax({
url: ctxPath + '/outsourcer/audit',
type: 'post',
data: {
id: data.id,
evaluateId: data.evaluateId,
templateId: data.templateId,
detailsId: data.detailsId,
type: type,
rejectReason: rejectReason, // 使用统一的原因
evaluateType: '1'
},
success: function (res) {
if (res.res == '1') {
layer.msg(title + '成功');
data.isApprove = 2;
obj.update(data);
} else {
data.isApprove = 0;
layer.msg(res.resMsg);
}
});
}
});
}
});
}
}
}
function auditlc(obj, type, data, rejectReason) {
if (type === 1) {
function getTitle(deptId) {
$.ajax({
url: ctxPath + '/outsourcer/audit',
type: 'post',
async: false,
url: ctxPath + '/outsourcer/getAuditTitleData',
type: 'get',
data: {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('id'),
id: data.id,
type: type,
detailsId: data.detailsId,
evaluateType: '1'
type: 'audit',
deptId: deptId
},
success: function (res) {
if (res.res == '1') {
data.isApprove = 1;
obj.update(data);
layer.msg(title + '成功');
} else {
data.isApprove = 0;
layer.msg(res.resMsg);
alter = false;
}
setCols(res.obj, res.resMsg);
}
});
} else {
$.ajax({
url: ctxPath + '/outsourcer/audit',
type: 'post',
data: {
id: data.id,
evaluateId: data.evaluateId,
templateId: data.templateId,
detailsId: data.detailsId,
type: type,
rejectReason: rejectReason, // 使用统一的原因
evaluateType: '1'
},
success: function (res) {
if (res.res == '1') {
layer.msg(title + '成功');
data.isApprove = 2;
obj.update(data);
} else {
data.isApprove = 0;
layer.msg(res.resMsg);
}
}
});
}
}
function getTitle(deptId) {
$.ajax({
url: ctxPath + '/outsourcer/getAuditTitleData',
type: 'get',
data: {
})
}
function getTableData() {
//获取表格填写的数据
var tableData = table.cache.baseTable;
let filed = [];
//定义一个map
let obj = tableData[0];
for (let key in obj) {
if (key.indexOf('LAY') === -1 && !['subName', 'proName', 'subId', 'proId'].includes(key)) {
filed.push(key);
}
}
//TODO 校验数据
let data = {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('id'),
type: 'audit',
deptId: deptId
},
success: function (res) {
setCols(res.obj, res.resMsg);
}
})
}
function getTableData() {
//获取表格填写的数据
var tableData = table.cache.baseTable;
let filed = [];
//定义一个map
let obj = tableData[0];
for (let key in obj) {
if (key.indexOf('LAY') === -1 && !['subName', 'proName', 'subId', 'proId'].includes(key)) {
filed.push(key);
}
}
//TODO 校验数据
let data = {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('id'),
jsonData: JSON.stringify(tableData),
titleFiled: filed.join(',')
};
$.ajax({
url: ctxPath + '/outsourcer/saveEvaluateData',
type: 'post',
data: data,
success: function (res) {
if (res.res == '1') {
layer.msg('保存成功');
closePage();
} else {
layer.msg(res.resMsg);
jsonData: JSON.stringify(tableData),
titleFiled: filed.join(',')
};
$.ajax({
url: ctxPath + '/outsourcer/saveEvaluateData',
type: 'post',
data: data,
success: function (res) {
if (res.res == '1') {
layer.msg('保存成功');
closePage();
} else {
layer.msg(res.resMsg);
}
}
}
})
}
})
}
function closePage() {
let index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe层的索引
parent.search(1)
parent.layer.close(index); // 再执行关闭
}
function closePage() {
let index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe层的索引
parent.search(1)
parent.layer.close(index); // 再执行关闭
}
</script>
</script>

View File

@ -5,7 +5,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Demo</title>
<link rel="stylesheet" href="../../../layui/css/layui.css"/>
<link rel="stylesheet" href="../../../layui/css/layui.css" />
<style>
.dialog-title {
padding: 12px 6px;
@ -25,172 +25,172 @@
</head>
<body>
<form class="layui-form layui-form-pane fromData" action="">
<div style="width: 100%;overflow:auto">
<table class="layui-table" id="baseTable" lay-filter="baseTable" style="overflow-x: auto;">
</table>
</div>
<div class="layui-form-item" style="display: none">
<div class="layui-input-block">
<button type="submit" class="layui-btn subBtn" id="commit" lay-submit lay-filter="formDemo">提交
</button>
<form class="layui-form layui-form-pane fromData" action="">
<div style="width: 100%;overflow:auto">
<table class="layui-table" id="baseTable" lay-filter="baseTable" style="overflow-x: auto;">
</table>
</div>
</div>
</form>
<script src="../../../js/publicJs.js"></script>
<script src="../../../js/common_methon.js"></script>
<script src="../../../js/common.js"></script>
<script type="text/javascript" src="../../../js/libs/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="../../../js/jq.js"></script>
<script type="text/javascript" src="../../../js/my/permission.js"></script>
<script src="../../../layui/layui.js"></script>
<script>
let headerRows;
let layer, laydate, table, form;
let tableLoading, tableIns;
let targetFieldPrefixForNegativeInput = ''; // 新增:用于存储“加减分项”的字段前缀
<div class="layui-form-item" style="display: none">
<div class="layui-input-block">
<button type="submit" class="layui-btn subBtn" id="commit" lay-submit lay-filter="formDemo">提交
</button>
</div>
</div>
</form>
<script src="../../../js/publicJs.js"></script>
<script src="../../../js/common_methon.js"></script>
<script src="../../../js/common.js"></script>
<script type="text/javascript" src="../../../js/libs/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="../../../js/jq.js"></script>
<script type="text/javascript" src="../../../js/my/permission.js"></script>
<script src="../../../layui/layui.js"></script>
<script>
let headerRows;
let layer, laydate, table, form;
let tableLoading, tableIns;
let targetFieldPrefixForNegativeInput = ''; // 新增:用于存储“加减分项”的字段前缀
// 定义一个列表的数据源 作为提交时参数
let tableRowList = []
let tableFieldList = []
let tableFieldValueList = []
$(function () {
layui.use(['layer', 'laydate', 'table', 'form'], function () {
layer = layui.layer;
laydate = layui.laydate;
table = layui.table;
form = layui.form;
//自定义loading
tableLoading = layer.load(2, {shade: [0.1, '#fff']});
initTable();
form.on('submit(formDemo)', function (data) {
getTableData();
return false;
// 定义一个列表的数据源 作为提交时参数
let tableRowList = []
let tableFieldList = []
let tableFieldValueList = []
$(function () {
layui.use(['layer', 'laydate', 'table', 'form'], function () {
layer = layui.layer;
laydate = layui.laydate;
table = layui.table;
form = layui.form;
//自定义loading
tableLoading = layer.load(2, { shade: [0.1, '#fff'] });
initTable();
form.on('submit(formDemo)', function (data) {
getTableData();
return false;
});
});
});
});
function initTable() {
getTitle();
}
function initTable() {
getTitle();
}
function setCols(data, msg) {
headerRows = [];
headerRows = JSON.parse(data);
function setCols(data, msg) {
headerRows = [];
headerRows = JSON.parse(data);
tableRowList = JSON.parse(msg)
tableRowList = JSON.parse(msg)
// 定义弹框内需要的label
const dialogLabelList = headerRows[1]
const dialogLabelInfo = headerRows[2]
tableFieldList = dialogLabelInfo
tableFieldValueList = dialogLabelList
// 定义弹框内需要的label
const dialogLabelList = headerRows[1]
const dialogLabelInfo = headerRows[2]
tableFieldList = dialogLabelInfo
tableFieldValueList = dialogLabelList
// 根据一级标题“六、加减分项”找到对应的字段前缀
for (const col of headerRows[0]) {
if (col.title === '六、加减分项') {
targetFieldPrefixForNegativeInput = col.field;
break;
// 根据一级标题“六、加减分项”找到对应的字段前缀
for (const col of headerRows[0]) {
if (col.title === '六、加减分项') {
targetFieldPrefixForNegativeInput = col.field;
break;
}
}
}
// Clear existing headers
const thead = document.querySelector('#baseTable thead');
if (thead) {
thead.innerHTML = '';
} else {
const newThead = document.createElement('thead');
document.querySelector('#baseTable').appendChild(newThead);
}
// Clear existing headers
const thead = document.querySelector('#baseTable thead');
if (thead) {
thead.innerHTML = '';
} else {
const newThead = document.createElement('thead');
document.querySelector('#baseTable').appendChild(newThead);
}
//动态生成表头
headerRows.forEach((rowData, index) => {
let dataList = rowData
let href = window.location.href
//动态生成表头
headerRows.forEach((rowData, index) => {
let dataList = rowData
let href = window.location.href
dataList.forEach(cellData => {
cellData.cellMinWidth = 120;
cellData.align = 'center';
if (cellData.title === '序号') {
cellData.type = 'numbers';
}
if (!['审核', '序号', '施工业务外包商', '工程名称', '评价人', '操作', '审批'].includes(cellData.title)) {
if (cellData.field.split('-').length === 1) {
cellData.title =
`<span lay-event="checkTips">${cellData.title}<i class="layui-icon layui-icon-tips layui-font-14"
dataList.forEach(cellData => {
cellData.cellMinWidth = 120;
cellData.align = 'center';
if (cellData.title === '序号') {
cellData.type = 'numbers';
}
if (!['审核', '序号', '施工业务外包商', '工程名称', '评价人', '操作', '审批'].includes(cellData.title)) {
if (cellData.field.split('-').length === 1) {
cellData.title =
`<span lay-event="checkTips">${cellData.title}<i class="layui-icon layui-icon-tips layui-font-14"
title="计算方法" style="margin-left: 5px;"></i></span>`;
}
}
if (cellData.mergeType === "colspan") {
cellData.colspan = cellData.num;
} else if (cellData.mergeType === "rowspan") {
cellData.rowspan = cellData.num;
}
// 去除审核
if (cellData.field === 'examineAndApprove' && href.includes('type=1')) {
cellData.hide = true;
}
});
});
tableIns = table.render({
elem: '#baseTable',
id: 'baseTable',
cols: headerRows,
data: JSON.parse(msg), // 使用从 API 获取的数据
cellMinWidth: 120, // 设置列的最小宽度以实现自适应
//data: msg, // 使用从 API 获取的数据
loading: true,
done: function (res) {
var tableView = this.elem.next();
layui.each(res.data, function (i, item1) {
if (item1.isApprove == '1') { // Condition to make the row non-editable
}
var cols = tableView.find('tr[data-index=' + i + ']').find('td');
cols.each(function (index, item) {
//对field为subNameproName 的列不进行设置
if (index > 2 && index != cols.length - 1) {
console.log(item, 'item')
let dataId = $(this).data('field')
if (item1[`${dataId}-file`] && item1[`${dataId}-file`]['fileName'] != '') {
$(this).find('.layui-table-cell').append(`<i class="layui-icon layui-icon-file-b file-icon" data-index="${i}" data-id="${dataId}" style="margin-left:6px;cursor:pointer"></i> `)
}
}
}
if (cellData.mergeType === "colspan") {
cellData.colspan = cellData.num;
} else if (cellData.mergeType === "rowspan") {
cellData.rowspan = cellData.num;
}
// 去除审核
if (cellData.field === 'examineAndApprove' && href.includes('type=1')) {
cellData.hide = true;
}
});
if (index === cols.length - 1) {
let div = $(this).find('div')
});
tableIns = table.render({
elem: '#baseTable',
id: 'baseTable',
cols: headerRows,
data: JSON.parse(msg), // 使用从 API 获取的数据
cellMinWidth: 120, // 设置列的最小宽度以实现自适应
//data: msg, // 使用从 API 获取的数据
loading: true,
done: function (res) {
var tableView = this.elem.next();
layui.each(res.data, function (i, item1) {
if (item1.isApprove == '1') { // Condition to make the row non-editable
// 创建自定义 DOM 元素
let customElement = $('<button>', {
class: 'layui-btn layui-btn-sm',
id: 'evaluate-btn',
text: '评价',
type: 'button'
});
let fileList = []
let uploadDom = []
}
var cols = tableView.find('tr[data-index=' + i + ']').find('td');
cols.each(function (index, item) {
//对field为subNameproName 的列不进行设置
if (index > 2 && index != cols.length - 1) {
// 将自定义元素插入到最后一个单元格
div.append(customElement);
console.log(item, 'item')
let dataId = $(this).data('field')
if (item1[`${dataId}-file`] && item1[`${dataId}-file`]['fileName'] != '') {
$(this).find('.layui-table-cell').append(`<i class="layui-icon layui-icon-file-b file-icon" data-index="${i}" data-id="${dataId}" style="margin-left:6px;cursor:pointer"></i> `)
}
}
customElement.on('click', function (event) {
event.stopPropagation()
event.preventDefault()
if (index === cols.length - 1) {
let div = $(this).find('div')
// 组装dom
let rowIndex = $(this).closest('tr').data('index')
let formHtml = `<div class="dialog-title">${tableRowList[rowIndex].proName}</div>`
let innerHtml = ''
const curRows = tableRowList[rowIndex]
dialogLabelList.forEach((e, index) => {
isFile = null
if (curRows[`${dialogLabelInfo[index].field}-file`]) {
isFile = curRows[`${dialogLabelInfo[index].field}-file`]
}
uploadDom.push('#uploadBtn' + index)
innerHtml += `<div style="padding:6px 0;display: flex; align-items: center;">
// 创建自定义 DOM 元素
let customElement = $('<button>', {
class: 'layui-btn layui-btn-sm',
id: 'evaluate-btn',
text: '评价',
type: 'button'
});
let fileList = []
let uploadDom = []
// 将自定义元素插入到最后一个单元格
div.append(customElement);
customElement.on('click', function (event) {
event.stopPropagation()
event.preventDefault()
// 组装dom
let rowIndex = $(this).closest('tr').data('index')
let formHtml = `<div class="dialog-title">${tableRowList[rowIndex].proName}</div>`
let innerHtml = ''
const curRows = tableRowList[rowIndex]
dialogLabelList.forEach((e, index) => {
isFile = null
if (curRows[`${dialogLabelInfo[index].field}-file`]) {
isFile = curRows[`${dialogLabelInfo[index].field}-file`]
}
uploadDom.push('#uploadBtn' + index)
innerHtml += `<div style="padding:6px 0;display: flex; align-items: center;">
<div style="margin-right: 10px;width: 200px";>${e.title}</div>
<input type="text" data-value="${tableFieldValueList[index]['standardScore']}" data-id="${dialogLabelInfo[index].field}" name="numberInput" placeholder="请输入" style=";width:180px; padding:1px 5px;" value="${curRows[dialogLabelInfo[index].field]}">
<button type="button" data-index="${index}" data-id="${dialogLabelInfo[index].field}" id="uploadBtn${index}" style="color: #4CAF50; border: none; margin-left: 10px; cursor: pointer;display:${(isFile && isFile.fileName != '') ? 'none' : 'block'}">
@ -199,9 +199,9 @@
<div class="upload-success" id="upload-success_${index}" style="display:${isFile && isFile.fileName != '' ? 'block' : 'none'}"><span class="prepend-content">${isFile ? isFile.fileName : ''}</span><i data-index="${rowIndex}" data-id="${dialogLabelInfo[index].field}" data-idx="${index}" class="layui-icon" style="font-size: 18px; color: red; cursor: pointer;">&#xe640;</i> </div>
</div>`
})
})
formHtml += `
formHtml += `
<div style="padding: 12px;">
<form id="uploadForm">
${innerHtml}
@ -209,249 +209,249 @@
</div>`
layer.open({
type: 1,
area: ['auto', 'auto'], // 宽高
content: formHtml,
title: '评分',
btn: ['确定', '取消'],
success: function (layero, index) {
// 点击上传按钮的逻辑
layui.use('upload', function () {
var upload = layui.upload;
// 执行上传功能
var uploadInst = upload.render({
elem: uploadDom.join(','),
url: ctxPath + '/upload/file',
accept: 'file',
multiple: false,
done: function (res) {
// 上传完毕回调
if (res.res === 1) {
var dataId = $(this.elem).data('id');
var dataIndex = $(this.elem).data('index');
tableRowList[rowIndex][`${dataId}-file`] = {
fileName: res.message,
filePath: res.obj,
layer.open({
type: 1,
area: ['auto', 'auto'], // 宽高
content: formHtml,
title: '评分',
btn: ['确定', '取消'],
success: function (layero, index) {
// 点击上传按钮的逻辑
layui.use('upload', function () {
var upload = layui.upload;
// 执行上传功能
var uploadInst = upload.render({
elem: uploadDom.join(','),
url: ctxPath + '/upload/file',
accept: 'file',
multiple: false,
done: function (res) {
// 上传完毕回调
if (res.res === 1) {
var dataId = $(this.elem).data('id');
var dataIndex = $(this.elem).data('index');
tableRowList[rowIndex][`${dataId}-file`] = {
fileName: res.message,
filePath: res.obj,
}
// 隐藏当前上传按钮
$(`#uploadBtn${dataIndex}`).hide()
$(`#upload-success_${dataIndex}`).show()
$(`#upload-success_${dataIndex}`).prepend(`<span class="prepend-content">${res.message}</span>`)
let hasIcon = tableView.find('tr[data-index=' + rowIndex + ']').find('td[data-field=' + dataId + ']').find('.layui-icon') > 0
} else {
layer.msg(res.resMsg)
}
// 隐藏当前上传按钮
$(`#uploadBtn${dataIndex}`).hide()
$(`#upload-success_${dataIndex}`).show()
$(`#upload-success_${dataIndex}`).prepend(`<span class="prepend-content">${res.message}</span>`)
let hasIcon = tableView.find('tr[data-index=' + rowIndex + ']').find('td[data-field=' + dataId + ']').find('.layui-icon') > 0
} else {
layer.msg(res.resMsg)
},
error: function () {
layer.msg('请求失败')
}
},
error: function () {
layer.msg('请求失败')
}
})
})
})
},
yes: function (index) {
// 点击"确定"按钮时的逻辑
},
yes: function (index) {
// 点击"确定"按钮时的逻辑
let formData = {};
let fields = dialogLabelInfo.map((e) => e.field)
let formData = {};
let fields = dialogLabelInfo.map((e) => e.field)
let isValidate = false
$('#uploadForm input[name="numberInput"]').each(function () {
let inputValue = $(this).val().trim();
let maxValue = $(this).data('value')
const currentDataId = $(this).data('id'); // 获取当前输入框的data-id
let isValidate = false
$('#uploadForm input[name="numberInput"]').each(function () {
let inputValue = $(this).val().trim();
let maxValue = $(this).data('value')
const currentDataId = $(this).data('id'); // 获取当前输入框的data-id
let regex;
let errorMessage;
let inputTitle = '';
let regex;
let errorMessage;
let inputTitle = '';
// 查找对应的标题
const dialogInfoIndex = dialogLabelInfo.findIndex(info => info.field === currentDataId);
if (dialogInfoIndex !== -1) {
inputTitle = dialogLabelList[dialogInfoIndex].title;
}
// 查找对应的标题
const dialogInfoIndex = dialogLabelInfo.findIndex(info => info.field === currentDataId);
if (dialogInfoIndex !== -1) {
inputTitle = dialogLabelList[dialogInfoIndex].title;
}
// 根据dataId是否以“加减分项”的字段前缀开头来判断
if (currentDataId && currentDataId.startsWith(targetFieldPrefixForNegativeInput)) {
regex = /^-?(0|[1-9]\d*)?$/; // 允许负数和非负数整数
errorMessage = `【${inputTitle}】请输入整数`;
} else {
regex = /^(0|[1-9]\d*)?$/; // 只允许非负整数
errorMessage = `【${inputTitle}】请输入大于等于0的正整数`;
}
// 根据dataId是否以“加减分项”的字段前缀开头来判断
if (currentDataId && currentDataId.startsWith(targetFieldPrefixForNegativeInput)) {
regex = /^-?(0|[1-9]\d*)?$/; // 允许负数和非负数整数
errorMessage = `【${inputTitle}】请输入整数`;
} else {
regex = /^(0|[1-9]\d*)?$/; // 只允许非负整数
errorMessage = `【${inputTitle}】请输入大于等于0的正整数`;
}
if (!regex.test(inputValue)) {
layer.msg(errorMessage);
isValidate = true;
return false;
}
// 新增:判断输入值的绝对值是否超过最大分值
if (inputValue !== '' && !isNaN(Number(inputValue))) {
if (Math.abs(Number(inputValue)) > maxValue) {
layer.msg(`【${inputTitle}】输入值不可超过最大分值${maxValue}`);
if (!regex.test(inputValue)) {
layer.msg(errorMessage);
isValidate = true;
return false;
}
}
let dataId = $(this).data('id') // 获取 data-id
if (dataId && inputValue) {
console.log('inputValue=====', inputValue)
formData[dataId] = inputValue * 1 // 将 data-id 作为键,输入框的值作为值
} else {
formData[dataId] = ''
}
})
if (isValidate) return
const currentRows = tableRowList[rowIndex]
Object.assign(currentRows, formData)
for (let key in formData) {
let curTd = tableView.find('tr[data-index=' + rowIndex + ']').find('td[data-field=' + key + ']')
if (curTd.length > 0) {
$(curTd).find('.layui-table-cell').text(formData[key])
let isIcon = $(curTd).find('.layui-table-cell').find('.layui-icon-file-b') > 0
if (tableRowList[rowIndex][`${key}-file`] && tableRowList[rowIndex][`${key}-file`]['fileName'] != '' && !isIcon) {
$(curTd).find('.layui-table-cell').append(`<i class="layui-icon layui-icon-file-b" style="margin-left:6px"></i> `)
// 新增:判断输入值的绝对值是否超过最大分值
if (inputValue !== '' && !isNaN(Number(inputValue))) {
if (Math.abs(Number(inputValue)) > maxValue) {
layer.msg(`【${inputTitle}】输入值不可超过最大分值${maxValue}`);
isValidate = true;
return false;
}
}
if (tableRowList[rowIndex][`${key}-file`] && tableRowList[rowIndex][`${key}-file`]['fileName'] == '' && isIcon) {
$(curTd).find('.layui-table-cell').find('layui-icon-file-b').remove()
let dataId = $(this).data('id') // 获取 data-id
if (dataId && inputValue) {
console.log('inputValue=====', inputValue)
formData[dataId] = inputValue * 1 // 将 data-id 作为键,输入框的值作为值
} else {
formData[dataId] = ''
}
})
if (isValidate) return
const currentRows = tableRowList[rowIndex]
Object.assign(currentRows, formData)
for (let key in formData) {
let curTd = tableView.find('tr[data-index=' + rowIndex + ']').find('td[data-field=' + key + ']')
if (curTd.length > 0) {
$(curTd).find('.layui-table-cell').text(formData[key])
let isIcon = $(curTd).find('.layui-table-cell').find('.layui-icon-file-b') > 0
if (tableRowList[rowIndex][`${key}-file`] && tableRowList[rowIndex][`${key}-file`]['fileName'] != '' && !isIcon) {
$(curTd).find('.layui-table-cell').append(`<i class="layui-icon layui-icon-file-b" style="margin-left:6px"></i> `)
}
if (tableRowList[rowIndex][`${key}-file`] && tableRowList[rowIndex][`${key}-file`]['fileName'] == '' && isIcon) {
$(curTd).find('.layui-table-cell').find('layui-icon-file-b').remove()
}
}
}
layer.msg('保存成功');
layer.close(index); // 关闭弹框
},
btn2: function (index) {
layer.close(index) // 关闭弹框
return false
}
layer.msg('保存成功');
layer.close(index); // 关闭弹框
})
});
}
},
btn2: function (index) {
layer.close(index) // 关闭弹框
return false
}
})
});
}
});
});
});
var columsName = ['subName'];//需要合并的列名称 ['business_tenant_name','land','contract_begin','contract_end','history_arrears','period'];
var columsIndex = [1];//需要合并的列索引值 [2,3,5,6,14,15];
merge(res, columsName, columsIndex);
var columsName = ['subName'];//需要合并的列名称 ['business_tenant_name','land','contract_begin','contract_end','history_arrears','period'];
var columsIndex = [1];//需要合并的列索引值 [2,3,5,6,14,15];
merge(res, columsName, columsIndex);
$(document).on('click', '.upload-success i', function () {
var dataIndex = $(this).data('index');
var Index = $(this).data('idx');
var dataId = $(this).data('id');
$(document).on('click', '.upload-success i', function () {
var dataIndex = $(this).data('index');
var Index = $(this).data('idx');
var dataId = $(this).data('id');
tableRowList[dataIndex][`${dataId}-file`] = {
fileName: '',
filePath: '',
}
$(`#upload-success_${Index}`).hide(function () {
$(`#upload-success_${Index} .prepend-content`).remove();
tableRowList[dataIndex][`${dataId}-file`] = {
fileName: '',
filePath: '',
}
$(`#upload-success_${Index}`).hide(function () {
$(`#upload-success_${Index} .prepend-content`).remove();
})
$(`#uploadBtn${Index}`).show()
})
$(`#uploadBtn${Index}`).show()
})
tableLoading && layer.close(tableLoading);
}
});
// 表头自定义元素工具事件 --- 2.8.8+
table.on('colTool(baseTable)', function (obj) {
const parentText = $(this).parent().text()
var event = obj.event;
if (event === 'checkTips' && parentText !== '审批') {
let text = `<span><span style="color: red">*</span>指标定义及计算方法:</span> ${obj.col.method}`;
text += `<br/><span><span style="color: red">*</span>积分标准:</span> ${obj.col.standard}`;
layer.alert(text, {
title: `${obj.col.title}`,
});
}
});
}
$(document).on('click', '.layui-table-cell', function (e) {
console.log('点击了单元格')
// 判断是否有文件图标
if ($(this).find('.file-icon').length > 0) {
var dataId = $(this).find('.file-icon').data('id');
var dataIndex = $(this).find('.file-icon').data('index');
console.log('File icon clicked', {
dataIndex: dataIndex,
dataId: dataId,
rowData: tableRowList[dataIndex]
tableLoading && layer.close(tableLoading);
}
});
// 表头自定义元素工具事件 --- 2.8.8+
table.on('colTool(baseTable)', function (obj) {
const parentText = $(this).parent().text()
var event = obj.event;
if (event === 'checkTips' && parentText !== '审批') {
let text = `<span><span style="color: red">*</span>指标定义及计算方法:</span> ${obj.col.method}`;
text += `<br/><span><span style="color: red">*</span>积分标准:</span> ${obj.col.standard}`;
layer.alert(text, {
title: `${obj.col.title}`,
});
}
});
window.open(ctxPath +"/statics/"+ tableRowList[dataIndex][`${dataId}-file`].filePath.split('/upload/')[1])
}
});
$(document).on('click', '.layui-table-cell', function (e) {
console.log('点击了单元格')
function getTitle() {
let path = getUrlParam("type") == '0' ? '/outsourcer/getTableTitle' : '/outsourcer/getAuditTitleData';
$.ajax({
url: ctxPath + path,
type: 'get',
data: {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('id'),
type: 'evaluate'
},
success: function (res) {
setCols(res.obj, res.resMsg);
// 判断是否有文件图标
if ($(this).find('.file-icon').length > 0) {
var dataId = $(this).find('.file-icon').data('id');
var dataIndex = $(this).find('.file-icon').data('index');
console.log('File icon clicked', {
dataIndex: dataIndex,
dataId: dataId,
rowData: tableRowList[dataIndex]
});
window.open(ctxPath + "/statics/" + tableRowList[dataIndex][`${dataId}-file`].filePath.split('/upload/')[1])
}
});
})
}
function getTableData() {
var tableData = table.cache.baseTable;
function getTitle() {
let path = getUrlParam("type") == '0' ? '/outsourcer/getTableTitle' : '/outsourcer/getAuditTitleData';
$.ajax({
url: ctxPath + path,
type: 'get',
data: {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('id'),
type: 'evaluate'
},
success: function (res) {
setCols(res.obj, res.resMsg);
}
let fields = tableFieldList.map((e) => e.field)
if (getUrlParam("type") == '2') {
//对tableData进行处理 appraiser = 当前人
for (let i = 0; i < tableData.length; i++) {
tableRowList[i].appraiser = JSON.parse(localStorage.getItem('loginUser')).nickname;
}
})
}
//TODO 校验数据
let data = {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('id'),
id: getUrlParam('detailsId'),
jsonData: JSON.stringify(tableRowList),
titleFiled: fields.join(',')
};
let path = getUrlParam("type") == '0' ? '/outsourcer/saveEvaluateData' : '/outsourcer/updateEvaluateData';
$.ajax({
url: ctxPath + path,
type: 'post',
data: data,
success: function (res) {
if (res.res == '1') {
layer.msg('保存成功');
closePage();
} else {
layer.msg(res.resMsg);
function getTableData() {
var tableData = table.cache.baseTable;
let fields = tableFieldList.map((e) => e.field)
if (getUrlParam("type") == '2') {
//对tableData进行处理 appraiser = 当前人
for (let i = 0; i < tableData.length; i++) {
tableRowList[i].appraiser = JSON.parse(localStorage.getItem('loginUser')).nickname;
}
}
})
}
//TODO 校验数据
let data = {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('id'),
id: getUrlParam('detailsId'),
jsonData: JSON.stringify(tableRowList),
titleFiled: fields.join(',')
};
let path = getUrlParam("type") == '0' ? '/outsourcer/saveEvaluateData' : '/outsourcer/updateEvaluateData';
$.ajax({
url: ctxPath + path,
type: 'post',
data: data,
success: function (res) {
if (res.res == '1') {
layer.msg('保存成功');
closePage();
} else {
layer.msg(res.resMsg);
}
}
})
}
function closePage() {
let index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe层的索引
parent.search(1)
parent.layer.close(index); // 再执行关闭
}
</script>
function closePage() {
let index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe层的索引
parent.search(1)
parent.layer.close(index); // 再执行关闭
}
</script>