From c9fe2c53364abe0e0e495a1b756267f865159e2e Mon Sep 17 00:00:00 2001
From: chengsc <11752@DESKTOP-DS49RCP>
Date: 星期三, 25 六月 2025 12:17:26 +0800
Subject: [PATCH] Merge branch 'csc'

---
 HTML/views/QualityControl/InspectionRequest.html |  180 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 165 insertions(+), 15 deletions(-)

diff --git a/HTML/views/QualityControl/InspectionRequest.html b/HTML/views/QualityControl/InspectionRequest.html
index 3119fd9..54c6286 100644
--- a/HTML/views/QualityControl/InspectionRequest.html
+++ b/HTML/views/QualityControl/InspectionRequest.html
@@ -22,6 +22,12 @@
 		.layui-table-grid-down {
 			display: none;
 		}
+
+		/* 鏍峰紡鐢ㄤ簬缇庡寲鍥剧墖灞曠ず */
+		.layui-table-cell img {
+			max-width: 100px;
+			max-height: 100px;
+		}
 	</style>
 	<script>
 		// 杩欓噷鏄渶瑕佸湪椤甸潰娓叉煋涔嬪墠鎵ц鐨勪唬鐮�
@@ -121,16 +127,30 @@
 
 					</div>
 
+					<div style="display: none;" id="UploadImageView">
+
+						<div id="UploadImage" style="margin-left: 35px;margin-top: 30px;">
+							<label>涓婁紶鍥剧墖:</label><button type="button" class="layui-btn" id="uploadBtn"
+								style="margin-left: 20px;">娴忚</button>
+							<button type="button" class="layui-btn" id="upload" style="margin-left: 20px;">涓婁紶</button>
+
+						</div>
+					</div>
+
+					<div style="display: none;" id="ImagesShowView">
+						<div id="ImagesShow">
+
+						</div>
+					</div>
+
 					<!-- 纭鍑哄簱鍙e脊绐� -->
 					<div class="layui-inline" id="divPickingArea" style="display: none; padding-top: 10px;">
 						<label class="layui-form-label">鍑哄簱鍙�</label>
 						<div class="layui-input-inline" style="width: 220px;">
 							<select name="PickingArea" id="PickingArea" lay-search>
 								<option value=""></option>
-								<option value="1">1</option>
-								<option value="2">2</option>
-								<option value="3">3</option>
-								<option value="4">4</option>
+								<option value="B020101">B020101</option>
+								<option value="B050101">B050101</option>
 							</select>
 						</div>
 					</div>
