<!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/zgqCustom/zgqCustom.js"></script>
|
<style type="text/css">
|
input.layui-input.layui-unselect {
|
padding-right: 0;
|
}
|
</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" style="margin-left: 120px;width: 184px;">
|
<select name="HState" lay-verify="HState" id="HState">
|
<option value="0" selected="selected">全部</option>
|
<option value="1">未开工</option>
|
<option value="3">已入库</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" 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 " id="HEndDate" style="width:190px;">
|
</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">
|
<label class="layui-form-label">合计公斤数</label>
|
<div class="layui-input-block" style="margin-left: 120px;">
|
<input type="text" class="layui-input ForFilteringSchemes" name="SumHMaterOutQty" id="SumHMaterOutQty" disabled="disabled">
|
</div>
|
</div>
|
<!--<div class="layui-inline">
|
<div style="padding-left: 10px;">
|
<input type="checkbox" name="checkWRuku" id="checkWRuku" lay-skin="primary" lay-filter="checkWRuku" title="未下推及已入库">
|
</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" style="padding: 0px; margin-left: 6%;">
|
<div class="layui-row" style="margin-top:10px;">
|
<!--其他条件-->
|
<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="HMaterNumber" id="HMaterNumber">
|
</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="HBillNo" id="HBillNo">
|
</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="HProductName" id="HProductName">
|
</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="HProductModel" id="HProductModel">
|
</div>
|
</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="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>
|
<div class="layui-row" style="margin-top: 10px; margin-bottom: 10px ">
|
<div class="layui-inline">
|
<label class="layui-form-label">过滤</label>
|
<div class="layui-input-block">
|
<select name="ColName1" id="ColName1" class="ForFilteringSchemes" lay-filter="ColName1" style="width:190px;">
|
</select>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<select name="Comparator1" id="Comparator1" lay-filter="Comparator1" class="ForFilteringSchemes" 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="ColContent1" id="ColContent1">
|
</div>
|
</div>
|
|
<div class="layui-row" style="margin-top: 10px; margin-bottom: 10px ">
|
<div class="layui-inline">
|
<label class="layui-form-label">过滤</label>
|
<div class="layui-input-block">
|
<select name="ColName2" id="ColName2" class="ForFilteringSchemes" lay-filter="ColName2" style="width:190px;">
|
</select>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<select name="Comparator2" id="Comparator2" lay-filter="Comparator2" class="ForFilteringSchemes" 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="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">
|
<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="btn-exit"><i class="layui-icon layui-icon-return"></i>退出</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="HideColumn"><i class="layui-icon layui-icon-form"></i>隐藏列设置</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-detail"><i class="layui-icon layui-icon-return"></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>
|
</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
|
, util = layui.util
|
//#region 【过滤方案】
|
|
//过滤条件的class类
|
var HClassTag = "ForFilteringSchemes";
|
//模块名称(中文版) 每个模块页面都需要修改
|
window.HModuleName = "白坯发布明细报表";
|
//是否已经选择了过滤方案(全局变量)
|
window.HDefaultFilter = "";
|
//选择的过滤方案内码(全局变量)
|
window.HInterID_Choose = 0;
|
|
//#endregion
|
//查询条件
|
var sWhere = "";
|
var option = [];
|
var HModName = "MaterOutSumReport_Cloth";
|
|
var titleData = ["HCusID"];//不需要显示的字段 可扩展
|
|
var ins; //用于导出excel
|
//#endregion
|
|
//#region 进入页面既加载
|
|
//#region 初始化界面
|
set_ClearBill();
|
|
//#endregion
|
|
//#region 点击事件包括on form事件等
|
//头工具栏事件
|
table.on('toolbar(mainTable)', function (obj) {
|
switch (obj.event) {
|
//导出excel
|
case 'get_export':
|
get_Export();
|
break;
|
//退出
|
case 'btn-exit': Pub_Close(2);
|
break;
|
//隐藏列设置
|
case 'HideColumn':
|
get_HideColumn();
|
break;
|
//明细报表
|
case 'btn-detail':
|
get_EntryReport();
|
break;
|
//保存方案
|
case 'set_SaveScheme': set_SaveScheme();
|
break;
|
//读取方案
|
case 'set_ReadScheme': set_ReadScheme();
|
break;
|
};
|
});
|
//重置按钮
|
form.on('submit(btnReSearch)', function (data) {
|
set_ClearQuery();
|
});
|
//查询按钮
|
form.on('submit(btnSearch)', function (data) {
|
get_FastQuery();
|
});
|
|
//行监听事件-单击
|
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;
|
}
|
});
|
});
|
|
//行监听事件-双击
|
table.on('rowDouble(mainTable)', function (obj) {
|
//选中高亮 双击行
|
obj.tr.find(':checkbox').prop('checked', true);
|
obj.tr.find('.layui-form-checkbox').addClass('layui-form-checked'); //设置复选框选中样式
|
$(obj.tr.selector).attr({ "style": "background:#ceedfa;color:black" });//改变当前tr背景颜色和字体颜色
|
//mainTable 为表格ID 注意此处如果ID不正确将导致你在监听复选框时获取不到你选择的数据,前面的只是添加或删除选中未选中样式以及设置背景色,字体颜色
|
layui.each(table.cache.mainTable, function (i, l) {
|
if (obj.tr.index() == l.LAY_TABLE_INDEX) {
|
l.LAY_CHECKED = true;
|
}
|
});
|
|
//下推
|
var sBillNo = obj.data["单据号"];
|
layer.open({
|
type: 2
|
, area: ['90%', '90%']
|
, title: '白坯发布明细报表'
|
, closeBtn: 1
|
, shade: 0.6 //遮罩透明度
|
, maxmin: true //允许全屏最小化
|
, anim: 0 //0-6的动画形式,-1不开启
|
, content: 'Kf_MaterOutEntryReport_Cloth.html?sBillNo=' + sBillNo
|
, resize: false
|
, btn: ["确定", "取消"]
|
, end: function () {
|
//刷新页面,
|
//location.reload();
|
}
|
, cancel: function () {
|
//$(".layui-btn").removeClass("layui-btn-disabled");
|
}
|
})
|
|
});
|
|
////监听任意字段过滤-:根据选中的字段,变更输入框的输入形式
|
layui.use(['form'], function () {
|
var form = layui.form;
|
form.on('select(ColName)', function (data) {
|
if (data.value == "日期") {
|
document.getElementById("ColContent").type = "date";
|
} else {
|
document.getElementById("ColContent").type = "text";
|
}
|
})
|
})
|
|
//#endregion
|
|
//#region 此页面所有的方法
|
|
//初始化界面
|
function set_ClearBill() {
|
//初始化时间
|
$("#HBeginDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * 10), "yyyy-MM-dd"));//开始日期
|
$("#HEndDate").val(Format(new Date(), "yyyy-MM-dd"));//结束日期
|
//初始化表格
|
set_InitGrid();
|
//加载数据到网格
|
get_FastQuery();
|
DisPlay_HideColumn();
|
//查询当前登录用户有没有在当前模块设置默认过滤方案
|
get_DefaultModule();
|
//ColFilter();
|
}
|
|
//初始化表格
|
function set_InitGrid() {
|
var HBeginDate = $("#HBeginDate").val();//下达日期 开始日期
|
var HEndDate = $("#HEndDate").val();//结束日期
|
var HMaterNumber = $("#HMaterNumber").val();//物料代码
|
var HBillNo = $("#HBillNo").val(); //单据号
|
var HProductName = $("#HProductName").val();//产品名称
|
var HProductModel = $("#HProductModel").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();
|
|
//拼接任一字段过滤查询条件
|
var com = "";
|
if (ColName != 0 && Comparator != 0) {
|
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;
|
}
|
com = " and ([" + ColName + "] " + com + ")";
|
}
|
var com1 = "";
|
if (ColName1 != 0 && Comparator1 != 0) {
|
|
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;
|
com1 = " and ([" + ColName1 + "] " + com1 + ")";
|
}
|
|
var com2 = "";
|
if (ColName2 != 0 && Comparator2 != 0) {
|
|
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;
|
}
|
com2 = " and ([" + ColName2 + "] " + com2 + ")";
|
// swhere += " and " + colname2 + " " + com2;
|
}
|
|
com = com + com1+com2;
|
|
//根据用户过滤用户关联客户的记录
|
var OtherSearch = getSWhereByHUser();
|
|
|
sWhere = {
|
HBeginDate: HBeginDate
|
, HEndDate: HEndDate
|
, HMaterNumber: HMaterNumber
|
, HBillNo: HBillNo
|
, HProductName: HProductName
|
, HProductModel: HProductModel
|
, RandomSearch: com
|
, OtherSearch: (OtherSearch == null || OtherSearch == "undefine") ? " and 1=1 " : OtherSearch
|
}
|
|
sWhere = JSON.stringify(sWhere);
|
|
|
//动态列-缓存列表
|
$.ajax({
|
url: GetWEBURL() + "/MaterOutSumReport/MaterOutSumReport_Cloth",
|
type: "GET",
|
async: false,
|
data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
|
//async: false,
|
success: function (data1) {
|
|
if (data1.count == 1) {
|
var totalArray = ["生产任务单数量", "白胚发布"];
|
|
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 ($.inArray(data[i].name, totalArray) > -1) {
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, totalRow: true, width: 120 });
|
}
|
else if (data[i].ColName == '白坯发布') {
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, totalRow: true });
|
}
|
else {
|
switch (data[i].Type) {
|
//int
|
case 'DateTime':
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true});
|
break;
|
default:
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true });
|
}
|
}
|
}
|
option = {
|
elem: '#mainTable'
|
, toolbar: '#toolbarDemo'
|
, cellMinWidth: 120
|
, limit: Number.MAX_VALUE // 数据表格默认全部显示
|
, totalRow: true
|
, height: 'full-70'
|
, cols: [col]
|
, data: data1.data
|
};
|
ins = table.render(option);
|
} else {
|
option = {
|
elem: '#mainTable'
|
, toolbar: '#toolbarDemo'
|
, cellMinWidth: 120
|
, limit: Number.MAX_VALUE // 数据表格默认全部显示
|
, totalRow: true
|
, height: 'full-70'
|
, cols: [[
|
{ type: 'checkbox', fixed: 'left', totalRowText: '合计' }
|
, { field: '日期', title: '日期', width: 160 }
|
, { field: '单据号', title: '单据号', width: 160 }
|
, { field: '产品代码', title: '产品代码', width: 160 }
|
, { field: '产品名称', title: '产品名称', width: 160 }
|
, { field: '规格型号', title: '规格型号', width: 160 }
|
, { field: '克重', title: '克重', width: 160 }
|
, { field: '生产任务单数量', title: '生产任务单数量', width: 160 }
|
, { field: '理论公斤数', title: '理论公斤数', width: 160 }
|
, { field: '白坯发布', title: '白坯发布', width: 160 }
|
, { field: '发布米数', title: '发布米数', width: 160 }
|
, { field: '白胚占比%', title: '白胚占比%', width: 160 }
|
, { field: '业务员', title: '业务员', width: 160 }
|
, { field: '客户', title: '客户', width: 160 }
|
, { field: '生产任务单数量', title: '生产任务单数量', totalRow: true, width: 200 }
|
, { field: '白坯发布', title: '白坯发布', width: 160, totalRow: true }
|
, { field: '是否取库存', title: '是否取库存', width: 160 }
|
]]
|
, done: function (res) {
|
}
|
};
|
ins = table.render(option);
|
}
|
},
|
error: function (err) {
|
layer.msg('错误' + err, {
|
icon: 5,
|
time: 20000
|
}, function () {
|
//do something
|
});
|
}
|
})
|
}
|
|
//列明显示下拉框
|
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');
|
|
$("#ColName1").empty();
|
$("#ColName1").append(Organization);
|
form.render('select');
|
|
$("#ColName2").empty();
|
$("#ColName2").append(Organization);
|
form.render('select');
|
}
|
|
|
//加载网格
|
function get_Display(sWhere) {
|
var wait = layer.load();//遮罩
|
$.ajax({
|
url: GetWEBURL() + '/MaterOutSumReport/MaterOutSumReport_Cloth',
|
async:false,
|
type: "GET",
|
data: { "sWhere": sWhere, "user": sessionStorage["HUserName"]},
|
success: function (data1) {
|
if (data1.count == 1) {
|
//调整日期格式:显示 年月日 和 时
|
for (var i = 0; i < data1.data.length; i++) {
|
if (data1.data[i].日期 != null) {
|
data1.data[i].日期 = data1.data[i]["日期"].split("T")[0];
|
}
|
}
|
|
var totalArray = ["生产数量", "白坯发布"];
|
|
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, totalArray) > -1) {
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, totalRow: true, width: 120 });
|
}
|
else if (data[i].ColName == '白坯发布') {
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, totalRow: true });
|
}
|
else {
|
switch (data[i].Type) {
|
//int
|
case 'DateTime':
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true });
|
break;
|
default:
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true });
|
}
|
}
|
}
|
|
|
option.cols = [col];
|
option.data = data1.data;
|
|
option.data = data1.data;
|
//var num = 0;
|
//for (let i = 0; i < data1.data.length; i++) {
|
// for (let j = i + 1; j < data1.data.length; j++) {
|
// if (data1.data[i].流转卡号 === data1.data[j].流转卡号) {
|
// //num += data1.data[i].整批;
|
// //data1.data[i].filter(() => {
|
// // return
|
// //})
|
// data1.data[j].整批 = '';
|
// }
|
// }
|
//}
|
ins = table.render(option);
|
|
//计算合计公斤数
|
var sumHMaterOutQty = 0;
|
for (var i = 0; i < data1.data.length; i++) {
|
sumHMaterOutQty += data1.data[i]["白坯发布"];
|
}
|
$("#SumHMaterOutQty").val(sumHMaterOutQty);
|
|
layer.close(wait);
|
} else {
|
$("#SumHMaterOutQty").val("");
|
layer.close(wait);
|
layer.alert(data1.Message, { icon: 5 });
|
}
|
}, error: function () {
|
$("#SumHMaterOutQty").val("");
|
layer.close(wait);
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
});
|
}
|
|
//快速过滤
|
function get_FastQuery() {
|
var HBeginDate = $("#HBeginDate").val();//下达日期 开始日期
|
var HEndDate = $("#HEndDate").val();//结束日期
|
var HMaterNumber = $("#HMaterNumber").val();//物料代码
|
var HBillNo = $("#HBillNo").val(); //单据号
|
var HProductName = $("#HProductName").val();//产品名称
|
var HProductModel = $("#HProductModel").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();
|
|
//拼接任一字段过滤查询条件
|
var com = "";
|
if (ColName != 0 && Comparator != 0) {
|
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;
|
}
|
com = " and ([" + ColName + "] " + com + ")";
|
}
|
var com1 = "";
|
if (ColName1 != 0 && Comparator1 != 0) {
|
|
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;
|
com1 = " and ([" + ColName1 + "] " + com1 + ")";
|
}
|
|
var com2 = "";
|
if (ColName2 != 0 && Comparator2 != 0) {
|
|
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;
|
}
|
com2 = " and ([" + ColName2 + "] " + com2 + ")";
|
// swhere += " and " + colname2 + " " + com2;
|
}
|
//根据用户过滤用户关联客户的记录
|
var OtherSearch = com + com1 + com2 + getSWhereByHUser();
|
|
sWhere = {
|
HBeginDate: HBeginDate
|
, HEndDate: HEndDate
|
,HMaterNumber: HMaterNumber
|
, HBillNo: HBillNo
|
, HProductName: HProductName
|
, HProductModel: HProductModel
|
, RandomSearch: com
|
, OtherSearch: (OtherSearch == null || OtherSearch == "undefine") ? " and 1=1 " : OtherSearch
|
}
|
//set_InitGrid(JSON.stringify(sWhere));
|
get_Display(JSON.stringify(sWhere));
|
//调用接口后清空sWhere缓存
|
sWhere = "";
|
}
|
|
//重置过滤条件
|
function set_ClearQuery() {
|
$("#HBeginDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * 30), "yyyy-MM-dd"));//开始日期
|
$("#HEndDate").val(Format(new Date(), "yyyy-MM-dd"));//结束日期
|
$("#HMaterNumber").val("");
|
$("#HBillNo").val("");
|
$("#HProductName").val("");
|
$("#HProductModel").val("");
|
$("#ColContent").val("");
|
$("#ColName").val("0");
|
$("#Comparator").val("0");
|
|
$("#ColContent1").val("");
|
$("#ColName1").val("0");
|
$("#Comparator1").val("0");
|
|
$("#ColContent2").val("");
|
$("#ColName2").val("0");
|
$("#Comparator2").val("0");
|
form.render()
|
ColFilter();
|
sWhere = "";
|
}
|
|
|
//隐藏列设置
|
function get_HideColumn() {
|
var colName = "";
|
for (var i = 1; i < option.cols[0].length; i++) {
|
colName += option.cols[0][i]["title"] + ",";
|
}
|
|
colName = encodeURI(colName.substring(0, colName.length - 1));//对 URI 进行编码
|
layer.open({
|
type: 2
|
, skin: "layui-layer-rim" //加上边框
|
, title: "隐藏列设置" //标题
|
, closeBtn: 1 //窗体右上角关闭 的 样式
|
, shift: 2 //弹出动画
|
, area: ["50%", "90%"] //窗体大小
|
, maxmin: true //设置最大最小按钮是否显示
|
, content: ['../../基础资料/隐藏列设置/Gy_GridView_Hide.html?HModName=' + HModName + '&colName=' + colName, "yes"]
|
, btn: ["确定", "取消"]
|
, btn1: function (index, laero) {
|
//刷新表格数据
|
DisPlay_HideColumn();
|
//更新表格缓存的数据
|
layer.close(index);//关闭弹窗
|
}
|
})
|
}
|
|
//显示列数据
|
function DisPlay_HideColumn() {
|
ColFilter();
|
$.ajax({
|
url: GetWEBURL() + '/Xt_grdAlignment_WMES/grdAlignmentWMESList',
|
async:false,
|
type: "GET",
|
data: { "HModName": HModName, "user": sessionStorage["HUserName"] },
|
success: function (data1) {
|
if (data1.data.length != 0) {
|
|
var dataCol = [];//数据库查询出的列数据
|
/*var titleData = [];//不需要显示的字段 可扩展*/
|
|
dataCol = data1.data[0].HGridString.split(',');
|
|
for (var i = 0; i < option.cols[0].length - 1; i++) {
|
if (dataCol[i]) {
|
var dataCols = dataCol[i].split('|');
|
}
|
//隐藏列
|
if (dataCols[1] == 1) {
|
option.cols[0][i + 1]["hide"] = true;
|
}
|
//设置内容字体大小
|
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 (dataCols[3] > 0) {
|
option.cols[0][i + 1]["width"] = dataCols[3];
|
}
|
//显示列
|
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);
|
}
|
}, error: function () {
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
})
|
}
|
//明细报表
|
function get_EntryReport() {
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
if (checkStatus.data.length === 1) {
|
var sBillNo = data[0]["单据号"];
|
layer.open({
|
type: 2
|
, area: ['90%', '90%']
|
, title: '白坯发布明细报表'
|
, closeBtn: 1
|
, shade: 0.6 //遮罩透明度
|
, maxmin: true //允许全屏最小化
|
, anim: 0 //0-6的动画形式,-1不开启
|
, content: 'Kf_MaterOutEntryReport_Cloth.html?sBillNo=' + sBillNo
|
, resize: false
|
, btn: ["确定", "取消"]
|
, end: function () {
|
//刷新页面,
|
//location.reload();
|
}
|
, cancel: function () {
|
//$(".layui-btn").removeClass("layui-btn-disabled");
|
}
|
})
|
|
} else {
|
layer.msg('请选择一行数据编辑!');
|
}
|
}
|
|
//#region 导出Execel
|
function get_Export() {
|
var ModRightNameCheck = "Kf_MaterOutSumReport_Cloth_ExportExcel";
|
|
//逻辑审核方法
|
$.ajax({
|
type: "GET",
|
url: GetWEBURL() + "/LMES/getReportByModRightNameCheck", //方法所在页面和方法名
|
data: { "ModRightNameCheck": ModRightNameCheck, "user": sessionStorage["HUserName"] },
|
success: function (result) {
|
if (result.count == 1) {
|
table.exportFile(ins.config.id, option.data, "xls");
|
} else {
|
layer.alert("当前模块没有导出权限!", { icon: 5 });
|
}
|
}, error: function () {
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
});
|
}
|
//#endregion
|
|
//#region 根据用户获取用户关联客户的过滤条件
|
function getSWhereByHUser() {
|
var res = "";
|
$.ajax({
|
type: "GET",
|
async: false,
|
url: GetWEBURL() + "/Xs_SeOrderBill/getCusIDListByUser", //方法所在页面和方法名
|
data: { "CurUserID": sessionStorage["Czybm"], "CurUserName": sessionStorage["HUserName"] },
|
success: function (result) {
|
if (result.count == 1) {
|
res = result.data;
|
} else {
|
res = result.data;
|
layer.alert(result.code + result.Message, { icon: 5 });
|
}
|
}, error: function (err) {
|
res = " and 1 = 0";
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
});
|
res = res.replaceAll("'", "''");
|
return res;
|
}
|
//#endregion
|
//#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 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>
|