自动化立体仓库 - WMS系统
lty
4 天以前 8e943b7104561c3b14cf223016698709c5ade4b5
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
<!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/cool.css" media="all">
    <link rel="stylesheet" href="../../static/css/common.css" media="all">
</head>
<body>
<div class="layui-inline"  style="width:31%;margin-top: 20px">
    <label class="layui-form-label" data-i18n="work_no_label">工 作 号:</label>
    <div class="layui-input-inline">
        <input id="wrkNo" class="layui-input" type="text" disabled="disabled">
    </div>
</div>
<!-- 表格 -->
<div class="layui-form">
    <table class="layui-hide" id="wrkDetlLogByMast" lay-filter="wrkDetlLogByMast"></table>
</div>
<script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.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/i18n/i18n-helper.js"></script>
<script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script>
 
<script type="text/javascript">
    var pageCur;
    function getCol() {
        var t = function(key, def) {
            return (typeof I18n !== 'undefined' && typeof I18n.t === 'function') ? I18n.t(key) : def;
        };
        var cols = [
            {field: 'wrkNo', align: 'center',title: t('work_no', '工作号')}
            ,{field: 'ioTime$', align: 'center',title: t('work_time', '工作时间')}
        ];
        cols.push.apply(cols, getDetlCols());
        return cols;
    }
    layui.use(['table','laydate', 'form'], function() {
        table = layui.table;
        var $ = layui.jquery;
        var form = layui.form;
 
        $('#wrkNo').val(parent.wrkNo);
        
        // 初始化表格函数
        var initTable = function() {
            // 数据渲染
            tableIns1 = table.render({
                elem: '#wrkDetlLogByMast',
                headers: {token: localStorage.getItem('token')},
                url: baseUrl+'/wrkDetlLog/list/auth',
                where: {wrk_no: parent.wrkNo},
                page: true,
                limit: 16,
                limits: [16, 30, 50, 100, 200, 500],
                even: true,
                toolbar: '#toolbar',
                cellMinWidth: 50,
                cols: [getCol()],
                text: {
                    none: (typeof I18n !== 'undefined' && typeof I18n.t === 'function') ? 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+"/";
                    }
                    pageCur=curr;
                    form.on('checkbox(tableCheckbox)', function (data) {
                        var _index = $(data.elem).attr('table-index')||0;
                        if(data.elem.checked){
                            res.data[_index][data.value] = 'Y';
                        }else{
                            res.data[_index][data.value] = 'N';
                        }
                    });
                    
                    // Update pagination translation
                    if (typeof I18n !== 'undefined' && I18n.updateLayuiPagination) {
                        I18n.updateLayuiPagination();
                    }
                }
            });
        };
 
        // 检查 I18n 是否就绪
        if (typeof I18n !== 'undefined' && I18n.isReady && I18n.isReady()) {
            initTable();
        } else {
            $(document).on('i18n:ready', function() {
                initTable();
            });
        }
        
        // 监听语言切换
        $(document).on('i18n:languageChanged', function() {
            initTable();
        });
    });
</script>
 
</body>
 
</html>