自动化立体仓库 - WMS系统
chen.lin
2026-02-14 371462edc6b3ee1de97c235d4a019b544badda0d
src/main/webapp/static/js/taskLog/taskLog.js
@@ -1,6 +1,7 @@
var pageCurr;
var wrkNo;
var ioTime;
var tableIns;
layui.use(['table', 'laydate', 'form'], function () {
    var table = layui.table;
    var $ = layui.jquery;
@@ -8,22 +9,75 @@
    var layDate = layui.laydate;
    var form = layui.form;
    // 数据渲染
    tableIns = table.render({
        elem: '#taskLog',
        headers: { token: localStorage.getItem('token') },
        url: baseUrl + '/taskLog/list/auth',
        page: true,
        limit: 16,
        limits: [16, 30, 50, 100, 200, 500],
    // AGV工作档日志:工作状态多选(与AGV任务管理一致),默认 7、8、9
    function updateTaskLogWrkStsFromCheckbox() {
        var ids = [], texts = [];
        $('#taskLogWrkStsCheckboxWrap input:checkbox:checked').each(function () {
            var $input = $(this);
            ids.push($input.val());
            var text = $input.data('text') || $input.closest('label').clone().children().remove().end().text().trim() || $input.val();
            texts.push(text);
        });
        $('#taskLogWrkSts').val(ids.join(','));
        $('#taskLogWrkStsDisp').val(texts.join(', '));
    }
    $(document).on('change', '#taskLogWrkStsCheckboxWrap input:checkbox', updateTaskLogWrkStsFromCheckbox);
    function initTaskLogWrkStsThenTable() {
        $.ajax({
            url: baseUrl + '/basWrkStatusQueryAgv/auth',
            headers: { token: localStorage.getItem('token') },
            data: { condition: '' },
            method: 'POST',
            traditional: true,
            success: function (res) {
                var $wrap = $('#taskLogWrkStsCheckboxWrap');
                $wrap.empty();
                var defaultIds = { '7': true, '8': true, '9': true };
                if (res.code === 200 && res.data && res.data.length) {
                    res.data.forEach(function (item) {
                        var id = String(item.id);
                        var text = item.value || id;
                        var checked = defaultIds[id] ? ' checked' : '';
                        $wrap.append(
                            '<label class="taskLog-wrksts-cb-label" style="display: inline-block; margin: 4px 12px 4px 0; cursor: pointer;"><input type="checkbox" value="' + id + '" data-text="' + (text.replace(/"/g, '&quot;')) + '"' + checked + '> ' + text + '</label>'
                        );
                    });
                    updateTaskLogWrkStsFromCheckbox();
                }
                $('#taskLogWrkStsDisp').off('click').on('click', function () {
                    $('#taskLogWrkStsWindow').toggle();
                });
                var initialWhere = {};
                $.each($('#search-box [name]').serializeArray(), function () {
                    initialWhere[this.name] = this.value;
                });
                renderTaskLogTable(initialWhere);
            },
            error: function () {
                renderTaskLogTable({});
            }
        });
    }
    function renderTaskLogTable(initialWhere) {
        tableIns = table.render({
            elem: '#taskLog',
            headers: { token: localStorage.getItem('token') },
            url: baseUrl + '/taskLog/list/auth',
            where: initialWhere || {},
            page: true,
            limit: 15,
        limits: [15, 30, 50, 100, 200, 500],
        even: true,
        toolbar: '#toolbar',
        cellMinWidth: 50,
        height: 'full-120',
        cols: [[
            // {field: 'id', align: 'center', title: 'id'}
            { field: 'wrkNo', align: 'center', title: '工作号', sort: true, width: 105 }
            , { field: 'ioTime$', align: 'center', title: '工作时间', }
            , { field: 'wrkSts$', align: 'center', title: '工作状态', }
            , { field: 'agvWrkNo', align: 'center', title: 'AGV工作号', width: 180 }
            , { field: 'ioTime$', align: 'center', title: '工作时间', width: 160 }
            , { field: 'wrkSts$', align: 'center', title: '工作状态', width: 150 }
            , { field: 'ioType$', align: 'center', title: '入出库类型', width: 150 }
            , { field: 'ioPri', align: 'center', title: '优先级', width: 80 }
            , { field: 'taskType$', align: 'center', title: '任务类型', width: 120 }
@@ -33,11 +87,14 @@
            , { field: 'staNo$', align: 'center', title: '目标站', width: 120 }
            , { field: 'locNo', align: 'center', title: '目标库位', width: 120 }
            , { field: 'barcode', align: 'center', title: '条码', width: 110 }
            , { field: 'errorMemo', align: 'center', title: 'AGV回复报文', width: 200, hide: true }
            , { field: 'errorMemo2', align: 'center', title: 'AGV回复报文2', width: 200, hide: true }
            , { field: 'errorTime$', align: 'center', title: '错误时间', width: 160, hide: true }
            , { field: 'preHave', align: 'center', title: '先入品', hide: true }
            , { field: 'takeNone', align: 'center', title: '空操作', hide: true }
            , { field: 'modiUser$', align: 'center', title: '修改人员', hide: true }
            , { field: 'modiTime$', align: 'center', title: '修改时间', hide: true, width: 160 }
            , { fixed: 'right', title: '操作', align: 'center', toolbar: '#operate', width: 200 }
            , { fixed: 'right', title: '操作', align: 'center', toolbar: '#operate', width: 250 }
        ]],
        request: {
            pageName: 'curr',
@@ -78,7 +135,10 @@
                }
            });
        }
    });
        });
    }
    initTaskLogWrkStsThenTable();
    // 监听排序事件
    table.on('sort(taskLog)', function (obj) {
@@ -250,6 +310,9 @@
    form.on('submit(reset)', function (data) {
        pageCurr = 1;
        clearFormVal($('#search-box'));
        $('#taskLogWrkStsCheckboxWrap input:checkbox').prop('checked', false);
        $('#taskLogWrkSts').val('');
        $('#taskLogWrkStsDisp').val('');
        tableReload(false);
    });
@@ -316,11 +379,13 @@
});
function tableReload(child) {
    var ins = child ? parent.tableIns : tableIns;
    if (!ins) return;
    var searchData = {};
    $.each($('#search-box [name]').serializeArray(), function () {
        searchData[this.name] = this.value;
    });
    (child ? parent.tableIns : tableIns).reload({
    ins.reload({
        where: searchData,
        page: {
            curr: pageCurr
@@ -331,7 +396,7 @@
            }
            pageCurr = curr;
            if (res.data.length === 0 && count !== 0) {
                tableIns.reload({
                ins.reload({
                    where: searchData,
                    page: {
                        curr: pageCurr - 1