gz_safety_ui/js/system/child/audit_user_set.js

73 lines
2.0 KiB
JavaScript

let objParam;
let form, table, tableIns, layer;
let oneList = [], twoList = [], threeList = [];
function setParams(params) {
objParam = JSON.parse(params);
layui.use(["form", 'layer'], function () {
form = layui.form;
layer = layui.layer;
getAuditConfig();
});
}
// 获取详情
function getAuditConfig() {
let params = {
encryptedData: JSON.stringify({
id: objParam.id
})
};
let url = dataUrl + 'sys/auditConfig/getAuditConfig';
ajaxRequest(url, "POST", params, true, function () {
}, function (result) {
console.error(result);
if (result.code === 200) {
setAuditUserData(result.data);
}
}, function (xhr, status, error) {
errorFn(xhr, status, error)
}, null);
// 各审核节点审核人员赋值
function setAuditUserData(obj) {
let one = obj.one;
let two = obj.two;
let three = obj.three;
oneList = one, twoList = two, threeList = three;
setData(one, 'one');
setData(two, 'two');
setData(three, 'three');
}
function setData(list, name) {
let html = '';
$.each(list, function (idx, item) {
html += '<div class="layout">' +
'<span>' + setNullValue(item.comName) + '</span>' +
'<span>' + item.userName + '</span>' +
'</div>';
})
$('#' + name).empty().append(html);
}
}
// 刷新数据
function reloadData() {
getAuditConfig();
}
// 设置审批人
function setAuditUser(type) {
objParam.type = type;
if (type === 1) {
objParam.list = oneList;
objParam.typeName = '分公司';
} else if (type === 2) {
objParam.list = twoList;
objParam.typeName = '项管中心';
} else if (type === 3) {
objParam.list = threeList;
objParam.typeName = '机具公司';
}
openIframeByParamObj("setAuditUserForm", "选择审批人", "./audit_user_set_form.html", "80%", "90%", objParam);
}