| | |
| | | var form = layui.form; |
| | | var admin = layui.admin; |
| | | |
| | | |
| | | /****************************************** 左边表 *************************************************/ |
| | | var leftTB = table.render({ |
| | | elem: '#leftTable', |
| | | url: baseUrl + '/pickout/list/auth', |
| | | height: 'full-100', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | 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 |
| | | }, |
| | | defaultToolbar: [], |
| | | cols:[[ |
| | | // {type: 'checkbox'} |
| | | {field: 'wrkNo', align: 'center',title: '任务号'} |
| | | ,{field: 'id', align: 'center',title: '唯一ID',hide: true} |
| | | ,{field: 'hostId', align: 'center',title: '商户ID', hide: true} |
| | | ,{field: 'userId', align: 'center',title: '用户ID', hide: true} |
| | | |
| | | ,{field: 'wrkSts$', align: 'center',title: '工作状态' ,templet: '#wrkStsTpl' , width: 100} |
| | | ,{field: 'zpallet', align: 'center',title: '条形码' , hide:true} |
| | | ,{field: 'createTime$', align: 'center',title: '', hide:true} |
| | | ,{field: 'createBy', align: 'center',title: '', hide:true} |
| | | ,{field: 'updateTime$', align: 'center',title: '', hide:true} |
| | | ,{field: 'updateBy', align: 'center',title: '', hide:true} |
| | | ,{field: 'memo', align: 'center',title: '', hide:true} |
| | | |
| | | ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:180} |
| | | ]], |
| | | done: function (res,curr,count){ |
| | | $('#dictTable+.layui-table-view .layui-table-body tbody>tr:first').trigger('click'); |
| | | } |
| | | }); |
| | | // 监听行工具事件 |
| | | table.on('tool(leftTable)', function(obj){ |
| | | var data = obj.data; |
| | | switch (obj.event) { |
| | | case 'complete': |
| | | complete(data); |
| | | break; |
| | | case "del": |
| | | var ids = [data.id]; |
| | | del(ids); |
| | | break; |
| | | } |
| | | }); |
| | | |
| | | /* 删除 */ |
| | | function del(ids) { |
| | | layer.confirm('确定要删除选中数据吗?', { |
| | | skin: 'layui-layer-admin', |
| | | shade: .1 |
| | | }, function (i) { |
| | | layer.close(i); |
| | | var loadIndex = layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl+"/pickout/delete/auth", |
| | | 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}); |
| | | tableReload(); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }) |
| | | }); |
| | | } |
| | | |
| | | /****************************************** 右边表 *************************************************/ |
| | | // 数据渲染 |
| | | tableIns = table.render({ |
| | | elem: '#pickout', |
| | |
| | | toolbar: '#toolbar', |
| | | cellMinWidth: 50, |
| | | cols: [[ |
| | | {type: 'checkbox'} |
| | | // {type: 'checkbox'} |
| | | {field: 'wrkNo', align: 'center',title: '任务号'} |
| | | ,{field: 'id', align: 'center',title: '唯一ID'} |
| | | ,{field: 'hostId', align: 'center',title: '商户ID'} |
| | | ,{field: 'userId', align: 'center',title: '用户ID'} |
| | | ,{field: 'wrkNo', align: 'center',title: '工作号'} |
| | | ,{field: 'wrkSts', align: 'center',title: '工作状态'} |
| | | ,{field: 'zpallet', align: 'center',title: '条形码'} |
| | | ,{field: 'createTime$', align: 'center',title: ''} |
| | | ,{field: 'createBy', align: 'center',title: ''} |
| | | ,{field: 'updateTime$', align: 'center',title: ''} |
| | | ,{field: 'updateBy', align: 'center',title: ''} |
| | | ,{field: 'memo', align: 'center',title: ''} |
| | | |
| | | ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:150} |
| | | ,{field: 'wrkSts$', align: 'center',title: '工作状态' ,templet: '#wrkStsTpl' , width: 100} |
| | | ,{field: 'zpallet', align: 'center',title: '条形码' , hide:true} |
| | | ,{field: 'createTime$', align: 'center',title: '', hide:true} |
| | | ,{field: 'createBy', align: 'center',title: '', hide:true} |
| | | ,{field: 'updateTime$', align: 'center',title: '', hide:true} |
| | | ,{field: 'updateBy', align: 'center',title: '', hide:true} |
| | | ,{field: 'memo', align: 'center',title: '', hide:true} |
| | | |
| | | ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:180} |
| | | ]], |
| | | request: { |
| | | pageName: 'curr', |
| | |
| | | break; |
| | | } |
| | | }); |
| | | |
| | | // 监听行工具事件 |
| | | table.on('tool(pickout)', function(obj){ |
| | | var data = obj.data; |
| | | switch (obj.event) { |
| | | case 'edit': |
| | | showEditModel(data); |
| | | break; |
| | | case "del": |
| | | var ids = [data.id]; |
| | | del(ids); |
| | | break; |
| | | } |
| | | /* 表格搜索 */ |
| | | form.on('submit(leftResearch)', function (data) { |
| | | insTb.reload({where: {doc_name: data.field.docName,doc_class:2}}); |
| | | return false; |
| | | }); |
| | | |
| | | /* 弹窗 - 新增、修改 */ |
| | | function showEditModel(mData) { |
| | | admin.open({ |
| | | type: 1, |
| | | area: '600px', |
| | | title: (mData ? '修改' : '添加') + '订单状态', |
| | | content: $('#editDialog').html(), |
| | | success: function (layero, dIndex) { |
| | | layDateRender(); |
| | | form.val('detail', mData); |
| | | form.on('submit(editSubmit)', function (data) { |
| | | var loadIndex = layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl+"/pickout/"+(mData?'update':'add')+"/auth", |
| | | 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}); |
| | | tableReload(); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | $(layero).children('.layui-layer-content').css('overflow', 'visible'); |
| | | layui.form.render('select'); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /* 删除 */ |
| | | function del(ids) { |
| | | layer.confirm('确定要删除选中数据吗?', { |
| | | skin: 'layui-layer-admin', |
| | | shade: .1 |
| | | }, function (i) { |
| | | layer.close(i); |
| | | var loadIndex = layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl+"/pickout/delete/auth", |
| | | 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}); |
| | | tableReload(); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }) |
| | | }); |
| | | } |
| | | |
| | | // 搜索 |
| | | form.on('submit(search)', function (data) { |