From acadfc413aeea932667c60ccfdf8866d994ddd2b Mon Sep 17 00:00:00 2001
From: zgq <519541279@qq.com>
Date: 星期四, 05 八月 2021 10:54:07 +0800
Subject: [PATCH] 1

---
 WebTM/views/生产管理/生产汇报单/Sc_Add_ICMOReportBillList.html |  210 +++++++++++++++++++++++++++++++++++++++++++++++----
 WebTM/views/生产管理/生产汇报单/Sc_ICMOReportBillList.html     |    2 
 2 files changed, 192 insertions(+), 20 deletions(-)

diff --git "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\346\261\207\346\212\245\345\215\225/Sc_Add_ICMOReportBillList.html" "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\346\261\207\346\212\245\345\215\225/Sc_Add_ICMOReportBillList.html"
index 4d2df40..dd119c4 100644
--- "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\346\261\207\346\212\245\345\215\225/Sc_Add_ICMOReportBillList.html"
+++ "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\346\261\207\346\212\245\345\215\225/Sc_Add_ICMOReportBillList.html"
@@ -47,6 +47,7 @@
                         <ul class="layui-tab-title" lay-filter="tab-all">
                             <li lay-id="1" style="padding:1px;" class="layui-this">鍩烘湰淇℃伅</li>
                             <li lay-id="2" style="padding:1px;">鍒跺崟淇℃伅</li>
+                            <li lay-id="3" style="padding:1px;">闄勪欢淇℃伅</li>
                         </ul>
                         <div class="layui-tab-content">
                             <!--鍩烘湰淇℃伅-->
@@ -203,6 +204,28 @@
                                     </div>
                                 </div>
                             </div>
+                            <!--闄勪欢淇℃伅-->
+                            <div class="layui-tab-item">
+                                <div class="layui-form-item">
+                                    <div class="layui-upload">
+                                        <button type="button" class="layui-btn" id="testList">閫夋嫨鏂囦欢</button><input class="layui-upload-file" type="file" accept="" name="file" multiple="">
+                                        <div class="layui-upload-list">
+                                            <table class="layui-table">
+                                                <thead>
+                                                    <tr>
+                                                        <th>鏂囦欢鍚�</th>
+                                                        <th>澶у皬</th>
+                                                        <th>鐘舵��</th>
+                                                        <th>鎿嶄綔</th>
+                                                    </tr>
+                                                </thead>
+                                                <tbody id="ProImgByList">
+                                                </tbody>
+                                            </table>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
                         </div>
                     </div>
                     <table class="layui-hide" id="mainTable" lay-filter="mainTable"></table>
@@ -215,6 +238,8 @@
                     <script type="text/html" id="xuhao">
                         {{d.LAY_TABLE_INDEX+1}}
                     </script>
+                    <!--闅愯棌瀛楁-->
+                    <input type="hidden" name="HInnerBillNo" id="HInnerBillNo" value="">
                 </form>
             </div>
         </div>
@@ -229,7 +254,7 @@
             base: '../../../layuiadmin/' //闈欐�佽祫婧愭墍鍦ㄨ矾寰�
         }).extend({
             index: 'lib/index' //涓诲叆鍙fā鍧�
-        }).use(['index', 'form', 'laydate', 'table', 'element'], function () {
+        }).use(['index', 'form', 'laydate', 'table', 'element', 'upload'], function () {
             
         //#region 鍏敤鍙橀噺
             var $ = layui.$
@@ -237,6 +262,7 @@
                 , layer = layui.layer
                 , table = layui.table
                 , form = layui.form
+                , upload = layui.upload
                 , laydate = layui.laydate
                 , element = layui.element;
             var option;
@@ -282,6 +308,7 @@
             }
             else if (OperationType == 3) {//缂栬緫
                 set_EditFromGrid();
+                get_file();
             }
             else {
                 layer.alert("鏈煡鎿嶄綔绫诲瀷锛�", { icon: 5 });
@@ -807,8 +834,10 @@
                         //console.log(d.data);
                         $("#HBillNo").val(d.data[0].HBillNo);
                         $("#HInterID").val(0);
+                        $("#HDate").val(Pub_Format(new Date(), "yyyy-MM-dd"));
                         $("#HMakeDate").val(Pub_Format(new Date(), "yyyy-MM-dd"));
                         $("#HMaker").val(sessionStorage["HUserName"]);
+                        PicUpload();
                     }
                 });
             }
