<!DOCTYPE html>
|
<html>
|
<head>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<title>SPC检验单分析</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>
|
<script src='../../../layuiadmin/lib/extend/echarts.min.js'></script>
|
<script src="../../../layuiadmin/soulTable.slim.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">
|
<input type="date" class="layui-input" id="HBeginDate" style="width:160px;">
|
</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:160px;">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label">部门</label>
|
<div class="layui-input-block">
|
<select name="HDeptName" id="HDeptName" lay-verify="required" lay-search class="layui-input">
|
<!--动态渲染车间-->
|
</select>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label">样本数</label>
|
<div class="layui-input-block">
|
<select name="limit" id="limit" lay-verify="required" lay-search class="layui-input">
|
<!--动态渲染车间-->
|
</select>
|
</div>
|
</div>
|
<button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnSearch" id="btnSearch">
|
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
|
</button>
|
<button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnReSearch" id="btnReSearch" style="padding:0 5px">重置</button>
|
|
<div class="layui-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;padding: 9px 18px;">物料代码</label>
|
<div class="layui-input-block" style="margin-left: 120px;">
|
<input type="hidden" class="layui-input" lay-verify="HMaterID" name="HMaterID" id="HMaterID" value="0">
|
<input type="text" class="layui-input" name="HMaterNumber" id="HMaterNumber" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
|
<button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnHMaterID" id="btnHMaterID" style="padding: 0 10px; margin-right: 3px;">
|
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
|
</button>
|
</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" name="HMaterName" id="HMaterName" style="background-color:#efefef4d;" readonly>
|
</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" name="HMaterModel" id="HMaterModel" style="background-color:#efefef4d;" readonly>
|
</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" name="HUpLoad" id="HUpLoad">
|
</div>
|
</div>
|
</div>
|
<div class="layui-row" style="margin-top:5px;">
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;padding: 9px 18px;">检验项目</label>
|
<div class="layui-input-block" style="margin-left: 120px;">
|
<input type="hidden" class="layui-input" lay-verify="HQCCheckItemID" name="HQCCheckItemID" id="HQCCheckItemID" value="0">
|
<input type="text" class="layui-input" name="HQCCheckItemNumber" id="HQCCheckItemNumber" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
|
<button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnHQCCheckItemID" id="btnHQCCheckItemID" style="padding: 0 10px;margin-right: 3px;">
|
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
|
</button>
|
</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" id="HUnitName">
|
</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" id="HStandard">
|
</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" id="HDownLoad">
|
</div>
|
</div>
|
</div>
|
<div class="layui-row" style="margin: 10px 0 10px;display:none;">
|
<div class="layui-inline">
|
<label class="layui-form-label">过滤</label>
|
<div class="layui-input-block">
|
<select name="ColName" id="ColName" lay-filter="ColName" style="width:190px;">
|
</select>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<select name="Comparator" id="Comparator" 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" value="" name="ColContent" id="ColContent">
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
<div>
|
<table class="" id="mainTable" lay-filter="mainTable"></table>
|
<div id="histogram_Avg" style="width:99.5%;height:calc(35vh);margin-top:5px;">
|
|
</div>
|
<div id="histogram_Diff" style="width:99.5%;height:calc(35vh);margin-top:5px;">
|
|
</div>
|
</div>
|
<script type="text/html" id="toolbarDemo">
|
<div class="layui-btn-container">
|
<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>
|
</div>
|
</script>
|
</form>
|
</div>
|
</div>
|
</div>
|
</div>
|
|
<script>
|
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
|
, util = layui.util
|
, soulTable = layui.soulTable
|
//查询条件
|
var sWhere = "";
|
var option = [];
|
var HModName = "QC_InspectionFormReport";
|
var optionAVG = [];
|
var optionS = [];
|
//#endregion
|
|
//#region 进入页面既加载
|
|
//初始化界面
|
set_ClearBill();
|
|
//#endregion
|
|
|
|
//#region 点击事件包括on form事件等
|
//头工具栏事件
|
table.on('toolbar(mainTable)', function (obj) {
|
switch (obj.event) {
|
//退出
|
case 'btn-exit': Pub_Close(2);
|
break;
|
//隐藏列设置
|
case 'HideColumn':
|
get_HideColumn();
|
break;
|
};
|
});
|
|
//#region 产品编码
|
form.on('submit(btnHMaterID)', function (data) {
|
btnHMaterID();
|
});
|
//#endregion
|
|
//#region 检验项目
|
form.on('submit(btnHQCCheckItemID)', function (data) {
|
btnHQCCheckItemID();
|
});
|
//#endregion
|
|
//重置按钮
|
form.on('submit(btnReSearch)', function (data) {
|
set_ClearQuery();
|
});
|
//查询按钮
|
form.on('submit(btnSearch)', function (data) {
|
get_FastQuery();
|
});
|
|
//车间弹窗
|
form.on('submit(HWorkShopList)', function () {
|
//页面层-自定义
|
layer.open({
|
type: 2,
|
skin: 'layui-layer-rim', //加上边框
|
title: '车间列表',
|
closeBtn: 1,
|
shift: 2,
|
area: ['80%', '80%'],
|
maxmin: true,
|
content: ['../../基础资料/公用基础资料/Gy_DepartmentList.html', 'yes'],
|
btn: ['确定', '取消']
|
, btn1: function (index, layero) {
|
|
//按钮【按钮一】的回调
|
var iframeWindow = window['layui-layer-iframe' + index] //获取弹框页面
|
var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
|
if (checkStatus.data.length === 0) {
|
return layer.msg('请选择数据');
|
}
|
$("#HWorkShopName").val(checkStatus.data[0].部门名称);
|
$("#HWorkShopID").val(checkStatus.data[0].HItemID);
|
layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
|
}
|
, btn2: function (index, layero) {
|
//按钮【按钮二】的回调
|
//return false 开启该代码可禁止点击该按钮关闭
|
},
|
end: function () {
|
|
},
|
success: function (layero, index) {
|
|
}
|
});
|
});
|
|
//#endregion
|
|
//#region 此页面所有的方法
|
|
//初始化界面
|
function set_ClearBill() {
|
get_Dept();
|
get_Limit();
|
//初始化时间
|
$("#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();
|
set_Line();
|
}
|
|
//初始化表格
|
function set_InitGrid() {
|
var columns = [];
|
|
//columns.push({ type: 'numbers', title: '序号' });
|
columns.push({ field:"Id", title: "序号", width: 70 });
|
|
//获取两个月期之间的相差
|
var time1 = Date.parse(new Date($("#HBeginDate").val()));//开始时间
|
var time2 = Date.parse(new Date($("#HEndDate").val()));//结束时间
|
var Days = Math.abs(parseInt((time2 - time1) / 1000 / 3600 / 24));
|
//获取年
|
var yyyy = new Date($("#HBeginDate").val()).getFullYear();
|
//获取月份
|
var MM = new Date($("#HBeginDate").val()).getMonth() + 1;
|
//获取开始月份的最大天数
|
var SumMonth = new Date(yyyy, MM, 0).getDate(); //动态两月之差
|
//获取开始日期的天数
|
var HBEGINDATE = new Date(new Date($("#HBeginDate").val())).getDate(); //获取开始日期天数
|
|
var k = 0;//收集循环次数
|
for (var j = 0; j <= (Days - k); j++) {
|
columns.push({ field: Format(yyyy + '/' + MM + '/' + (HBEGINDATE + j), 'yyyy-MM-dd'), title: Format(yyyy + '/' + MM + '/' + (HBEGINDATE + j), 'MM.dd'), width: 120 })
|
//跨年的话 会从一月一号开始
|
if (MM == 12 && (HBEGINDATE + j) == 31) {
|
yyyy += 1;
|
MM = 1;
|
SumMonth = new Date(yyyy, MM, 0).getDate();
|
HBEGINDATE = 0;
|
k += j;
|
j = 0;
|
} else if ((HBEGINDATE + j) == SumMonth) { //跨月 月数加一 天数从一开始
|
HBEGINDATE = 0;
|
MM += 1;
|
SumMonth = new Date(yyyy, MM, 0).getDate();
|
k += j;
|
j = 0;
|
}
|
}
|
|
option = {
|
elem: '#mainTable'
|
, toolbar: '#toolbarDemo'
|
, height: 'full-50'
|
, cellMinWidth: 90
|
, limit: 500
|
, loading: false
|
, cols: [columns]
|
, done: function (res, curr, count) {
|
soulTable.render(this);
|
}
|
};
|
table.render(option);
|
}
|
|
//加载网格
|
function get_Display(sWhere) {
|
var wait = layer.load();//遮罩
|
$.ajax({
|
url: GetWEBURL() + '/QC_CustomerAppealReport/QC_InspectionFormReport',
|
type: "GET",
|
async: false,
|
data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
|
success: function (data1) {
|
if (data1.count == 1) {
|
var limit = parseInt($("#limit").val());//样本数
|
option.data = data1.data;
|
optionAVG = data1.data[limit + 1];
|
optionS = data1.data[limit + 2];
|
table.render(option);
|
layer.close(wait);
|
set_Line();
|
} else {
|
layer.close(wait);
|
layer.alert(data1.Message, { icon: 5 });
|
}
|
}, error: function () {
|
layer.close(wait);
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
});
|
}
|
|
//折线图
|
function set_Line() {
|
//#region【折线图】
|
//平均值
|
var chartDom = document.getElementById('histogram_Avg');
|
var myChart = echarts.init(chartDom);
|
var option_ZXT_Avg;
|
|
let H_X = [];//x轴标题
|
let HAvg = [];//平均值
|
let HDifference = [];//差值
|
|
//获取两个月期之间的相差
|
var time1 = Date.parse(new Date($("#HBeginDate").val()));//开始时间
|
var time2 = Date.parse(new Date($("#HEndDate").val()));//结束时间
|
var Days = Math.abs(parseInt((time2 - time1) / 1000 / 3600 / 24));
|
//获取年
|
var yyyy = new Date($("#HBeginDate").val()).getFullYear();
|
//获取月份
|
var MM = new Date($("#HBeginDate").val()).getMonth() + 1;
|
//获取开始月份的最大天数
|
var SumMonth = new Date(yyyy, MM, 0).getDate(); //动态两月之差
|
//获取开始日期的天数
|
var HBEGINDATE = new Date(new Date($("#HBeginDate").val())).getDate(); //获取开始日期天数
|
|
var k = 0;//收集循环次数
|
for (var j = 0; j <= (Days - k); j++) {
|
/* columns.push({ field: Format(yyyy + '/' + MM + '/' + (HBEGINDATE + j), 'yyyy-MM-dd'), title: Format(yyyy + '/' + MM + '/' + (HBEGINDATE + j), 'MM.dd'), width: 120 })*/
|
if (optionAVG != [] || optionS != []) {
|
HAvg.push(optionAVG[Format(yyyy + '/' + MM + '/' + (HBEGINDATE + j), 'yyyy-MM-dd')]);
|
HDifference.push(optionS[Format(yyyy + '/' + MM + '/' + (HBEGINDATE + j), 'yyyy-MM-dd')]);
|
} else {
|
HAvg.push(0);
|
HDifference.push(0);
|
}
|
|
//跨年的话 会从一月一号开始
|
if (MM == 12 && (HBEGINDATE + j) == 31) {
|
yyyy += 1;
|
MM = 1;
|
SumMonth = new Date(yyyy, MM, 0).getDate();
|
HBEGINDATE = 0;
|
k += j;
|
j = 0;
|
} else if ((HBEGINDATE + j) == SumMonth) { //跨月 月数加一 天数从一开始
|
HBEGINDATE = 0;
|
MM += 1;
|
SumMonth = new Date(yyyy, MM, 0).getDate();
|
k += j;
|
j = 0;
|
}
|
}
|
|
for (let i = 1; i <= Days; i++) {
|
H_X.push(i);
|
}
|
|
option_ZXT_Avg = {
|
title: {
|
text: '平均值',
|
left: 'center'
|
},
|
grid: {
|
x: '3%', //相当于距离左边效果:padding-left
|
//y: '5%', //相当于距离上边效果:padding-top
|
bottom: '5%',
|
containLabel: true
|
},
|
xAxis: {
|
type: 'category',
|
data: H_X
|
},
|
yAxis: {
|
type: 'value'
|
},
|
series: [
|
{
|
data: HAvg,
|
type: 'line',
|
areaStyle: {//填充的颜色
|
color: {//线性渐变前四个参数分别是 x0, y0, x2, y2, 范围从 0 - 1,相当于在图形包围盒中的百分比,如果 globalCoord 为 `true`,则该四个值是绝对的像素位置
|
type: 'linear',
|
x: 0,
|
y: 1,
|
x2: 0,
|
y2: 0,
|
colorStops: [{
|
offset: 0, color: 'rgba(232,247,247)' // 0% 处的颜色
|
}, {
|
offset: 1, color: 'rgba(183,252,252)' // 100% 处的颜色
|
}],
|
globalCoord: false// 缺省为 false
|
}
|
},
|
markLine: {
|
symbol: 'none',//去掉箭头
|
data: [
|
{ type: 'max', name: 'Max', lineStyle: { color: 'red' } },
|
{ type: 'average', name: 'Avg', lineStyle: { color: 'blue' } },
|
{ type: 'min', name: 'Min', lineStyle: { color: 'green' } },
|
]
|
|
},
|
}
|
]
|
};
|
option_ZXT_Avg && myChart.setOption(option_ZXT_Avg);
|
|
//差值
|
var chartDom = document.getElementById('histogram_Diff');
|
var myChart = echarts.init(chartDom);
|
var option_ZXT_Diff;
|
|
option_ZXT_Diff = {
|
title: {
|
text: '差值',
|
left: 'center'
|
},
|
grid: {
|
x: '3%', //相当于距离左边效果:padding-left
|
//y: '5%', //相当于距离上边效果:padding-top
|
bottom: '5%',
|
containLabel: true
|
},
|
xAxis: {
|
type: 'category',
|
data: H_X
|
},
|
yAxis: {
|
type: 'value'
|
},
|
series: [
|
{
|
data: HDifference,
|
type: 'line',
|
areaStyle: {//填充的颜色
|
color: {//线性渐变前四个参数分别是 x0, y0, x2, y2, 范围从 0 - 1,相当于在图形包围盒中的百分比,如果 globalCoord 为 `true`,则该四个值是绝对的像素位置
|
type: 'linear',
|
x: 0,
|
y: 1,
|
x2: 0,
|
y2: 0,
|
colorStops: [{
|
offset: 0, color: 'rgba(255,240,170,0)' // 0% 处的颜色
|
}, {
|
offset: 1, color: 'rgba(255,240,170,1)' // 100% 处的颜色
|
}],
|
globalCoord: false// 缺省为 false
|
}
|
},
|
markLine: {
|
symbol: 'none',//去掉箭头
|
data: [
|
{ type: 'max', name: 'Max', lineStyle: { color: 'red' } },
|
{ type: 'average', name: 'Avg', lineStyle: { color: 'blue' } },
|
{ type: 'min', name: 'Min', lineStyle: { color: 'green' } },
|
]
|
},
|
}
|
]
|
};
|
option_ZXT_Diff && myChart.setOption(option_ZXT_Diff);
|
|
//#endregion
|
|
}
|
|
//生产车间
|
function get_Dept() {
|
//获取车间列
|
var HDeptName = '<option value="0" style="color:red;" selected>全部车间</option>';
|
$.ajax({
|
type: "get",
|
url: GetWEBURL() + "/Sc_ICMOBill/GetHDeptList",
|
async: false,
|
data: { "HOrgID": sessionStorage["OrganizationID"] },
|
success: function (result) {
|
if (result.count == 1) { // 说明验证成功了,
|
var data = result.data;
|
for (var i = 0; i < data.length; i++) {
|
HDeptName += '<option style="color:blue;" value="' + data[i].HItemID + '" >' + data[i].HName + '</option>';
|
}
|
|
$("#HDeptName").append(HDeptName);
|
form.render('select');
|
}
|
layer.closeAll("loading");
|
}
|
})
|
}
|
|
//样本数量
|
function get_Limit() {
|
var limit = "";
|
for (var i = 1; i <= 50; i++) {
|
limit += '<option style="color:blue;" value="' + i + '" >' + i + '</option>';
|
}
|
$("#limit").append(limit);
|
form.render('select');
|
}
|
|
//快速过滤
|
function get_FastQuery() {
|
var HBeginDate = $("#HBeginDate").val();//下达日期 开始日期
|
var HEndDate = $("#HEndDate").val();//结束日期
|
var HDeptID = $("#HDeptName").val();//车间
|
var limit = $("#limit").val();//样本数
|
var HMaterID = $("#HMaterID").val();//物料
|
var HQCCheckItemID = $("#HQCCheckItemID").val();//检验项目
|
|
if (limit == 0) {
|
return layer.msg("样本数量不能为0!");
|
}
|
|
if (HMaterID == 0) {
|
return layer.msg("物料不能为空!");
|
}
|
|
if (HQCCheckItemID == 0) {
|
return layer.msg("检验项目不能为空!");
|
}
|
|
sWhere = {
|
HBeginDate: HBeginDate
|
, HEndDate: HEndDate
|
, HDeptID: HDeptID
|
, limit: limit
|
, HMaterID: HMaterID
|
, HQCCheckItemID: HQCCheckItemID
|
}
|
//初始化表格
|
set_InitGrid();
|
get_Display(JSON.stringify(sWhere));
|
//调用接口后清空sWhere缓存
|
sWhere = "";
|
}
|
|
//物料列表
|
function btnHMaterID() {
|
layer.open({
|
type: 2 //类型
|
, skin: 'layui-layer-rim'//加上边框
|
, area: ['90%', '90%']//大小
|
, title: '物料列表'//标题
|
, shift: 2//弹出动画
|
, content: ['../../基础资料/公用基础资料/Gy_Material.html', 'yes']
|
, btn: ['确定', '取消']
|
, btn1: function (index, layero) {//按钮【按钮一】的回调
|
var iframeWindow = window['layui-layer-iframe' + index] //获取弹框页面
|
var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
|
if (checkStatus.data.length === 0) {
|
return layer.msg('请选择数据');
|
}
|
//获取数据
|
$("#HMaterID").val(checkStatus.data[0].HItemID);
|
$("#HMaterNumber").val(checkStatus.data[0].物料代码);
|
$("#HMaterName").val(checkStatus.data[0].物料名称);
|
$("#HMaterModel").val(checkStatus.data[0].规格型号);
|
layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
|
}
|
, btn2: function (index, layero) { }
|
})
|
}
|
|
//检验项目列表
|
function btnHQCCheckItemID() {
|
layer.open({
|
type: 2 //类型
|
, skin: 'layui-layer-rim'//加上边框
|
, area: ['90%', '90%']//大小
|
, title: '检验项目列表'//标题
|
, shift: 2//弹出动画
|
, content: ['../../基础资料/公用基础资料/Gy_CheckItem.html', 'yes']
|
, btn: ['确定', '取消']
|
, btn1: function (index, layero) {//按钮【按钮一】的回调
|
var iframeWindow = window['layui-layer-iframe' + index] //获取弹框页面
|
var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
|
if (checkStatus.data.length === 0) {
|
return layer.msg('请选择数据');
|
}
|
//获取数据
|
$("#HQCCheckItemID").val(checkStatus.data[0].HItemID);
|
$("#HQCCheckItemNumber").val(checkStatus.data[0].代码);
|
layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
|
}
|
, btn2: function (index, layero) { }
|
})
|
}
|
|
|
//重置过滤条件
|
function set_ClearQuery() {
|
$("#HBeginDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * 10), "yyyy-MM-dd"));//开始日期
|
$("#HEndDate").val(Format(new Date(), "yyyy-MM-dd"));//结束日期
|
$("#HICMOBillNo").val("");
|
$("#HProcExchBillNo").val("");
|
$("#HName").val("");
|
$("#HBillNo").val("");
|
$("#HMaterNumber").val("");
|
$("#F_BSV_WYID").val("");
|
$("#HState").val("0")
|
$("#ColContent").val("");
|
$("#ColName").val("0");
|
$("#Comparator").val("0");
|
$("input[name='checkWRuku']").prop("checked", false);
|
form.render()
|
sWhere = "";
|
}
|
|
//隐藏列设置
|
function get_HideColumn() {
|
var colName = "";
|
for (var i = 1; i < option.cols[0].length - 1; 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() {
|
$.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 = [];//不需要显示的字段 可扩展
|
|
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 (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 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
|
});
|
</script>
|
</body>
|
</html>
|