From 397dbf892f842c834af17a91c788c94fd96003f8 Mon Sep 17 00:00:00 2001 From: YYC <1833023622@qq.com> Date: 星期一, 29 五月 2023 19:13:31 +0800 Subject: [PATCH] 问题修改 --- igds-app/js/admin/work-apply.js | 251 ++++++++++++++++++++++++++------------------------ 1 files changed, 131 insertions(+), 120 deletions(-) diff --git a/igds-app/js/admin/work-apply.js b/igds-app/js/admin/work-apply.js index 6c93a9f..bf9b1a8 100644 --- a/igds-app/js/admin/work-apply.js +++ b/igds-app/js/admin/work-apply.js @@ -1,4 +1,38 @@ var url = null; +var depotData; +var name = '' +var listPicker2 = []; +var list = [{ + value: 'ywj', + text: '钁d簨闀� 鍙舵枃娲�' +}, { + value: 'aaa', + text: '鎬荤粡鐞� 鑹続A' +}, { + value: 'lj', + text: '缃楄緫' +}, { + value: 'ymt', + text: '浜戝ぉ鏄�' +}, { + value: 'shq', + text: '鍙插己' +}, { + value: 'zhbh', + text: '绔犲寳娴�' +}, { + value: 'zhy', + text: '搴勯' +}, { + value: 'gyf', + text: '鍏充竴甯�' +}, { + value: 'zhz', + text: '鏅哄瓙' +}, { + value: 'gezh', + text: '姝岃��' +}] //宸ュ崟鐢宠 var data = { "interfaceId": "5701", @@ -13,12 +47,23 @@ } }; //鑾峰彇搴撳尯鍒楄〃 -var data = { +var data1 = { "interfaceId": "5002", "outId": "10002", "reqDateTime": new Date(), "tokenAuth": "", + "data": {} +}; + +//鑾峰彇浠撳簱鍒楄〃 +var data2 = { + "interfaceId": "5102", + "sign": "10102", + "outId": "10102", + "reqDateTime": new Date(), + "tokenAuth": "", "data": { + "deptId": "" } }; @@ -28,12 +73,16 @@ var selectDeptId = JSON.parse(localStorage.getItem('selectDeptId')); url = user.url + "/api-phone/v35/gateway"; data.tokenAuth = user.tokenAuth; - // data.data.deptId = selectDeptId; + data2.tokenAuth = user.tokenAuth; + data2.data.deptId = selectDeptId; + depotList(); + } function chooseDate() { var dtpicker = new mui.DtPicker({ - type: "date", //璁剧疆鏃ュ巻鍒濆瑙嗗浘妯″紡 + // type: "hour", //璁剧疆鏃ュ巻鍒濆瑙嗗浘妯″紡 + type: "datetime", // beginDate: new Date(2015, 04, 25), //璁剧疆寮�濮嬫棩鏈� // endDate: new Date(2016, 04, 25), //璁剧疆缁撴潫鏃ユ湡 @@ -48,10 +97,11 @@ function chooseDate1() { var dtpicker = new mui.DtPicker({ - type: "date", //璁剧疆鏃ュ巻鍒濆瑙嗗浘妯″紡 + // type: "hour", //璁剧疆鏃ュ巻鍒濆瑙嗗浘妯″紡 + type: "datetime", // beginDate: new Date(2015, 04, 25), //璁剧疆寮�濮嬫棩鏈� // endDate: new Date(2016, 04, 25), //璁剧疆缁撴潫鏃ユ湡 - + value: dateTime }) dtpicker.show(function(e) { var date_el = document.getElementById("date2-val") @@ -63,6 +113,7 @@ //宸ュ崟鐢宠 function workApply() { + console.log(JSON.stringify(data.data)) //鍙戦�佽姹傝繘琛屽伐鍗曠敵璇� mui.ajax(url, { type: "POST", @@ -73,6 +124,32 @@ success: function(result) { if (result.code == "0000") { console.log(JSON.stringify(result)) + mui.toast(result.msg); + } else { + // console.log(JSON.stringify(result)) + // mui.toast(result.msg); + mui.alert(result.msg, '鎻愮ず', ["纭畾"], function() {}, "div"); + } + }, + error: function() { + mui.alert('绯荤粺绻佸繖,璇烽噸鏂扮櫥褰曞皾璇曪紒', '鎻愮ず', ["纭畾"], function() {}, "div"); + } + }) +} + +function depotList() { + //鑾峰彇浠撳簱鍒楄〃 + mui.ajax(url, { + type: "POST", + dataType: "json", + crossDomain: true, + contentType: "application/json;charset=utf-8", + data: JSON.stringify(data2), + success: function(result) { + if (result.code == "0000") { + depotData = result.data + conversion(depotData); + // console.log(JSON.stringify(result)) } else { mui.alert(result.msg, '鎻愮ず', ["纭畾"], function() {}, "div"); } @@ -83,10 +160,47 @@ }) } +function conversion(data) { + var fenl = {} + $.each(data, function(index, item) { + fenl = { + value: item.name, + text: item.id, + } + listPicker2.push(fenl) + }) +} + +function refresh(){ + var html = ''; + html += '<div class="m-gd"><div class="group"><div class="l">涓氬姟绫诲瀷:</div><div class="r">' + html += '<div class="val" id="ywlx"><div class="placeholder">璇烽�夋嫨</div>' + html += '<div class="real-val" id="ywlx-val" ></div></div></div></div>' + html += '<div class="group"><div class="l">鍏宠仈浠撳簱:</div><div class="r">'; + html += '<div class="val" id="glck"><div class="placeholder">璇烽�夋嫨</div>'; + html += '<div class="real-val" id="glck-val" ></div></div></div></div>'; + html += '<div class="group"><div class="l">鏈夋晥寮�濮嬫椂闂�:</div><div class="r">'; + html += '<div class="val" id="date1" onclick="chooseDate();"><div class="placeholder">璇烽�夋嫨</div>'; + html += '<div class="real-val" id="date1-val"></div></div></div></div>'; + html += '<div class="group"><div class="l">鏈夋晥缁撴潫鏃堕棿:</div><div class="r">'; + html += '<div class="val" id="date2" onclick="chooseDate1();"><div class="placeholder">璇烽�夋嫨</div>'; + html += '<div class="real-val" id="date2-val"></div></div></div></div>'; + html += '<div type="submit" class="submit">鎻愪氦</div></div>'; + $("#refresh").html(html); + data.data.depotId = ''; + data.data.type = '' + data.data.startTime = '' + data.data.endTime = '' + +} + //鎻愪氦 mui(".mui-scroll").on("tap", ".wp form .submit", function() { - console.log("111") workApply(); + // window.location.reload(); + window.setTimeout(function() { + refresh(); + }, 200) }) mui('.mui-scroll-wrapper').scroll({ @@ -95,6 +209,8 @@ bounce: false, //鏄惁鍚敤鍥炲脊 deceleration: 0.0005 //flick 鍑忛�熺郴鏁帮紝绯绘暟瓒婂ぇ锛屾粴鍔ㄩ�熷害瓒婃參锛屾粴鍔ㄨ窛绂昏秺灏忥紝榛樿鍊�0.0006 }); + + (function($, doc) { $.init(); $.ready(function() { @@ -108,43 +224,14 @@ return obj[param] || ''; }; //鏅�氱ず渚� - var userPicker = new $.PopPicker(); - userPicker.setData([{ - value: 'ywj', - text: '钁d簨闀� 鍙舵枃娲�' - }, { - value: 'aaa', - text: '鎬荤粡鐞� 鑹続A' - }, { - value: 'lj', - text: '缃楄緫' - }, { - value: 'ymt', - text: '浜戝ぉ鏄�' - }, { - value: 'shq', - text: '鍙插己' - }, { - value: 'zhbh', - text: '绔犲寳娴�' - }, { - value: 'zhy', - text: '搴勯' - }, { - value: 'gyf', - text: '鍏充竴甯�' - }, { - value: 'zhz', - text: '鏅哄瓙' - }, { - value: 'gezh', - text: '姝岃��' - }]); var showUserPickerButton = doc.getElementById('ywlx'); - var userResult = doc.getElementById('ywlx-val'); showUserPickerButton.addEventListener('tap', function(event) { + var userResult = doc.getElementById('ywlx-val'); + var userPicker = new $.PopPicker(); + userPicker.setData(list); userPicker.show(function(items) { // userResult.innerText = JSON.stringify(items[0]); + console.log(JSON.stringify(items)) userResult.innerText = items[0].text; // userResult.previousSibling.style.display="none" jQuery(userResult).prev().hide() @@ -152,98 +239,22 @@ //return false; }); }, false); - //----------------------------------------- - //鎵�灞炲垎搴�: - var picker1 = new $.PopPicker(); - picker1.setData([{ - value: 'ywj', - text: '钁d簨闀� 鍙舵枃娲�' - }, { - value: 'aaa', - text: '鎬荤粡鐞� 鑹続A' - }, { - value: 'lj', - text: '缃楄緫' - }, { - value: 'ymt', - text: '浜戝ぉ鏄�' - }, { - value: 'shq', - text: '鍙插己' - }, { - value: 'zhbh', - text: '绔犲寳娴�' - }, { - value: 'zhy', - text: '搴勯' - }, { - value: 'gyf', - text: '鍏充竴甯�' - }, { - value: 'zhz', - text: '鏅哄瓙' - }, { - value: 'gezh', - text: '姝岃��' - }]); - var showPicker1Button = doc.getElementById('ssfk'); - var picker1Result = doc.getElementById('ssfk-val'); - showPicker1Button.addEventListener('tap', function(event) { - picker1.show(function(items) { - // userResult.innerText = JSON.stringify(items[0]); - picker1Result.innerText = items[0].text; - // userResult.previousSibling.style.display="none" - jQuery(picker1Result).prev().hide() - //杩斿洖 false 鍙互闃绘閫夋嫨妗嗙殑鍏抽棴 - //return false; - }); - }, false); - //----------------------------------------- + //---------------------------------------- //鍏宠仈浠撳簱: - var picker2 = new $.PopPicker(); - picker2.setData([{ - value: 'ywj', - text: '钁d簨闀� 鍙舵枃娲�' - }, { - value: 'aaa', - text: '鎬荤粡鐞� 鑹続A' - }, { - value: 'lj', - text: '缃楄緫' - }, { - value: 'ymt', - text: '浜戝ぉ鏄�' - }, { - value: 'shq', - text: '鍙插己' - }, { - value: 'zhbh', - text: '绔犲寳娴�' - }, { - value: 'zhy', - text: '搴勯' - }, { - value: 'gyf', - text: '鍏充竴甯�' - }, { - value: 'zhz', - text: '鏅哄瓙' - }, { - value: 'gezh', - text: '姝岃��' - }]); var showPicker2Button = doc.getElementById('glck'); - var picker2Result = doc.getElementById('glck-val'); showPicker2Button.addEventListener('tap', function(event) { + var picker2Result = doc.getElementById('glck-val'); + var picker2 = new $.PopPicker(); + picker2.setData(listPicker2); picker2.show(function(items) { // userResult.innerText = JSON.stringify(items[0]); picker2Result.innerText = items[0].text; + data.data.depotId = items[0].value; // userResult.previousSibling.style.display="none" jQuery(picker2Result).prev().hide() //杩斿洖 false 鍙互闃绘閫夋嫨妗嗙殑鍏抽棴 //return false; }); }, false); - }); })(mui, document); \ No newline at end of file -- Gitblit v1.9.3