| | |
| | | <span>æ´å¤</span> |
| | | </div> |
| | | </div> |
| | | <!--<div class="layui-inline" style="display:none"> |
| | | <label class="layui-form-label" style="width: 85px;">ç»ç»</label> |
| | | <div class="layui-input-block" style="margin-left: 120px; width: 185px;"> |
| | | <select name="HORGID" id="HORGID" lay-verify="HORGID">--> |
| | | <!--å¨ææ¸²æç»ç»--> |
| | | <!--</select> |
| | | </div> |
| | | </div>--> |
| | | <!--<div class="layui-inline"> |
| | | <label class="layui-form-label" style="width: 85px;padding: 9px 18px;">ç产车é´</label> |
| | | <div class="layui-input-block" style="margin-left: 77px;"> |
| | | <input type="hidden" class="layui-input" lay-verify="HWorkShopID" name="HWorkShopID" id="HWorkShopID" value="0" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly> |
| | | <input type="text" class="layui-input" lay-verify="HWorkShopIDName" name="HWorkShopIDName" id="HWorkShopIDName" value="" style="background-color:#efefef4d;width: 60%;display: inline-block;"> |
| | | <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnHWorkShopID" id="btnHWorkShopID" style="padding: 0 10px;float: right;margin-right: 3px;"> |
| | | <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i> |
| | | </button> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label" style="width: 85px;padding: 9px 18px;">产åç¼ç </label> |
| | | <div class="layui-input-block" style="margin-left: 77px;"> |
| | | <input type="hidden" class="layui-input" lay-verify="HMATERIALID" name="HMATERIALID" id="HMATERIALID" value="0" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly> |
| | | <input type="text" class="layui-input" lay-verify="HMATERIALNAME" name="HMATERIALNAME" id="HMATERIALNAME" value="" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly> |
| | | <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnHMATERIALID" id="btnHMATERIALID" style="padding: 0 10px;float: right;margin-right: 3px;"> |
| | | <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i> |
| | | </button> |
| | | </div> |
| | | </div>--> |
| | | <!--<div class="layui-inline"> |
| | | <label class="layui-form-label" style="width: 85px;">é½å¥ç±»å</label> |
| | | <div class="layui-input-block" style="margin-left: 120px; width: 185px;"> |
| | | <select name="HType" id="HType" lay-verify="HType"> |
| | | <option value="é½å¥" selected="selected">é½å¥</option> |
| | | <option value="æªé½å¥">æªé½å¥</option>--> |
| | | <!--<option value="éè´è®¢å">éè´è®¢å</option> ææ¶æ²¡æ--> |
| | | <!--</select> |
| | | </div> |
| | | </div>--> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label" style="width: 85px;padding: 9px 18px;">æç»äº§ååç§°</label> |
| | | <div class="layui-input-block" style="margin-left: 77px;"> |
| | | <input type="hidden" class="layui-input" lay-verify="HMATERIALID" name="HMATERIALID" id="HMATERIALID" value="0" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly> |
| | | <input type="text" class="layui-input" lay-verify="HMATERIALNAME" name="HMATERIALNAME" id="HMATERIALNAME" value="" style="background-color:#efefef4d;width: 60%;display: inline-block;"> |
| | | <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnHMATERIALID" id="btnHMATERIALID" style="padding: 0 10px;float: right;margin-right: 3px;"> |
| | | <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i> |
| | | </button> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-inline" style="display:none"> |
| | | <label class="layui-form-label" style="width: 85px;">æ¬ ææ¥æ</label> |
| | | <div class="layui-input-block" style="margin-left: 120px;"> |
| | |
| | | <input type="date" class="layui-input" lay-verify="HENDDATE" name="HENDDATE" id="HENDDATE" style="padding-left: 78px;"> |
| | | </div> |
| | | </div> |
| | | <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnSearch2" id="btnSearch2">åºåæ¥è¯¢</button> |
| | | <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnSearch" id="btnSearch">æ¥è¯¢</button> |
| | | <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnReSearch" id="btnReSearch">éç½®</button> |
| | | <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnExport" id="btnExport">导åº</button> |
| | | <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="bthHideColumn" id="bthHideColumn">å设置</button> |
| | | <!--<div class="layui-colla-content" style="padding: 0px; margin-left: 6%;"> |
| | | <div class="layui-row" style="margin-top:10px;"> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label" style="width: 85px;padding: 9px 18px;">产åç¼ç </label> |
| | | <div class="layui-input-block" style="margin-left: 77px;"> |
| | | <input type="hidden" class="layui-input" lay-verify="HMATERIALID" name="HMATERIALID" id="HMATERIALID" value="0" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly> |
| | | <input type="text" class="layui-input" lay-verify="HMATERIALNAME" name="HMATERIALNAME" id="HMATERIALNAME" value="" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly> |
| | | <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnHMATERIALID" id="btnHMATERIALID" style="padding: 0 10px;float: right;margin-right: 3px;"> |
| | | <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i> |
| | | </button> |
| | | </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" name="HMOBILLNO" id="HMOBILLNO"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div>--> |
| | | |
| | | </div> |
| | | </div> |
| | | |
| | |
| | | <ul class="layui-tab-title"> |
| | | <li class="layui-this">䏿¥</li> |
| | | <li>䏿¥</li> |
| | | <li>峿¶åºåæç»</li> |
| | | </ul> |
| | | <div class="layui-tab-content" style=""> |
| | | <div class="layui-tab-item layui-show"> |
| | |
| | | <div class="layui-tab-item "> |
| | | <table class="" id="mainTable2" lay-filter="mainTable2"></table> |
| | | </div> |
| | | |
| | | <div class="layui-tab-item "> |
| | | <table class="" id="mainTable3" lay-filter="mainTable3"></table> |
| | | <script type="text/html" id="toolbarDemo"> |
| | | <div class="layui-btn-container" id="toolbarDemo_ButtonSet"> |
| | | <button type="button" class="layui-btn layui-btn-sm" lay-event="set_HideColumn" id="HideColumn"><i class="layui-icon layui-icon-form"></i>å设置</button> |
| | | </div> |
| | | </script> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | |
| | | , treeTable = layui.treeTable; |
| | | var sWhere = ""; |
| | | var option = []; |
| | | var option3 = []; |
| | | var ins; //ç¨äºå¯¼åºexcel |
| | | var HModName = "JIT_MaterialLevelShorAnalysisDetailReport"; |
| | | var HModName2 = "Jit_MaterialLevelShorAnalysisDetailReport2" |
| | | var HMaterID = 0; |
| | | var HWorkShopID = 0; |
| | | var HOrgID = 0; |
| | |
| | | //#endregion |
| | | |
| | | //#region 触åäºä»¶ï¼å
æ¬form.on(){}æ ¼å¼çææç¹å»äºä»¶ãéæ©äºä»¶ç |
| | | //头工å
·æ äºä»¶ |
| | | table.on('toolbar(mainTable3)', function (obj) { |
| | | switch (obj.event) { |
| | | //å设置 |
| | | case 'set_HideColumn': get_HideColumnNoPage(HModName2, sessionStorage["HUserName"], option3, get_Display2); |
| | | break; |
| | | |
| | | }; |
| | | }); |
| | | //#region 产åç¼ç |
| | | form.on('submit(btnHMATERIALID)', function (data) { |
| | | btnHMATERIALID(); |
| | | }); |
| | | //#endregion |
| | | |
| | | //#region éç½®æé® |
| | | form.on('submit(btnReSearch)', function (data) { |
| | | set_ClearQuery(); |
| | | }); |
| | | //#endregion |
| | | |
| | | //#region åºåæç»æ¥è¯¢æé® |
| | | form.on('submit(btnSearch2)', function (data) { |
| | | get_Display2(); |
| | | }); |
| | | //#endregion |
| | | |
| | |
| | | |
| | | //#region åå§åçé¢ |
| | | function set_ClearBill() { |
| | | |
| | | //ç©æè¡¨æ ¼ä¸ææç´¢æ¡ |
| | | tableSelect.render({ |
| | | elem: '#HMATERIALNAME', |
| | | checkedKey: 'HItemID', |
| | | searchKey: 'ç©æä»£ç ,ç©æåç§°', |
| | | sWhere: '',//tableæç´¢sWhereæ¡ä»¶ |
| | | table: { |
| | | url: GetWEBURL() + 'Gy_Material/page', |
| | | where: { user: sessionStorage["HMaker"], "Organization": sessionStorage["Organization"] }, |
| | | cols: [[ |
| | | { type: 'checkbox', fixed: 'left' }, |
| | | { field: 'HItemID', title: 'HItemID' }, |
| | | { field: 'ç©æä»£ç ', title: 'ç©æä»£ç ' }, |
| | | { field: 'ç©æåç§°', title: 'ç©æåç§°' }, |
| | | ]], |
| | | page: true, |
| | | limit: 5, |
| | | limits: [5] |
| | | }, |
| | | done: function (elem, data) { |
| | | if (data != []) { |
| | | //è·åæ°æ® |
| | | $("#HMATERIALID").val(data.data[0].HItemID); |
| | | $("#HMATERIALNAME").val(data.data[0].ç©æåç§°); |
| | | /*$("#HMATERIALNAME").blur();//åå
æ ¼å¤±å»ç¦ç¹*/ |
| | | get_Display2(); |
| | | } |
| | | |
| | | } |
| | | }) |
| | | addSWhereByOpenType() |
| | | //åå§åè¡¨æ ¼ |
| | | set_InitGrid(); |
| | |
| | | DisPlay_HideColumn_GetPageSize(HModName, sessionStorage["HUserName"], option) |
| | | //设置页ç |
| | | DisPlay_HideColumn_GetPageSize(HModName, sessionStorage["HUserName"], option2) |
| | | //设置页ç |
| | | DisPlay_HideColumn_GetPageSize(HModName2, sessionStorage["HUserName"], option3) |
| | | //å¿«éè¿æ»¤ |
| | | get_FastQuery(); |
| | | } |
| | |
| | | soulTable.render(this); |
| | | } |
| | | }; |
| | | option3 = { |
| | | elem: '#mainTable3' |
| | | , toolbar: '#toolbarDemo' |
| | | , height: 'full-50' |
| | | , page: true |
| | | , cellMinWidth: 90 |
| | | , limit: 1000 |
| | | , limits: [50, 500, 1000, 2000] |
| | | , totalRow: true |
| | | , loading: false |
| | | , cols: [columns] |
| | | , done: function (res, curr, count) { |
| | | soulTable.render(this); |
| | | } |
| | | }; |
| | | } |
| | | //#endregion |
| | | |
| | |
| | | } |
| | | } |
| | | }); |
| | | option.data = root; |
| | | option.data = sortByFirstValidDate(root); |
| | | |
| | | //å设置 |
| | | DisPlay_HideColumnForPlan(HModName, sessionStorage["HUserName"], option); |
| | |
| | | } |
| | | } |
| | | }); |
| | | option2.data = root; |
| | | option2.data = sortByFirstValidDate(root); |
| | | |
| | | //å设置 |
| | | DisPlay_HideColumnForPlan(HModName, sessionStorage["HUserName"], option2); |
| | | ins = treeTable.render(option2); |
| | | layer.close(ajaxLoad); |
| | | } else { |
| | | layer.alert(data1.code + data1.Message, { icon: 5 }); |
| | | layer.close(ajaxLoad); |
| | | } |
| | | }, error: function () { |
| | | layer.alert("æ¥å£è¯·æ±å¤±è´¥!", { icon: 5 }); |
| | | layer.close(ajaxLoad); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // çé彿°ï¼æ£æ¥å符串æ¯å¦ç¬¦åæ ¼å¼ç鿥æ |
| | | function isValidDate(dateStr) { |
| | | // æ£å表达å¼éªè¯æ ¼å¼ |
| | | const formatRegex = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/; |
| | | if (!formatRegex.test(dateStr)) return false; |
| | | |
| | | // åå²å¹´ææ¥å¹¶è½¬æ¢ä¸ºæ°å¼ |
| | | const [year, month, day] = dateStr.split('-').map(Number); |
| | | |
| | | // å建Dateå¯¹è±¡ï¼æä»½ä»0å¼å§ï¼ |
| | | const date = new Date(year, month - 1, day); |
| | | |
| | | // æ£æ¥æ¥ææ¯å¦ææï¼ä¸è¾å
¥çå¹´ææ¥ä¸è´ï¼ |
| | | return ( |
| | | date.getFullYear() === year && |
| | | date.getMonth() === month - 1 && |
| | | date.getDate() === day |
| | | ); |
| | | } |
| | | //ä»¥ææ©æ¬ æä¸ºä¼å
级æåº |
| | | function sortByFirstValidDate(arr) { |
| | | // å设ææå¯¹è±¡æ¥æç¸åçæ¥æé®ï¼è¿é以第ä¸ä¸ªå¯¹è±¡çé®ä¸ºåºå |
| | | const dateKeys = Object.keys(arr[0] || {}) |
| | | .filter(key => /^\d{4}-\d{2}-\d{2}$/.test(key)) |
| | | .sort((a, b) => a.localeCompare(b)); // é¢å
æåºæææ¥æé® |
| | | |
| | | // è¾
å©å½æ°ï¼æ¾å°å¯¹è±¡ä¸ç¬¬ä¸ä¸ªææå¼çæ¥æ |
| | | const getFirstValidDate = (obj) => { |
| | | for (const key of dateKeys) { |
| | | const value = obj[key]; |
| | | if (typeof value === 'number' && value > 0) { |
| | | return key; // è¿å第ä¸ä¸ªæææ¥æ |
| | | } |
| | | } |
| | | return Infinity; // æ æææ¥ææ¶ææå |
| | | }; |
| | | |
| | | // æåºé»è¾ |
| | | return arr.slice().sort((a, b) => { |
| | | const aDate = getFirstValidDate(a); |
| | | const bDate = getFirstValidDate(b); |
| | | return aDate.localeCompare(bDate); |
| | | }); |
| | | } |
| | | |
| | | |
| | | |
| | | //#endregion |
| | | |
| | | //#region æ¥è¯¢2 |
| | | function get_Display2() { |
| | | var ajaxLoad = layer.load(); |
| | | var HMaterID2 = $("#HMATERIALID").val(); |
| | | if (HMaterID2 == 0) { |
| | | HMaterID2 = HMaterID; |
| | | } |
| | | //æç»å表 |
| | | var sql = "select * from h_v_Jit_MaterialLevelShorAnalysisDetailReport_StockOccupyingAnalysis where åé¡¹ç©æID = " + HMaterID2 + " order by å±çº§,æ¥è®¡åæ¥æ"; |
| | | $.ajax({ |
| | | url: GetWEBURL() + '/Gy_SOPBillList/WindowPrintList', |
| | | type: "GET", |
| | | async: false, |
| | | data: { "sWhere": sql }, |
| | | success: function (data1) { |
| | | if (data1.count == 1) { |
| | | var data = [];//ååæ®µæ°æ® |
| | | var col = []; |
| | | var totalArray = []; |
| | | var titleData = []; |
| | | //ç»ç©ºçæ°ç»èµå¼ |
| | | 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', totalRowText: 'å计' }); |
| | | for (var i = 0; i < data.length; i++) {//éådataæ°ç»éçæ°æ® |
| | | // if (data[i].name == 'HInterID' || data[i].name == 'HBillType' || data[i].name == 'hmainid') { |
| | | if ($.inArray(data[i].name, titleData) > -1) {//æ£æ¥dataãiã.nameæ¯å¦å¨æ°ç»ä¸ //计ç®å |
| | | col.push({ field: data[i].id, title: data[i].name, align: 'center', hide: true }); //éèidå |
| | | } |
| | | else 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, filter: true }); |
| | | } else if (data[i].name == 'æ¯å¦å¹é
å°è®¢å') { |
| | | col.push({ field: 'æ¯å¦å¹é
å°è®¢å', title: 'æ¯å¦å¹é
å°è®¢å', sort: true, filter: true, templet: function (d) { return d.æ¯å¦å¹é
å°è®¢å ? 'å¦' : 'æ¯'; } }); |
| | | } |
| | | else if (data[i].name == 'æ¯å¦å¹é
å°è¦æè®¡åä¿¡æ¯') { |
| | | col.push({ field: 'æ¯å¦å¹é
å°è¦æè®¡åä¿¡æ¯', title: 'æ¯å¦å¹é
å°è¦æè®¡åä¿¡æ¯', sort: true, filter: true, templet: function (d) { return d.æ¯å¦å¹é
å°è¦æè®¡åä¿¡æ¯ ? 'å¦' : 'æ¯'; } }); |
| | | } else if (isValidDate(data[i].name)) { |
| | | col.push({ field: data[i].name, title: Format(data[i].name, 'MM.dd'), width: 70, totalRow: true, filter: true }) |
| | | } |
| | | else { |
| | | switch (data[i].Type) { |
| | | //int |
| | | case 'DateTime': |
| | | col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, filter: true, templet: "<div>{{d." + (data[i].name == "è¡å
³éæ¥æ" ? "è¡å
³é人" : data[i].name) + " ==''?'':layui.util.toDateString(d." + data[i].name + ", 'yyyy-MM-dd HH:mm:ss')}}</div>", width: 200 }); |
| | | break; |
| | | default: |
| | | col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 200, filter: true }); |
| | | } |
| | | } |
| | | } |
| | | option3.cols = [col]; |
| | | option3.data = data1.data; |
| | | //å设置 |
| | | DisPlay_HideColumn(HModName2, sessionStorage["HUserName"], option3,[]); |
| | | table.render(option3); |
| | | layer.close(ajaxLoad); |
| | | } else { |
| | | layer.alert(data1.code + data1.Message, { icon: 5 }); |
| | |
| | | var data = HExportData; |
| | | if (tableId == "mainTable2") { |
| | | data = HExportData2; |
| | | } else if (tableId == "mainTable3") { |
| | | data = option3.data; |
| | | } |
| | | |
| | | data.forEach((item) => { |
| | |
| | | /* $("#HORGID").val(sessionStorage["OrganizationID"]);//ç»ç»*/ |
| | | //$("#HBEGINDATE").val(Format(new Date(new Date()), "yyyy-MM-dd"));//æ¬ ææ¥æ |
| | | //$("#HENDDATE").val(Format(new Date($("#HBEGINDATE").val()).setDate(new Date($("#HBEGINDATE").val()).getDate() + 30), "yyyy-MM-dd"));//è³ |
| | | //$("#HMATERIALID").val("");//ç©æ/产å |
| | | $("#HMATERIALID").val("0");//ç©æ/产å |
| | | //$("#HMATERIALNAME").val(""); |
| | | //$("#HWorkShopID").val(""); |
| | | //$("#HWorkShopIDName").val(""); |
| | |
| | | sWhere = ""; |
| | | } |
| | | //#endregion |
| | | |
| | | //ç©æå表 |
| | | function btnHMATERIALID() { |
| | | layer.open({ |
| | | type: 2 //ç±»å |
| | | , skin: 'layui-layer-rim'//å ä¸è¾¹æ¡ |
| | | , area: ['90%', '90%']//å¤§å° |
| | | , title: 'ç©æå表'//æ é¢ |
| | | , shift: 2//å¼¹åºå¨ç» |
| | | , content: ['../../åºç¡èµæ/å
¬ç¨åºç¡èµæ/Gy_Material.html', '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('è¯·éæ©æ°æ®'); |
| | | } |
| | | //è·åæ°æ® |
| | | $("#HMATERIALID").val(checkStatus.data[0].HItemID); |
| | | $("#HMATERIALNAME").val(checkStatus.data[0].ç©æåç§°); |
| | | layer.close(index); //å®è·åçå§ç»æ¯ææ°å¼¹åºçæä¸ªå±ï¼å¼æ¯ç±layerå
é¨å¨æéå¢è®¡ç®ç |
| | | } |
| | | , btn2: function (index, layero) { } |
| | | }) |
| | | } |
| | | //#region è·ååæ° |
| | | function getUrlVars() { |
| | | var vars = [], hash; |