<!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>
|
</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>
|
<script type="text/html" id="toolbarDemo">
|
<div class="layui-btn-container">
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Edit"><i class="layui-icon layui-icon-form"></i>编辑</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Delete"><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>
|
var _cur_page = 1;
|
var sql = " ";
|
//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'], function () {
|
var $ = layui.$
|
, admin = layui.admin
|
, layer = layui.layer
|
, laydate = layui.laydate
|
, table = layui.table
|
, form = layui.form
|
, element = layui.element;
|
//常规用法
|
laydate.render({
|
elem: '#HDate1'
|
});
|
laydate.render({
|
elem: '#HDate2'
|
});
|
//layui.code();
|
RoadHBillNo(sql);
|
layer.load(3)
|
//方法级渲染
|
table.render({
|
elem: '#mainTable'
|
, dateType: 'json'
|
, colFilterRecord: true//是否开启字段筛选的记忆功能
|
, data: []
|
// , url: GetWEBURL()+'GetPOOrderBill'
|
, toolbar: '#toolbarDemo' //开启头部工具栏,并为其绑定左侧模板
|
, defaultToolbar: ['filter', 'exports', 'print']
|
// , where: { msg: "", NowPage: 1, OnePage: 10 }
|
, cellMinWidth: 100
|
, 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 }
|
, { field: '生产资源名称', title: '生产资源名称' }
|
, { field: '生产资源代码', title: '生产资源代码' }
|
, { field: '产品内码', title: '产品内码' }
|
, { field: '产品名称', title: '产品名称' }
|
, { field: '产品型号', title: '产品型号', width: 115 }
|
, { field: '检验员代码', title: '检验员代码', width: 115 }
|
, { field: '检验员名称', title: '检验员名称' }
|
, { 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: '作废人', hide: true, width: 160 }
|
, { field: '作废日期 ', title: '作废日期', width: 215 }
|
, { field: '单据类型 ', title: '单据类型 ', width: 115 }
|
]]
|
//, skin: 'row' //表格风格
|
// , even: true
|
, page: true //是否显示分页
|
, limits: [10, 20, 50, 100]
|
, limit: 50 //每页默认显示的数量
|
//, height: 500
|
, done: function (res, curr, count) {
|
_cur_page = curr;
|
layer.closeAll("loading");
|
}
|
});
|
|
//头工具栏事件
|
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-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_PatrolProcCheckBill.html?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();
|
//逻辑删除方法
|
$.ajax({
|
url: GetWEBURL() + 'DeltetQC_PatrolProcCheck',
|
type: "GET",
|
data: { "HInterID": InterID },
|
success: function (result) {
|
console.log('gouba' + 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 });
|
}
|
}, error: function () {
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
});
|
}
|
else {
|
layer.msg('请选择一行数据删除!');
|
}
|
break;
|
};
|
});
|
|
|
|
///加载显示数据
|
function RoadHBillNo(sqlWhere) {
|
where = sqlWhere;
|
$.ajax({
|
type: "get",
|
url: GetWEBURL() +"/QC_Management/MES_QC_PatrolProcCheckBillList_Json",
|
async: true,
|
data: { "sqlWhere": sqlWhere },//"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 });
|
}
|
});
|
};
|
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);
|
});
|
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) : '';
|
});
|
});
|
</script>
|
</body>
|
|
</html>
|