From ed6540aece2d099230ea88768010f61aacc7c19c Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期三, 17 四月 2024 10:18:55 +0800
Subject: [PATCH] 物料上传图片

---
 WebTM/Files/Material/ZY004/R-C.jpg                |    0 
 WebTM/views/基础资料/公用基础资料/Add_Edit_Gy_Material.html |   84 +++++++++++++++---------------------------
 WebTM/views/基础资料/公用基础资料/Gy_Material.html          |    7 ++-
 3 files changed, 35 insertions(+), 56 deletions(-)

diff --git a/WebTM/Files/Material/ZY004/R-C.jpg b/WebTM/Files/Material/ZY004/R-C.jpg
new file mode 100644
index 0000000..12785ac
--- /dev/null
+++ b/WebTM/Files/Material/ZY004/R-C.jpg
Binary files differ
diff --git "a/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/Add_Edit_Gy_Material.html" "b/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/Add_Edit_Gy_Material.html"
index 3ffa5f1..ff9bbef 100644
--- "a/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/Add_Edit_Gy_Material.html"
+++ "b/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/Add_Edit_Gy_Material.html"
@@ -1584,19 +1584,19 @@
                     , uploadListIns = upload.render({
                         elem: '#testList'
 
-                        , url: GetWEBURL() + "/Cj_StationOutBill/UploadFile1"
+                        , url: GetWEBURL() + "/Gy_Mater/UploadFile"
                         , accept: 'file'
                         , multiple: true
                         , auto: false
                         //, bindAction: '#testListAction' //鎸夋壄缁戝畾
-                        , data: { "HBillNo": $("#HNumber").val(), "HRemark": $("#HRemark").val(), "HUserName": sessionStorage["HUserName"] }
+                        , data: { "HNumber": $("#HNumber").val(), "HRemark": $("#HRemark").val(), "HUserName": sessionStorage["HUserName"] }
                         , choose: function (obj) {
                             var files = this.files = obj.pushFile(); //灏嗘瘡娆¢�夋嫨鐨勬枃浠惰拷鍔犲埌鏂囦欢闃熷垪
                             //璇诲彇鏈湴鏂囦欢
                             obj.preview(function (index, file, result) {
                                 var tr = $(['<tr id="upload-' + index + '">'
                                     , '<td>' + file.name + '</td>'
-                                    , '<td>' + '<img id="showImg" class="ImgClass" style="width: 150px; margin:10px;cursor:pointer;"src="' + result + '" alt="' + file.name + '">' + '</td>'
+                                    , '<td>' + '<img onclick=\"previewImg(this)\" id="showImg" class="ImgClass" style="width: 150px; margin:10px;cursor:pointer;"src="' + result + '" alt="' + file.name + '">' + '</td>'
                                     , '<td>' + (file.size / 1014).toFixed(1) + 'kb</td>'
                                     , '<td>绛夊緟涓婁紶</td>'
                                     , '<td>'
@@ -1621,30 +1621,6 @@
 
                                 ProImgByList.append(tr);
 
-                                //鏌愬浘鐗囨斁澶ч瑙�
-                                $(".ImgClass").click(function () {
-                                    var idx = $(".ImgClass").index(this);//鑾峰彇鐐瑰嚮琛屼笅鏍囨樉绀哄搴旂殑鍥剧墖
-
-                                    var width = $("#showImg").width();
-                                    var height = $("#showImg").height();
-                                    var scaleWH = width / height;
-                                    var bigH = 600;
-                                    var bigW = scaleWH * bigH;
-                                    if (bigW > 900) {
-                                        bigW = 900;
-                                        bigH = bigW / scaleWH;
-                                    }
-
-                                    // 鏀惧ぇ棰勮鍥剧墖
-                                    layer.open({
-                                        type: 1,
-                                        title: false,
-                                        closeBtn: 1,
-                                        shadeClose: true,
-                                        area: [bigW + 'px', bigH + 'px'], //瀹介珮
-                                        content: "<img width='" + bigW + "' height='" + bigH + "' src=" + result + " />"
-                                    });
-                                });
                             });
                         }
                         , done: function (res, index, upload) {
@@ -1672,9 +1648,9 @@
             function getFile() {
                 var ProImgByList = $('#ProImgByList')
                 $.ajax({
-                    url: GetWEBURL() + '/Cj_StationOutBill/Filelist',
+                    url: GetWEBURL() + '/Gy_Mater/Filelist',
                     type: "GET",
-                    data: { "HBillNo": $("#HNumber").val() },
+                    data: { "HNumber": $("#HNumber").val() },
                     success: function (data1) {
                         if (data1.count == 1) {
                             var index = 0;
@@ -1683,7 +1659,7 @@
                                     , '<td style="display:none">' + data1.data[i].HItemID + '</td>'
                                     , '<td style="display:none">' + data1.data[i].HSourceBillNo + '</td>'
                                     , '<td>' + data1.data[i].HFileName + '</td>'
-                                    , '<td>' + '<img id="showImg' + i + '" class="ImgClass" style="width: 150px; margin:10px;cursor:pointer;"src="' + data1.data[i].HFilePath + '" alt="' + data1.data[i].HFileName + '">' + '</td>'
+                                    , '<td>' + '<img onclick=\"previewImg(this)\" id="showImg' + i + '" class="ImgClass" style="width: 150px; margin:10px;cursor:pointer;"src="' + data1.data[i].HFilePath + '" alt="' + data1.data[i].HFileName + '">' + '</td>'
                                     , '<td>' + (data1.data[i].HFileSize / 1014).toFixed(1) + 'kb</td>'
                                     , '<td style="color: #5FB878;">涓婁紶鎴愬姛</td>'
                                     , '<td style="display:none">' + data1.data[i].url + '</td>'
@@ -1695,29 +1671,6 @@
 
                                 $('#ProImgByList').append(tr);
                             }
-                            //鏌愬浘鐗囨斁澶ч瑙�
-                            $(".ImgClass").click(function () {
-                                var idx = $(".ImgClass").index(this);//鑾峰彇鐐瑰嚮琛屼笅鏍囨樉绀哄搴旂殑鍥剧墖
-
-                                var width = $("#showImg" + idx).width();
-                                var height = $("#showImg" + idx).height();
-                                var scaleWH = width / height;
-                                var bigH = 600;
-                                var bigW = scaleWH * bigH;
-                                if (bigW > 900) {
-                                    bigW = 900;
-                                    bigH = bigW / scaleWH;
-                                }
-                                // 鏀惧ぇ棰勮鍥剧墖
-                                layer.open({
-                                    type: 1,
-                                    title: false,
-                                    closeBtn: 1,
-                                    shadeClose: true,
-                                    area: [bigW + 'px', bigH + 'px'], //瀹介珮
-                                    content: "<img width='" + bigW + "' height='" + bigH + "' src=" + data1.data[idx].HFilePath + " />"
-                                });
-                            });
 
                         } else {
                             layer.alert(data1.code + data1.Message, { icon: 5 });
@@ -1760,7 +1713,7 @@
 
                 //鍒犻櫎宸蹭笂浼犳枃浠�
                 $.ajax({
-                    url: GetWEBURL() + '/Cj_StationOutBill/DeleteFilelist',
+                    url: GetWEBURL() + '/Gy_Mater/DeleteFilelist',
                     type: "GET",
                     data: { "HItemID": HItemID, "HSourceBillNo": HSourceBillNo, "HFileName": HFileName },
                     success: function (data1) {
@@ -1801,6 +1754,29 @@
                 $("#HSecUnitID").val(obj[0].HItemID);
             }
         }
+
+        function previewImg(obj) {
+            var img = new Image();
+            img.src = obj.src;
+            var height = img.height + 500; //鑾峰彇鍥剧墖楂樺害
+            var width = img.width + 500; //鑾峰彇鍥剧墖瀹藉害
+            var imgHtml = "<img src='" + obj.src + "' width='100%' height='100%'/>";
+            //寮瑰嚭灞�
+            layer.open({
+                type: 1,
+                shade: 0.8,
+                offset: 'auto',
+                area: ['80%', '80%'],
+                shadeClose: true,
+                scrollbar: false,
+                title: "鍥剧墖棰勮", //涓嶆樉绀烘爣棰�  
+                content: imgHtml, //鎹曡幏鐨勫厓绱狅紝娉ㄦ剰锛氭渶濂借鎸囧畾鐨勫厓绱犺瀛樻斁鍦╞ody鏈�澶栧眰锛屽惁鍒欏彲鑳借鍏跺畠鐨勭浉瀵瑰厓绱犳墍褰卞搷  
+                cancel: function () {
+                    //layer.msg('鎹曡幏灏辨槸浠庨〉闈㈠凡缁忓瓨鍦ㄧ殑鍏冪礌涓婏紝鍖呰9layer鐨勭粨鏋�', { time: 5000, icon: 6 });  
+                }
+            });
+        }
+
     </script>
 
 </body>
diff --git "a/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/Gy_Material.html" "b/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/Gy_Material.html"
index d6d1b91..f261a2e 100644
--- "a/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/Gy_Material.html"
+++ "b/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/Gy_Material.html"
@@ -385,7 +385,10 @@
 
                 addSWhereByOpenType();
                 get_Display_Tree();
-
+                //鐗╂枡鍥剧墖浣嶇疆榛樿涓虹┖
+                var html2 = '<h1 style="text-align:center;line-height:290px;color:red;font-weight:bolder;"></h1>';
+                $("#file").append(html2);
+                Carousel.reload({ autoplay: false })
                 //if (openType == 2) {
                 //    addSWhereByOpenType();
                 //    //get_Display(sWhere);
@@ -934,7 +937,7 @@
                 return subStr;
             }
 
-            //#region 缂栬緫鏃�,鑾峰彇宸蹭笂浼犵殑鏂囦欢鍒楄〃
+            //#region 鐐瑰嚮鐗╂枡鏃�,鑾峰彇宸蹭笂浼犵殑鏂囦欢鍒楄〃
             function getFileList_loaded(HMaterNumber) {
                 $("#file").html("");
                 $(".layui-carousel-ind").html("");

--
Gitblit v1.9.1