Compare commits

...

2 Commits

Author SHA1 Message Date
BianLzhaoMin eb0bc28afd Merge branch 'master' of http://192.168.0.75:3000/liux/gs_sub_evaluate 2025-02-19 14:04:55 +08:00
BianLzhaoMin 40032ee109 增加专责审批调试问题 2025-02-19 14:04:53 +08:00
5 changed files with 1001 additions and 791 deletions

View File

@ -0,0 +1,199 @@
let layer, laydate, table, form;
$(function () {
layui.use(["layer", "laydate", "table", "form"], function () {
layer = layui.layer;
laydate = layui.laydate;
form = layui.form;
table = layui.table;
laydate.render({
elem: "#startDate",
type: "month",
format: "yyyy-MM",
});
businessDivisionPullDown(form, null);
initTable();
});
});
function search(type) {
if (type === 1) {
} else {
$("#keyWord").val("");
$("#evaluateDeptId").val("");
$("#evStatus").val("");
$("#status").val("");
$("#startDate").val("");
$("#endDate").val("");
form.render("select");
}
table.reload("baseTable", {
url: ctxPath + "/backstage/evaluate/evalSummaryList",
page: {
curr: 1,
},
where: {
type: "audit",
keyWord: $("#keyWord").val(),
evaluateDeptId: $("#evaluateDeptId").val(),
evStatus: $("#evStatus").val(),
status: $("#status").val(),
startDate: $("#startDate").val(),
endDate: $("#endDate").val(),
},
});
}
function initTable() {
//渲染表格
table.render({
elem: "#baseTable",
url: ctxPath + "/backstage/evaluate/evalSummaryList", //数据接口
method: "get", //方式默认是get
toolbar: "default", //开启工具栏,此处显示默认图标,可以自定义模板,详见文档
where: {
type: "audit",
}, //post请求必须加where post请求需要的参数
cellMinWidth: 80,
cols: [
[
//表头
{
field: "number",
width: 80,
title: "序号",
align: "center",
type: "numbers",
},
{ field: "evaluateDept", align: "center", title: "评价事业部" },
{ field: "evaluateTitle", align: "center", title: "评价标题" },
{ field: "evaluateMonth", align: "center", title: "评价年月" },
{ field: "projectNum", align: "center", title: "项目数量" },
{
field: "outsourcerNum",
align: "center",
title: "外包商数量",
},
{
field: "isApprove",
align: "center",
title: "评价状态",
templet: (d) => {
if (d.rejectReason) {
return "评价驳回";
} else {
return Number(d.isApprove) === 0
? "待评价"
: Number(d.isApprove) === 1
? "已评价"
: "";
}
// Number(d.isApprove) === 0 ? '待评价' : (Number(d.isApprove) === 1 ? '已评价' : '')
},
},
{
field: "status",
align: "center",
title: "审核状态",
templet: (d) =>
Number(d.status) === 0
? "待审核"
: Number(d.status) === 1
? "已审核"
: "审核中",
},
{ field: "rejectReason", align: "center", title: "驳回原因" },
{
fixed: "right",
width: 180,
title: "操作",
align: "center",
templet: (d) => {
let text = "";
if (d.isAudit == "1") {
text +=
'<a lay-event="examine" style="color: #009688;cursor: pointer;font-size: 15px"' +
' id="examine">审核</a>';
}
text +=
'<a lay-event="evaluateTable" style="color: #009688;cursor: pointer;font-size:' +
' 15px;margin-left: 10px"' +
' id="evaluateTable">查看</a>';
return text;
},
},
],
],
id: "baseTable",
page: true, //开启分页
loading: true, //数据加载中。。。
limits: [10, 20, 100], //一页选择显示3,5或10条数据
limit: 10, //一页显示5条数据
response: {
statusCode: 200, //规定成功的状态码默认0
},
parseData: function (res) {
//将原始数据解析成 table 组件所规定的数据res为从url中get到的数据
let result;
if (res.data !== "" && res.data != null && res.data !== "null") {
if (this.page.curr) {
result = res.data.slice(
this.limit * (this.page.curr - 1),
this.limit * this.page.curr
);
} else {
result = res.data.slice(0, this.limit);
}
}
return {
code: res.code, //解析接口状态
msg: res.msg, //解析提示文本
count: res.count, //解析数据长度
data: result, //解析数据列表
};
},
toolbar: "#toolbar",
});
table.on("tool(test)", function (obj) {
const data = obj.data; //当前行数据
const rowIndex = obj.index;
const layEvent = obj.event; //当前点击的事件名
switch (layEvent) {
case "examine":
ViewReviews(data, "审核");
break;
case "evaluateTable":
ViewReviews(data, "查看");
break;
default:
console.warn(`未知事件: ${layEvent}`);
}
});
//查看子页面
function ViewReviews(data, title) {
try {
localStorage.setItem("AllAuditTitle", title);
const layerIndex = layer.open({
type: 2,
title: title,
shade: 0.3,
area: ["98%", "98%"],
scrollbar: true,
move: true,
anim: 2,
shadeClose: false,
content:
"./summaryAuditView.html?evaluateId=" +
data.id +
"&templateId=" +
data.templateId,
end: function () {
search(2);
},
});
} catch (error) {
console.error("ViewReviews 错误:", error);
}
}
}

