From 7f55a1f12d5c4e00d95668a31a542ca848850ea2 Mon Sep 17 00:00:00 2001
From: 王 垚 <1402714037@qq.com>
Date: 星期五, 16 十二月 2022 09:13:23 +0800
Subject: [PATCH] 111

---
 WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_POOrderBillList.html |  184 ++++++++++++++++++++++++++--------------------
 1 files changed, 104 insertions(+), 80 deletions(-)

diff --git a/WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_POOrderBillList.html b/WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_POOrderBillList.html
index eb4179b..c77ed01 100644
--- a/WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_POOrderBillList.html
+++ b/WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_POOrderBillList.html
@@ -150,7 +150,7 @@
                             <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-back" id="btn_back"><i class="layui-icon layui-icon-close-fill"></i>椹冲洖</button>
                             <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-report" id="btn_report"><i class="layui-icon layui-icon-close-fill"></i>姹囨姤</button>
                             <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-details"><i class="layui-icon layui-icon-form"></i>璇︽儏</button>
-                            <!--<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-barcode"><i class="layui-icon layui-icon-file"></i>鐢熸垚鏉$爜</button>-->
+                            <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-barcode"><i class="layui-icon layui-icon-file"></i>鐢熸垚鏉$爜</button>
                             <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-generate"><i class="layui-icon layui-icon-file"></i>鐢熸垚閫佽揣鍗�</button>
                             <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-exit"><i class="layui-icon layui-icon-return"></i>閫�鍑�</button>
                             <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-HideColumn"><i class="layui-icon layui-icon-return"></i>闅愯棌鍒楄缃�</button>
@@ -164,7 +164,7 @@
     <script src="../../../../Scripts/webConfig.js"></script>
     <script>
         var _cur_page = 1;
-        var sql = " and 1=1";
+        var sql = "";
         var options = document.getElementById('HStatus').children;
         function getUrlVars() {
             var vars = [], hash;
@@ -217,6 +217,8 @@
             laydate.render({
                 elem: '#HDate2'
             });
+            //涓嶉渶瑕佹樉绀虹殑瀛楁 鍙墿灞�
+            var titleData = ["HItemID", "HParentID"];
             var option = [];
             var HModName = "SRM_POOrderBillList";
             //#region 杩涘叆椤甸潰鏃㈠姞杞�
@@ -228,9 +230,9 @@
                 $("#HPURCHASEORGID").append(Organization);
                 form.render('select');
                 //鍒濆鍖栬〃鏍�
-                set_InitGrid();
+                //set_InitGrid();
                 //鏄剧ず鍒楁暟鎹�
-                DisPlay_HideColumn();
+                //DisPlay_HideColumn();
                 //鐩存帴鎵ц鍒楄〃绛涢�� 鍔犺浇鏁版嵁鍒扮綉鏍�
                 get_FastQuery(table, option)
             }
@@ -244,28 +246,28 @@
                     , { field: 'hmainid', title: 'hmainid', sort: true, /*fixed: true,*/ hide: true }
                     , { field: 'hsubid', title: 'hsubid', sort: true, /*fixed: true,*/ hide: true }
                     , { field: '鐘舵��', title: '鐘舵��', sort: true/*, fixed: true */ }
-                    //, { field: '鍙嶉鐘舵��', title: '鍙嶉鐘舵��', width: 100/*, fixed: true */}
+                    , { field: '鍙嶉鐘舵��', title: '鍙嶉鐘舵��', width: 100/*, fixed: true */}
                     //, { field: '浼樺厛绾�', title: '浼樺厛绾�', width: 100/*, fixed: true */}
                     , { field: '鍗曟嵁鍙�', title: '鍗曟嵁鍙�', width: 150, sort: true/*, fixed: 'left' */ }
