<!DOCTYPE html>
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
<head>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<title>不良后果</title>
|
<meta name="renderer" content="webkit">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
<link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
|
<link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
|
<script src="../../../layuiadmin/layui/layui.js"></script>
|
<script src="../../../layuiadmin/HideButton_New.js"></script>
|
<script src="../../../layuiadmin/SetColumn.js"></script>
|
<script src="../../../layuiadmin/Scripts/json2.js"></script>
|
<script src="../../../layuiadmin/Scripts/jquery-1.4.1.js"></script>
|
<script src="../../../layuiadmin/Scripts/webConfig.js"></script>
|
<script src="../../../layuiadmin/PubCustom.js"></script>
|
|
</head>
|
<body>
|
<div class="layui-fluid">
|
<div class="layui-col-md12">
|
<div class="layui-card" style="padding: 1px">
|
<div class="layui-card-body" style="padding: 1px;">
|
|
<form class="layui-form" action="" lay-filter="component-form-group">
|
|
<div class="layui-collapse">
|
<div class="layui-colla-item">
|
<div class="layui-colla-title layui-inline">
|
<div class="layui-inline">
|
<span>更多</span>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;">不良后果代码</label>
|
<div class="layui-input-block" style="margin-left: 120px;">
|
<input type="text" class="layui-input ForFilteringSchemes" name="HNumber" id="HNumber">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;">不良后果名称</label>
|
<div class="layui-input-block" style="margin-left: 120px;">
|
<input type="text" class="layui-input ForFilteringSchemes" name="HName" id="HName">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;">组织</label>
|
<div class="layui-input-block" style="margin-left: 120px; width: 185px;">
|
<select name="HOrgID" id="HOrgID" lay-verify="HOrgID" class="ForFilteringSchemes">
|
<!--动态渲染组织-->
|
</select>
|
</div>
|
</div>
|
<button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnSearch" id="btnSearch">
|
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
|
</button>
|
<button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnReSearch" id="btnReSearch" style="padding:0 5px">重置</button>
|
<!--显示当前过滤方案-->
|
<div class="layui-inline" style="margin-left:5px;">
|
<div style="text-align:center;font-size:15px;font-weight:bold;color:#fc9393" id="HFilterScheme_Now"></div>
|
</div>
|
<div class="layui-colla-content" style="padding: 0px; margin-left: 6%;">
|
<div class="layui-row" style="margin-top:5px">
|
<div class="layui-inline">
|
<label class="layui-form-label">过滤</label>
|
<div class="layui-input-block">
|
<select name="ColName" id="ColName" lay-filter="ColName" style="width:190px;" class="ForFilteringSchemes">
|
</select>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<select name="Comparator" id="Comparator" lay-filter="Comparator" style="width:190px;" class="ForFilteringSchemes">
|
<option value="0" selected="selected"></option>
|
<option value="=">=</option>
|
<option value=">=">>=</option>
|
<option value=">">></option>
|
<option value="<="><=</option>
|
<option value="<"><</option>
|
<option value="<>"><></option>
|
<option value="7">包含</option>
|
<option value="8">左包含</option>
|
<option value="9">右包含</option>
|
<option value="10">不包含</option>
|
</select>
|
</div>
|
<div class="layui-inline">
|
<input type="text" class="layui-input ForFilteringSchemes" value="" name="ColContent" id="ColContent">
|
</div>
|
</div>
|
<div class="layui-row" style="margin-top:5px">
|
<div class="layui-inline">
|
<label class="layui-form-label">过滤</label>
|
<div class="layui-input-block">
|
<select name="ColName1" id="ColName1" lay-filter="ColName1" style="width:190px;" class="ForFilteringSchemes">
|
</select>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<select name="Comparator1" id="Comparator1" lay-filter="Comparator1" style="width:190px;" class="ForFilteringSchemes">
|
<option value="0" selected="selected"></option>
|
<option value="=">=</option>
|
<option value=">=">>=</option>
|
<option value=">">></option>
|
<option value="<="><=</option>
|
<option value="<"><</option>
|
<option value="<>"><></option>
|
<option value="7">包含</option>
|
<option value="8">左包含</option>
|
<option value="9">右包含</option>
|
<option value="10">不包含</option>
|
</select>
|
</div>
|
<div class="layui-inline">
|
<input type="text" class="layui-input ForFilteringSchemes" value="" name="ColContent1" id="ColContent1">
|
</div>
|
</div>
|
<div class="layui-row" style="margin-top:5px">
|
<div class="layui-inline">
|
<label class="layui-form-label">过滤</label>
|
<div class="layui-input-block">
|
<select name="ColName2" id="ColName2" lay-filter="ColName2" style="width:190px;" class="ForFilteringSchemes">
|
</select>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<select name="Comparator2" id="Comparator2" lay-filter="Comparator2" style="width:190px;" class="ForFilteringSchemes">
|
<option value="0" selected="selected"></option>
|
<option value="=">=</option>
|
<option value=">=">>=</option>
|
<option value=">">></option>
|
<option value="<="><=</option>
|
<option value="<"><</option>
|
<option value="<>"><></option>
|
<option value="7">包含</option>
|
<option value="8">左包含</option>
|
<option value="9">右包含</option>
|
<option value="10">不包含</option>
|
</select>
|
</div>
|
<div class="layui-inline">
|
<input type="text" class="layui-input ForFilteringSchemes" value="" name="ColContent2" id="ColContent2">
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
<table class="" id="mainTable" lay-filter="mainTable"></table>
|
<script type="text/html" id="toolbarDemo">
|
<div class="layui-btn-container" id="toolbarDemo_ButtonSet">
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="set_SouceExcel" id="set_SouceExcel"><i class="layui-icon layui-icon-delete"></i>导入</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="get_export" id="get_export"><i class="layui-icon layui-icon-export"></i>导出</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="set_Copy" id="set_Copy"><i class="layui-icon layui-icon-form"></i>复制</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Add" id="AddButton"><i class="layui-icon layui-icon-file-b"></i>新增</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Edit" id="EditButton"><i class="layui-icon layui-icon-form"></i>编辑</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Delete" id="DeleteButton"><i class="layui-icon layui-icon-delete"></i>删除</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Audit" id="AuditButton"><i class="layui-icon layui-icon-radio"></i>审核</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-DeAudit" id="DeAuditButton"><i class="layui-icon layui-icon-circle"></i>反审核</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Stop" id="StopButton"> <i class="layui-icon layui-icon-radio"></i>禁用</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-DeStop" id="DeStopButton"><i class="layui-icon layui-icon-radio"></i>反禁用</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="set_HideColumn" id="HideButton"><i class="layui-icon layui-icon-form"></i>列设置</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="set_HideButton" id="HideButton"><i class="layui-icon layui-icon-form"></i>按钮设置</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="set_SaveScheme" id="set_SaveScheme"><i class="layui-icon layui-icon-template"></i>保存方案</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="set_ReadScheme" id="set_ReadScheme"><i class="layui-icon layui-icon-set"></i>读取方案</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="get_Refresh" id="RefreshButton"><i class="layui-icon layui-icon-refresh-3"></i>刷新</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="get_Exit" id="ExitButton"><i class="layui-icon layui-icon-logout"></i>退出</button>
|
</div>
|
</script>
|
|
</form>
|
</div>
|
</div>
|
</div>
|
</div>
|
|
<script>
|
layui.config({
|
base: '../../../layuiadmin/' //静态资源所在路径
|
}).extend({
|
index: 'lib/index', //主入口模块
|
}).use(['index', 'form', 'table', 'element', 'laypage', 'laydate'], function () {
|
//#region 公共变量
|
var $ = layui.$
|
, admin = layui.admin
|
, layer = layui.layer
|
, table = layui.table
|
, form = layui.form
|
, element = layui.element
|
, laypage = layui.laypage
|
, laydate = layui.laydate
|
//查询条件
|
var sWhere = "";
|
var option = [];
|
var HModName = "Gy_BadResult";
|
var HBillType = "Gy_BadResult";
|
var set_HideButton_ID = "toolbarDemo_ButtonSet";//需要设置的按钮的父级节点的id
|
//不需要显示的字段 可扩展
|
var titleData = ["HItemID", "短代码 ", "父级ID", "等级", "末级标志", "助记码", "创建组织", "是否系统预设","HUSEORGID", "HCREATEORGID"];
|
|
|
//#endregion
|
//#region 【过滤方案】
|
|
//过滤条件的class类
|
var HClassTag = "ForFilteringSchemes";
|
//模块名称(中文版) 每个模块页面都需要修改
|
window.HModuleName = "不良后果列表维护";
|
//是否已经选择了过滤方案(全局变量)
|
window.HDefaultFilter = "";
|
//选择的过滤方案内码(全局变量)
|
window.HInterID_Choose = 0;
|
|
//#endregion
|
|
//#region 进入页面既加载
|
//初始化界面
|
set_ClearBill();
|
//#endregion
|
|
//#region 触发事件:包括form.on(){}格式的所有点击事件、选择事件等
|
//头工具栏事件
|
table.on('toolbar(mainTable)', function (obj) {
|
var checkStatus = table.checkStatus(obj.config.id);
|
switch (obj.event) {
|
//导入
|
case 'set_SouceExcel': set_SouceExcel();
|
break;
|
//导出excel
|
case 'get_export': get_Export();
|
break;
|
//复制
|
case 'set_Copy': set_Copy();
|
break;
|
//新增
|
case 'btn-Add': set_AddNew();
|
break;
|
//编辑
|
case 'btn-Edit': set_ShowBill();
|
break;
|
//删除
|
case 'btn-Delete': set_DeleteBill();
|
break;
|
//审核按钮
|
case 'btn-Audit':
|
set_CheckBill(0);
|
break;
|
//反审核按钮
|
case 'btn-DeAudit':
|
set_CheckBill(1);
|
break;
|
//禁用按钮
|
case 'btn-Stop':
|
set_De_Stop(0);
|
break;
|
//反禁用按钮
|
case 'btn-DeStop':
|
set_De_Stop(1);
|
break;
|
//刷新
|
case 'get_Refresh': get_Refresh();
|
break;
|
//退出按钮
|
case 'get_Exit': Pub_Close(2);
|
break;
|
//保存方案
|
case 'set_SaveScheme': set_SaveScheme();
|
break;
|
//读取方案
|
case 'set_ReadScheme': set_ReadScheme();
|
break;
|
//列设置
|
case 'set_HideColumn': get_HideColumnNoPage(HModName, sessionStorage["HUserName"], option, get_FastQuery);
|
break;
|
//按钮设置
|
case 'set_HideButton':
|
get_HideButton(set_HideButton_ID, HBillType, HModName, sessionStorage["HUserName"]);
|
break;
|
};
|
});
|
|
table.on('tool(mainTable)', function (obj) {
|
var data = obj.data;
|
if (obj.event == '不良后果代码') {
|
var hID = data.HItemID.toString();
|
//if (AllowLoadData(sSubStr) != false) {//非空验证
|
layer.open({
|
type: 2
|
, area: ['100%', '100%']
|
, title: '编辑不良后果'
|
, shade: 0.6 //遮罩透明度
|
, maxmin: true //允许全屏最小化
|
, anim: 0 //0-6的动画形式,-1不开启
|
, content: '../生产基础资料/Add_Edit_Gy_BadResult.html?OperationType=3&linterid=' + hID + '&HSouceBillType='
|
, resize: false,
|
end: function () {
|
//刷新页面,
|
location.reload();
|
}
|
, cancel: function () {
|
//$(".layui-btn").removeClass("layui-btn-disabled");
|
}
|
})
|
}
|
});
|
|
//查询按钮
|
form.on('submit(btnSearch)', function (data) {
|
get_FastQuery();
|
});
|
// 重置按钮
|
form.on('submit(btnReSearch)', function (data) {
|
set_ClearQuery();
|
});
|
//代码回车方法
|
$('#HNumber').on('keydown', function (event) {
|
if (event.keyCode == 13) {
|
get_FastQuery();
|
}
|
});
|
|
//名称回车方法
|
$('#HName').on('keydown', function (event) {
|
if (event.keyCode == 13) {
|
get_FastQuery();
|
}
|
});
|
|
|
//#region 双击返回数据
|
table.on('rowDouble(mainTable)', function (obj) {
|
var data = [];
|
data.push(obj.data);
|
parent.GetBadResultValue(data);
|
var index = parent.layer.getFrameIndex(window.name);
|
parent.layer.close(index);
|
});
|
//#endregion
|
|
//#endregion
|
|
//#region 点击行选中高亮
|
table.on('row(mainTable)', function (obj) {
|
//选中行改变颜色
|
var flag = !obj.tr.find(':checkbox:first').prop('checked');
|
obj.tr.find(':checkbox').prop('checked', flag);
|
if (flag) {
|
obj.tr.find('.layui-form-checkbox').addClass('layui-form-checked'); //设置复选框选中样式
|
$(obj.tr.selector).attr({ "style": "background:#ceedfa;color:black" });//改变当前tr背景颜色和字体颜色
|
} else {
|
obj.tr.find('.layui-form-checkbox').removeClass('layui-form-checked');//取消复选框选中样式
|
$(obj.tr.selector).attr({ "style": "background:" });//取消当前tr颜色
|
}
|
//mainTable 为表格ID 注意此处如果ID不正确将导致你在监听复选框时获取不到你选择的数据,前面的只是添加或删除选中未选中样式以及设置背景色,字体颜色
|
layui.each(table.cache.mainTable, function (i, l) {
|
if (obj.tr.index() == l.LAY_TABLE_INDEX) {
|
l.LAY_CHECKED = flag;
|
}
|
});
|
})
|
//#endregion
|
|
//#region 此页面所有方法
|
// 初始化界面
|
function set_ClearBill() {
|
//初始化组织
|
Organ();
|
//初始化表格
|
set_InitGrid();
|
//查询
|
get_Display(sWhere);
|
|
get_DefaultModule();
|
}
|
//初始化表格
|
function set_InitGrid() {
|
option = {
|
elem: '#mainTable'
|
, toolbar: '#toolbarDemo'
|
, height: 'full-50'
|
, page: true
|
, limits: [50, 500, 5000, 50000]
|
, limit: 50
|
, cellMinWidth: 90
|
//, cols: [[
|
// { type: 'checkbox', fixed: 'left' }
|
// , { field: 'HItemID', title: 'HItemID', sort: true, hide: true }
|
// , { field: '不良原因代码', title: '不良原因代码' }
|
// , { field: '不良原因名称', title: '不良原因名称' }
|
// , { field: '条码编号', title: '条码编号' }
|
// , { field: '禁用标记', title: '禁用标记' }
|
// , { field: '备注', title: '备注' }
|
//]]
|
//将禁用的数据标红
|
//, done: function (res, cuur, count) {
|
// for (var i = 0; i < res.data.length; i++)
|
// {
|
// if (res.data[i].禁用标记=='Y') {
|
// $("table tbody tr").eq(i).css('color','red')
|
// }
|
// }
|
//}
|
};
|
}
|
//查询
|
function get_Display(sWhere) {
|
var index = layer.load(0, { shade: false });
|
var ajaxLoad = layer.load();
|
//进入页面显示的缓存列表
|
$.ajax({
|
url: GetWEBURL() + '/Gy_BadReason/Gy_BadResultList',
|
type: "GET",
|
async: false,
|
data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
|
success: function (data1) {
|
if (data1.count == 1) {
|
var data = [];
|
var col = [];
|
//给空的数组赋值
|
for (var key in data1.list) {
|
data.push({ "id": data1.list[key].ColmCols, "name": data1.list[key].ColmCols, "Type": data1.list[key].ColmType });
|
}
|
//在列表左边添加勾选框
|
col.push({ type: 'checkbox', fixed: 'left' });
|
for (var i = 0; i < data.length; i++) {
|
if ($.inArray(data[i].name, titleData) > -1) {
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', hide: true }); //隐藏id列
|
}
|
else if (data[i].name == '不良后果代码') {//添加超链接
|
col.push({
|
field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 200, event: '不良后果代码', templet: function (d) {
|
return '<span style="color: blue;">' + d.不良后果代码 + '</span>'
|
}, style: 'cursor: pointer;'
|
});
|
}
|
else {
|
switch (data[i].Type) {
|
//int
|
case 'DateTime':
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: false, templet: "<div>{{d." + data[i].name + " ==null ?'':layui.util.toDateString(d." + data[i].name + ", 'yyyy-MM-dd')}}</div>", width: 200 });
|
break;
|
case 'long':
|
case 'Int32':
|
case 'Int64':
|
case 'double':
|
case 'Decimal':
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: false, width: 120, totalRow: true });
|
break;
|
default:
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: false, width: 200 });
|
}
|
}
|
}
|
|
//动态显示列名
|
option = {
|
elem: '#mainTable'
|
, toolbar: '#toolbarDemo'
|
, cols: [col]
|
, data: data1.data
|
, height: 'full-80'
|
, page: true
|
, limits: [50, 500, 5000, 50000]
|
, limit: 50
|
, cellMinWidth: 90
|
}
|
//刷新表格数据
|
DisPlay_HideColumn(HModName, sessionStorage["HUserName"], option, titleData)
|
ins = table.render(option);
|
|
//刷新按钮显示
|
Display_HideButton(set_HideButton_ID, HBillType, HModName, sessionStorage["HUserName"]);
|
|
layer.close(ajaxLoad);
|
|
if ($("#Comparator").val() == 0 && $("#ColContent").val() == "") {
|
ColFilter();
|
}
|
|
} else {
|
layer.close(ajaxLoad);
|
layer.alert(data1.code + data1.Message, { icon: 5 });
|
}
|
}, error: function () {
|
layer.close(ajaxLoad);
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
});
|
layer.close(index);
|
}
|
//快速查询
|
function get_FastQuery() {
|
var HNumber = $("#HNumber").val();
|
var HName = $("#HName").val();
|
var HOrgID = $("#HOrgID").val();
|
var ColName = $("#ColName").val();//复选框
|
var Comparator = $("#Comparator").val()
|
var ColContent = $("#ColContent").val();
|
|
var ColName1 = $("#ColName1").val();//复选框
|
var Comparator1 = $("#Comparator1").val()
|
var ColContent1 = $("#ColContent1").val();
|
var ColName2 = $("#ColName2").val();//复选框
|
var Comparator2 = $("#Comparator2").val()
|
var ColContent2 = $("#ColContent2").val();
|
|
if (ColName != 0 && Comparator != 0) {
|
var com = "";
|
switch (Comparator) {
|
case "7":
|
com = "like'%" + ColContent + "%'";
|
break;
|
case "8":
|
com = "like'%" + ColContent + "'";
|
break;
|
case "9":
|
com = "like'" + ColContent + "%'";
|
break;
|
case "10":
|
com = "not like'%" + ColContent + "%'";
|
break;
|
default:
|
com = "" + Comparator + "'" + ColContent + "'";
|
break;
|
}
|
sWhere += " and " + ColName + " " + com;
|
}
|
if (ColName1 != 0 && Comparator1 != 0) {
|
var com1 = "";
|
switch (Comparator1) {
|
case "7":
|
com1 = "like'%" + ColContent1 + "%'";
|
break;
|
case "8":
|
com1 = "like'%" + ColContent1 + "'";
|
break;
|
case "9":
|
com1 = "like'" + ColContent1 + "%'";
|
break;
|
case "10":
|
com1 = "not like'%" + ColContent1 + "%'";
|
break;
|
default:
|
com1 = "" + Comparator1 + "'" + ColContent1 + "'";
|
break;
|
}
|
sWhere += " and " + ColName1 + " " + com1;
|
}
|
if (ColName2 != 0 && Comparator2 != 0) {
|
var com2 = "";
|
switch (Comparator2) {
|
case "7":
|
com2 = "like'%" + ColContent2 + "%'";
|
break;
|
case "8":
|
com2 = "like'%" + ColContent2 + "'";
|
break;
|
case "9":
|
com2 = "like'" + ColContent2 + "%'";
|
break;
|
case "10":
|
com2 = "not like'%" + ColContent2 + "%'";
|
break;
|
default:
|
com2 = "" + Comparator2 + "'" + ColContent2 + "'";
|
break;
|
}
|
sWhere += " and " + ColName2 + " " + com2;
|
}
|
|
if (HOrgID) {
|
sWhere += " and HUSEORGID = '" + HOrgID + "'";
|
}
|
if (HNumber) {
|
sWhere += " and 不良后果代码 like '%" + HNumber + "%'";
|
}
|
if (HName) {
|
sWhere += " and 不良后果名称 like '%" + HName + "%'";
|
}
|
get_Display(sWhere);
|
sWhere = "";//调用接口后清空sWhere缓存
|
}
|
//重置快速查询
|
function set_ClearQuery() {
|
$("#HNumber").val("");
|
$("#HName").val("");
|
$("#HOrgID").val(sessionStorage["OrganizationID"]);
|
$("#ColContent").val("");
|
$("#ColName").val("0");
|
$("#Comparator").val("0");
|
$("#ColContent2").val("");
|
$("#ColName2").val("0");
|
$("#Comparator2").val("0");
|
$("#ColContent1").val("");
|
$("#ColName1").val("0");
|
$("#Comparator1").val("0");
|
form.render('select');
|
sWhere = "";
|
$("#btnSearch").click();
|
}
|
|
//刷新
|
function get_Refresh() {
|
set_ClearQuery();
|
/* $("#btnSearch").trigger('click');*/
|
}
|
|
//获取组织
|
function Organ() {
|
//获取登录页组织列
|
$.ajax({
|
type: "get",
|
url: GetWEBURL() + "/Web/GetOrganizations",
|
success: function (result) {
|
var Organization = "";
|
if (result.count == 1) { // 说明验证成功了,
|
var data = result.data;
|
for (var i = 0; i < data.length; i++) {
|
Organization += '<option style="color:blue;" value="' + data[i].ID + '">' + data[i].Name + '</option>';
|
}
|
$("#HOrgID").append(Organization);
|
$("#HOrgID").val(sessionStorage["OrganizationID"])
|
form.render('select');
|
}
|
layer.closeAll("loading");
|
}
|
})
|
}
|
|
//#region 导出Execel
|
function get_Export() {
|
table.exportFile(ins.config.id, option.data, "xls");
|
}
|
//#endregion
|
|
//新增
|
function set_AddNew() {
|
layer.open({
|
type: 2,
|
skin: 'layui-layer-rim', //加上边框
|
title: '新增不良后果',
|
closeBtn: 1,
|
shift: 2,
|
area: ['100%', '100%'],
|
maxmin: true,
|
content: '../生产基础资料/Add_Edit_Gy_BadResult.html?OperationType=1&linterid=&HSouceBillType=',
|
end: function () {
|
//刷新页面,
|
location.reload();
|
},
|
success: function (layero, index) {
|
|
}
|
});
|
}
|
//导入
|
function set_SouceExcel() {
|
layer.open({
|
type: 2
|
, area: ['100%', '100%']
|
, title: '不良后果导入'
|
, shift: 0//弹出动画
|
, content: './Gy_BadResult_Excel.html?OperationType=dao&HSouceBillType='
|
})
|
}
|
|
//#region 复制
|
function set_Copy() {
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
if (checkStatus.data.length === 1) {
|
var hID = data[0].HItemID.toString();
|
layer.open({
|
type: 2
|
, area: ['100%', '100%']
|
, title: '复制-不良后果'
|
, shade: 0.6 //遮罩透明度
|
, maxmin: true //允许全屏最小化
|
, anim: 0 //0-6的动画形式,-1不开启
|
, content: '../生产基础资料/Add_Edit_Gy_BadResult.html?OperationType=2&linterid=' + hID + '&HSouceBillType='
|
, resize: false,
|
end: function () {
|
//刷新页面,
|
get_FastQuery(2);
|
}
|
, cancel: function () {
|
}
|
})
|
} else {
|
layer.msg('请选择一行数据编辑!');
|
}
|
}
|
//#endregion
|
|
|
//编辑
|
function set_ShowBill() {
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
if (checkStatus.data.length === 1) {
|
var hID = data[0].HItemID.toString();
|
layer.open({
|
type: 2
|
, area: ['100%', '100%']
|
, title: '编辑不良后果'
|
, shade: 0.6 //遮罩透明度
|
, maxmin: true //允许全屏最小化
|
, anim: 0 //0-6的动画形式,-1不开启
|
, content: '../生产基础资料/Add_Edit_Gy_BadResult.html?OperationType=3&linterid=' + hID + '&HSouceBillType='
|
, resize: false,
|
end: function () {
|
//刷新页面,
|
location.reload();
|
}
|
, cancel: function () {
|
//$(".layui-btn").removeClass("layui-btn-disabled");
|
}
|
})
|
|
} else {
|
layer.msg('请选择一行数据编辑!');
|
}
|
}
|
//删除
|
function set_DeleteBill() {
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
if (checkStatus.data.length === 1) {
|
var HItemID = data[0].HItemID.toString();
|
//逻辑删除方法
|
layer.confirm("确认要删除吗,删除后不能恢复", { title: "删除确认" }, function (index) {
|
$.ajax({
|
type: "GET",
|
url: GetWEBURL() + "DeltetGy_BadResult", //方法所在页面和方法名
|
data: { "HItemID": HItemID, "user": sessionStorage["HUserName"]},
|
success: function (result) {
|
if (result.count == 1) {
|
layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
|
// 得到frame索引
|
var index = layer.getFrameIndex(window.name);
|
//关闭当前frame
|
layer.close(index);
|
//修改为功后刷新界面
|
window.location.reload();
|
});
|
|
} else {
|
layer.alert(result.code + result.Message, { icon: 5 });
|
}
|
}, error: function () {
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
});
|
})
|
}
|
else {
|
layer.msg('请选择一行数据删除!');
|
}
|
}
|
//#endregion
|
|
//#region 反审核/审核数据
|
function set_CheckBill(num) {
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
if (checkStatus.data.length === 1) {
|
var InterID = data[0].HItemID.toString();
|
//逻辑审核方法
|
$.ajax({
|
type: "GET",
|
url: GetWEBURL() + "/Gy_BadReason/AuditGy_BadResult", //方法所在页面和方法名
|
data: { "HInterID": InterID, "IsAudit": num, "CurUserName": sessionStorage["HUserName"] },
|
success: function (result) {
|
if (result.count == 1) {
|
layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
|
// 得到frame索引
|
var index = layer.getFrameIndex(window.name);
|
//关闭当前frame
|
layer.close(index);
|
//修改为功后刷新界面
|
$("#btnSearch").trigger('click');
|
});
|
|
} else {
|
layer.alert(result.code + result.Message, { icon: 5 });
|
}
|
}, error: function () {
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
});
|
}
|
else {
|
layer.msg('请选择一行数据审核!');
|
}
|
}
|
//#endregion
|
|
//#region 反禁用/禁用数据
|
function set_De_Stop(num) {
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
if (checkStatus.data.length === 1) {
|
var InterID = data[0].HItemID.toString();
|
//逻辑审核方法
|
$.ajax({
|
type: "GET",
|
url: GetWEBURL() + "/Gy_BadReason/StopGy_BadResult", //方法所在页面和方法名
|
data: { "HInterID": InterID, "IsStop": num, "CurUserName": sessionStorage["HUserName"] },
|
success: function (result) {
|
if (result.count == 1) {
|
layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
|
// 得到frame索引
|
var index = layer.getFrameIndex(window.name);
|
//关闭当前frame
|
layer.close(index);
|
//修改为功后刷新界面
|
$("#btnSearch").trigger('click');
|
});
|
|
} else {
|
layer.alert(result.code + result.Message, { icon: 5 });
|
}
|
}, error: function () {
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
});
|
}
|
else {
|
layer.msg('请选择一行数据审核!');
|
}
|
}
|
//#endregion
|
|
|
|
|
//#region 列明显示下拉框
|
function ColFilter() {
|
var Organization = '<option value="0" selected="selected" ></option>';
|
for (var i = 1; i < option.cols[0].length; i++) {
|
if (option.cols[0][i].hide != true) {
|
Organization += '<option style="color:blue;" value="' + option.cols[0][i].field + '">' + option.cols[0][i].field + '</option>';
|
}
|
}
|
$("#ColName").empty();
|
$("#ColName").append(Organization);
|
$("#ColName1").empty();
|
$("#ColName1").append(Organization);
|
$("#ColName2").empty();
|
$("#ColName2").append(Organization);
|
form.render('select');
|
}
|
//#endregion
|
//#region 【过滤方案】
|
|
//获取当前用户的默认过滤方案
|
function get_DefaultModule() {
|
$.ajax({
|
url: GetWEBURL() + '/Xt_FastICScheme/Chooselist',
|
type: "GET",
|
data: { "user": sessionStorage["Czybm"], "HModuleName": HModuleName, "HInterID": 0, "Type": "Default" },
|
success: function (data1) {
|
if (data1.count == 1) {
|
//当前用户设置有默认的过滤方案
|
var data = data1.data;
|
//当前选择的过滤方案
|
HInterID_Choose = data[0].hmainid;
|
//过滤方案内码
|
HInterID = data[0].hmainid
|
//过滤方案名称
|
HDefaultFilter = data[0].方案名称
|
//过滤方案的备注(方案信息描述)
|
var HRemark = data[0].备注
|
//显示出当前的默认过滤方案
|
document.getElementById("HFilterScheme_Now").style.display = "block";
|
document.getElementById('HFilterScheme_Now').innerHTML = "当前过滤方案:" + HDefaultFilter + '<span style="font-size: 15px; font-weight: bold; color:#7b90fb"> ' + "(" + HRemark + ")" + '</span>';
|
//把过滤条件值回写到页面上
|
for (let i = 0; i < data.length; i++) {
|
$("#" + data[i].过滤字段ID).val(data[i].过滤值);
|
if (data[i].过滤标签类型 == 'SELECT') {
|
$("#" + data[i].过滤字段ID).find("option[value='" + data[i].过滤值 + "']").attr("selected", true);
|
}
|
}
|
//查询
|
get_FastQuery();
|
form.render("select");
|
} else {
|
//当前用户没有设置默认的过滤方案
|
//隐藏显示过滤方案的标签信息
|
document.getElementById("HFilterScheme_Now").style.display = "none";
|
//执行查询方法
|
form.render("select");
|
}
|
}, error: function () {
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
});
|
}
|
|
//保存方案
|
function set_SaveScheme() {
|
var index = layer.open()
|
//判断用户是否点击了右上角的“叉号”关闭弹窗页面
|
var HIsClose_Manual = false;
|
//获取本页所有过滤条件对象(class中包含"ForFilteringSchemes"的元素)
|
var Filter = document.getElementsByClassName(HClassTag);
|
|
var HFilterIdList = "";//过滤条件
|
var HFilterIdLists = "";//拼接多个过滤条件
|
var HValue = "";//过滤值
|
var HElement_type = "";//过滤标签类型
|
|
for (var i = 0; i < Filter.length; i++) {
|
HFilterIdList = Filter[i].id; //过滤条件ID
|
HFilterIdLists += Filter[i].id + ","; //过滤条件ID(拼接)
|
HValue += $("#" + HFilterIdList).val() + ","; //过滤条件中输入的值
|
HElement_type += document.getElementById(HFilterIdList).tagName + ",";//通过标签id获取标签类型
|
}
|
|
//去除末尾逗号
|
HFilterIdLists = HFilterIdLists.substring(0, HFilterIdLists.length - 1);
|
HValue = HValue.substring(0, HValue.length - 1);
|
HElement_type = HElement_type.substring(0, HElement_type.length - 1);
|
|
//当前页面上没有选择过滤方案,进入新增方法
|
if (HDefaultFilter == "") {
|
layer.open({
|
type: 2
|
, area: ['40%', '80%']
|
, title: '过滤方案'
|
, shift: 0//弹出动画
|
, content: '../../系统管理/过滤方案设置/Xt_FastICScheme.html?OperationType=1&HModuleName=' + HModuleName + '&HFilterIdLists=' + HFilterIdLists + '&HValue=' + HValue + '&HElement_type=' + HElement_type
|
, cancel: function () {
|
// 右上角关闭事件的逻辑
|
HIsClose_Manual = true;
|
}
|
, end: function () {
|
if (HIsClose_Manual != true) {
|
get_FastQuery();
|
//显示当前的过滤方案
|
document.getElementById("HFilterScheme_Now").style.display = "block";
|
document.getElementById('HFilterScheme_Now').innerHTML = "当前过滤方案:" + sessionStorage["HFilterSchemeName_" + sessionStorage["Czybm"]] + '<span style="font-size: 15px; font-weight: bold; color:#7b90fb"> ' + "(" + sessionStorage["HFilterSchemeRemark_" + sessionStorage["Czybm"]] + ")" + '</span>';
|
}
|
}
|
})
|
layer.close(index)
|
} else {
|
//当前页面已有过滤方案,用户选择 新增或者编辑
|
layer.confirm('当前已选择过滤方案,是否修改?请选择对应操作', {
|
title: "操作提示",
|
icon: 0,
|
btn: ['新增方案', '保存修改当前方案', '取消']
|
}, function (index, layero) {
|
//新增
|
layer.open({
|
type: 2
|
, area: ['40%', '80%']
|
, title: '过滤方案'
|
, shift: 0//弹出动画
|
, content: '../../系统管理/过滤方案设置/Xt_FastICScheme.html?OperationType=1&HModuleName=' + HModuleName + '&HFilterIdLists=' + HFilterIdLists + '&HValue=' + HValue + '&HElement_type=' + HElement_type
|
, end: function () {
|
get_FastQuery()
|
//显示当前的过滤方案
|
document.getElementById("HFilterScheme_Now").style.display = "block";
|
document.getElementById('HFilterScheme_Now').innerHTML = "当前过滤方案:" + sessionStorage["HFilterSchemeName_" + sessionStorage["Czybm"]] + '<span style="font-size: 15px; font-weight: bold; color:#7b90fb"> ' + "(" + sessionStorage["HFilterSchemeRemark_" + sessionStorage["Czybm"]] + ")" + '</span>';
|
}
|
})
|
layer.close(index)
|
}, function (index) {
|
//编辑
|
var Filter_Edit = document.getElementsByClassName(HClassTag); //获取本页所有过滤条件对象(class中包含"ForFilteringSchemes"的元素)
|
HFilterIdList = "";
|
HFilterIdLists = "";
|
HValue = "";
|
HElement_type = "";
|
for (var i = 0; i < Filter_Edit.length; i++) {
|
HFilterIdList = Filter_Edit[i].id; //过滤条件ID
|
HFilterIdLists += Filter_Edit[i].id + ","; //过滤条件ID(拼接)
|
HValue += $("#" + HFilterIdList).val() + ","; //过滤条件中输入的值
|
HElement_type += document.getElementById(HFilterIdList).tagName + ",";//通过标签id获取标签类型
|
}
|
//去除末尾逗号
|
HFilterIdLists = HFilterIdLists.substring(0, HFilterIdLists.length - 1);
|
HValue = HValue.substring(0, HValue.length - 1);
|
HElement_type = HElement_type.substring(0, HElement_type.length - 1);
|
|
var sMainSub = HInterID_Choose + ';' + HFilterIdLists + ';' + HValue + ';' + HElement_type + ';' + sessionStorage["Czybm"] + ';' + 3;
|
|
//修改
|
$.ajax({
|
type: "POST",
|
url: GetWEBURL() + "/Xt_FastICScheme/save", //方法所在页面和方法名
|
async: true,
|
data: { "oMain": sMainSub },
|
dataType: "json",
|
success: function (data) {
|
if (data.count == 1) { // 说明验证成功了,
|
layer.msg(data.Message, { time: 1 * 1000, icon: 1 });
|
}
|
else {
|
|
}
|
layer.closeAll("loading");
|
},
|
error: function (err) {
|
|
|
}
|
});
|
layer.close(index)
|
}, function (index) {
|
//取消
|
layer.alert('取消')
|
layer.close(index)
|
});
|
}
|
|
}
|
|
//读取方案
|
function set_ReadScheme() {
|
var HIsClose_Manual = false;
|
var Filter = document.getElementsByClassName(HClassTag); //获取本页所有过滤条件对象(class中包含"ForFilteringSchemes"的元素)
|
|
var HFilterIdList = "";
|
var HFilterIdLists = "";
|
var HValue = "";
|
var HElement_type = "";
|
for (var i = 0; i < Filter.length; i++) {
|
HFilterIdList = Filter[i].id; //过滤条件ID
|
HFilterIdLists += Filter[i].id + ","; //过滤条件ID(拼接)
|
HValue += $("#" + HFilterIdList).val() + ","; //过滤条件中输入的值
|
HElement_type += document.getElementById(HFilterIdList).tagName + ",";//通过标签id获取标签类型
|
}
|
//去除末尾逗号
|
HFilterIdLists = HFilterIdLists.substring(0, HFilterIdLists.length - 1);
|
HValue = HValue.substring(0, HValue.length - 1);
|
HElement_type = HElement_type.substring(0, HElement_type.length - 1);
|
|
layer.open({
|
type: 2
|
, area: ['80%', '80%']
|
, title: '过滤方案列表'
|
, shift: 0//弹出动画
|
, content: '../../系统管理/过滤方案设置/Xt_FastICSchemeList.html?HType=Select&HFilterIdLists=' + HFilterIdLists + '&HValue=' + HValue + '&HElement_type=' + HElement_type + '&HModuleName=' + HModuleName
|
, cancel: function () {
|
// 右上角关闭事件的逻辑
|
HIsClose_Manual = true;
|
}
|
, end: function () {
|
if (HIsClose_Manual != true) {
|
get_FastQuery()
|
form.render("select");
|
}
|
}
|
})
|
}
|
|
//#endregion
|
//以上是layui模块
|
});
|
//#region 【过滤方案返回数据】
|
function HFilterScheme(obj) //返回过滤方案
|
{
|
var HInterID = obj[0].hmainid;
|
HInterID_Choose = obj[0].hmainid;
|
$.ajax({
|
url: GetWEBURL() + '/Xt_FastICScheme/Chooselist',
|
type: "GET",
|
data: { "user": sessionStorage["Czybm"], "HModuleName": HModuleName, "HInterID": HInterID, "Type": "Select" },
|
success: function (data1) {
|
if (data1.count == 1) {
|
var data = data1.data;
|
//赋值过滤方案名称
|
HDefaultFilter = data[0].方案名称
|
var HRemark = data[0].备注
|
//显示当前的过滤方案
|
document.getElementById("HFilterScheme_Now").style.display = "block";
|
document.getElementById('HFilterScheme_Now').innerHTML = "当前过滤方案:" + HDefaultFilter + '<span style="font-size: 15px; font-weight: bold; color:#7b90fb"> ' + "(" + HRemark + ")" + '</span>';
|
HInterID = data[0].hmainid
|
//根据选择的过滤方案回填数据到列表过滤条件
|
for (let i = 0; i < data.length; i++) {
|
$("#" + data[i].过滤字段ID).val(data[i].过滤值);
|
if (data[i].过滤标签类型 == 'SELECT') {
|
$("#" + data[i].过滤字段ID).find("option[value='" + data[i].过滤值 + "']").attr("selected", true);
|
}
|
}
|
|
} else {
|
layer.close(ajaxLoad);
|
layer.alert(data1.code + data1.Message, { icon: 5 });
|
}
|
}, error: function () {
|
layer.close(ajaxLoad);
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
});
|
}
|
//#endregion
|
</script>
|
|
</body>
|
</html>
|