<!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/zgqCustom/zgqCustom.js"></script>
|
<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/HideButton.js"></script>
|
<script src="../../../layuiadmin/soulTable.slim.js"></script>
|
<script src="../../../layuiadmin/PageTitle.js"></script>
|
<style>
|
.layui-form-select .layui-input {
|
padding-right: 15px;
|
cursor: pointer;
|
}
|
</style>
|
</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">状态</label>
|
<div class="layui-input-block">
|
<select name="Status" lay-filter="Status" style="width:190px;" class="layui-input ForFilteringSchemes" id="Status">
|
<option value="-1" selected="selected">全部</option>
|
<option value="0">未审核</option>
|
<option value="1">已审核</option>
|
<option value="2">已关闭</option>
|
</select>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label">开始日期</label>
|
<div class="layui-input-block">
|
<input type="date" class="layui-input ForFilteringSchemes" id="HBeginDate" style="width:190px;">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label">结束日期</label>
|
<div class="layui-input-block">
|
<input type="date" class="layui-input ForFilteringSchemes" id="HEndDate" style="width:190px;">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label">生产订单</label>
|
<div class="layui-input-block">
|
<input type="text" class="layui-input ForFilteringSchemes" name="HICMOBillNo" id="HICMOBillNo" style="width:190px;">
|
</div>
|
</div>
|
<button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" style="display: none;" 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; display: none;">重置</button>
|
<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">
|
<!--动态渲染组织-->
|
</select>
|
</div>
|
</div>
|
<!--显示当前过滤方案-->
|
<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">
|
<div class="layui-row">
|
<div class="layui-inline">
|
<label class="layui-form-label">部门信息</label>
|
<div class="layui-input-block">
|
<input type="text" class="layui-input ForFilteringSchemes" name="Dept" id="Dept" style="width:190px;">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label">物料信息</label>
|
<div class="layui-input-block">
|
<input type="text" class="layui-input ForFilteringSchemes" name="HMater" id="HMater" style="width:190px;">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label">物料代码</label>
|
<div class="layui-input-block">
|
<input type="text" class="layui-input ForFilteringSchemes" name="HMaterNumber" id="HMaterNumber" style="width:190px;">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label">规格型号</label>
|
<div class="layui-input-block">
|
<input type="text" class="layui-input ForFilteringSchemes" name="HMaterModel" id="HMaterModel" style="width:190px;">
|
</div>
|
</div>
|
</div>
|
<div class="layui-row" style="margin-top: 10px;">
|
<div class="layui-inline">
|
<label class="layui-form-label">单据号</label>
|
<div class="layui-input-block">
|
<input type="text" class="layui-input ForFilteringSchemes" name="HBillNo" id="HBillNo" style="width:190px;">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label">操作员</label>
|
<div class="layui-input-block">
|
<input type="text" class="layui-input ForFilteringSchemes" name="HEmployee" id="HEmployee" style="width:190px;">
|
</div>
|
</div>
|
|
<div class="layui-inline">
|
<label class="layui-form-label">生产资源</label>
|
<div class="layui-input-block">
|
<input type="text" class="layui-input ForFilteringSchemes" name="HSource" id="HSource" style="width:190px;">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label">班组</label>
|
<div class="layui-input-block">
|
<input type="text" class="layui-input ForFilteringSchemes" name="HGroup" id="HGroup" style="width:190px;">
|
</div>
|
</div>
|
</div>
|
<div class="layui-row" style="margin-top: 10px;">
|
<div class="layui-inline">
|
<label class="layui-form-label">过滤</label>
|
<div class="layui-input-block">
|
<select name="ColName" id="ColName" class="ForFilteringSchemes" lay-filter="ColName" style="width:190px;">
|
</select>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<select name="Comparator" id="Comparator" class="ForFilteringSchemes" lay-filter="Comparator" style="width:190px;">
|
<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 class="layui-inline">
|
<label class="layui-form-label">单据号</label>
|
<div class="layui-input-block">
|
<input type="text" class="layui-input" name="HBillno2" id="HBillno2" style="width:190px;">
|
</div>
|
</div>
|
<button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnResCnz" id="btnReSearch" style="padding: 0 5px; display: none;">重新同步</button>
|
</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="btn-getCheckData"><i class="layui-icon layui-icon-tips"></i>预览</button>-->
|
<button type="button" class="layui-btn layui-btn-sm" style="display: none;" lay-event="btn-Add" id="btn-Add"><i class="layui-icon layui-icon-file-b"></i>新增</button>
|
<button type="button" class="layui-btn layui-btn-sm" style="display: none;" lay-event="btn-Edit" id="btn-Edit"><i class="layui-icon layui-icon-form"></i>编辑</button>
|
<button type="button" class="layui-btn layui-btn-sm" style="display: none;" lay-event="btn-Delete" id="btn-Delete"><i class="layui-icon layui-icon-delete"></i>删除</button>
|
<button type="button" class="layui-btn layui-btn-sm" style="display:none;" lay-event="btn-PushProductInBill" id="btn-PushProductInBill"><i class="layui-icon layui-icon-delete"></i>下推(生产入库单)</button>
|
<button type="button" class="layui-btn layui-btn-sm" style="display:none;" lay-event="btn-PushProductionReturnBill" id="btn-PushProductionReturnBill"><i class="layui-icon layui-icon-delete"></i>下推(生产退库单)</button>
|
<button type="button" class="layui-btn layui-btn-sm" style="display: none;" lay-event="btn-Audit" id="btn-Audit"><i class="layui-icon layui-icon-radio"></i>审核</button>
|
<button type="button" class="layui-btn layui-btn-sm" style="display: none;" lay-event="btn-DeAudit" id="btn-DeAudit"><i class="layui-icon layui-icon-circle"></i>反审核</button>
|
<button type="button" class="layui-btn layui-btn-sm" style="display: none;" 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" style="display: none;" 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" style="display: none;" lay-event="btn-Print" id="btn-Print"><i class="layui-icon layui-icon-print"></i>预览</button>
|
<button type="button" class="layui-btn layui-btn-sm" style="display: none;" lay-event="btn-Cell" id="btn-Cell"><i class="layui-icon layui-icon-slider"></i>保存列宽</button>
|
<button type="button" class="layui-btn layui-btn-sm" style="display: none;" lay-event="btn-RefreshCell" id="btn-RefreshCell"><i class="layui-icon layui-icon-cols"></i>默认列宽</button>
|
<button type="button" class="layui-btn layui-btn-sm" style="display: none;" lay-event="get_Refresh" id="get_Refresh"><i class="layui-icon layui-icon-refresh-3"></i>刷新</button>
|
<button type="button" class="layui-btn layui-btn-sm" style="display: none;" lay-event="get_Exit" id="get_Exit"><i class="layui-icon layui-icon-logout"></i>退出</button>
|
<button type="button" class="layui-btn layui-btn-sm" style="display:none;" lay-event="set_HideColumn" id="HideColumn"><i class="layui-icon layui-icon-form"></i>列设置</button>
|
<button type="button" class="layui-btn layui-btn-sm" style="display:none;" lay-event="set_HideButton" id="HideButton"><i class="layui-icon layui-icon-form"></i>按钮设置</button>
|
<button type="button" class="layui-btn layui-btn-sm" style="display:none;" 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" style="display:none;" lay-event="set_ReadScheme" id="set_ReadScheme"><i class="layui-icon layui-icon-set"></i>读取方案</button>
|
</div>
|
</script>
|
</form>
|
</div>
|
</div>
|
</div>
|
</div>
|
<script>
|
//#region 折叠注释
|
//#endregion
|
layui.config({
|
base: '../../../layuiadmin/' //静态资源所在路径
|
}).extend({
|
index: 'lib/index', //主入口模块
|
}).use(['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
|
, soulTable = layui.soulTable
|
var sWhere = "";
|
var option = [];
|
var columns = "";
|
var DataList;
|
var Name = "ICMReportCellWidth";
|
var HModName = "Sc_ICMOReportBillList";
|
//#endregion
|
|
//#region 【过滤方案】
|
|
//过滤条件的class类
|
var HClassTag = "ForFilteringSchemes";
|
//模块名称(中文版) 每个模块页面都需要修改
|
window.HModuleName = "生产汇报单列表";
|
//是否已经选择了过滤方案(全局变量)
|
window.HDefaultFilter = "";
|
//选择的过滤方案内码(全局变量)
|
window.HInterID_Choose = 0;
|
|
//#endregion
|
|
|
//#region 进入页面即加载
|
|
//#region 【动态获取模块名称】
|
var HModuleType = "3711";
|
//通过单据类型,从数据库动态获取单据模块命名,引用js文件 PageTitle.js
|
var HPageTitle = get_PageTitle(HModuleType) == "" ? document.title : get_PageTitle(HModuleType);
|
//#endregion
|
|
//初始化界面
|
set_ClearBill();
|
|
|
//获取组织
|
Organ();
|
//#endregion
|
|
|
//#region 触发事件:包括form.on(){}格式的所有点击事件、选择事件等
|
|
//#region 头工具栏事件
|
table.on('toolbar(mainTable)', function (obj) {
|
switch (obj.event) {
|
//新增按钮
|
case 'btn-Add': set_AddNew();
|
break;
|
//编辑按钮
|
case 'btn-Edit': set_ShowBill();
|
break;
|
//删除按钮
|
case 'btn-Delete': set_DeleteBill();
|
break;
|
//下推(生产入库单)
|
case 'btn-PushProductInBill': set_PushProductInBill();
|
break;
|
//下推(生产退库单)
|
case 'btn-PushProductionReturnBill':set_PushProductionReturnBill();
|
break;
|
//审核按钮
|
case 'btn-Audit': set_CheckBill();
|
break;
|
//反审核按钮
|
case 'btn-DeAudit': set_AbandonCheck();
|
break;
|
//关闭
|
case 'set_CloseBill': set_CloseBill(1);
|
break;
|
//反关闭
|
case 'set_CancelCloseBill': set_CloseBill(2);
|
break;
|
//预览按钮
|
case 'btn-Print': get_PrintReport();
|
break;
|
//保存列宽按钮
|
case 'btn-Cell': set_SaveGridColWidth();
|
break;
|
//默认列宽按钮
|
case 'btn-RefreshCell': set_DefaultGridColWidth();
|
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_HideButton':
|
var btns = document.getElementsByTagName("button"); //获取本页所有按钮对象
|
get_HideButton(btns, "3711", HModName, sessionStorage["HUserName"]);
|
break;
|
//列设置
|
case 'set_HideColumn':
|
get_HideColumn();
|
break;
|
};
|
});
|
|
//获取组织
|
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");
|
}
|
})
|
}
|
|
//行监听事件
|
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(btnSearch)', function (data) {
|
get_FastQuery(table, option);
|
});
|
//#endregion
|
|
//#region 重置按钮
|
form.on('submit(btnReSearch)', function (data) {
|
//清空过滤条件
|
set_ClearQuery();
|
});
|
//#endregion
|
|
//#region 重新同步按钮
|
form.on('submit(btnResCnz)', function (data) {
|
set_ResCnz();
|
});
|
//#endregion
|
|
//#endregion
|
|
|
//#region 本页面所有被调用的方法
|
|
//#region 初始化界面
|
function set_ClearBill() {
|
//初始化表格
|
set_InitGrid();
|
//查询
|
get_Display(sWhere);
|
//查询当前登录用户有没有在当前模块设置默认过滤方案
|
get_DefaultModule();
|
}
|
//#endregion
|
|
//#region 刷新
|
function get_Refresh() {
|
sWhere = "";
|
get_Display(sWhere);
|
}
|
//#endregion
|
|
//#region 初始化表格
|
function set_InitGrid() {
|
$("#HBeginDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * 30), "yyyy-MM-dd"));
|
$("#HEndDate").val(Format(new Date(), "yyyy-MM-dd"));
|
columns = [
|
{ type: 'checkbox', fixed: 'left' }
|
, { field: 'hmainid', title: 'hmainid', sort: true, hide: true, width: 200 }
|
, { field: '日期', title: '日期', width: 160, templet: "<div>{{d.日期 ==null ?'':layui.util.toDateString(d.日期, 'yyyy-MM-dd')}}</div>", sort: true }
|
, { field: '单据号', title: '单据号', width: 200, sort: true }
|
, { field: '单据状态', title: '单据状态', sort: true }
|
, { field: '行状态', title: '行状态', width: 125, sort: true }
|
, { field: '班组代码', title: '班组代码', width: 200, sort: true }
|
, { field: '班组', title: '班组', width: 200, sort: true }
|
, { field: '操作员', title: '操作员', width: 200, sort: true }
|
, { field: '生产资源代码', title: '生产资源代码', width: 200, sort: true }
|
, { field: '生产资源', title: '生产资源', width: 200, sort: true }
|
, { field: '表头备注', title: '表头备注', width: 200, sort: true }
|
, { field: 'hsubid', title: 'hsubid', hide: true, width: 200, sort: true }
|
, { field: 'hmaterid', title: 'hmaterid', hide: true, width: 200, sort: true }
|
, { field: '物料代码', title: '物料代码', width: 200, sort: true }
|
, { field: '物料名称', title: '物料名称', width: 200, sort: true }
|
, { field: '规格型号', title: '规格型号', width: 200, sort: true }
|
, { field: 'hunitid', title: 'hunitid', hide: true, width: 200, sort: true }
|
, { field: '计量单位代码', title: '计量单位代码', width: 200, sort: true }
|
, { field: '计量单位', title: '计量单位', width: 200, sort: true }
|
, { field: '生产数量', title: '生产数量', width: 200, sort: true, totalRow: true }
|
, { field: '生产任务单号', title: '生产任务单号', width: 200, sort: true }
|
, { field: '表体备注', title: '表体备注', width: 200, sort: true }
|
, { field: '制单人', title: '制单人', width: 200, sort: true }
|
, { field: '制单日期', title: '制单日期', width: 200, templet: "<div>{{d.制单日期 ==null ?'':layui.util.toDateString(d.制单日期, 'yyyy-MM-dd HH:mm:ss')}}</div>", sort: true }
|
, { field: '审核人', title: '审核人', width: 200, sort: true }
|
, { field: '审核日期', title: '审核日期', width: 200, templet: "<div>{{d.审核日期 ==null ? '':layui.util.toDateString(d.审核日期, 'yyyy-MM-dd HH:mm:ss')}}</div>", sort: true }
|
, { field: '修改人', title: '修改人', width: 200, sort: true }
|
, { field: '修改日期', title: '修改日期', width: 200, templet: "<div>{{d.修改日期 ==null ?'':layui.util.toDateString(d.修改日期, 'yyyy-MM-dd HH:mm:ss')}}</div>", sort: true }
|
, { field: '关闭人', title: '关闭人', width: 200, sort: true }
|
, { field: '关闭日期', title: '关闭日期', width: 200, templet: "<div>{{d.关闭日期 ==null ?'':layui.util.toDateString(d.关闭日期, 'yyyy-MM-dd HH:mm:ss')}}</div>", sort: true }
|
, { field: '作废人', title: '作废人', width: 200, sort: true }
|
, { field: '作废日期', title: '作废日期', width: 200, templet: "<div>{{d.作废日期 ==null ?'':layui.util.toDateString(d.作废日期, 'yyyy-MM-dd HH:mm:ss')}}</div>", sort: true }
|
, { field: 'HICMOInterID', title: 'HICMOInterID', hide: true, width: 200, sort: true }
|
, { field: 'HEmpID', title: 'HEmpID', hide: true, width: 200, sort: true }
|
, { field: 'HEmpName', title: 'HEmpName', hide: true, width: 200, sort: true }
|
, { field: 'HSourceID', title: 'HSourceID', hide: true, width: 200, sort: true }
|
, { field: 'HSourceName', title: 'HSourceName', hide: true, width: 200, sort: true }
|
, { field: 'HGroupID', title: 'HGroupID', hide: true, width: 200, sort: true }
|
, { field: 'HGroupName', title: 'HGroupName', hide: true, width: 200, sort: true }
|
, { field: 'HEmpNumber', title: 'HEmpNumber', hide: true, width: 200, sort: true }
|
];
|
option = {
|
elem: '#mainTable'
|
, toolbar: '#toolbarDemo'
|
, page: true
|
//, cellMinWidth: 120
|
, totalRow: true
|
, limit: 10
|
, height: 'full-50'
|
, cols: [columns]
|
, limit: 50
|
, limits: [50, 500, 5000, 20000]
|
, done: function (res, curr, count) {
|
soulTable.render(this);
|
}
|
};
|
//设置列宽
|
var colWidth = getColumnsWidth();
|
if (colWidth == "" || colWidth == []) {
|
|
}
|
else {
|
$.each(columns, function (x, m) {
|
m["width"] = colWidth[x];
|
});
|
}
|
}
|
//#endregion
|
|
//#region 获取列宽
|
function getColumnsWidth() {
|
var result = [];
|
var colNum = $(".layui-table-header").find("tr").eq(0).find("th").length;
|
//获取列宽
|
$.ajax({
|
url: GetWEBURL() + '/tb_CellWidth/GetMouldScrapInHouseCellWidthList',
|
async: false,
|
type: "Get",
|
dataType: "json",
|
data: { "colNum": colNum, "Name": Name },
|
success: function (data1) {
|
if (data1.code == 1) {
|
result = data1.data;
|
}
|
else if (data1.code == -1) {
|
|
}
|
else {
|
layer.alert(data1.Message, { icon: 5 });
|
}
|
}, error: function (e) {
|
layer.alert(e.Message, { icon: 5 });
|
}
|
});
|
|
return result;
|
}
|
//#endregion
|
|
//#region 加载网格
|
function get_Display(sWhere) {
|
//加载网格
|
var wait = layer.load();//遮罩
|
$.ajax({
|
url: GetWEBURL() + '/Sc_ICMOReportBill/list',
|
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(wait);
|
|
var btns = document.getElementsByTagName("button"); //获取本页所有按钮对象
|
Display_HideButton(btns, "3711", HModName, sessionStorage["HUserName"]);
|
//刷新表格数据
|
DisPlay_HideColumn();
|
if ($("#Comparator").val() == 0 && $("#ColContent").val() == "") {
|
ColFilter();
|
}
|
} else {
|
layer.close(wait);
|
layer.alert(data1.code + data1.Message, { icon: 5 });
|
}
|
}, error: function () {
|
layer.close(wait);
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
});
|
}
|
//#endregion
|
|
//#region 快速过滤
|
function get_FastQuery(table, option) {
|
var Status = $("select[name='Status']").val();//状态
|
var HDate = $("#HBeginDate").val();//开始日期
|
var HDate1 = $("#HEndDate").val();//结束日期
|
var HBillNo = $("#HBillNo").val(); //单据号
|
var Dept = $("#Dept").val(); //部门信息
|
var HMater = $("#HMater").val(); //物料信息
|
var HMaterNumber = $("#HMaterNumber").val(); //物料代码
|
var HMaterModel = $("#HMaterModel").val(); //规格型号
|
var HICMOBillNo = $("#HICMOBillNo").val(); //生产订单
|
var HEmployee = $("#HEmployee").val(); //操作员
|
var HSource = $("#HSource").val(); //生产资源
|
var HGroup = $("#HGroup").val(); //生产班组
|
var ColName = $("#ColName").val();//复选框
|
var Comparator = $("#Comparator").val()
|
var ColContent = $("#ColContent").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 (Status) {
|
switch (Status) {
|
case '-1': //全部
|
sWhere += "";
|
break;
|
case '0': //未审核
|
sWhere += " and 审核人=''";
|
break;
|
case '1': //已审核
|
sWhere += " and 审核人<>''";
|
break;
|
case '2': //已关闭
|
sWhere += " and 关闭人<>''";
|
default:
|
|
}
|
}
|
if (HDate) {
|
sWhere += " and CONVERT(varchar(100),日期, 23) >= '" + HDate + "'";
|
}
|
if (HDate1) {
|
sWhere += " and CONVERT(varchar(100),日期, 23) <= '" + HDate1 + "'";
|
}
|
if (HBillNo) {
|
sWhere += " and 单据号 like '%" + HBillNo + "%'";
|
}
|
if (Dept) {
|
sWhere += " and 部门 like '%" + Dept + "%'";
|
}
|
if (HMater) {
|
sWhere += " and concat(物料代码,物料名称,规格型号) like '%" + HMater + "%'";
|
}
|
if (HMaterNumber) {
|
sWhere += " and 物料代码 like '%" + HMaterNumber + "%'";
|
}
|
if (HMaterModel) {
|
sWhere += " and 规格型号 like '%" + HMaterModel + "%'";
|
}
|
if (HICMOBillNo) {
|
sWhere += " and 生产任务单号 like '%" + HICMOBillNo + "%'";
|
}
|
if (HEmployee) {
|
sWhere += " and 操作员 like '%" + HEmployee + "%'";
|
}
|
if (HSource) {
|
sWhere += " and concat(生产资源代码,生产资源) like '%" + HSource + "%'";
|
}
|
if (HGroup) {
|
sWhere += " and concat(班组代码,班组) like '%" + HGroup + "%'";
|
}
|
sWhere += addSWhereByOpenType();
|
var index = layer.load(0);
|
get_Display(sWhere);
|
//调用接口后清空sWhere缓存
|
sWhere = "";
|
}
|
//#endregion
|
|
//#region 重置过滤条件
|
function set_ClearQuery() {
|
$('#Status').find("option[value='-1']").attr("selected", true);
|
$("#HBeginDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * 30), "yyyy-MM-dd"));
|
$("#HEndDate").val(Format(new Date(), "yyyy-MM-dd"));
|
$("#HBillNo").val("");
|
$("#Dept").val("");
|
$("#HMater").val("");
|
$("#HMaterNumber").val("");
|
$("#HMaterModel").val("");
|
$("#HICMOBillNo").val("");
|
$("#HEmployee").val("");
|
$("#HSource").val("");
|
$("#HGroup").val("");
|
$("#ColContent").val("");
|
$("#ColName").val("0");
|
$("#Comparator").val("0");
|
form.render('select');
|
}
|
//#endregion
|
|
//重新同步按钮
|
function set_ResCnz() {
|
var HBillno2 = $('#HBillno2').val();
|
$.ajax({
|
url: GetWEBURL() + '/Sc_ICMOReportBill/Sc_ICMOReportBillViewApi',
|
type: "GET",
|
data: { "BillNo": HBillno2, "BillType": 3711 },
|
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.close(wait);
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
});
|
}
|
|
//#region 下推(生产入库单)
|
function set_PushProductInBill() {
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
if (data.length > 0) {
|
var dataArray = [];
|
for (var i = 0; i < data.length; i++) {
|
var temp = {
|
"hmainid": data[i].hmainid
|
, "hsubid": data[i].hsubid
|
, "HBillStatus": data[i].状态
|
, "HSourceBillType": "3711"
|
}
|
dataArray.push(temp);
|
if (data[i].状态 != "已审核") {
|
var err = "下推失败!单据【" + data[i].单据号 + "】的状态为“" + data[0].状态 + "”,不允许下推!";
|
layer.alert(err, { icon: 5 });
|
return;
|
}
|
|
if (data[i].行状态 != "" ) {
|
var err = "下推失败!单据【" + data[i].单据号 + "】的状态为“" + data[0].行状态 + "”,不允许下推!";
|
layer.alert(err, { icon: 5 });
|
return;
|
}
|
}
|
|
var datajson = {
|
"data": dataArray
|
};
|
|
var url = encodeURI('../../验收入库/产品入库/Kf_ProductInBillEdit.html?OperationType=4&linterid=0&HSouceBillType=3711&res=' + JSON.stringify(datajson))
|
layer.open({
|
type: 2
|
, area: ['100%', '100%']
|
, title: '生产汇报单-下推生产入库单'
|
, shift: 0//弹出动画
|
, content: url
|
, btn: [],
|
// 按钮1 的回调
|
end: function (index, layero, that) {
|
//刷新页面
|
$("#btnSearch").trigger('click');
|
}
|
})
|
} else {
|
layer.msg('请选择数据下推!');
|
}
|
}
|
//#endregion
|
|
|
//#region 下推(生产退库单)
|
function set_PushProductionReturnBill() {
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
if (data.length > 0) {
|
var dataArray = [];
|
for (var i = 0; i < data.length; i++) {
|
var temp = {
|
"hmainid": data[i].hmainid
|
, "hsubid": data[i].hsubid
|
, "HBillStatus": data[i].状态
|
, "HSourceBillType": "3711"
|
}
|
dataArray.push(temp);
|
if (data[i].状态 != "已审核") {
|
var err = "下推失败!单据【" + data[i].单据号 + "】的状态为“" + data[0].状态 + "”,不允许下推!";
|
layer.alert(err, { icon: 5 });
|
return;
|
}
|
|
if (data[i].行状态 != "" ) {
|
var err = "下推失败!单据【" + data[i].单据号 + "】的状态为“" + data[0].行状态 + "”,不允许下推!";
|
layer.alert(err, { icon: 5 });
|
return;
|
}
|
}
|
|
var datajson = {
|
"data": dataArray
|
};
|
|
var url = encodeURI('../../生产管理/生产退库单/Sc_ProductionReturnEdit.html?OperationType=4&linterid=0&HSouceBillType=3711&res=' + JSON.stringify(datajson))
|
layer.open({
|
type: 2
|
, area: ['100%', '100%']
|
, title: '生产汇报单-下推生产退库单'
|
, shift: 0//弹出动画
|
, content: url
|
, btn: [],
|
// 按钮1 的回调
|
end: function (index, layero, that) {
|
//刷新页面
|
$("#btnSearch").trigger('click');
|
}
|
})
|
} else {
|
layer.msg('请选择数据下推!');
|
}
|
}
|
//#endregion
|
|
//#region 新增
|
function set_AddNew() {
|
layer.open({
|
type: 2,
|
skin: 'layui-layer-rim', //加上边框
|
area: ['100%', '100%'],
|
title: '新增' + HPageTitle,
|
shift: 0,
|
content: '../生产汇报单/Sc_Add_ICMOReportBillList.html?OperationType=1&linterid=&HSouceBillType=',
|
end: function () {
|
//刷新页面,
|
location.reload();
|
}
|
});
|
}
|
//#endregion
|
|
//#region 编辑
|
function set_ShowBill() {
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
if (checkStatus.data.length === 1) {
|
var hID = data[0].hmainid.toString();
|
//if (AllowLoadData(sSubStr) != false) {//非空验证
|
layer.open({
|
type: 2
|
, area: ['100%', '100%']
|
, title: '编辑' + HPageTitle
|
, closeBtn: 1
|
, shade: 0.6 //遮罩透明度
|
, maxmin: true //允许全屏最小化
|
, anim: 0 //0-6的动画形式,-1不开启
|
, content: '../生产汇报单/Sc_Add_ICMOReportBillList.html?OperationType=3&linterid=' + hID + '&HSouceBillType='
|
, resize: false,
|
end: function () {
|
//刷新页面,
|
location.reload();
|
}
|
, cancel: function () {
|
//$(".layui-btn").removeClass("layui-btn-disabled");
|
}
|
})
|
|
} else {
|
layer.msg('请选择一行数据编辑!');
|
}
|
}
|
//#endregion
|
|
//#region 删除
|
function set_DeleteBill() {
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
if (checkStatus.data.length === 1) {
|
var InterID = data[0].hmainid.toString();
|
//逻辑删除方法
|
layer.confirm("确认要删除吗,删除后不能恢复", { title: "删除确认" }, function (index) {
|
$.ajax({
|
type: "GET",
|
url: GetWEBURL() + "Sc_ICMOReportBill/DeltetICMOReportBill", //方法所在页面和方法名
|
data: { "HInterID": InterID, "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() {
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
if (checkStatus.data.length === 1) {
|
var InterID = data[0].hmainid.toString();
|
//逻辑审核方法
|
$.ajax({
|
type: "GET",
|
url: GetWEBURL() + "/Sc_ICMOReportBill/AuditProcessReportList", //方法所在页面和方法名
|
data: { "HInterID": InterID, "IsAudit": 0, "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_AbandonCheck() {
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
if (checkStatus.data.length === 1) {
|
var InterID = data[0].hmainid.toString();
|
//逻辑审核方法
|
$.ajax({
|
type: "GET",
|
url: GetWEBURL() + "/Sc_ICMOReportBill/AuditProcessReportList", //方法所在页面和方法名
|
data: { "HInterID": InterID, "IsAudit": 1, "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
|
|
//关闭 [1 关闭、2 反关闭]
|
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].hmainid;
|
$.ajax({
|
url: GetWEBURL() + '/Sc_ICMOReportBill/CloseSc_ICMOReportBill',
|
type: "GET",
|
data: { "HInterID": HInterID, "Type": num, "user": sessionStorage["HUserName"] },
|
success: function (result) {
|
if (result.count == 1) {
|
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("请选择一条数据!");
|
}
|
}
|
|
//#region 预览
|
function get_PrintReport() {
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
if (checkStatus.data.length === 1) {
|
var InterID = data[0].hmainid.toString();
|
layer.alert("我是打印按钮!单据主ID是:" + InterID);
|
//window.open("../生产工序管理/工序汇报单/HBarPlanPrint.html?linterid=" + linterid + "&Type=HDepartMent" + "&OpenTmp=b");
|
window.open("../../基础资料/公用基础资料/HBarPlanPrint.html?linterid=" + InterID + "&Type=HDepartMent" + "&OpenTmp=b");
|
}
|
else {
|
layer.msg('请选择一行数据打印!');
|
}
|
}
|
//#endregion
|
|
//#region 保存列宽
|
function set_SaveGridColWidth() {
|
var arr = [];
|
// 列数
|
var colNum = $(".layui-table-header").find("tr").eq(0).find("th").length;
|
for (var i = 0; i <= colNum; i++) {
|
var colName = $(".layui-table-header").find("tr").eq(0).find("th").eq(i).text();
|
var colWidth = $(".layui-table-header").find("tr").eq(0).find("th").eq(i).width();
|
if (colName != "" && colName != null) {
|
arr.push(colWidth == -1 ? 200 : colWidth);
|
}
|
}
|
arr.unshift(40); //首位追加
|
$.ajax({
|
url: GetWEBURL() + '/tb_CellWidth/GetMouldScrapInHouseCellWidth',
|
async: false,
|
type: "POST",
|
dataType: "json",
|
data: { "myMap": JSON.stringify(arr), "Name": Name },
|
success: function (data1) {
|
if (data1.count == 1) {
|
layer.alert(data1.Message, { icon: 1 });
|
} else {
|
layer.alert(data1.Message, { icon: 5 });
|
}
|
}, error: function (e) {
|
layer.alert(e.Message, { icon: 5 });
|
}
|
});
|
//设置赋值列宽
|
var colWidth = getColumnsWidth();
|
if (colWidth == "" || colWidth == []) {
|
|
}
|
else {
|
$.each(columns, function (x, m) {
|
m["width"] = colWidth[x];
|
});
|
}
|
location.reload();
|
}
|
//#endregion
|
|
//#region 默认列宽
|
function set_DefaultGridColWidth() {
|
var arr = [];
|
// 列数
|
var colNum = $(".layui-table-header").find("tr").eq(0).find("th").length;
|
for (var i = 0; i <= colNum; i++) {
|
var colName = $(".layui-table-header").find("tr").eq(0).find("th").eq(i).text();
|
if (colName != "" && colName != null) {
|
arr.push(200); //默认宽度200
|
}
|
}
|
arr.unshift(40); //首位追加
|
$.ajax({
|
url: GetWEBURL() + '/tb_CellWidth/GetMouldScrapInHouseCellWidth',
|
async: false,
|
type: "POST",
|
dataType: "json",
|
data: { "myMap": JSON.stringify(arr), "Name": Name },
|
success: function (data1) {
|
if (data1.count == 1) {
|
|
} else {
|
layer.alert(data1.Message, { icon: 5 });
|
}
|
}, error: function (e) {
|
layer.alert(e.Message, { icon: 5 });
|
}
|
});
|
//设置赋值列宽
|
var colWidth = getColumnsWidth();
|
if (colWidth == "" || colWidth == []) {
|
|
}
|
else {
|
$.each(columns, function (x, m) {
|
m["width"] = colWidth[x];
|
});
|
}
|
//get_FastQuery(table, option);
|
location.reload();
|
}
|
//#endregion
|
|
//隐藏列设置
|
function get_HideColumn() {
|
var colName = "";
|
var contentUrl = "";
|
for (var i = 1; i < option.cols[0].length - 1; i++) {
|
colName += option.cols[0][i]["title"] + ",";
|
}
|
var urlStr = window.document.location.pathname;//获取文件路径
|
var urlLen = urlStr.split('/');
|
for (var i = 0; i < urlLen.length - 4; i++) {
|
contentUrl += "../";
|
}
|
colName = encodeURI(colName.substring(0, colName.length - 1));//对 URI 进行编码
|
|
contentUrl += '基础资料/隐藏列设置/Gy_GridView_Hide.html?HModName=' + HModName + '&colName=' + colName;
|
|
layer.open({
|
type: 2
|
, skin: "layui-layer-rim" //加上边框
|
, title: "隐藏列设置" //标题
|
, closeBtn: 1 //窗体右上角关闭 的 样式
|
, shift: 2 //弹出动画
|
, area: ["50%", "90%"] //窗体大小
|
, maxmin: true //设置最大最小按钮是否显示
|
, content: [contentUrl, "yes"]
|
, btn: ["确定", "取消"]
|
, btn1: function (index, laero) {
|
//刷新表格数据
|
DisPlay_HideColumn();
|
//更新表格缓存的数据
|
layer.close(index);//关闭弹窗
|
}
|
})
|
}
|
|
//显示列数据
|
function DisPlay_HideColumn() {
|
$.ajax({
|
url: GetWEBURL() + '/Xt_grdAlignment_WMES/grdAlignmentWMESList',
|
type: "GET",
|
data: { "HModName": HModName, "user": sessionStorage["HUserName"] },
|
success: function (data1) {
|
if (data1.data.length != 0) {
|
|
|
var dataCol = [];//数据库查询出的列数据
|
var titleData = ["hmainid", "HEntryID", "作废人", "作废日期", "销售订单日期", "订单跟踪号", "HDeptID", "HMaterID", "hunitid", "hempid", "业务员代码", "业务员", "hcusid", "客户代码", "客户", "HCenterID", "工作中心代码", "工作中心", "hbomid", "BOM单编码", "HRoutingInterID", "工艺路线代码", "工艺路线", "订单包装备注", "hsubid", "源单单号", "源单主内码", "源单子内码", "行关闭人", "关闭类型", "单据类型", "计划跟踪号"];//不需要显示的字段 可扩展
|
|
dataCol = data1.data[0].HGridString.split(',');
|
|
for (var i = 0; i < option.cols[0].length - 2; i++) {
|
if (dataCol[i]) {
|
var dataCols = dataCol[i].split('|');
|
}
|
//隐藏列
|
if (dataCols[1] == 1) {
|
option.cols[0][i + 1]["hide"] = true;
|
}
|
//设置列宽
|
if (dataCols[3] > 0) {
|
option.cols[0][i + 1]["width"] = dataCols[3];
|
}
|
//设置内容字体大小
|
if (data1.data[0].HFontSize != 0) {
|
option.cols[0][i + 1]["style"] = "font-size:" + data1.data[0].HFontSize + "px;";
|
} else {
|
option.cols[0][i + 1]["style"] = "font-size:100%";
|
}
|
//设置列宽
|
//if (data1.data[0].HColumnWidth != 0) {
|
// option.cols[0][i + 1]["width"] = data1.data[0].HColumnWidth + "px;";
|
//} else {
|
// option.cols[0][i + 1]["width"] = "";
|
//}
|
//显示列
|
if (dataCols[1] == 0 && $.inArray(option.cols[0][i + 1]["title"], titleData) == -1) {
|
option.cols[0][i + 1]["hide"] = false;
|
}
|
//字体所在位置(左 居中 右)
|
switch (dataCols[2]) {
|
case "L":
|
option.cols[0][i + 1]["align"] = "left";
|
break;
|
case "M":
|
option.cols[0][i + 1]["align"] = "center";
|
break;
|
case "R":
|
option.cols[0][i + 1]["align"] = "right";
|
break;
|
}
|
}
|
|
//取消冻结列
|
for (var i = 1; i < option.cols[0].length - 1; i++) {
|
if (option.cols[0][i]["fixed"] != null) {
|
option.cols[0][i]["fixed"] = null;
|
}
|
else {
|
break;
|
}
|
}
|
//冻结列
|
if (data1.data[0].HFixCols != 0) {
|
for (var i = 0; i < data1.data[0].HFixCols; i++) {
|
if ($.inArray(option.cols[0][i + 1]["title"], titleData) != -1) {
|
data1.data[0].HFixCols += 1;
|
}
|
option.cols[0][i + 1]["fixed"] = "left";
|
}
|
}
|
table.render(option);
|
} else {
|
table.render(option);
|
}
|
|
var btns = document.getElementsByTagName("button"); //获取本页所有按钮对象
|
var HBillType = "3710";
|
Display_HideButton(btns, HBillType, HModName, sessionStorage["HUserName"]);
|
|
}, error: function () {
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
})
|
}
|
|
//列明显示下拉框
|
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);
|
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";
|
//执行查询方法
|
get_FastQuery()
|
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
|
//#region 获取参数
|
function getUrlVars() {
|
var vars = [], hash;
|
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
|
for (var i = 0; i < hashes.length; i++) {
|
hash = hashes[i].split('=');
|
vars.push(hash[0]);
|
vars[hash[0]] = hash[1];
|
}
|
return vars;
|
}
|
//#endregion
|
//#region 判断是直接打开页面还是其它页面通过选择按钮打开,并显示相应数据
|
function addSWhereByOpenType() {
|
//获取参数
|
var params = getUrlVars();
|
var openType = params[params[0]]; //从参数中获取 打开方式 1直接打开 2其它页面通过选择按钮打开
|
var HOrgID = params[params[1]];
|
|
var addSWhere = "";
|
|
if (openType == 2) {
|
addSWhere = " and 状态 = '已审核' and 行状态 = '' and HOrgID = " + HOrgID;
|
}
|
return addSWhere;
|
}
|
//#endregion
|
|
//#endregion
|
|
|
});
|
|
//#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>
|