+                    , { field: '璁″垝璺熻釜鍗曞彿', title: '璁″垝璺熻釜鍗曞彿', sort: true, hide: true }
+                    , { field: '鑷畾涔夋爣璇�', title: '鑷畾涔夋爣璇�', width: 120 }
+                    , { field: '閫佽揣鍦扮偣', title: '閫佽揣鍦扮偣', width: 120 }
+                    , { field: '鍖呰鏍囪瘑', title: '鍖呰鏍囪瘑', width: 120 }
+                    , { field: '鍞竴ID', title: '鍞竴ID', width: 120 }
+                    //, { field: '鐗╂枡缂栫爜', title: '鐗╂枡缂栫爜', width: 120, sort: true }
+                    , { field: '鐗╂枡浠g爜', title: '鐗╂枡缂栫爜', width: 120, sort: true }
+                    , { field: '鐗╂枡鍚嶇О', title: '鐗╂枡鍚嶇О', width: 120, sort: true }
+                    , { field: '璁¢噺鍗曚綅', title: '璁¢噺鍗曚綅', width: 80, sort: true }
+                    , { field: '鏁伴噺', title: '璁㈠崟鏁伴噺', sort: true }
+                    , { field: '鎵撳嵃鏉$爜鏁伴噺', title: '鎵撳嵃鏉$爜鏁伴噺', sort: true }
+                    , { field: '宸插彂璐ф暟閲�', title: '宸插彂璐ф暟閲�', sort: true }
+                    , { field: '鏈彂璐ф暟閲�', title: '鏈彂璐ф暟閲�', sort: true }
+                    , { field: '浜よ揣鍦扮偣', title: '浜よ揣鍦扮偣', sort: true }
+                    , { field: '浜よ揣鏃ユ湡', title: '浜よ揣鏃ユ湡', width: 180, sort: true }
                     , { field: '鏃ユ湡', title: '鏃ユ湡', width: 120, sort: true/*, fixed: 'left' */ }
                     , { field: 'HSupID', title: 'HSupID', width: 180, hide: true }
                     , { field: '渚涘簲鍟�', title: '渚涘簲鍟�', width: 180, sort: true/*, fixed: 'left' */ }
-                    , { field: '璁″垝璺熻釜鍗曞彿', title: '璁″垝璺熻釜鍗曞彿', sort: true, hide: true }
-                    , { field: 'F_xbkf_Combo', title: '鑷畾涔夋爣璇�', width: 120 }
-                    , { field: 'FSHDD', title: '閫佽揣鍦扮偣', width: 120 }
-                    , { field: 'FStockInQty', title: '绱鍏ュ簱鏁伴噺', width: 120 }
-                    , { field: '鍖呰鏍囪瘑', title: '鍖呰鏍囪瘑', width: 120 }
-                    , { field: 'FMRBQTY', title: '绱閫�鏂欐暟閲�', width: 120 }
-                    //, { field: '鐗╂枡缂栫爜', title: '鐗╂枡缂栫爜', width: 120, sort: true }
-                    , { field: '鐗╂枡浠g爜', title: '鐗╂枡浠g爜', width: 120, sort: true }
-                    , { field: '鐗╂枡鍚嶇О', title: '鐗╂枡鍚嶇О', width: 120, sort: true }
                     , { field: '瑙勬牸鍨嬪彿', title: '瑙勬牸鍨嬪彿', width: 120, sort: true }
-                    , { field: '璁¢噺鍗曚綅', title: '璁¢噺鍗曚綅', width: 80, sort: true }
-                    , { field: '鏁伴噺', title: '璁㈣揣鏁伴噺', sort: true }
-                    , { field: '浜よ揣鍦扮偣', title: '浜よ揣鍦扮偣', sort: true }
-                    , { field: '浜よ揣鏃ユ湡', title: '浜よ揣鏃ユ湡', width: 180, sort: true }
-                    , { field: '鍏宠仈鏁伴噺', title: '鍏宠仈鏁伴噺', sort: true }
-                    , { field: '鏈叧鑱旀暟閲�', title: '鏈叧鑱旀暟閲�', sort: true }
                     , { field: '鍓╀綑鍏ュ簱鏁伴噺', title: '鍓╀綑鍏ュ簱鏁伴噺', sort: true }
                     , { field: '鍓╀綑鏀舵枡鏁伴噺', title: '鍓╀綑鏀舵枡鏁伴噺', sort: true }
                     , { field: '鍏抽棴鐘舵��', title: '鍏抽棴鐘舵��', sort: true }
@@ -286,22 +288,12 @@
                     , totalRow: true
                     , limit: 500
                     , height: 'full-50'
-                    , cols: [columns]
+                    //, cols: [columns]
                     , limits: [500, 5000, 20000]
                     , done: function (res, curr, count) {
 
                     }
                 };
