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.
173 lines
6.3 KiB
173 lines
6.3 KiB
<#include "../../_include/_t.ftl"/>
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title></title>
|
|
<#include "../../_include/_h.ftl"/>
|
|
<#include "../../_include/_l.ftl"/>
|
|
<#include "../../_include/admin/_c.ftl"/>
|
|
</head>
|
|
<body>
|
|
<div class="page_div">
|
|
<blockquote class="layui-elem-quote">
|
|
${title}
|
|
<button id="checks_reloadBtn" class="layui-btn" style="float:right;margin-top:-8px;"><i class="layui-icon"></i>加载所有数据到系统缓存中</button>
|
|
</blockquote>
|
|
<table id="checks_dataTable" lay-filter="checks_dataTable_filter" lay-size="sm"></table>
|
|
<div id="checks_loading" style="font-size:16px;margin:0 auto;">
|
|
<span style="display:block;width:300px;position:relative;left:40%;text-indent:2px;padding:15px;background:url('${ctx}/style/images/gif/_loading.gif') left center no-repeat;">巡检类型数据较多,正在加载,请稍后...</span>
|
|
</div>
|
|
</div>
|
|
<div id="checks_detailWin" class="page_win page_win_hide">
|
|
<form id="checks_detailForm" lay-filter="checks_detailForm_filter" class="layui-form">
|
|
<input type="hidden" name="id"/>
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">所属:</label>
|
|
<div class="layui-input-inline" style="width:400px;">
|
|
<input type="text" id="checks_detailForm_pt" class="layui-input" readonly="readonly" autocomplete="off"/>
|
|
</div>
|
|
</div>
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">巡检类型:</label>
|
|
<div class="layui-input-inline" style="width:400px;">
|
|
<input type="text" name="ckname" placeholder="巡检类型" lay-verify="required" lay-verType="tips" class="layui-input" autocomplete="off"/>
|
|
</div>
|
|
</div>
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">巡检规范:</label>
|
|
<div class="layui-input-inline" style="width:400px;">
|
|
<textarea name="ckdes" placeholder="巡检规范" lay-verify="required" lay-verType="tips" class="layui-textarea" autocomplete="off" style="resize:none;height:160px;"></textarea>
|
|
</div>
|
|
</div>
|
|
<div class="layui-input-block layui-hide">
|
|
<button lay-submit class="layui-btn layui-btn-normal" lay-filter="checks_detailForm_filter"><i class="icon_submit"></i>提交数据</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
layuiplus.on(function(){
|
|
layuiplus.init(0);
|
|
//定义窗口变量========================
|
|
var checks_detailWin = null;
|
|
//数据表格=========================================================================================================
|
|
var checks_dataTable = table.render({
|
|
elem:"#checks_dataTable",
|
|
url:"${ctx}/admin/data/checks/list",
|
|
method:"get",
|
|
cols:[[
|
|
{field:"ckname",title:"巡检类型",unresize:true,width:500,templet:function(d){
|
|
if(d.cklevel == "1"){
|
|
return "<span style=\"font-weight:bold;font-size:16px;margin-left:30px;\">"+d.ckname+"</span>";
|
|
}
|
|
if(d.cklevel == "2"){
|
|
return "<span style=\"font-weight:normal;font-size:16px;margin-left:96px;\">"+d.ckname+"</span>";
|
|
}
|
|
if(d.cklevel == "3"){
|
|
return "<span style=\"font-weight:normal;margin-left:166px;\">"+d.ckname+"</span>";
|
|
}
|
|
return "";
|
|
}},
|
|
{field:"ckdes",title:"巡检规范",unresize:true,width:400,templet:"<div><span title=\"{{d.ckdes==undefined?'':d.ckdes}}\">{{d.ckdes==undefined?'':d.ckdes}}</span></div>"},
|
|
//{field:"cksort",title:"排序",unresize:true,width:100},
|
|
{title:"操作 ",unresize:true,align:"left",templet:function(d){
|
|
var opt = "<a class=\"layui-btn layui-btn-normal layui-btn-xs\" lay-event=\"opt_detail\">查看详情</a> ";
|
|
return opt;
|
|
}}
|
|
]],
|
|
done:function(){
|
|
$("#checks_loading").hide();
|
|
var trs = $("#checks_dataTable").next("div").children("div").children("div:last").children("table").children("tbody").children("tr");
|
|
$.each(trs,function(){
|
|
var t = parseInt($(this).find("td[data-field=ckname]").find("div > span").css("margin-left"));
|
|
if(t == 30){
|
|
$(this).css("background","#d2d2d2");
|
|
}
|
|
if(t == 96){
|
|
$(this).css("background","#e2e2e2");
|
|
}
|
|
if(t == 166){
|
|
$(this).css("background","#F0F0F0");
|
|
}
|
|
});
|
|
}
|
|
});
|
|
//数据表格每行数据操作监听=============================================================================================
|
|
table.on("tool(checks_dataTable_filter)",function(row){//row.data row.event
|
|
if(row.event == "opt_detail"){
|
|
checks_detailWin = layer.open({
|
|
id:"checks_detailWin_id",
|
|
type:1,
|
|
title:"<i class=\"icon_update\"></i>巡检类型详情",
|
|
area:["600px","auto"],
|
|
shade:0.3,
|
|
resize:false,
|
|
content:$("#checks_detailWin"),
|
|
btn:["<i class=\"icon_submit\"></i>保存数据"],
|
|
yes:function(index,layero){
|
|
$("#checks_detailForm").find("button[lay-filter=checks_detailForm_filter]").click();
|
|
},
|
|
success:function(){
|
|
$.ajax({
|
|
type:"post",
|
|
url:"${ctx}/admin/data/checks/get",
|
|
data:{id:row.data.id,cklevel:row.data.cklevel},
|
|
dataType:"json",
|
|
success:function(data){
|
|
if(row.data.cklevel == "1"){
|
|
$("#checks_detailForm_pt").val("/");
|
|
}
|
|
if(row.data.cklevel == "2"){
|
|
$("#checks_detailForm_pt").val(data.c2.ckname);
|
|
}
|
|
if(row.data.cklevel == "3"){
|
|
$("#checks_detailForm_pt").val(data.c1.ckname+" - "+data.c2.ckname);
|
|
}
|
|
form.val("checks_detailForm_filter",{
|
|
id:data.e.id,
|
|
ckname:data.e.ckname,
|
|
ckdes:data.e.ckdes
|
|
});
|
|
}
|
|
});
|
|
},
|
|
end:function(){
|
|
$("#checks_detailForm")[0].reset();
|
|
}
|
|
});
|
|
}
|
|
});
|
|
//保存按钮=================================================================
|
|
form.on("submit(checks_detailForm_filter)",function(formData){
|
|
$.ajax({
|
|
type:"post",
|
|
url:"${ctx}/admin/data/checks/update",
|
|
data:formData.field,
|
|
dataType:"json",
|
|
success:function(data){
|
|
if(data.status == true){
|
|
checks_dataTable.reload();
|
|
layer.close(checks_detailWin);
|
|
layer.msg("操作成功",{time:2000});
|
|
}
|
|
}
|
|
});
|
|
return false;
|
|
});
|
|
//加载缓存按钮===============================================================
|
|
$("#checks_reloadBtn").click(function(){
|
|
$.ajax({
|
|
type:"get",
|
|
url:"${ctx}/admin/data/checks/reload",
|
|
dataType:"json",
|
|
success:function(data){
|
|
if(data.status == true){
|
|
layer.msg("操作成功",{time:2000});
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|