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.
217 lines
7.9 KiB
217 lines
7.9 KiB
11 months ago
|
layui.config({
|
||
|
base: '../../js/'
|
||
|
}).use(['ztree', 'form', 'layer', 'table', 'util', 'laytpl'], function () {
|
||
|
var form = layui.form,
|
||
|
layer = parent.layer === undefined ? layui.layer : top.layer,
|
||
|
$ = layui.jquery,
|
||
|
laytpl = layui.laytpl,
|
||
|
table = layui.table;
|
||
|
var OrgId = JSON.parse(window.sessionStorage.getItem("userInfo")).OrgID;
|
||
|
//var OrgId = "fc21743dcaad4225b8be141dd47d8a2f";
|
||
|
|
||
|
|
||
|
|
||
|
var tableIns = table.render({
|
||
|
elem: '#firePlanList',
|
||
|
event: true,
|
||
|
url: '../../ashx/ZYTFirePlanHandler.ashx',
|
||
|
where: { Action: 'List', OrgId: OrgId , random: new Date().getTime() },
|
||
|
cellMinWidth: 95,
|
||
|
page: true,
|
||
|
height: "full-125",
|
||
|
limits: [10, 15, 20, 25],
|
||
|
limit: 15,
|
||
|
id: "firePlanListTable",
|
||
|
cols: [[
|
||
|
{ type: "checkbox", fixed: "left", width: 50 },
|
||
|
{ field: 'PLAN_TITLE', title: '预案名称', minWidth: 60, align: "center" },
|
||
|
{
|
||
|
field: 'AUTHORITY_TYPE', title: '查看权限', minWidth: 60, align: "center", templet: function (d) {
|
||
|
var returnStr = "";
|
||
|
if (d.AUTHORITY_TYPE == '0') {
|
||
|
returnStr = "全区";
|
||
|
} else if (d.AUTHORITY_TYPE == '1') {
|
||
|
returnStr = "全支队";
|
||
|
} else if (d.AUTHORITY_TYPE == '2') {
|
||
|
returnStr = "本单位";
|
||
|
}
|
||
|
return returnStr;
|
||
|
}
|
||
|
},
|
||
|
//{ field: 'PLANTYPE', title: '类型', minWidth: 60, align: "center", templet: function (d) {
|
||
|
// var returnStr = "";
|
||
|
// if (d.PLANTYPE == '0') {
|
||
|
// returnStr = "视频";
|
||
|
// } else if (d.PLANTYPE == '1') {
|
||
|
// returnStr = "音频";
|
||
|
// } else if (d.PLANTYPE == '2') {
|
||
|
// returnStr = "其它";
|
||
|
// }
|
||
|
// return returnStr;
|
||
|
//} },
|
||
|
{ field: 'ORG_NAME', title: '发布单位', minWidth: 60, align: "center" },
|
||
|
{
|
||
|
field: 'CREATION_TIME', title: '发布时间', minWidth: 60, align: "center", templet: function (d) {
|
||
|
if (d.CREATION_TIME) {
|
||
|
return layui.util.toDateString(d.CREATION_TIME, 'yyyy-MM-dd HH:mm:ss');
|
||
|
} else { return "" }
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
title: '操作', width: 180, fixed: "right", align: "center", templet: function (d) {
|
||
|
if (d.ORG_ID == OrgId) {
|
||
|
return $('#firePlanListBar').html();
|
||
|
} else {
|
||
|
return $('#firePlanListBar2').html();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
]]
|
||
|
});
|
||
|
|
||
|
//"ID": "625891956356652",
|
||
|
// "PLANTITLE": "火灾预案",
|
||
|
// "PLANTYPE": "2",
|
||
|
// "PLANURL": "",
|
||
|
// "AUTHORITYTYPE": "0",
|
||
|
// "AUTHORITYORGID": "734389c7ae364584aea9918693bba3de",
|
||
|
// "ORGID": "734389c7ae364584aea9918693bba3de",
|
||
|
// "ORGNAME": "西藏总队机关",
|
||
|
// "ADDUSERSUID": "xzxfzdjg",
|
||
|
// "ADDTIME": "2022-11-09 12:12:12",
|
||
|
|
||
|
|
||
|
//查询
|
||
|
$(".search_btn").click(function () {
|
||
|
|
||
|
table.reload("firePlanListTable", {
|
||
|
page: {
|
||
|
curr: 1 //重新从第 1 页开始
|
||
|
},
|
||
|
where: {
|
||
|
Action: 'List',
|
||
|
OrgId: OrgId,
|
||
|
keywords: $(".searchVal").val(), //姓名或身份证号
|
||
|
random: new Date().getTime() //随机参数
|
||
|
}
|
||
|
});
|
||
|
|
||
|
})
|
||
|
function reload() {
|
||
|
table.reload("firePlanListTable", {
|
||
|
page: {
|
||
|
curr: 1 //重新从第 1 页开始
|
||
|
},
|
||
|
where: {
|
||
|
Action: 'List',
|
||
|
OrgId: OrgId,
|
||
|
keywords: $(".searchVal").val(), //搜索的关键字
|
||
|
random: new Date().getTime() //随机参数
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
function checkFile(data) {
|
||
|
debugger
|
||
|
var url = data.PLAN_URL;
|
||
|
let baseUrl = encodeURIComponent(btoa(url));
|
||
|
layer.open({
|
||
|
id: "office_win_id",
|
||
|
area: ["60%", "80%"],
|
||
|
type: 2,
|
||
|
title: "<i class=\"icon_detail\"></i>预览",
|
||
|
shade: 0.3,
|
||
|
resize: false,
|
||
|
//skin: 'layerWin', //注意这里,靠这个css自定义样式!!!!!
|
||
|
zIndex: 1,//不设置会导致kindeditor的弹框被遮盖
|
||
|
content: "http://8.142.26.221:8012/onlinePreview?url=" + baseUrl,
|
||
|
//content:"http://192.168.31.95:8012/onlinePreview?url="+baseUrl,
|
||
|
maxmin: true,
|
||
|
success: function () {
|
||
|
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
|
||
|
|
||
|
//添加
|
||
|
function AddEdit(edit) {
|
||
|
var clientWidth = parseInt(document.body.clientWidth * 0.5) + 'px';
|
||
|
var clientHeight = parseInt(document.body.clientHeight * 0.65) + 'px';
|
||
|
var content = "YuAnAdd.html";
|
||
|
var title = "添加预案";
|
||
|
if (edit) { title = "编辑预案"; }
|
||
|
var index = layui.layer.open({
|
||
|
title: title,
|
||
|
type: 2,
|
||
|
area: [clientWidth, clientHeight],
|
||
|
maxmin: true,
|
||
|
content: content,
|
||
|
success: function (layero, index) {
|
||
|
var body = layui.layer.getChildFrame('body', index);
|
||
|
body.find(".Action").val("Save");
|
||
|
if (edit) {
|
||
|
body.find(".ID").val(edit.ID);
|
||
|
|
||
|
body.find("#PLAN_TITLE").val(edit.PLAN_TITLE);
|
||
|
body.find("#AUTHORITY_TYPE").val(edit.AUTHORITY_TYPE);
|
||
|
body.find("#PLAN_URL").val(edit.PLAN_URL);
|
||
|
body.find("#checkFile").show();
|
||
|
setTimeout(function () {
|
||
|
if (edit.AUTHORITY_TYPE != null && edit.AUTHORITY_TYPE != "") {
|
||
|
body.find("#AUTHORITY_TYPE").siblings("div.layui-form-select").find('dl').find("dd[lay-value='" + edit.AUTHORITY_TYPE + "']").click();
|
||
|
}
|
||
|
}, 1000);
|
||
|
form.render();
|
||
|
} else {
|
||
|
form.render();
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
|
||
|
$(".add_btn").click(function () {
|
||
|
AddEdit();
|
||
|
});
|
||
|
//批量删除
|
||
|
$(".delAll_btn").click(function () {
|
||
|
var checkStatus = table.checkStatus('firePlanListTable'),
|
||
|
data = checkStatus.data,
|
||
|
PlanList = [];
|
||
|
if (data.length > 0) {
|
||
|
for (var i in data) {
|
||
|
PlanList.push(data[i].ID);
|
||
|
}
|
||
|
layui.layer.confirm('确定删除选中的预案?', { icon: 3, title: '提示信息' }, function (index) {
|
||
|
//提交信息
|
||
|
$.post("../../ashx/ZYTFirePlanHandler.ashx", {
|
||
|
Action: "Delete",
|
||
|
PlanList: PlanList.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);
|
||
|
}
|
||
|
layui.layer.close(index);
|
||
|
});
|
||
|
});
|
||
|
} else {
|
||
|
layer.msg("请选择需要删除的预案");
|
||
|
}
|
||
|
});
|
||
|
//列表操作
|
||
|
table.on('tool(firePlanList)', function (obj) {
|
||
|
var layEvent = obj.event;
|
||
|
data = obj.data;
|
||
|
if (layEvent == 'edit') {//修改
|
||
|
AddEdit(data);
|
||
|
} else if (layEvent == 'audit') {//查看
|
||
|
checkFile(data);
|
||
|
}
|
||
|
})
|
||
|
|
||
|
})
|