From 4f20ad52b8d4ab206e3458e488d3950eb2bfb5a3 Mon Sep 17 00:00:00 2001
From: YYC <1833023622@qq.com>
Date: 星期三, 07 六月 2023 16:35:55 +0800
Subject: [PATCH] 细节调整

---
 igds-app/js/admin/work-apply.js |  346 +++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 212 insertions(+), 134 deletions(-)

diff --git a/igds-app/js/admin/work-apply.js b/igds-app/js/admin/work-apply.js
index 6c93a9f..ae12d9e 100644
--- a/igds-app/js/admin/work-apply.js
+++ b/igds-app/js/admin/work-apply.js
@@ -1,4 +1,43 @@
 var url = null;
+var depotData;
+var typeData;
+var startTime = '';
+var endTime = '';
+var name = ''
+var info = '';
+var listPicker2 = [];
+var listPicker1 = [];
+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",
@@ -10,59 +49,83 @@
 		"type": "",
 		"startTime": "",
 		"endTime": "",
-	}
-};
-//鑾峰彇搴撳尯鍒楄〃
-var data = {
-	"interfaceId": "5002",
-	"outId": "10002",
-	"reqDateTime": new Date(),
-	"tokenAuth": "",
-	"data": {
+		"info": ""
 	}
 };
 
+//鑾峰彇浠撳簱鍒楄〃
+var data2 = {
+	"interfaceId": "5102",
+	"outId": "10102",
+	"reqDateTime": new Date(),
+	"tokenAuth": "",
+	"data": {
+		"deptId": ""
+	}
+};
+
+//鑾峰彇涓氬姟绫诲瀷
+var data1 = {
+	"interfaceId": "6101",
+	"outId": "11101",
+	"reqDateTime": new Date(),
+	"tokenAuth": "",
+	"data": {
+		
+	}
+};
 
 function init() {
 	var user = JSON.parse(localStorage.getItem('user'));
 	var selectDeptId = JSON.parse(localStorage.getItem('selectDeptId'));
 	url = user.url + "/api-phone/v35/gateway";
 	data.tokenAuth = user.tokenAuth;
-	// data.data.deptId = selectDeptId;
-}
+	data1.tokenAuth = user.tokenAuth;
+	data2.tokenAuth = user.tokenAuth;
+	data2.data.deptId = selectDeptId;
+	
+	depotList();
+	typeList();
 
+}
+//寮�濮嬫椂闂�
 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), //璁剧疆缁撴潫鏃ユ湡
-
+		value: startTime
 	})
 	dtpicker.show(function(e) {
 		var date_el = document.getElementById("date1-val")
 		date_el.innerText = e.value
-		data.data.startTime = e.value;
+		startTime = e.value
+		data.data.startTime = startTime;
 		jQuery(date_el).prev().hide()
 	})
 }
-
+//
 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:endTime
 	})
 	dtpicker.show(function(e) {
 		var date_el = document.getElementById("date2-val")
 		date_el.innerText = e.value
-		data.data.endTime = e.value
+		endTime = e.value
+		data.data.endTime = endTime
 		jQuery(date_el).prev().hide()
 	})
 }
 
 //宸ュ崟鐢宠
 function workApply() {
+	console.log(JSON.stringify(data.data))
 	//鍙戦�佽姹傝繘琛屽伐鍗曠敵璇�
 	mui.ajax(url, {
 		type: "POST",
@@ -73,7 +136,10 @@
 		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");
 			}
 		},
@@ -83,10 +149,106 @@
 	})
 }
 
+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 typeList() {
+	//鑾峰彇浠撳簱鍒楄〃
+	mui.ajax(url, {
+		type: "POST",
+		dataType: "json",
+		crossDomain: true,
+		contentType: "application/json;charset=utf-8",
+		data: JSON.stringify(data1),
+		success: function(result) {
+			if (result.code == "0000") {
+				typeData = result.data
+				conversionType(typeData);
+				// 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)
+	})
+}
+function conversionType(data){
+	var fenl = {}
+	$.each(data, function(index, item) {
+		fenl = {
+			value: item.name,
+			text: item.id,
+		}
+		listPicker1.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 class="group"><div class="l">宸ュ崟鍐呭:</div><div class="r">'
+	html += '<div class="gdnr" id="gdnr" "><div class="placeholder">璇烽�夋嫨</div>'
+	html += '<div class="real-val" id="gdnr-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 = ''
+	info = ''
+	data.data.info = info
+	
+}
+
 //鎻愪氦
 mui(".mui-scroll").on("tap", ".wp form .submit", function() {
-	console.log("111")
+	data.data.info = info;
 	workApply();
+	// window.location.reload();
+	window.setTimeout(function() {
+		refresh();
+	}, 200)
 })
 
 mui('.mui-scroll-wrapper').scroll({
@@ -95,6 +257,8 @@
 	bounce: false, //鏄惁鍚敤鍥炲脊
 	deceleration: 0.0005 //flick 鍑忛�熺郴鏁帮紝绯绘暟瓒婂ぇ锛屾粴鍔ㄩ�熷害瓒婃參锛屾粴鍔ㄨ窛绂昏秺灏忥紝榛樿鍊�0.0006
 });
+
+
 (function($, doc) {
 	$.init();
 	$.ready(function() {
@@ -108,43 +272,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(listPicker1);
 			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 +287,41 @@
 				//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
+})(mui, document);
+
+//鎵撳紑寮圭獥
+mui(".mui-scroll").on("tap", ".wp form .gdnr", function() {
+	document.getElementById("textareaPop").value = info;
+	$("#m-pop").css('display', 'flex');
+})
+
+//鍏抽棴寮圭獥
+function closePop() {
+	$("#m-pop").css('display', 'none');
+}
+//寮圭獥纭畾鎸夐挳
+mui(".mui-content").on("tap", ".m-pop .inner .confirm", function() {
+	info = document.getElementById("textareaPop").value;
+	if(info){
+		document.getElementById("gdnr").innerText = info	
+	}
+	closePop();
+})
\ No newline at end of file

--
Gitblit v1.9.3