自动化立体仓库 - WMS系统
lty
7 天以前 539a56279625242c497b4b4093f2defbb9d80334
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
<!DOCTYPE html>
<html lang="en">
<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, maximum-scale=1">
    <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../static/css/admin.css?v=318" media="all">
    <link rel="stylesheet" href="../../static/css/cool.css" media="all">
    <link rel="stylesheet" href="../../static/css/common.css" media="all">
    <style>
        body {
            /*overflow: hidden;*/
        }
        .layui-table-box {
            border-right: 1px solid #9F9F9F;
            border-left: 1px solid #9F9F9F;
        }
    </style>
</head>
<body>
<div style="padding: 25px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;">
    <span style="font-size: large; font-weight: bold" data-i18n="select_item">选择商品</span>
</div>
<div class="layui-card" style="padding: 0 20px; overflow: scroll;">
    <fieldset class="layui-elem-field site-demo-button" style="margin: 20px;">
        <legend data-i18n="search_bar">搜索栏</legend>
        <div id="search-box" class="layui-form layui-card-header">
            <div class="layui-inline">
                <div class="layui-input-inline">
                    <input class="layui-input" type="text" name="matnr" data-i18n-placeholder="product_code" placeholder="商品编号" autocomplete="off">
                </div>
            </div>
            <div class="layui-inline">
                <div class="layui-input-inline">
                    <input class="layui-input" type="text" name="maktx" data-i18n-placeholder="product_name" placeholder="商品名称" autocomplete="off">
                </div>
            </div>
            <!-- 日期范围 -->
            <div class="layui-inline" style="width: 300px">
                <div class="layui-input-inline">
                    <input class="layui-input layui-laydate-range" id = "modi_time" name="modi_time" type="text" data-i18n-placeholder="start_end_time" placeholder="起始时间 - 终止时间" autocomplete="off" style="width: 300px">
                </div>
            </div>
            <div class="layui-inline">
                <div class="layui-input-inline">
                    <input class="layui-input" type="text" name="condition" data-i18n-placeholder="please_input" placeholder="请输入" autocomplete="off">
                </div>
            </div>
            <!-- 待添加 -->
            <div id="data-search-btn" class="layui-btn-container layui-form-item" style="display: inline-block">
                <button id="search" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="search" data-i18n="search">搜索</button>
            </div>
        </div>
    </fieldset>
 
    <div class="layui-form">
        <table class="layui-hide" id="mat" lay-filter="mat"></table>
    </div>
</div>
 
<script type="text/html" id="toolbar">
    <div class="layui-btn-container">
        <button class="layui-btn" id="btn-confirm" lay-event="confirm" style="" data-i18n="extract">提取</button>
    </div>
</script>
 
<script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="../../static/js/i18n/i18n-helper.js"></script>
<script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script>
<script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script>
<script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script>
 
</body>
<script>
    function getCol() {
        let cols = [
            {type: 'checkbox', fixed: 'left'}
        ];
        if (typeof getMatCols === 'function') {
            cols.push.apply(cols, getMatCols());
        } else {
            cols.push.apply(cols, matCols);
        }
        cols.push(
            {field: 'modiUser$', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('modifier') : '修改人员', hide: true},
            {field: 'modiTime$', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('modify_time') : '修改时间'}
        )
        return cols;
    }
 
    layui.config({
        base: baseUrl + "/static/layui/lay/modules/"
    }).use(['table','laydate', 'form', 'admin'], function() {
        var table = layui.table;
        var $ = layui.jquery;
        var layer = layui.layer;
        var layDate = layui.laydate;
        var form = layui.form;
        var admin = layui.admin;
        
        var dateIns = layDate.render({
            elem: '#modi_time'
            ,type: 'datetime'
            ,range: true
            ,lang: typeof I18n !== 'undefined' && I18n.getLanguage().toLowerCase() === 'zh-cn' ? 'cn' : 'en'
        });
 
        // 物料查询数据表
        function initTable() {
            matQueryTable = table.render({
                elem: '#mat',
                headers: {token: localStorage.getItem('token')},
                url: baseUrl + '/mat/list/auth',
                page: true,
                limit: 7,
                limits: [7, 10, 30,50,100],
                even: true,
                cellMinWidth: 50,
                toolbar: '#toolbar',
                cols: [getCol()],
                text: {
                    none: typeof I18n !== 'undefined' ? I18n.t('no_data') : '暂无相关数据'
                },
                request: {
                    pageName: 'curr',
                    pageSize: 'limit'
                },
                parseData: function (res) {
                    return {
                        'code': res.code,
                        'msg': res.msg,
                        'count': res.data.total,
                        'data': res.data.records
                    }
                },
                response: {
                    statusCode: 200
                },
                done: function (res, curr, count) {
                    if (res.code === 403) {
                        top.location.href = baseUrl + "/";
                    }
                    if (typeof I18n !== 'undefined') {
                        I18n.updatePage();
                        I18n.updateLayuiPagination();
                    }
                }
            });
        }
 
        // Initialize table when I18n is ready
        if (typeof I18n !== 'undefined' && I18n.isReady()) {
            initTable();
        } else {
            $(document).on('i18n:ready', function() {
                initTable();
            });
        }
 
        // 监听头工具栏事件
        table.on('toolbar(mat)', function (obj) {
            let checkStatus = table.checkStatus(obj.config.id);
            let data = checkStatus.data;
            switch(obj.event) {
                case 'confirm':
                    if (data.length === 0){
                        layer.msg(typeof I18n !== 'undefined' ? I18n.t('please_select_data') : "请选择数据", {icon: 2});
                        return;
                    }
                    parent.addTableData(data);
                    break;
            }
        });
 
        // 搜索栏搜索事件
        form.on('submit(search)', function (data) {
            tableReload();
        });
 
        $(document).on('i18n:languageChanged', function() {
             if (matQueryTable) {
                 matQueryTable.reload({
                     cols: [getCol()]
                 });
             } else {
                 initTable();
             }
             // Update placeholder
             $('[data-i18n-placeholder]').each(function() {
                 var key = $(this).attr('data-i18n-placeholder');
                 $(this).attr('placeholder', I18n.t(key));
             });
             // Reload date component
            if (typeof dateIns !== 'undefined') {
                // Completely remove and recreate the input element to force laydate reset
                var $input = $('#modi_time');
                var parent = $input.parent();
                var inputHtml = $input.prop("outerHTML");
                $input.remove();
                parent.append(inputHtml);
                $('#modi_time').removeAttr('lay-key'); // Ensure no key remains
                
                dateIns = layDate.render({
                    elem: '#modi_time'
                    ,type: 'datetime'
                    ,range: true
                    ,lang: I18n.getLanguage().toLowerCase() === 'zh-cn' ? 'cn' : 'en'
                });
            }
        });
    })
 
    function tableReload() {
        if (!matQueryTable) return;
        var searchData = {};
        $.each($('#search-box [name]').serializeArray(), function() {
            searchData[this.name] = this.value;
        });
        matQueryTable.reload({
            where: searchData
        });
    }
 
</script>
 
</html>