自动化立体仓库 - WMS系统
zhou zhou
2025-12-26 44c6df2e7b14b2126b0157b07803ac83047d7829
src/main/webapp/static/js/locCache/locCache.js
@@ -12,7 +12,7 @@
    // 数据渲染
    tableIns = table.render({
        elem: '#locCache',
        headers: {token: localStorage.getItem('token')},
        headers: { token: localStorage.getItem('token') },
        url: baseUrl + '/locCache/list/auth',
        page: true,
        limit: 15,
@@ -20,23 +20,23 @@
        toolbar: '#toolbar',
        cellMinWidth: 80,
        height: 'full-120',
        cols: [[{type: 'checkbox'}, {field: 'locNo', align: 'center', title: '库位号', width: 120}
            , {field: 'barcode', align: 'center', title: '托盘码'}
            , {field: 'areaName', align: 'center', title: '库区名称'}
        cols: [[{ type: 'checkbox' }, { field: 'locNo', align: 'center', title: '库位号', width: 120 }
            , { field: 'barcode', align: 'center', title: '托盘码' }
            , { field: 'areaName', align: 'center', title: '库区名称' }
            // , {field: 'whsType$', align: 'center', title: '库位类型'}
            , {field: 'locSts', align: 'center', title: '库位状态'}
            , {field: 'row1', align: 'center', title: '排'}
            , {field: 'bay1', align: 'center', title: '列'}
            , {field: 'lev1', align: 'center', title: '层'}
            , { field: 'locSts', align: 'center', title: '库位状态' }
            , { field: 'row1', align: 'center', title: '排' }
            , { field: 'bay1', align: 'center', title: '列' }
            , { field: 'lev1', align: 'center', title: '层' }
            // , {field: 'locType', align: 'center', title: '库位类型'}
            , {field: 'sort', align: 'center', title: '优先级'}
            , {field: 'modiUser$', align: 'center', title: '修改人员'}
            , {field: 'modiTime$', align: 'center', title: '修改时间'}
            , {field: 'appeUser$', align: 'center', title: '创建者'}
            , {field: 'appeTime$', align: 'center', title: '添加时间'}
            , {field: 'frozen', align: 'center', title: '是否冻结,0.未冻结,1.已冻结', hide: true}
            , {field: 'frozenMemo', align: 'center', title: '冻结备注', hide: true}
            , {fixed: 'right', title: '操作', align: 'center', toolbar: '#operate', width: 160}]
            , { field: 'sort', align: 'center', title: '优先级' }
            , { field: 'modiUser$', align: 'center', title: '修改人员', hide: true }
            , { field: 'modiTime$', align: 'center', title: '修改时间' }
            , { field: 'appeUser$', align: 'center', title: '创建者', hide: true }
            , { field: 'appeTime$', align: 'center', title: '添加时间', hide: true }
            , { field: 'frozen', align: 'center', title: '是否冻结', hide: true }
            , { field: 'frozenMemo', align: 'center', title: '冻结备注', hide: true }
            , { fixed: 'right', title: '操作', align: 'center', toolbar: '#operate', width: 200 }]
        ],
        request: {
            pageName: 'curr', pageSize: 'limit'
@@ -67,7 +67,7 @@
        searchData['orderByField'] = obj.field;
        searchData['orderByType'] = obj.type;
        tableIns.reload({
            where: searchData, page: {curr: 1}
            where: searchData, page: { curr: 1 }
        });
    });
@@ -80,14 +80,14 @@
                break;
            case 'batchModifties':
                if (checkStatus.length === 0) {
                    layer.msg('请选择需要修改的数据信息', {icon: 2});
                    layer.msg('请选择需要修改的数据信息', { icon: 2 });
                    return;
                }
                batchModifies();
                break;
            case 'deleteData':
                if (checkStatus.length === 0) {
                    layer.msg('请选择要删除的数据', {icon: 2});
                    layer.msg('请选择要删除的数据', { icon: 2 });
                    return;
                }
                del(checkStatus.map(function (d) {
@@ -95,8 +95,8 @@
                }));
                break;
            case 'init':
                layer.prompt({title: '请输入口令,并重置库位', formType: 1, shadeClose: true}, function (pass, idx) {
                    http.get(baseUrl + "/locMast/init/pwd", {pwd: pass}, function (res) {
                layer.prompt({ title: '请输入口令,并重置库位', formType: 1, shadeClose: true }, function (pass, idx) {
                    http.get(baseUrl + "/locMast/init/pwd", { pwd: pass }, function (res) {
                        if (res.data) {
                            layer.open({
                                type: 1,
@@ -153,7 +153,7 @@
        console.log(data.field)
        $.ajax({
            url: baseUrl + "/locCache/init/auth",
            headers: {'token': localStorage.getItem('token')},
            headers: { 'token': localStorage.getItem('token') },
            data: data.field,
            method: 'POST',
            async: false,
@@ -190,28 +190,58 @@
        admin.open({
            type: 1,
            area: '600px',
            title: (mData ? '修改' : '添加') + '订单状态',
            title: (mData ? '修改' : '添加') + '库位缓存',
            content: $('#editDialog').html(),
            success: function (layero, dIndex) {
                layDateRender(mData);
                form.val('detail', mData);
                // 加载库区列表
                $.ajax({
                    url: baseUrl + "/basAreasQuery/auth",
                    headers: { 'token': localStorage.getItem('token') },
                    data: { condition: '' },
                    method: 'POST',
                    success: function (res) {
                        if (res.code === 200) {
                            var areaSelect = $(layero).find('select[name="areaName"]');
                            areaSelect.empty();
                            areaSelect.append('<option value="">请选择库区</option>');
                            var list = res.data;
                            for (var i = 0; i < list.length; i++) {
                                areaSelect.append('<option value="' + list[i].value + '" data-id="' + list[i].id + '">' + list[i].value + '</option>');
                            }
                            // 设置表单值
                            form.val('detail', mData);
                            // 如果有数据,设置选中的库区
                            if (mData && mData.areaName) {
                                areaSelect.val(mData.areaName);
                            }
                            form.render('select');
                        }
                    }
                });
                // 监听库区选择变化,同步areaId
                form.on('select(editAreaName)', function (data) {
                    var selectedOption = $(data.elem).find('option:selected');
                    var areaId = selectedOption.attr('data-id') || '';
                    $(layero).find('input[name="areaId"]').val(areaId);
                });
                form.on('submit(editSubmit)', function (data) {
                    var loadIndex = layer.load(2);
                    $.ajax({
                        url: baseUrl + "/locCache/" + (mData ? 'update' : 'add') + "/auth",
                        headers: {'token': localStorage.getItem('token')},
                        headers: { 'token': localStorage.getItem('token') },
                        data: data.field,
                        method: 'POST',
                        success: function (res) {
                            layer.close(loadIndex);
                            if (res.code === 200) {
                                layer.close(dIndex);
                                layer.msg(res.msg, {icon: 1});
                                layer.msg(res.msg, { icon: 1 });
                                tableReload();
                            } else if (res.code === 403) {
                                top.location.href = baseUrl + "/";
                            } else {
                                layer.msg(res.msg, {icon: 2});
                                layer.msg(res.msg, { icon: 2 });
                            }
                        }
                    })
@@ -232,18 +262,18 @@
            var loadIndex = layer.load(2);
            $.ajax({
                url: baseUrl + "/locCache/delete/auth",
                headers: {'token': localStorage.getItem('token')},
                data: {ids: ids},
                headers: { 'token': localStorage.getItem('token') },
                data: { ids: ids },
                method: 'POST',
                success: function (res) {
                    layer.close(loadIndex);
                    if (res.code === 200) {
                        layer.msg(res.msg, {icon: 1});
                        layer.msg(res.msg, { icon: 1 });
                        tableReload();
                    } else if (res.code === 403) {
                        top.location.href = baseUrl + "/";
                    } else {
                        layer.msg(res.msg, {icon: 2});
                        layer.msg(res.msg, { icon: 2 });
                    }
                }
            })
@@ -303,6 +333,6 @@
        searchData[this.name] = this.value;
    });
    tableIns.reload({
        where: searchData, page: {curr: pageCurr}
        where: searchData, page: { curr: pageCurr }
    });
}