代码优化

This commit is contained in:
BianLzhaoMin 2025-02-19 16:19:26 +08:00
parent bedfe05015
commit c0269c0f03
2 changed files with 310 additions and 277 deletions

View File

@ -157,17 +157,47 @@
} }
} else { } else {
if (cellData.field === 'examineAndApprove') { if (cellData.field === 'examineAndApprove') {
cellData.templet = function (d) { cellData.templet = function (d) {
//如果d.isApprove == 1 去除当前行的编辑功能 //如果d.isApprove == 1 去除当前行的编辑功能
// let text = "";
// if (d.isTwoApprove == 1) {
// text += '<a style="color: #009688;cursor: pointer;font-size: 15px"' +
// ' id="pass">已通过</a>';
// }
// if (d.isTwoApprove == 2) {
// text += '<a style="color: #a59e9e;cursor: pointer;font-size: 15px"' +
// ' 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;
let text = ""; let text = "";
if (d.isTwoApprove == 1) { if (d.isTwoApprove == 1 && d.isApprove == 1 && d.isThreeApprove == 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.isTwoApprove == 1 && d.isApprove == 1 && d.isThreeApprove == 1) {
text += '<a style="color: #009688;cursor: pointer;font-size: 15px"' + text += '<a style="color: #009688;cursor: pointer;font-size: 15px"' +
' id="pass">已通过</a>'; ' id="pass">已通过</a>';
} } else if (d.isThreeApprove == 2 && d.isTwoApprove == 1) {
if (d.isTwoApprove == 2) {
text += '<a style="color: #a59e9e;cursor: pointer;font-size: 15px"' + text += '<a style="color: #a59e9e;cursor: pointer;font-size: 15px"' +
' id="reject">已驳回</a>'; ' id="reject">已驳回</a>';
} else {
noMessage++
return ''
} }
}
// 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 +=

View File

@ -1,24 +1,26 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>汇总审核查看审批</title> <title>汇总审核查看审批</title>
<link rel="stylesheet" href="../../../layui/css/layui.css"/> <link rel="stylesheet" href="../../../layui/css/layui.css" />
</head> </head>
<body> <body>
<div style="padding: 10px;"> <div style="padding: 10px;">
<div class="layui-btn-container" id="auditBtnGroup"> <div class="layui-btn-container" id="auditBtnGroup">
</div> </div>
<table class="layui-table" id="baseTable" lay-filter="test"></table> <table class="layui-table" id="baseTable" lay-filter="test"></table>
</div> </div>
<script src="../../../js/publicJs.js"></script> <script src="../../../js/publicJs.js"></script>
<script src="../../../js/common_methon.js"></script> <script src="../../../js/common_methon.js"></script>
<script type="text/javascript" src="../../../js/common.js"></script> <script type="text/javascript" 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/libs/jquery-2.1.1.min.js"></script>
<script src="../../../layui/layui.js"></script> <script src="../../../layui/layui.js"></script>
<script type="text/javascript" src="../../../js/jq.js"></script> <script type="text/javascript" src="../../../js/jq.js"></script>
<script type="text/javascript" src="../../../js/my/permission.js"></script> <script type="text/javascript" src="../../../js/my/permission.js"></script>
<script> <script>
let headerRows; let headerRows;
let layer, laydate, table; let layer, laydate, table;
let tableLoading; let tableLoading;
@ -29,7 +31,7 @@
laydate = layui.laydate; laydate = layui.laydate;
table = layui.table; table = layui.table;
//自定义loading //自定义loading
tableLoading = layer.load(2, {shade: [0.1, '#fff']}); tableLoading = layer.load(2, { shade: [0.1, '#fff'] });
getAuditBtn(); getAuditBtn();
initTable(); initTable();
bindToolbarEvents(); bindToolbarEvents();
@ -56,15 +58,15 @@
if (data[i].isApprove == '0') { if (data[i].isApprove == '0') {
btn = btn =
`<button class="layui-btn layui-btn-sm" onclick="openPage('${data[i].id}', '${data[i].name}','0')">${data[i].name}评价审批</button>`; `<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') { } else if (data[i].isApprove == '1') {
btn = 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>`; `<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') { } else if (data[i].isApprove == '2') {
btn = 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>`; `<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") === '查看'){ if (localStorage.getItem("AllAuditTitle") === '查看') {
btn = 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>`; `<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>`;
} }
@ -329,7 +331,7 @@
}); });
if (typeof value === 'number') { if (typeof value === 'number') {
itemData[totalField] = t.toFixed(2); itemData[totalField] = t.toFixed(2);
}else { } else {
itemData[totalField] = t; itemData[totalField] = t;
} }
@ -523,7 +525,7 @@
}); });
} }
function openPage(id, name,type) { function openPage(id, name, type) {
let url = './otherEvaluateAuditForm.html?deptId=' + id + '&evaluateId=' + getUrlParam('evaluateId') + let url = './otherEvaluateAuditForm.html?deptId=' + id + '&evaluateId=' + getUrlParam('evaluateId') +
'&templateId=' + getUrlParam('templateId') + '&type=' + type; '&templateId=' + getUrlParam('templateId') + '&type=' + type;
if (id == '0') { if (id == '0') {
@ -542,6 +544,7 @@
content: url, content: url,
}); });
} }
</script> </script>
</body> </body>
</html> </html>