<!DOCTYPE html>
|
<html>
|
<head>
|
<meta 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.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
<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/soulTable.slim.js"></script>
|
</head>
|
<body>
|
|
<div class="layui-card layadmin-header">
|
<div class="layui-breadcrumb" lay-filter="breadcrumb">
|
<a lay-href="">主页</a>
|
<!--<a><cite>采购订单</cite></a>
|
<a><cite>采购订单表格</cite></a>
|
<a><cite>采购订单表格的重载</cite></a>-->
|
</div>
|
</div>
|
|
<div class="layui-fluid">
|
<div class="layui-row layui-col-space15">
|
<div class="layui-col-md12">
|
<div class="layui-card">
|
|
<div class="layui-card-body">
|
<!--<div class="test-table-reload-btn" style="margin-bottom: 10px;">-->
|
<form class="layui-form" action="">
|
<div class="layui-form-item">
|
<div class="layui-inline">
|
<label class="layui-form-label">单据号</label>
|
<div class="layui-input-block">
|
<input type="text" class="layui-input" name="HBillNo" id="HBillNo">
|
</div>
|
</div>
|
|
<div class="layui-inline">
|
<label class="layui-form-label">开始日期</label>
|
<div class="layui-input-block">
|
<input type="text" class="layui-input" name="HDate1" id="HDate1">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label">结束日期</label>
|
<div class="layui-input-block">
|
<input type="text" class="layui-input" name="HDate2" id="HDate2">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="f_Query">
|
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
|
</button>
|
</div>
|
</div>
|
|
</form>
|
<!--</div>-->
|
</div>
|
<table class="layui-hide" id="mainTable" lay-filter="mainTable"></table>
|
<div class="layui-tab layui-tab-card">
|
<ul class="layui-tab-title">
|
<li class="layui-this">检测值</li>
|
</ul>
|
<div class="layui-tab-content">
|
<div class="layui-tab-item layui-show">
|
<!--检测值-->
|
<table class="layui-hide" id="mainTable_Value" lay-filter="mainTable_Value"></table>
|
</div>
|
</div>
|
</div>
|
<script type="text/html" id="toolbarDemo">
|
<div class="layui-btn-container">
|
<button type="button" class="layui-btn layui-btn-sm" style="display:none;" id="btn-Add" lay-event="btn-Add"><i class="layui-icon layui-icon-form"></i>新增</button>
|
<button type="button" class="layui-btn layui-btn-sm" style="display:none;" id="btn-Edit" lay-event="btn-Edit"><i class="layui-icon layui-icon-form"></i>编辑</button>
|
<button type="button" class="layui-btn layui-btn-sm" style="display:none;" id="btn-Delete" lay-event="btn-Delete"><i class="layui-icon layui-icon-form"></i>删除</button>
|
<button type="button" class="layui-btn layui-btn-sm" style="display:none;" id="set_HideColumn" lay-event="set_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>
|
</div>
|
</script>
|
</div>
|
</div>
|
</div>
|
</div>
|
|
<!--<script src="../../layuiadmin/layui/lay/modules/mobile/jquery-3.3.1.min.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/HideButton.js"></script>
|
<script>
|
var _cur_page = 1;
|
var sql = " ";
|
var titleData = ["hmainid", "hentryid", "HEntryID", "HSourceID", "HMaterID", "HFirstCheckEmp", "HQCCheckItemID", "HUnitID", "HSampleSchemeID"];
|
var checkobj = ""; //复选框
|
var trindex = ""; //默认选中行下标
|
//var options = document.getElementById('HStatus').children;
|
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;
|
}
|
|
function f_alert(sMsg) {
|
layer.alert(sMsg, { icon: 5 });
|
//layer.open({
|
// type: 1
|
// , offset: 'auto' //具体配置参考:http://www.layui.com/doc/modules/layer.html#offset
|
// , id: 'layerDemo' //防止重复弹出
|
// , content: '<div style="padding: 20px 100px;">' + sMsg + '</div>'
|
// , shade: 0 //不显示遮罩
|
// , yes: function () {
|
// layer.closeAll();
|
// }
|
//});
|
}
|
var params = getUrlVars();
|
var type = params[params[0]];
|
//switch (type) {
|
// case "UnConfirm":
|
// options[1].selected = true;
|
// sql += " and 状态 like ^^%未确认%^^";
|
// //$("#HStatus").attr("disabled", true)
|
// break;
|
// case "ReConfirm":
|
// options[2].selected = true;
|
// sql += " and 状态 like ^^%已确认%^^";
|
// sql += " and 未关联数量 > 0";
|
// break;
|
// case "ReBack":
|
// options[3].selected = true;
|
// sql += " and 状态 like ^^%已驳回%^^";
|
// break;
|
//}
|
layui.config({
|
base: '../../../layuiadmin/' //静态资源所在路径
|
}).extend({
|
index: 'lib/index' //主入口模块
|
}).use(['index', 'form', 'laydate', 'code', 'table', 'element', 'layer','soulTable'], function () {
|
var $ = layui.$
|
, admin = layui.admin
|
, layer = layui.layer
|
, laydate = layui.laydate
|
, table = layui.table
|
, form = layui.form
|
, soulTable = layui.soulTable
|
, element = layui.element;
|
|
//公用变量
|
var option = [];
|
var HModName = "QC_FirstPieceCheckBillList";
|
//不需要显示的字段 可扩展 (检测值)
|
var titleData_Value = [];
|
//隐藏勾选字段
|
DisPlay_HideColumn();
|
//常规用法
|
laydate.render({
|
elem: '#HDate1'
|
});
|
laydate.render({
|
elem: '#HDate2'
|
});
|
//layui.code();
|
RoadHBillNo(sql);
|
layer.load(3)
|
|
option = {
|
elem: '#mainTable'
|
, dateType: 'json'
|
, colFilterRecord: true//是否开启字段筛选的记忆功能
|
, data: []
|
// , url: GetWEBURL()+'GetPOOrderBill'
|
, toolbar: '#toolbarDemo' //开启头部工具栏,并为其绑定左侧模板
|
, defaultToolbar: ['filter', 'exports', 'print']
|
// , where: { msg: "", NowPage: 1, OnePage: 10 }
|
, cellMinWidth: 100
|
, limit: 50 //每页默认显示的数量
|
, limits: [50, 500, 5000, 20000]
|
, cols: [[
|
{ type: 'checkbox', fixed: 'left' }
|
, { field: 'hmainid', title: 'hmainid', sort: true, fixed: true, hide: true }
|
, { field: 'hsubid', title: 'hsubid', hide: true }
|
, { field: '日期', title: '日期', sort: true, width: 120 }
|
, { field: '单据号', title: '单据号', sort: true, width: 170 }
|
, { field: '表头备注 ', title: '表头备注', width: 105, sort: true }
|
, { field: '生产资源名称', title: '生产资源名称', sort: true }
|
, { field: '生产资源代码', title: '生产资源代码', sort: true }
|
, { field: '产品内码', title: '产品内码', sort: true }
|
, { field: '产品名称', title: '产品名称', sort: true }
|
, { field: '产品型号', title: '产品型号', width: 115, sort: true }
|
, { field: '检验员代码', title: '检验员代码', width: 115, sort: true }
|
, { field: '检验员名称', title: '检验员名称', sort: true }
|
, { field: '制单人', title: '制单人', width: 160, sort: true }
|
, { field: '制单日期', title: '制单日期', width: 160, sort: true }
|
, { field: '审核人', title: '审核人', width: 160, sort: true }
|
, { field: '审核日期', title: '审核日期', width: 160, sort: true }
|
, { field: '修改人', title: '修改人', width: 160, sort: true }
|
, { field: '修改日期', title: '修改日期', width: 160, sort: true }
|
, { field: '关闭人', title: '关闭人', width: 160, sort: true }
|
, { field: '关闭日期', title: '关闭日期', width: 160, sort: true }
|
, { field: '作废人', title: '作废人', hide: true, width: 160, sort: true }
|
, { field: '作废日期 ', title: '作废日期', width: 215, sort: true }
|
, { field: '单据类型 ', title: '单据类型 ', width: 115, sort: true }
|
]]
|
//, skin: 'row' //表格风格
|
// , even: true
|
, page: true //是否显示分页
|
//, height: 500
|
, done: function (res, curr, count) {
|
_cur_page = curr;
|
layer.closeAll("loading");
|
}
|
}
|
//方法级渲染
|
table.render(option);
|
//头工具栏事件
|
table.on('toolbar(mainTable)', function (obj) {
|
var checkStatus = table.checkStatus(obj.config.id);
|
switch (obj.event) {
|
case 'btn-getCheckData':
|
var data = checkStatus.data;
|
layer.alert(JSON.stringify(data));
|
break;
|
case 'btn-Add':
|
set_AddNew();
|
break;
|
case 'btn-Edit':
|
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: '编辑首件检验单'
|
, shade: 0.6 //遮罩透明度
|
, maxmin: true //允许全屏最小化
|
, anim: 0 //0-6的动画形式,-1不开启
|
, content: '../首件检验单/QC_Add_Edit_FirstPieceCheckBill.html?OperationType=3&hID=' + hID
|
, resize: false
|
, cancel: function () {
|
//$(".layui-btn").removeClass("layui-btn-disabled");
|
}
|
})
|
|
} else {
|
layer.msg('请选择一行数据编辑!');
|
}
|
|
break;
|
case 'btn-Delete':
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
if (checkStatus.data.length === 1) {
|
var InterID = data[0].hmainid.toString();
|
//逻辑删除方法
|
layer.confirm("确认要删除吗,删除后不能恢复", { title: "删除确认" }, function (index) {
|
var wait = layer.load();
|
$.ajax({
|
url: GetWEBURL() + 'DeltetQC_FirstPieceCheck',
|
type: "GET",
|
data: { "HInterID": InterID, "user": sessionStorage["HUserName"] },
|
success: function (result) {
|
if (result.count == 1) {
|
layer.msg(result.Message, { 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 });
|
}
|
layer.close(wait);
|
}, error: function () {
|
layer.close(wait);
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
});
|
})
|
}
|
else {
|
layer.msg('请选择一行数据删除!');
|
}
|
break;
|
//列设置
|
case 'set_HideColumn':
|
get_HideColumn();
|
break;
|
//按钮设置
|
case 'set_HideButton':
|
var btns = document.getElementsByTagName("button"); //获取本页所有按钮对象
|
var HBillType = "7505";
|
get_HideButton(btns, HBillType, HModName, sessionStorage["HUserName"]);
|
break;
|
};
|
});
|
|
///加载显示数据
|
//function RoadHBillNo(sqlWhere) {
|
// where = sqlWhere;
|
// var index0 = layer.load();
|
// $.ajax({
|
// type: "get",
|
// url: GetWEBURL() +"/QC_Management/MES_QC_FirstPieceCheckBillList_Json",
|
// async: true,
|
// data: { "sqlWhere": sqlWhere, "user": sessionStorage["HUserName"] },//"HSupNo": sessionStorage["HUserName"],
|
// success: function (result) {
|
// if (result.count == 1) {
|
// ajaxReturnData = JSON.parse(JSON.stringify(result)).data;
|
// table.reload('mainTable', {
|
// data: ajaxReturnData
|
// , height: 'full-10'
|
// , page: {
|
// curr: _cur_page //必须从第 1 页开始
|
// }
|
// , loading: false
|
// , done: function (index, res) {
|
|
// }
|
// });
|
// layer.close(index0);
|
// } else {
|
// layer.close(index0);
|
// layer.alert(result.code + result.Message, { icon: 5 });
|
// }
|
|
// },
|
// error: function (result) {
|
// layer.close(index0);
|
// layer.alert("接口请求失败!", { icon: 5 });
|
// }
|
// });
|
//};
|
|
// 查询
|
function RoadHBillNo(sqlWhere) {
|
var ajaxLoad = layer.load();
|
$.ajax({
|
url: GetWEBURL() + '/QC_FirstPieceCheckBill/QC_FirstPieceCheckBillList',
|
type: "GET",
|
data: { "sWhere": sqlWhere, "user": sessionStorage["HUserName"] },
|
success: function (data1) {
|
if (data1.count == 1) {
|
layer.close(ajaxLoad);
|
|
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 {
|
switch (data[i].Type) {
|
//int
|
case 'DateTime':
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, templet: "<div>{{d." + data[i].name + " ==null ?'':layui.util.toDateString(d." + data[i].name + ", 'yyyy-MM-dd')}}</div>", width: 200 });
|
break;
|
default:
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 200 });
|
}
|
}
|
}
|
option = {
|
elem: '#mainTable'
|
, toolbar: '#toolbarDemo'
|
, height: 'full-50'
|
, page: true //开启分页
|
, limit: 500
|
, limits: [500, 2000, 5000, 20000]
|
, cols: [col]
|
, data: data1.data
|
, done: function (res, curr, count) {
|
soulTable.render(this);
|
}
|
};
|
//初始化表格
|
DisPlay_HideColumn();
|
table.render(option);
|
|
//if ($("#Comparator").val() == 0 && $("#ColContent").val() == "") {
|
// ColFilter();
|
//}
|
//刷新按钮显示
|
var btns = document.getElementsByTagName("button"); //获取本页所有按钮对象
|
var HBillType = "7505";
|
Display_HideButton(btns, HBillType, HModName, sessionStorage["HUserName"]);
|
} else {
|
layer.close(ajaxLoad);
|
layer.msg(data1.code + data1.Message, { icon: 5 });
|
}
|
}, error: function () {
|
layer.close(ajaxLoad);
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
});
|
|
}
|
|
//点击主表带出从表数据
|
table.on('rowDouble(mainTable)', function (obj) { //注:tool 是工具条事件名,test 是 table 原始容器的属性 lay-filter="对应的值"
|
//选中行改变颜色
|
check_row(obj);
|
|
var datas = obj.data; //获得当前行数据
|
HBillNo = datas["单据号"].toString();
|
var HInterID = datas.hmainid;
|
var HEntryID = datas.hsubid;
|
var wait = layer.load();
|
$.ajax({
|
url: GetWEBURL() + '/QC_ValueTable/getValueList',
|
type: "GET",
|
data: { "HInterID": HInterID, "HEntryID": HEntryID, "user": sessionStorage["HUserName"] },
|
async: false,
|
success: function (data1) {
|
if (data1.count == 1) {
|
var data = [];
|
var col = [];
|
//给空的数组赋值
|
for (var key in data1.list) {
|
data.push({ "id": data1.list[key].ColmCols, "name": data1.list[key].ColmCols, "Type": data1.list[key].ColmType });
|
}
|
//在列表左边添加勾选框
|
col.push({ type: 'checkbox', fixed: 'left' });
|
for (var i = 0; i < data.length; i++) {
|
// if (data[i].name == 'HInterID' || data[i].name == 'HBillType' || data[i].name == 'hmainid') {
|
if ($.inArray(data[i].name, titleData_Value) > -1) {
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', hide: true }); //隐藏id列
|
}
|
else {
|
switch (data[i].Type) {
|
//int
|
case 'DateTime':
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, templet: "<div>{{d." + data[i].name + " ==null ?'':layui.util.toDateString(d." + data[i].name + ", 'yyyy-MM-dd HH:mm:ss')}}</div>", width: 200 });
|
break;
|
default:
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 200 });
|
}
|
}
|
}
|
|
//动态显示列名
|
option_Value = {
|
elem: '#mainTable_Value'
|
//, toolbar: '#toolbarDemo2'
|
, cols: [col]
|
, data: data1.data
|
, height: 550
|
, page: true
|
, cellMinWidth: 90
|
, limit: 50
|
, limits: [50, 500, 5000, 20000]
|
}
|
table.render(option_Value);
|
|
//刷新表格数据
|
//DisPlay_HideColumn();
|
|
layer.close(wait);
|
//layer.alert("查询成功", { icon: 1 });
|
} else {
|
option_Value = {
|
elem: '#mainTable_Value'
|
//, toolbar: '#toolbarDemo2'
|
, cols: []
|
, data: ""
|
, height: 550
|
, page: true
|
, cellMinWidth: 90
|
, limit: 50
|
, limits: [50, 500, 5000, 20000]
|
}
|
table.render(option_Value);
|
layer.close(wait);
|
layer.alert(data1.code + data1.Message, { icon: 5 });
|
}
|
}, error: function () {
|
layer.close(wait);
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
});
|
});
|
|
form.on('submit(f_Query)', function (data) {//查询
|
var sqlWhere = " and 1=1 ";
|
//if ($("#HStatus").val() != "")
|
// sqlWhere += " and 状态 like ^^%" + $("#HStatus").val() + "%^^";
|
var HBillNo = $("#HBillNo").val();//单据号
|
var HNumber = $("#HNumber").val();//物料代码
|
var HName = $("#HName").val();//物料名称
|
var HModel = $("#HModel").val();//规格型号
|
var HDate1 = $("#HDate1").val();//开始日期
|
var HDate2 = $("#HDate2").val();//结束日期
|
|
if (HBillNo)
|
sqlWhere += " and 单据号 like '%" + HBillNo+ "%'";
|
if (HNumber)
|
sqlWhere += " and 物料代码 like '%" + HNumber + "%'";
|
if (HName)
|
sqlWhere += " and 物料名称 like '%" + HName + "%'";
|
if (HModel)
|
sqlWhere += " and 规格型号 like '%" + HModel + "%'";
|
//if ($("#HClStatus").val() != "")
|
// sqlWhere += " and 关闭状态 like ^^%" + $("#HClStatus").val() + "%^^";
|
//if ($("#HPURCHASEORGID").val() != "")
|
// sqlWhere += " and 采购组织 like ^^%" + $("#HPURCHASEORGID").val() + "%^^";
|
if (HDate1) {
|
sqlWhere += " and 日期 >= '" + HDate1 + "'";
|
}
|
if (HDate2) {
|
sqlWhere += " and 日期 <= '" + HDate2 + "'";
|
}
|
//if ($("#HISGenerate").val() != "") {
|
// if ($("#HISGenerate").val() == "是")
|
// {
|
// sqlWhere += " and 未关联数量 <= 0";
|
// }
|
// else if ($("#HISGenerate").val() == "否") {
|
// sqlWhere += " and 未关联数量 > 0";
|
// }
|
//}
|
|
|
var Time = $("#Time").val();
|
var dd = new Date();
|
var dt;
|
switch (Time) {
|
case 1: dd = new Date(dd.setDate(dd.getDate() + 7));
|
case 2: dd = new Date(dd.setDate(dd.getDate() + 14));
|
case 3: dd = new Date(dd.setMonth(dd.getMonth() + 1));
|
case 4: dd = new Date(dd.setMonth(dd.getMonth() + 2));
|
case 5: dd = new Date(dd.setMonth(dd.getMonth() + 3));
|
case 6: dd = new Date(dd.setMonth(dd.getMonth() + 6));
|
case 7: dd = new Date(dd.setMonth(dd.getMonth() + 12));
|
default: dd = new Date(dd.setDate(dd.getDate()));
|
}
|
dt = dd.getFullYear().toString();
|
if (dd.getMonth() + 1 < 10) {
|
dt = dt + "-0" + (dd.getMonth() + 1).toString();
|
}
|
else {
|
dt = dt + "-0" + (dd.getMonth() + 1).toString();
|
}
|
if (dd.getDate() < 10) {
|
dt = dt + "-0" + dd.getDate().toString();
|
}
|
else {
|
dt = dt + "-" + dd.getDate().toString();
|
}
|
//if (Time != 8) {
|
// sqlWhere += " and 交货日期 <= ^^" + dt + "^^";
|
//}
|
sql = sqlWhere;
|
//从第一页开始
|
_cur_page = 1;
|
RoadHBillNo(sqlWhere);
|
});
|
|
//改变选中行颜色
|
function check_row(obj) {
|
if (checkobj != "") {
|
checkobj.tr.find('.layui-form-checkbox').removeClass('layui-form-checked');//取消复选框选中样式
|
checkobj.tr.find(':checkbox:first').prop('checked', false);//取消复选框选中样式
|
$(checkobj.tr.selector).attr({ "style": "background:" });//取消当前tr颜色
|
}
|
|
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背景颜色和字体颜色
|
checkobj = obj;
|
} 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;
|
}
|
});
|
}
|
|
//新增
|
function set_AddNew() {
|
layer.open({
|
type: 2,
|
skin: 'layui-layer-rim', //加上边框
|
title: '新增首件检验单',
|
closeBtn: 1,
|
shift: 2,
|
area: ['100%', '100%'],
|
maxmin: true,
|
content: './QC_Add_Edit_FirstPieceCheckBill.html?OperationType=1&linterid=&HSouceBillType=0&closeType=1',
|
end: function () {
|
//刷新页面,
|
//get_FastQuery(table, option);
|
},
|
success: function (layero, index) {
|
|
}
|
});
|
}
|
|
var $ = layui.$, active = {
|
f_Query: function () { //查询
|
|
},
|
f_Qrjq: function () { //接受
|
|
},
|
f_Bhjq: function () { //拒绝
|
|
},
|
//JSreload: function () {
|
// var demoReload = $('#test-table-demoReload');
|
// //执行重载
|
// table.JSreload('test-table-reload', {
|
// page: {
|
// curr: 1 //重新从第 1 页开始
|
// }
|
// , where: {
|
// key: {
|
// id: demoReload.val()
|
// }
|
// }
|
// });
|
//}
|
};
|
$('.test-table-reload-btn .layui-btn').on('click', function () {
|
var type = $(this).data('type');
|
active[type] ? active[type].call(this) : '';
|
});
|
|
//隐藏列设置
|
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();
|
//刷新页面,
|
location.reload();
|
//更新表格缓存的数据
|
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", "HEntryID", "HSourceID", "HMaterID", "HFirstCheckEmp", "HQCCheckItemID", "HUnitID", "HSampleSchemeID"];//不需要显示的字段 可扩展
|
|
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 = "7505";
|
Display_HideButton(btns, HBillType, HModName, sessionStorage["HUserName"]);
|
}, error: function () {
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
})
|
}
|
});
|
</script>
|
</body>
|
|
</html>
|