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.
518 lines
20 KiB
518 lines
20 KiB
11 months ago
|
layui.config({
|
||
|
base: "../../js/",
|
||
|
}).use(['form', 'layer', 'table', 'laytpl', 'laydate', 'upload'], function () {
|
||
|
var form = layui.form,
|
||
|
layer = parent.layer === undefined ? layui.layer : top.layer,
|
||
|
$ = layui.jquery,
|
||
|
laytpl = layui.laytpl,
|
||
|
upload = layui.upload,
|
||
|
table = layui.table;
|
||
|
laydate = layui.laydate;
|
||
|
|
||
|
var OrgId = JSON.parse(window.sessionStorage.getItem("userInfo")).OrgID;
|
||
|
let OrgList = [];
|
||
|
|
||
|
var usersUid = $.getUrlVar("usersUid");
|
||
|
var AREA_PID = $.getUrlVar("AREA_PID");
|
||
|
var vehicleType = $.getUrlVar("vehicleType");
|
||
|
if (vehicleType != null) {
|
||
|
getFromByCid(vehicleType);
|
||
|
$("#classType").siblings("div.layui-form-select").find('dl').find("dd[lay-value='" + vehicleType + "']").click();
|
||
|
}
|
||
|
|
||
|
//初始化
|
||
|
$.ajax({
|
||
|
type: "post",
|
||
|
url: "../../ashx/SysEmpHandler.ashx",
|
||
|
data: { Action: "OrgDeptTree", OrgId: OrgId },
|
||
|
dataType: "json",
|
||
|
success: function (result) {
|
||
|
var data = result.data;
|
||
|
if (data.length > 0) {
|
||
|
for (var i in data) {
|
||
|
if (data[i].TYPE == "org") {
|
||
|
OrgList.push(data[i].ID);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
});
|
||
|
|
||
|
// 获取车载装备名称 初始化
|
||
|
//var epuTypeStr = "";
|
||
|
//$.ajax({
|
||
|
// type: "post",
|
||
|
// url: "../../ashx/FireCarEquipHandler.ashx",
|
||
|
// data: { Action: "EpuTypeAllList", OrgId: OrgId },
|
||
|
// dataType: "json",
|
||
|
// success: function (result) {
|
||
|
// result.data.ds.forEach(function (obj, index, arr) {
|
||
|
// epuTypeStr += "<option value='" + obj.ID + "' data-code= '" + obj.CODE + "' data-type-code= '" + obj.TYPE_CODE + "'>" + obj.NAME + "</option>";
|
||
|
// });
|
||
|
// $("#searchEquipType").append(epuTypeStr);
|
||
|
// form.render('select');
|
||
|
// }
|
||
|
//});
|
||
|
|
||
|
////装备类型下拉框监听
|
||
|
//form.on('select(searchEquipType)', function (data) {
|
||
|
// var code = $("#searchEquipType").find("option:selected").attr("data-code");
|
||
|
// code = (code == null) ? "" : code;
|
||
|
// $("#EQUIP_CODE").val(code);
|
||
|
|
||
|
// var type_code = $("#searchEquipType").find("option:selected").attr("data-type-code");
|
||
|
// type_code = (type_code == null) ? "" : type_code;
|
||
|
// $("#EQUIP_TYPE").val(type_code);
|
||
|
//});
|
||
|
|
||
|
// 表格初始化加载
|
||
|
setTimeout(function () {
|
||
|
let ID = $.getUrlVar("ID");
|
||
|
console.log(ID)
|
||
|
//系统列表
|
||
|
let tableIns = table.render({
|
||
|
elem: "#carEquipListEdit",
|
||
|
url: "../../ashx/FireCarEquipHandler.ashx",
|
||
|
where: {
|
||
|
Action: "CarEquipList",
|
||
|
ID: ID,
|
||
|
random: new Date().getTime(),
|
||
|
}, // OrgId: OrgId,
|
||
|
cellMinWidth: 95,
|
||
|
page: true,
|
||
|
height: "full",
|
||
|
limits: [10, 15, 20, 25],
|
||
|
limit: 15,
|
||
|
id: "carEquipListEdit",
|
||
|
cols: [
|
||
|
[
|
||
|
{ type: "checkbox", fixed: "left", width: 30 },
|
||
|
{
|
||
|
field: "EQUIP_NAME",
|
||
|
title: "装备名称",
|
||
|
minWidth: 60,
|
||
|
align: "center",
|
||
|
},
|
||
|
{
|
||
|
field: "EQUIP_CODE",
|
||
|
title: "装备编码",
|
||
|
minWidth: 60,
|
||
|
align: "center",
|
||
|
},
|
||
|
{
|
||
|
field: "EQUIP_TYPE",
|
||
|
title: "装备类型代码",
|
||
|
minWidth: 60,
|
||
|
align: "center",
|
||
|
},
|
||
|
{
|
||
|
field: "EQUIP_NUMBER",
|
||
|
title: "装备数量",
|
||
|
minWidth: 60,
|
||
|
align: "center",
|
||
|
},
|
||
|
{
|
||
|
field: "EQUIP_UNIT",
|
||
|
title: "装备单位",
|
||
|
minWidth: 60,
|
||
|
align: "center",
|
||
|
},
|
||
|
{
|
||
|
field: "CREATE_MAN",
|
||
|
title: "更新人员",
|
||
|
minWidth: 60,
|
||
|
align: "center",
|
||
|
},
|
||
|
{
|
||
|
field: "CREATE_TIME",
|
||
|
title: "更新时间",
|
||
|
minWidth: 60,
|
||
|
align: "center",
|
||
|
},
|
||
|
{
|
||
|
field: "REMAEK",
|
||
|
title: "备注",
|
||
|
minWidth: 60,
|
||
|
align: "center",
|
||
|
},
|
||
|
{
|
||
|
title: "操作",
|
||
|
width: 70,
|
||
|
templet: "#sysappListBar",
|
||
|
fixed: "right",
|
||
|
align: "center",
|
||
|
},
|
||
|
],
|
||
|
],
|
||
|
});
|
||
|
}, 500);
|
||
|
|
||
|
//批量删除
|
||
|
$(".delAll_btn").click(function () {
|
||
|
var checkStatus = table.checkStatus("carEquipListEdit"),
|
||
|
data = checkStatus.data,
|
||
|
carEquipListEdit = [];
|
||
|
console.log(data)
|
||
|
if (data.length > 0) {
|
||
|
for (var i in data) {
|
||
|
console.log(data[i])
|
||
|
carEquipListEdit.push(data[i].ID);
|
||
|
}
|
||
|
console.log(carEquipListEdit)
|
||
|
layer.confirm(
|
||
|
"确定删除选中车载装备?",
|
||
|
{ icon: 3, title: "提示信息" },
|
||
|
function (index) {
|
||
|
//提交信息
|
||
|
$.post(
|
||
|
"../../ashx/FireCarEquipHandler.ashx",
|
||
|
{
|
||
|
Action: "Del",
|
||
|
carEquipListEdit: carEquipListEdit.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("请选择需要删除的车载装备");
|
||
|
}
|
||
|
});
|
||
|
|
||
|
// 删除后重载
|
||
|
reload = function () {
|
||
|
let ID = $.getUrlVar("ID");
|
||
|
table.reload("carEquipListEdit", {
|
||
|
page: {
|
||
|
curr: 1, //重新从第 1 页开始
|
||
|
},
|
||
|
where: {
|
||
|
Action: "CarEquipList",
|
||
|
ID: ID,
|
||
|
random: new Date().getTime(),
|
||
|
},
|
||
|
});
|
||
|
};
|
||
|
|
||
|
//列表操作
|
||
|
table.on('tool(carEquipListEdit)', function (obj) {
|
||
|
var layEvent = obj.event;
|
||
|
data = obj.data;
|
||
|
if (layEvent == 'edit_btn') {//修改
|
||
|
AddEdit(data);
|
||
|
}
|
||
|
})
|
||
|
var CarNum = $.getUrlVar("CarNUM");
|
||
|
var CarId = $.getUrlVar("ID");
|
||
|
$(".add_btn").click(function () {
|
||
|
|
||
|
var clientWidth = parseInt(document.body.clientWidth * 0.7) + 'px';
|
||
|
var clientHeight = parseInt(document.body.clientHeight * 0.6) + 'px';
|
||
|
var title = "";
|
||
|
title = "添加车载装备";
|
||
|
var index = layui.layer.open({
|
||
|
title: title,
|
||
|
type: 2,
|
||
|
area: [clientWidth, clientHeight],
|
||
|
maxmin: true,
|
||
|
//AddEquip,传入车辆信息
|
||
|
content: "CarEquEdit.html?",
|
||
|
success: function (layero, index) {
|
||
|
var body = layui.layer.getChildFrame('body', index);
|
||
|
body.find(".CarNum").val(CarNum);
|
||
|
body.find(".CarId").val(CarId);
|
||
|
body.find(".Action").val("CreateCarEquip");
|
||
|
form.render();
|
||
|
}
|
||
|
})
|
||
|
window.sessionStorage.setItem("index", index);
|
||
|
//改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
|
||
|
$(window).on("resize", function () {
|
||
|
layui.layer.full(window.sessionStorage.getItem("index"));
|
||
|
})
|
||
|
|
||
|
});
|
||
|
|
||
|
// 编辑窗口弹出
|
||
|
function AddEdit(edit) {
|
||
|
console.log(edit)
|
||
|
var clientWidth = parseInt(document.body.clientWidth * 0.7) + 'px';
|
||
|
var clientHeight = parseInt(document.body.clientHeight * 0.6) + 'px';
|
||
|
var title = "";
|
||
|
if (edit) { title = "编辑车载装备"; } else { title = "添加车载装备"; }
|
||
|
var index = layui.layer.open({
|
||
|
title: title,
|
||
|
type: 2,
|
||
|
area: [clientWidth, clientHeight],
|
||
|
maxmin: true,
|
||
|
content: "CarEquEdit.html",
|
||
|
success: function (layero, index) {
|
||
|
var body = layui.layer.getChildFrame('body', index);
|
||
|
if (edit) {
|
||
|
body.find(".ID").val(edit.ID);
|
||
|
body.find(".Action").val("Edit");
|
||
|
|
||
|
body.find("#searchEquipType").val(edit.EQUIP_ID);
|
||
|
body.find("#EQUIP_CODE").val(edit.EQUIP_CODE);
|
||
|
body.find("#EQUIP_TYPE").val(edit.EQUIP_TYPE);
|
||
|
body.find("#EQUIP_NUMBER").val(edit.EQUIP_NUMBER);
|
||
|
body.find("#EQUIP_UNIT").val(edit.EQUIP_UNIT);
|
||
|
body.find("#CREATE_MAN").val(edit.CREATE_MAN);
|
||
|
body.find("#CREATE_TIME").val(edit.CREATE_TIME);
|
||
|
body.find("#REMAEK").val(edit.REMAEK);
|
||
|
|
||
|
setTimeout(function () {
|
||
|
body.find("#searchEquipType").siblings("div.layui-form-select").find('dl').find("dd[lay-value='" + edit.EQUIP_ID + "']").click();
|
||
|
|
||
|
//body.find("#STATION_ID").siblings("div.layui-form-select").find('input').val();
|
||
|
}, 1000)
|
||
|
form.render();
|
||
|
|
||
|
} else {
|
||
|
body.find(".Action").val("Add");
|
||
|
form.render();
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
window.sessionStorage.setItem("index", index);
|
||
|
//改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
|
||
|
$(window).on("resize", function () {
|
||
|
layui.layer.full(window.sessionStorage.getItem("index"));
|
||
|
})
|
||
|
}
|
||
|
|
||
|
function getFromByCid(id) {
|
||
|
if (id == "0") {
|
||
|
$("#officialAndDucyDiv").show();
|
||
|
$("#officialDiv").show();
|
||
|
$("#ducyDiv").hide();
|
||
|
$("#socityDiv").hide();
|
||
|
}
|
||
|
else if (id == "1") {
|
||
|
$("#officialAndDucyDiv").show();
|
||
|
$("#ducyDiv").show();
|
||
|
$("#officialDiv").hide();
|
||
|
$("#socityDiv").hide();
|
||
|
}
|
||
|
else if (id == "2") {
|
||
|
$("#socityDiv").show();
|
||
|
$("#officialAndDucyDiv").hide();
|
||
|
$("#ducyDiv").hide();
|
||
|
$("#officialDiv").hide();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//$(function () {
|
||
|
// //机构、部门 联合下拉框查询
|
||
|
// deptArray = [];
|
||
|
// var orgStr = "";
|
||
|
// $.ajax({
|
||
|
// type: "post",
|
||
|
// url: "../../ashx/SysEmpHandler.ashx",
|
||
|
// data: { Action: "getOrgDeptTree", OrgId: OrgId },
|
||
|
// dataType: "json",
|
||
|
// success: function (result) {
|
||
|
// result.data.forEach(function (obj, index, arr) {
|
||
|
// if (obj.TYPE == "org") {
|
||
|
// orgStr += "<option value='" + obj.ID + "'>" + obj.NAME + "</option>";
|
||
|
// } else if (obj.TYPE == "dept") {
|
||
|
// var dept_obj = new Object();
|
||
|
// dept_obj.ID = obj.ID;
|
||
|
// dept_obj.PID = obj.PID;
|
||
|
// dept_obj.NAME = obj.NAME;
|
||
|
// deptArray.push(dept_obj);
|
||
|
// }
|
||
|
// });
|
||
|
// $("#org_id").append(orgStr);
|
||
|
// form.render('select');
|
||
|
// }
|
||
|
// });
|
||
|
|
||
|
// //获取行政区列表
|
||
|
// var areaStr = "";
|
||
|
// $.ajax({
|
||
|
// type: "post",
|
||
|
// url: "../../ashx/FireOrgHandler.ashx",
|
||
|
// data: { Action: "AreaList", PID: AREA_PID },
|
||
|
// dataType: "json",
|
||
|
// success: function (result) {
|
||
|
// result.data.forEach(function (obj, index, arr) {
|
||
|
// areaStr += "<option value='" + obj.AREA_CODE + "'>" + obj.AREA_NAME + "</option>";
|
||
|
// });
|
||
|
// $("#region").append(areaStr);
|
||
|
// form.render('select');
|
||
|
// }
|
||
|
// });
|
||
|
|
||
|
//})
|
||
|
|
||
|
//form.on('select(classType)', function (data) {
|
||
|
// getFromByCid(data.value);
|
||
|
// form.render('select');
|
||
|
//});
|
||
|
|
||
|
|
||
|
//form.on('select(org_id)', function (data) {
|
||
|
// $("#dept_id").empty();
|
||
|
// $("#dept_id").append("<option value=''>---请选择---</option>");
|
||
|
// form.render('select');
|
||
|
// var orgVal = $("#org_id").val();
|
||
|
// console.log(orgVal);
|
||
|
// var deptStr = "";
|
||
|
// deptArray.forEach(function (obj, index, arr) {
|
||
|
// if (orgVal == obj.PID) {
|
||
|
// deptStr += "<option value='" + obj.ID + "'>" + obj.NAME + "</option>";
|
||
|
// }
|
||
|
// });
|
||
|
// $("#dept_id").append(deptStr);
|
||
|
// form.render('select');
|
||
|
//});
|
||
|
|
||
|
////车辆照片上传
|
||
|
//var uploadR = upload.render({
|
||
|
// elem: '#PHOTO_btn',
|
||
|
// url: '../../ashx/CommonHandler.ashx',
|
||
|
// data: {
|
||
|
// Action: 'UploadImg',
|
||
|
// fileUrl: 'Upload/Fire/Car/VehicleOfficial'
|
||
|
// },
|
||
|
// before: function (obj) {
|
||
|
// //预读本地文件示例,不支持ie8
|
||
|
// obj.preview(function (index, file, result) {
|
||
|
// $('#PHOTO').attr('src', result); //图片链接(base64)
|
||
|
// });
|
||
|
// },
|
||
|
// done: function (res) {
|
||
|
// //如果上传失败
|
||
|
// if (res.code > 0) {
|
||
|
// return layer.msg('上传失败');
|
||
|
// }
|
||
|
// $("#PHOTO_PATH").val(res.data.src);
|
||
|
// //上传成功
|
||
|
// },
|
||
|
// error: function () {
|
||
|
// //演示失败状态,并实现重传
|
||
|
// var demoText = $('#PHOTO_Text');
|
||
|
// demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
|
||
|
// demoText.find('.demo-reload').on('click', function () {
|
||
|
// uploadInst.upload();
|
||
|
// });
|
||
|
// }
|
||
|
//});
|
||
|
|
||
|
|
||
|
|
||
|
//form.on("submit(AddEdit)", function (data) {
|
||
|
// //load提交
|
||
|
// var classType = $("#classType").val(); //车辆类型
|
||
|
// if (classType == "0") {
|
||
|
// data = {
|
||
|
// Action: $(".Action").val(),
|
||
|
// id: $(".ID").val(), //车辆ID
|
||
|
// class: classType, //车辆类型
|
||
|
// car_name: $("#car_name").val(), //车辆名称
|
||
|
// car_no: $("#car_no").val(), //车辆编号
|
||
|
// org_id: $("#org_id").val(), //消防机构
|
||
|
// dept_id: $("#dept_id").val(), //部门
|
||
|
// car_num: $("#car_num").val(), //车辆号牌
|
||
|
// trademark: $("#trademark").val(), //商标
|
||
|
// liableman: $("#liableman").val(), //责任人名称
|
||
|
// region: $("#region").val(), //所属辖区
|
||
|
// PHOTO: $("#PHOTO_PATH").val(), //照片
|
||
|
// car_code: $("#car_code").val(), //车辆登记代号
|
||
|
// frame_num: $("#frame_num").val(), //车架号
|
||
|
// engine_no: $("#engine_no").val(), //发动机号
|
||
|
// gbcode: $("#gbcode").val(), //国标代码
|
||
|
// isrun: $("#isrun").val(), //是否运行
|
||
|
// isstart: $("#isstart").val(), //是否启动
|
||
|
// isapply: $("#isapply").val(), //申请状态
|
||
|
// factory: $("#FACTORY").val(), //车联网厂家
|
||
|
// IMEI: $("#IMEI").val(), //终端IMEI
|
||
|
// remarks: $("#REMARKS").val(),//备注
|
||
|
// telnum: $("#telnum").val(), //责任人电话
|
||
|
// waternum: $("#waternum").val(), //载水量
|
||
|
// random: new Date().getTime() //随机参数
|
||
|
// }
|
||
|
// } else if (classType == "1") {
|
||
|
// data = {
|
||
|
// Action: $(".Action").val(),
|
||
|
// id: $(".ID").val(), //车辆ID
|
||
|
// car_name: $("#car_name").val(), //车辆名称
|
||
|
// car_no: $("#car_no").val(), //车辆编号
|
||
|
// org_id: $("#org_id").val(), //上级消防机关
|
||
|
// dept_id: $("#dept_id").val(), //本级消防机关
|
||
|
// car_num: $("#car_num").val(), //车辆号牌
|
||
|
// car_code: $("#car_code").val(), //车辆登记代号
|
||
|
// frame_num: $("#frame_num").val(), //车架号
|
||
|
// engine_no: $("#engine_no").val(), //发动机号
|
||
|
// trademark: $("#trademark").val(), //商标
|
||
|
// gbcode: $("#gbcode").val(), //国标代码
|
||
|
// factory: $("#factory").val(), //出厂厂家
|
||
|
// liableman: $("#liableman").val(), //责任人名称
|
||
|
// region: $("#region").val(), //所属辖区
|
||
|
// isrun: $("#isrun").val(), //是否运行
|
||
|
// isstart: $("#isstart").val(), //是否启动
|
||
|
// class: classType, //大类型
|
||
|
// waternum: $("#waternum").val(), //载水量
|
||
|
// drypowder: $("#drypowder").val(), //载干粉量
|
||
|
// heightboardingcar: $("#heightboardingcar").val(), //登高车工作高度
|
||
|
// frothamount: $("#frothamount").val(), //泡沫量
|
||
|
// frothamounta: $("#frothamounta").val(), //A类泡沫量
|
||
|
// frothamountb: $("#frothamountb").val(), //B类泡沫量
|
||
|
// frothamountmulti: $("#frothamountmulti").val(), //多功能泡沫量
|
||
|
// liquidlevel: $("#liquidlevel").val(), //液位
|
||
|
// pressure: $("#pressure").val(), //压力
|
||
|
// PHOTO: $("#PHOTO_PATH").val(), //照片
|
||
|
// factory: $("#FACTORY").val(), //车联网厂家
|
||
|
// IMEI: $("#IMEI").val(), //终端IMEI
|
||
|
// remarks: $("#REMARKS").val(),//备注
|
||
|
// telnum: $("#telnum").val(), //责任人电话
|
||
|
// random: new Date().getTime() //随机参数
|
||
|
// }
|
||
|
// } else if (classType == "2") {
|
||
|
// data = {
|
||
|
// Action: $(".Action").val(),
|
||
|
// id: $(".ID").val(), //车辆ID
|
||
|
// class: classType, //车辆类型
|
||
|
// car_name: $("#car_name").val(), //车辆名称
|
||
|
// car_no: $("#car_no").val(), //车辆编号
|
||
|
// org_id: $("#org_id").val(), //消防机构
|
||
|
// dept_id: $("#dept_id").val(), //部门
|
||
|
// car_num: $("#car_num").val(), //车辆号牌
|
||
|
// trademark: $("#trademark").val(), //商标
|
||
|
// liableman: $("#liableman").val(), //责任人名称
|
||
|
// telnum: $("#telnum").val(), //责任人电话
|
||
|
// region: $("#region").val(), //所属辖区
|
||
|
// factory: $("#FACTORY").val(), //车联网厂家
|
||
|
// IMEI: $("#IMEI").val(), //终端IMEI
|
||
|
// PHOTO: $("#PHOTO_PATH").val(), //照片
|
||
|
// remarks: $("#REMARKS").val(),//备注
|
||
|
// }
|
||
|
// }
|
||
|
// var index = layer.msg('数据提交中,请稍候', { icon: 16, time: false, shade: 0.8 });
|
||
|
// $.post("../../ashx/CarHandler.ashx", data, function (res) {
|
||
|
// console.log(res);
|
||
|
// layer.close(index);
|
||
|
// res = $.parseJSON(res);
|
||
|
// if (res.code == 1) {
|
||
|
// top.layer.msg(res.msg);
|
||
|
// parent.location.reload();
|
||
|
// } else {
|
||
|
// layer.close(index);
|
||
|
// layer.msg(res.msg);
|
||
|
// }
|
||
|
// });
|
||
|
// layer.close(index);
|
||
|
// return false;
|
||
|
//});
|
||
|
|
||
|
})
|