自动化立体仓库 - WMS系统
lty
8 天以前 539a56279625242c497b4b4093f2defbb9d80334
src/main/webapp/views/handWrkMast/wrkDetlLog.html
@@ -12,7 +12,7 @@
</head>
<body>
<div class="layui-inline"  style="width:31%;margin-top: 20px">
    <label class="layui-form-label">工 作 号:</label>
    <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>
@@ -24,16 +24,20 @@
<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: '工作号'}
            ,{field: 'ioTime$', align: 'center',title: '工作时间'}
            {field: 'wrkNo', align: 'center',title: t('work_no', '工作号')}
            ,{field: 'ioTime$', align: 'center',title: t('work_time', '工作时间')}
        ];
        cols.push.apply(cols, detlCols);
        cols.push.apply(cols, getDetlCols());
        return cols;
    }
    layui.use(['table','laydate', 'form'], function() {
@@ -42,48 +46,74 @@
        var form = layui.form;
        $('#wrkNo').val(parent.wrkNo);
        // 数据渲染
        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()],
            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';
        // 初始化表格函数
        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>