From bdd84cc48ba7b2527584c44d174da8e7d20c5375 Mon Sep 17 00:00:00 2001
From: zhaowc <526854230@qq.com>
Date: 星期三, 18 九月 2024 16:37:13 +0800
Subject: [PATCH] 增加对申请入库时对平库库位的校验

---
 HTML/views/SystemSettings/Job.html |  203 ++++++++++++++++++++++++++++----------------------
 1 files changed, 114 insertions(+), 89 deletions(-)

diff --git a/HTML/views/SystemSettings/Job.html b/HTML/views/SystemSettings/Job.html
index 627ced1..d26a50f 100644
--- a/HTML/views/SystemSettings/Job.html
+++ b/HTML/views/SystemSettings/Job.html
@@ -27,7 +27,7 @@
 				id="top">
 				<div class="layui-form-item">
 					<div class="layui-inline">
-						<button class="layui-btn layui-btn-sm layuiadmin-btn-list" lay-submit
+						<button class="layui-btn layui-btn-sm layuiadmin-btn-list" lay-submit id="btnAdd"
 							lay-filter="LAY-app-contlist-add">
 							<i class="layui-icon layui-icon-add-1 layuiadmin-button-btn"></i>娣诲姞
 						</button>
@@ -56,14 +56,18 @@
 	<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="Play">
 		<i class="layui-icon layui-icon-play"></i>寮�濮�</a>
 	{{# } }}
-	<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>缂栬緫</a>
-	<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>鍒犻櫎</a>
-	<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="detail"><i
+	<a class="layui-btn layui-btn-normal layui-btn-xs btnEdit" lay-event="edit"><i
+			class="layui-icon layui-icon-edit"></i>缂栬緫</a>
+	<a class="layui-btn layui-btn-danger layui-btn-xs btnDel" lay-event="del"><i
+			class="layui-icon layui-icon-delete"></i>鍒犻櫎</a>
+	<a class="layui-btn layui-btn-normal layui-btn-xs btnLog" lay-event="detail"><i
 			class="layui-icon layui-icon-log"></i>鏃ュ織</a>
-	<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="execute"><i
+	<a class="layui-btn layui-btn-normal layui-btn-xs btnExec" lay-event="execute"><i
 			class="layui-icon layui-icon-triangle-r"></i>鎵ц</a>
 	</script>
 	<script>
+		var doing = true;
+		var objRowsData = {};
 		layui.config({
 			base: '../../layuiadmin/' //闈欐�佽祫婧愭墍鍦ㄨ矾寰�
 		}).extend({
@@ -74,23 +78,15 @@
 				laypage = layui.laypage,
 				layer = layui.layer;
 			var h1 = GetTableHeight();
-			refreshTable("", "", "", "", "");
+			refreshTable();
 			var tableIns;
 
-			function refreshTable(MenuName, Type, Msg, MenuNo, ParentNo) {
-				var param = {
-					MenuName: MenuName,
-					Type: Type,
-					Msg: Msg,
-					MenuNo: MenuNo,
-					ParentNo: ParentNo,
-				};
-				ParentNo = '绯荤粺璁剧疆'; //妯″潡鍚嶇О
+			function refreshTable() {
 				var url = "/Job/GetAllJob";
 				sendData(IP + url, {}, 'get', function (res) {
 
 					// console.log(res.data)
-					if (res.code == 200) //鎴愬姛
+					if (res.code == 0) //鎴愬姛
 					{
 						var list = res.data;
 						$.extend(infoOptions, {
@@ -142,26 +138,6 @@
 						{
 							field: 'DisplayState', title: '鐘舵��', align: 'center', width: 80
 						},
-						// {
-						// 	field: 'TriggerState', title: '鐘舵��', align: 'center', width: 80, templet: function (d) {
-						// 		switch (d.TriggerState) {
-						// 			case 0:
-						// 				return '姝e父'
-						// 			case 1:
-						// 				return '鏆傚仠'
-						// 			case 2:
-						// 				return '瀹屾垚'
-						// 			case 3:
-						// 				return '寮傚父'
-						// 			case 4:
-						// 				return '闃诲'
-						// 			case 5:
-						// 				return '涓嶅瓨鍦�'
-						// 			default:
-						// 				return '鏈煡';
-						// 		}
-						// 	}
-						// },
 						{
 							field: 'PreviousFireTime', title: '涓婃鎵ц鏃堕棿', align: 'center', width: 170, templet: function (d) {
 								return formatDateTime(d.PreviousFireTime)
@@ -178,7 +154,33 @@
 						{
 							field: 'caozuo', title: '鎿嶄綔', fixed: 'right', width: 340, align: 'left', toolbar: "#toolBar"
 						}
-					]]
+					]],
+				done: function () {
+					//鏉冮檺
+					var listRole = JSON.parse(localStorage.getItem('listRole'));
+					$("#btnAdd").hide();
+					$(".btnEdit").hide();
+					$(".btnDel").hide();
+					$(".btnLog").hide();
+					$(".btnExec").hide();
+					if (listRole) {
+						if (listRole.filter(s => s.MenuName == "娣诲姞浠诲姟").length > 0) {
+							$("#btnAdd").show();
+						}
+						if (listRole.filter(s => s.MenuName == "缂栬緫浠诲姟").length > 0) {
+							$(".btnEdit").show();
+						}
+						if (listRole.filter(s => s.MenuName == "鍒犻櫎浠诲姟").length > 0) {
+							$(".btnDel").show();
+						}
+						if (listRole.filter(s => s.MenuName == "浠诲姟鏃ュ織").length > 0) {
+							$(".btnLog").show();
+						}
+						if (listRole.filter(s => s.MenuName == "鎵ц浠诲姟").length > 0) {
+							$(".btnExec").show();
+						}
+					}
+				}
 			};
 
 			table.on('tool(LAY-app-content-list)', function (obj) {
@@ -187,7 +189,7 @@
 					case "execute":
 						sendData(IP + "/Job/TriggerJob", { Name: data.Name, Group: data.GroupName }, 'post', function (res) {
 							console.log(res);
-							if (res.code == 200) { //鎴愬姛
+							if (res.code == 0) { //鎴愬姛
 								layer.msg(res.msg, {
 									icon: 1,
 									time: 3000 //1绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
@@ -206,46 +208,72 @@
 						});
 						break;
 					case "edit":
+						objRowsData = data;
+						layer.open({
+							type: 2,
+							title: '缂栬緫瀹氭椂浠诲姟淇℃伅',
+							content: 'JobForm.html',
+							maxmin: true,
+							area: ['650px', '550px'],
+							end: function () {
+								refreshTable();
+							}
+						});
 						break;
 					case "del":
-						sendData(IP + "/Job/RemoveJob", { Name: data.Name, Group: data.GroupName }, 'post', function (res) {
-							console.log(res);
-							if (res.code == 200) { //鎴愬姛
-								layer.msg(res.msg, {
-									icon: 1,
-									time: 3000 //1绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
-								}, function () {
-									refreshTable("", "", "", "", "");
-									doing = true;
+						if (doing) {
+							doing = false;
+							layer.confirm('纭畾鍒犻櫎閫変腑鐨勬ā鏉匡紵', function (index) {
+								sendData(IP + "/Job/RemoveJob", { Name: data.Name, Group: data.GroupName }, 'post', function (res) {
+									console.log(res);
+									if (res.code == 0) { //鎴愬姛
+										layer.msg(res.msg, {
+											icon: 1,
+											time: 3000 //1绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+										}, function () {
+											refreshTable();
+											doing = true;
+										});
+									} else { //涓嶆垚鍔�
+										layer.msg(res.msg, {
+											icon: 2,
+											time: 3000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+										}, function () {
+											refreshTable();
+											doing = true;
+										});
+									}
+									layer.close(index);
 								});
-							} else { //涓嶆垚鍔�
-								layer.msg(res.msg, {
-									icon: 2,
-									time: 3000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
-								}, function () {
-									refreshTable("", "", "", "", "");
-									doing = true;
-								});
-							}
-							layer.close(index);
-						});
+
+							});
+						}
 						break;
 					case "detail":
 						sendData(IP + "/Job/GetJobLogs", { Name: data.Name, Group: data.GroupName }, 'post', function (res) {
 							console.log(res);
-							if (res.code == 200) { //鎴愬姛
-								layer.open({
-									type: 1,
-									area: ['80%', '80%'], // 瀹介珮
-									content: res.data.join('\n')
-								});
+							if (res.code == 0) { //鎴愬姛
+								if (res.data) {
+									layer.open({
+										type: 1,
+										area: ['80%', '80%'], // 瀹介珮
+										content: res.data.join('\n')
+									});
+								}
+								else {
+									layer.msg('鏆傛棤鏃ュ織', {
+										icon: 2,
+										time: 3000
+									}, function () {
+										refreshTable();
+									});
+								}
 							} else { //涓嶆垚鍔�
 								layer.msg(res.msg, {
 									icon: 2,
-									time: 3000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+									time: 3000
 								}, function () {
-									refreshTable("", "", "", "", "");
-									doing = true;
+									refreshTable();
 								});
 							}
 							layer.close(index);
@@ -254,12 +282,12 @@
 					case "Play":
 						sendData(IP + "/Job/ResumeJob", { Name: data.Name, Group: data.GroupName }, 'post', function (res) {
 							console.log(res);
-							if (res.code == 200) { //鎴愬姛
+							if (res.code == 0) { //鎴愬姛
 								layer.msg(res.msg, {
 									icon: 1,
 									time: 3000 //1绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
 								}, function () {
-									refreshTable("", "", "", "", "");
+									refreshTable();
 									doing = true;
 								});
 							} else { //涓嶆垚鍔�
@@ -267,7 +295,7 @@
 									icon: 2,
 									time: 3000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
 								}, function () {
-									refreshTable("", "", "", "", "");
+									refreshTable();
 									doing = true;
 								});
 							}
@@ -277,12 +305,12 @@
 					case "Pause":
 						sendData(IP + "/Job/StopJob", { Name: data.Name, Group: data.GroupName }, 'post', function (res) {
 							console.log(res);
-							if (res.code == 200) { //鎴愬姛
+							if (res.code == 0) { //鎴愬姛
 								layer.msg(res.msg, {
 									icon: 1,
 									time: 3000 //1绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
 								}, function () {
-									refreshTable("", "", "", "", "");
+									refreshTable();
 									doing = true;
 								});
 							} else { //涓嶆垚鍔�
@@ -290,7 +318,7 @@
 									icon: 2,
 									time: 3000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
 								}, function () {
-									refreshTable("", "", "", "", "");
+									refreshTable();
 									doing = true;
 								});
 							}
@@ -299,24 +327,21 @@
 						break;
 				}
 			});
-
-			//鐩戝惉鎼滅储
-			form.on('submit(LAY-app-contlist-search)', function (data) {
-				// console.log(data)
-				var MenuName = data.field.MenuName;
-				var Type = data.field.Type;
-				var Msg = data.field.Msg;
-				var MenuNo = data.field.MenuNo;
-				//MenuName, Type, Msg, MenuNo,ParentNo
-				refreshTable(MenuName, Type, Msg, MenuNo);
+			//娣诲姞 
+			form.on('submit(LAY-app-contlist-add)', function (obj) {
+				objRowsData = null;
+				layer.open({
+					type: 2,
+					title: '娣诲姞瀹氭椂浠诲姟淇℃伅',
+					content: 'JobForm.html',
+					maxmin: true,
+					area: ['650px', '550px'],
+					end: function () {
+						refreshTable();
+					}
+				});
 			});
 
-			var doing = true;
-
-			// $('.layui-btn.layuiadmin-btn-list').on('click', function() {
-			// 	var type = $(this).data('type');
-			// 	active[type] ? active[type].call(this) : '';
-			// });
 		});
 		function formatDateTime(inputDateTime) {
 			// 鍒涘缓涓�涓棩鏈熷璞★紝鐢ㄤ簬瑙f瀽杈撳叆鐨勬棩鏈熸椂闂村瓧绗︿覆

--
Gitblit v1.8.0