<!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/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>
|
.layui-table-view{
|
width:52%;
|
float:left;
|
}
|
/*layui-form layui-border-box layui-table-view*/
|
.right{
|
width:47.5%;
|
height:550px;
|
float:left;
|
margin-left:0.5%;
|
}
|
.right-button{
|
float:right;
|
margin-top:10px
|
}
|
.right-content {
|
width: 100%;
|
height: 490px;
|
background-color: white;
|
border: solid 1px #BEC0C4;
|
}
|
</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-card-header">
|
<div class="layui-btn-group">
|
<button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Add_Row">增行</button>
|
<button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Del_Row">删行</button>
|
<button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Give_Up">放弃</button>
|
<button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Get_Use">使用</button>
|
<button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Cancel">取消</button>
|
<button type="button" id="add-btn" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Saver">保存</button>
|
<button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Exit">退出</button>
|
</div>
|
</div>
|
<div class="layui-collapse" style="margin-bottom:2px">
|
<h1 style="text-align: center; padding: 10px 0;"><b>作业指导书</b></h1>
|
<div class="layui-tab-content">
|
<div class="layui-tab-item layui-show">
|
<div class="layui-form-item">
|
<div class="layui-inline">
|
<label class="layui-form-label">单据号</label>
|
<div class="layui-input-inline">
|
<input type="text" class="layui-input" id="HBillNo" style="width:190px;">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label">日期</label>
|
<div class="layui-input-inline">
|
<input type="date" class="layui-input" id="HDate" style="width:190px;">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label">指导书名称</label>
|
<div class="layui-input-inline">
|
<input type="text" class="layui-input" id="HName" style="width:190px;">
|
</div>
|
</div>
|
</div>
|
<div class="layui-form-item">
|
<div class="layui-inline">
|
<label class="layui-form-label">产品代码</label>
|
<div class="layui-input-inline">
|
<input type="text" name="HSourceBillNo" id="HSourceBillNo" readonly class="layui-input" value="" style="float:left;width:150px;">
|
<button type="button" lay-submit="" class="layui-btn" lay-filter="HSourceBillNoList" style="width:40px;">
|
<i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
|
</button>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label">产品名称</label>
|
<div class="layui-input-inline">
|
<input type="text" class="layui-input" id="HMaterName" style="width:190px;">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label">规格型号</label>
|
<div class="layui-input-inline">
|
<input type="text" class="layui-input" id="HMaterName" style="width:190px;">
|
</div>
|
</div>
|
</div>
|
<div class="layui-form-item">
|
<div class="layui-inline">
|
<label class="layui-form-label">计量单位</label>
|
<div class="layui-input-inline">
|
<input type="text" name="HSourceBillNo" id="HSourceBillNo" readonly class="layui-input" value="" style="float:left;width:150px;">
|
<button type="button" lay-submit="" class="layui-btn" lay-filter="HSourceBillNoList" style="width:40px;">
|
<i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
|
</button>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label">备注</label>
|
<div class="layui-input-inline">
|
<input type="text" class="layui-input" id="HMaterName" style="width:514px;">
|
</div>
|
</div>
|
</div>
|
<div class="layui-form-item">
|
<div class="layui-inline">
|
<div class="layui-input-inline" style="margin-left: 80px;">
|
<input type="checkbox" name="checkboxHStandard" id="checkboxHStandard" lay-skin="primary" lay-filter="checkboxHStandard" title="是否默认工艺">
|
<input type="hidden" value="true" name="HStandard" id="HStandard" lay-verify="HStandard">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<div class="layui-input-inline" style="margin-left: 110px;">
|
<input type="checkbox" name="checkboxHStandard" id="checkboxHStandard" lay-skin="primary" lay-filter="checkboxHStandard" title="是否启用">
|
<input type="hidden" value="true" name="HStandard" id="HStandard" lay-verify="HStandard">
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
<table class="" id="mainTable" lay-filter="mainTable"></table>
|
<div class="right">
|
<div class="right-content">
|
|
</div>
|
<div class="right-button">
|
<button type="button" class="layui-btn layui-btn-primary" lay-submit="" lay-filter="Add_Row" style="color:#232389">上传</button>
|
<button type="button" class="layui-btn layui-btn-primary" lay-submit="" lay-filter="Add_Row" style="color:#232389">删除</button>
|
</div>
|
</div>
|
<script type="text/html" id="toolbarDemo">
|
<div class="layui-btn-container">
|
|
</div>
|
</script>
|
</form>
|
</div>
|
</div>
|
</div>
|
</div>
|
|
<script type="text/javascript">
|
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
|
//查询条件
|
var sWhere = "";
|
var option = [];
|
var HModName = "WW_PPBomBillList";
|
//#endregion
|
|
//#region 进入页面既加载
|
//初始化表格
|
set_InitGrid();
|
//加载数据到网格
|
get_Display(sWhere);
|
//隐藏勾选字段
|
DisPlay_HideColumn();
|
//#endregion
|
|
//#region 点击事件包括on form事件等
|
//头工具栏事件
|
table.on('toolbar(mainTable)', function (obj) {
|
switch (obj.event) {
|
//添加行
|
case 'Add_Row': set_AddRow();
|
break;
|
//删除行
|
case 'Del_Row': set_DelRow();
|
break;
|
//放弃
|
case 'Give_Up': set_GiveUp();
|
break;
|
//使用
|
case 'Get_Use': set_GetUse();
|
break;
|
//取消
|
case 'Cancel': set_Cancel();
|
break;
|
//保存
|
case 'Saver': set_Saver();
|
break;
|
//退出
|
case 'Exit': set_Exit();
|
break;
|
};
|
});
|
|
//重置按钮
|
form.on('submit(btnReSearch)', function (data) {
|
set_ClearQuery();
|
});
|
|
//查询按钮
|
form.on('submit(btnSearch)', function (data) {
|
get_FastQuery(table, option);
|
});
|
//#endregion
|
|
//#region 此页面所有方法
|
//初始化表格
|
function set_InitGrid() {
|
$("#HDate").val(Format(new Date(), "yyyy-MM-dd"));
|
option = {
|
elem: '#mainTable'
|
, toolbar: '#toolbarDemo'
|
, page: true
|
, cellMinWidth: 120
|
, totalRow: true
|
, limit: 50
|
, cellMinWidth: 1000
|
, height: 'full-50'
|
, cols: [[
|
{ type: 'checkbox', fixed: 'left' }
|
, { field: '流水号', title: '流水号', width: 200, hide: true }
|
, { field: '工序代码', title: '工序代码', width: 200, sort: true }
|
, { field: '工序', title: '工序', width: 200 }
|
, { field: '工位', title: '工位', width: 200 }
|
, { field: '工位代码', title: '工位代码', width: 200, hide: true }
|
, { field: '工作中心代码', title: '工作中心代码', width: 110 }
|
, { field: '工作中心', title: '工作中心', width: 110 }
|
, { field: '备注', title: '备注', width: 110 }
|
]]
|
, limits: [50, 500, 5000, 20000]
|
, done: function (res, curr, count) {
|
|
}
|
};
|
}
|
//加载网格
|
function get_Display(sWhere) {
|
var wait = layer.load();//遮罩
|
$.ajax({
|
url: GetWEBURL() + '/Gy_SOPBill/list',
|
type: "GET",
|
data: { "sWhere": sWhere, "user": sessionStorage["HUserName"]},
|
success: function (data1) {
|
if (data1.count == 1) {
|
DataList = data1.data;
|
option.data = data1.data;
|
table.render(option);
|
layer.close(wait);
|
} else {
|
layer.close(wait);
|
layer.alert(data1.Message, { icon: 5 });
|
}
|
}, error: function () {
|
layer.close(wait);
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
});
|
}
|
//使用
|
function get_Use() {
|
$.ajax({
|
type: "GET",
|
url: GetWEBURL() + "Gy_SOPBill/BatchUse", //方法所在页面和方法名
|
success: function (result) {
|
if (result.count == 1) {
|
layer.alert(result.Message, { icon: 1 }, function (index) {
|
//关闭当前frame
|
layer.close(index);
|
});
|
|
} else {
|
layer.alert(result.code + result.Message, { icon: 5 });
|
}
|
}, error: function () {
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
});
|
}
|
//新增
|
function set_AddNew() {
|
layer.open({
|
type: 2,
|
skin: 'layui-layer-rim', //加上边框
|
title: '作业指导书',
|
closeBtn: 1,
|
shift: 2,
|
area: ['100%', '100%'],
|
maxmin: true,
|
content: '../生产基础资料/Gy_SOPBill.html?OperationType=1&linterid=&HSouceBillType=',
|
end: function () {
|
//刷新页面,
|
location.reload();
|
},
|
success: function (layero, index) {
|
|
}
|
});
|
}
|
//打印
|
function get_PrintReport() {
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
if (checkStatus.data.length === 1) {
|
layer.open({
|
type: 2
|
, area: ['50%', '50%']
|
, title: '打印模版选择'
|
, shade: 0.6 //遮罩透明度
|
, maxmin: false //允许全屏最小化
|
, anim: 0 //0-6的动画形式,-1不开启
|
, content: ['../../BaseSet/SRM_OpenTmpList.html?linterid=' + data[0].hmainid.toString() + '&MyMsg=' + data[0].hmainid.toString() + '&Type=HEquipFileMainBill', 'yes']
|
, resize: false
|
})
|
}
|
else {
|
layer.msg('请选择一行数据打印!');
|
}
|
}
|
//Excel表格导出
|
function SetExcel() {
|
layer.confirm("确定导出所有数据吗", { title: "导出确认" }, function (index) {
|
var HBillNo = $("#HBillNo").val(); //单据号
|
var HBillType = $("#HBillType").val();
|
var HMaterNumber = $("#HMaterNumber").val();//结束日期
|
var HMaterName = $("#HMaterName").val();
|
var HCenterName = $("#HCenterName").val();
|
if (HBillNo) {
|
sWhere += " and 单据号 like '%" + HBillNo + "%'";
|
}
|
if (HBillType) {
|
sWhere += " and 单据类型 like '%" + HBillNo + "%'";
|
}
|
if (HMaterNumber) {
|
sWhere += " and 物料代码 like '%" + HMaterNumber + "%'";
|
}
|
if (HMaterName) {
|
sWhere += " and 物料名称 like '%" + HMaterName + "%'";
|
}
|
if (HCenterName) {
|
sWhere += " and 工作中心名称 like '%" + HCenterName + "%'";
|
}
|
window.location.href = GetWEBURL() + "/Gy_SOPBill/SetExcel?sWhere=" + sWhere;
|
// 得到frame索引
|
//var index = layer.getFrameIndex(window.name);
|
//关闭当前frame
|
layer.close(index);
|
})
|
sWhere = " ";
|
}
|
//刷新
|
function get_Refresh() {
|
$("#HBillNo").val(""); //单据号
|
$("#HBillType").val("");
|
$("#HMaterNumber").val("");
|
$("#HMaterName").val("");
|
$("#HCenterName").val("");
|
$("#btnSearch").click();
|
}
|
|
//预览
|
function get_ViewReport() {
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
if (checkStatus.data.length === 1) {
|
layer.open({
|
type: 2
|
, area: ['50%', '50%']
|
, title: '打印模版选择'
|
, shade: 0.6 //遮罩透明度
|
, maxmin: false //允许全屏最小化
|
, anim: 0 //0-6的动画形式,-1不开启
|
, content: ['../../BaseSet/SRM_OpenTmpList.html?linterid=' + data[0].hmainid.toString() + '&MyMsg=' + data[0].hmainid.toString() + '&Type=HMouldProdInBill', 'yes']
|
, resize: false
|
})
|
}
|
else {
|
layer.msg('请选择一行数据打印!');
|
}
|
}
|
|
//快速过滤
|
function get_FastQuery() {
|
var HBillNo = $("#HBillNo").val(); //单据号
|
var HBillType = $("#HBillType").val();
|
var HMaterNumber = $("#HMaterNumber").val();//结束日期
|
var HMaterName = $("#HMaterName").val();
|
var HCenterName = $("#HCenterName").val();
|
if (HBillNo) {
|
sWhere += " and 单据号 like '%" + HBillNo + "%'";
|
}
|
if (HBillType) {
|
sWhere += " and 单据类型 like '%" + HBillNo + "%'";
|
}
|
if (HMaterNumber) {
|
sWhere += " and 物料代码 like '%" + HMaterNumber + "%'";
|
}
|
if (HMaterName) {
|
sWhere += " and 物料名称 like '%" + HMaterName + "%'";
|
}
|
if (HCenterName) {
|
sWhere += " and 工作中心名称 like '%" + HCenterName + "%'";
|
}
|
var index = layer.load(0);
|
get_Display(sWhere);
|
//调用接口后清空sWhere缓存
|
sWhere = " ";
|
}
|
//重置过滤条件
|
function set_ClearQuery() {
|
$("#HBillNo").val(""); //单据号
|
$("#HBillType").val("");
|
$("#HMaterNumber").val("");
|
$("#HMaterName").val("");
|
$("#HCenterName").val("");
|
|
sWhere = " ";
|
get_Display(sWhere);
|
}
|
//#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 = ["单据ID", "hmaterid", "hsubid", "HCenterID", "HWorkStationID"];//不需要显示的字段 可扩展
|
|
dataCol = data1.data[0].HGridString.split(',');
|
|
for (var i = 0; i < option.cols[0].length - 2; 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);
|
}
|
}, error: function () {
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
})
|
}
|
//以上是layui模块
|
});
|
</script>
|
</body>
|
</html>
|