var element;
layui.use(['element'], function(){
element = layui.element;
// tab 切换事件
element.on('tab(demo-filter-tab)', function(data){
let auditStatus = $(this).attr('value');
$('#auditStatus').val(auditStatus);
search();
});
});
$(function() {
getbaseList(1);
});
function search(){
getbaseList(1);
}
function reloadData() {
getbaseList(1);
}
// 重置
function resetSearch(){
$('#keyWord').val('');
getbaseList(1);
}
function getbaseList(init) {
if (init == 1){
$(".pageNum").val(1);
}
JY.Model.loading();
JY.Ajax.doRequest( "baseForm",bonuspath + '/backstage/planAudit/findByPage',null,function(data) {
$("#baseTable tbody").empty();
var obj = data.obj;
var list = obj.list;
var results = list.results;
var pageNum = list.pageNum, pageSize = list.pageSize, totalRecord = list.totalRecord;
var html = "";
if (results != null && results.length > 0) {
var leng = (pageNum - 1) * pageSize;
for (var i = 0; i < results.length; i++) {
var l = results[i];
html += "
";
html += "| "
+ (i + leng + 1) + " | ";
html += ""+ JY.Object.notEmpty(l.code) + " | ";
html += ""+ JY.Object.notEmpty(l.proName) + " | ";
html += ""+ JY.Object.notEmpty(l.projectPart) + " | ";
html += ""+ getCheckStatus(l.statusType,l.status) + " | ";
html += ""+ JY.Object.notEmpty(l.creator) + " | ";
html += ""+ JY.Object.notEmpty(l.createTime) + " | ";
html += ""+ JY.Object.notEmpty(l.remark) + " | ";
html += rowFunction(l);
html += "
";
}
$("#baseTable tbody").append(html);
JY.Page.setPage("baseForm", "pageing", pageSize,pageNum, totalRecord, "getbaseList");
} else {
html += "| 没有相关数据 |
";
$("#baseTable tbody").append(html);
$("#pageing ul").empty();// 清空分页
}
JY.Model.loadingClose();
});
}
function rowFunction(obj){
let content = getCheckStatus(obj.statusType,obj.status);
var h="";
h+="";
h+="";
if(!(content.indexOf('驳回') > -1 || content.indexOf('通过') > -1)){
h+=" ";
}
h+=" ";
h+=" ";
h+=" | ";
return h;
}
// 导出
function exportData(){
let params = {
"keyWord":$("#keyWord").val(),
"auditStatus":$("#auditStatus").val()
}
exportCommon(bonuspath + '/backstage/planAudit/export', 'POST', params,"需求计划申请");
}
// 机具需求计划申请详情
function detail(obj){
var title = "详情";
var layerIndex = layer.open({
type: 2,
title: title,
shade: [0],
area: ['90%', '90%'],
scrollbar: true,
move:false,
anim: 2,
yes:function(index,layero){
},
content: [bonuspath +'/backstage/planApplication/detail'],
success: function (layero, index) {
let iframeWin = window["layui-layer-iframe" + layerIndex];
iframeWin.setParams(obj);
},
});
}
//机具需求计划申请审核详情
function checkDetail(obj){
var title = "审核详情";
var layerIndex = layer.open({
type: 2,
title: title,
shade: [0],
area: ['90%', '90%'],
scrollbar: true,
move:false,
anim: 2,
yes:function(index,layero){
},
content: [bonuspath +'/backstage/planAudit/checkDetail'],
success: function (layero, index) {
let iframeWin = window["layui-layer-iframe" + layerIndex];
iframeWin.setParams(obj);
},
});
}
//审核状态
function getCheckStatus(statusType, status) {
var company = "";
if (statusType === '1') {
return "●审核通过";
} else if (statusType === '2') {
company = "分公司";
} else if (statusType === '3') {
company = "项目管理中心";
} else if (statusType === '4') {
company = "机具公司";
}
if (status === '1') {
return "●待" + company + "审核";
} else if (status === '2') {
return "●审核通过";
} else if (status === '3') {
return "●"+company + "审核驳回";
}
return "●待审核";
}