王 垚
2022-06-30 dbe5254dccd9afc24b51ee442dd9f82c89410dff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
 
 
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>送货单列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
</head>
<body>
 
    <div class="layui-card layadmin-header">
        <div class="layui-breadcrumb" lay-filter="breadcrumb">
            <a lay-href="">主页</a>
            <a><cite>组件</cite></a>
            <a><cite>送货单表格</cite></a>
            <a><cite>送货单表格的重载</cite></a>
        </div>
    </div>
 
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-header">送货单列表</div>
                    <div class="layui-card-body">
                        <div class="test-table-reload-btn" style="margin-bottom: 10px;">
                            单据号:
                            <div class="layui-inline">
                                <input class="layui-input" name="HBillNo" id="HBillNo" autocomplete="off">
                            </div>
                            <button class="layui-btn" data-type="f_Query">查询</button>
                            <button class="layui-btn" data-type="f_SHD">打印送货单</button>
                            <button class="layui-btn" data-type="f_HBarCode">生成条码</button>
                            <!--<button class="layui-btn" data-type="f_Jumppage">生成送货单</button>-->
                        </div>
                        <table class="layui-hide" id="test-table-reload" lay-filter="user"></table>
                        <blockquote class="layui-elem-quote">送货单列表</blockquote>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--<script src="../../layuiadmin/layui/lay/modules/mobile/jquery-3.3.1.min.js"></script>-->
    <script src="../../layuiadmin/layui/layui.js"></script>
    <script src="../CreateControl.js"></script>
    <script src="../GRInstall.js"></script>
    <script src="../GRUtility.js"></script>
    <script>
        CreateReport("Report"); //打印
        Report.LoadFromURL("送货单(A4纸).grf");//打印
        layui.config({
            base: '../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'table'], function () {
            var $ = layui.$;
            var table = layui.table;
            var layer = layui.layer;
            RoadHBillNo("and 1=1");
            layer.load(3)
            //方法级渲染
            table.render({
                elem: '#test-table-reload'
                , dateType: 'json'
                , colFilterRecord: true//是否开启字段筛选的记忆功能
                , data: []
            //  , url: 'http://localhost:8083/Web/GetPOInStockBillList'
              , toolbar: '#toolbarDemo'
            //  , where: { msg: "", NowPage: 1, OnePage: 10 }
                // , where: { sqlWhere: "178070" }
              , cols: [[
                { checkbox: true, fixed: true }
                , { field: '单据号', title: '单据号', width: 200, sort: true, fixed: true, edit: 'text'}
                , { field: '物料代码', title: '物料代码', width: 200, edit: 'text' }
                , { field: '物料名称', title: '物料名称', width: 200, edit: 'text' }
                , { field: '规格型号', title: '规格型号', width: 200, edit: 'text' }
                , { field: '计量单位', title: '计量单位', width: 100, edit: 'text' }
                , { field: '订货数量', title: '订货数量', width: 100, edit: 'text' }
                , { field: '合格数量', title: '合格数量', width: 100, edit: 'text' }
                , { field: '不合格数量', title: '不合格数量', width: 100, edit: 'text' }
                , { field: '日期', title: '日期', width: 150, edit: 'text' }
              ]]
              , page: true
              , height: 500
               , done: function () {
                   layer.closeAll("loading");
               }
            });
            ///加载显示数据
            function RoadHBillNo(sqlWhere) {
                where = sqlWhere;
                $.ajax({
                    type: "get",
                    url: "http://localhost:8083/Web/GetPOInStockBillList",
                    async: true,
                    data: { "HSupNo": sessionStorage["HUserName"], "sqlWhere": sqlWhere },
                    success: function (result) {
                        ajaxReturnData = JSON.parse(JSON.stringify(result)).data;
                        table.reload('test-table-reload', {
                            data: ajaxReturnData
                            , height: 'full-10'
                            , loading: false
                            , done: function (index, res) {
 
                            }
                        });
                    },
                    error: function (result) {
                        console.log(result);
                        //layer.msg('获取采购订单出现异常', { icon: 2, time: 2000 });
                    }
                });
            };
            //定义事件集合
            var $ = layui.$, active = {
                reload: function () {
                    var demoReload = $('#test-table-demoReload');
                    //执行重载
                    table.reload('test-table-reload', {
                        page: {
                            curr: 1 //重新从第 1 页开始
                        }
                      , where: {
                          key: {
                              id: demoReload.val()
                          }
                      }
                    });
                },
                //快速查询
                f_Query: function () { //查询
                    var sqlWhere = " and 1=1 ";
                    if ($("#HBillNo").val() != "")
                        sqlWhere += " and 单据号 like ''%" + $("#HBillNo").val() + "%''";
                    RoadHBillNo(sqlWhere);
                },
                f_SHD: function () {
                    var checkStatus = table.checkStatus('test-table-reload')
                    , data = checkStatus.data;
                    window.open("../../views/WarM/HBarPlanPrint.html?linterid=" + data[0].hmainid + "&Type=HPOInStockBill");
                   // CreateDisplayViewerEx("100%", "100%", "../../views/grf/送货单(A4纸).grf", "../../views/WarM/xmlK3_POInStockBill.aspx?linterid=" + data[0].hmainid, true, "");
                   // AjaxReportRun(Report, "../../views/WarM/xmlK3_POInStockBill.aspx?linterid=" + data[0].hmainid, Report.PrintPreview(true));
                },
                f_HBarCode: function () {//生成条码
                    var checkStatus = table.checkStatus('test-table-reload')
                   , data = checkStatus.data;
                    layer.open({
                        type: 2
                         , area: ['100%', '100%']
                         , title: '送货单'
                         , shade: 0.6 //遮罩透明度
                         , maxmin: false //允许全屏最小化
                         , anim: 0 //0-6的动画形式,-1不开启
                         , content: ['../../views/WarM/Web_BarCodeBill.html?linterid=' + data[0].hmainid + '&lentryid=' + data[0].hmainid, 'yes']
                        // , content: ['../../views/WarM/KF_POInStockBill.html?linterid=' + JSON.stringify(data), 'yes']
                        // , content: ['../../views/WarM/KF_POInStockBill.html?linterid=' + rows, 'yes']
                         , resize: false
                         , cancel: function () {
                             $(".layui-btn").removeClass("layui-btn-disabled");
                         }
                    })
                }
            };
            $('.test-table-reload-btn .layui-btn').on('click', function () {
                var type = $(this).data('type');
                active[type] ? active[type].call(this) : '';
            });
        });
    </script>
</body>
</html>