This commit is contained in:
parent
acacc5f98e
commit
1cee686c16
|
|
@ -1,203 +1,231 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>Demo</title>
|
<title>Demo</title>
|
||||||
<link rel="stylesheet" href="../../../layui/css/layui.css"/>
|
<link rel="stylesheet" href="../../../layui/css/layui.css" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="layui-btn-group" style="margin-top: 10px" id="btnGroup" hidden="hidden">
|
<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(-1)">事业部评价审批</button>
|
||||||
<button class="layui-btn layui-btn-sm" onclick="initTable(0)">项目部评价审批</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>
|
</div>
|
||||||
<div class="layui-form-item" style="display: none">
|
<div class="layui-btn-group" style="margin-top: 10px" id="allAudit">
|
||||||
<div class="layui-input-block">
|
<button class="layui-btn layui-btn-sm" onclick="allAudit(1)">全部通过</button>
|
||||||
<button type="submit" class="layui-btn subBtn" id="commit" lay-submit lay-filter="formDemo">提交
|
<button class="layui-btn layui-btn-sm" onclick="allAudit(2)">全部驳回</button>
|
||||||
</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>
|
||||||
</div>
|
<div class="layui-form-item" style="display: none">
|
||||||
</form>
|
<div class="layui-input-block">
|
||||||
<script src="../../../js/publicJs.js"></script>
|
<button type="submit" class="layui-btn subBtn" id="commit" lay-submit lay-filter="formDemo">提交
|
||||||
<script src="../../../js/common_methon.js"></script>
|
</button>
|
||||||
<script src="../../../js/common.js"></script>
|
</div>
|
||||||
<script type="text/javascript" src="../../../js/libs/jquery-2.1.1.min.js"></script>
|
</div>
|
||||||
<script type="text/javascript" src="../../../js/jq.js"></script>
|
</form>
|
||||||
<script type="text/javascript" src="../../../js/my/permission.js"></script>
|
<script src="../../../js/publicJs.js"></script>
|
||||||
<script src="../../../layui/layui.js"></script>
|
<script src="../../../js/common_methon.js"></script>
|
||||||
<script>
|
<script src="../../../js/common.js"></script>
|
||||||
let headerRows;
|
<script type="text/javascript" src="../../../js/libs/jquery-2.1.1.min.js"></script>
|
||||||
let alter = true;
|
<script type="text/javascript" src="../../../js/jq.js"></script>
|
||||||
let layer, laydate, table, form;
|
<script type="text/javascript" src="../../../js/my/permission.js"></script>
|
||||||
let tableLoading;
|
<script src="../../../layui/layui.js"></script>
|
||||||
$(function () {
|
<script>
|
||||||
let use1 = layui.use(['layer', 'laydate', 'table', 'form'], function () {
|
let headerRows;
|
||||||
layer = layui.layer;
|
let alter = true;
|
||||||
laydate = layui.laydate;
|
let layer, laydate, table, form;
|
||||||
table = layui.table;
|
let tableLoading;
|
||||||
form = layui.form;
|
let tableRowList = []
|
||||||
//自定义loading
|
$(function () {
|
||||||
let loginUser = JSON.parse(localStorage.getItem('loginUser'));
|
let use1 = layui.use(['layer', 'laydate', 'table', 'form'], function () {
|
||||||
if (loginUser) {
|
layer = layui.layer;
|
||||||
if (loginUser.isBusinessDivision) {
|
laydate = layui.laydate;
|
||||||
if (parseInt(loginUser.isBusinessDivision) === 1) {
|
table = layui.table;
|
||||||
$('#btnGroup').show();
|
form = layui.form;
|
||||||
} else {
|
//自定义loading
|
||||||
$('#btnGroup').hide();
|
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']});
|
headerRows.forEach(rowData => {
|
||||||
initTable(null);
|
rowData.forEach(cellData => {
|
||||||
form.on('submit(formDemo)', function (data) {
|
cellData.align = 'center';
|
||||||
getTableData();
|
if (cellData.title === '序号') {
|
||||||
return false;
|
cellData.type = 'numbers';
|
||||||
});
|
|
||||||
});
|
|
||||||
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>`;
|
|
||||||
}
|
}
|
||||||
}
|
if (!['审核', '序号', '施工业务外包商', '工程名称'].includes(cellData.title)) {
|
||||||
if (cellData.mergeType === "colspan") {
|
if (cellData.field.split('-').length === 2) {
|
||||||
cellData.colspan = cellData.num;
|
cellData.title =
|
||||||
} else if (cellData.mergeType === "rowspan") {
|
`${cellData.title}<i class="layui-icon layui-icon-tips layui-font-14" lay-event="checkTips"
|
||||||
cellData.rowspan = cellData.num;
|
title="计算方法" style="margin-left: 5px;"></i>`;
|
||||||
}
|
}
|
||||||
if (cellData.field === 'examineAndApprove') {
|
}
|
||||||
cellData.templet = function (d) {
|
if (cellData.mergeType === "colspan") {
|
||||||
//如果d.isApprove == 1 去除当前行的编辑功能
|
cellData.colspan = cellData.num;
|
||||||
let text = "";
|
} else if (cellData.mergeType === "rowspan") {
|
||||||
console.log("======")
|
cellData.rowspan = cellData.num;
|
||||||
console.log("======", getUrlParam("type"))
|
}
|
||||||
console.log("======", d.isApprove)
|
if (cellData.field === 'examineAndApprove') {
|
||||||
if (getUrlParam("type") == '1') {
|
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) {
|
if (d.isApprove == 0) {
|
||||||
text += '<a lay-event="pass" style="color: #009688;cursor: pointer;font-size: 15px"' +
|
text += '<a lay-event="pass" style="color: #009688;cursor: pointer;font-size: 15px"' +
|
||||||
' id="pass">通过</a>';
|
' id="pass">通过</a>';
|
||||||
text +=
|
text +=
|
||||||
'<a lay-event="reject" style="color: #a59e9e;cursor: pointer;font-size: 15px;margin-left: 10px"' +
|
'<a lay-event="reject" style="color: #a59e9e;cursor: pointer;font-size: 15px;margin-left: 10px"' +
|
||||||
' id="reject">驳回</a>';
|
' id="reject">驳回</a>';
|
||||||
} else if (d.isApprove == 1) {
|
} else if (d.isApprove == 1) {
|
||||||
text += '<span style="color: #009688;font-size: 15px">已通过</span>';
|
text += '<span style="color: #009688;font-size: 15px">已通过</span>';
|
||||||
} else if (d.isApprove == 2) {
|
} else if (d.isApprove == 2) {
|
||||||
text += '<span style="color: #a59e9e;font-size: 15px">已驳回</span>';
|
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 {
|
return text;
|
||||||
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>';
|
});
|
||||||
|
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.on('tool(test)', function (obj) {
|
||||||
table.render({
|
var data = obj.data; //当前行数据
|
||||||
elem: '#baseTable',
|
var rowIndex = obj.index;
|
||||||
cols: headerRows,
|
var layEvent = obj.event; //当前点击的事件名
|
||||||
data: JSON.parse(msg), // 使用从 API 获取的数据
|
if (layEvent === 'pass') {
|
||||||
//data: msg, // 使用从 API 获取的数据
|
data.isApprove = 1;
|
||||||
loading: true,
|
audit(obj, 1, data);
|
||||||
done: function (res) {
|
}
|
||||||
var columsName = ['subName'];//需要合并的列名称 ['business_tenant_name','land','contract_begin','contract_end','history_arrears','period'];
|
if (layEvent === 'reject') {
|
||||||
var columsIndex = [1];//需要合并的列索引值 [2,3,5,6,14,15];
|
data.isApprove = 2;
|
||||||
merge(res, columsName, columsIndex);
|
audit(obj, 2, data);
|
||||||
tableLoading && layer.close(tableLoading);
|
}
|
||||||
}
|
});
|
||||||
});
|
// 表头自定义元素工具事件 --- 2.8.8+
|
||||||
table.on('tool(test)', function (obj) {
|
table.on('colTool(test)', function (obj) {
|
||||||
var data = obj.data; //当前行数据
|
var event = obj.event;
|
||||||
var rowIndex = obj.index;
|
if (event === 'checkTips') {
|
||||||
var layEvent = obj.event; //当前点击的事件名
|
let text = `<span><span style="color: red">*</span>指标定义及计算方法:</span> ${obj.col.method}`;
|
||||||
if (layEvent === 'pass') {
|
text += `<br/><span><span style="color: red">*</span>积分标准:</span> ${obj.col.standard}`;
|
||||||
data.isApprove = 1;
|
layer.alert(text, {
|
||||||
audit(obj, 1, data);
|
title: `${obj.col.title}`,
|
||||||
}
|
});
|
||||||
if (layEvent === 'reject') {
|
}
|
||||||
data.isApprove = 2;
|
});
|
||||||
audit(obj, 2, data);
|
}
|
||||||
}
|
|
||||||
});
|
$(document).on('click', '.layui-table-cell', function (e) {
|
||||||
// 表头自定义元素工具事件 --- 2.8.8+
|
console.log('点击了单元格')
|
||||||
table.on('colTool(test)', function (obj) {
|
|
||||||
var event = obj.event;
|
// 判断是否有文件图标
|
||||||
if (event === 'checkTips') {
|
if ($(this).find('.file-icon').length > 0) {
|
||||||
let text = `<span><span style="color: red">*</span>指标定义及计算方法:</span> ${obj.col.method}`;
|
var dataId = $(this).find('.file-icon').data('id');
|
||||||
text += `<br/><span><span style="color: red">*</span>积分标准:</span> ${obj.col.standard}`;
|
var dataIndex = $(this).find('.file-icon').data('index');
|
||||||
layer.alert(text, {
|
console.log('File icon clicked', {
|
||||||
title: `${obj.col.title}`,
|
dataIndex: dataIndex,
|
||||||
|
dataId: dataId,
|
||||||
|
rowData: tableRowList[dataIndex]
|
||||||
});
|
});
|
||||||
|
window.open(ctxPath + "/statics/" + tableRowList[dataIndex][`${dataId}-file`].filePath.split('/upload/')[1])
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
function allAudit(type) {
|
function allAudit(type) {
|
||||||
let title = type === 1 ? '全部通过' : '全部驳回';
|
let title = type === 1 ? '全部通过' : '全部驳回';
|
||||||
layer.confirm('确定' + title + '吗?', function (index) {
|
layer.confirm('确定' + title + '吗?', function (index) {
|
||||||
var tableId = 'baseTable';
|
var tableId = 'baseTable';
|
||||||
var allData = table.cache[tableId];
|
var allData = table.cache[tableId];
|
||||||
console.log("allData", allData);
|
console.log("allData", allData);
|
||||||
|
|
||||||
// 如果是驳回操作(type === 2),先弹出输入框获取驳回原因
|
// 如果是驳回操作(type === 2),先弹出输入框获取驳回原因
|
||||||
if (type === 2) {
|
if (type === 2) {
|
||||||
let content = `
|
let content = `
|
||||||
<div style="padding: 20px 100px;">
|
<div style="padding: 20px 100px;">
|
||||||
<span style="color: red">*</span>驳回原因:
|
<span style="color: red">*</span>驳回原因:
|
||||||
<div style="display: inline-block; margin-left: 10px;">
|
<div style="display: inline-block; margin-left: 10px;">
|
||||||
|
|
@ -205,10 +233,90 @@
|
||||||
</div>
|
</div>
|
||||||
</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({
|
layer.open({
|
||||||
type: 1,
|
type: 1,
|
||||||
title: title,
|
title: title,
|
||||||
content: content,
|
content: content,
|
||||||
|
async: false,
|
||||||
btn: ['确定', '取消'],
|
btn: ['确定', '取消'],
|
||||||
yes: function (index, layero) {
|
yes: function (index, layero) {
|
||||||
let rejectReason = $('#rejectReason').val();
|
let rejectReason = $('#rejectReason').val();
|
||||||
|
|
@ -216,48 +324,38 @@
|
||||||
layer.msg('请输入驳回原因');
|
layer.msg('请输入驳回原因');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 关闭输入框后开始处理所有行
|
$.ajax({
|
||||||
layer.close(index);
|
url: ctxPath + '/outsourcer/audit',
|
||||||
// 遍历所有行,调用 auditlc 并传入统一的驳回原因
|
type: 'post',
|
||||||
allData.forEach(function (rowData, index) {
|
data: {
|
||||||
var fakeObj = {
|
id: data.id,
|
||||||
data: rowData,
|
evaluateId: data.evaluateId,
|
||||||
index: index,
|
templateId: data.templateId,
|
||||||
config: {id: tableId}
|
detailsId: data.detailsId,
|
||||||
};
|
type: type,
|
||||||
rowData.isApprove = 2;
|
rejectReason: rejectReason,
|
||||||
auditlc(fakeObj, 2, rowData, rejectReason);
|
evaluateType: '1'
|
||||||
if (alter == true) {
|
},
|
||||||
parent.layer.closeAll();
|
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) {
|
function auditlc(obj, type, data, rejectReason) {
|
||||||
let title = type === 1 ? '通过' : '驳回';
|
if (type === 1) {
|
||||||
if (type === 1) {
|
|
||||||
layer.confirm('确定' + title + '吗?', function (index) {
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: ctxPath + '/outsourcer/audit',
|
url: ctxPath + '/outsourcer/audit',
|
||||||
type: 'post',
|
type: 'post',
|
||||||
|
|
@ -277,161 +375,91 @@
|
||||||
} else {
|
} else {
|
||||||
data.isApprove = 0;
|
data.isApprove = 0;
|
||||||
layer.msg(res.resMsg);
|
layer.msg(res.resMsg);
|
||||||
|
alter = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
} else {
|
||||||
} else {
|
$.ajax({
|
||||||
let content = '<div style="padding: 20px 100px;"><span style="color: red">*</span>' + title +
|
url: ctxPath + '/outsourcer/audit',
|
||||||
'原因:<input type="text" id="rejectReason" autocomplete="off" class="layui-input" lay-verify="required" style="width: 300px;height: 100px"></div>';
|
type: 'post',
|
||||||
layer.open({
|
data: {
|
||||||
type: 1,
|
id: data.id,
|
||||||
title: title,
|
evaluateId: data.evaluateId,
|
||||||
content: content,
|
templateId: data.templateId,
|
||||||
async: false,
|
detailsId: data.detailsId,
|
||||||
btn: ['确定', '取消'],
|
type: type,
|
||||||
yes: function (index, layero) {
|
rejectReason: rejectReason, // 使用统一的原因
|
||||||
let rejectReason = $('#rejectReason').val();
|
evaluateType: '1'
|
||||||
if (!rejectReason) {
|
},
|
||||||
layer.msg('请输入驳回原因');
|
success: function (res) {
|
||||||
return;
|
if (res.res == '1') {
|
||||||
}
|
layer.msg(title + '成功');
|
||||||
$.ajax({
|
data.isApprove = 2;
|
||||||
url: ctxPath + '/outsourcer/audit',
|
obj.update(data);
|
||||||
type: 'post',
|
} else {
|
||||||
data: {
|
data.isApprove = 0;
|
||||||
id: data.id,
|
layer.msg(res.resMsg);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function auditlc(obj, type, data, rejectReason) {
|
function getTitle(deptId) {
|
||||||
if (type === 1) {
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: ctxPath + '/outsourcer/audit',
|
url: ctxPath + '/outsourcer/getAuditTitleData',
|
||||||
type: 'post',
|
type: 'get',
|
||||||
async: false,
|
|
||||||
data: {
|
data: {
|
||||||
|
templateId: getUrlParam('templateId'),
|
||||||
evaluateId: getUrlParam('id'),
|
evaluateId: getUrlParam('id'),
|
||||||
id: data.id,
|
type: 'audit',
|
||||||
type: type,
|
deptId: deptId
|
||||||
detailsId: data.detailsId,
|
|
||||||
evaluateType: '1'
|
|
||||||
},
|
},
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
if (res.res == '1') {
|
setCols(res.obj, res.resMsg);
|
||||||
data.isApprove = 1;
|
|
||||||
obj.update(data);
|
|
||||||
layer.msg(title + '成功');
|
|
||||||
} else {
|
|
||||||
data.isApprove = 0;
|
|
||||||
layer.msg(res.resMsg);
|
|
||||||
alter = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
} 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',
|
function getTableData() {
|
||||||
data: {
|
//获取表格填写的数据
|
||||||
|
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'),
|
templateId: getUrlParam('templateId'),
|
||||||
evaluateId: getUrlParam('id'),
|
evaluateId: getUrlParam('id'),
|
||||||
type: 'audit',
|
jsonData: JSON.stringify(tableData),
|
||||||
deptId: deptId
|
titleFiled: filed.join(',')
|
||||||
},
|
};
|
||||||
success: function (res) {
|
$.ajax({
|
||||||
setCols(res.obj, res.resMsg);
|
url: ctxPath + '/outsourcer/saveEvaluateData',
|
||||||
}
|
type: 'post',
|
||||||
|
data: data,
|
||||||
})
|
success: function (res) {
|
||||||
}
|
if (res.res == '1') {
|
||||||
|
layer.msg('保存成功');
|
||||||
function getTableData() {
|
closePage();
|
||||||
//获取表格填写的数据
|
} else {
|
||||||
var tableData = table.cache.baseTable;
|
layer.msg(res.resMsg);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
})
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function closePage() {
|
function closePage() {
|
||||||
let index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe层的索引
|
let index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe层的索引
|
||||||
parent.search(1)
|
parent.search(1)
|
||||||
parent.layer.close(index); // 再执行关闭
|
parent.layer.close(index); // 再执行关闭
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>Demo</title>
|
<title>Demo</title>
|
||||||
<link rel="stylesheet" href="../../../layui/css/layui.css"/>
|
<link rel="stylesheet" href="../../../layui/css/layui.css" />
|
||||||
<style>
|
<style>
|
||||||
.dialog-title {
|
.dialog-title {
|
||||||
padding: 12px 6px;
|
padding: 12px 6px;
|
||||||
|
|
@ -25,172 +25,172 @@
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<form class="layui-form layui-form-pane fromData" action="">
|
<form class="layui-form layui-form-pane fromData" action="">
|
||||||
<div style="width: 100%;overflow:auto">
|
<div style="width: 100%;overflow:auto">
|
||||||
<table class="layui-table" id="baseTable" lay-filter="baseTable" style="overflow-x: auto;">
|
<table class="layui-table" id="baseTable" lay-filter="baseTable" style="overflow-x: auto;">
|
||||||
</table>
|
</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>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="layui-form-item" style="display: none">
|
||||||
</form>
|
<div class="layui-input-block">
|
||||||
<script src="../../../js/publicJs.js"></script>
|
<button type="submit" class="layui-btn subBtn" id="commit" lay-submit lay-filter="formDemo">提交
|
||||||
<script src="../../../js/common_methon.js"></script>
|
</button>
|
||||||
<script src="../../../js/common.js"></script>
|
</div>
|
||||||
<script type="text/javascript" src="../../../js/libs/jquery-2.1.1.min.js"></script>
|
</div>
|
||||||
<script type="text/javascript" src="../../../js/jq.js"></script>
|
</form>
|
||||||
<script type="text/javascript" src="../../../js/my/permission.js"></script>
|
<script src="../../../js/publicJs.js"></script>
|
||||||
<script src="../../../layui/layui.js"></script>
|
<script src="../../../js/common_methon.js"></script>
|
||||||
<script>
|
<script src="../../../js/common.js"></script>
|
||||||
let headerRows;
|
<script type="text/javascript" src="../../../js/libs/jquery-2.1.1.min.js"></script>
|
||||||
let layer, laydate, table, form;
|
<script type="text/javascript" src="../../../js/jq.js"></script>
|
||||||
let tableLoading, tableIns;
|
<script type="text/javascript" src="../../../js/my/permission.js"></script>
|
||||||
let targetFieldPrefixForNegativeInput = ''; // 新增:用于存储“加减分项”的字段前缀
|
<script src="../../../layui/layui.js"></script>
|
||||||
|
<script>
|
||||||
|
let headerRows;
|
||||||
|
let layer, laydate, table, form;
|
||||||
|
let tableLoading, tableIns;
|
||||||
|
let targetFieldPrefixForNegativeInput = ''; // 新增:用于存储“加减分项”的字段前缀
|
||||||
|
|
||||||
// 定义一个列表的数据源 作为提交时参数
|
// 定义一个列表的数据源 作为提交时参数
|
||||||
let tableRowList = []
|
let tableRowList = []
|
||||||
let tableFieldList = []
|
let tableFieldList = []
|
||||||
let tableFieldValueList = []
|
let tableFieldValueList = []
|
||||||
$(function () {
|
$(function () {
|
||||||
layui.use(['layer', 'laydate', 'table', 'form'], function () {
|
layui.use(['layer', 'laydate', 'table', 'form'], function () {
|
||||||
layer = layui.layer;
|
layer = layui.layer;
|
||||||
laydate = layui.laydate;
|
laydate = layui.laydate;
|
||||||
table = layui.table;
|
table = layui.table;
|
||||||
form = layui.form;
|
form = layui.form;
|
||||||
//自定义loading
|
//自定义loading
|
||||||
tableLoading = layer.load(2, {shade: [0.1, '#fff']});
|
tableLoading = layer.load(2, { shade: [0.1, '#fff'] });
|
||||||
initTable();
|
initTable();
|
||||||
form.on('submit(formDemo)', function (data) {
|
form.on('submit(formDemo)', function (data) {
|
||||||
getTableData();
|
getTableData();
|
||||||
return false;
|
return false;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
function initTable() {
|
function initTable() {
|
||||||
getTitle();
|
getTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCols(data, msg) {
|
function setCols(data, msg) {
|
||||||
headerRows = [];
|
headerRows = [];
|
||||||
headerRows = JSON.parse(data);
|
headerRows = JSON.parse(data);
|
||||||
|
|
||||||
tableRowList = JSON.parse(msg)
|
tableRowList = JSON.parse(msg)
|
||||||
|
|
||||||
// 定义弹框内需要的label
|
// 定义弹框内需要的label
|
||||||
const dialogLabelList = headerRows[1]
|
const dialogLabelList = headerRows[1]
|
||||||
const dialogLabelInfo = headerRows[2]
|
const dialogLabelInfo = headerRows[2]
|
||||||
tableFieldList = dialogLabelInfo
|
tableFieldList = dialogLabelInfo
|
||||||
tableFieldValueList = dialogLabelList
|
tableFieldValueList = dialogLabelList
|
||||||
|
|
||||||
// 根据一级标题“六、加减分项”找到对应的字段前缀
|
// 根据一级标题“六、加减分项”找到对应的字段前缀
|
||||||
for (const col of headerRows[0]) {
|
for (const col of headerRows[0]) {
|
||||||
if (col.title === '六、加减分项') {
|
if (col.title === '六、加减分项') {
|
||||||
targetFieldPrefixForNegativeInput = col.field;
|
targetFieldPrefixForNegativeInput = col.field;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Clear existing headers
|
// Clear existing headers
|
||||||
const thead = document.querySelector('#baseTable thead');
|
const thead = document.querySelector('#baseTable thead');
|
||||||
if (thead) {
|
if (thead) {
|
||||||
thead.innerHTML = '';
|
thead.innerHTML = '';
|
||||||
} else {
|
} else {
|
||||||
const newThead = document.createElement('thead');
|
const newThead = document.createElement('thead');
|
||||||
document.querySelector('#baseTable').appendChild(newThead);
|
document.querySelector('#baseTable').appendChild(newThead);
|
||||||
}
|
}
|
||||||
|
|
||||||
//动态生成表头
|
//动态生成表头
|
||||||
headerRows.forEach((rowData, index) => {
|
headerRows.forEach((rowData, index) => {
|
||||||
let dataList = rowData
|
let dataList = rowData
|
||||||
let href = window.location.href
|
let href = window.location.href
|
||||||
|
|
||||||
dataList.forEach(cellData => {
|
dataList.forEach(cellData => {
|
||||||
cellData.cellMinWidth = 120;
|
cellData.cellMinWidth = 120;
|
||||||
cellData.align = 'center';
|
cellData.align = 'center';
|
||||||
if (cellData.title === '序号') {
|
if (cellData.title === '序号') {
|
||||||
cellData.type = 'numbers';
|
cellData.type = 'numbers';
|
||||||
}
|
}
|
||||||
if (!['审核', '序号', '施工业务外包商', '工程名称', '评价人', '操作', '审批'].includes(cellData.title)) {
|
if (!['审核', '序号', '施工业务外包商', '工程名称', '评价人', '操作', '审批'].includes(cellData.title)) {
|
||||||
if (cellData.field.split('-').length === 1) {
|
if (cellData.field.split('-').length === 1) {
|
||||||
cellData.title =
|
cellData.title =
|
||||||
`<span lay-event="checkTips">${cellData.title}<i class="layui-icon layui-icon-tips layui-font-14"
|
`<span lay-event="checkTips">${cellData.title}<i class="layui-icon layui-icon-tips layui-font-14"
|
||||||
title="计算方法" style="margin-left: 5px;"></i></span>`;
|
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为subName,proName 的列不进行设置
|
|
||||||
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>', {
|
var cols = tableView.find('tr[data-index=' + i + ']').find('td');
|
||||||
class: 'layui-btn layui-btn-sm',
|
cols.each(function (index, item) {
|
||||||
id: 'evaluate-btn',
|
//对field为subName,proName 的列不进行设置
|
||||||
text: '评价',
|
if (index > 2 && index != cols.length - 1) {
|
||||||
type: 'button'
|
|
||||||
});
|
|
||||||
let fileList = []
|
|
||||||
let uploadDom = []
|
|
||||||
|
|
||||||
// 将自定义元素插入到最后一个单元格
|
console.log(item, 'item')
|
||||||
div.append(customElement);
|
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) {
|
if (index === cols.length - 1) {
|
||||||
event.stopPropagation()
|
let div = $(this).find('div')
|
||||||
event.preventDefault()
|
|
||||||
|
|
||||||
// 组装dom
|
// 创建自定义 DOM 元素
|
||||||
let rowIndex = $(this).closest('tr').data('index')
|
let customElement = $('<button>', {
|
||||||
let formHtml = `<div class="dialog-title">${tableRowList[rowIndex].proName}</div>`
|
class: 'layui-btn layui-btn-sm',
|
||||||
let innerHtml = ''
|
id: 'evaluate-btn',
|
||||||
const curRows = tableRowList[rowIndex]
|
text: '评价',
|
||||||
dialogLabelList.forEach((e, index) => {
|
type: 'button'
|
||||||
isFile = null
|
});
|
||||||
if (curRows[`${dialogLabelInfo[index].field}-file`]) {
|
let fileList = []
|
||||||
isFile = curRows[`${dialogLabelInfo[index].field}-file`]
|
let uploadDom = []
|
||||||
}
|
|
||||||
uploadDom.push('#uploadBtn' + index)
|
// 将自定义元素插入到最后一个单元格
|
||||||
innerHtml += `<div style="padding:6px 0;display: flex; align-items: center;">
|
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>
|
<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]}">
|
<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'}">
|
<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;"></i> </div>
|
<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;"></i> </div>
|
||||||
</div>`
|
</div>`
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
formHtml += `
|
formHtml += `
|
||||||
<div style="padding: 12px;">
|
<div style="padding: 12px;">
|
||||||
<form id="uploadForm">
|
<form id="uploadForm">
|
||||||
${innerHtml}
|
${innerHtml}
|
||||||
|
|
@ -209,249 +209,249 @@
|
||||||
</div>`
|
</div>`
|
||||||
|
|
||||||
|
|
||||||
layer.open({
|
layer.open({
|
||||||
type: 1,
|
type: 1,
|
||||||
area: ['auto', 'auto'], // 宽高
|
area: ['auto', 'auto'], // 宽高
|
||||||
content: formHtml,
|
content: formHtml,
|
||||||
title: '评分',
|
title: '评分',
|
||||||
btn: ['确定', '取消'],
|
btn: ['确定', '取消'],
|
||||||
success: function (layero, index) {
|
success: function (layero, index) {
|
||||||
// 点击上传按钮的逻辑
|
// 点击上传按钮的逻辑
|
||||||
layui.use('upload', function () {
|
layui.use('upload', function () {
|
||||||
var upload = layui.upload;
|
var upload = layui.upload;
|
||||||
// 执行上传功能
|
// 执行上传功能
|
||||||
var uploadInst = upload.render({
|
var uploadInst = upload.render({
|
||||||
elem: uploadDom.join(','),
|
elem: uploadDom.join(','),
|
||||||
url: ctxPath + '/upload/file',
|
url: ctxPath + '/upload/file',
|
||||||
accept: 'file',
|
accept: 'file',
|
||||||
multiple: false,
|
multiple: false,
|
||||||
done: function (res) {
|
done: function (res) {
|
||||||
// 上传完毕回调
|
// 上传完毕回调
|
||||||
if (res.res === 1) {
|
if (res.res === 1) {
|
||||||
var dataId = $(this.elem).data('id');
|
var dataId = $(this.elem).data('id');
|
||||||
var dataIndex = $(this.elem).data('index');
|
var dataIndex = $(this.elem).data('index');
|
||||||
tableRowList[rowIndex][`${dataId}-file`] = {
|
tableRowList[rowIndex][`${dataId}-file`] = {
|
||||||
fileName: res.message,
|
fileName: res.message,
|
||||||
filePath: res.obj,
|
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 formData = {};
|
||||||
let fields = dialogLabelInfo.map((e) => e.field)
|
let fields = dialogLabelInfo.map((e) => e.field)
|
||||||
|
|
||||||
let isValidate = false
|
let isValidate = false
|
||||||
$('#uploadForm input[name="numberInput"]').each(function () {
|
$('#uploadForm input[name="numberInput"]').each(function () {
|
||||||
let inputValue = $(this).val().trim();
|
let inputValue = $(this).val().trim();
|
||||||
let maxValue = $(this).data('value')
|
let maxValue = $(this).data('value')
|
||||||
const currentDataId = $(this).data('id'); // 获取当前输入框的data-id
|
const currentDataId = $(this).data('id'); // 获取当前输入框的data-id
|
||||||
|
|
||||||
let regex;
|
let regex;
|
||||||
let errorMessage;
|
let errorMessage;
|
||||||
let inputTitle = '';
|
let inputTitle = '';
|
||||||
|
|
||||||
// 查找对应的标题
|
// 查找对应的标题
|
||||||
const dialogInfoIndex = dialogLabelInfo.findIndex(info => info.field === currentDataId);
|
const dialogInfoIndex = dialogLabelInfo.findIndex(info => info.field === currentDataId);
|
||||||
if (dialogInfoIndex !== -1) {
|
if (dialogInfoIndex !== -1) {
|
||||||
inputTitle = dialogLabelList[dialogInfoIndex].title;
|
inputTitle = dialogLabelList[dialogInfoIndex].title;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据dataId是否以“加减分项”的字段前缀开头来判断
|
// 根据dataId是否以“加减分项”的字段前缀开头来判断
|
||||||
if (currentDataId && currentDataId.startsWith(targetFieldPrefixForNegativeInput)) {
|
if (currentDataId && currentDataId.startsWith(targetFieldPrefixForNegativeInput)) {
|
||||||
regex = /^-?(0|[1-9]\d*)?$/; // 允许负数和非负数整数
|
regex = /^-?(0|[1-9]\d*)?$/; // 允许负数和非负数整数
|
||||||
errorMessage = `【${inputTitle}】请输入整数`;
|
errorMessage = `【${inputTitle}】请输入整数`;
|
||||||
} else {
|
} else {
|
||||||
regex = /^(0|[1-9]\d*)?$/; // 只允许非负整数
|
regex = /^(0|[1-9]\d*)?$/; // 只允许非负整数
|
||||||
errorMessage = `【${inputTitle}】请输入大于等于0的正整数`;
|
errorMessage = `【${inputTitle}】请输入大于等于0的正整数`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!regex.test(inputValue)) {
|
if (!regex.test(inputValue)) {
|
||||||
layer.msg(errorMessage);
|
layer.msg(errorMessage);
|
||||||
isValidate = true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 新增:判断输入值的绝对值是否超过最大分值
|
|
||||||
if (inputValue !== '' && !isNaN(Number(inputValue))) {
|
|
||||||
if (Math.abs(Number(inputValue)) > maxValue) {
|
|
||||||
layer.msg(`【${inputTitle}】输入值不可超过最大分值${maxValue}`);
|
|
||||||
isValidate = true;
|
isValidate = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
// 新增:判断输入值的绝对值是否超过最大分值
|
||||||
let dataId = $(this).data('id') // 获取 data-id
|
if (inputValue !== '' && !isNaN(Number(inputValue))) {
|
||||||
if (dataId && inputValue) {
|
if (Math.abs(Number(inputValue)) > maxValue) {
|
||||||
console.log('inputValue=====', inputValue)
|
layer.msg(`【${inputTitle}】输入值不可超过最大分值${maxValue}`);
|
||||||
formData[dataId] = inputValue * 1 // 将 data-id 作为键,输入框的值作为值
|
isValidate = true;
|
||||||
} else {
|
return false;
|
||||||
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()
|
|
||||||
|
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];
|
||||||
var columsName = ['subName'];//需要合并的列名称 ['business_tenant_name','land','contract_begin','contract_end','history_arrears','period'];
|
merge(res, columsName, columsIndex);
|
||||||
var columsIndex = [1];//需要合并的列索引值 [2,3,5,6,14,15];
|
|
||||||
merge(res, columsName, columsIndex);
|
|
||||||
|
|
||||||
|
|
||||||
$(document).on('click', '.upload-success i', function () {
|
$(document).on('click', '.upload-success i', function () {
|
||||||
var dataIndex = $(this).data('index');
|
var dataIndex = $(this).data('index');
|
||||||
var Index = $(this).data('idx');
|
var Index = $(this).data('idx');
|
||||||
var dataId = $(this).data('id');
|
var dataId = $(this).data('id');
|
||||||
|
|
||||||
tableRowList[dataIndex][`${dataId}-file`] = {
|
tableRowList[dataIndex][`${dataId}-file`] = {
|
||||||
fileName: '',
|
fileName: '',
|
||||||
filePath: '',
|
filePath: '',
|
||||||
}
|
}
|
||||||
$(`#upload-success_${Index}`).hide(function () {
|
$(`#upload-success_${Index}`).hide(function () {
|
||||||
$(`#upload-success_${Index} .prepend-content`).remove();
|
$(`#upload-success_${Index} .prepend-content`).remove();
|
||||||
|
})
|
||||||
|
$(`#uploadBtn${Index}`).show()
|
||||||
})
|
})
|
||||||
$(`#uploadBtn${Index}`).show()
|
tableLoading && layer.close(tableLoading);
|
||||||
})
|
}
|
||||||
tableLoading && layer.close(tableLoading);
|
});
|
||||||
}
|
// 表头自定义元素工具事件 --- 2.8.8+
|
||||||
});
|
table.on('colTool(baseTable)', function (obj) {
|
||||||
// 表头自定义元素工具事件 --- 2.8.8+
|
const parentText = $(this).parent().text()
|
||||||
table.on('colTool(baseTable)', function (obj) {
|
var event = obj.event;
|
||||||
const parentText = $(this).parent().text()
|
if (event === 'checkTips' && parentText !== '审批') {
|
||||||
var event = obj.event;
|
let text = `<span><span style="color: red">*</span>指标定义及计算方法:</span> ${obj.col.method}`;
|
||||||
if (event === 'checkTips' && parentText !== '审批') {
|
text += `<br/><span><span style="color: red">*</span>积分标准:</span> ${obj.col.standard}`;
|
||||||
let text = `<span><span style="color: red">*</span>指标定义及计算方法:</span> ${obj.col.method}`;
|
layer.alert(text, {
|
||||||
text += `<br/><span><span style="color: red">*</span>积分标准:</span> ${obj.col.standard}`;
|
title: `${obj.col.title}`,
|
||||||
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])
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
|
$(document).on('click', '.layui-table-cell', function (e) {
|
||||||
|
console.log('点击了单元格')
|
||||||
|
|
||||||
function getTitle() {
|
// 判断是否有文件图标
|
||||||
let path = getUrlParam("type") == '0' ? '/outsourcer/getTableTitle' : '/outsourcer/getAuditTitleData';
|
if ($(this).find('.file-icon').length > 0) {
|
||||||
$.ajax({
|
var dataId = $(this).find('.file-icon').data('id');
|
||||||
url: ctxPath + path,
|
var dataIndex = $(this).find('.file-icon').data('index');
|
||||||
type: 'get',
|
console.log('File icon clicked', {
|
||||||
data: {
|
dataIndex: dataIndex,
|
||||||
templateId: getUrlParam('templateId'),
|
dataId: dataId,
|
||||||
evaluateId: getUrlParam('id'),
|
rowData: tableRowList[dataIndex]
|
||||||
type: 'evaluate'
|
});
|
||||||
},
|
window.open(ctxPath + "/statics/" + tableRowList[dataIndex][`${dataId}-file`].filePath.split('/upload/')[1])
|
||||||
success: function (res) {
|
|
||||||
setCols(res.obj, res.resMsg);
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function getTableData() {
|
function getTitle() {
|
||||||
var tableData = table.cache.baseTable;
|
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 = {
|
function getTableData() {
|
||||||
templateId: getUrlParam('templateId'),
|
var tableData = table.cache.baseTable;
|
||||||
evaluateId: getUrlParam('id'),
|
|
||||||
id: getUrlParam('detailsId'),
|
let fields = tableFieldList.map((e) => e.field)
|
||||||
jsonData: JSON.stringify(tableRowList),
|
if (getUrlParam("type") == '2') {
|
||||||
titleFiled: fields.join(',')
|
//对tableData进行处理 appraiser = 当前人
|
||||||
};
|
for (let i = 0; i < tableData.length; i++) {
|
||||||
let path = getUrlParam("type") == '0' ? '/outsourcer/saveEvaluateData' : '/outsourcer/updateEvaluateData';
|
tableRowList[i].appraiser = JSON.parse(localStorage.getItem('loginUser')).nickname;
|
||||||
$.ajax({
|
|
||||||
url: ctxPath + path,
|
|
||||||
type: 'post',
|
|
||||||
data: data,
|
|
||||||
success: function (res) {
|
|
||||||
if (res.res == '1') {
|
|
||||||
layer.msg('保存成功');
|
|
||||||
closePage();
|
|
||||||
} else {
|
|
||||||
layer.msg(res.resMsg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
//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() {
|
function closePage() {
|
||||||
let index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe层的索引
|
let index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe层的索引
|
||||||
parent.search(1)
|
parent.search(1)
|
||||||
parent.layer.close(index); // 再执行关闭
|
parent.layer.close(index); // 再执行关闭
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
Loading…
Reference in New Issue