需求开发

This commit is contained in:
liang.chao 2025-09-05 18:09:40 +08:00
parent d0ac01ec86
commit fc71ed727a
6 changed files with 329 additions and 312 deletions

View File

@ -78,7 +78,7 @@
left join pj_evaluate_details ped on ped.evaluate_id = per.evaluate_id
left join pj_template_config pt on pt.config_id = per.template_id and pt.is_active = 1
left join pm_org_info poi on per.dept_id = poi.id and poi.status = 1
# left join pm_org_info poi1 on poi1.id = r.pro_id
left join pm_org_info poi1 on poi1.id = r.pro_id
where per.is_active = 1
<!-- <if test="deptId == null or deptId == ''">-->
<!-- and poi1.user_id = #{userId}-->

View File

@ -453,6 +453,11 @@
subTotals = (subArr.reduce((a, b) => a + b, 0) / subArr.length).toFixed(2);
} else if (twoLevelCountType === '最低分') {
subTotals = Math.min(...subArr).toFixed(2);
} else if (twoLevelCountType === '累加') {
subTotals = subArr.reduce((a, b) => a + b, 0).toFixed(2);
} else if (twoLevelCountType === '累减') {
const sumOfDifferences = subArr.reduce((sum, value) => sum + (10 - value), 0);
subTotals = (10 - sumOfDifferences).toFixed(2);
}
} else {
subTotals = "0.00";

View File

@ -252,6 +252,11 @@
subTotals = (subArr.reduce((a, b) => a + b, 0) / subArr.length).toFixed(2);
} else if (twoLevelCountType === '最低分') {
subTotals = Math.min(...subArr).toFixed(2);
} else if (twoLevelCountType === '累加') {
subTotals = subArr.reduce((a, b) => a + b, 0).toFixed(2);
} else if (twoLevelCountType === '累减') {
const sumOfDifferences = subArr.reduce((sum, value) => sum + (10 - value), 0);
subTotals = (10 - sumOfDifferences).toFixed(2);
}
} else {
subTotals = "0.00";

View File

@ -155,7 +155,7 @@
text +=
'<a lay-event="view" style="color: #009688;cursor: pointer;font-size: 15px"' +
' id="view">查看</a>';
if (d.status === '评价'){
if (d.status === '评价'){
text +=
'<a lay-event="edit" style="color: #009688;cursor: pointer;font-size: 15px;margin-left: 10px"' +
' id="view">编辑</a>';

View File

@ -4,161 +4,161 @@
<head>
<meta charset="UTF-8">
<title>汇总审核查看审批</title>
<link rel="stylesheet" href="../../../layui/css/layui.css" />
<link rel="stylesheet" href="../../../layui/css/layui.css"/>
</head>
<body>
<div style="padding: 10px;">
<div class="layui-btn-container" id="auditBtnGroup">
</div>
<table class="layui-table" id="baseTable" lay-filter="test"></table>
<div style="padding: 10px;">
<div class="layui-btn-container" id="auditBtnGroup">
</div>
<script src="../../../js/publicJs.js"></script>
<script src="../../../js/common_methon.js"></script>
<script type="text/javascript" src="../../../js/common.js"></script>
<script type="text/javascript" src="../../../js/libs/jquery-3.6.0.js"></script>
<script src="../../../layui/layui.js"></script>
<script type="text/javascript" src="../../../js/jq.js"></script>
<script type="text/javascript" src="../../../js/my/permission.js"></script>
<script>
let headerRows;
let layer, laydate, table;
let tableLoading;
let code = 0;
$(function () {
layui.use(['layer', 'laydate', 'table'], function () {
layer = layui.layer;
laydate = layui.laydate;
table = layui.table;
//自定义loading
tableLoading = layer.load(2, { shade: [0.1, '#fff'] });
getAuditBtn();
initTable();
bindToolbarEvents();
<table class="layui-table" id="baseTable" lay-filter="test"></table>
</div>
<script src="../../../js/publicJs.js"></script>
<script src="../../../js/common_methon.js"></script>
<script type="text/javascript" src="../../../js/common.js"></script>
<script type="text/javascript" src="../../../js/libs/jquery-3.6.0.js"></script>
<script src="../../../layui/layui.js"></script>
<script type="text/javascript" src="../../../js/jq.js"></script>
<script type="text/javascript" src="../../../js/my/permission.js"></script>
<script>
let headerRows;
let layer, laydate, table;
let tableLoading;
let code = 0;
$(function () {
layui.use(['layer', 'laydate', 'table'], function () {
layer = layui.layer;
laydate = layui.laydate;
table = layui.table;
//自定义loading
tableLoading = layer.load(2, {shade: [0.1, '#fff']});
getAuditBtn();
initTable();
bindToolbarEvents();
});
});
});
function getAuditBtn() {
$.ajax({
url: ctxPath + '/outsourcer/getAuditBtn',
type: 'post',
data: {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('evaluateId'),
type: 'audit',
},
success: function (res) {
if (res.res == '1') {
let data = res.obj;
let btnGroup = $('#auditBtnGroup');
btnGroup.empty();
for (let i = 0; i < data.length; i++) {
let btn = '';
if (data[i].isApprove == '0') {
btn =
`<button class="layui-btn layui-btn-sm" onclick="openPage('${data[i].id}', '${data[i].name}','0')">${data[i].name}评价审批</button>`;
} else if (data[i].isApprove == '1') {
btn =
`<button class="layui-btn layui-btn-primary layui-border layui-btn-sm" onclick="openPage('${data[i].id}', '${data[i].name}','1')">${data[i].name}</button>`;
} else if (data[i].isApprove == '2') {
btn =
`<button class="layui-btn layui-btn-primary layui-border-red layui-btn-sm" onclick="openPage('${data[i].id}', '${data[i].name}','2')">${data[i].name}</button>`;
}
if (localStorage.getItem("AllAuditTitle") === '查看') {
btn =
`<button class="layui-btn layui-btn-primary layui-border layui-btn-sm" onclick="openPage('${data[i].id}', '${data[i].name}','1')">${data[i].name}</button>`;
}
if (localStorage.getItem("AllAuditTitle") == '审核') {
let isHide = getHide(data[i].id)
if(isHide){
btn = `<button class="layui-btn layui-btn-sm" onclick="openPage('${data[i].id}', '${data[i].name}','0')">${data[i].name}</button>`;
}else{
btn = `<button class="layui-btn layui-btn-primary layui-border layui-btn-sm" onclick="openPage('${data[i].id}', '${data[i].name}','0')">${data[i].name}</button>`;
}
// btn = `<button class="layui-btn layui-btn-sm" onclick="openPage('${data[i].id}', '${data[i].name}','0')">${data[i].name}</button>`;
}
btnGroup.append(btn);
function getAuditBtn() {
$.ajax({
url: ctxPath + '/outsourcer/getAuditBtn',
type: 'post',
data: {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('evaluateId'),
type: 'audit',
},
success: function (res) {
if (res.res == '1') {
let data = res.obj;
let btnGroup = $('#auditBtnGroup');
btnGroup.empty();
for (let i = 0; i < data.length; i++) {
let btn = '';
if (data[i].isApprove == '0') {
btn =
`<button class="layui-btn layui-btn-sm" onclick="openPage('${data[i].id}', '${data[i].name}','0')">${data[i].name}评价审批</button>`;
} else if (data[i].isApprove == '1') {
btn =
`<button class="layui-btn layui-btn-primary layui-border layui-btn-sm" onclick="openPage('${data[i].id}', '${data[i].name}','1')">${data[i].name}</button>`;
} else if (data[i].isApprove == '2') {
btn =
`<button class="layui-btn layui-btn-primary layui-border-red layui-btn-sm" onclick="openPage('${data[i].id}', '${data[i].name}','2')">${data[i].name}</button>`;
}
if (localStorage.getItem("AllAuditTitle") === '查看') {
btn =
`<button class="layui-btn layui-btn-primary layui-border layui-btn-sm" onclick="openPage('${data[i].id}', '${data[i].name}','1')">${data[i].name}</button>`;
}
if (localStorage.getItem("AllAuditTitle") == '审核') {
let isHide = getHide(data[i].id)
if (isHide) {
btn = `<button class="layui-btn layui-btn-sm" onclick="openPage('${data[i].id}', '${data[i].name}','0')">${data[i].name}</button>`;
} else {
btn = `<button class="layui-btn layui-btn-primary layui-border layui-btn-sm" onclick="openPage('${data[i].id}', '${data[i].name}','0')">${data[i].name}</button>`;
}
// btn = `<button class="layui-btn layui-btn-sm" onclick="openPage('${data[i].id}', '${data[i].name}','0')">${data[i].name}</button>`;
}
btnGroup.append(btn);
}
}
})
}
function initTable() {
code = 0;
getTitle();
}
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';
function initTable() {
code = 0;
getTitle();
}
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';
cellData.fixed = 'left';
}
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>`;
}
} else {
if (cellData.title === '施工业务外包商') {
cellData.fixed = 'left';
}
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>`;
}
} else {
if (cellData.title === '施工业务外包商') {
cellData.fixed = 'left';
}
if (cellData.title === '工程名称') {
cellData.fixed = 'left';
}
if (cellData.title === '工程名称') {
cellData.fixed = 'left';
}
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 = "";
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>';
}
}
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 = "";
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>';
}
// 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>';
return text;
}
// 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>';
return text;
}
});
}
});
table.render({
});
table.render({
elem: '#baseTable',
cols: headerRows,
data: JSON.parse(msg), // 使用从 API 获取的数据
@ -257,15 +257,20 @@
}
});
//计算小计
if (subArr.length > 0){
if (subArr.length > 0) {
if (twoLevelCountType === '最高分') {
subTotals = Math.max(...subArr).toFixed(2);
} else if (twoLevelCountType === '平均分') {
subTotals = (subArr.reduce((a, b) => a + b, 0) / subArr.length).toFixed(2);
} else if (twoLevelCountType === '最低分') {
subTotals = Math.min(...subArr).toFixed(2);
} else if (twoLevelCountType === '累加') {
subTotals = subArr.reduce((a, b) => a + b, 0).toFixed(2);
} else if (twoLevelCountType === '累减') {
const sumOfDifferences = subArr.reduce((sum, value) => sum + (10 - value), 0);
subTotals = (10 - sumOfDifferences).toFixed(2);
}
}else {
} else {
subTotals = "0.00";
}
itemData[item + '-subtotal'] = subTotals;
@ -423,184 +428,184 @@
}
}
)
;
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}`;
//设置500ms内仅弹出一次
if (!layer.alert.isShown) {
layer.alert.isShown = true;
layer.alert(text, {
title: `${obj.col.title}`,
end: function () {
setTimeout(function () {
layer.alert.isShown = false;
}, 500);
}
});
}
}
});
}
function getTitle() {
$.ajax({
url: ctxPath + '/outsourcer/getCollectData',
type: 'get',
data: {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('evaluateId'),
type: 'audit',
},
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);
)
;
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}`;
//设置500ms内仅弹出一次
if (!layer.alert.isShown) {
layer.alert.isShown = true;
layer.alert(text, {
title: `${obj.col.title}`,
end: function () {
setTimeout(function () {
layer.alert.isShown = false;
}, 500);
}
});
}
}
//TODO 校验数据
let data = {
});
}
function getTitle() {
$.ajax({
url: ctxPath + '/outsourcer/getCollectData',
type: 'get',
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 bindToolbarEvents() {
table.on('toolbar(test)', function (obj) {
var id = obj.config.id;
switch (obj.event) {
case 'getCheckData':
//获取带按钮的名称
const title = $(this).text();
const layerIndex = layer.open({
type: 2,
title: title,
shade: 0.3,
area: ['80%', '90%'],
scrollbar: true,
move: true,
anim: 2,
shadeClose: false,
content: './reviewPage.html',
});
break;
case 'getData':
var getData = table.getData(id);
layer.alert(layui.util.escape(JSON.stringify(getData)));
break;
}
});
}
function openPage(id, name, type) {
let url = './otherEvaluateAuditForm.html?deptId=' + id + '&evaluateId=' + getUrlParam('evaluateId') +
'&templateId=' + getUrlParam('templateId') + '&type=' + type;
if (id == '0') {
url = './proEvaluateAuditForm.html?deptId=' + id + '&evaluateId=' + getUrlParam('evaluateId') +
'&templateId=' + getUrlParam('templateId') + '&type=' + type;
evaluateId: getUrlParam('evaluateId'),
type: 'audit',
},
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);
}
const layerIndex = layer.open({
type: 2,
title: name + "评价审批",
shade: 0.3,
area: ['98%', '98%'],
scrollbar: true,
move: true,
anim: 2,
shadeClose: false,
content: url,
});
}
function getHide(id){
let isHide = false;
$.ajax({
url: ctxPath + '/outsourcer/isCheckOneIsAudit',
type: 'get',
async:false,
data: {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('evaluateId'),
deptId: id,
evaluateType: '3',
type: 'auditAll',
},
success: function (res) {
if (res.res == '1') {
isHide = true
$.ajax({
url: ctxPath + '/outsourcer/isCheckThreeIsAudit',
type: 'get',
async:false,
data: {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('evaluateId'),
deptId: id,
evaluateType: '3',
type: 'auditAll',
},
success: function (res) {
if (res.res == '1') {
isHide =false;
}else{
isHide = true;
}
}
})
} else {
isHide =false;
}
//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);
}
})
return isHide;
}
})
}
function bindToolbarEvents() {
table.on('toolbar(test)', function (obj) {
var id = obj.config.id;
switch (obj.event) {
case 'getCheckData':
//获取带按钮的名称
const title = $(this).text();
const layerIndex = layer.open({
type: 2,
title: title,
shade: 0.3,
area: ['80%', '90%'],
scrollbar: true,
move: true,
anim: 2,
shadeClose: false,
content: './reviewPage.html',
});
break;
case 'getData':
var getData = table.getData(id);
layer.alert(layui.util.escape(JSON.stringify(getData)));
break;
}
});
}
function openPage(id, name, type) {
let url = './otherEvaluateAuditForm.html?deptId=' + id + '&evaluateId=' + getUrlParam('evaluateId') +
'&templateId=' + getUrlParam('templateId') + '&type=' + type;
if (id == '0') {
url = './proEvaluateAuditForm.html?deptId=' + id + '&evaluateId=' + getUrlParam('evaluateId') +
'&templateId=' + getUrlParam('templateId') + '&type=' + type;
}
</script>
const layerIndex = layer.open({
type: 2,
title: name + "评价审批",
shade: 0.3,
area: ['98%', '98%'],
scrollbar: true,
move: true,
anim: 2,
shadeClose: false,
content: url,
});
}
function getHide(id) {
let isHide = false;
$.ajax({
url: ctxPath + '/outsourcer/isCheckOneIsAudit',
type: 'get',
async: false,
data: {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('evaluateId'),
deptId: id,
evaluateType: '3',
type: 'auditAll',
},
success: function (res) {
if (res.res == '1') {
isHide = true
$.ajax({
url: ctxPath + '/outsourcer/isCheckThreeIsAudit',
type: 'get',
async: false,
data: {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('evaluateId'),
deptId: id,
evaluateType: '3',
type: 'auditAll',
},
success: function (res) {
if (res.res == '1') {
isHide = false;
} else {
isHide = true;
}
}
})
} else {
isHide = false;
}
}
})
return isHide;
}
</script>
</body>
</html>

View File

@ -136,6 +136,8 @@
<input type="radio" name="sub_5161" value="最高分" title="最高分" checked>
<input type="radio" name="sub_5161" value="最低分" title="最低分">
<input type="radio" name="sub_5161" value="平均分" title="平均分">
<input type="radio" name="sub_5161" value="累加" title="累加">
<input type="radio" name="sub_5161" value="累减" title="累减">
</div>
</div>
</div>