From af1b8e2d783d0589ed5d4807ca1a02d672d14270 Mon Sep 17 00:00:00 2001 From: YL <YL@LAPTOP-SE03PLUR> Date: 星期六, 24 七月 2021 00:34:33 +0800 Subject: [PATCH] 制作通用的单据编辑样例模块(生产汇报单列表/编辑),以方便其他开发人员可以借鉴。 --- WebTM/views/生产管理/生产汇报单/Sc_Add_ICMOReportBillList.html | 496 +++++++++++------------ WebTM/views/生产管理/生产汇报单/Sc_ICMOReportBillList.html | 726 +++++++++++++++++++++------------ WebTM/layuiadmin/Scripts/webConfig.js | 4 WebTM/views/生产管理/生产开工单/Sc_Add_MESBeginWorkBillList.html | 2 4 files changed, 704 insertions(+), 524 deletions(-) diff --git a/WebTM/layuiadmin/Scripts/webConfig.js b/WebTM/layuiadmin/Scripts/webConfig.js index 34475e5..7818b9f 100644 --- a/WebTM/layuiadmin/Scripts/webConfig.js +++ b/WebTM/layuiadmin/Scripts/webConfig.js @@ -6,10 +6,10 @@ //var WEBURL = "http://101.37.171.70/API/"; //鍏徃鏈嶅姟鍣� //var WEBURL = "http://localhost:8080/API/"; //棰滄檽鍐涙湰鍦伴厤缃� //var WEBURL = "http://localhost:8082/lubao"; //棰滄檽鍐涙湰鍦伴厤缃� - //var WEBURL = "http://localhost:8082/LuBaoAPI/"; //鏉ㄩ湶鏈湴閰嶇疆 + var WEBURL = "http://localhost:8082/LuBaoAPI/"; //鏉ㄩ湶鏈湴閰嶇疆 //var WEBURL = "http://10.1.4.154/API/"; //姹熶赴瀹㈡埛 //var WEBURL = "http://10.1.4.155/API/"; //姹熶赴瀹㈡埛NEW - var WEBURL = "http://47.96.97.237/API/"; //鏅轰簯鏈嶅姟鍣� + //var WEBURL = "http://47.96.97.237/API/"; //鏅轰簯鏈嶅姟鍣� //var WEBURL = "http://183.129.128.86:9090/API/"; //鍑礉濂堢壒瀹㈡埛鏈嶅姟鍣� return WEBURL } diff --git "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\345\274\200\345\267\245\345\215\225/Sc_Add_MESBeginWorkBillList.html" "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\345\274\200\345\267\245\345\215\225/Sc_Add_MESBeginWorkBillList.html" index 44e5a94..cf042c3 100644 --- "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\345\274\200\345\267\245\345\215\225/Sc_Add_MESBeginWorkBillList.html" +++ "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\345\274\200\345\267\245\345\215\225/Sc_Add_MESBeginWorkBillList.html" @@ -434,10 +434,12 @@ $("#HMainSourceBillType").val(""); $('#HMainSourceBillNo').attr("disabled", false); $('#XDHList').addClass("layui-btn-disabled").attr("disabled", true); + Type = 1; } else { $('#HMainSourceBillNo').attr("disabled", true); $('#XDHList').removeClass("layui-btn-disabled").attr("disabled", false); + Type = 2; } }); diff --git "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\346\261\207\346\212\245\345\215\225/Sc_Add_ICMOReportBillList.html" "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\346\261\207\346\212\245\345\215\225/Sc_Add_ICMOReportBillList.html" index beab3e3..300880a 100644 --- "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\346\261\207\346\212\245\345\215\225/Sc_Add_ICMOReportBillList.html" +++ "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\346\261\207\346\212\245\345\215\225/Sc_Add_ICMOReportBillList.html" @@ -90,18 +90,18 @@ <div class="layui-inline"> <label class="layui-form-label">婧愬崟绫诲瀷</label> <div class="layui-input-inline"> - <select name="HSourceBillType" lay-filter="HSourceBillType" id="HSourceBillType"> - <option value="0" selected="selected">鐢熶骇浠诲姟鍗�</option> - <option value="1">鎵嬪伐褰曞叆</option> + <select name="HMainSourceBillType" lay-filter="HMainSourceBillType" id="HMainSourceBillType"> + <option value="2">鐢熶骇浠诲姟鍗�</option> + <option value="1" selected="selected">鎵嬪伐褰曞叆</option> </select> </div> </div> <div class="layui-inline"> <label class="layui-form-label">閫夊崟鍙�</label> <div class="layui-input-inline"> - <input type="text" name="HSourceBillNo" id="HSourceBillNo" class="layui-input" value="" style="float:left;width:150px;"> - <input type="hidden" name="HSourceInterID" id="HSourceInterID" class="layui-input" value="" style="float:left;width:150px;"> - <input type="hidden" name="HSourceEntryID" id="HSourceEntryID" class="layui-input" value="" style="float:left;width:150px;"> + <input type="text" name="HMainSourceBillNo" id="HMainSourceBillNo" class="layui-input" value="" style="float:left;width:150px;"> + <input type="hidden" name="HMainSourceInterID" id="HMainSourceInterID" class="layui-input" value="" style="float:left;width:150px;"> + <input type="hidden" name="HMainSourceEntryID" id="HMainSourceEntryID" class="layui-input" value="" style="float:left;width:150px;"> <button type="button" lay-submit="" class="layui-btn" lay-filter="XDHList" id="XDHList" style="width:40px;"> <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i> </button> @@ -162,6 +162,8 @@ var params = getUrlVars(); var hID = params[params[0]];//缂栬緫鏌ョ湅 + var Type = params[params[1]] == undefined ? "1" : params[params[1]];//鍗曟嵁缂栬緫鐘舵�侊細 1.鏃犳簮鍗曟柊澧灺� 聽2.鏈夋簮鍗曟柊澧灺� 聽3.缂栬緫聽 4.娴忚聽 5.鍙樻洿 + var Sctag = "0"; layui.config({ @@ -177,122 +179,83 @@ , laydate = layui.laydate , element = layui.element; - - //甯歌鐢ㄦ硶 - laydate.render({ - elem: '#HDate' + //鍏叡鍙橀噺 + var option = []; - }); - //鍒ゆ柇鏄惁鐧诲綍 鏈櫥褰曞垯璺冲埌鐧诲綍椤� - //if (sessionStorage.login != "login") { - // layer.confirm("鐧诲綍澶辨晥锛岃閲嶆柊鐧诲綍锛�", { - // icon: 4, skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず", closeBtn: 0, btn: ['閲嶆柊鐧诲綍'] - // }, function () { window.location.href = "../../user/login.html"; }); - //} - //var tableReload = table.reload; - var option = { - id:'mainTable' - ,elem: '#mainTable' - , toolbar: '#toolbarDemo' - , height: 500 - //,url: '/demo/table/user/' //鏁版嵁鎺ュ彛 - , page: true //寮�鍚垎椤� - , cols: [[ //琛ㄥご - { type: 'checkbox', fixed: 'left' } - , { templet: '#xuhao', title: '搴忓彿', sort: true, fixed: 'left', event: "qwe", width: 100 } - , { field: 'HMaterID', title: 'HMaterID', edit: 'text', width: 100, hide: true } - , { field: 'HMaterCode', title: '鐗╂枡浠g爜', edit: 'text', event: 'HMaterCode', width: 100 } - , { field: 'HMaterName', title: '鐗╂枡鍚嶇О', edit: 'text', width: 100 } - , { field: 'HMaterSpec', title: '瑙勬牸鍨嬪彿', edit: 'text', width: 100 } - , { field: 'HUnitID', title: 'HUnitID', edit: 'text', width: 100, hide: true } - , { field: 'HUnitCode', title: '鍗曚綅浠g爜', edit: 'text', event: 'HUnitCode', width: 100 } - , { field: 'HUnitName', title: '鍗曚綅鍚嶇О', edit: 'text', width: 100 } - , { field: 'HSourceID', title: 'HSourceID', edit: 'text', width: 100, hide: true } - , { field: 'HSourceCode', title: '璧勬簮浠g爜', edit: 'text', event: 'HSourceCode', width: 100 } - , { field: 'HSourceName', title: '璧勬簮鍚嶇О', edit: 'text', width: 100 } - , { field: 'HWorkerid', title: 'HWorkerid', edit: 'text', width: 100, hide: true } - , { field: 'HWorkerCode', title: '鎿嶄綔鍛樹唬鐮�', edit: 'text', event: 'HWorkerCode', width: 100 } - , { field: 'HWorkerName', title: '鎿嶄綔鍛樺悕绉�', edit: 'text', width: 100 } - , { field: 'HQty', title: '鐢熶骇鏁伴噺', edit: 'text', width: 100 } - , { field: 'HRemark', title: '琛ㄤ綋澶囨敞', edit: 'text', width: 100 } - , { fixed: 'right', title: '鎿嶄綔', toolbar: '#barDemo', width: 150 } - ]] - , limit: 500 //姣忛〉榛樿鏄剧ず鐨勬暟閲� - }; - - - //鍒ゆ柇鏄惁鏂板 - if (hID == null || hID == 0) { - //鍒濆鍔犺浇琛ㄦ牸{ "ID": 0, "HWasterReasonName": " ","HBadReasonID":0,"HEmpName": " ", "HSQProcName": " ","HProcID":0, "HZRProcName": " ", "HMRBChecker": " ", "HRemark": " ", "HPSProcName": " ", "HCloseMan": " " } - option.data = [TabRow]; - table.render(option); - } - else { - $("#HInterID").val(hID);//淇敼鏃朵富琛↖D - //缂栬緫鍔犺浇鏁版嵁 - $.ajax({ - url: GetWEBURL() + 'Sc_ICMOReportBill/Sc_ICMOReportBillListProjectDetai', - type: "GET", - data: { "sqlWhere": "and hmainid=" + hID }, - success: function (result) { - //console.log(result); - //console.log('gouba' + result); - if (result.count == 1) { - option.data = result.data; - table.render(option); - - } else { - layer.alert(result.code + result.Message, { icon: 5 }); - } - }, error: function () { - layer.close(index0); - layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 }); - } - }); - - } - + //鍒濆鍖栬〃鍗曟彃浠� + set_InitFrom(); //澶村伐鍏锋爮浜嬩欢 - var rowid = 0; - var rows = 0; table.on('toolbar(mainTable)', function (obj) { + var rowid = 0; + var rows = 0; var checkStatus = table.checkStatus('mainTable') , data = checkStatus.data;; var AddRow = table.cache['mainTable']; var NewRow = TabRow; switch (obj.event) { - case 'btn-AddLine': - //table.cache["mainTable"].push(AddRow[rows]); - table.cache["mainTable"].push(NewRow); - option.data = table.cache["mainTable"]; - table.render(option); - rows++; - layer.msg('澧炲姞涓�琛屾寜閽紒') + case 'btn-AddLine': btnAddLine(NewRow); break; - case 'btn-CopyLine': - var copydata = JSON.stringify(data); - if (data.length <= 0) { - layer.alert("璇烽�夋嫨闇�瑕佸鍒剁殑涓�琛岋紒"); - } - else if (data.length > 1) { - layer.alert("鍙兘閫夋嫨澶嶅埗涓�琛岋紒"); - } - else { - var copydata2 = copydata.substring(1, copydata.length);//鍘婚櫎棣栬瀛楃'[' - var copyrow = copydata2.substring(0, copydata2.length - 1);//鍘婚櫎鏈熬瀛楃']' - table.cache["mainTable"].push(JSON.parse(copyrow));//灏嗗鍒剁殑琛屽己杞垚json杩藉姞鍒拌〃鏍间笂 - option.data = table.cache["mainTable"];//灏嗘暟鎹粦瀹氬埌data涓� - table.render(option);//灏嗘暟鎹覆鏌撳埌琛ㄦ牸涓� - //layer.alert(copyrow); - } + case 'btn-CopyLine': btnCopyLine(data); + break; } }); + //琛屽唴浜嬩欢 table.on('tool(mainTable)', function (obj) { + set_GridDelete(obj); //琛屽唴鍒犻櫎 + set_GridCellCheck(obj); //琛屽唴蹇嵎閿瓫閫� + }); + //鍒濆鍖栬〃鏍� + set_InitGrid(); + + //鍒ゆ柇鏄簮鍗曟柊澧炪�佹棤婧愬崟鏂板銆佺紪杈� + set_Type(Type); + + //鍒ゆ柇鏄惁婧愬崟鏂板銆佹垨鑰呯紪杈� + set_CheckSelect(); + + + //鍒濆鍖栬〃鍗� + function set_InitFrom() { + laydate.render({ + elem: '#HDate' + + }); + } + + //琛ㄦ牸澧炲姞琛屼簨浠� + function btnAddLine(NewRow) { + table.cache["mainTable"].push(NewRow); + option.data = table.cache["mainTable"]; + table.render(option); + rows++; + layer.msg('澧炲姞涓�琛屾寜閽紒') + } + + //琛ㄦ牸澶嶅埗琛屼簨浠� + function btnCopyLine(data) { + var copydata = JSON.stringify(data); + if (data.length <= 0) { + layer.alert("璇烽�夋嫨闇�瑕佸鍒剁殑涓�琛岋紒"); + } + else if (data.length > 1) { + layer.alert("鍙兘閫夋嫨澶嶅埗涓�琛岋紒"); + } + else { + var copydata2 = copydata.substring(1, copydata.length);//鍘婚櫎棣栬瀛楃'[' + var copyrow = copydata2.substring(0, copydata2.length - 1);//鍘婚櫎鏈熬瀛楃']' + table.cache["mainTable"].push(JSON.parse(copyrow));//灏嗗鍒剁殑琛屽己杞垚json杩藉姞鍒拌〃鏍间笂 + option.data = table.cache["mainTable"];//灏嗘暟鎹粦瀹氬埌data涓� + table.render(option);//灏嗘暟鎹覆鏌撳埌琛ㄦ牸涓� + } + } + + //琛ㄦ牸琛屽唴浜嬩欢鍒犻櫎 + function set_GridDelete(obj) { var data = obj.data; var rowIndex = $(obj.tr).attr("data-index"); if (obj.event === 'del') { @@ -305,17 +268,13 @@ option.data = table.cache["mainTable"];//灏嗘暟鎹粦瀹氬埌data涓� table.reload(option); layer.close(index); - //obj.del(); - //layer.close(index); - - //var oldData = table.cache["mainTable"]; - //oldData.splice(obj.tr.data('index'), 1); - //table.reload('mainTable', { data: oldData }); - //layer.close(index); } }); } + } + //琛ㄦ牸琛屽唴浜嬩欢蹇嵎閿瓫閫� + function set_GridCellCheck(obj) { $(document).off('keydown', ".layui-table-edit").on('keydown', '.layui-table-edit', function (e) { if (event.key == "F7") { if (obj.event === 'HMaterCode') //鐗╂枡淇℃伅 @@ -487,19 +446,115 @@ } }) + } - }); + //鍒濆鍖栬〃鏍� + function set_InitGrid() { + var columns = [ + { type: 'checkbox', fixed: 'left' } + , { templet: '#xuhao', title: '搴忓彿', sort: true, fixed: 'left', event: "qwe", width: 100 } + , { field: 'HMaterID', title: 'HMaterID', edit: 'text', width: 100, hide: true } + , { field: 'HMaterCode', title: '鐗╂枡浠g爜', edit: 'text', event: 'HMaterCode', width: 100 } + , { field: 'HMaterName', title: '鐗╂枡鍚嶇О', edit: 'text', width: 100 } + , { field: 'HMaterSpec', title: '瑙勬牸鍨嬪彿', edit: 'text', width: 100 } + , { field: 'HUnitID', title: 'HUnitID', edit: 'text', width: 100, hide: true } + , { field: 'HUnitCode', title: '鍗曚綅浠g爜', edit: 'text', event: 'HUnitCode', width: 100 } + , { field: 'HUnitName', title: '鍗曚綅鍚嶇О', edit: 'text', width: 100 } + , { field: 'HSourceID', title: 'HSourceID', edit: 'text', width: 100, hide: true } + , { field: 'HSourceCode', title: '璧勬簮浠g爜', edit: 'text', event: 'HSourceCode', width: 100 } + , { field: 'HSourceName', title: '璧勬簮鍚嶇О', edit: 'text', width: 100 } + , { field: 'HWorkerid', title: 'HWorkerid', edit: 'text', width: 100, hide: true } + , { field: 'HWorkerCode', title: '鎿嶄綔鍛樹唬鐮�', edit: 'text', event: 'HWorkerCode', width: 100 } + , { field: 'HWorkerName', title: '鎿嶄綔鍛樺悕绉�', edit: 'text', width: 100 } + , { field: 'HQty', title: '鐢熶骇鏁伴噺', edit: 'text', width: 100 } + , { field: 'HRemark', title: '琛ㄤ綋澶囨敞', edit: 'text', width: 100 } + , { fixed: 'right', title: '鎿嶄綔', toolbar: '#barDemo', width: 150 } + ]; + option = { + id: 'mainTable' + , elem: '#mainTable' + , toolbar: '#toolbarDemo' + , page: false + , cellMinWidth: 120 + , height: 500 + , cols: [columns] + , done: function (res, curr, count) { + } + }; + } + //鑾峰彇鏈�澶у崟鎹彿 + function set_MAXNum() { + var date = new Date(); + var day = date.getDate(); + var month = date.getMonth() + 1; + var year = date.getFullYear(); + var shijian = year + "-" + month + "-" + day; + //鑾峰彇鏈�澶у崟鎹彿 new + $("#HInterID").val("0"); + $("#HBillNo").val(""); + $.ajax({ + url: GetWEBURL() + "/Web/GetMAXNum", + type: "GET", + data: { "HBillType": '3711' }, + success: function (d) { + //console.log(d.data); + $("#HBillNo").val(d.data[0].HBillNo); + $("#HDate").val(shijian); + $("#HInterID").val(0); + } + }); + } + //鍒ゆ柇鏄簮鍗曟柊澧炪�佹棤婧愬崟鏂板銆佺紪杈� + function set_Type(Type) { + console.log(Type); + switch (Type) { + //鏃犳簮鍗曟柊澧� + case '1': set_AddFNew(); + break; + //鏈夋簮鍗曟柊澧灺� 聽 + case '2': set_AddNew(); + break; + //缂栬緫聽 + case '3': set_EditFromGrid(); + break; + } + } - - - - function RoadBillMain(hID)//鍔犺浇琛ㄥご + //鏃犳簮鍗曟柊澧� + function set_AddFNew() { - + + //鑾峰彇鏈�澶у崟鎹彿 + set_MAXNum(); + $('#HMainSourceBillNo').attr("disabled", false); + $('#XDHList').addClass("layui-btn-disabled").attr("disabled", true); + option.data = [TabRow]; + table.render(option); + } + + //鏈夋簮鍗曟柊澧� + function set_AddNew() { + //鑾峰彇鏈�澶у崟鎹彿 + set_MAXNum(); + option.data = [TabRow]; + table.render(option); + } + + //缂栬緫鑾峰彇琛ㄥご銆佽幏鍙栬〃浣� + function set_EditFromGrid() { + set_EditForm(hID); //缂栬緫鑾峰彇琛ㄥご + set_EditGrid(hID); //缂栬緫鑾峰彇琛ㄤ綋 + option.data = [TabRow]; + table.render(option); + } + + //缂栬緫鑾峰彇琛ㄥご + function set_EditForm(hID) { + //鏌ヨ妫�楠屾柟妗堝崟鏄惁瀛樺湪 $.ajax({ url: GetWEBURL() + "Sc_ICMOReportBill/Sc_GetICMOReportBillListCheckDetai", @@ -523,8 +578,9 @@ , "HGroupName": data.鐝粍 //鐝粍鍚嶇О , "HEmpID": data.HEmpID //缁熻鍛業D , "HEmpName": data.缁熻鍛� //缁熻鍛樺悕绉� - , "HSourceBillType": "" //婧愬崟绫诲瀷 - , "XDH": "" //閫夊崟鍙� + , "HMainSourceBillNo": data.HMainSourceBillNo + , "HMainSourceInterID": data.HMainSourceInterID + , "HMainSourceEntryID": data.HMainSourceEntryID , "HExplanation": "" //鎽樿 , "HRemark": data.琛ㄥご澶囨敞 //澶囨敞 }); @@ -538,46 +594,56 @@ }); } - - var date = new Date(); - var day = date.getDate(); - var month = date.getMonth() + 1; - var year = date.getFullYear(); - var shijian = year + "-" + month + "-" + day; - - //鍒ゆ柇鏄惁鏂板 - if (hID == null || hID == 0) { - //鑾峰彇鏈�澶у崟鎹彿 new - $("#HInterID").val("0"); - $("#HBillNo").val(""); + //缂栬緫鑾峰彇琛ㄤ綋 + function set_EditGrid(hID) { + $("#HInterID").val(hID);//淇敼鏃朵富琛↖D + //缂栬緫鍔犺浇鏁版嵁 $.ajax({ - url: GetWEBURL() + "/Web/GetMAXNum", + url: GetWEBURL() + 'Sc_ICMOReportBill/Sc_ICMOReportBillListProjectDetai', type: "GET", - data: { "HBillType": '3711' }, - success: function (d) { - //console.log(d.data); - $("#HBillNo").val(d.data[0].HBillNo); - $("#HDate").val(shijian); - $("#HInterID").val(0); + data: { "sqlWhere": "and hmainid=" + hID }, + success: function (result) { + if (result.count == 1) { + option.data = result.data; + table.render(option); + + } else { + layer.alert(result.code + result.Message, { icon: 5 }); + } + }, error: function () { + layer.close(index0); + layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 }); } }); } - else {//濡傛灉淇敼鍒欒蛋涓嬮潰 new - RoadBillMain(hID); - /* RoadBillSub(linterid);*/ - } - //鑾峰彇涓嬫媺閫変腑鍊� - form.on('select(HSourceBillType)', function (data) { - Sctag = data.value; - form.render('select'); - if (Sctag != "0") { - $('#XDHList').addClass("layui-btn-disabled").attr("disabled", true); - } - else { - $('#XDHList').removeClass("layui-btn-disabled").attr("disabled", false); - } - }); + + //鐩戣涓嬫媺妗嗘槸鍚︽簮鍗� + function set_CheckSelect() { + //鑾峰彇涓嬫媺閫変腑鍊� + form.on('select(HMainSourceBillType)', function (data) { + Sctag = data.value; + form.render('select'); + switch (Sctag) { + //鏃犳簮鍗曟柊澧� + case '1': + $("#HMainSourceInterID").val("0"); + $("#HMainSourceEntryID").val("0"); + $('#HMainSourceBillNo').attr("disabled", false); + $('#XDHList').addClass("layui-btn-disabled").attr("disabled", true); + Type = 1; + break; + //鏈夋簮鍗曟柊澧灺� 聽 + case '2': + $("#HMainSourceInterID").val("0"); + $("#HMainSourceEntryID").val("0"); + $('#HMainSourceBillNo').attr("disabled", true); + $('#XDHList').removeClass("layui-btn-disabled").attr("disabled", false); + Type = 2; + break; + } + }); + } //琛ㄥご淇℃伅杞﹂棿寮圭獥 @@ -721,18 +787,18 @@ //var rowIndex = $("#mainTable").find("tbody tr").attr('data-index');//褰撳墠琛岀殑绱㈠紩 //$(".layui-table-view .layui-table tbody tr[data-index=" + 1+ "]").remove(); - $("#HSourceBillNo").val(checkStatus.data[0].鍗曟嵁鍙�); - $("#HSourceInterID").val(checkStatus.data[0].hmainid); - $("#HSourceEntryID").val(checkStatus.data[0].HEntryID); + $("#HMainSourceBillNo").val(checkStatus.data[0].鍗曟嵁鍙�); + $("#HMainSourceInterID").val(checkStatus.data[0].hmainid); + $("#HMainSourceEntryID").val(checkStatus.data[0].HEntryID); var list = []; - for (var i = 0; i <checkStatus.data.length; i++) { + for (var i = 0; i < checkStatus.data.length; i++) { list.push(checkStatus.data[i].鍗曟嵁鍙�) } if (isAllEqual(list)) //鐩稿悓鍗曞彿 { - if (checkStatus.data.length>1) - { - for (var i = 0; i < checkStatus.data.length-1; i++) //琛ヨ + console.log(checkStatus.data); + if (checkStatus.data.length > 1) { + for (var i = 0; i < checkStatus.data.length - 1; i++) //琛ヨ { //var NewRow = { "HMaterID": 0, "HMaterCode": "", "HMaterName": "", "HMaterSpec": "", "HUnitID": 0, "HUnitCode": "", "HUnitName": "", "HSourceID": 0, "HSourceCode": "", "HSourceName": "", "HWorkerid": 0, "HWorkerCode": "", "HWorkerName": "", "HQty": 0, "HRemark": "" }; table.cache["mainTable"].push(TabRow); @@ -751,11 +817,10 @@ } layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨� } - else - { + else { layer.msg("璇烽�夋嫨鐩稿悓鍗曞彿!", { time: 1 * 2000, icon: 5 }); } - + } , btn2: function (index, layero) { //鎸夐挳銆愭寜閽簩銆戠殑鍥炶皟 @@ -771,22 +836,13 @@ }); - + //閫�鍑� form.on('submit(Exit)', function (data) {// var index = parent.layer.getFrameIndex(window.name); //鍏堝緱鍒板綋鍓峣frame灞傜殑绱㈠紩 parent.layer.close(index); //鍐嶆墽琛屽叧闂� }); - - - - - form.on('submit(Cancel)', function () { - //sessionStorage["SourceFlag"] = false; - parent.location.href = "../../../views/index.html" - //window.close();//鍏抽棴褰撳墠椤� - }) - + //缂栬緫鑾峰彇琛ㄤ綋鏃舵椂闂存牸寮忕煫姝f柟寮� function formatDate(date) { var d = new Date(date), month = '' + (d.getMonth() + 1), @@ -799,6 +855,7 @@ return [year, month, day].join('-'); } + //鎻愪氦淇濆瓨 form.on('submit(Saver)', function (data) {//淇濆瓨 var refSav = ""; if (hID == "" || hID == null) { @@ -819,7 +876,6 @@ return false; } - $.ajax( { type: "POST", @@ -836,39 +892,18 @@ }); } else { - - f_alert(data.Message); - console.log("Reason" + sMainStr + "sub:" + JSON.stringify(layui.table.cache.mainTable)); + layer.alert(data.Message, { icon: 5 }); } - layer.closeAll("loading"); }, error: function (err) { - - f_alert("閿欒:" + err); - console.log("Reason" + sMainStr); + layer.alert(err.Message, { icon: 5 }); } }); - }); - - function f_alert(sMsg) { - layer.alert(sMsg, { icon: 5 }); - - } - - //鐩戝惉鎻愪氦 - form.verify({ - numberOrEmpty: function (value, item) { - // if (value != '') { - if (!/^\d+$/.test(value)) { - return '涓嶈兘涓虹┖鎴栨暟瀛楁垨鑰�0'; - } - //} - } - }); - - + }) }); - //鍒ゆ柇鏁扮粍涓殑鍊兼槸鍚︾浉鍚� + + + //鍒ゆ柇婧愬崟甯﹀洖鏁版嵁鏁扮粍涓殑鍊兼槸鍚︾浉鍚� function isAllEqual(array) { if (array.length > 0) { return !array.some(function (value, index) { @@ -879,61 +914,8 @@ } } - //瀹氫箟鍏ㄥ眬鍙橀噺 - var HReasonName, ReasonID, EmpName, SQProcName, - ProcID, ZRProcName, QRName - ; - function GetHReasonValue(obj) //杩斿洖涓嶈壇鍘熷洜 - { - HReasonName = obj[0].HName; - ReasonID = obj[0].HItemID; - } - //杩斿洖鐗╂枡 - function GetHMaterNameValue(obj) { //杩斿洖鐗╂枡 - $("#HMater").val(obj[0].HName); - $("#HMaterID").val(obj[0].HItemID); - $("#HMaterNumber").val(obj[0].HNumber); - } - //杩斿洖宸ュ簭 - function GetHProcValue(obj) { //杩斿洖宸ュ簭 - $("#HProcName").val(obj[0].宸ュ簭); - $("#HProcID").val(obj[0].HItemID); - $("#HProcNumber").val(obj[0].宸ュ簭浠g爜); - } - function GetHDeptNameValue(obj) { //杩斿洖閮ㄩ棬 - $("#HDepName").val(obj[0].HName); - $("#HDeptID").val(obj[0].HItemID); - $("#HDeptNumber").val(obj[0].HNumber); - } - //杩斿洖鍗曚綅 - function GetHUnitNameValue(obj) { - $("#HUName").val(obj[0].HName); - $("#HUnitID").val(obj[0].HItemID); - $("#HUnitNumber").val(obj[0].HNumber); - } - function GetHKeeperValue(obj) { //杩斿洖璐d换浜� - EmpName = obj[0].HName; - // $("#HEmpName").val(obj[0].HName); - //$("#HItemID").val(obj[0].HItemID); - } - //function GetHProcValue(obj) { //杩斿洖鐢宠宸ュ簭 - // SQProcName = obj[0].宸ュ簭; - // ProcID = obj[0].HItemID; - // //$("#HSQProcName").val(obj[0].宸ュ簭); - // //$("#HProcID").val(obj[0].HItemID); - //} - function GetHZRValue(obj) { //杩斿洖璐d换宸ュ簭 - ZRProcName = obj[0].宸ュ簭; - //$("#HZRProcName").val(obj[0].宸ュ簭); - //$("#HItemID").val(obj[0].HItemID); - } - //HWorker - function GetHWorkerValue(obj) { //杩斿洖涓嶈壇纭浜� - QRName = obj[0].HName; - //$("#HQRName").val(obj[0].HName); - //$("#HItemID").val(obj[0].HItemID); - } + function AllowLoadData(sSubStr) { //闈炵┖楠岃瘉 var Result = true; if ($("#HDeptID").val() == '' || $("#HDeptID").val() == null) { diff --git "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\346\261\207\346\212\245\345\215\225/Sc_ICMOReportBillList.html" "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\346\261\207\346\212\245\345\215\225/Sc_ICMOReportBillList.html" index 2966867..87626c5 100644 --- "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\346\261\207\346\212\245\345\215\225/Sc_ICMOReportBillList.html" +++ "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\346\261\207\346\212\245\345\215\225/Sc_ICMOReportBillList.html" @@ -1,8 +1,8 @@ 锘�<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> -<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> -<title>鐢熶骇姹囨姤鍗曞垪琛�</title> + <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"> @@ -15,7 +15,7 @@ } </style> <script src="../../../layuiadmin/layui/layui.js"></script> - + <script src="../../../layuiadmin/zgqCustom/zgqCustom.js"></script> </head> <body> <div class="layui-fluid"> @@ -32,7 +32,7 @@ </div> <div class="layui-inline"> <label class="layui-form-label">鐘舵��</label> - <div class="layui-input-block" > + <div class="layui-input-block"> <select name="Status" lay-filter="Status" style="width:190px;"> <option value="-1" selected="selected">鍏ㄩ儴</option> <option value="0">鏈鏍�</option> @@ -44,13 +44,13 @@ <div class="layui-inline"> <label class="layui-form-label">寮�濮嬫棩鏈�</label> <div class="layui-input-block"> - <input type="date" class="layui-input" id="HDate" style="width:190px;"> + <input type="date" class="layui-input" id="HBeginDate" style="width:190px;"> </div> </div> <div class="layui-inline"> <label class="layui-form-label">缁撴潫鏃ユ湡</label> <div class="layui-input-block"> - <input type="date" class="layui-input" id="HDate1" style="width:190px;"> + <input type="date" class="layui-input" id="HEndDate" style="width:190px;"> </div> </div> <div class="layui-inline"> @@ -93,6 +93,9 @@ <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Delete"><i class="layui-icon layui-icon-delete"></i>鍒犻櫎</button> <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Audit"><i class="layui-icon layui-icon-radio"></i>瀹℃牳</button> <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-DeAudit"><i class="layui-icon layui-icon-circle"></i>鍙嶅鏍�</button> + <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Print"><i class="layui-icon layui-icon-circle"></i>棰勮</button> + <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Cell"><i class="layui-icon layui-icon-ok"></i>淇濆瓨鍒楀</button> + <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-RefreshCell"><i class="layui-icon layui-icon-refresh"></i>榛樿鍒楀</button> <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-reload" style="display:none;"><i class="layui-icon layui-icon-refresh"></i>鍒锋柊</button> <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-confirm" id="btn_confirm" style="display:none;"><i class="layui-icon layui-icon-ok-circle"></i>纭</button> <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-back" id="btn_back" style="display:none;"><i class="layui-icon layui-icon-close-fill"></i>椹冲洖</button> @@ -125,257 +128,118 @@ , form = layui.form , element = layui.element , laypage = layui.laypage - , laydate = layui.laydate - var sWhere = ""; + , laydate = layui.laydate - var option = { - elem: '#mainTable' - , toolbar: '#toolbarDemo' - ,height: 'full-50' - , page: true - ,cellMinWidth: 90 - , cols: [[ - { type: 'checkbox', fixed: 'left' } - , { field: 'hmainid', title: 'hmainid', sort: true, hide: true, width: 200} - , { field: '鏃ユ湡', title: '鏃ユ湡', width: 160,templet: "<div>{{d.鏃ユ湡 ==null ?'':layui.util.toDateString(d.鏃ユ湡, 'yyyy-MM-dd')}}</div>"} - , { field: '鍗曟嵁鍙�', title: '鍗曟嵁鍙�', width: 200} - , { field: '鐝粍浠g爜', title: '鐝粍浠g爜', width: 200 } - , { field: '鐝粍', title: '鐝粍', width: 200 } - , { field: '鎿嶄綔鍛�', title: '鎿嶄綔鍛�', width: 200} - , { field: '鐢熶骇璧勬簮浠g爜', title: '鐢熶骇璧勬簮浠g爜', width: 200 } - , { field: '鐢熶骇璧勬簮', title: '鐢熶骇璧勬簮', width: 200} - , { field: '琛ㄥご澶囨敞', title: '琛ㄥご澶囨敞', width: 200 } - , { field: 'hsubid', title: 'hsubid', hide: true, width: 200} - , { field: 'hmaterid', title: 'hmaterid', hide: true, width: 200} - , { field: '鐗╂枡浠g爜', title: '鐗╂枡浠g爜', width: 200} - , { field: '鐗╂枡鍚嶇О', title: '鐗╂枡鍚嶇О', width: 200} - , { field: '瑙勬牸鍨嬪彿', title: '瑙勬牸鍨嬪彿', width: 200} - , { field: 'hunitid', title: 'hunitid', hide: true, width: 200} - , { field: '璁¢噺鍗曚綅浠g爜', title: '璁¢噺鍗曚綅浠g爜', width: 200} - , { field: '璁¢噺鍗曚綅', title: '璁¢噺鍗曚綅', width: 200} - , { field: '鐢熶骇鏁伴噺', title: '鐢熶骇鏁伴噺', width: 200} - , { field: '鐢熶骇浠诲姟鍗曞彿', title: '鐢熶骇浠诲姟鍗曞彿', width: 200} - , { field: '琛ㄤ綋澶囨敞', title: '琛ㄤ綋澶囨敞', width: 200} - , { field: '鍒跺崟浜�', title: '鍒跺崟浜�', width: 200} - , { field: '鍒跺崟鏃ユ湡', title: '鍒跺崟鏃ユ湡', width: 200, templet: "<div>{{d.鍒跺崟鏃ユ湡 ==null ?'':layui.util.toDateString(d.鍒跺崟鏃ユ湡, 'yyyy-MM-dd HH:mm:ss')}}</div>" } - , { field: '瀹℃牳浜�', title: '瀹℃牳浜�', width: 200 } - , { field: '瀹℃牳鏃ユ湡', title: '瀹℃牳鏃ユ湡', width: 200, templet: "<div>{{d.瀹℃牳鏃ユ湡 ==null ? '':layui.util.toDateString(d.瀹℃牳鏃ユ湡, 'yyyy-MM-dd HH:mm:ss')}}</div>" } - , { field: '淇敼浜�', title: '淇敼浜�', width: 200 } - , { field: '淇敼鏃ユ湡', title: '淇敼鏃ユ湡', width: 200, templet: "<div>{{d.淇敼鏃ユ湡 ==null ?'':layui.util.toDateString(d.淇敼鏃ユ湡, 'yyyy-MM-dd HH:mm:ss')}}</div>" } - , { field: '鍏抽棴浜�', title: '鍏抽棴浜�', width: 200 } - , { field: '鍏抽棴鏃ユ湡', title: '鍏抽棴鏃ユ湡', width: 200, templet: "<div>{{d.鍏抽棴鏃ユ湡 ==null ?'':layui.util.toDateString(d.鍏抽棴鏃ユ湡, 'yyyy-MM-dd HH:mm:ss')}}</div>" } - , { field: '浣滃簾浜�', title: '浣滃簾浜�', width: 200 } - , { field: '浣滃簾鏃ユ湡', title: '浣滃簾鏃ユ湡', width: 200, templet: "<div>{{d.浣滃簾鏃ユ湡 ==null ?'':layui.util.toDateString(d.浣滃簾鏃ユ湡, 'yyyy-MM-dd HH:mm:ss')}}</div>" } - , { field: 'HICMOInterID', title: 'HICMOInterID', hide: true, width: 200} - , { field: 'HEmpID', title: 'HEmpID', hide: true, width: 200} - , { field: 'HEmpName', title: 'HEmpName', hide: true, width: 200} - , { field: 'HSourceID', title: 'HSourceID', hide: true, width: 200} - , { field: 'HSourceName', title: 'HSourceName', hide: true, width: 200} - , { field: 'HGroupID', title: 'HGroupID', hide: true, width: 200} - , { field: 'HGroupName', title: 'HGroupName', hide: true, width: 200} - , { field: 'HEmpNumber', title: 'HEmpNumber', hide: true, width: 200} - ]] - }; + //鍏叡鍙橀噺 + var sWhere = ""; + var option = []; + var DataList; + var Name = "ICMReportCellWidth"; + + //鍒濆鍖栬〃鏍� + set_InitGrid(); + + //鍔犺浇鏁版嵁鍒扮綉鏍� + get_Display(sWhere); //澶村伐鍏锋爮浜嬩欢 table.on('toolbar(mainTable)', function (obj) { - var checkStatus = table.checkStatus(obj.config.id); switch (obj.event) { - case 'btn-Add': - //椤甸潰灞�-鑷畾涔� - layer.open({ - type: 2, - skin: 'layui-layer-rim', //鍔犱笂杈规 - title: '鏂板鐢熶骇姹囨姤鍗�', - closeBtn: 1, - shift: 2, - area: ['100%', '100%'], - maxmin: true, - content: '../鐢熶骇姹囨姤鍗�/Sc_Add_ICMOReportBillList.html', - end: function () { - //鍒锋柊椤甸潰, - location.reload(); - }, - success: function (layero, index) { - - } - }); + //鏂板鎸夐挳 + 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: '缂栬緫鐢熶骇姹囨姤鍗�' - , closeBtn: 1 - , shade: 0.6 //閬僵閫忔槑搴� - , maxmin: true //鍏佽鍏ㄥ睆鏈�灏忓寲 - , anim: 0 //0-6鐨勫姩鐢诲舰寮忥紝-1涓嶅紑鍚� - , content: '../鐢熶骇姹囨姤鍗�/Sc_Add_ICMOReportBillList.html?hID=' + hID - , resize: false, - end: function () { - //鍒锋柊椤甸潰, - location.reload(); - } - , cancel: function () { - //$(".layui-btn").removeClass("layui-btn-disabled"); - } - }) - - } else { - layer.msg('璇烽�夋嫨涓�琛屾暟鎹紪杈戯紒'); - } - + //缂栬緫鎸夐挳 + case 'btn-Edit': set_ShowBill(); 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) { - $.ajax({ - type: "GET", - url: GetWEBURL() + "Sc_ICMOReportBill/DeltetICMOReportBill", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚� - data: { "HInterID": InterID }, - success: function (result) { - if (result.count == 1) { - layer.msg(result.Message, { time: 1 * 1000, 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('璇烽�夋嫨涓�琛屾暟鎹垹闄わ紒'); - } + //鍒犻櫎鎸夐挳 + case 'btn-Delete': set_DeleteBill(); break; - - case 'btn-Audit': - var checkStatus = table.checkStatus('mainTable') - , data = checkStatus.data; - if (checkStatus.data.length === 1) { - var InterID = data[0].hmainid.toString(); - //閫昏緫瀹℃牳鏂规硶 - $.ajax({ - type: "GET", - url: GetWEBURL() + "/Sc_ICMOReportBill/AuditProcessReportList", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚� - data: { "HInterID": InterID, "IsAudit": 0, "CurUserName": sessionStorage["HUserName"] }, - success: function (result) { - if (result.count == 1) { - layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () { - // 寰楀埌frame绱㈠紩 - var index = layer.getFrameIndex(window.name); - //鍏抽棴褰撳墠frame - layer.close(index); - //淇敼涓哄姛鍚庡埛鏂扮晫闈� - $("#btnSearch").trigger('click'); - }); - - } else { - layer.alert(result.code + result.Message, { icon: 5 }); - } - }, error: function () { - layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 }); - } - }); - - } - else { - layer.msg('璇烽�夋嫨涓�琛屾暟鎹鏍革紒'); - } + //瀹℃牳鎸夐挳 + case 'btn-Audit': set_CheckBill(); break; - case 'btn-DeAudit': - var checkStatus = table.checkStatus('mainTable') - , data = checkStatus.data; - if (checkStatus.data.length === 1) { - var InterID = data[0].hmainid.toString(); - //閫昏緫瀹℃牳鏂规硶 - $.ajax({ - type: "GET", - url: GetWEBURL() + "/Sc_ICMOReportBill/AuditProcessReportList", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚� - data: { "HInterID": InterID, "IsAudit": 1, "CurUserName": sessionStorage["HUserName"] }, - success: function (result) { - if (result.count == 1) { - layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () { - // 寰楀埌frame绱㈠紩 - var index = layer.getFrameIndex(window.name); - //鍏抽棴褰撳墠frame - layer.close(index); - //淇敼涓哄姛鍚庡埛鏂扮晫闈� - $("#btnSearch").trigger('click'); - }); - - } else { - layer.alert(result.code + result.Message, { icon: 5 }); - } - }, error: function () { - layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 }); - } - }); - - } - else { - layer.msg('璇烽�夋嫨涓�琛屾暟鎹弽瀹℃牳锛�'); - } + //鍙嶅鏍告寜閽� + case 'btn-DeAudit': set_AbandonCheck(); + break; + //棰勮鎸夐挳 + case 'btn-Print': get_PrintReport(); + break; + //淇濆瓨鍒楀鎸夐挳 + case 'btn-Cell': set_SaveGridColWidth(); + break; + //榛樿鍒楀鎸夐挳 + case 'btn-RefreshCell': set_DefaultGridColWidth(); break; }; }); - var index = layer.load(0, { shade: false }); - //杩涘叆椤甸潰鏄剧ず鐨勭紦瀛樺垪琛� - $.ajax({ - //url: "http://61.130.49.162:9090/WMSAPI///Web/GetMAXNum", - url: GetWEBURL() + '/Sc_ICMOReportBill/list', - type: "GET", - data: { "sWhere": sWhere }, - success: function (data1) { - if (data1.count == 1) { - option.data = data1.data; - table.render(option); - layer.close(index); - } else { - layer.close(index); - layer.alert(data1.code + data1.Message, { icon: 5 }); - } - }, error: function () { - layer.close(index); - layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 }); - } - }); + //鏌ヨ鎸夐挳 + form.on('submit(btnSearch)', function (data) { + get_FastQuery(table, option); + }); //閲嶇疆鎸夐挳 form.on('submit(btnReSearch)', function (data) { - $('#Status').find("option[value='-1']").attr("selected", true); - $("#HDate").val("");//寮�濮嬫棩鏈� - $("#HDate1").val("");//缁撴潫鏃ユ湡 - $("#HBillNo").val(""); - $("#Dept").val(""); - $("#Part").val(""); - $("#btnSearch").click(); + set_ClearQuery(); }); - //鏌ヨ鎸夐挳 - form.on('submit(btnSearch)', function (data) { + //鑾峰彇鍒楀 + function getColumnsWidth() { + var result = []; + var colNum = $(".layui-table-header").find("tr").eq(0).find("th").length; + //鑾峰彇鍒楀 + $.ajax({ + url: GetWEBURL() + '/tb_CellWidth/GetMouldScrapInHouseCellWidthList', + async: false, + type: "Get", + dataType: "json", + data: { "colNum": colNum, "Name": Name }, + success: function (data1) { + if (data1.code == 1) { + result = data1.data; + } + else if (data1.code == -1) { + + } + else { + layer.alert(data1.Message, { icon: 5 }); + } + }, error: function (e) { + layer.alert(e.Message, { icon: 5 }); + } + }); + + return result; + } + + //鍔犺浇缃戞牸 + function get_Display(sWhere) { + //鍔犺浇缃戞牸 + var wait = layer.load();//閬僵 + $.ajax({ + url: GetWEBURL() + '/Sc_ICMOReportBill/list', + type: "GET", + data: { "sWhere": sWhere }, + success: function (data1) { + if (data1.count == 1) { + option.data = data1.data; + table.render(option); + layer.close(wait); + } else { + layer.close(wait); + layer.alert(data1.code + data1.Message, { icon: 5 }); + } + }, error: function () { + layer.close(wait); + layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 }); + } + }); + } + + //蹇�熻繃婊� + function get_FastQuery(table, option) { var Status = $("select[name='Status']").val();//鐘舵�� - var HDate = $("#HDate").val();//寮�濮嬫棩鏈� - var HDate1 = $("#HDate1").val();//缁撴潫鏃ユ湡 + var HDate = $("#HBeginDate").val();//寮�濮嬫棩鏈� + var HDate1 = $("#HEndDate").val();//缁撴潫鏃ユ湡 var HBillNo = $("#HBillNo").val(); //鍗曟嵁鍙� var Dept = $("#Dept").val(); //閮ㄩ棬淇℃伅 var Part = $("#Part").val(); //鐗╂枡淇℃伅 @@ -411,39 +275,371 @@ if (Part) { sWhere += " and concat(鐗╂枡浠g爜,鐗╂枡鍚嶇О,瑙勬牸鍨嬪彿) like '%" + Part + "%'"; } - $.ajax({ - //url: "http://61.130.49.162:9090/WMSAPI///Web/GetMAXNum", - url: GetWEBURL() + '/Sc_ICMOReportBill/list', - type: "GET", - data: { "sWhere": sWhere }, - success: function (data1) { - if (data1.count == 1) { - option.data = data1.data; - table.render(option); - layer.alert("鏌ヨ鎴愬姛", { icon: 1 }); - } else { - layer.alert(data1.code + data1.Message, { icon: 5 }); - } - }, error: function () { - layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 }); + + var index = layer.load(0); + get_Display(sWhere); + //璋冪敤鎺ュ彛鍚庢竻绌簊Where缂撳瓨 + sWhere = ""; + } + + //閲嶇疆杩囨护鏉′欢 + function set_ClearQuery() { + $('#Status').find("option[value='-1']").attr("selected", true); + $("#HBeginDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * 30), "yyyy-MM-dd")); + $("#HEndDate").val(Format(new Date(), "yyyy-MM-dd")); + $("#HBillNo").val(""); + $("#Dept").val(""); + $("#Part").val(""); + } + + //鍒濆鍖栬〃鏍� + function set_InitGrid() { + $("#HBeginDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * 30), "yyyy-MM-dd")); + $("#HEndDate").val(Format(new Date(), "yyyy-MM-dd")); + var columns = [ + { type: 'checkbox', fixed: 'left' } + , { field: 'hmainid', title: 'hmainid', sort: true, hide: true, width: 200 } + , { field: '鏃ユ湡', title: '鏃ユ湡', width: 160, templet: "<div>{{d.鏃ユ湡 ==null ?'':layui.util.toDateString(d.鏃ユ湡, 'yyyy-MM-dd')}}</div>" } + , { field: '鍗曟嵁鍙�', title: '鍗曟嵁鍙�', width: 200 } + , { field: '鐝粍浠g爜', title: '鐝粍浠g爜', width: 200 } + , { field: '鐝粍', title: '鐝粍', width: 200 } + , { field: '鎿嶄綔鍛�', title: '鎿嶄綔鍛�', width: 200 } + , { field: '鐢熶骇璧勬簮浠g爜', title: '鐢熶骇璧勬簮浠g爜', width: 200 } + , { field: '鐢熶骇璧勬簮', title: '鐢熶骇璧勬簮', width: 200 } + , { field: '琛ㄥご澶囨敞', title: '琛ㄥご澶囨敞', width: 200 } + , { field: 'hsubid', title: 'hsubid', hide: true, width: 200 } + , { field: 'hmaterid', title: 'hmaterid', hide: true, width: 200 } + , { field: '鐗╂枡浠g爜', title: '鐗╂枡浠g爜', width: 200 } + , { field: '鐗╂枡鍚嶇О', title: '鐗╂枡鍚嶇О', width: 200 } + , { field: '瑙勬牸鍨嬪彿', title: '瑙勬牸鍨嬪彿', width: 200 } + , { field: 'hunitid', title: 'hunitid', hide: true, width: 200 } + , { field: '璁¢噺鍗曚綅浠g爜', title: '璁¢噺鍗曚綅浠g爜', width: 200 } + , { field: '璁¢噺鍗曚綅', title: '璁¢噺鍗曚綅', width: 200 } + , { field: '鐢熶骇鏁伴噺', title: '鐢熶骇鏁伴噺', width: 200 } + , { field: '鐢熶骇浠诲姟鍗曞彿', title: '鐢熶骇浠诲姟鍗曞彿', width: 200 } + , { field: '琛ㄤ綋澶囨敞', title: '琛ㄤ綋澶囨敞', width: 200 } + , { field: '鍒跺崟浜�', title: '鍒跺崟浜�', width: 200 } + , { field: '鍒跺崟鏃ユ湡', title: '鍒跺崟鏃ユ湡', width: 200, templet: "<div>{{d.鍒跺崟鏃ユ湡 ==null ?'':layui.util.toDateString(d.鍒跺崟鏃ユ湡, 'yyyy-MM-dd HH:mm:ss')}}</div>" } + , { field: '瀹℃牳浜�', title: '瀹℃牳浜�', width: 200 } + , { field: '瀹℃牳鏃ユ湡', title: '瀹℃牳鏃ユ湡', width: 200, templet: "<div>{{d.瀹℃牳鏃ユ湡 ==null ? '':layui.util.toDateString(d.瀹℃牳鏃ユ湡, 'yyyy-MM-dd HH:mm:ss')}}</div>" } + , { field: '淇敼浜�', title: '淇敼浜�', width: 200 } + , { field: '淇敼鏃ユ湡', title: '淇敼鏃ユ湡', width: 200, templet: "<div>{{d.淇敼鏃ユ湡 ==null ?'':layui.util.toDateString(d.淇敼鏃ユ湡, 'yyyy-MM-dd HH:mm:ss')}}</div>" } + , { field: '鍏抽棴浜�', title: '鍏抽棴浜�', width: 200 } + , { field: '鍏抽棴鏃ユ湡', title: '鍏抽棴鏃ユ湡', width: 200, templet: "<div>{{d.鍏抽棴鏃ユ湡 ==null ?'':layui.util.toDateString(d.鍏抽棴鏃ユ湡, 'yyyy-MM-dd HH:mm:ss')}}</div>" } + , { field: '浣滃簾浜�', title: '浣滃簾浜�', width: 200 } + , { field: '浣滃簾鏃ユ湡', title: '浣滃簾鏃ユ湡', width: 200, templet: "<div>{{d.浣滃簾鏃ユ湡 ==null ?'':layui.util.toDateString(d.浣滃簾鏃ユ湡, 'yyyy-MM-dd HH:mm:ss')}}</div>" } + , { field: 'HICMOInterID', title: 'HICMOInterID', hide: true, width: 200 } + , { field: 'HEmpID', title: 'HEmpID', hide: true, width: 200 } + , { field: 'HEmpName', title: 'HEmpName', hide: true, width: 200 } + , { field: 'HSourceID', title: 'HSourceID', hide: true, width: 200 } + , { field: 'HSourceName', title: 'HSourceName', hide: true, width: 200 } + , { field: 'HGroupID', title: 'HGroupID', hide: true, width: 200 } + , { field: 'HGroupName', title: 'HGroupName', hide: true, width: 200 } + , { field: 'HEmpNumber', title: 'HEmpNumber', hide: true, width: 200 } + ]; + option = { + elem: '#mainTable' + , toolbar: '#toolbarDemo' + , page: true + , cellMinWidth: 120 + , totalRow: true + , limit: 10 + , height: 'full-50' + , cols: [columns] + , limits: [50, 500, 1000, 5000] + , done: function (res, curr, count) { + + } + }; + //璁剧疆鍒楀 + var colWidth = getColumnsWidth(); + if (colWidth == "" || colWidth == []) { + + } + else { + $.each(columns, function (x, m) { + m["width"] = colWidth[x]; + }); + } + } + + //鏂板 + function set_AddNew() { + layer.open({ + type: 2, + skin: 'layui-layer-rim', //鍔犱笂杈规 + title: '鏂板鐢熶骇姹囨姤鍗�', + closeBtn: 1, + shift: 2, + area: ['100%', '100%'], + maxmin: true, + content: '../鐢熶骇姹囨姤鍗�/Sc_Add_ICMOReportBillList.html?hID=&Type=1', + end: function () { + //鍒锋柊椤甸潰, + location.reload(); + }, + success: function (layero, index) { + } }); - sWhere = "";//璋冪敤鎺ュ彛鍚庢竻绌簊Where缂撳瓨 + } + + //缂栬緫 + function set_ShowBill() + { + 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: '缂栬緫鐢熶骇姹囨姤鍗�' + , closeBtn: 1 + , shade: 0.6 //閬僵閫忔槑搴� + , maxmin: true //鍏佽鍏ㄥ睆鏈�灏忓寲 + , anim: 0 //0-6鐨勫姩鐢诲舰寮忥紝-1涓嶅紑鍚� + , content: '../鐢熶骇姹囨姤鍗�/Sc_Add_ICMOReportBillList.html?hID=' + hID + '&Type=3' + , resize: false, + end: function () { + //鍒锋柊椤甸潰, + location.reload(); + } + , cancel: function () { + //$(".layui-btn").removeClass("layui-btn-disabled"); + } + }) + + } else { + layer.msg('璇烽�夋嫨涓�琛屾暟鎹紪杈戯紒'); + } + } + //鍒犻櫎 + function set_DeleteBill() { + var checkStatus = table.checkStatus('mainTable') + , data = checkStatus.data; + if (checkStatus.data.length === 1) { + var InterID = data[0].hmainid.toString(); + //閫昏緫鍒犻櫎鏂规硶 + layer.confirm("纭瑕佸垹闄ゅ悧锛屽垹闄ゅ悗涓嶈兘鎭㈠", { title: "鍒犻櫎纭" }, function (index) { + $.ajax({ + type: "GET", + url: GetWEBURL() + "Sc_ICMOReportBill/DeltetICMOReportBill", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚� + data: { "HInterID": InterID }, + success: function (result) { + if (result.count == 1) { + layer.msg(result.Message, { time: 1 * 1000, 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('璇烽�夋嫨涓�琛屾暟鎹垹闄わ紒'); + } + } + + //瀹℃牳 + function set_CheckBill() { + var checkStatus = table.checkStatus('mainTable') + , data = checkStatus.data; + if (checkStatus.data.length === 1) { + var InterID = data[0].hmainid.toString(); + //閫昏緫瀹℃牳鏂规硶 + $.ajax({ + type: "GET", + url: GetWEBURL() + "/Sc_ICMOReportBill/AuditProcessReportList", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚� + data: { "HInterID": InterID, "IsAudit": 0, "CurUserName": sessionStorage["HUserName"] }, + success: function (result) { + if (result.count == 1) { + layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () { + // 寰楀埌frame绱㈠紩 + var index = layer.getFrameIndex(window.name); + //鍏抽棴褰撳墠frame + layer.close(index); + //淇敼涓哄姛鍚庡埛鏂扮晫闈� + $("#btnSearch").trigger('click'); + }); + + } else { + layer.alert(result.code + result.Message, { icon: 5 }); + } + }, error: function () { + layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 }); + } + }); + + } + else { + layer.msg('璇烽�夋嫨涓�琛屾暟鎹鏍革紒'); + } + } + + //鍙嶅鏍� + function set_AbandonCheck() { + var checkStatus = table.checkStatus('mainTable') + , data = checkStatus.data; + if (checkStatus.data.length === 1) { + var InterID = data[0].hmainid.toString(); + //閫昏緫瀹℃牳鏂规硶 + $.ajax({ + type: "GET", + url: GetWEBURL() + "/Sc_ICMOReportBill/AuditProcessReportList", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚� + data: { "HInterID": InterID, "IsAudit": 1, "CurUserName": sessionStorage["HUserName"] }, + success: function (result) { + if (result.count == 1) { + layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () { + // 寰楀埌frame绱㈠紩 + var index = layer.getFrameIndex(window.name); + //鍏抽棴褰撳墠frame + layer.close(index); + //淇敼涓哄姛鍚庡埛鏂扮晫闈� + $("#btnSearch").trigger('click'); + }); + + } else { + layer.alert(result.code + result.Message, { icon: 5 }); + } + }, error: function () { + layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 }); + } + }); + + } + else { + layer.msg('璇烽�夋嫨涓�琛屾暟鎹弽瀹℃牳锛�'); + } + + } + + //棰勮 + function get_PrintReport() { + var checkStatus = table.checkStatus('mainTable') + , data = checkStatus.data; + if (checkStatus.data.length === 1) { + var InterID = data[0].hmainid.toString(); + layer.alert("鎴戞槸鎵撳嵃鎸夐挳锛佸崟鎹富ID鏄細" + InterID); + //window.open("../鐢熶骇宸ュ簭绠$悊/宸ュ簭姹囨姤鍗�/HBarPlanPrint.html?linterid=" + linterid + "&Type=HDepartMent" + "&OpenTmp=b"); + window.open("../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/HBarPlanPrint.html?linterid=" + InterID + "&Type=HDepartMent" + "&OpenTmp=b"); + } + else { + layer.msg('璇烽�夋嫨涓�琛屾暟鎹墦鍗帮紒'); + } + } + + //淇濆瓨鍒楀 + function set_SaveGridColWidth() { + var arr = []; + // 鍒楁暟 + var colNum = $(".layui-table-header").find("tr").eq(0).find("th").length; + for (var i = 0; i <= colNum; i++) { + var colName = $(".layui-table-header").find("tr").eq(0).find("th").eq(i).text(); + var colWidth = $(".layui-table-header").find("tr").eq(0).find("th").eq(i).width(); + if (colName != "" && colName != null) { + arr.push(colWidth == -1 ? 200 : colWidth); + } + } + arr.unshift(40); //棣栦綅杩藉姞 + $.ajax({ + url: GetWEBURL() + '/tb_CellWidth/GetMouldScrapInHouseCellWidth', + async: false, + type: "POST", + dataType: "json", + data: { "myMap": JSON.stringify(arr), "Name": Name }, + success: function (data1) { + if (data1.count == 1) { + layer.alert(data1.Message, { icon: 1 }); + } else { + layer.alert(data1.Message, { icon: 5 }); + } + }, error: function (e) { + layer.alert(e.Message, { icon: 5 }); + } + }); + //璁剧疆璧嬪�煎垪瀹� + var colWidth = getColumnsWidth(); + if (colWidth == "" || colWidth == []) { + + } + else { + $.each(columns, function (x, m) { + m["width"] = colWidth[x]; + }); + } + get_FastQuery(table, option); + } + + //榛樿鍒楀 + function set_DefaultGridColWidth() { + var arr = []; + // 鍒楁暟 + var colNum = $(".layui-table-header").find("tr").eq(0).find("th").length; + for (var i = 0; i <= colNum; i++) { + var colName = $(".layui-table-header").find("tr").eq(0).find("th").eq(i).text(); + if (colName != "" && colName != null) { + arr.push(200); //榛樿瀹藉害200 + } + } + arr.unshift(40); //棣栦綅杩藉姞 + $.ajax({ + url: GetWEBURL() + '/tb_CellWidth/GetMouldScrapInHouseCellWidth', + async: false, + type: "POST", + dataType: "json", + data: { "myMap": JSON.stringify(arr), "Name": Name }, + success: function (data1) { + if (data1.count == 1) { + layer.alert(data1.Message, { icon: 1 }); + + } else { + layer.alert(data1.Message, { icon: 5 }); + } + }, error: function (e) { + layer.alert(e.Message, { icon: 5 }); + } + }); + //璁剧疆璧嬪�煎垪瀹� + var colWidth = getColumnsWidth(); + if (colWidth == "" || colWidth == []) { + + } + else { + $.each(columns, function (x, m) { + m["width"] = colWidth[x]; + }); + } + get_FastQuery(table, option); + } + + + + //閲嶇疆鎸夐挳 + form.on('submit(btnReSearch)', function (data) { + $('#Status').find("option[value='-1']").attr("selected", true); + $("#HBeginDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * 30), "yyyy-MM-dd")); + $("#HEndDate").val(Format(new Date(), "yyyy-MM-dd")); + $("#HBillNo").val(""); + $("#Dept").val(""); + $("#Part").val(""); + $("#btnSearch").click(); }); - - //laydate.render({ - // elem: '#HDate' - // , type: 'datetime' - // , trigger: 'click' - // , format:'yyyy-MM-dd HH:mm' - //}); - - - //浠ヤ笂鏄痩ayui妯″潡 }); - + </script> -- Gitblit v1.9.1