From 0adbc72b09cbc1fd3c0f59cb65c3c476d65adc15 Mon Sep 17 00:00:00 2001 From: YYC <1833023622@qq.com> Date: 星期三, 17 五月 2023 18:36:02 +0800 Subject: [PATCH] 工单申请 --- igds-app/js/admin/work-apply.js | 212 ++++++++++++++++++++++++++-------------------------- 1 files changed, 107 insertions(+), 105 deletions(-) diff --git a/igds-app/js/admin/work-apply.js b/igds-app/js/admin/work-apply.js index 6c93a9f..7f57f76 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,7 +97,8 @@ 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), //璁剧疆缁撴潫鏃ユ湡 @@ -63,6 +113,7 @@ //宸ュ崟鐢宠 function workApply() { + console.log(JSON.stringify(data.data)) //鍙戦�佽姹傝繘琛屽伐鍗曠敵璇� mui.ajax(url, { type: "POST", @@ -74,6 +125,7 @@ if (result.code == "0000") { console.log(JSON.stringify(result)) } else { + // console.log(JSON.stringify(result)) mui.alert(result.msg, '鎻愮ず', ["纭畾"], function() {}, "div"); } }, @@ -83,10 +135,47 @@ }) } +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"); + } + }, + error: function() { + mui.alert('绯荤粺绻佸繖,璇烽噸鏂扮櫥褰曞皾璇曪紒', '鎻愮ず', ["纭畾"], function() {}, "div"); + } + }) +} + +function conversion(data) { + var fenl = {} + $.each(data, function(index, item) { + fenl = { + value: item.name, + text: item.id, + } + listPicker2.push(fenl) + }) +} + //鎻愪氦 mui(".mui-scroll").on("tap", ".wp form .submit", function() { - console.log("111") workApply(); + window.location.reload(); + // window.setTimeout(function() { + // window.location.reload(); + // }, 200) }) mui('.mui-scroll-wrapper').scroll({ @@ -95,6 +184,8 @@ bounce: false, //鏄惁鍚敤鍥炲脊 deceleration: 0.0005 //flick 鍑忛�熺郴鏁帮紝绯绘暟瓒婂ぇ锛屾粴鍔ㄩ�熷害瓒婃參锛屾粴鍔ㄨ窛绂昏秺灏忥紝榛樿鍊�0.0006 }); + + (function($, doc) { $.init(); $.ready(function() { @@ -108,43 +199,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() @@ -154,41 +216,11 @@ }, 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) { + var picker1Result = doc.getElementById('ssfk-val'); + var picker1 = new $.PopPicker(); + picker1.setData(list); picker1.show(function(items) { // userResult.innerText = JSON.stringify(items[0]); picker1Result.innerText = items[0].text; @@ -200,50 +232,20 @@ }, 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