| | |
| | | <div class="layui-card-body" style="padding: 1px;"> |
| | | <form class="layui-form" action="" lay-filter="formData" style="background-color:white;"> |
| | | <div style="padding: 10px; "> |
| | | <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnSave" id="btnSave">导å
¥æ°æ®</button> |
| | | <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="Cancel" id="Cancel">éåº</button> |
| | | <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="UpLoad" id="UpLoad">æä»¶ä¸ä¼ </button> |
| | | <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="Confirm" id="Confirm">æ°æ®éªè¯</button> |
| | | <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnSave_ReWrite" id="btnSave_ReWrite">è¦ç导å
¥</button> |
| | | <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnSave_Add" id="btnSave_Add">追å 导å
¥</button> |
| | | <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="Cancel" id="Cancel">éåº</button> |
| | | </div> |
| | | <div class="layui-tab" lay-filter="tab-POStockInBill"> |
| | | <div class="layui-tab-content"> |
| | | <!--åºæ¬ä¿¡æ¯--> |
| | | <div class="layui-tab-item layui-show"> |
| | | <div class="layui-form-item" style="padding-top: 10px;"> |
| | | |
| | | <div class="layui-row"> |
| | | <div class="layui-col-xs4 layui-inline" style="width:100%;"> |
| | | <label class="layui-form-label">导å
¥å段(ä»»éå
¶ä¸)ï¼</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="checkbox" name="checkboxHUserID" id="checkboxHUserID" lay-skin="primary" lay-filter="checkboxHUserID" value="true" title="ç¨æ·ä»£ç "> |
| | | <input type="hidden" value="false" name="HUserID" id="HUserID"> |
| | | </div> |
| | | <div class="layui-input-inline"> |
| | | <input type="checkbox" name="checkboxHUserName" id="checkboxHUserName" lay-skin="primary" lay-filter="checkboxHUserName" value="true" title="ç¨æ·åç§°"> |
| | | <input type="hidden" value="false" name="HUserName" id="HUserName"> |
| | | </div> |
| | | <!--<div class="layui-input-inline"> |
| | | <input type="checkbox" name="checkboxHCusNumber" id="checkboxHCusNumber" lay-skin="primary" lay-filter="checkboxHCusNumber" value="true" title="客æ·ä»£ç "> |
| | | <input type="hidden" value="false" name="HCusNumber" id="HCusNumber"> |
| | | </div> |
| | | <div class="layui-input-inline"> |
| | | <input type="checkbox" name="checkboxHCusName" id="checkboxHCusName" lay-skin="primary" lay-filter="checkboxHCusName" value="true" title="客æ·åç§°"> |
| | | <input type="hidden" value="false" name="HCusName" id="HCusName"> |
| | | </div>--> |
| | | </div> |
| | | <div class="layui-col-xs4 layui-inline" style="width:100%;"> |
| | | <label class="layui-form-label">导å
¥å段(ä»»éå
¶ä¸)ï¼</label> |
| | | <!--<div class="layui-input-inline"> |
| | | <input type="checkbox" name="checkboxHCusNumber" id="checkboxHCusNumber" lay-skin="primary" lay-filter="checkboxHCusNumber" value="true" title="客æ·ä»£ç "> |
| | | <input type="hidden" value="false" name="HCusNumber" id="HCusNumber"> |
| | | </div> |
| | | <div class="layui-input-inline"> |
| | | <input type="checkbox" name="checkboxHCusName" id="checkboxHCusName" lay-skin="primary" lay-filter="checkboxHCusName" value="true" title="客æ·åç§°"> |
| | | <input type="hidden" value="false" name="HCusName" id="HCusName"> |
| | | </div>--> |
| | | <div class="layui-input-inline"> |
| | | <input type="checkbox" name="checkboxHOrgNumber" id="checkboxHOrgNumber" lay-skin="primary" lay-filter="checkboxHOrgNumber" value="true" title="ç»ç»ä»£ç "> |
| | | <input type="hidden" value="false" name="HOrgNumber" id="HOrgNumber"> |
| | | </div> |
| | | <div class="layui-input-inline"> |
| | | <input type="checkbox" name="checkboxHOrgName" id="checkboxHOrgName" lay-skin="primary" lay-filter="checkboxHOrgName" value="true" title="ç»ç»åç§°"> |
| | | <input type="hidden" value="false" name="HOrgName" id="HOrgName"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | |
| | | |
| | | var option = []; |
| | | |
| | | //è®°å½éªè¯æ è®° |
| | | var confirmBar = 0; |
| | | //#endregion |
| | | |
| | | //#region è¿å
¥é¡µé¢å³å è½½ |
| | |
| | | |
| | | //#region 触åäºä»¶ï¼å
æ¬form.on(){}æ ¼å¼çææç¹å»äºä»¶ãéæ©äºä»¶ç |
| | | //#region 表头æé®è§¦åäºä»¶ |
| | | //#region 导å
¥ ä¿åæ°æ® |
| | | form.on('submit(btnSave)', function (data) { |
| | | //#region è¦ç导å
¥ ä¿åæ°æ® |
| | | form.on('submit(btnSave_ReWrite)', function (data) { |
| | | if (confirmBar == 1) { |
| | | set_AddNew(data,1); |
| | | } else { |
| | | var reConfirmBar = 1; |
| | | for (var i = 0; i < option.data.length; i++) { |
| | | if ( (option.data[i].å¤å®ç»æ != "" && option.data[i].å¤å®ç»æ != "ç¨æ·å·²ç»å
³è该客æ·ï¼") || (option.data[i].客æ·å
ç === null || option.data[i].客æ·å
ç == "") ) { |
| | | reConfirmBar = 0; |
| | | break; |
| | | } |
| | | } |
| | | if (reConfirmBar == 1) { |
| | | set_AddNew(data, 1); |
| | | } else { |
| | | layer.msg("ä¿åå¤±è´¥ï¼æ°æ®æªéè¿æ ¡éªï¼è¯·å¨ä¿®æ¹åéæ°æ ¡éªï¼", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨æç¤º" }); |
| | | } |
| | | } |
| | | }) |
| | | //#endregion |
| | | |
| | | //#region 追å 导å
¥ ä¿åæ°æ® |
| | | form.on('submit(btnSave_Add)', function (data) { |
| | | if (confirmBar == 1) { |
| | | set_AddNew(data, 2); |
| | | } else { |
| | | layer.msg("ä¿åå¤±è´¥ï¼æ°æ®æªéè¿æ ¡éªï¼è¯·å¨ä¿®æ¹åéæ°æ ¡éªï¼", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨æç¤º" }); |
| | | } |
| | | }) |
| | | //#endregion |
| | | |
| | | //#region 导å
¥ æ°æ®éªè¯ |
| | | form.on('submit(Confirm)', function (data) { |
| | | var HUserID = document.getElementById("checkboxHUserID").checked; |
| | | var HUserName = document.getElementById("checkboxHUserName").checked; |
| | | //var HCusNumber = document.getElementById("checkboxHCusNumber").checked; |
| | | //var HCusName = document.getElementById("checkboxHCusName").checked; |
| | | var HOrgNumber = document.getElementById("checkboxHOrgNumber").checked; |
| | | var HOrgName = document.getElementById("checkboxHOrgName").checked; |
| | | |
| | | if (!((HUserID == true && HUserName == false) || (HUserID == false && HUserName == true))) { |
| | | layer.msg("请å¨ç¨æ·ä»£ç åç¨æ·åç§°ä¹é´ä»»éä¸ä¸ªä½ä¸ºå¯¼å
¥å段!"); |
| | | return false; |
| | | } |
| | | |
| | | if (!((HOrgNumber == true && HOrgName == false) || (HOrgNumber == false && HOrgName == true))) { |
| | | layer.msg("请å¨ç»ç»ä»£ç åç»ç»åç§°ä¹é´ä»»éä¸ä¸ªä½ä¸ºå¯¼å
¥å段!"); |
| | | return false; |
| | | } |
| | | |
| | | if (AllowLoadData()) { |
| | | set_AddNew(data); |
| | | set_confirm(data); |
| | | } |
| | | }) |
| | | //#endregion |
| | |
| | | , loading: false |
| | | , cols: [[ |
| | | { type: 'checkbox', fixed: 'left' } |
| | | , { field: 'HUserID', title: 'ç¨æ·ä»£ç ', width: 120 } |
| | | , { field: 'ç¨æ·åç§°', title: 'ç¨æ·åç§°', width: 120 } |
| | | , { field: 'HCusID', title: '客æ·å
ç ', width: 120, hide: true } |
| | | , { field: '客æ·ä»£ç ', title: '客æ·ä»£ç ', width: 120 } |
| | | , { field: '客æ·åç§°', title: '客æ·åç§°', width: 120 } |
| | | , { field: 'ç¨æ·ä»£ç ', title: 'ç¨æ·ä»£ç ', edit: "true", width: 120 } |
| | | , { field: 'ç¨æ·åç§°', title: 'ç¨æ·åç§°', edit: "true", width: 120 } |
| | | , { field: '客æ·å
ç ', title: '客æ·å
ç ', edit: "true", width: 120, hide: true } |
| | | , { field: '客æ·ä»£ç ', title: '客æ·ä»£ç ', edit: "true", width: 120 } |
| | | , { field: '客æ·åç§°', title: '客æ·åç§°', edit: "true", width: 120 } |
| | | , { field: 'ç»ç»ä»£ç ', title: 'ç»ç»ä»£ç ', edit: "true", width: 120 } |
| | | , { field: 'ç»ç»åç§°', title: 'ç»ç»åç§°', edit: "true", width: 120 } |
| | | , { field: 'å¤å®ç»æ', title: 'å¤å®ç»æ', edit: "true", width: 240 } |
| | | , { fixed: 'right', title: 'æä½', toolbar: '#barDemo' } |
| | | ]] |
| | | , done: function (res, curr, count) { |
| | | //循ç¯è¡¨æ°æ®æ ¹æ®flagç¶æç»è¡ä¸è² |
| | | $.each(res['data'], function (i, j) { |
| | | if (j['å¤å®ç»æ'] != '') { |
| | | Layui_SetDataTableRowColor('table', i + 1, 'red'); |
| | | } else { |
| | | Layui_SetDataTableRowColor('table', i + 1, 'black'); |
| | | } |
| | | |
| | | }); |
| | | } |
| | | }; |
| | | //渲æé¡µé¢ |
| | | table.render(option); |
| | |
| | | } |
| | | //#endregion |
| | | |
| | | //#region ç»tableè¡ä¸è² |
| | | function Layui_SetDataTableRowColor(TabDivId, RowIndex, ColorString) { |
| | | try { |
| | | var div = $("[lay-id='mainTable'] tr:eq(" + RowIndex + ")"); |
| | | if (div != null) //æ¾å°å¯¹è±¡äº |
| | | { |
| | | // console.log(div); |
| | | div.css("color", ColorString); |
| | | |
| | | } else { |
| | | console.log('æ²¡ææ¾å°å¯¹è±¡'); |
| | | } |
| | | } catch (e) { |
| | | console.log(e.message); |
| | | } |
| | | } |
| | | //#endregion |
| | | |
| | | //#region 导å
¥(æ°æ®éªè¯) |
| | | function set_confirm(data) { |
| | | var num = []; |
| | | for (var i = 0; i < option.data.length; i++) { |
| | | if (option.data[i] != "") { |
| | | num.push(option.data[i]) |
| | | } |
| | | } |
| | | |
| | | //è·å导å
¥å段 |
| | | var HUserID = document.getElementById("checkboxHUserID").checked; |
| | | var HUserName = document.getElementById("checkboxHUserName").checked; |
| | | //var HCusNumber = document.getElementById("checkboxHCusNumber").checked; |
| | | //var HCusName = document.getElementById("checkboxHCusName").checked; |
| | | var HOrgNumber = document.getElementById("checkboxHOrgNumber").checked; |
| | | var HOrgName = document.getElementById("checkboxHOrgName").checked; |
| | | var importList = ""; |
| | | if (HUserID == true) { |
| | | importList += "HUserID;"; |
| | | } else if (HUserName == true) { |
| | | importList += "HUserName;"; |
| | | } |
| | | if (HOrgNumber == true) { |
| | | importList += "HOrgNumber;"; |
| | | } else if (HOrgName == true) { |
| | | importList += "HOrgName;"; |
| | | } |
| | | |
| | | //data.field.HOrgID = sessionStorage["OrganizationID"];//ç»ç» |
| | | //var sMainStr = JSON.stringify(data.field); |
| | | var sSubStr = JSON.stringify(num); |
| | | var sMainSub = sSubStr + '&å' + sessionStorage["HUserName"] + '&å' + importList; |
| | | var index = layer.load(); |
| | | |
| | | $.ajax({ |
| | | type: "POST", |
| | | url: GetWEBURL() + "/Xt_User/Gy_UserCustomer_ImportByExcel_Confirm", |
| | | async: true, |
| | | data: { "sMainSub": sMainSub }, |
| | | dataType: "json", |
| | | success: function (data) { |
| | | if (data.count == 1) { |
| | | if (data.Message == "1") { |
| | | confirmBar = 1; |
| | | for (var i = 0; i < option.cols[0].length; i++) { |
| | | option.cols[0][i].edit = "false"; |
| | | } |
| | | } else { |
| | | confirmBar = 0; |
| | | for (var i = 0; i < option.cols[0].length; i++) { |
| | | option.cols[0][i].edit = "true"; |
| | | } |
| | | } |
| | | option.data = data.data; |
| | | table.render(option); |
| | | layer.close(index); |
| | | } |
| | | else { |
| | | layer.close(index); |
| | | layer.msg(data.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨æç¤º" }); |
| | | } |
| | | }, |
| | | error: function (err) { |
| | | layer.close(index); |
| | | layer.msg("é误:" + err, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨æç¤º" }); |
| | | } |
| | | }); |
| | | } |
| | | //#endregion |
| | | |
| | | //#region 导å
¥(ä¿å) |
| | | function set_AddNew(data) { |
| | | function set_AddNew(data, saveType) { |
| | | var num = []; |
| | | for (var i = 0; i < option.data.length; i++) { |
| | | if (option.data[i] != "") { |
| | |
| | | //data.field.HOrgID = sessionStorage["OrganizationID"];//ç»ç» |
| | | //var sMainStr = JSON.stringify(data.field); |
| | | var sSubStr = JSON.stringify(num); |
| | | var sMainSub = sSubStr + '&å' + sessionStorage["HUserName"]; |
| | | var sMainSub = sSubStr + '&å' + sessionStorage["HUserName"] + '&å' + saveType; |
| | | var index = layer.load(); |
| | | |
| | | $.ajax({ |
| | |
| | | layer.close(index); |
| | | layer.msg(data.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨æç¤º" }); |
| | | } |
| | | confirmBar = 0; |
| | | }, |
| | | error: function (err) { |
| | | layer.close(index); |
| | | layer.msg("é误:" + err, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨æç¤º" }); |
| | | confirmBar = 0; |
| | | } |
| | | }); |
| | | } |
| | |
| | | return false; |
| | | } |
| | | |
| | | //if (confirmBar == 0) { |
| | | // layer.msg("æ°æ®åå¨é®é¢,请å¨ä¿®æ¹æ°æ®åéæ°æ ¡éª!"); |
| | | // return false; |
| | | //} |
| | | |
| | | //å
³é®åé夿 ¡éª |
| | | var num = []; |
| | | var temp = ""; |
| | | for (var i = 0; i < data.length; i++) { |
| | | temp = data[i]["HUserID"] + "," + data[i]["客æ·ä»£ç "]; |
| | | temp = data[i]["ç¨æ·ä»£ç "] + "," + data[i]["客æ·ä»£ç "] + "," + data[i]["ç»ç»ä»£ç "]; |
| | | if ($.inArray(temp, num) == -1) { |
| | | num.push(temp); |
| | | } else { |
| | | layer.msg("第" + (i + 1) + "è¡,ç¨æ·ç¼ç ä¸å®¢æ·ä»£ç åå¨éå¤è®°å½!"); |
| | | layer.msg("第" + (i + 1) + "è¡,ç¨æ·ä»£ç ã客æ·ä»£ç åç»ç»ä»£ç åå¨éå¤è®°å½!"); |
| | | return false; |
| | | } |
| | | } |