View File

@ -1,206 +1,282 @@
<!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-inline" style="margin-top: 10px;display: flex;justify-content: flex-end; margin-right: 10px;"
id="btnGroup">
<button class="layui-btn layui-btn-sm" onclick="allAudit(1)">通过</button>
<button class="layui-btn layui-btn-sm" onclick="allAudit(2)">驳回</button>
</div>
<div id="txtTip" style="margin-top: 10px;display: flex;justify-content: flex-end;width: 99%;">注:如无审核按钮,则表示当前评价停留在一级审核处</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 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;
$(function () {
layui.use(['layer', 'laydate', 'table', 'form'], function () {
layer = layui.layer;
laydate = layui.laydate;
table = layui.table;
form = layui.form;
tableLoading = layer.load(2, {shade: [0.1, '#fff']});
let deptId = getUrlParam('deptId');
isCheckOneIsAudit(deptId);
initTable(deptId);
form.on('submit(formDemo)', function (data) {
getTableData();
return false;
<body>
<div class="layui-inline" style="margin-top: 10px;display: flex;justify-content: flex-end; margin-right: 10px;"
id="btnGroup">
<button class="layui-btn layui-btn-sm" onclick="allAudit(1)">通过</button>
<button class="layui-btn layui-btn-sm" onclick="allAudit(2)">驳回</button>
</div>
<div id="txtTip" style="margin-top: 10px;display: flex;justify-content: flex-end;width: 99%;">
注:如无审核按钮,则表示当前评价停留在一级审核处</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 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;
$(function () {
layui.use(['layer', 'laydate', 'table', 'form'], function () {
layer = layui.layer;
laydate = layui.laydate;
table = layui.table;
form = layui.form;
tableLoading = layer.load(2, { shade: [0.1, '#fff'] });
let deptId = getUrlParam('deptId');
isCheckOneIsAudit(deptId);
initTable(deptId);
form.on('submit(formDemo)', function (data) {
getTableData();
return false;
});
});
});
});
function isCheckOneIsAudit(deptId) {
$.ajax({
url: ctxPath + '/outsourcer/isCheckOneIsAudit',
type: 'get',
data: {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('evaluateId'),
deptId: deptId,
evaluateType: '2',
type: 'auditAll',
},
success: function (res) {
if (res.res == '1') {
$("#btnGroup").show();
$("#txtTip").hide();
} else {
$("#btnGroup").hide();
function isCheckOneIsAudit(deptId) {
$.ajax({
url: ctxPath + '/outsourcer/isCheckOneIsAudit',
type: 'get',
data: {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('evaluateId'),
deptId: deptId,
evaluateType: '2',
type: 'auditAll',
},
success: function (res) {
if (res.res == '1') {
$("#btnGroup").show();
$("#txtTip").hide();
} else {
$("#btnGroup").hide();
}
if (getUrlParam("type") == '1') {
$("#btnGroup").hide();
$("#txtTip").hide();
}
}
if (getUrlParam("type") == '1'){
$("#btnGroup").hide();
$("#txtTip").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 === 1) {
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.hide = true;
}
function initTable(deptId) {
getTitle(deptId);
}
function setCols(data, msg) {
//重新加载表格 清空之前的表头和内容
table.reload('baseTable', {
cols: []
});
});
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];
// res.data.sort(function (a, b) {
// return a.subName.localeCompare(b.subName);
// });
merge(res, columsName, columsIndex);
tableLoading && layer.close(tableLoading);
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);
}
});
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}`,
});
}
});
}
function allAudit(type) {
let title = type === 1 ? '全部通过' : '全部驳回';
layer.confirm('确定'+title+'吗?', function (index) {
if(type === 1){
$.ajax({
url: ctxPath + '/outsourcer/allAudit',
type: 'post',
async: false,
data: {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('evaluateId'),
type: type,
evaluateType: '2',
deptId: getUrlParam('deptId'),
isApprove: type
},
success: function (res) {
if (res.res == '1') {
parent.layer.closeAll();
parent.layer.msg(res.resMsg);
parent.getAuditBtn()
} else {
layer.msg(res.resMsg);
//动态生成表头
headerRows.forEach(rowData => {
rowData.forEach(cellData => {
cellData.align = 'center';
if (cellData.title === '序号') {
cellData.type = 'numbers';
}
if (!['审核', '序号', '施工业务外包商', '工程名称', '评价人', '审批'].includes(cellData.title)) {
if (cellData.field.split('-').length === 1) {
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.hide = true;
}
});
}else{
});
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];
// res.data.sort(function (a, b) {
// return a.subName.localeCompare(b.subName);
// });
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}`,
});
}
});
}
function allAudit(type) {
let title = type === 1 ? '全部通过' : '全部驳回';
layer.confirm('确定' + title + '吗?', function (index) {
if (type === 1) {
$.ajax({
url: ctxPath + '/outsourcer/dedicatedAllAudit',
type: 'post',
async: false,
data: {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('evaluateId'),
type: type,
evaluateType: '2',
deptId: getUrlParam('deptId'),
isApprove: type
},
success: function (res) {
if (res.res == '1') {
parent.layer.closeAll();
parent.layer.msg(res.resMsg);
parent.getAuditBtn()
} else {
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" lay-verify="required" class="layui-input" 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/dedicatedAllAudit',
type: 'post',
async: false,
data: {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('evaluateId'),
type: type,
evaluateType: '2',
deptId: getUrlParam('deptId'),
isApprove: type,
rejectReason: rejectReason,
},
success: function (res) {
if (res.res == '1') {
parent.layer.closeAll();
parent.layer.msg(res.resMsg);
parent.getAuditBtn()
} else {
layer.msg(res.resMsg);
}
}
});
}
});
}
});
}
function audit(status) {
let title = status === 1 ? '通过' : '驳回';
if (status === 1) {
layer.confirm('确定' + title + '吗?', function (index) {
$.ajax({
url: ctxPath + '/outsourcer/dedicatedAudit',
type: 'post',
async: false,
data: {
templateId: "5",
evaluateId: "41",
status: status,
},
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" lay-verify="required" class="layui-input" style="width: 300px;height: 100px"></div>';
layer.open({
@ -216,25 +292,23 @@
return;
}
$.ajax({
url: ctxPath + '/outsourcer/allAudit',
url: ctxPath + '/outsourcer/dedicatedAudit',
type: 'post',
async: false,
data: {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('evaluateId'),
type: type,
evaluateType: '2',
deptId: getUrlParam('deptId'),
isApprove: type,
rejectReason: rejectReason,
templateId: "5",
evaluateId: "41",
status: status,
rejectReason: rejectReason
},
success: function (res) {
layer.close(index);
if (res.res == '1') {
parent.layer.closeAll();
parent.layer.msg(res.resMsg);
parent.getAuditBtn()
layer.msg(title + '成功');
data.isApprove = 2;
obj.update(data);
} else {
code = 0;
data.isApprove = 0;
layer.msg(res.resMsg);
}
}
@ -242,133 +316,62 @@
}
});
}
});
}
function audit(status) {
let title = status === 1 ? '通过' : '驳回';
if (status === 1) {
layer.confirm('确定' + title + '吗?', function (index) {
$.ajax({
url: ctxPath + '/outsourcer/audit',
type: 'post',
async: false,
data: {
templateId: "5",
evaluateId: "41",
status: status,
},
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" lay-verify="required" class="layui-input" 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: {
templateId: "5",
evaluateId: "41",
status: status,
rejectReason: rejectReason
},
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 getTitle(deptId) {
$.ajax({
url: ctxPath + '/outsourcer/getAuditTitleData',
type: 'get',
data: {
function getTitle(deptId) {
$.ajax({
url: ctxPath + '/outsourcer/getAuditTitleData',
type: 'get',
data: {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('evaluateId'),
type: 'auditAll',
deptId: deptId,
evaluateType: '2'
},
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('evaluateId'),
type: 'auditAll',
deptId: deptId,
evaluateType: '2'
},
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('evaluateId'),
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); // 再执行关闭
}
</script>
function closePage() {
let index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe层的索引
parent.search(1)
parent.layer.close(index); // 再执行关闭
}
</script>

View File

@ -82,7 +82,7 @@
<script type="text/javascript" src="../../../js/common_methon.js"></script>
<script type="text/javascript" src="../../../js/select.js"></script>
<script src="../../../js/filePreview.js"></script>
<script src="../../../js/evaluate/summaryAudit/summaryAudit.js?v=1"></script>
<script src="../../../js/evaluate/summaryAudit/responsibleForApproval.js?v=1"></script>
</body>
</html>

View File

@ -1,258 +1,340 @@
<!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;display: flex;justify-content: flex-end; margin-right: 10px;" id="btnGroup">
<button class="layui-btn layui-btn-sm" onclick="allAudit(1)" >全部通过</button>
<button class="layui-btn layui-btn-sm" onclick="allAudit(2)" >全部驳回</button>
</div>
<div id="txtTip" style="margin-top: 10px;display: flex;justify-content: flex-end;width: 99%;">注:如无审核按钮,则表示当前评价停留在一级审核处</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;display: flex;justify-content: flex-end; margin-right: 10px;"
id="btnGroup">
<button class="layui-btn layui-btn-sm" onclick="allAudit(1)">全部通过</button>
<button class="layui-btn layui-btn-sm" onclick="allAudit(2)">全部驳回</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 id="txtTip" style="margin-top: 10px;display: flex;justify-content: flex-end;width: 99%;">
注:如无审核按钮,则表示当前评价停留在一级审核处</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 noMessage = 0
let headerRows;
let layer, laydate, table, form;
let tableLoading;
$(function () {
layui.use(['layer', 'laydate', 'table', 'form'], function () {
layer = layui.layer;
laydate = layui.laydate;
table = layui.table;
form = layui.form;
tableLoading = layer.load(2, {shade: [0.1, '#fff']});
let deptId = getUrlParam('deptId');
isCheckOneIsAudit(deptId);
initTable(deptId);
form.on('submit(formDemo)', function (data) {
getTableData();
return false;
<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 noMessage = 0
let headerRows;
let layer, laydate, table, form;
let tableLoading;
$(function () {
layui.use(['layer', 'laydate', 'table', 'form'], function () {
layer = layui.layer;
laydate = layui.laydate;
table = layui.table;
form = layui.form;
tableLoading = layer.load(2, { shade: [0.1, '#fff'] });
let deptId = getUrlParam('deptId');
isCheckOneIsAudit(deptId);
initTable(deptId);
form.on('submit(formDemo)', function (data) {
getTableData();
return false;
});
});
});
});
function isCheckOneIsAudit(deptId) {
$.ajax({
url: ctxPath + '/outsourcer/isCheckOneIsAudit',
type: 'get',
data: {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('evaluateId'),
deptId: deptId,
evaluateType: '2',
type: 'auditAll',
},
success: function (res) {
if (res.res == '1') {
$("#btnGroup").show();
$("#txtTip").hide();
} else {
$("#btnGroup").hide();
}
if (getUrlParam("type") == '1'){
$("#btnGroup").hide();
$("#txtTip").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 === 1) {
cellData.title =
`${cellData.title}<i class="layui-icon layui-icon-tips layui-font-14" lay-event="checkTips"
title="计算方法" style="margin-left: 5px;"></i>`;
function isCheckOneIsAudit(deptId) {
$.ajax({
url: ctxPath + '/outsourcer/isCheckTwoIsAudit',
type: 'get',
data: {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('evaluateId'),
deptId: deptId,
evaluateType: '2',
type: 'auditAll',
},
success: function (res) {
if (res.res == '1') {
$("#btnGroup").show();
$("#txtTip").hide();
} else {
$("#btnGroup").hide();
}
if (getUrlParam("type") == '1') {
$("#btnGroup").hide();
$("#txtTip").hide();
}
}
if (cellData.mergeType === "colspan") {
cellData.colspan = cellData.num;
} else if (cellData.mergeType === "rowspan") {
cellData.rowspan = cellData.num;
}
if (getUrlParam("type") != '1'){
if (cellData.field === 'examineAndApprove') {
cellData.templet = function (d) {
console.log("ddddd:",d)
//如果d.isApprove == 1 去除当前行的编辑功能
let text = "";
if (d.isTwoApprove == 0 && d.isApprove == 1 ) {
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 ) {
})
}
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 === 1) {
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 (getUrlParam("type") != '1') {
if (cellData.field === 'examineAndApprove') {
cellData.templet = function (d) {
console.log("ddddd:", d)
//如果d.isApprove == 1 去除当前行的编辑功能
let text = "";
if (d.isTwoApprove == 0 && d.isApprove == 1) {
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) {
text += '<a style="color: #009688;cursor: pointer;font-size: 15px"' +
' id="pass">已通过</a>';
} else if (d.isTwoApprove == 2 && d.isApprove == 1) {
text += '<a style="color: #a59e9e;cursor: pointer;font-size: 15px"' +
' id="reject">已驳回</a>';
} else {
noMessage++
return ''
}
}
// 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;
}
}
} else {
if (cellData.field === 'examineAndApprove') {
cellData.templet = function (d) {
//如果d.isApprove == 1 去除当前行的编辑功能
let text = "";
if (d.isTwoApprove == 1) {
text += '<a style="color: #009688;cursor: pointer;font-size: 15px"' +
' id="pass">已通过</a>';
}else if (d.isTwoApprove == 2 && d.isApprove == 1 ) {
}
if (d.isTwoApprove == 2) {
text += '<a style="color: #a59e9e;cursor: pointer;font-size: 15px"' +
' id="reject">已驳回</a>';
}else{
noMessage++
return ''
}
// 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;
}
}
}else{
if (cellData.field === 'examineAndApprove') {
cellData.templet = function (d) {
//如果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;
}
}
});
});
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];
// res.data.sort(function (a, b) {
// return a.subName.localeCompare(b.subName);
// });
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.isTwoApprove = 1;
audit(obj, 1, data);
}
if (layEvent === 'reject') {
data.isTwoApprove = 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.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];
// res.data.sort(function (a, b) {
// return a.subName.localeCompare(b.subName);
// });
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.isTwoApprove = 1;
audit(obj, 1, data);
}
if (layEvent === 'reject') {
data.isTwoApprove = 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}`,
});
}
});
}
function allAudit(type) {
if (noMessage > 0){
layer.msg("当前页面评价驳回数据或者一级审核未通过数据,无法进行全部通过或者全部驳回操作 ")
return
}
let title = type === 1 ? '全部通过' : '全部驳回';
layer.confirm('确定'+title+'吗?', function (index) {
if(type === 1){
$.ajax({
url: ctxPath + '/outsourcer/allAudit',
type: 'post',
async: false,
data: {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('evaluateId'),
type: type,
evaluateType: '2',
deptId: getUrlParam('deptId'),
isApprove: type
},
success: function (res) {
if (res.res == '1') {
parent.layer.closeAll();
parent.layer.msg(res.resMsg);
parent.getAuditBtn()
} else {
layer.msg(res.resMsg);
function allAudit(type) {
if (noMessage > 0) {
layer.msg("当前页面评价驳回数据或者一级审核未通过数据,无法进行全部通过或者全部驳回操作 ")
return
}
let title = type === 1 ? '全部通过' : '全部驳回';
layer.confirm('确定' + title + '吗?', function (index) {
if (type === 1) {
$.ajax({
url: ctxPath + '/outsourcer/allAudit',
type: 'post',
async: false,
data: {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('evaluateId'),
type: type,
evaluateType: '3',
deptId: getUrlParam('deptId'),
isApprove: type
},
success: function (res) {
if (res.res == '1') {
parent.layer.closeAll();
parent.layer.msg(res.resMsg);
parent.getAuditBtn()
} else {
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" lay-verify="required" class="layui-input" 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/allAudit',
type: 'post',
async: false,
data: {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('evaluateId'),
type: type,
evaluateType: '3',
deptId: getUrlParam('deptId'),
isApprove: type,
rejectReason: rejectReason,
},
success: function (res) {
if (res.res == '1') {
parent.layer.closeAll();
parent.layer.msg(res.resMsg);
parent.getAuditBtn()
} else {
layer.msg(res.resMsg);
}
}
});
}
},
});
}
});
}
function audit(obj, type, status) {
let title = type === 1 ? '通过' : '驳回';
if (type == 1) {
layer.confirm('确定' + title + '吗?', function (index) {
$.ajax({
url: ctxPath + '/outsourcer/audit',
type: 'post',
async: false,
data: {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('evaluateId'),
id: status.id,
type: type,
detailsId: status.detailsId,
evaluateType: '3'
},
success: function (res) {
if (res.res == '1') {
status.isTwoApprove = type;
obj.update(status);
layer.msg(res.resMsg);
} else {
status.isTwoApprove = 0;
layer.msg(res.resMsg);
}
}
});
});
}else{
} else {
let content = '<div style="padding: 20px 100px;"><span style="color: red">*</span>' + title +
'原因:<input type="text" id="rejectReason" autocomplete="off" lay-verify="required" class="layui-input" style="width: 300px;height: 100px"></div>';
'原因:<input type="text" id="rejectReason" autocomplete="off" lay-verify="required" class="layui-input" style="width: 300px;height: 100px"></div>';
layer.open({
type: 1,
title: title,
@ -266,25 +348,26 @@
return;
}
$.ajax({
url: ctxPath + '/outsourcer/allAudit',
url: ctxPath + '/outsourcer/audit',
type: 'post',
async: false,
data: {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('evaluateId'),
id: status.id,
type: type,
evaluateType: '2',
deptId: getUrlParam('deptId'),
isApprove: type,
detailsId: status.detailsId,
evaluateType: '3',
rejectReason: rejectReason,
},
success: function (res) {
debugger
layer.close(index);
if (res.res == '1') {
parent.layer.closeAll();
parent.layer.msg(res.resMsg);
parent.getAuditBtn()
status.isTwoApprove = type;
obj.update(status);
layer.msg(res.resMsg);
} else {
status.isTwoApprove = 0;
layer.msg(res.resMsg);
}
}
@ -293,140 +376,61 @@
});
}
});
}
function audit(obj, type, status) {
let title = type === 1 ? '通过' : '驳回';
if(type == 1){
layer.confirm('确定'+title+'吗?', function (index) {
$.ajax({
url: ctxPath + '/outsourcer/audit',
type: 'post',
async: false,
data: {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('evaluateId'),
id: status.id,
type: type,
detailsId: status.detailsId,
evaluateType: '2'
},
success: function (res) {
if (res.res == '1') {
status.isTwoApprove = type;
obj.update(status);
layer.msg(res.resMsg);
} else {
status.isTwoApprove = 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" lay-verify="required" class="layui-input" 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: {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('evaluateId'),
id: status.id,
type: type,
detailsId: status.detailsId,
evaluateType: '2',
rejectReason: rejectReason,
},
success: function (res) {
debugger
layer.close(index);
if (res.res == '1') {
status.isTwoApprove = type;
obj.update(status);
layer.msg(res.resMsg);
} else {
status.isTwoApprove = 0;
layer.msg(res.resMsg);
}
}
});
}
});
}
}
function getTitle(deptId) {
$.ajax({
url: ctxPath + '/outsourcer/getAuditTitleData',
type: 'get',
data: {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('evaluateId'),
type: 'auditAll',
deptId: deptId
},
success: function (res) {
setCols(res.obj, 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('evaluateId'),
type: 'auditAll',
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('evaluateId'),
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); // 再执行关闭
}
</script>
function closePage() {
let index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe层的索引
parent.search(1)
parent.layer.close(index); // 再执行关闭
}
</script>

View File

@ -1,50 +1,54 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" media="screen" href="../../css/bootstrap.min.css">
<link rel="stylesheet" href="../../css/treetable/jquery.treetable.css" />
<link rel="stylesheet" href="../../css/treetable/jquery.treetable.theme.default.css" />
<link rel="stylesheet" type="text/css" media="screen" href="../../layui/css/layui.css">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" media="screen" href="../../css/bootstrap.min.css">
<link rel="stylesheet" href="../../css/treetable/jquery.treetable.css" />
<link rel="stylesheet" href="../../css/treetable/jquery.treetable.theme.default.css" />
<link rel="stylesheet" type="text/css" media="screen" href="../../layui/css/layui.css">
</head>
<body>
<div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<header style="height: 100%">
<div align="left">
<table style="width: 100%">
<tr>
<td>
</td>
<td align="right">
<button class="layui-btn layui-btn-sm" onclick="location.href='addMenu.html'" permission="sys:menu:add">
<i class="layui-icon">&#xe608;</i> 添加
</button>
</td>
</tr>
</table>
</div>
</header>
<div>
<div class="widget-body no-padding">
<table id="dt-table" class="table table-striped table-bordered table-hover" style="width:100%">
<tr>
<th width="20%">名称</th>
<th width="5%">id</th>
<th>href</th>
<th width="15%">permission</th>
<th width="5%">sort</th>
<th>操作</th>
</tr>
</table>
</div>
</div>
</div>
</div>
<div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<header style="height: 100%">
<div align="left">
<table style="width: 100%">
<tr>
<td>
</td>
<td align="right">
<button class="layui-btn layui-btn-sm" onclick="location.href='addMenu.html'"
permission="sys:menu:add">
<i class="layui-icon">&#xe608;</i> 添加
</button>
</td>
</tr>
</table>
</div>
</header>
<div>
<div class="widget-body no-padding">
<table id="dt-table" class="table table-striped table-bordered table-hover" style="width:100%">
<tr>
<th width="20%">名称</th>
<th width="5%">id</th>
<th>href</th>
<th width="15%">permission</th>
<th width="5%">sort</th>
<th>操作</th>
</tr>
</table>
</div>
</div>
</div>
</div>
</body>
</html>
<script type="text/javascript" src="../../js/libs/jquery-2.1.1.min.js"></script>
@ -54,84 +58,84 @@
<script src="../../js/libs/jquery.treetable.js"></script>
<script src="../../js/publicJs.js"></script>
<script type="text/javascript">
var pers = checkPermission();
initMenuList();
var pers = checkPermission();
initMenuList();
function initMenuList(){
$.ajax({
type : 'get',
url : ctxPath + '/permissions',
contentType: "application/json; charset=utf-8",
async:false,
success : function(data) {
var length = data.length;
for(var i=0; i<length; i++){
var d = data[i];
var tr = "<tr data-tt-id='" + d['id'] + "' data-tt-parent-id='" + d['parentId'] + "'>";
var td1 = "<td>" + d['name'] +"</td>";
tr += td1;
var id = "<td>" + d['id'] +"</td>";
tr += id;
var href = "";
if(d['href'] != null){
href = d['href'];
function initMenuList() {
$.ajax({
type: 'get',
url: ctxPath + '/permissions',
contentType: "application/json; charset=utf-8",
async: false,
success: function (data) {
var length = data.length;
for (var i = 0; i < length; i++) {
var d = data[i];
var tr = "<tr data-tt-id='" + d['id'] + "' data-tt-parent-id='" + d['parentId'] + "'>";
var td1 = "<td>" + d['name'] + "</td>";
tr += td1;
var id = "<td>" + d['id'] + "</td>";
tr += id;
var href = "";
if (d['href'] != null) {
href = d['href'];
}
var td2 = "<td>" + href + "</td>";
tr += td2;
var permission = d['permission'];
if (permission == null) {
permission = "";
}
var td3 = "<td>" + permission + "</td>";
tr += td3;
var sort = d['sort'];
if (sort == 0) {
sort = "";
}
var td4 = "<td>" + sort + "</td>";
tr += td4;
var id = d['id'];
var href = ctxPath + "/pages/menu/updateMenu.html?id=" + id;
var edit = buttonEdit(href, "sys:menu:add", pers);
var del = buttonDel(id, "sys:menu:del", pers);
tr += "<td>" + edit + del + "</td>";
tr += "</tr>"
$("#dt-table").append(tr);
}
var td2 = "<td>" + href +"</td>";
tr += td2;
var permission = d['permission'];
if(permission == null){
permission = "";
}
var td3 = "<td>" + permission +"</td>";
tr += td3;
var sort = d['sort'];
if(sort == 0){
sort = "";
}
var td4 = "<td>" + sort +"</td>";
tr += td4;
var id = d['id'];
var href = ctxPath + "/pages/menu/updateMenu.html?id=" + id;
var edit = buttonEdit(href, "sys:menu:add", pers);
var del = buttonDel(id, "sys:menu:del", pers);
tr += "<td>"+edit + del+"</td>";
tr += "</tr>"
$("#dt-table").append(tr);
}
}
});
}
layui.use('layer', function () {
var layer = layui.layer;
});
}
layui.use('layer', function(){
var layer = layui.layer;
});
function del(id){
layer.confirm('确定要删除吗?', {
btn : [ '确定', '取消' ]
}, function() {
$.ajax({
type : 'delete',
url : ctxPath + '/permissions/' + id,
success : function(data) {
location.reload();
}
});
});
}
function del(id) {
layer.confirm('确定要删除吗?', {
btn: ['确定', '取消']
}, function () {
$.ajax({
type: 'delete',
url: ctxPath + '/permissions/' + id,
success: function (data) {
location.reload();
}
});
});
}
var option = {
expandable : true,
clickableNodeNames : true,
onNodeExpand : function() {
expandable: true,
clickableNodeNames: true,
onNodeExpand: function () {
var d = this;
},
onNodeCollapse : function() {
onNodeCollapse: function () {
var d = this;
}