@@ -223,6 +243,10 @@
 							var html = ''; 
 							switch (d.Status) {
 								case "0" :
+									html += `<a class="layui-btn layui-btn-normal layui-btn-xs shangClass" lay-event="upImage">
+									<i class="layui-icon layui-icon-add"></i>涓婁紶</a> `;
+									html += `<a class="layui-btn layui-btn-normal layui-btn-xs chaClass" lay-event="ViewImage">
+										<i class="layui-icon layui-icon-add"></i>鏌ョ湅</a> `;
 									html += `<a class="layui-btn layui-btn-normal layui-btn-xs addClass" lay-event="add">
 											<i class="layui-icon layui-icon-add"></i>璇烽獙</a> `;
 									html += `<a class="layui-btn layui-btn-danger layui-btn-xs delClass" lay-event="del">
@@ -287,13 +311,14 @@
 			base: '../../layuiadmin/' //闈欐�佽祫婧愭墍鍦ㄨ矾寰�
 		}).extend({
 			index: 'lib/index' //涓诲叆鍙fā鍧�
-		}).use(['index', 'table', 'laypage', 'element', 'layer', 'laydate'], function () {
+		}).use(['index', 'table', 'laypage', 'element', 'layer', 'laydate', 'upload'], function () {
 			var table = layui.table,
 				form = layui.form,
-				element = layui.element;
-			laypage = layui.laypage,
-				layer = layui.layer;
-			laydate = layui.laydate;
+				element = layui.element,
+				laypage = layui.laypage,
+				layer = layui.layer,
+				laydate = layui.laydate,
+				upload = layui.upload;
 			var h1 = GetTableTabHeight();
 			laydate.render({
 				elem: '#StartTime'
@@ -379,7 +404,11 @@
 				{ field: 'Status', title: '鎵ц鐘舵��', align: 'center', width: 90, templet: '#templetStatus' },
 				{ field: 'RequestTime', title: '璇烽獙鏃ユ湡', align: 'center', width: 165, templet: '#templetCompleteTime' },
 				{ field: 'RequestUser', title: '璇烽獙浜�', align: 'center', width: 165 },
-				// { field: 'UDF1', title: '鑷畾涔�1', align: 'center', width: 100 },
+				{
+					field: 'UDF5', title: '鍥剧墖', align: 'center', width: 100, templet: function (d) {
+						return d.image ? '<img src="' + d.image + '" alt="鍥剧墖">' : '鏃犲浘鐗�';
+					}
+				},
 				// { field: 'UDF2', title: '鑷畾涔�2', align: 'center', width: 100 },
 				// { field: 'UDF3', title: '鑷畾涔�3', align: 'center', width: 100 },
 				// { field: 'UDF4', title: '鑷畾涔�4', align: 'center', width: 100 },
@@ -390,7 +419,7 @@
 				{ field: 'UpdateTime', title: '瀹屾垚鏃ユ湡', align: 'center', width: 165, templet: '#templetUpdateTime' },
 				{ field: 'UpdateUserName', title: '鍏冲崟浜�', align: 'center', width: 165 },
 
-				{ field: 'caozuo', title: '鎿嶄綔', fixed: 'right', width: 180, align: 'center', toolbar: '#InspectionRequestList', "disabled": true }
+				{ field: 'caozuo', title: '鎿嶄綔', fixed: 'right', width: 270, align: 'center', toolbar: '#InspectionRequestList', "disabled": true }
 			]];
 			var TotalColsSysArr = encodeURIComponent(encodeURIComponent(JSON.stringify(TotalColsArr)))//灏嗚〃澶存暟鎹繘琛寀rl缂栫爜
 			//#endregion
@@ -452,6 +481,8 @@
 			// 娣诲姞鎸夐挳鏉冮檺
 			function setRight() {
 				$(function () {
+					$(".shangClass").hide();
+					$(".chaClass").hide();
 					$(".addClass").hide();
 					$(".editClass").hide();
 					$(".delClass").hide();
@@ -460,6 +491,17 @@
 				sendData(IP + "/Basis/GetRoleRightList", {}, 'get', function (res) {
 					if (res.code == 0) { //鎴愬姛 
 						for (var k = 0; k < res.data.length; k++) {
+
+							if (res.data[k].MenuName == "涓婁紶") {
+								$(function () {
+									$(".shangClass").show();
+								});
+							}
+							if (res.data[k].MenuName == "鏌ョ湅") {
+								$(function () {
+									$(".chaClass").show();
+								});
+							}
 							if (res.data[k].MenuName == "璇烽獙") {
 								$(function () {
 									$(".addClass").show();
@@ -495,22 +537,81 @@
 			table.on('tool(InspectionRequest)', function (obj) {
 				var data = obj.data;
 				switch (obj.event) {
+					case "upImage":
+						layer.open({
+							type: 1,
+							title: '涓婁紶鍥剧墖',
+							content: $('#UploadImageView'),
+							maxmin: true,
+							area: ['350px', '215px'],
+							btn: ['纭畾'],
+							success: function (index, layero) {
+								upload.render({
+									elem: '#uploadBtn',
+									url: IP + '/BllQuality/UploadImage',
+									accept: 'images',
+									exts: 'jpg|png|gif',
+									multiple: false,
+									size: 1024 * 5, // 5MB
+									auto: false,
+									bindAction: '#upload',
+									headers: { ToKen: $.cookie('token') },
+									xhrFields: {
+										withCredentials: true // 鎼哄甫cookie
+									},
+									before: function () {
+										this.data = {
+											qualityId: data.Id
+										};
+										layer.load(1, { shade: [0.5, '#000'] });
+									},
+									done: function (res) {
+										layer.closeAll('loading');
+										if (res.code == 0) {
+											layer.msg('涓婁紶鎴愬姛', { icon: 1 });
+											// 涓婁紶鎴愬姛鍚庣殑鍥炶皟锛屽鍒锋柊琛ㄦ牸绛�
+											// table.reload('LAY-app-content-list');
+										} else {
+											layer.msg(res.msg || '涓婁紶澶辫触', { icon: 2 });
+										}
+									},
+									error: function () {
+										layer.closeAll('loading');
+										layer.msg('涓婁紶澶辫触', { icon: 2 });
+									}
+								});
+							}
+						});
+						break;
+					case "ViewImage":
+						layer.open({
+							type: 1,
+							title: '鏌ョ湅鍥剧墖',
+							content: $('#ImagesShowView'),
+							maxmin: true,
+							area: ['650px', '315px'],
+							btn: ['纭畾'],
+							success: function (index, layero) {
+								getImage(data.Id);
+							}
+						});
+						break;
 					case "add":
 						layer.confirm('纭畾瑕佸彂璧疯楠岋紵', function (index) {
 							var param = {
 								Id: data.id,
 								Code: data.QcNo,
 							};
-							sendData(IP + "/BllQuality/SendInspectionRequest", param, 'post', function (res) {
-								if (res.code == 0) { //鎴愬姛
-									layer.msg(res.msg, {
+							sendData(IP + "/UpApi/SendInspectionRequest", param, 'post', function (res) {
+								if (res.Success == "0") { //鎴愬姛
+									layer.msg(res.Message, {
 										icon: 1,
 										time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
 									}, function () {
 										bindInspectionRequest();
 									});
 								} else { //涓嶆垚鍔�
-									layer.msg(res.msg, {
+									layer.msg(res.Message, {
 										icon: 2,
 										time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
 									});
@@ -627,6 +728,55 @@
 				}
 			});
 
+			function getImage(id) {
+				var param = {
+					Id: id
+				}
+				sendData(IP + "/BllQuality/GetImage", param, 'post', function (res) {
+					if (res.code == 0) { //鎴愬姛
+						$("#ImagesShow").html('');
+						res.data.forEach(function (item) {
+							$("#ImagesShow").append('<div>' +
+								'<a href=' + item + ' target="_blank" class="image-item"><img src="' + item + '"  /></a>' +
+								'<button class="layui-btn layui-btn-primary layui-btn-sm delete-btn" data-type="customCols" data_Url=' + item + ' >鍒犻櫎</button>' +
+								'</div>');
+						})
+						$('.delete-btn').on('click', function () {
+							var item = $(this);
+							var QualityId = id;
+							var imageUrl = item.attr('data_Url');
+							layer.confirm('纭畾鍒犻櫎鍚楋紵', function (index) {
+								var param = {
+									QualityId: QualityId,
+									ImageUrl: imageUrl
+								}
+								sendData(IP + "/BllQuality/DeleteImage", param, 'post', function (res) {
+									if (res.code == 0) { //鎴愬姛
+										layer.msg(res.msg, {
+											icon: 1,
+											time: 1000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+										}, function () {
+											getImage(id);
+										});
+									} else {
+										layer.msg(res.msg, {
+											icon: 2,
+											time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+										});
+									}
+								});
+							})
+						});
+					} else { //涓嶆垚鍔�
+						$("#ImagesShow").html('');
+						res.msg, {
+							icon: 2,
+							time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+						}
+					}
+				})
+			}
+
 			// 鍙栨牱鏄庣粏鍗曟満浜嬩欢
 			table.on('tool(SamplingDetails)', function (obj) {
 				var data = obj.data;

--
Gitblit v1.8.0