系统优化,部门领导审批,除项目部外,审批仅展示一个通过驳回
This commit is contained in:
parent
b92fb37a3f
commit
935b22c059
|
|
@ -11,6 +11,10 @@
|
|||
<button class="layui-btn layui-btn-sm" onclick="initTable(-1)">事业部评价审批</button>
|
||||
<button class="layui-btn layui-btn-sm" onclick="initTable(0)">项目部评价审批</button>
|
||||
</div>
|
||||
<div class="layui-btn-group" style="margin-top: 10px" id="allAudit">
|
||||
<button class="layui-btn layui-btn-sm" onclick="allAudit(1)">全部通过</button>
|
||||
<button class="layui-btn layui-btn-sm" onclick="allAudit(2)">全部驳回</button>
|
||||
</div>
|
||||
<form class="layui-form layui-form-pane fromData" action="">
|
||||
<div style="width: 100%;overflow:auto">
|
||||
<table class="layui-table" id="baseTable" lay-filter="test">
|
||||
|
|
@ -173,6 +177,34 @@
|
|||
});
|
||||
}
|
||||
|
||||
function allAudit(type) {
|
||||
let title = type === 1 ? '全部通过' : '全部驳回';
|
||||
layer.confirm('确定' + title + '吗?', function (index) {
|
||||
var tableId = 'baseTable';
|
||||
var allData = table.cache[tableId];
|
||||
console.log("allData", allData);
|
||||
allData.forEach(function (rowData, index) {
|
||||
// 构造一个类似单行操作时的 obj 对象
|
||||
var fakeObj = {
|
||||
data: rowData, // 当前行数据
|
||||
index: index, // 行索引
|
||||
config: {id: tableId} // 表格ID(需和你的表格一致)
|
||||
};
|
||||
// 调用 audit(),模拟单行操作
|
||||
if (type === 1) {
|
||||
rowData.isApprove = 1;
|
||||
auditlc(fakeObj, 1, rowData);
|
||||
parent.layer.closeAll();
|
||||
} else if (type === 2) {
|
||||
rowData.isApprove = 2;
|
||||
auditlc(fakeObj, 2, rowData);
|
||||
parent.layer.closeAll();
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function audit(obj, type, data) {
|
||||
let title = type === 1 ? '通过' : '驳回';
|
||||
if (type === 1) {
|
||||
|
|
@ -245,6 +277,75 @@
|
|||
}
|
||||
}
|
||||
|
||||
function auditlc(obj, type, data) {
|
||||
if (type === 1) {
|
||||
$.ajax({
|
||||
url: ctxPath + '/outsourcer/audit',
|
||||
type: 'post',
|
||||
async: false,
|
||||
data: {
|
||||
evaluateId: getUrlParam('id'),
|
||||
id: data.id,
|
||||
type: type,
|
||||
detailsId: data.detailsId,
|
||||
evaluateType: '1'
|
||||
},
|
||||
success: function (res) {
|
||||
if (res.res == '1') {
|
||||
data.isApprove = 1;
|
||||
obj.update(data);
|
||||
layer.msg(title + '成功');
|
||||
} else {
|
||||
data.isApprove = 0;
|
||||
layer.msg(res.resMsg);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
let content = '<div style="padding: 20px 100px;"><span style="color: red">*</span>' + title +
|
||||
'原因:<input type="text" id="rejectReason" autocomplete="off" class="layui-input" lay-verify="required" style="width: 300px;height: 100px"></div>';
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: title,
|
||||
content: content,
|
||||
async: false,
|
||||
btn: ['确定', '取消'],
|
||||
yes: function (index, layero) {
|
||||
let rejectReason = $('#rejectReason').val();
|
||||
if (!rejectReason) {
|
||||
layer.msg('请输入驳回原因');
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
url: ctxPath + '/outsourcer/audit',
|
||||
type: 'post',
|
||||
data: {
|
||||
id: data.id,
|
||||
evaluateId: data.evaluateId,
|
||||
templateId: data.templateId,
|
||||
detailsId: data.detailsId,
|
||||
type: type,
|
||||
rejectReason: rejectReason,
|
||||
evaluateType: '1'
|
||||
},
|
||||
success: function (res) {
|
||||
layer.close(index);
|
||||
if (res.res == '1') {
|
||||
layer.msg(title + '成功');
|
||||
data.isApprove = 2;
|
||||
obj.update(data);
|
||||
} else {
|
||||
code = 0;
|
||||
data.isApprove = 0;
|
||||
layer.msg(res.resMsg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function getTitle(deptId) {
|
||||
$.ajax({
|
||||
url: ctxPath + '/outsourcer/getAuditTitleData',
|
||||
|
|
|
|||
Loading…
Reference in New Issue