| | |
| | | <div class="layui-input-inline"> |
| | | <input type="hidden" name="HEquipID" id="HEquipID" class="layui-input" value="" style="float:left;width:150px;"> |
| | | <input type="text" name="HEquipName" id="HEquipName" class="layui-input" value="" style="float:left;width:150px;"> |
| | | <button type="button" lay-submit="" class="layui-btn layui-btn-primary" lay-filter="ProductModulList" style="width:40px;"> |
| | | <button type="button" lay-submit="" class="layui-btn" lay-filter="ProductModulList" style="width:40px;"> |
| | | <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i> |
| | | </button> |
| | | </div> |
| | |
| | | <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">å é¤</a> |
| | | </script> |
| | | <script> |
| | | //è·ååæ° |
| | | var params = get_UrlVars(); |
| | | if (typeof (params[params[0]]) == "undefined") { |
| | | var OperationType = 1;//æä½ç±»å |
| | | } else { |
| | | var OperationType = params[params[0]];//æä½ç±»å |
| | | var linterid = params[params[1]];//æºåid |
| | | var HSouceBillType = params[params[2]];//æºåç±»å |
| | | } |
| | | |
| | | layui.config({ |
| | | base: '../../layuiadmin/' //éæèµæºæå¨è·¯å¾ |
| | | }).extend({ |
| | | index: 'lib/index' //主å
¥å£æ¨¡å |
| | | }).use(['index', 'form', 'laydate', 'table', 'element'], function () { |
| | | |
| | | //#region å
¬ç¨åé |
| | | //#region å
¬ç¨åé |
| | | var $ = layui.$ |
| | | , admin = layui.admin |
| | | , layer = layui.layer |
| | |
| | | , laydate = layui.laydate |
| | | , element = layui.element; |
| | | |
| | | var option; |
| | | var option=[]; |
| | | var sBillType = "3903"; |
| | | var TabRow = { "HDotCheckItem": "", "HDotCheckPart": "", "HClaim": "", "HManagerID": 0, "HManagerCode":"","HManagerName":"", "HRemark": "" }; |
| | | var Sctag = "0"; |
| | | var columns = ""; |
| | | var TabRow = { /*"HDotCheckID": 0, "HDotCheckCode": "",*/"HDotCheckItem": "", "HDotCheckPart": "", "HClaim": "", "HManagerID": 0, "HManagerCode": "", "HManagerName": "", "HRemark": "" }; |
| | | |
| | | var date = new Date(); |
| | | var day = date.getDate(); |
| | | var month = date.getMonth() + 1; |
| | | var year = date.getFullYear(); |
| | | var shijian = year + "-" + month + "-" + day; |
| | | //#endregion |
| | | |
| | | //#endregion |
| | | |
| | | //#region è¿å
¥é¡µé¢å³å è½½ |
| | | |
| | | //夿æ¯å¦ç»å½ æªç»å½åè·³å°ç»å½é¡µ |
| | | //get_LoginIs(); |
| | | |
| | | //#region è¿å
¥é¡µé¢å³å è½½ |
| | | //åå§å表åæä»¶ |
| | | set_InitFrom(); |
| | | |
| | | //åå§åè¡¨æ ¼ |
| | | set_InitGrid(); |
| | | |
| | | //è·å页é¢è·³è½¬åæ° |
| | | var params = get_UrlVars(); |
| | | if (typeof (params[params[0]]) == "undefined") { |
| | | var OperationType = 1;//æä½ç±»å |
| | | } else { |
| | | var OperationType = params[params[0]];//æä½ç±»å |
| | | var linterid = params[params[1]];//æºåid |
| | | var HSouceBillType = params[params[2]];//æºåç±»å |
| | | } |
| | | //夿æä½ç±»å |
| | | if (OperationType == 1) {//æ æºæ°å¢ |
| | | $("#HItemID").val(0); |
| | | set_AddFNew(); |
| | | } |
| | | else if (OperationType == 3) {//ç¼è¾ |
| | | $("#HItemID").val(linterid);//ä¿®æ¹æ¶ä¸»è¡¨ID |
| | | //ç¼è¾ç¶ææ¶ï¼æ ¹æ®å
ç ï¼è·åä¿¡æ¯å¹¶åå
¥çé¢ |
| | | set_EditFromGrid(linterid); |
| | | } |
| | | |
| | | else { |
| | | layer.alert("æªç¥æä½ç±»åï¼", { icon: 5 }); |
| | | } |
| | | |
| | | //#endregion |
| | | |
| | | //#endregion |
| | | |
| | | //#region 触åäºä»¶ï¼å
æ¬form.on(){}æ ¼å¼çææç¹å»äºä»¶ãéæ©äºä»¶ç |
| | | |
| | | //#region 头工å
·æ äºä»¶ |
| | | //#region 触åäºä»¶ï¼å
æ¬form.on(){}æ ¼å¼çææç¹å»äºä»¶ãéæ©äºä»¶ç |
| | | //头工å
·æ äºä»¶ |
| | | table.on('toolbar(mainTable)', function (obj) { |
| | | var rowid = 0; |
| | | var checkStatus = table.checkStatus('mainTable') |
| | | , data = checkStatus.data;; |
| | | var AddRow = table.cache['mainTable']; |
| | | , data = checkStatus.data; |
| | | var NewRow = TabRow; |
| | | switch (obj.event) { |
| | | //æ°å¢ä¸è¡ |
| | |
| | | break; |
| | | } |
| | | }); |
| | | //#endregion |
| | | |
| | | //#region è¡å
äºä»¶ |
| | | //è¡å
äºä»¶ |
| | | table.on('tool(mainTable)', function (obj) { |
| | | set_GridDelete(obj); //è¡å
å é¤ |
| | | set_GridCellCheck(obj); //è¡å
å¿«æ·é®çé |
| | | }); |
| | | //#endregion |
| | | |
| | | //#region 表头信æ¯è®¾å¤å¼¹çª |
| | | //表头信æ¯è®¾å¤å¼¹çª |
| | | form.on('submit(ProductModulList)', function () { |
| | | //页é¢å±-èªå®ä¹ |
| | | layer.open({ |
| | |
| | | } |
| | | }); |
| | | }); |
| | | //#endregion |
| | | |
| | | //#region æäº¤ä¿å |
| | | // æäº¤ä¿å |
| | | form.on('submit(set_SaveBill)', function (data) {//ä¿å |
| | | //debugger; |
| | | data.field.HMaker = sessionStorage["HUserName"];//å¶å人 |
| | | var sMainStr = JSON.stringify(data.field); |
| | | var sSubStr = JSON.stringify(table.cache['mainTable']); |
| | | var sMainSub = sMainStr + ';' + sSubStr; |
| | | $.ajax( |
| | | { |
| | | type: "POST", |
| | | url: GetWEBURL() + "/Sb_EquipDotCheckBill/SaveEquipDotCheckBillList", //æ¹æ³æå¨é¡µé¢åæ¹æ³å |
| | | async: true, |
| | | data: { "msg": sMainSub }, |
| | | dataType: "json", |
| | | success: function (data) { |
| | | if (data.count == 1) { // 说æéªè¯æåäºï¼ |
| | | layer.msg(data.Message, { time: 1 * 1000, icon: 1 }, function () { |
| | | $('#add-btn').addClass("layui-btn-disabled").attr("disabled", true); |
| | | var index = parent.layer.getFrameIndex(window.name); //å
å¾å°å½åiframeå±çç´¢å¼ |
| | | parent.layer.close(index); //åæ§è¡å
³é           |
| | | }); |
| | | } |
| | | else { |
| | | if (AllowLoadData(sSubStr)) { |
| | | $.ajax( |
| | | { |
| | | type: "POST", |
| | | url: GetWEBURL() + "/Sb_EquipDotCheckBill/SaveEquipDotCheckBillList", //æ¹æ³æå¨é¡µé¢åæ¹æ³å |
| | | async: true, |
| | | data: { "msg": sMainSub }, |
| | | dataType: "json", |
| | | success: function (data) { |
| | | if (data.count == 1) { // 说æéªè¯æåäºï¼ |
| | | layer.msg(data.Message, { time: 1 * 1000, icon: 1 }, function () { |
| | | $('#add-btn').addClass("layui-btn-disabled").attr("disabled", true); |
| | | var index = parent.layer.getFrameIndex(window.name); //å
å¾å°å½åiframeå±çç´¢å¼ |
| | | parent.layer.close(index); //åæ§è¡å
³é           |
| | | }); |
| | | } |
| | | else { |
| | | |
| | | f_alert(data.Message); |
| | | console.log("Reason" + sMainStr + "sub:" + JSON.stringify(layui.table.cache.mainTable)); |
| | | } |
| | | layer.closeAll("loading"); |
| | | }, |
| | | error: function (err) { |
| | | f_alert(data.Message); |
| | | console.log("Reason" + sMainStr + "sub:" + JSON.stringify(layui.table.cache.mainTable)); |
| | | } |
| | | layer.closeAll("loading"); |
| | | }, |
| | | error: function (err) { |
| | | |
| | | f_alert("é误:" + err); |
| | | console.log("Reason" + sMainStr); |
| | | } |
| | | }); |
| | | f_alert("é误:" + err); |
| | | console.log("Reason" + sMainStr); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | }) |
| | | //#endregion |
| | | |
| | | //#region éåºæé® |
| | | //éåºæé® |
| | | form.on('submit(Cancel)', function () { |
| | | Pub_Close(1); |
| | | }) |
| | | |
| | | //#endregion |
| | | |
| | | //#endregion |
| | | |
| | | //#region æ¬é¡µé¢ææè¢«è°ç¨çæ¹æ³ |
| | | //#region åå§å表å |
| | | //#region æ¬é¡µé¢ææè¢«è°ç¨çæ¹æ³ |
| | | //åå§å表å |
| | | function set_InitFrom() { |
| | | laydate.render({ |
| | | elem: '#HDate', |
| | |
| | | elem: '#HEndDate' |
| | | }); |
| | | } |
| | | //#endregion |
| | | |
| | | //#region åå§åè¡¨æ ¼ |
| | | //åå§åè¡¨æ ¼ |
| | | function set_InitGrid() { |
| | | //表头 |
| | | columns = [ |
| | | { type: 'checkbox', fixed: 'left' } |
| | | , { templet: '#xuhao', title: 'åºå·', sort: true, fixed: 'left', event: "qwe" } |
| | | //, { field: 'HDotCheckID', title: 'ç¹æ£é¡¹ç®ä»£ç ', edit: 'text', hide: true } |
| | | //, { field: 'HDotCheckCode', title: 'ç¹æ£é¡¹ç®ä»£ç ', edit: 'text', event: "HDotCheckCode" } |
| | | , { field: 'HDotCheckItem', title: 'ç¹æ£é¡¹ç®', edit: 'text', event: "" } |
| | | , { field: 'HDotCheckPart', title: 'ç¹æ£é¨ä½', edit: 'text', event: "" } |
| | | , { field: 'HClaim', title: 'å
·ä½è¦æ±', edit: 'text' } |
| | | , { field: 'HManagerID', title: 'è´è´£äººä»£ç ', edit: 'text', hide: true} |
| | | , { field: 'HManagerCode', title: 'è´è´£äººä»£ç ', edit: 'text', event: 'HManagerCode'} |
| | | , { field: 'HManagerID', title: 'è´è´£äººä»£ç ', edit: 'text', hide: true } |
| | | , { field: 'HManagerCode', title: 'è´è´£äººä»£ç ', edit: 'text', event: 'HManagerCode' } |
| | | , { field: 'HManagerName', title: 'è´è´£äººåç§°', edit: 'text' } |
| | | , { field: 'HRemark', title: '夿³¨', event: "", edit: 'text' } |
| | | , { fixed: 'right', title: 'æä½', toolbar: '#barDemo', width: 150 } |
| | |
| | | id: 'mainTable' |
| | | , elem: '#mainTable' |
| | | , toolbar: '#toolbarDemo' |
| | | , page: false |
| | | , page: true |
| | | , cellMinWidth: 120 |
| | | , height: 500 |
| | | , cols: [columns] |
| | |
| | | } |
| | | }; |
| | | } |
| | | //#endregion |
| | | |
| | | //#region è¡¨æ ¼å¢å è¡äºä»¶ |
| | | //å¢å ä¸è¡äºä»¶ |
| | | function btnAddLine(NewRow) { |
| | | table.cache["mainTable"].push(NewRow); |
| | | option.data = table.cache["mainTable"]; |
| | | table.render(option); |
| | | } |
| | | //#endregion |
| | | |
| | | //#region è¡¨æ ¼å¤å¶è¡äºä»¶ |
| | | //è¡¨æ ¼å¤å¶ä¸è¡äºä»¶ |
| | | function btnCopyLine(data) { |
| | | var copydata = JSON.stringify(data); |
| | | if (data.length <= 0) { |
| | |
| | | table.render(option);//å°æ°æ®æ¸²æå°è¡¨æ ¼ä¸ |
| | | } |
| | | } |
| | | //#endregion |
| | | |
| | | //#region è¡¨æ ¼è¡å
äºä»¶å é¤ |
| | | // è¡¨æ ¼è¡å
äºä»¶å é¤ |
| | | function set_GridDelete(obj) { |
| | | var data = obj.data; |
| | | var rowIndex = $(obj.tr).attr("data-index"); |
| | | if (obj.event === 'del') { |
| | | layer.confirm('ççå é¤è¡ä¹', function (index) { |
| | | console.log("ç´¢å¼ä¸º:" + rowIndex); |
| | | if (rowIndex === '0') { |
| | | layer.msg('é¦è¡æ æ³å é¤ï¼ï¼ï¼'); |
| | | } else { |
| | | obj.del(); |
| | | option.data = table.cache["mainTable"];//å°æ°æ®ç»å®å°dataä¸ |
| | | table.reload(option); |
| | | //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); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | //#endregion |
| | | |
| | | //#region è¡¨æ ¼è¡å
äºä»¶å¿«æ·é®çé |
| | | // è¡¨æ ¼è¡å
äºä»¶å¿«æ·é®çé |
| | | function set_GridCellCheck(obj) { |
| | | $(document).off('keydown', ".layui-table-edit").on('keydown', '.layui-table-edit', function (e) { |
| | | if (event.key == "F7") { |
| | | //if (obj.event === 'HDotCheckCode') //ç¹æ£é¡¹ç®ä»£ç |
| | | //{ |
| | | // //页é¢å±-èªå®ä¹ |
| | | // layer.open({ |
| | | // type: 2, |
| | | // skin: 'layui-layer-rim', //å ä¸è¾¹æ¡ |
| | | // title: 'ç©æå表', |
| | | // closeBtn: 1, |
| | | // shift: 2, |
| | | // area: ['90%', '90%'], |
| | | // maxmin: true, |
| | | // content: ['../PublicPage/CheckItemInformation.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('è¯·éæ©æ°æ®'); |
| | | // } |
| | | // //åæ¥æ´æ°è¡¨æ ¼åç¼å对åºçå¼ |
| | | // obj.update({ |
| | | // HDotCheckID: checkStatus.data[0].HItemID, |
| | | // HDotCheckCode: checkStatus.data[0].HNumber, |
| | | // HDotCheckItem: checkStatus.data[0].HName |
| | | // }); |
| | | // layer.close(layer.index); //å®è·åçå§ç»æ¯ææ°å¼¹åºçæä¸ªå±ï¼å¼æ¯ç±layerå
é¨å¨æéå¢è®¡ç®ç |
| | | // } |
| | | // , btn2: function (index, layero) { |
| | | // //æé®ãæé®äºãçåè° |
| | | // //return false å¼å¯è¯¥ä»£ç å¯ç¦æ¢ç¹å»è¯¥æé®å
³é |
| | | // }, |
| | | // end: function () { |
| | | // } |
| | | // }); |
| | | //} |
| | | if (obj.event === 'HManagerCode') //è´è´£äººä»£ç |
| | | { |
| | | //页é¢å±-èªå®ä¹ |
| | |
| | | } |
| | | }) |
| | | } |
| | | //#endregion |
| | | |
| | | //#region è·åæå¤§åæ®å· |
| | | //è·åæå¤§åæ®å·åé»è®¤å¼èµå¼ |
| | | function get_MAXNum() { |
| | | //è·åæå¤§åæ®å· new |
| | | $("#HInterID").val("0"); |
| | |
| | | type: "GET", |
| | | data: { "HBillType": sBillType }, |
| | | success: function (d) { |
| | | //console.log(d.data); |
| | | $("#HBillNo").val(d.data[0].HBillNo); |
| | | $("#HDate").val(shijian); |
| | | $("#HBeginDate").val(shijian); |
| | | $("#HEndDate").val(shijian); |
| | | $("#HCheckBeginDate").val(shijian); |
| | | $("#HDate").val(Pub_Format(new Date(), "yyyy-MM-dd")); |
| | | $("#HBeginDate").val(Pub_Format(new Date(), "yyyy-MM-dd")); |
| | | $("#HEndDate").val(Pub_Format(new Date(), "yyyy-MM-dd")); |
| | | $("#HInterID").val(0); |
| | | } |
| | | }); |
| | | } |
| | | //#endregion |
| | | |
| | | //#region æ æºåæ°å¢ |
| | | //æ æºåæ°å¢ |
| | | function set_AddFNew() { |
| | | //è·åæå¤§åæ®å· |
| | | get_MAXNum(); |
| | | option.data = [TabRow]; |
| | | table.render(option); |
| | | } |
| | | //#endregion |
| | | |
| | | //#region ç¼è¾è·å表头ãè·åè¡¨ä½ |
| | | //ç¼è¾è·å表头ãè·åè¡¨ä½ |
| | | function set_EditFromGrid(linterid) { |
| | | set_EditForm(linterid); //ç¼è¾è·å表头 |
| | | set_EditGrid(linterid); //ç¼è¾è·åè¡¨ä½ |
| | | option.data = [TabRow]; |
| | | table.render(option); |
| | | } |
| | | //#endregion |
| | | |
| | | //#region ç¼è¾è·å表头 |
| | | //ç¼è¾è·å表头 |
| | | function set_EditForm(linterid) { |
| | | $.ajax({ |
| | | url: GetWEBURL() + "Sb_EquipDotCheckBill/Sb_EquipDotCheckBillListCheckDetai", |
| | |
| | | } |
| | | }); |
| | | } |
| | | //#endregion |
| | | |
| | | //#region ç¼è¾è·åè¡¨ä½ |
| | | // ç¼è¾è·åè¡¨ä½ |
| | | function set_EditGrid(linterid) { |
| | | $("#HInterID").val(linterid);//ä¿®æ¹æ¶ä¸»è¡¨ID |
| | | //ç¼è¾å è½½æ°æ® |
| | |
| | | } |
| | | }); |
| | | } |
| | | //#endregion |
| | | |
| | | //#region è¡¨åæ°æ®ç¼è¾æ¶é´æ ¼å¼å |
| | | // è¡¨åæ°æ®ç¼è¾æ¶é´æ ¼å¼å |
| | | function formatDate(date) { |
| | | var d = new Date(date), |
| | | month = '' + (d.getMonth() + 1), |
| | |
| | | |
| | | return [year, month, day].join('-'); |
| | | } |
| | | //#endregion |
| | | |
| | | |
| | | |
| | | //#endregion |
| | | //æ°æ®éªè¯ |
| | | function AllowLoadData(sSubStr) { |
| | | if ($("#HEquipName").val() == '') { |
| | | layer.msg("è®¾å¤æ²¡æéæ©", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨æç¤º" }); |
| | | return false; |
| | | } |
| | | //å¤æç©ææç»é¡¹ |
| | | if (typeof (sSubStr) == "undefined" || sSubStr == "" || sSubStr == "[]") { |
| | | layer.msg("没æç©ææç»è®°å½", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨æç¤º" }); |
| | | return false; |
| | | } |
| | | if (typeof (sSubStr) != "undefined" && typeof (sSubStr) != "") { |
| | | sSubStr = JSON.parse(sSubStr); |
| | | for (var i = 0; i < sSubStr.length; i++) { |
| | | //if (sSubStr[i].HDotCheckCode == "") { |
| | | // layer.msg("æç»è®°å½ç¬¬" + (i + 1) + "è¡,ç¹æ£é¡¹ç®ä»£ç ä¿¡æ¯ä¸ºç©º!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨æç¤º" }); |
| | | // return false; |
| | | //} |
| | | if (sSubStr[i].HDotCheckItem == "") { |
| | | layer.msg("æç»è®°å½ç¬¬" + (i + 1) + "è¡,ç¹æ£é¡¹ç®ä»£ç ä¿¡æ¯ä¸ºç©º!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨æç¤º" }); |
| | | return false; |
| | | } |
| | | if (sSubStr[i].HManagerCode == "") { |
| | | layer.msg("æç»è®°å½ç¬¬" + (i + 1) + "è¡,è´è´£äººä»£ç ä¿¡æ¯ä¸ºç©º!", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨æç¤º" }); |
| | | return false; |
| | | } |
| | | else { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //#endregion |
| | | |
| | | }); |
| | | </script> |