<!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/zgqCustom/zgqCustom.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/PageTitle.js"></script>
|
<!--<style>
|
.main-btn { /*头部主按钮*/
|
padding: 0 2px; /*调整按钮左右空隙大小*/
|
height: 30px;
|
line-height: 30px;
|
}
|
|
.btn-title {
|
font-size: 16px;
|
}
|
/* 防止下拉框的下拉列表被隐藏---必须设置--- */
|
.layui-table-cell {
|
overflow: visible !important;
|
}
|
/* 使得下拉框与单元格刚好合适 */
|
td .layui-form-select {
|
margin-top: -10px;
|
margin-left: -15px;
|
margin-right: -15px;
|
}
|
|
.layui-form-item .layui-inline {
|
margin-top: 5px;
|
margin-bottom: 5px;
|
margin-right: 0px;
|
}
|
|
.layui-form-label {
|
width: 25%;
|
}
|
</style>-->
|
|
</head>
|
<body>
|
<div class="layui-fluid" style="padding: 0;">
|
<div class="layui-card" style="padding: 2px;background-color: #efefef;">
|
<div class="layui-card-body" style="padding: 1px;">
|
<form class="layui-form" action="" lay-filter="formData" style="background-color:white;">
|
<div class="layui-row" lay-split="true">
|
<div class="layui-col-xs12 layui-col-md6">
|
<h1 style="text-align: center; padding: 10px 0;"><b>未核销采购入库单</b></h1>
|
<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" 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">供应商<label style="color:red"> * </label></label>
|
<div class="layui-input-inline">
|
<input type="text" name="HSupName" id="HSupName" class="layui-input" value="" style="float: left; width: 150px; background-color: #efefef4d;" readonly>
|
<input type="hidden" name="HSupID" id="HSupID" class="layui-input" value="0" style="float:left;width:150px;">
|
<button type="button" id="HSupList" lay-submit="" class="layui-btn" lay-filter="HSupList" style="width:40px;">
|
<i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
|
</button>
|
</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:5px;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 class="layui-row" style="margin-top: 5px; display: none;">
|
<div class="layui-inline">
|
<label class="layui-form-label">过滤</label>
|
<div class="layui-input-block">
|
<select name="ColName1" id="ColName1" lay-filter="ColName1" style="width:190px;">
|
</select>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<select name="Comparator1" id="Comparator1" lay-filter="Comparator1" 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="ColContent1" id="ColContent1">
|
</div>
|
</div>
|
<div class="layui-row" style="margin-top: 5px; display: none;">
|
<div class="layui-inline">
|
<label class="layui-form-label">过滤</label>
|
<div class="layui-input-block">
|
<select name="ColName2" id="ColName2" lay-filter="ColName2" style="width:190px;">
|
</select>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<select name="Comparator2" id="Comparator2" lay-filter="Comparator2" 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="ColContent2" id="ColContent2">
|
</div>
|
</div>
|
</div>
|
</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-waitSec"><i class="layui-icon layui-icon-form"></i>加入待核销队列</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="set_HideColumn"><i class="layui-icon layui-icon-form"></i>列设置</button>
|
</div>
|
</script>
|
</div>
|
<div class="layui-col-xs12 layui-col-md6">
|
<h1 style="text-align: center; padding: 10px 0;"><b>待核销列表</b></h1>
|
<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>
|
</div>
|
<table class="layui-hide" id="mainTable1" lay-filter="mainTable1"></table>
|
<script type="text/html" id="toolbarDemo1">
|
<div class="layui-btn-container">
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Delete"><i class="layui-icon layui-icon-form"></i>删除</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="set_HideColumn"><i class="layui-icon layui-icon-form"></i>列设置</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Sec"><i class="layui-icon layui-icon-form"></i>核销</button>
|
</div>
|
</script>
|
</div>
|
</div>
|
</form>
|
</div>
|
</div>
|
</div>
|
|
<script>
|
layui.config({
|
base: '../../../layuiadmin/' //静态资源所在路径
|
}).extend({
|
index: 'lib/index' //主入口模块
|
}).use(['index', 'form', 'laydate', 'table', 'element'], function () {
|
//#region 公共变量
|
var $ = layui.$
|
, admin = layui.admin
|
, layer = layui.layer
|
, table = layui.table
|
, form = layui.form
|
, element = layui.element;
|
|
//表格渲染参数
|
var option = {}; //表1渲染参数
|
var option1 = {}; //表2渲染参数
|
//模块名
|
var HModName = "Cg_POStockInBillList_Sec_Sub";
|
var HModName1 = "Cg_POStockInBillList_Sec_Sub1";
|
var HBillType = "0001";
|
//过滤条件
|
var sWhere = "";
|
|
//#endregion
|
|
//#region 判断是否登录 未登录则跳到登录页
|
if (sessionStorage.login != "login") {
|
layer.confirm("登录失效,请重新登录!", {
|
icon: 4, skin: 'layui-layer-lan', title: "温馨提示", closeBtn: 0, btn: ['重新登录']
|
}, function () { window.location.href = "../../user/login.html"; });
|
}
|
//#endregion
|
|
//#region 进入页面即加载
|
//#region 页面初始化
|
set_ClearBill();
|
//#endregion
|
//#endregion
|
|
//#region 选择供应商按钮
|
form.on('submit(HSupList)', function () {
|
get_checkSup();
|
});
|
|
//#region 供应商选择页面
|
function get_checkSup() {
|
var HOrgName = sessionStorage["Organization"];
|
layer.open({
|
type: 2//弹窗类型
|
, skin: 'layui-layer-rim' //加上边框
|
, area: ['90%', '90%']//大小
|
, title: '供应商列表'//标题
|
, shift: 2//弹出动画
|
, content: ['../../基础资料/采购基础资料/Gy_Supplier.html?Type=HSup&HOrgName=' + HOrgName, '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('请选择数据');
|
}
|
|
$("#HSupName").val(checkStatus.data[0].供应商名称);
|
$("#HSupID").val(checkStatus.data[0].HItemID);
|
|
document.getElementById("HSupList").disabled = true;
|
document.getElementById("HSupList").style.color = "white";
|
|
layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
|
}
|
, btn2: function (index, layero) { }
|
})
|
}
|
//#endregion
|
//#endregion
|
|
//#region 子表1:点击行选中高亮
|
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;
|
}
|
});
|
})
|
//#endregion
|
|
//#region 子表2:点击行选中高亮
|
//table.on('row(mainTable1)', 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.mainTable1, function (i, l) {
|
// if (obj.tr.index() == l.LAY_TABLE_INDEX) {
|
// l.LAY_CHECKED = flag;
|
// }
|
// });
|
//})
|
//#endregion
|
|
//#region 子表1:头工具栏事件
|
//#region 子表1 头工具栏按钮监听
|
table.on('toolbar(mainTable)', function (obj) {
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
switch (obj.event) {
|
//加入待核销队列
|
case 'btn-waitSec':
|
waitSec(data);
|
break;
|
//列设置
|
case 'set_HideColumn':
|
get_HideColumn();
|
break;
|
}
|
});
|
//#endregion
|
|
//#region 加入待核销队列
|
function waitSec(obj) {
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
if (data.length > 0) {
|
//判断选中的记录中是否存在不同的客户,若存在,则操作失败。若不存在,则记录销售出库单的主内码
|
var dataArray = [];
|
var HCusName = data[0].供应商;
|
//var HEmpName = data[0].业务员;
|
for (var i = 0; i < data.length; i++) {
|
if ($.inArray(data[i].hmainid, dataArray) == -1) {
|
var temp = {
|
"hmainid": data[i].hmainid
|
,"单据号": data[i].单据号
|
}
|
dataArray.push(temp);
|
}
|
|
if (data[i].供应商 != HCusName) {
|
layer.msg("加入待核销列表失败!已经选中的记录中存在不同供应商!");
|
return;
|
}
|
//if (data[i].业务员 != HEmpName) {
|
// layer.msg("下推失败!已经选中的记录中存在不同业务员!");
|
// return;
|
//}
|
}
|
|
|
//判断选中的单据中是否已经被加入到待核销列表中
|
for (var i = 0; i < dataArray.length; i++) {
|
var err = "";
|
var sql = "select * from h_v_Cg_POStockInBillList_WaitSec where 1=1 " + " and hmainid = '" + dataArray[i].hmainid + "' order by 单据号 desc";
|
var ModRightNameCheck = "";
|
$.ajax({
|
url: GetWEBURL() + '/CommonModel/searchMethod',
|
type: "GET",
|
async: false,
|
data: { "sql": sql, "user": sessionStorage["HUserName"], "ModRightNameCheck": ModRightNameCheck },
|
success: function (data1) {
|
if (data1.count == 1) {
|
if (data1.data.length > 0) {
|
err += "单据号[" + data[0].单据号 + "]:已经加入到待核销列表,核销人为[" + data[0].核销人 + "];";
|
}
|
} else {
|
err += data1.code + data1.Message;
|
}
|
}, error: function (e) {
|
err += "接口请求失败!" + e;
|
}
|
});
|
}
|
if (err != "") {
|
layer.alert(err, { icon: 5 });
|
return;
|
}
|
|
//将选中的单据加入到待核销列表中
|
var successMsg = "";
|
var errMsg = "";
|
for (var i = 0; i < dataArray.length; i++) {
|
$.ajax({
|
url: GetWEBURL() + '/Cg_POStockInBillList_Sec/addBillToWaitSecList',
|
type: "GET",
|
async: false,
|
data: { "hmainid": dataArray[i].hmainid, "user": sessionStorage["HUserName"] },
|
success: function (data1) {
|
if (data1.count == 1) {
|
successMsg += "[" + dataArray[i].单据号 + "]";
|
} else {
|
errMsg += "[" + dataArray[i].单据号 + "]";
|
}
|
}, error: function (e) {
|
errMsg += "[" + dataArray[i].单据号 + "]";
|
}
|
});
|
}
|
if (errMsg != "") {
|
successMsg += "加入成功!";
|
errMsg += "加入失败!";
|
layer.alert(successMsg + errMsg, { icon: 5 });
|
}
|
|
get_FastQuery();
|
get_FastQuery1();
|
|
|
} else {
|
layer.msg('请选择数据下推!');
|
}
|
}
|
//#endregion
|
//#endregion
|
|
//#region 子表2:头工具栏事件
|
//#region 子表2 头工具栏按钮监听
|
table.on('toolbar(mainTable1)', function (obj) {
|
var checkStatus = table.checkStatus('mainTable1')
|
, data = checkStatus.data;
|
|
switch (obj.event) {
|
//删除
|
case 'btn-Delete':
|
deleteFromWaitSecList();
|
break;
|
//核销
|
case 'btn-Sec':
|
SecSellOutBill();
|
break;
|
//列设置
|
case 'set_HideColumn':
|
get_HideColumn1();
|
break;
|
}
|
});
|
//#endregion
|
|
//#region 从待核销列表删除
|
function deleteFromWaitSecList() {
|
var checkStatus = table.checkStatus('mainTable1')
|
, data = checkStatus.data;
|
if (data.length == 1) {
|
var ajaxLoad = layer.load();
|
var hmaindid = data[0].hmainid;
|
var sql = "delete from Cg_POStockInBillList_Sec where HMainSourceInterID = " + hmaindid + " and ISNULL(HSecEmp,'') = '' ";
|
var ModRightNameCheck = "";
|
$.ajax({
|
url: GetWEBURL() + '/CommonModel/commonMethod',
|
type: "GET",
|
async: false,
|
data: { "sql": sql, "user": sessionStorage["HUserName"], "ModRightNameCheck": ModRightNameCheck },
|
success: function (data1) {
|
if (data1.count == 1) {
|
layer.close(ajaxLoad);
|
layer.msg("删除成功!", { time: 1 * 1000, icon: 1 }, function () {
|
// 得到frame索引
|
var index = layer.getFrameIndex(window.name);
|
layer.close(index);
|
});
|
|
get_FastQuery();
|
get_FastQuery1();
|
} else {
|
layer.close(ajaxLoad);
|
layer.alert(data1.code + data1.Message, { icon: 5 });
|
}
|
}, error: function (e) {
|
layer.close(ajaxLoad);
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
});
|
} else {
|
layer.msg('请选择一行数据下推!');
|
}
|
}
|
//#endregion
|
|
//#region 核销
|
function SecSellOutBill() {
|
var checkStatus = table.checkStatus('mainTable1')
|
, data = checkStatus.data;
|
if (data.length > 0) {
|
//判断选中的记录中是否存在不同的客户,若存在,则操作失败。若不存在,则记录销售出库单的主内码
|
var dataArray = [];
|
var HCusName = data[0].供应商;
|
//var HEmpName = data[0].业务员;
|
for (var i = 0; i < data.length; i++) {
|
if ($.inArray(data[i].hmainid, dataArray) == -1) {
|
var temp = {
|
"hmainid": data[i].hmainid
|
, "单据号": data[i].单据号
|
}
|
dataArray.push(temp);
|
}
|
|
if (data[i].供应商 != HCusName) {
|
layer.msg("核销失败!已经选中的记录中存在不同供应商!");
|
return;
|
}
|
//if (data[i].业务员 != HEmpName) {
|
// layer.msg("下推失败!已经选中的记录中存在不同业务员!");
|
// return;
|
//}
|
}
|
|
|
//判断选中的单据是否存在且符合核销条件
|
for (var i = 0; i < dataArray.length; i++) {
|
var err = "";
|
var sql = "select * from h_v_Cg_POStockInBillList_WhenSec where 1 = 1 and hmainid = " + dataArray[i].hmainid;
|
var ModRightNameCheck = "";
|
$.ajax({
|
url: GetWEBURL() + '/CommonModel/searchMethod',
|
type: "GET",
|
async: false,
|
data: { "sql": sql, "user": sessionStorage["HUserName"], "ModRightNameCheck": ModRightNameCheck },
|
success: function (data1) {
|
if (data1.count == 1) {
|
if (data1.data.length == 0) {
|
err += "单据号[" + data[0].单据号 + "]:不存在或状态不为[审核/关闭];";
|
}
|
} else {
|
err += data1.code + data1.Message;
|
}
|
}, error: function (e) {
|
err += "接口请求失败!" + e;
|
}
|
});
|
}
|
if (err != "") {
|
layer.alert(err, { icon: 5 });
|
return;
|
}
|
|
//核销生成应收单
|
var hmainidList = [];
|
for (var i = 0; i < dataArray.length; i++) {
|
hmainidList.push(dataArray[i].hmainid);
|
}
|
$.ajax({
|
url: GetWEBURL() + '/Cg_POStockInBillList_Sec/SecToPayableBill',
|
type: "GET",
|
async: false,
|
data: { "hmainidList": hmainidList.toString(), "user": sessionStorage["HUserName"] },
|
success: function (data1) {
|
if (data1.count == 1) {
|
layer.msg(data1.Message, { icon: 1 });
|
} else {
|
layer.alert(data1.Message, { icon: 5 });
|
}
|
}, error: function (e) {
|
layer.alert("接口访问错误" + e.Message, { icon: 5 });
|
}
|
});
|
|
|
get_FastQuery();
|
get_FastQuery1();
|
} else {
|
layer.msg('请选择数据下推!');
|
}
|
}
|
//#endregion
|
//#endregion
|
|
//#region 此页面所有的方法
|
//#region 获取参数
|
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;
|
}
|
//#endregion
|
|
//#region 列明显示下拉框
|
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);
|
$("#ColName1").empty();
|
$("#ColName1").append(Organization);
|
$("#ColName2").empty();
|
$("#ColName2").append(Organization);
|
form.render('select');
|
}
|
//#endregion
|
|
//#region 子表初始化
|
function get_InitGrid() {
|
//表1
|
option = {
|
elem: '#mainTable'
|
, toolbar: '#toolbarDemo'
|
//, page: true
|
//, limit: 500
|
//, limits: [50, 500, 5000, 50000]
|
, totalRow: true
|
, cellMinWidth: 120
|
, height: 'full-100'
|
, cols: [[
|
{ type: 'checkbox', totalRowText: '合计行' }
|
, { type: 'numbers', title: '序号', style: 'background-color: #f9f9f9;' }
|
, { field: 'HProjectID', title: '项目ID', hide: true, style: 'background-color: #f9f9f9;' }
|
, { field: 'HProNumber', title: '项目代码', hide: true, style: 'background-color: #f9f9f9;' }
|
, { field: 'HProName', title: '项目名称', style: 'background-color: #f9f9f9;' }
|
, { field: 'HProjectStageID', title: '项目阶段ID', hide: true, style: 'background-color: #f9f9f9;' }
|
, { field: 'HProjectStageName', title: '项目阶段名称', style: 'background-color: #f9f9f9;' } //f7
|
, { field: 'HName', title: '任务名称', style: 'background-color: #f9f9f9;' }
|
, { field: 'HTaskNote', title: '任务描述', style: 'background-color: #f9f9f9;' }
|
, { field: 'HPlanTimes', title: '预计工时', edit: 'text', totalRow: true }
|
, { field: 'HReportTimes', title: '已汇报工时', totalRow: true, style: 'background-color: #f9f9f9;' }
|
|
, { field: 'HMonday', title: '周一', templet: "#HMonday" }//checkbox
|
, { field: 'HTuesday', title: '周二', templet: "#HTuesday" }
|
, { field: 'HWednesday', title: '周三', templet: "#HWednesday" }
|
, { field: 'HThursday', title: '周四', templet: "#HThursday" }
|
, { field: 'HFriday', title: '周五', templet: "#HFriday" }
|
, { field: 'HSaturday', title: '周六', templet: "#HSaturday" }
|
, { field: 'HSunday', title: '周日', templet: "#HSunday" }
|
|
, { field: 'HSourceInterID', title: '源单内码', hide: true, style: 'background-color: #f9f9f9;' } //f7
|
, { field: 'HSourceEntryID', title: '源单子内码', hide: true, style: 'background-color: #f9f9f9;' } //f7
|
, { field: 'HSourceBillNo', title: '源单单号', hide: true, style: 'background-color: #f9f9f9;' } //f7
|
, { field: 'HSourceBillType', title: '源单类型', hide: true, style: 'background-color: #f9f9f9;' } //f7
|
, { fixed: 'right', title: '操作', toolbar: '#barDemo' }
|
]]
|
}
|
|
var rowdata = [
|
|
];
|
option.data = rowdata;
|
table.render(option);
|
|
|
|
//表2
|
option1 = {
|
elem: '#mainTable1'
|
, toolbar: '#toolbarDemo1'
|
//, page: true
|
, limit: 500
|
//, limits: [50, 500, 5000, 50000]
|
, totalRow: true
|
, cellMinWidth: 120
|
, height: 'full-100'
|
, cols: [[
|
{ type: 'checkbox', totalRowText: '合计行' }
|
, { type: 'numbers', title: '序号', style: 'background-color: #f9f9f9;' }
|
, { field: 'HProjectID', title: '项目ID', hide: true, style: 'background-color: #f9f9f9;' }
|
, { field: 'HProNumber', title: '项目代码', hide: true, style: 'background-color: #f9f9f9;' }
|
, { field: 'HProName', title: '项目名称', style: 'background-color: #f9f9f9;' }
|
, { field: 'HProjectStageID', title: '项目阶段ID', hide: true, style: 'background-color: #f9f9f9;' }
|
, { field: 'HProjectStageName', title: '项目阶段名称', style: 'background-color: #f9f9f9;' } //f7
|
, { field: 'HName', title: '任务名称', style: 'background-color: #f9f9f9;' }
|
, { field: 'HTaskNote', title: '任务描述', style: 'background-color: #f9f9f9;' }
|
, { field: 'HPlanTimes', title: '预计工时', edit: 'text', totalRow: true }
|
, { field: 'HReportTimes', title: '已汇报工时', totalRow: true, style: 'background-color: #f9f9f9;' }
|
|
, { field: 'HSourceInterID', title: '源单内码', hide: true, style: 'background-color: #f9f9f9;' } //f7
|
, { field: 'HSourceEntryID', title: '源单子内码', hide: true, style: 'background-color: #f9f9f9;' } //f7
|
, { field: 'HSourceBillNo', title: '源单单号', hide: true, style: 'background-color: #f9f9f9;' } //f7
|
, { field: 'HSourceBillType', title: '源单类型', hide: true, style: 'background-color: #f9f9f9;' } //f7
|
// , { fixed: 'right', title: '操作', toolbar: '#barDemo' }
|
]]
|
}
|
|
var rowdata1 = [
|
|
];
|
option1.data = rowdata1;
|
table.render(option1);
|
}
|
//#endregion
|
|
//#region 初始化界面
|
function set_ClearBill() {
|
get_InitGrid();
|
|
//get_FastQuery();
|
get_FastQuery1();
|
|
DisPlay_HideColumn();
|
DisPlay_HideColumn1();
|
}
|
//#endregion
|
|
//#region 未核销采购入库单查询
|
//#region 查询
|
function get_Display(sql) {
|
var ajaxLoad = layer.load();
|
var ModRightNameCheck = "";
|
$.ajax({
|
url: GetWEBURL() + '/CommonModel/searchMethod',
|
type: "GET",
|
async: false,
|
data: { "sql": sql, "user": sessionStorage["HUserName"], "ModRightNameCheck": ModRightNameCheck },
|
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, totalArray) > -1) {
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, totalRow: true, width: 120 });
|
} 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: 120 });
|
break;
|
default:
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 120 });
|
}
|
}
|
}
|
|
|
//设置列
|
option.cols = [col];
|
//处理并设置表格数据
|
option.data = data1.data;
|
table.render(option);
|
//刷新表格数据
|
DisPlay_HideColumn();
|
|
layer.close(ajaxLoad);
|
|
if ($("#Comparator").val() == 0 && $("#ColContent").val() == "" && $("#Comparator1").val() == 0 && $("#ColContent1").val() == "" && $("#Comparator2").val() == 0 && $("#ColContent2").val() == "") {
|
ColFilter();
|
}
|
} else {
|
layer.close(ajaxLoad);
|
layer.alert(data1.code + data1.Message, { icon: 5 });
|
}
|
}, error: function (e) {
|
layer.close(ajaxLoad);
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
});
|
|
}
|
//#endregion
|
|
//#region 快速过滤
|
function get_FastQuery() {
|
//获取登录账户对应职员名称
|
//var HUserName = getHEmpByHUserName();
|
//if (HUserName != "" && HUserName != null) {
|
// sWhere += " and 计划人 = '" + HUserName + "'";
|
//}
|
|
var HOrgID = sessionStorage["OrganizationID"];
|
var HBillNo = $("#HBillNo").val(); //单据号
|
var HSupID = $("#HSupID").val();
|
var HSupName = $("#HSupName").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();
|
|
if (ColName != 0 && Comparator != 0) {
|
var com = "";
|
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;
|
}
|
sWhere += " and " + ColName + " " + com;
|
}
|
if (ColName1 != 0 && Comparator1 != 0) {
|
var com1 = "";
|
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;
|
}
|
if (ColName2 != 0 && Comparator2 != 0) {
|
var com2 = "";
|
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 = "" + Comparator + "'" + ColContent + "'";
|
break;
|
}
|
sWhere += " and " + ColName2 + " " + com2;
|
}
|
|
//if (HBillNo) {
|
// sWhere += " and 单据号 like '%" + HBillNo + "%'";
|
//}
|
|
if (HSupName) {
|
sWhere += " and 供应商 like '" + HSupName + "'";
|
} else {
|
sWhere += " and 1=0";
|
}
|
|
if (HOrgID) {
|
sWhere += " and HOrgID = '" + HOrgID + "'";
|
}
|
|
var sql = "select * from h_v_Cg_POStockInBillList_Sec where 1=1 " + sWhere + " order by 单据号 desc"
|
|
get_Display(sql);
|
sWhere = "";//调用接口后清空sWhere缓存
|
}
|
//#endregion
|
|
//#region 查询按钮
|
form.on('submit(btnSearch)', function (data) {
|
get_FastQuery();
|
});
|
//#endregion
|
|
//#region 重置按钮
|
form.on('submit(btnReSearch)', function (data) {
|
//清空过滤条件
|
set_ClearQuery();
|
});
|
//#endregion
|
|
//#region 重置过滤条件
|
function set_ClearQuery() {
|
$("#HBillNo").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('select');
|
sWhere = "";
|
}
|
//#endregion
|
//#endregion
|
|
//#region 待核销列表查询
|
//#region 查询
|
function get_Display1(sql) {
|
var ajaxLoad = layer.load();
|
var ModRightNameCheck = "";
|
$.ajax({
|
url: GetWEBURL() + '/CommonModel/searchMethod',
|
type: "GET",
|
async: false,
|
data: { "sql": sql, "user": sessionStorage["HUserName"], "ModRightNameCheck": ModRightNameCheck },
|
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, totalArray) > -1) {
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, totalRow: true, width: 120 });
|
} 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: 120 });
|
break;
|
default:
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 120 });
|
}
|
}
|
}
|
|
|
//设置列
|
option1.cols = [col];
|
//处理并设置表格数据
|
option1.data = data1.data;
|
table.render(option1);
|
//刷新表格数据
|
DisPlay_HideColumn1();
|
|
layer.close(ajaxLoad);
|
} else {
|
layer.close(ajaxLoad);
|
layer.alert(data1.code + data1.Message, { icon: 5 });
|
}
|
}, error: function (e) {
|
layer.close(ajaxLoad);
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
});
|
|
}
|
//#endregion
|
|
//#region 快速过滤
|
function get_FastQuery1() {
|
var sql = "select * from h_v_Cg_POStockInBillList_WaitSec where 1=1 " + " and 核销人 = '" + sessionStorage["HUserName"] + "' order by 单据号 desc";
|
get_Display1(sql);
|
}
|
//#endregion
|
//#endregion
|
|
//#region 子表1:隐藏列设置
|
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);//关闭弹窗
|
}
|
})
|
}
|
//#endregion
|
//#region 子表1:显示列数据
|
function DisPlay_HideColumn() {
|
$.ajax({
|
url: GetWEBURL() + '/Xt_grdAlignment_WMES/grdAlignmentWMESList',
|
type: "GET",
|
data: { "HModName": HModName, "user": sessionStorage["HUserName"] },
|
async: false,
|
success: function (data1) {
|
if (data1.data.length != 0) {
|
var dataCol = [];//数据库查询出的列数据
|
var titleData = ["项目ID", "项目阶段ID", "源单内码", "源单子内码", "源单单号", "源单类型"];//不需要显示的字段 可扩展
|
//titleData = [];
|
|
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 (e) {
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
})
|
}
|
//#endregion
|
|
//#region 子表2:隐藏列设置
|
function get_HideColumn1() {
|
var colName = "";
|
var contentUrl = "";
|
for (var i = 1; i < option1.cols[0].length - 1; i++) {
|
colName += option1.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=' + HModName1 + '&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_HideColumn1();
|
//更新表格缓存的数据
|
layer.close(index);//关闭弹窗
|
}
|
})
|
}
|
//#endregion
|
//#region 子表2:显示列数据
|
function DisPlay_HideColumn1() {
|
$.ajax({
|
url: GetWEBURL() + '/Xt_grdAlignment_WMES/grdAlignmentWMESList',
|
type: "GET",
|
data: { "HModName": HModName1, "user": sessionStorage["HUserName"] },
|
async: false,
|
success: function (data1) {
|
if (data1.data.length != 0) {
|
var dataCol = [];//数据库查询出的列数据
|
var titleData = ["项目ID", "项目阶段ID", "源单内码", "源单子内码", "源单单号", "源单类型"];//不需要显示的字段 可扩展
|
//titleData = [];
|
|
dataCol = data1.data[0].HGridString.split(',');
|
|
for (var i = 0; i < option1.cols[0].length - 2; i++) {
|
var dataCols = dataCol[i].split('|');
|
//隐藏列
|
if (dataCols[1] == 1) {
|
option1.cols[0][i + 1]["hide"] = true;
|
}
|
//设置列宽
|
if (dataCols[3] > 0) {
|
option1.cols[0][i + 1]["width"] = dataCols[3];
|
}
|
//设置内容字体大小
|
if (data1.data[0].HFontSize != 0) {
|
option1.cols[0][i + 1]["style"] += "font-size:" + data1.data[0].HFontSize + "px;";
|
} else {
|
option1.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(option1.cols[0][i + 1]["title"], titleData) == -1) {
|
option1.cols[0][i + 1]["hide"] = false;
|
}
|
//字体所在位置(左 居中 右)
|
switch (dataCols[2]) {
|
case "L":
|
option1.cols[0][i + 1]["align"] = "left";
|
break;
|
case "M":
|
option1.cols[0][i + 1]["align"] = "center";
|
break;
|
case "R":
|
option1.cols[0][i + 1]["align"] = "right";
|
break;
|
}
|
}
|
|
//取消冻结列
|
for (var i = 1; i < option1.cols[0].length - 1; i++) {
|
if (option1.cols[0][i]["fixed"] != null) {
|
option1.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(option1.cols[0][i + 1]["title"], titleData) != -1) {
|
data1.data[0].HFixCols += 1;
|
}
|
option1.cols[0][i + 1]["fixed"] = "left";
|
}
|
}
|
table.render(option1);
|
} else {
|
table.render(option1);
|
}
|
}, error: function (e) {
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
})
|
}
|
//#endregion
|
//#endregion
|
});
|
</script>
|
</body>
|
</html>
|