-                ////璁剧疆鍒楀
-                //var colWidth = getColumnsWidth();
-                //if (colWidth == "" || colWidth == []) {
-
-                //}
-                //else {
-                //    $.each(columns, function (x, m) {
-                //        m["width"] = colWidth[x];
-                //    });
-                //}
             }
             //闅愯棌鍒楄缃�
             function get_HideColumn() {
@@ -338,16 +330,18 @@
                     success: function (data1) {
                         if (data1.data.length != 0) {
                             var dataCol = [];//鏁版嵁搴撴煡璇㈠嚭鐨勫垪鏁版嵁
-                            var titleData = [];//涓嶉渶瑕佹樉绀虹殑瀛楁 鍙墿灞�
-
                             dataCol = data1.data[0].HGridString.split(',');
-
-                            for (var i = 0; i < option.cols[0].length - 2; i++) {
+                            for (var i = 0; i < dataCol.length; i++) {
                                 var dataCols = dataCol[i].split('|');
                                 //闅愯棌鍒�
                                 if (dataCols[1] == 1) {
                                     option.cols[0][i + 1]["hide"] = true;
                                 }
+                                //鏄剧ず鍒�
+                                if (dataCols[1] == 0 && $.inArray(option.cols[0][i + 1]["title"], titleData) == -1) {
+                                    option.cols[0][i + 1]["hide"] = false;
+                                }
+                                //闅愯棌id
                                 //璁剧疆鍒楀
                                 if (dataCols[3] > 0) {
                                     option.cols[0][i + 1]["width"] = dataCols[3];
@@ -364,10 +358,7 @@
                                 //} else {
                                 //    option.cols[0][i + 1]["width"] = "";
                                 //}
-                                //鏄剧ず鍒�
-                                if (dataCols[1] == 0 && $.inArray(option.cols[0][i + 1]["title"], titleData) == -1) {
-                                    option.cols[0][i + 1]["hide"] = false;
-                                }
+                                 
                                 //瀛椾綋鎵�鍦ㄤ綅缃�(宸� 灞呬腑 鍙�)
                                 switch (dataCols[2]) {
                                     case "L":
@@ -381,7 +372,6 @@
                                         break;
                                 }
                             }
-
                             //鍙栨秷鍐荤粨鍒�
                             for (var i = 1; i < option.cols[0].length - 1; i++) {
                                 if (option.cols[0][i]["fixed"] != null) {
@@ -413,18 +403,59 @@
             function get_Display(sqlWhere) {
                 var wait = layer.load();//閬僵
                 $.ajax({
-                    type: "get",
+                    type: "POST",
                     url: GetWEBURL() + "GetPOOrderBill",
                     async: true,
                     data: { "HSupNo": sessionStorage["HUserName"], "sqlWhere": sqlWhere },
-                    success: function (result) {
-                        if (result.Message == "鑾峰彇鎴愬姛") {
-                            option.data = result.data;
-                            table.render(option);
+                    success: function (data1) {
+                        if (data1.Message == "鑾峰彇鎴愬姛") {
+                        var data = [];
+                        var col = [];
+                        //缁欑┖鐨勬暟缁勮祴鍊�
+                        for (var key in data1.list) {
+                            data.push({ "id": data1.list[key].ColmCols, "name": data1.list[key].ColmCols, "Type": data1.list[key].ColmType });
+                        }
+                        //鍦ㄥ垪琛ㄥ乏杈规坊鍔犲嬀閫夋
+                        col.push({ type: 'checkbox', fixed: 'left' });
+                        for (var i = 0; i < data.length; i++) {
+                            // if (data[i].name == 'HInterID' || data[i].name == 'HBillType' || data[i].name == 'hmainid') {
+                            if ($.inArray(data[i].name, titleData) > -1) {
+                                col.push({ field: data[i].id, title: data[i].name, align: 'center', hide: true }); //闅愯棌id鍒�
+                            }
+                            else if (data[i].name.indexOf('id') > -1)
+                            {
+                                col.push({ field: data[i].id, title: data[i].name, align: 'center', hide: true }); //id鍒�
+                            }
+                            else {
+                                switch (data[i].Type) {
+                                    //int
+                                    case 'DateTime':
+                                        col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, templet: "<div>{{d." + data[i].name + " ==null ?'':layui.util.toDateString(d." + data[i].name + ", 'yyyy-MM-dd')}}</div>", width: 200 });
+                                        break;
+                                    default:
+                                        col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 200 });
+                                }
+                            }
+                        }
+                        //鍔ㄦ�佹樉绀哄垪鍚�
+                        option = {
+                            elem: '#mainTable'
+                            , toolbar: '#toolbarDemo'
+                            , cols: [col]
+                            , data: data1.data
+                            , height: 'full-80'
+                            , page: true
+                            , cellMinWidth: 90
+                            , limit: 50
+                            , limits: [50, 500, 5000, 20000]
+                        }
+                        table.render(option);
+                        //鍒锋柊琛ㄦ牸鏁版嵁
+                        DisPlay_HideColumn();
                             layer.close(wait);
                         } else {
                             layer.close(wait);
-                            layer.alert(result.Message, { icon: 5 });
+                            layer.alert(data1.Message, { icon: 5 });
                         }
                     },
                     error: function (result) {
@@ -439,7 +470,7 @@
             });
             //鏌ヨ鏉′欢
             function get_FastQuery(table, option) {
-                var sqlWhere = " and 1=1 ";
+                var sqlWhere = "";
                 if ($("#HStatus").val() != "")
                     sqlWhere += " and 鐘舵�� like ^^%" + $("#HStatus").val() + "%^^";
                 if ($("#HBillNo").val() != "")
@@ -525,32 +556,26 @@
                         var checkStatus = table.checkStatus('mainTable')
                             , data = checkStatus.data;
                         _cur_page = $(".layui-laypage-em").next().html();
-                        if (data[0]["鐘舵��"] == "鏈‘璁�") {
-                            layer.confirm('鏄惁纭鍗曟嵁?', { icon: 3, title: '鎻愮ず' }, function (index) {
-                                $.ajax({
-                                    type: "get",
-                                    url: GetWEBURL() + "POOrderAccept",
-                                    data: { "HInterID": data[0]["hmainid"].toString(), "HBillNo": data[0]["鍗曟嵁鍙�"].toString(), "HUser": sessionStorage["HUserName"] },
-                                    success: function (result) {
-                                        if (result.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
-                                            layer.msg(result.Message, { icon: 1 });
-                                            RoadHBillNo(sql);
-                                        }
-                                        else {
-                                            // $("#verifycode").click();
-                                            layer.msg(result.Message, { icon: 5 });
-                                        }
-                                        layer.closeAll("loading");
+                        layer.confirm('鏄惁纭鍗曟嵁?', { icon: 3, title: '鎻愮ず' }, function (index) {
+                            $.ajax({
+                                type: "get",
+                                url: GetWEBURL() + "POOrderAccept",
+                                data: { "HInterID": data[0]["hmainid"].toString(), "HBillNo": data[0]["鍗曟嵁鍙�"].toString(), "HUser": sessionStorage["HUserName"] },
+                                success: function (result) {
+                                    if (result.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                                        layer.msg(result.Message, { icon: 1 });
+                                        get_FastQuery(table, option);
                                     }
-                                })
+                                    else {
+                                        // $("#verifycode").click();
+                                        layer.msg(result.Message, { icon: 5 });
+                                    }
+                                    layer.closeAll("loading");
+                                }
+                            })
+                            layer.close(index);
+                        });
 
-                                layer.close(index);
-                            });
-
-                        }
-                        else {
-                            layer.msg("蹇呴』鏄湭纭鍗曟嵁鎵嶈兘杩涜纭鎿嶄綔锛�", { icon: 5 });
-                        }
                         break;
                     case 'btn-back':
                         var checkStatus = table.checkStatus('mainTable')
@@ -573,7 +598,6 @@
                                     success: function (result) {
                                         if (result.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
                                             layer.msg("鎷掔粷鎴愬姛锛�", { icon: 1 });
-                                            RoadHBillNo(sql);
                                         }
                                         else {
                                             // $("#verifycode").click();
@@ -641,9 +665,10 @@
                             success: function (data) {
                                 if (data.code == "0") {
                                     layer.alert(data.Message, { icon: 5 });
+                                    get_FastQuery(table, option);
                                     hasPrivileage = false;
                                     table.reload('mainTable', {
-                                       height: 'full-10'
+                                        height: 'full-10'
                                         , page: {
                                             curr: _cur_page //蹇呴』浠庣 1 椤靛紑濮�
                                         }
@@ -686,19 +711,18 @@
                                 , anim: 0 //0-6鐨勫姩鐢诲舰寮忥紝-1涓嶅紑鍚�
                                 , content: ['../../views/SRM/SRM_POInStockBill_Edit.html?linterid=' + data[0].hmainid.toString() + '&lentryid=' + rows.toString() + '&lSourceBillType=1102', 'yes']
                                 , resize: false
-                                //, cancel: function () {
-                                //    $(".layui-btn").removeClass("layui-btn-disabled");
-                                //}
+                                ,end: function () {
+                                    get_FastQuery(table, option)
+                                }
                             })
                         }
                         break;
-
                     case 'btn-barcode':
                         var checkStatus = table.checkStatus('mainTable')
                             , data = checkStatus.data;
-                        //if (data[0].鏈敓鎴愭潯鐮佹暟閲� <= 0) {
-                        //    layer.msg("閫変腑琛屽凡鐢熸垚鏉$爜锛�", { icon: 5 });
-                        //}
+                        if (data.length == 0) {
+                            return layer.msg('璇烽�夋嫨鏁版嵁')
+                        }
                         layer.open({
                             type: 2
                             , area: ['100%', '100%']

--
Gitblit v1.9.1