@@ -859,23 +888,22 @@
                     success: function (result) {
                         if (result.code == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
                             var data = result.data.h_v_IF_ICMOReportBillList_Edit[0];
-                            console.info(data);
-                            form.val("component-form-group", { //formTest 鍗� class="layui-form" 鎵�鍦ㄥ厓绱犲睘鎬� lay-filter="" 瀵瑰簲鐨勫��
-                                "HBillNo": data.鍗曟嵁鍙�
-                                , "HDate": formatDate(data.鏃ユ湡)
-                                , "HInnerBillNo": data.鍐呴儴鍗曟嵁鍙�
-                                , "HDeptID": data.HDeptID                //鐢熶骇杞﹂棿ID
-                                , "HDeptName": data.閮ㄩ棬                 //鐢熶骇杞﹂棿鍚嶇О
-                                , "HGroupID": data.HGroupID              //鐝粍ID
-                                , "HGroupName": data.鐝粍                //鐝粍鍚嶇О
-                                , "HEmpID": data.HEmpID                  //缁熻鍛業D
-                                , "HEmpName": data.缁熻鍛�                //缁熻鍛樺悕绉�
-                                , "HMainSourceBillNo": data.HMainSourceBillNo
-                                , "HMainSourceInterID": data.HMainSourceInterID
-                                , "HMainSourceEntryID": data.HMainSourceEntryID
-                                , "HExplanation": ""                      //鎽樿
-                                , "HRemark": data.琛ㄥご澶囨敞                //澶囨敞
-                            });
+                            //console.info(data);
+                            $("#HBillNo").val(data.鍗曟嵁鍙�);
+                            $("#HDate").val(formatDate(data.鏃ユ湡));
+                            $("#HInnerBillNo").val(data.鍐呴儴鍗曟嵁鍙�);
+                            $("#HDeptID").val(data.HDeptID);
+                            $("#HDeptName").val(data.閮ㄩ棬);
+                            $("#HGroupID").val(data.HGroupID);
+                            $("#HGroupName").val(data.鐝粍);
+                            $("#HEmpID").val(data.HEmpID);
+                            $("#HEmpName").val(data.缁熻鍛�);
+                            $("#HMainSourceBillNo").val(data.HMainSourceBillNo);
+                            $("#HMainSourceInterID").val(data.HMainSourceInterID);
+                            $("#HMainSourceEntryID").val(data.HMainSourceEntryID);
+                            $("#HExplanation").val("");
+                            $("#HRemark").val(data.琛ㄥご澶囨敞);
+                            PicUpload();
                         } else {
                             layer.alert(result.msg, { icon: 5, btn: ['閫�鍑�'], time: 100000, offset: 't' });
                         }
@@ -898,7 +926,6 @@
                         if (result.count == 1) {
                             option.data = result.data;
                             table.render(option);
-
                         } else {
                             layer.alert(result.code + result.Message, { icon: 5 });
                         }
@@ -1077,6 +1104,151 @@
             }
             //#endregion
 
