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.
539 lines
22 KiB
539 lines
22 KiB
layui
|
|
.config({
|
|
base: "../../js/",
|
|
})
|
|
.use(["ztree", "form", "layer", "table", "laytpl"], function () {
|
|
var form = layui.form,
|
|
layer = parent.layer === undefined ? layui.layer : top.layer,
|
|
laytpl = layui.laytpl,
|
|
table = layui.table;
|
|
var OrgId = JSON.parse(window.sessionStorage.getItem("userInfo")).OrgID;
|
|
var vehicleType = "";
|
|
form.on("select(searchClass)", function (data) {
|
|
vehicleType = data.value;
|
|
if (vehicleType == "0") {
|
|
$("#vehicleAcc_btn").show();
|
|
} else {
|
|
$("#vehicleAcc_btn").hide();
|
|
}
|
|
|
|
table.reload("carListTableAboutEqupt", {
|
|
page: {
|
|
curr: 1, //重新从第 1 页开始
|
|
},
|
|
where: {
|
|
Action: "CarList",
|
|
keywords: $(".searchVal").val(), //搜索的关键字
|
|
class: vehicleType, //车辆类别
|
|
random: new Date().getTime(), //随机参数
|
|
},
|
|
});
|
|
});
|
|
|
|
var AREA_PID = "";
|
|
var $zTree,
|
|
OrgList = [];
|
|
var setting = {
|
|
view: {
|
|
selectedMulti: false,
|
|
},
|
|
check: {
|
|
enable: true,
|
|
},
|
|
data: {
|
|
key: {
|
|
name: "NAME",
|
|
},
|
|
simpleData: {
|
|
enable: true,
|
|
type: "TYPE",
|
|
idKey: "ID",
|
|
pIdKey: "PID",
|
|
},
|
|
},
|
|
edit: {
|
|
enable: false,
|
|
},
|
|
callback: {
|
|
onClick: function (e, treeId, treeNode) {
|
|
search(treeNode.ID, treeNode.TYPE);
|
|
},
|
|
},
|
|
};
|
|
//初始化树
|
|
$.ajax({
|
|
type: "post",
|
|
url: "../../ashx/SysEmpHandler.ashx",
|
|
data: { Action: "OrgDeptTree", OrgId: OrgId },
|
|
dataType: "json",
|
|
success: function (result) {
|
|
var data = result.data;
|
|
var zNodes = [];
|
|
if (data.length > 0) {
|
|
for (var i in data) {
|
|
if (data[i].TYPE == "org") {
|
|
OrgList.push(data[i].ID);
|
|
zNodes.push(data[i]);
|
|
}
|
|
}
|
|
}
|
|
$zTree = $.fn.zTree.init($("#ztree"), setting, zNodes);
|
|
},
|
|
});
|
|
|
|
//延迟展开根节点
|
|
setTimeout(function () {
|
|
var nodes = $zTree.getNodes();
|
|
for (var i = 0; i < nodes.length; i++) {
|
|
$zTree.expandNode($zTree.getNodes()[i], true, false, false);
|
|
}
|
|
}, 500);
|
|
|
|
//每次加载节点触发的方法
|
|
function onAsyncSuccess(event, treeId, treeNode, msg) {
|
|
//递归展开子节点
|
|
if (treeNode != undefined) {
|
|
expandNodes(treeNode.children, "ztree");
|
|
}
|
|
}
|
|
|
|
//递归展开子节点
|
|
function expandNodes(nodes, treeId) {
|
|
if (!nodes) return;
|
|
var zTree = $.fn.zTree.getZTreeObj(treeId);
|
|
for (var i = 0, l = nodes.length; i < l; i++) {
|
|
zTree.expandNode(nodes[i], true, false, false);
|
|
if (nodes[i].isParent && nodes[i].zAsync) {
|
|
expandNodes(nodes[i].children, treeId);
|
|
}
|
|
}
|
|
}
|
|
|
|
//获取父级行政区ID
|
|
var orgStr = "";
|
|
$.ajax({
|
|
type: "post",
|
|
url: "../../ashx/FireOrgHandler.ashx",
|
|
data: { Action: "AreaPID", ORG_ID: OrgId },
|
|
dataType: "json",
|
|
success: function (result) {
|
|
AREA_PID = result.data.CITY;
|
|
},
|
|
});
|
|
|
|
setTimeout(function () {
|
|
var is_content = "";
|
|
$("input:checkbox[name='is_content']:checked").each(function (i) {
|
|
is_content = $(this).val();
|
|
});
|
|
//系统列表
|
|
var tableIns = table.render({
|
|
elem: "#carListTableAboutEqupt",
|
|
url: "../../ashx/CarHandler.ashx",
|
|
where: {
|
|
Action: "CarList",
|
|
class: "1",
|
|
OrgId: OrgId,
|
|
OrgList: OrgList.join(","),
|
|
is_content: is_content,
|
|
random: new Date().getTime(),
|
|
}, // OrgId: OrgId,
|
|
//where: { Action: 'CarList', class: vehicleType, OrgId: OrgId, OrgList: OrgList.join(","), is_content: is_content, random: new Date().getTime() }, // OrgId: OrgId,
|
|
cellMinWidth: 95,
|
|
page: true,
|
|
height: "full-125",
|
|
limits: [10, 15, 20, 25],
|
|
limit: 15,
|
|
id: "carListTableAboutEqupt",
|
|
cols: [
|
|
[
|
|
{ type: "checkbox", fixed: "left", width: 50 },
|
|
{
|
|
field: "CAR_NUM",
|
|
title: "车辆号牌",
|
|
minWidth: 60,
|
|
align: "center",
|
|
},
|
|
{
|
|
field: "CAR_NAME",
|
|
title: "车辆名称",
|
|
minWidth: 60,
|
|
align: "center",
|
|
},
|
|
{
|
|
field: "CLASS",
|
|
title: "车辆类别",
|
|
minWidth: 60,
|
|
align: "center",
|
|
templet: function (d) {
|
|
if (d.CLASS == "0") {
|
|
return '<span class="layui-badge layui-bg-green">执勤车</span>';
|
|
//return '<span class="layui-badge layui-bg-green">公务车</span>';
|
|
} else if (d.CLASS == "1") {
|
|
return '<span class="layui-badge layui-bg-orange">执勤车</span>';
|
|
} else if (d.CLASS == "2") {
|
|
//return '<span class="layui-badge layui-bg-blue">地方车</span>';
|
|
return '<span class="layui-badge layui-bg-blue">执勤车</span>';
|
|
} else {
|
|
//return '<span class="layui-badge layui-bg-gray">无类型</span>';
|
|
return '<span class="layui-badge layui-bg-gray">执勤车</span>';
|
|
}
|
|
//return 'ID:' + d.id + ',标题:<span style="color: #c00;">' + d.title + '</span>'
|
|
},
|
|
},
|
|
|
|
{
|
|
field: "ORG_NAME",
|
|
title: "所属消防单位",
|
|
minWidth: 60,
|
|
align: "center",
|
|
},
|
|
{
|
|
//field: 'ISRUN', title: '是否可用', minWidth: 60, align: "center", templet: function (d) {
|
|
// if (d.ISRUN == "0") { //是否运行 0可用1在用2故障
|
|
// return ' <span class="layui-badge layui-bg-blue">可用</span>';
|
|
// } else if (d.ISRUN == "1") {
|
|
// return ' <span class="layui-badge layui-bg-danger">在用</span>';
|
|
// } else if (d.ISRUN == "2") {
|
|
// return ' <span class="layui-badge layui-bg-gray">故障</span>';
|
|
// } else {
|
|
// return ' <span class="layui-badge layui-bg-gray">未知</span>';
|
|
// }
|
|
//}
|
|
field: "LIABLEMAN",
|
|
title: "责任人",
|
|
minWidth: 60,
|
|
align: "center",
|
|
},
|
|
{
|
|
field: "TELNUM",
|
|
title: "责任人电话",
|
|
minWidth: 60,
|
|
align: "center",
|
|
},
|
|
//{
|
|
// field: 'ISSTART', title: '是否启动', minWidth: 60, align: "center", templet: function (d) {
|
|
// if (d.ISSTART == "0") {
|
|
// return ' <span class="layui-badge layui-bg-blue">未启动</span>';
|
|
// } else if (d.ISSTART == "1") {
|
|
// return ' <span class="layui-badge layui-bg-danger">已启动</span>';
|
|
// } else {
|
|
// return ' <span class="layui-badge layui-bg-gray">未知</span>';
|
|
// }
|
|
// }
|
|
//},
|
|
{
|
|
field: "ISAPPLY",
|
|
title: "申请状态",
|
|
minWidth: 60,
|
|
align: "center",
|
|
templet: function (d) {
|
|
if (d.ISAPPLY == "0") {
|
|
return ' <span class="layui-badge layui-bg-blue" style="background-color:#30ca30 !important">在岗</span>';
|
|
} else if (d.ISAPPLY == "1") {
|
|
return ' <span class="layui-badge" style="background-color:#3079ea !important">申请中</span>';
|
|
} else if (d.ISAPPLY == "2") {
|
|
return ' <span class="layui-badge ">离岗</span>';
|
|
} else {
|
|
return ' <span class="layui-badge layui-bg-gray">未知</span>';
|
|
}
|
|
},
|
|
},
|
|
{
|
|
title: "操作",
|
|
width: 160,
|
|
templet: "#sysappListBar",
|
|
fixed: "right",
|
|
align: "center",
|
|
},
|
|
],
|
|
],
|
|
});
|
|
}, 500);
|
|
//搜索【此功能需要后台配合,所以暂时没有动态效果演示】
|
|
$(".search_btn").on("click", function () {
|
|
var is_content = "";
|
|
$("input:checkbox[name='is_content']:checked").each(function (i) {
|
|
is_content = $(this).val();
|
|
});
|
|
table.reload("carListTableAboutEqupt", {
|
|
page: {
|
|
curr: 1, //重新从第 1 页开始
|
|
},
|
|
where: {
|
|
Action: "CarList",
|
|
keywords: $(".searchVal").val(), //搜索的关键字
|
|
class: $("#searchClass").val(), //车辆类别
|
|
is_content: is_content,
|
|
random: new Date().getTime(), //随机参数
|
|
},
|
|
});
|
|
});
|
|
//导出
|
|
$(".exp_btn").click(function () {
|
|
var is_content = "";
|
|
$("input:checkbox[name='is_content']:checked").each(function (i) {
|
|
is_content = $(this).val();
|
|
});
|
|
|
|
layer.confirm(
|
|
"若需导出数据较多,或导致导出时间较长,请耐心等候,点击确认开始导出!",
|
|
{ icon: 3, title: "提示" },
|
|
function (index) {
|
|
var data = {
|
|
Action: "expList",
|
|
class: $("#searchClass").val(), //车辆类别
|
|
OrgId: OrgId,
|
|
is_content: is_content,
|
|
keywords: $(".searchVal").val(), //搜索的关键字
|
|
random: new Date().getTime(),
|
|
};
|
|
var url = "../../ashx/CarHandler.ashx";
|
|
var method = "POST";
|
|
$.downLoadFile(url, data, method, false);
|
|
|
|
layer.close(index);
|
|
}
|
|
);
|
|
});
|
|
function search(treeid, type) {
|
|
//console.log(treeid + "," + type);
|
|
var is_content = "";
|
|
$("input:checkbox[name='is_content']:checked").each(function (i) {
|
|
is_content = $(this).val();
|
|
});
|
|
table.reload("carListTableAboutEqupt", {
|
|
page: {
|
|
curr: 1, //重新从第 1 页开始
|
|
},
|
|
where: {
|
|
Action: "CarList",
|
|
keywords: $(".searchVal").val(), //搜索的关键字
|
|
treeID: treeid, //所属目录
|
|
type: type, //所属目录
|
|
class: $("#searchClass").val(), //车辆类别
|
|
is_content: is_content,
|
|
random: new Date().getTime(), //随机参数
|
|
},
|
|
});
|
|
}
|
|
reload = function () {
|
|
var is_content = "";
|
|
$("input:checkbox[name='is_content']:checked").each(function (i) {
|
|
is_content = $(this).val();
|
|
});
|
|
table.reload("carListTableAboutEqupt", {
|
|
page: {
|
|
curr: 1, //重新从第 1 页开始
|
|
},
|
|
where: {
|
|
Action: "CarList",
|
|
keywords: $(".searchVal").val(), //搜索的关键字
|
|
class: $("#searchClass").val(), //车辆类别
|
|
is_content: is_content,
|
|
random: new Date().getTime(), //随机参数
|
|
},
|
|
});
|
|
};
|
|
//添加编辑
|
|
function AddEdit(edit) {
|
|
var clientWidth = parseInt(document.body.clientWidth * 0.7) + "px";
|
|
var clientHeight = parseInt(document.body.clientHeight * 0.85) + "px";
|
|
var title = "";
|
|
title = "车载装备维护";
|
|
var index = layui.layer.open({
|
|
title: title,
|
|
type: 2,
|
|
area: [clientWidth, clientHeight],
|
|
maxmin: true,
|
|
content:
|
|
"edit.html?AREA_PID=" +
|
|
AREA_PID +
|
|
"&ID=" +
|
|
edit.ID +
|
|
"&vehicleType=" +
|
|
"1" +
|
|
"&CarNUM=" +
|
|
edit.CAR_NUM,
|
|
});
|
|
window.sessionStorage.setItem("index", index);
|
|
//改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
|
|
$(window).on("resize", function () {
|
|
layui.layer.full(window.sessionStorage.getItem("index"));
|
|
});
|
|
}
|
|
|
|
//查看
|
|
function View(edit) {
|
|
var clientWidth = parseInt(document.body.clientWidth * 0.5) + "px";
|
|
var clientHeight = parseInt(document.body.clientHeight * 0.7) + "px";
|
|
var title = "";
|
|
title = "车载装备详情";
|
|
var index = layui.layer.open({
|
|
title: title,
|
|
type: 2,
|
|
area: [clientWidth, clientHeight],
|
|
maxmin: true,
|
|
content:
|
|
"view.html?AREA_PID=" +
|
|
AREA_PID +
|
|
"&ID=" +
|
|
edit.ID +
|
|
"&vehicleType=" +
|
|
"1",
|
|
});
|
|
window.sessionStorage.setItem("index", index);
|
|
//改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
|
|
$(window).on("resize", function () {
|
|
layui.layer.full(window.sessionStorage.getItem("index"));
|
|
});
|
|
}
|
|
|
|
// 记录查看
|
|
function Recard(edit) {
|
|
var clientWidth = parseInt(document.body.clientWidth * 0.5) + "px";
|
|
var clientHeight = parseInt(document.body.clientHeight * 0.7) + "px";
|
|
var title = "";
|
|
title = "交接记录";
|
|
var index = layui.layer.open({
|
|
title: title,
|
|
type: 2,
|
|
area: [clientWidth, clientHeight],
|
|
maxmin: true,
|
|
//content: "view.html?AREA_PID=" + AREA_PID + "&ID=" + edit.ID + "&vehicleType=" + vehicleType
|
|
content:
|
|
"record.html?AREA_PID=" +
|
|
AREA_PID +
|
|
"&ID=" +
|
|
edit.ID +
|
|
"&vehicleType=" +
|
|
"1",
|
|
});
|
|
window.sessionStorage.setItem("index", index);
|
|
//改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
|
|
$(window).on("resize", function () {
|
|
layui.layer.full(window.sessionStorage.getItem("index"));
|
|
});
|
|
}
|
|
|
|
$(".add_btn").click(function () {
|
|
AddEdit();
|
|
});
|
|
|
|
//批量删除
|
|
$(".delAll_btn").click(function () {
|
|
var checkStatus = table.checkStatus("carListTableAboutEqupt"),
|
|
data = checkStatus.data,
|
|
carList = [];
|
|
if (data.length > 0) {
|
|
for (var i in data) {
|
|
carList.push(data[i].ID);
|
|
}
|
|
layer.confirm(
|
|
"确定删除选中的车辆?",
|
|
{ icon: 3, title: "提示信息" },
|
|
function (index) {
|
|
//提交信息
|
|
$.post(
|
|
"../../ashx/CarHandler.ashx",
|
|
{
|
|
Action: "Del",
|
|
carList: carList.join(","),
|
|
random: new Date().getTime(), //随机参数
|
|
},
|
|
function (res) {
|
|
res = $.parseJSON(res);
|
|
if (res.code == 1) {
|
|
top.layer.msg(res.msg);
|
|
reload();
|
|
} else {
|
|
top.layer.msg(res.msg);
|
|
}
|
|
}
|
|
);
|
|
}
|
|
);
|
|
} else {
|
|
layer.msg("请选择需要删除的车辆");
|
|
}
|
|
});
|
|
|
|
//列表操作
|
|
table.on("tool(carListTableAboutEqupt)", function (obj) {
|
|
var layEvent = obj.event;
|
|
data = obj.data;
|
|
console.log(obj)
|
|
console.log(data)
|
|
if (layEvent == "equipEdit") {
|
|
//修改
|
|
AddEdit(data);
|
|
} else if (layEvent == "audit") {
|
|
//查看
|
|
View(data);
|
|
} else if (layEvent == "recard") {
|
|
//记录
|
|
Recard(data);
|
|
} else if (layEvent == "playVideo") {
|
|
//车载视频
|
|
playVideo(data);
|
|
}
|
|
});
|
|
|
|
function playVideo(data) {
|
|
if (!data.IMEI) {
|
|
layer.msg("暂未获取到视频信息,请稍后再试");
|
|
} else {
|
|
var l = (screen.availWidth - 500) / 2;
|
|
var t = (screen.availHeight - 300) / 2;
|
|
if (data.FACTORY == "1") {
|
|
window.open(
|
|
"../../Fire/Map/LTTMapVideoRealPlay.html?carNum=" + data.IMEI,
|
|
"实时视频",
|
|
"height=300, width=550, top=" +
|
|
t +
|
|
", left=" +
|
|
l +
|
|
", toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no"
|
|
);
|
|
} else {
|
|
window.open(
|
|
"../../Fire/Map/MapVideoRealPlay.html?imei=" + data.IMEI,
|
|
"实时视频",
|
|
"height=300, width=550, top=" +
|
|
t +
|
|
", left=" +
|
|
l +
|
|
", toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no"
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
//申请表单
|
|
$(".apply_btn").click(function () {
|
|
var clientWidth = parseInt(document.body.clientWidth * 0.7) + "px";
|
|
var clientHeight = parseInt(document.body.clientHeight * 0.9) + "px";
|
|
var title = "申请表单";
|
|
var index = layui.layer.open({
|
|
title: title,
|
|
type: 2,
|
|
area: [clientWidth, clientHeight],
|
|
maxmin: true,
|
|
content: "apply.html",
|
|
success: function (layero, index) { },
|
|
});
|
|
window.sessionStorage.setItem("index", index);
|
|
//改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
|
|
$(window).on("resize", function () {
|
|
layui.layer.full(window.sessionStorage.getItem("index"));
|
|
});
|
|
});
|
|
|
|
form.on("checkbox(bellow)", function (data) {
|
|
if (data.elem.checked == true) {
|
|
reload();
|
|
} else {
|
|
reload();
|
|
}
|
|
});
|
|
});
|
|
|