<!DOCTYPE html>
|
<html>
|
<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/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>
|
<script src="../../../layuiadmin/soulTable.slim.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-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>
|
<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>
|
</div>
|
<table class="" id="mainTable" lay-filter="mainTable"></table>
|
<script type="text/html" id="toolbarDemo">
|
<div class="layui-btn-container">
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="set_AddNew"><i class="layui-icon layui-icon-file-b"></i>新增</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="set_ShowBill"><i class="layui-icon layui-icon-form"></i>编辑</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="set_DeleteBill"><i class="layui-icon layui-icon-delete"></i>删除</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="get_Refresh"><i class="layui-icon layui-icon-refresh-3"></i>刷新</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="set_SouceExcel"><i class="layui-icon layui-icon-delete"></i>导入</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-view"><i class="layui-icon layui-icon-tips"></i>预览</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="set_CheckBill" id="CheckBill"><i class="layui-icon layui-icon-form"></i>审核</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="set_AbandonCheck" id="AbandonCheck"><i class="layui-icon layui-icon-form"></i>反审核</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Stop" id="btn-Stop"><i class="layui-icon layui-icon-radio"></i>禁用</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-DeStop" id="btn-DeStop"><i class="layui-icon layui-icon-radio"></i>反禁用</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="set_CloseBill" id="set_CloseBill"><i class="layui-icon layui-icon-form"></i>关闭</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="set_CancelCloseBill" id="set_CancelCloseBill"><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_Exit"><i class="layui-icon layui-icon-logout"></i>退出</button>
|
</div>
|
</script>
|
</form>
|
</div>
|
</div>
|
</div>
|
</div>
|
<script>
|
var TagId = "";
|
var TagParentId = "";
|
var Level = "1";
|
layui.config({
|
base: '../../../layuiadmin/' //静态资源所在路径
|
}).extend({
|
index: 'lib/index', //主入口模块
|
}).use(['tree', 'index', 'form', 'table', 'element', 'laypage', 'laydate','soulTable'], 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
|
, util = layui.util
|
, tree = layui.tree
|
, soulTable = layui.soulTable
|
//查询条件
|
var sWhere = "";
|
var option = [];
|
//#endregion
|
|
//#region 【过滤方案】
|
|
//过滤条件的class类
|
var HClassTag = "ForFilteringSchemes";
|
//模块名称(中文版) 每个模块页面都需要修改
|
window.HModuleName = "设备分类维护";
|
//是否已经选择了过滤方案(全局变量)
|
window.HDefaultFilter = "";
|
//选择的过滤方案内码(全局变量)
|
window.HInterID_Choose = 0;
|
|
//#endregion
|
//#region 进入页面既加载
|
set_ClearBill();
|
//#endregion
|
|
//#region 头工具栏事件
|
|
table.on('toolbar(mainTable)', function (obj) {
|
switch (obj.event) {
|
//新增
|
case 'set_AddNew': set_AddNew();
|
break;
|
//编辑
|
case 'set_ShowBill': set_ShowBill();
|
break;
|
//删除
|
case 'set_DeleteBill': set_DeleteBill();
|
break;
|
//刷新
|
case 'get_Refresh': get_Refresh();
|
break;
|
//导入
|
case 'set_SouceExcel': set_SouceExcel();
|
break;
|
//浏览
|
case 'btn-view':
|
get_ViewReport();
|
break;
|
//审核
|
case 'set_CheckBill': set_CheckBill(1);
|
break;
|
//反审核
|
case 'set_AbandonCheck': set_CheckBill(2);
|
break;
|
//关闭
|
case 'set_CloseBill': set_CloseBill(1);
|
break;
|
//反关闭
|
case 'set_CancelCloseBill': set_CloseBill(2);
|
break;
|
//禁用按钮
|
case 'btn-Stop':
|
set_De_Stop(0);
|
break;
|
//反禁用按钮
|
case 'btn-DeStop':
|
set_De_Stop(1);
|
break;
|
//保存方案
|
case 'set_SaveScheme': set_SaveScheme();
|
break;
|
//读取方案
|
case 'set_ReadScheme': set_ReadScheme();
|
break;
|
//退出按钮
|
case 'get_Exit': Pub_Close(2);
|
break;
|
};
|
});
|
|
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 重置按钮
|
form.on('submit(btnReSearch)', function (data) {
|
set_ClearQuery();
|
});
|
//#endregion
|
|
//#region 查询按钮
|
form.on('submit(btnSearch)', function (data) {
|
get_FastQuery();
|
});
|
//#endregion
|
|
//代码回车方法
|
$('#HNumber').on('keydown', function (event) {
|
if (event.keyCode == 13) {
|
get_FastQuery();
|
}
|
});
|
//名称回车方法
|
$('#HName').on('keydown', function (event) {
|
if (event.keyCode == 13) {
|
get_FastQuery();
|
}
|
});
|
|
//初始化表格
|
|
function set_ClearBill() {
|
//初始化表格
|
set_InitGrid();
|
|
//查询
|
get_Display(sWhere);
|
|
get_DefaultModule();
|
}
|
|
//#region初始化表格
|
function set_InitGrid() {
|
option = {
|
elem: '#mainTable'
|
, toolbar: '#toolbarDemo'
|
, height: 'full-50'
|
, page: true
|
, totalRow: true
|
, limits: [50, 500, 5000, 50000]
|
, limit: 50
|
, cellMinWidth: 90
|
, done: function (res, curr, count) {
|
soulTable.render(this);
|
}
|
, cols: [[
|
{ type: 'checkbox', fixed: 'left', totalRowText: '合计行'}
|
, { field: 'HItemID', title: 'HItemID', sort: true, hide: true }
|
, { field: 'HParentID', title: 'HParentID', sort: true, hide: true }
|
, { field: 'HNumber', title: '代码', width: 200, sort: true}
|
, { field: 'HName', title: '名称', width: 200, sort: true}
|
, { field: 'HLevel', title: '等级', width: 200, sort: true}
|
, { field: 'HEndFlag', title: '明细标记', width: 200, sort: true}
|
, { field: 'HStopFlag', title: '禁用标记', width: 200, sort: true}
|
, { field: 'HRemark', title: '备注', width: 200, sort: true}
|
, { field: 'HUseFlag', title: '使用标记', width: 200, sort: true }
|
, { field: 'HMakeEmp', title: '制单人', sort: true }
|
, { field: 'HMakeTime', title: '制单日期', templet: "<div>{{d.HMakeTime ==null ?'':layui.util.toDateString(d.HMakeTime, 'yyyy-MM-dd')}}</div>", sort: true }
|
, { field: 'HCheckEmp', title: '审核人', sort: true }
|
, { field: '审核日期', title: '审核日期', templet: "<div>{{d.HCheckTime ==null ?'':layui.util.toDateString(d.HCheckTime, 'yyyy-MM-dd')}}</div>", sort: true }
|
, { field: 'HModifyEmp', title: '修改人', sort: true }
|
, { field: 'HModifyTime', title: '修改日期', templet: "<div>{{d.HModifyTime ==null ?'':layui.util.toDateString(d.HModifyTime, 'yyyy-MM-dd')}}</div>", sort: true }
|
, { field: 'HCloseEmp', title: '关闭人', sort: true }
|
, { field: 'HCloseTime', title: '关闭日期', templet: "<div>{{d.HCloseTime ==null ?'':layui.util.toDateString(d.HCloseTime, 'yyyy-MM-dd')}}</div>", sort: true }
|
]]
|
};
|
}
|
//查询
|
function get_Display(sWhere) {
|
var ajaxLoad = layer.load();
|
//进入页面显示的缓存列表
|
$.ajax({
|
url: GetWEBURL() + '/Gy_EquipType/GetList',
|
type: "GET",
|
async: false,
|
data: { "sWhere": sWhere, "user": sessionStorage["HUserName"]},
|
success: function (data1) {
|
if (data1.count == 1) {
|
option.data = data1.data;
|
table.render(option);
|
layer.close(ajaxLoad);
|
} else {
|
layer.close(ajaxLoad);
|
layer.alert(data1.code + data1.Message, { icon: 5 });
|
}
|
}, error: function () {
|
layer.close(ajaxLoad);
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
});
|
}
|
//#endregion
|
|
//#region 快速过滤
|
function get_FastQuery() {
|
var HNumber = $("#HNumber").val();
|
var HName = $("#HName").val();
|
if (HNumber) {
|
sWhere += " and HNumber like '%" + HNumber + "%'";
|
}
|
if (HName) {
|
sWhere += " and HName like '%" + HName + "%'";
|
}
|
get_Display(sWhere);
|
sWhere = "";//调用接口后清空sWhere缓存
|
}
|
//#endregion
|
|
//#region 重置过滤条件方法
|
function set_ClearQuery() {
|
$("#HNumber").val("");
|
$("#HName").val("");
|
sWhere = "";
|
get_Display(sWhere);
|
}
|
//#endregion
|
|
//#region 工具栏事件
|
//新增
|
function set_AddNew() {
|
//页面层-自定义
|
layer.open({
|
type: 2,
|
skin: 'layui-layer-rim', //加上边框
|
title: '新增检验项目',
|
closeBtn: 1,
|
shift: 2,
|
area: ['80%', '80%'],
|
maxmin: true,
|
content: '../公用基础资料/Gy_EquipTypeEdit.html?OperationType=1&linterid=&HSouceBillType=0&closeType=1',
|
end: function () {
|
//刷新页面,
|
location.reload();
|
},
|
success: function (layero, index) {
|
|
}
|
});
|
}
|
|
//删除
|
function set_DeleteBill() {
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
var layEvent = checkStatus.event;
|
if (checkStatus.data.length === 1) {
|
layer.confirm('您确定要删除吗?', {
|
btn: ['确定', '取消'] //按钮
|
, yes: function (index, layero) {
|
|
$.ajax({
|
url: GetWEBURL() + '/Gy_EquipType/Delete_EquipType',
|
type: "GET",
|
//async: true,
|
data: { "HItemID": data[0].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();
|
//重载tree
|
//tree.reload('treeDepartment', {});
|
});
|
|
} else {
|
layer.alert(result.code + result.Message, { icon: 5 });
|
}
|
}
|
})
|
}
|
});
|
}
|
else {
|
layer.msg('请选择一行数据编辑!');
|
}
|
};
|
|
//刷新
|
function get_Refresh() {
|
set_ClearQuery();
|
}
|
|
//预览
|
function get_ViewReport() {
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
if (checkStatus.data.length === 1) {
|
var InterID = data[0].hmainid.toString();
|
window.open("../../基础资料/公用基础资料/HBarPlanPrint.html?linterid=" + InterID + "&Type=HEquipType&OpenTmp=设备分类");
|
|
}
|
else {
|
layer.msg('请选择一行数据打印!');
|
}
|
}
|
//导入
|
function set_SouceExcel() {
|
layer.open({
|
type: 2
|
, area: ['100%', '100%']
|
, title: '工序资料导入'
|
, shift: 0//弹出动画
|
, content: './Gy_EquipType_Excel.html?OperationType=dao&HSouceBillType='
|
})
|
}
|
//审核/反审核
|
function set_CheckBill(num) {
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
|
if (data.length == 1) {
|
layer.confirm("确认要审核吗?", function (index) {
|
var wait = layer.load();
|
var HInterID = data[0].HItemID;
|
$.ajax({
|
url: GetWEBURL() + '/Gy_EquipTypeBill/CheckGy_EquipTypeBill',
|
type: "GET",
|
data: { "HInterID": HInterID, "Type": num, "user": sessionStorage["HUserName"] },
|
success: function (result) {
|
if (result.count == 1) {
|
get_FastQuery();
|
layer.msg(result.Message, { icon: 1 });
|
layer.close(wait);
|
} else {
|
layer.alert(result.code + result.Message, { icon: 5 });
|
layer.close(wait);
|
}
|
}, error: function () {
|
layer.alert("接口请求失败!", { icon: 5 });
|
layer.close(wait);
|
}
|
});
|
})
|
} else {
|
layer.msg("请选择一条数据!");
|
}
|
}
|
|
//关闭/反关闭
|
function set_CloseBill(num) {
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
|
if (data.length == 1) {
|
layer.confirm("确认要关闭吗?", function (index) {
|
var wait = layer.load();
|
var HInterID = data[0].HItemID;
|
$.ajax({
|
url: GetWEBURL() + '/Gy_EquipTypeBill/CloseGy_EquipTypeBill',
|
type: "GET",
|
data: { "HInterID": HInterID, "Type": num, "user": sessionStorage["HUserName"] },
|
success: function (result) {
|
if (result.count == 1) {
|
get_FastQuery();
|
layer.msg(result.Message, { icon: 1 });
|
layer.close(wait);
|
} else {
|
layer.alert(result.code + result.Message, { icon: 5 });
|
layer.close(wait);
|
}
|
}, error: function () {
|
layer.alert("接口请求失败!", { icon: 5 });
|
layer.close(wait);
|
}
|
});
|
})
|
}
|
else {
|
layer.msg("请选择一条数据!");
|
}
|
}
|
|
// 反禁用/禁用数据
|
function set_De_Stop(num) {
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
if (checkStatus.data.length === 1) {
|
var InterID = data[0].HItemID.toString();
|
layer.confirm("确认要禁用吗?", function (index) {
|
//逻辑审核方法
|
$.ajax({
|
type: "GET",
|
url: GetWEBURL() + "/Gy_EquipTypeBill/StopGy_EquipTypeBill", //方法所在页面和方法名
|
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('请选择一行数据审核!');
|
}
|
}
|
|
//修改按钮
|
function set_ShowBill() {
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
if (checkStatus.data.length === 1) {
|
var linterid = data[0].HItemID;
|
TagParentId = data[0].HParentID;
|
//if (AllowLoadData(sSubStr) != false) {//非空验证
|
layer.open({
|
type: 2
|
, area: ['80%', '80%']
|
, title: '编辑模治具分类'
|
, closeBtn: 1
|
, shade: 0.6 //遮罩透明度
|
, maxmin: true //允许全屏最小化
|
, anim: 0 //0-6的动画形式,-1不开启]
|
, content: '../公用基础资料/Gy_EquipTypeEdit.html?OperationType=3&linterid=' + linterid + '&HSouceBillType=0&closeType=1'
|
|
, resize: false,
|
end: function () {
|
//刷新页面,
|
location.reload();
|
}
|
, cancel: function () {
|
//$(".layui-btn").removeClass("layui-btn-disabled");
|
}
|
})
|
|
} else {
|
layer.msg('请选择一行数据编辑!');
|
}
|
};
|
|
//数据验证
|
//#region 数据验证
|
function AllowLoadData(sSubStr) {
|
if ($("#HNumber").val() == '') {
|
layer.msg("请填写代码", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
|
return false;
|
}
|
if ($("#HName").val() == '') {
|
layer.msg("请填写名称", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
|
return false;
|
}
|
else {
|
return true;
|
}
|
}
|
//#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>
|