+            //#region 鏂囦欢涓婁紶
+            function PicUpload() {
+                //澶氬浘鐗囦笂浼�
+                //澶氭枃浠跺垪琛ㄧず渚�
+                var ProImgByList = $('#ProImgByList')
+                    , uploadListIns = upload.render({
+                        elem: '#testList'
+                        , url: GetWEBURL() + "/Cj_StationOutBill/UploadFile1"
+                        , accept: 'file'
+                        , multiple: true
+                        , auto: false
+                        //, bindAction: '#testListAction' //鎸夋壄缁戝畾
+                        , data: { "HBillNo": $("#HBillNo").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>' + (file.size / 1014).toFixed(1) + 'kb</td>'
+                                    , '<td>绛夊緟涓婁紶</td>'
+                                    , '<td>'
+                                    , '<button class="layui-btn layui-btn-xs demo-reload ">涓婁紶</button>'
+                                    , '<button class="layui-btn layui-btn-xs layui-btn-danger demo-delete">鍒犻櫎</button>'
+                                    , '</td>'
+                                    , '</tr>'].join(''));
+
+                                //鍗曚釜閲嶄紶
+                                tr.find('.demo-reload').on('click', function () {
+                                    obj.upload(index, file);
+                                    return false;
+                                });
+
+                                //鍒犻櫎
+                                tr.find('.demo-delete').on('click', function () {
+                                    delete files[index]; //鍒犻櫎瀵瑰簲鐨勬枃浠�
+                                    tr.remove();
+                                    uploadListIns.config.elem.next()[0].value = ''; //娓呯┖ input file 鍊硷紝浠ュ厤鍒犻櫎鍚庡嚭鐜板悓鍚嶆枃浠朵笉鍙��
+                                });
+
+                                ProImgByList.append(tr);
+                            });
+                        }
+                        , done: function (res, index, upload) {
+                            if (res.code == 1) { //涓婁紶鎴愬姛
+                                var tr = ProImgByList.find('tr#upload-' + index)
+                                    , tds = tr.children();
+                                tds.eq(2).html('<span style="color: #5FB878;">涓婁紶鎴愬姛</span>');
+                                tds.eq(3).html(''); //娓呯┖鎿嶄綔
+                                //tds.eq(3).find('.demo-reload').addClass('layui-hide'); //闅愯棌涓婁紶
+                                return delete this.files[index]; //鍒犻櫎鏂囦欢闃熷垪宸茬粡涓婁紶鎴愬姛鐨勬枃浠�
+                            }
+                            this.error(index, upload);
+                        }
+                        , error: function (index, upload) {
+                            var tr = ProImgByList.find('tr#upload-' + index)
+                                , tds = tr.children();
+                            tds.eq(2).html('<span style="color: #FF5722;">涓婁紶澶辫触[妫�鏌ユ枃浠跺悕鍙婃枃浠舵牸寮廬</span>');
+                            tds.eq(3).find('.demo-reload').removeClass('layui-hide'); //鏄剧ず涓婁紶
+                        }
+                    });
+            }
+            //#endregion
+
+
+            //鑾峰彇缂栬緫鏃�,宸蹭笂浼犵殑鏂囦欢鍒楄〃
+            function get_file() {
+                if (HBillNo != null || HBillNo != undefined) {
+                    var ProImgByList = $('#ProImgByList')
+                    $.ajax({
+                        url: GetWEBURL() + '/Cj_StationOutBill/Filelist',
+                        type: "GET",
+                        data: { "HBillNo": HBillNo },
+                        success: function (data1) {
+                            if (data1.count == 1) {
+                                var index = 0;
+                                for (var i = 0; i < data1.data.length; i++) {
+                                    var tr = $(['<tr id="upload-' + i + '">'
+                                        , '<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>' + (data1.data[i].HFileSize / 1014).toFixed(1) + 'kb</td>'
+                                        , '<td style="color: #5FB878;">涓婁紶鎴愬姛</td>'
+                                        , '<td style="display:none">' + data1.data[i].url + '</td>'
+                                        , '<td>'
+                                        , '<button class="layui-btn layui-btn-xs  demo-dowload" type="button" id="deltefile" onclick="javascript:dowload(this)"><i class="layui-icon layui-icon-download-circle layuiadmin-button-btn"></i>涓嬭浇</button>'
+                                        , '<button class="layui-btn layui-btn-xs layui-btn-danger demo-delete" type="button" id="deltefile" onclick="javascript:toManager(this)"><i class="layui-icon layui-icon-delete layuiadmin-button-btn"></i>鍒犻櫎</button>'
+                                        , '</td>'
+                                        , '</tr>'].join(''));
+
+                                    $('#ProImgByList').append(tr);
+                                }
+                            } else {
+                                layer.alert(data1.code + data1.Message, { icon: 5 });
+                            }
+                        }, error: function () {
+                            layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                        }
+                    });
+                }
+            }
+
+
+            //鍒犻櫎鏂囦欢
+            function toManager(r) {
+                //寰楀埌褰撳墠鎵�鍦ㄨ
+                var rows = r.parentNode.parentNode.rowIndex;
+                //寰楀埌鎵�鍦ㄨ鐨勭涓�鍒楃殑鍐呭:涓婚敭ID
+                var HItemID = $("#ProImgByList tr:eq(" + (rows - 1) + ") td:eq(0)").html();
+                //寰楀埌鎵�鍦ㄨ鐨勭浜屽垪鐨勫唴瀹�:鍗曟嵁鍙�
+                var HSourceBillNo = $("#ProImgByList tr:eq(" + (rows - 1) + ") td:eq(1)").html();
+                //寰楀埌鎵�鍦ㄨ鐨勭涓夊垪鐨勫唴瀹�:鏂囦欢鍚嶇О
+                var HFileName = $("#ProImgByList tr:eq(" + (rows - 1) + ") td:eq(2)").html();
+                layer.confirm("纭瑕佸垹闄ゅ悧锛屽垹闄ゅ悗涓嶈兘鎭㈠", { title: "鍒犻櫎纭" }, function (index) {
+
+                    //鍒犻櫎宸蹭笂浼犳枃浠�
+                    $.ajax({
+                        url: GetWEBURL() + '/Cj_StationOutBill/DeleteFilelist',
+                        type: "GET",
+                        data: { "HItemID": HItemID, "HSourceBillNo": HSourceBillNo, "HFileName": HFileName },
+                        success: function (data1) {
+                            if (data1.count == 1) {
+                                layer.alert(data1.Message, { icon: 1 });
+                                $("#ProImgByList tr").eq((rows - 1)).remove();
+                            }
+                            else {
+                                layer.alert(data1.code + data1.Message, { icon: 5 });
+                            }
+                        }, error: function () {
+                            layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                        }
+                    });
+                })
+            }
+
+            //涓嬭浇鏂囦欢
+            function dowload(r) {
+                //寰楀埌褰撳墠鎵�鍦ㄨ
+                var rows = r.parentNode.parentNode.rowIndex;
+                //寰楀埌鎵�鍦ㄨ鐨勭浜斿垪鐨勫唴瀹�:鏂囦欢鍦板潃
+                var url = $("#ProImgByList tr:eq(" + (rows - 1) + ") td:eq(5)").html();
+                /*window.location.href = url;*/
+                window.open(url)
+            }
+
         //#endregion
 
 
diff --git "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\346\261\207\346\212\245\345\215\225/Sc_ICMOReportBillList.html" "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\346\261\207\346\212\245\345\215\225/Sc_ICMOReportBillList.html"
index 6eeb724..4542bab 100644
--- "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\346\261\207\346\212\245\345\215\225/Sc_ICMOReportBillList.html"
+++ "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\346\261\207\346\212\245\345\215\225/Sc_ICMOReportBillList.html"
@@ -435,7 +435,7 @@
                         , shade: 0.6 //閬僵閫忔槑搴�
                         , maxmin: true //鍏佽鍏ㄥ睆鏈�灏忓寲
                         , anim: 0 //0-6鐨勫姩鐢诲舰寮忥紝-1涓嶅紑鍚�
-                        , content: '../鐢熶骇姹囨姤鍗�/Sc_Add_ICMOReportBillList.html?hID=' + hID + '&Type=3'
+                        , content: '../鐢熶骇姹囨姤鍗�/Sc_Add_ICMOReportBillList.html?OperationType=3&linterid=' + hID + '&HSouceBillType='
                         , resize: false,
                         end: function () {
                             //鍒锋柊椤甸潰,

--
Gitblit v1.9.1