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.
200 lines
7.9 KiB
200 lines
7.9 KiB
11 months ago
|
layui.use(['form', 'layer', 'table', 'laytpl'], function () {
|
||
|
var form = layui.form,
|
||
|
layer = layui.layer,
|
||
|
$ = layui.jquery,
|
||
|
laytpl = layui.laytpl,
|
||
|
table = layui.table;
|
||
|
var UserId = JSON.parse(window.sessionStorage.getItem("userInfo")).UserCode
|
||
|
var OrgID = JSON.parse(window.sessionStorage.getItem("userInfo")).OrgID
|
||
|
|
||
|
//系统列表
|
||
|
var tableIns = table.render({
|
||
|
elem: '#carApplyList',
|
||
|
url: '../../ashx/CarApplyHandler.ashx',
|
||
|
where: { Action: 'List', random: new Date().getTime(), userId: UserId ,orgID:OrgID },
|
||
|
cellMinWidth: 95,
|
||
|
page: true,
|
||
|
height: "full-125",
|
||
|
limits: [10, 15, 20, 25],
|
||
|
limit: 20,
|
||
|
id: "ListTable",
|
||
|
cols: [[
|
||
|
{ field: 'CARNUM', title: '车牌号', minWidth: 60, align: "center" },
|
||
|
{ field: 'USERNAME', title: '申请人', minWidth: 60, align: "center" },
|
||
|
//{ field: 'STA_NAME', title: '用车部门', minWidth: 60, align: "center" },
|
||
|
{ field: 'STATE', title: '状态', align: 'center', minWidth: 60, templet: function (d) {
|
||
|
if (d.STATE == "0") {
|
||
|
return '<span class="layui-badge layui-bg-blue">申请中</span>';
|
||
|
} else if (d.STATE == "1") {
|
||
|
return '<span class="layui-badge layui-bg-green">通过</span>';
|
||
|
} else if (d.STATE == "2") {
|
||
|
return ' <span class="layui-badge layui-bg-gray">未通过</span>';
|
||
|
} else {
|
||
|
return '<span class="layui-badge layui-bg-blue">申请中</span>';
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{ field: 'STARTTIME', title: '用车时间', minWidth: 60, align: "center" },
|
||
|
{ field: 'EXTENDCODE2', title: '还车状态', align: 'center', minWidth: 60, templet: function (d) {
|
||
|
if(d.STATE="1")
|
||
|
{
|
||
|
if (d.EXTENDCODE2 == "0") {
|
||
|
return '<span class="layui-badge layui-bg-blue">申请中</span>';
|
||
|
} else if (d.EXTENDCODE2 == "1") {
|
||
|
return '<span class="layui-badge layui-bg-orange">未还车</span>';
|
||
|
} else if (d.EXTENDCODE2 == "2") {
|
||
|
return ' <span class="layui-badge layui-bg-green">已还车</span>';
|
||
|
}else if (d.EXTENDCODE2 == "3") {
|
||
|
return ' <span class="layui-badge layui-bg-orange">未通过</span>';
|
||
|
}else{
|
||
|
return '';
|
||
|
}
|
||
|
}
|
||
|
else{
|
||
|
return '';
|
||
|
}
|
||
|
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
title: '操作', width: 180, fixed: "right", align: "center",templet: function (d) {
|
||
|
//console.log(d.EXTENDCODE2);
|
||
|
//if (d.STATE == "1") {
|
||
|
// if ((d.EXTENDCODE2 == "0" ||d.EXTENDCODE2 == "1"||d.EXTENDCODE2 == "3")&&d.USERID==UserId) {
|
||
|
// return $('#oacarApplyListBar2').html();
|
||
|
// } else {
|
||
|
// return $('#oacarApplyListBar').html();
|
||
|
// }
|
||
|
//} else {
|
||
|
return $('#oacarApplyListBar').html();
|
||
|
//}
|
||
|
}
|
||
|
}
|
||
|
]]
|
||
|
});
|
||
|
//table重新加载
|
||
|
function reload() {
|
||
|
table.reload("ListTable", {
|
||
|
page: { curr: 1 },
|
||
|
where: {
|
||
|
Action: 'List',
|
||
|
keywords: $(".searchVal").val(), //搜索的关键字
|
||
|
random: new Date().getTime(), //随机参数
|
||
|
userId: UserId
|
||
|
}
|
||
|
|
||
|
})
|
||
|
}
|
||
|
//搜索【此功能需要后台配合,所以暂时没有动态效果演示】
|
||
|
$(".search_btn").on("click", function () {
|
||
|
if ($(".searchVal").val() != '') {
|
||
|
table.reload("ListTable", {
|
||
|
page: {
|
||
|
curr: 1 //重新从第 1 页开始
|
||
|
},
|
||
|
where: {
|
||
|
Action: 'List',
|
||
|
keywords: $(".searchVal").val(), //搜索的关键字
|
||
|
random: new Date().getTime(), //随机参数
|
||
|
userId: UserId
|
||
|
}
|
||
|
});
|
||
|
} else {
|
||
|
layer.msg("请输入搜索的内容");
|
||
|
}
|
||
|
});
|
||
|
$(".addNews_btn").click(function () {
|
||
|
//var clientWidth = parseInt(document.body.clientWidth * 0.7) + 'px';
|
||
|
//var clientHeight = parseInt(document.body.clientHeight * 0.9) + 'px';
|
||
|
//var index = layui.layer.open({
|
||
|
// title: "车辆申请单",
|
||
|
// type: 2,
|
||
|
// area: [clientWidth, clientHeight],
|
||
|
// maxmin: true,
|
||
|
// content: "applyItem.html"
|
||
|
//})
|
||
|
//window.sessionStorage.setItem("index", index);
|
||
|
////改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
|
||
|
//$(window).on("resize", function () {
|
||
|
// layui.layer.full(window.sessionStorage.getItem("index"));
|
||
|
//})
|
||
|
var json = {
|
||
|
"hasChilds": "0",
|
||
|
"height": "",
|
||
|
"ico": "",
|
||
|
"id": "0a1530262dc64865aca9cbd5db142c13",
|
||
|
"link": "Platform/WorkFlowRun/Default.aspx?flowid=c6533642-dc36-4728-aac7-81e6989f6105",
|
||
|
"model": "0",
|
||
|
"title": "用车流程",
|
||
|
"width": ""
|
||
|
}
|
||
|
top.treeClick(json);
|
||
|
});
|
||
|
//查看进度
|
||
|
function view(data) {
|
||
|
var clientWidth = parseInt(document.body.clientWidth * 0.9) + 'px';
|
||
|
var clientHeight = parseInt(document.body.clientHeight * 0.9) + 'px';
|
||
|
var index = layui.layer.open({
|
||
|
title: "查看申请单处理进度",
|
||
|
type: 2,
|
||
|
area: [clientWidth, clientHeight],
|
||
|
maxmin: true,
|
||
|
content: "carAudit.html?applyId=" + data.ID, // + "&waitId=20583a98-5647-48ac-a99f-48becfc0470e",
|
||
|
success: function (layero, index) {
|
||
|
var body = layui.layer.getChildFrame('body', index);
|
||
|
var iframe = window['layui-layer-iframe' + index];
|
||
|
body.find(".ID").val(data.ID)//ID与action是一个隐藏的元素
|
||
|
body.find(".Action").val("view");
|
||
|
}
|
||
|
})
|
||
|
window.sessionStorage.setItem("index", index);
|
||
|
//改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
|
||
|
$(window).on("resize", function () {
|
||
|
layui.layer.full(window.sessionStorage.getItem("index"));
|
||
|
})
|
||
|
}
|
||
|
|
||
|
function edit(data) {
|
||
|
console.log(data);
|
||
|
layer.confirm('请问是否发起还车申请', {
|
||
|
icon: 3,
|
||
|
title: '提示',
|
||
|
btn: ['确定', '取消'] //按钮
|
||
|
}, function () {
|
||
|
$.post("../../ashx/CarApplyHandler.ashx", {
|
||
|
Action: "ReturnCar",
|
||
|
Id: data.ID, //请假表ID
|
||
|
}, function (res) {
|
||
|
res = $.parseJSON(res);
|
||
|
if (res.code == 1) {
|
||
|
|
||
|
// parent.layer.msg(res.msg);
|
||
|
var title = "车辆还车审批";
|
||
|
var content = data.USERNAME + "的车辆还车申请,请审批!";
|
||
|
var usercode = res.usercode;
|
||
|
sendMessage(title, content, usercode);
|
||
|
top.layer.msg(res.msg);
|
||
|
location.reload();
|
||
|
} else {
|
||
|
layer.msg(res.msg);
|
||
|
}
|
||
|
});
|
||
|
return false;
|
||
|
});
|
||
|
}
|
||
|
|
||
|
//列表操作
|
||
|
table.on('tool(carApplyList)', function (obj) {
|
||
|
var layEvent = obj.event;
|
||
|
data = obj.data;
|
||
|
if (layEvent == 'audit') {//查看
|
||
|
view(data);
|
||
|
}
|
||
|
else if (layEvent == 'edit')
|
||
|
{
|
||
|
edit(data);
|
||
|
}
|
||
|
})
|
||
|
|
||
|
startMqttServer();
|
||
|
})
|