You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
167 lines
6.9 KiB
167 lines
6.9 KiB
11 months ago
|
layui.use(['form', 'layer', 'table', 'laytpl', 'laydate'], function () {
|
||
|
var form = layui.form,
|
||
|
layer = parent.layer === undefined ? layui.layer : top.layer,
|
||
|
$ = layui.jquery,
|
||
|
laytpl = layui.laytpl,
|
||
|
table = layui.table;
|
||
|
laydate = layui.laydate;
|
||
|
var UserId = JSON.parse(window.sessionStorage.getItem("userInfo")).UserCode;
|
||
|
var UserName = JSON.parse(window.sessionStorage.getItem("userInfo")).USERS_NAME;
|
||
|
var count = 0;
|
||
|
var pplName = ""
|
||
|
var applyId = $.getUrlVar("applyId");
|
||
|
waitId = $.getUrlVar("waitId");
|
||
|
|
||
|
getApply = function () {
|
||
|
$.ajax({
|
||
|
type: "post",
|
||
|
url: "../../ashx/ZYCarApplyHandler.ashx",
|
||
|
data: { Action: "List", id: applyId },
|
||
|
dataType: "json",
|
||
|
success: function (res) {
|
||
|
console.log(res.data);
|
||
|
var applyData = res.data[0];
|
||
|
lId = applyData.ID;
|
||
|
pplName = applyData.USERNAME;
|
||
|
$("#username").val(applyData.USERNAME);
|
||
|
$("#userphone").val(applyData.USERPHONE);
|
||
|
$("#carnum").val(applyData.CARNUM);
|
||
|
$("#starttime").val(applyData.STARTTIME);
|
||
|
$("#finishtime").val(applyData.FINISHTIME);
|
||
|
$("#userman").val(applyData.USERMAN);
|
||
|
$("#dept").val(applyData.DEPT);
|
||
|
$("#ridenum").val(applyData.RIDENUM);
|
||
|
$("#ridemans").val(applyData.RIDEMANS);
|
||
|
$("#ridepurpose").val(applyData.RIDEPURPOSE);
|
||
|
$("#startpoint").val(applyData.STARTPOINT);
|
||
|
$("#destination").val(applyData.DESTINATION);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
getWiteList = function () {
|
||
|
$.ajax({
|
||
|
type: "post",
|
||
|
url: "../../ashx/ZYCarApplyHandler.ashx",
|
||
|
data: { Action: "getWaitList", id: applyId },
|
||
|
dataType: "json",
|
||
|
success: function (res) {
|
||
|
console.log(res.data);
|
||
|
var waitData = res.data;
|
||
|
countSum = waitData.length;
|
||
|
waitData.forEach(function (obj, index, arr) {
|
||
|
//countSum = index;
|
||
|
console.log(index);
|
||
|
var color = "", state = "";
|
||
|
var li = "<li class='layui-timeline-item'>";
|
||
|
if (obj.STATE == 0) {
|
||
|
li += "<i class='layui-icon layui-icon-circle' style='color:black'></i>";
|
||
|
color = "black";
|
||
|
state = "等待处理"
|
||
|
} else if (obj.STATE == 1) {
|
||
|
li += "<i class='layui-icon layui-icon-edit' style='color:blue;font-size:30px'></i>";
|
||
|
color = "blue";
|
||
|
state = "审批中";
|
||
|
sort = obj.SORT;
|
||
|
} else if (obj.STATE == 2) {
|
||
|
li += "<i class='layui-icon layui-icon-ok-circle' style='color:green;font-size:30px'></i>";
|
||
|
color = "green";
|
||
|
state = "同意";
|
||
|
count++;
|
||
|
} else if (obj.STATE == 3) {
|
||
|
li += "<i class='layui-icon layui-icon-close-fill' style='color:red;font-size:30px'></i>";
|
||
|
color = "red";
|
||
|
state = "不同意"
|
||
|
}
|
||
|
li += "<div class='layui-timeline-content layui-text'>";
|
||
|
li += "<h4 class='layui-timeline-title' style='font-size: 16px;'><span style='color:" + color + "'>【" + state + "】</span>  审批人:" + obj.PPL_NAME + "</h4>";
|
||
|
if (waitId != null && waitId == obj.ID) {
|
||
|
li += "<textarea class='layui-textarea' style='margin-bottom: 10px;' id='a_opinion' placeholder='请输入审批意见'></textarea>";
|
||
|
li += "<div class='layui-center'><a onclick='agreeClick()' class='layui-btn'>同意</a>";
|
||
|
li += "<a onclick='disagreeClick()' class='layui-btn layui-btn-danger'>不同意</a></div>";
|
||
|
} else {
|
||
|
if (obj.A_TIME != "") {
|
||
|
li += "<p>审批时间:" + obj.A_TIME + "</p>";
|
||
|
li += "<p>审批意见:" + obj.A_OPINION + "</p>";
|
||
|
}
|
||
|
}
|
||
|
li += "</div></li>"
|
||
|
$("#stepMsg").append(li);
|
||
|
});
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
$(function () {
|
||
|
getApply();
|
||
|
getWiteList();
|
||
|
});
|
||
|
|
||
|
agreeClick = function () {
|
||
|
//load提交
|
||
|
var index = layer.msg('数据提交中,请稍候', { icon: 16, time: false, shade: 0.8 });
|
||
|
if (count < countSum) {
|
||
|
isOver = "0";
|
||
|
} else {
|
||
|
isOver = "1";
|
||
|
}
|
||
|
layer.confirm('请问是否同意【' + pplName + '】的车辆申请', {
|
||
|
icon: 1,
|
||
|
title: '提示',
|
||
|
btn: ['确定', '取消'] //按钮
|
||
|
}, function () {
|
||
|
$.post("../../ashx/ZYCarApplyHandler.ashx", {
|
||
|
Action: "editWait",
|
||
|
leaveId: lId, //请假表ID
|
||
|
waitId: waitId, //待办表ID
|
||
|
state: "2", //同意状态
|
||
|
sort: sort, //审批顺序
|
||
|
a_opinion: $("#a_opinion").val(), //审批意见
|
||
|
isOver: isOver //是否审批结束
|
||
|
}, function (res) {
|
||
|
layer.close(index);
|
||
|
res = $.parseJSON(res);
|
||
|
if (res.code == 1) {
|
||
|
top.layer.msg(res.msg);
|
||
|
parent.location.reload();
|
||
|
} else {
|
||
|
layer.msg(res.msg);
|
||
|
}
|
||
|
});
|
||
|
layer.close(index);
|
||
|
return false;
|
||
|
});
|
||
|
}
|
||
|
disagreeClick = function () {
|
||
|
var index = layer.msg('数据提交中,请稍候', { icon: 16, time: false, shade: 0.8 });
|
||
|
if ((count + 1) < countSum) {
|
||
|
isOver = "0";
|
||
|
} else {
|
||
|
isOver = "1";
|
||
|
}
|
||
|
layer.confirm('请问是否不同意【' + pplName + '】的车辆申请', {
|
||
|
icon: 2,
|
||
|
title: '提示',
|
||
|
btn: ['确定', '取消'] //按钮
|
||
|
}, function () {
|
||
|
$.post("../../ashx/ZYCarApplyHandler.ashx", {
|
||
|
Action: "editWait",
|
||
|
leaveId: lId, //请假表ID
|
||
|
waitId: waitId, //待办表ID
|
||
|
state: "3", //同意状态
|
||
|
sort: sort, //审批顺序
|
||
|
a_opinion: $("#a_opinion").val(), //审批意见
|
||
|
isOver: isOver //是否审批结束
|
||
|
}, function (res) {
|
||
|
layer.close(index);
|
||
|
res = $.parseJSON(res);
|
||
|
if (res.code == 1) {
|
||
|
top.layer.msg(res.msg);
|
||
|
parent.location.reload();
|
||
|
} else {
|
||
|
layer.msg(res.msg);
|
||
|
}
|
||
|
});
|
||
|
layer.close(index);
|
||
|
return false;
|
||
|
});
|
||
|
}
|
||
|
})
|