| | |
| | | var pageCurr; |
| | | layui.config({ |
| | | base: baseUrl + "/static/layui/lay/modules/" |
| | | }).use(['table','laydate', 'form', 'admin'], function(){ |
| | | }).use(['table','laydate', 'form', 'admin', 'tableMerge'], function(){ |
| | | var table = layui.table; |
| | | var $ = layui.jquery; |
| | | var layer = layui.layer; |
| | | var layDate = layui.laydate; |
| | | var form = layui.form; |
| | | var admin = layui.admin; |
| | | var tableMerge = layui.tableMerge; |
| | | |
| | | /****************************************** 左边表 *************************************************/ |
| | | |
| | |
| | | }); |
| | | |
| | | /* 表格搜索 */ |
| | | form.on('submit(docTypeTable)', function (data) { |
| | | insTb.reload({where: data.field}); |
| | | form.on('submit(docTypeTableSearch)', function (data) { |
| | | insTb.reload({where: {doc_name: data.field.docName}}); |
| | | return false; |
| | | }); |
| | | |
| | |
| | | if (obj.event === 'add') { // 添加 |
| | | showEditModel(); |
| | | } else if (obj.event === 'edit') { // 修改 |
| | | showEditModel(selObj.data, selObj); |
| | | if (selObj == null) { |
| | | return; |
| | | } |
| | | showEditModel(selObj.data); |
| | | } else if (obj.event === 'del') { // 删除 |
| | | if (selObj == null) { |
| | | return; |
| | | } |
| | | doDel(selObj); |
| | | } |
| | | }); |
| | | |
| | | /* 监听行单击事件 */ |
| | | var selObj; |
| | | table.on('row(docTypeTable)', function (obj) { |
| | | selObj = obj; |
| | | obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click'); |
| | |
| | | }); |
| | | |
| | | /* 显示表单弹窗 */ |
| | | function showEditModel(mData, obj) { |
| | | function showEditModel(mData) { |
| | | admin.open({ |
| | | type: 1, |
| | | title: (mData ? '修改' : '添加') + '字典', |
| | | content: $('#dictEditDialog').html(), |
| | | title: (mData ? '修改' : '添加') + '单据类型', |
| | | content: $('#docTypeEditDialog').html(), |
| | | success: function (layero, dIndex) { |
| | | // 回显表单数据 |
| | | form.val('dictEditForm', mData); |
| | | form.val('docTypeEditForm', mData); |
| | | // 表单提交事件 |
| | | form.on('submit(dictEditSubmit)', function (data) { |
| | | form.on('submit(docTypeEditSubmit)', function (data) { |
| | | var loadIndex = layer.load(2); |
| | | $.get(mData ? '../../json/ok.json' : '../../json/ok.json', data.field, function (res) { |
| | | layer.close(loadIndex); |
| | | if (200 === res.code) { |
| | | layer.close(dIndex); |
| | | layer.msg(res.msg, {icon: 1}); |
| | | if (obj) { |
| | | obj.update(data.field); |
| | | } else { |
| | | $.ajax({ |
| | | url: baseUrl+"/docType/"+(mData?'update':'add')+"/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: data.field, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.close(loadIndex); |
| | | selObj = null; |
| | | if (res.code === 200){ |
| | | layer.close(dIndex); |
| | | layer.msg(res.msg, {icon: 1}); |
| | | insTb.reload(); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | }, 'json'); |
| | | }) |
| | | return false; |
| | | }); |
| | | } |
| | |
| | | |
| | | /* 删除 */ |
| | | function doDel(obj) { |
| | | layer.confirm('确定要删除此字典吗?', { |
| | | layer.confirm('确定要删除此单据类型吗?', { |
| | | skin: 'layui-layer-admin', |
| | | shade: .1 |
| | | }, function (i) { |
| | | layer.close(i); |
| | | var loadIndex = layer.load(2); |
| | | $.get('../../json/ok.json', { |
| | | id: obj.data.dictId, |
| | | }, function (res) { |
| | | layer.close(loadIndex); |
| | | if (200 === res.code) { |
| | | layer.msg(res.msg, {icon: 1}); |
| | | obj.del(); |
| | | $('#dictTable+.layui-table-view .layui-table-body tbody>tr:first').trigger('click'); |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | $.ajax({ |
| | | url: baseUrl+"/docType/delete/one/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: {param: JSON.stringify(obj.data)}, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | selObj = null; |
| | | layer.close(loadIndex); |
| | | if (res.code === 200){ |
| | | layer.closeAll(); |
| | | insTb.reload(); |
| | | $('#dictTable+.layui-table-view .layui-table-body tbody>tr:first').trigger('click'); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }, 'json'); |
| | | }) |
| | | }); |
| | | } |
| | | |
| | |
| | | page: true, |
| | | limit: 16, |
| | | limits: [16, 30, 50, 100, 200, 500], |
| | | toolbar: '#toolbar', |
| | | toolbar: '#orderToolbar', |
| | | height: 'full-100', |
| | | cols: [[ |
| | | {type: 'checkbox'} |
| | | // ,{field: 'id', align: 'center',title: 'ID'} |
| | | // ,{field: 'uuid', align: 'center',title: '编号'} |
| | | ,{field: 'orderNo', align: 'center',title: '订单编号'} |
| | | ,{field: 'orderTime', align: 'center',title: '单据日期'} |
| | | ,{field: 'docType$', align: 'center',title: '单据类型'} |
| | | ,{field: 'itemId$', align: 'center',title: '项目编号'} |
| | | ,{field: 'docType$', align: 'center',title: '类别', templet: '#docTypeTpl', width: 100} |
| | | ,{field: 'orderNo', align: 'center',title: '单据编号', minWidth: 250} |
| | | ,{field: 'orderTime', align: 'center',title: '单据日期', width: 120} |
| | | ,{field: 'itemName', align: 'center',title: '项目', hide: true} |
| | | ,{field: 'allotItemId$', align: 'center',title: '调拨项目编号', hide: true} |
| | | ,{field: 'defNumber', align: 'center',title: '初始票据号', hide: true} |
| | | ,{field: 'number', align: 'center',title: '票据号'} |
| | | // ,{field: 'cstmr$', align: 'center',title: '客户编号'} |
| | | ,{field: 'cstmrName', align: 'center',title: '客户', hide: true} |
| | | ,{field: 'number', align: 'center',title: '票据号', hide: true} |
| | | ,{field: 'cstmrName', align: 'center',title: '客户'} |
| | | ,{field: 'tel', align: 'center',title: '联系方式', hide: true} |
| | | ,{field: 'operMemb', align: 'center',title: '操作人员'} |
| | | ,{field: 'totalFee', align: 'center',title: '合计金额'} |
| | | ,{field: 'operMemb', align: 'center',title: '操作人员', hide: true} |
| | | ,{field: 'totalFee', align: 'center',title: '合计金额', hide: true} |
| | | ,{field: 'discount', align: 'center',title: '优惠率', hide: true} |
| | | ,{field: 'discountFee', align: 'center',title: '优惠金额', hide: true} |
| | | ,{field: 'otherFee', align: 'center',title: '销售或采购费用合计', hide: true} |
| | |
| | | ,{field: 'sendTime$', align: 'center',title: '发货时间', hide: true} |
| | | ,{field: 'shipName', align: 'center',title: '物流名称', hide: true} |
| | | ,{field: 'shipCode', align: 'center',title: '物流单号', hide: true} |
| | | ,{field: 'settle$', align: 'center',title: '订单状态'} |
| | | // ,{field: 'status$', align: 'center',title: '状态'} |
| | | // ,{field: 'createBy$', align: 'center',title: '添加人员',event: 'createBy', style: 'cursor:pointer'} |
| | | // ,{field: 'createTime$', align: 'center',title: '添加时间'} |
| | | // ,{field: 'updateBy$', align: 'center',title: '修改人员',event: 'updateBy', style: 'cursor:pointer'} |
| | | // ,{field: 'updateTime$', align: 'center',title: '修改时间'} |
| | | // ,{field: 'memo', align: 'center',title: '备注'} |
| | | |
| | | ,{field: 'settle$', align: 'center',title: '订单状态', templet: '#settleTpl', width: 100} |
| | | ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:150} |
| | | ]], |
| | | request: { |
| | |
| | | response: { |
| | | statusCode: 200 |
| | | }, |
| | | size: 'lg', |
| | | done: function(res, curr, count) { |
| | | if (res.code === 403) { |
| | | top.location.href = baseUrl+"/"; |
| | | } |
| | | pageCurr=curr; |
| | | limit(); |
| | | 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'; |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | /* 表格2搜索 */ |
| | | form.on('submit(orderTable)', function (data) { |
| | | form.on('submit(orderTbSearch)', function (data) { |
| | | insTb2.reload({where: data.field, page: {curr: 1}}); |
| | | return false; |
| | | }); |
| | | |
| | | /* 表格2工具条点击事件 */ |
| | | table.on('tool(orderTable)', function (obj) { |
| | | if (obj.event === 'edit') { // 修改 |
| | | showEditModel2(obj.data); |
| | | } else if (obj.event === 'del') { // 删除 |
| | | doDel2(obj); |
| | | } |
| | | /* 表格2重置 */ |
| | | form.on('submit(orderTbReset)', function (data) { |
| | | insTb2.reload({where: null,page: {curr: 1}}); |
| | | return false; |
| | | }); |
| | | |
| | | /* 表格2头工具栏点击事件 */ |
| | | table.on('toolbar(orderTable)', function (obj) { |
| | | if (obj.event === 'add') { // 添加 |
| | | showEditModel2(); |
| | | right(); |
| | | } else if (obj.event === 'del') { // 删除 |
| | | var checkRows = table.checkStatus('dictDataTable'); |
| | | var checkRows = table.checkStatus('orderTable'); |
| | | if (checkRows.data.length === 0) { |
| | | layer.msg('请选择要删除的数据', {icon: 2}); |
| | | return; |
| | | } |
| | | var ids = checkRows.data.map(function (d) { |
| | | return d.dictDataId; |
| | | return d.id; |
| | | }); |
| | | doDel2({ids: ids}); |
| | | doDelOrder({ids: ids}); |
| | | } |
| | | }); |
| | | |
| | | /* 显示表单弹窗2 */ |
| | | function showEditModel2(mData) { |
| | | admin.open({ |
| | | type: 1, |
| | | title: (mData ? '修改' : '添加') + '数据字典项', |
| | | content: $('#dictDataEditDialog').html(), |
| | | success: function (layero, dIndex) { |
| | | // 回显表单数据 |
| | | form.val('dictDataEditForm', mData); |
| | | // 表单提交事件 |
| | | form.on('submit(dictDataEditSubmit)', function (data) { |
| | | data.field.dictId = selObj.data.dictId; |
| | | var loadIndex = layer.load(2); |
| | | $.get(mData ? '../../json/ok.json' : '../../json/ok.json', data.field, function (res) { |
| | | /* 表格2工具条点击事件 */ |
| | | table.on('tool(orderTable)', function (obj) { |
| | | var data = obj.data; |
| | | switch (obj.event) { |
| | | // 拣货 |
| | | case 'stockOut': |
| | | var loadIndex = layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl + "/work/stock/out/preview", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | contentType: 'application/json;charset=UTF-8', |
| | | data: JSON.stringify({ |
| | | orderNo: data.orderNo |
| | | }), |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.close(loadIndex); |
| | | if (200 === res.code) { |
| | | layer.close(dIndex); |
| | | layer.msg(res.msg, {icon: 1}); |
| | | insTb2.reload({page: {curr: 1}}); |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | }, 'json'); |
| | | return false; |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | if (res.code === 200){ |
| | | layer.open({ |
| | | type: 1 |
| | | ,title: false |
| | | ,closeBtn: false |
| | | ,offset: '100px' |
| | | ,area: '1000px' |
| | | ,shade: 0.5 |
| | | ,shadeClose: true |
| | | ,btn: ['立即生成', '稍后处理'] |
| | | ,btnAlign: 'c' |
| | | ,moveType: 1 //拖拽模式,0或者1 |
| | | ,content: $('#stoukOutPreview') |
| | | ,success: function(layero, index){ |
| | | table.render({ |
| | | elem: '#stoPreTab', |
| | | data: res.data, |
| | | page: true, |
| | | cellMinWidth: 100, |
| | | height: 432, |
| | | cols: [[ |
| | | {field: 'title', title: '商品', merge: true, align: 'center'}, |
| | | {field: 'anfme', title: '总数量', merge: ['title'], align: 'center', style: 'font-weight: bold', width: 90}, |
| | | {field: 'type', title: '仓库', merge: true, align: 'center', templet: '#typeTpl', width: 90}, |
| | | {field: 'locNo', title: '货位', align: 'center'}, |
| | | {field: 'prior$', title: '推荐货位', align: 'center', width: 100}, |
| | | {field: 'reduce', title: '数量', align: 'center', width: 90, style: 'font-weight: bold'}, |
| | | // {field: 'remQty', title: '余量', align: 'center', width: 80}, |
| | | {field: 'total', title: '总量', align: 'center', width: 90}, |
| | | ]], |
| | | done: function () { |
| | | tableMerge.render(this); |
| | | $('.layui-table-body.layui-table-main').css("overflow", "auto") |
| | | } |
| | | }); |
| | | |
| | | /* 删除2 */ |
| | | function doDel2(obj) { |
| | | } |
| | | ,yes: function(index, layero){ |
| | | //按钮【马上拣货】的回调 |
| | | stockOut(data.orderNo); |
| | | } |
| | | ,btn2: function(index, layero){ |
| | | //按钮【稍后处理】的回调 |
| | | //return false 开启该代码可禁止点击该按钮关闭 |
| | | } |
| | | }); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}) |
| | | } |
| | | } |
| | | }) |
| | | break; |
| | | // 打印 |
| | | case 'print': |
| | | layer.confirm('开始打印' +data.orderNo + ' 拣货单?', {shadeClose: true}, function(){ |
| | | layer.closeAll(); |
| | | printPakouts(data.orderNo); |
| | | }) |
| | | break; |
| | | // 删除 |
| | | case 'del': |
| | | var ids = [obj.id]; |
| | | doDelOrder({ids: ids}); |
| | | break; |
| | | |
| | | } |
| | | }); |
| | | |
| | | /* 删除订单 */ |
| | | function doDelOrder(obj) { |
| | | layer.confirm('确定要删除选中数据吗?', { |
| | | skin: 'layui-layer-admin', |
| | | shade: .1 |
| | | }, function (i) { |
| | | layer.close(i); |
| | | var loadIndex = layer.load(2); |
| | | $.get('../../json/ok.json', { |
| | | id: obj.data ? obj.data.dictDataId : '', |
| | | ids: obj.ids ? obj.ids.join(',') : '' |
| | | }, function (res) { |
| | | layer.close(loadIndex); |
| | | if (200 === res.code) { |
| | | layer.msg(res.msg, {icon: 1}); |
| | | insTb2.reload({page: {curr: 1}}); |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | $.ajax({ |
| | | url: baseUrl+"/orders/delete/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: {ids: obj.ids}, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.close(loadIndex); |
| | | if (res.code === 200){ |
| | | layer.msg(res.msg, {icon: 1}); |
| | | $(".layui-laypage-btn")[0].click(); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }, 'json'); |
| | | }) |
| | | |
| | | }); |
| | | } |
| | | |
| | | // 生成拣货单 |
| | | function stockOut(orderNo) { |
| | | layer.closeAll(); |
| | | $.ajax({ |
| | | url: baseUrl+"/work/stock/out/create", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | contentType:'application/json;charset=UTF-8', |
| | | data: JSON.stringify({ |
| | | orderNo: orderNo |
| | | }), |
| | | method: 'POST', |
| | | success: function (res) { |
| | | // 成功 |
| | | if (res.code === 200){ |
| | | layer.confirm(res.msg, { |
| | | shadeClose: true |
| | | , btn: ['打印拣货单'] |
| | | }, function() { |
| | | layer.closeAll(); |
| | | printPakouts(orderNo); |
| | | } |
| | | ) |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}) |
| | | } |
| | | $(".layui-laypage-btn")[0].click(); |
| | | } |
| | | }) |
| | | // }); |
| | | } |
| | | |
| | | // 打印拣货单 |
| | | function printPakouts(orderNo) { |
| | | $.ajax({ |
| | | url: baseUrl+"/work/stock/out/print", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: JSON.stringify({ |
| | | orderNo: orderNo |
| | | }), |
| | | contentType:'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | res.data["barcodeUrl"]=baseUrl+"/order/code/auth?type=1¶m="+res.data.docNum; |
| | | var tpl = $('#pakoutPrintTpl').html(); |
| | | var template = Handlebars.compile(tpl); |
| | | var html = template(res); |
| | | var box = $("#pakoutPrintBox"); |
| | | box.html(html);box.show(); |
| | | box.print({ |
| | | mediaPrint:true, |
| | | deferred: $.Deferred().done(function () { |
| | | layer.confirm('[重要] 打印是否成功?', {btn: ['Yes', 'No']}, function(){ |
| | | $.ajax({ |
| | | url: baseUrl+"/pakout/print/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | docNumber: orderNo |
| | | }, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | layer.closeAll(); |
| | | $(".layui-laypage-btn")[0].click(); |
| | | layer.msg(res.msg, {icon: 1}) |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}) |
| | | } |
| | | } |
| | | }) |
| | | }); |
| | | }) |
| | | }); |
| | | box.hide(); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // // 数据渲染 |
| | | // tableIns = table.render({ |
| | | // elem: '#order', |
| | | // headers: {token: localStorage.getItem('token')}, |
| | | // url: baseUrl+'/order/list/auth', |
| | | // page: true, |
| | | // limit: 16, |
| | | // limits: [16, 30, 50, 100, 200, 500], |
| | | // even: true, |
| | | // toolbar: '#toolbar', |
| | | // cellMinWidth: 50, |
| | | // cols: [[ |
| | | // {type: 'checkbox'} |
| | | // // ,{field: 'id', align: 'center',title: 'ID'} |
| | | // // ,{field: 'uuid', align: 'center',title: '编号'} |
| | | // ,{field: 'orderNo', align: 'center',title: '订单编号'} |
| | | // ,{field: 'orderTime', align: 'center',title: '单据日期'} |
| | | // ,{field: 'docType$', align: 'center',title: '单据类型'} |
| | | // ,{field: 'itemId$', align: 'center',title: '项目编号'} |
| | | // ,{field: 'allotItemId$', align: 'center',title: '调拨项目编号', hide: true} |
| | | // ,{field: 'defNumber', align: 'center',title: '初始票据号', hide: true} |
| | | // ,{field: 'number', align: 'center',title: '票据号'} |
| | | // // ,{field: 'cstmr$', align: 'center',title: '客户编号'} |
| | | // ,{field: 'cstmrName', align: 'center',title: '客户', hide: true} |
| | | // ,{field: 'tel', align: 'center',title: '联系方式', hide: true} |
| | | // ,{field: 'operMemb', align: 'center',title: '操作人员'} |
| | | // ,{field: 'totalFee', align: 'center',title: '合计金额'} |
| | | // ,{field: 'discount', align: 'center',title: '优惠率', hide: true} |
| | | // ,{field: 'discountFee', align: 'center',title: '优惠金额', hide: true} |
| | | // ,{field: 'otherFee', align: 'center',title: '销售或采购费用合计', hide: true} |
| | | // ,{field: 'actFee', align: 'center',title: '实付金额', hide: true} |
| | | // ,{field: 'payType$', align: 'center',title: '付款类型'} |
| | | // ,{field: 'salesman', align: 'center',title: '业务员', hide: true} |
| | | // ,{field: 'accountDay', align: 'center',title: '结算天数', hide: true} |
| | | // ,{field: 'postFeeType$', align: 'center',title: '邮费支付类型', hide: true} |
| | | // ,{field: 'postFee', align: 'center',title: '邮费', hide: true} |
| | | // ,{field: 'payTime$', align: 'center',title: '付款时间', hide: true} |
| | | // ,{field: 'sendTime$', align: 'center',title: '发货时间', hide: true} |
| | | // ,{field: 'shipName', align: 'center',title: '物流名称', hide: true} |
| | | // ,{field: 'shipCode', align: 'center',title: '物流单号', hide: true} |
| | | // ,{field: 'settle$', align: 'center',title: '订单状态'} |
| | | // // ,{field: 'status$', align: 'center',title: '状态'} |
| | | // // ,{field: 'createBy$', align: 'center',title: '添加人员',event: 'createBy', style: 'cursor:pointer'} |
| | | // // ,{field: 'createTime$', align: 'center',title: '添加时间'} |
| | | // // ,{field: 'updateBy$', align: 'center',title: '修改人员',event: 'updateBy', style: 'cursor:pointer'} |
| | | // // ,{field: 'updateTime$', align: 'center',title: '修改时间'} |
| | | // // ,{field: 'memo', align: 'center',title: '备注'} |
| | | // |
| | | // ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:150} |
| | | // ]], |
| | | // 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+"/"; |
| | | // } |
| | | // pageCurr=curr; |
| | | // limit(); |
| | | // 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'; |
| | | // } |
| | | // }); |
| | | // } |
| | | // }); |
| | | // |
| | | // // 监听排序事件 |
| | | // table.on('sort(locMast)', function (obj) { |
| | | // var searchData = {}; |
| | | // $.each($('#search-box [name]').serializeArray(), function() { |
| | | // searchData[this.name] = this.value; |
| | | // }); |
| | | // searchData['orderByField'] = obj.field; |
| | | // searchData['orderByType'] = obj.type; |
| | | // tableIns.reload({ |
| | | // where: searchData, |
| | | // page: { |
| | | // curr: 1 |
| | | // }, |
| | | // done: function (res, curr, count) { |
| | | // if (res.code === 403) { |
| | | // top.location.href = baseUrl+"/"; |
| | | // } |
| | | // pageCurr=curr; |
| | | // limit(); |
| | | // } |
| | | // }); |
| | | // }); |
| | | // |
| | | // // 监听头工具栏事件 |
| | | // table.on('toolbar(order)', function (obj) { |
| | | // var checkStatus = table.checkStatus(obj.config.id); |
| | | // switch(obj.event) { |
| | | // case 'addData': |
| | | // layer.open({ |
| | | // type: 2, |
| | | // title: '新增', |
| | | // maxmin: true, |
| | | // area: [top.detailWidth, top.detailHeight], |
| | | // content: 'order_detail.html', |
| | | // success: function(layero, index){ |
| | | // layer.getChildFrame('#data-detail-submit-edit', index).hide(); |
| | | // clearFormVal(layer.getChildFrame('#detail', index)); |
| | | // layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); |
| | | // } |
| | | // }); |
| | | // break; |
| | | // case 'deleteData': |
| | | // var data = checkStatus.data; |
| | | // if (data.length === 0){ |
| | | // layer.msg('请选择数据'); |
| | | // } else { |
| | | // layer.confirm('确定删除'+(data.length===1?'此':data.length)+'条数据吗', function(){ |
| | | // $.ajax({ |
| | | // url: baseUrl+"/order/delete/auth", |
| | | // headers: {'token': localStorage.getItem('token')}, |
| | | // data: {param: JSON.stringify(data)}, |
| | | // method: 'POST', |
| | | // traditional:true, |
| | | // success: function (res) { |
| | | // if (res.code === 200){ |
| | | // layer.closeAll(); |
| | | // tableReload(false); |
| | | // } else if (res.code === 403){ |
| | | // top.location.href = baseUrl+"/"; |
| | | // } else { |
| | | // layer.msg(res.msg) |
| | | // } |
| | | // } |
| | | // }) |
| | | // }); |
| | | // } |
| | | // break; |
| | | // case 'exportData': |
| | | // layer.confirm('确定导出Excel吗', {shadeClose: true}, function(){ |
| | | // var titles=[]; |
| | | // var fields=[]; |
| | | // obj.config.cols[0].map(function (col) { |
| | | // if (col.type === 'normal' && col.hide === false && col.toolbar == null) { |
| | | // titles.push(col.title); |
| | | // fields.push(col.field); |
| | | // } |
| | | // }); |
| | | // var exportData = {}; |
| | | // $.each($('#search-box [name]').serializeArray(), function() { |
| | | // exportData[this.name] = this.value; |
| | | // }); |
| | | // var param = { |
| | | // 'order': exportData, |
| | | // 'fields': fields |
| | | // }; |
| | | // $.ajax({ |
| | | // url: baseUrl+"/order/export/auth", |
| | | // headers: {'token': localStorage.getItem('token')}, |
| | | // data: JSON.stringify(param), |
| | | // dataType:'json', |
| | | // contentType:'application/json;charset=UTF-8', |
| | | // method: 'POST', |
| | | // success: function (res) { |
| | | // layer.closeAll(); |
| | | // if (res.code === 200) { |
| | | // table.exportFile(titles,res.data,'xls'); |
| | | // } else if (res.code === 403) { |
| | | // top.location.href = baseUrl+"/"; |
| | | // } else { |
| | | // layer.msg(res.msg) |
| | | // } |
| | | // } |
| | | // }); |
| | | // }); |
| | | // break; |
| | | // } |
| | | // }); |
| | | // |
| | | // // 监听行工具事件 |
| | | // table.on('tool(order)', function(obj){ |
| | | // var data = obj.data; |
| | | // switch (obj.event) { |
| | | // // 详情 |
| | | // case 'detail': |
| | | // layer.open({ |
| | | // type: 2, |
| | | // title: '详情', |
| | | // maxmin: true, |
| | | // area: [top.detailWidth, top.detailHeight], |
| | | // shadeClose: true, |
| | | // content: 'order_detail.html', |
| | | // success: function(layero, index){ |
| | | // setFormVal(layer.getChildFrame('#detail', index), data, true); |
| | | // top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true); |
| | | // layer.getChildFrame('#data-detail-submit-save,#data-detail-submit-edit,#prompt', index).hide(); |
| | | // layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); |
| | | // layero.find('iframe')[0].contentWindow.layui.form.render('select'); |
| | | // layero.find('iframe')[0].contentWindow.layui.form.render('checkbox'); |
| | | // } |
| | | // }); |
| | | // break; |
| | | // // 编辑 |
| | | // case 'edit': |
| | | // layer.open({ |
| | | // type: 2, |
| | | // title: '修改', |
| | | // maxmin: true, |
| | | // area: [top.detailWidth, top.detailHeight], |
| | | // content: 'order_detail.html', |
| | | // success: function(layero, index){ |
| | | // layer.getChildFrame('#data-detail-submit-save', index).hide(); |
| | | // setFormVal(layer.getChildFrame('#detail', index), data, false); |
| | | // top.convertDisabled(layer.getChildFrame('#data-detail :input', index), false); |
| | | // top.convertDisabled(layer.getChildFrame('#id', index), true); |
| | | // layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); |
| | | // layero.find('iframe')[0].contentWindow.layui.form.render('select'); |
| | | // layero.find('iframe')[0].contentWindow.layui.form.render('checkbox'); |
| | | // } |
| | | // }); |
| | | // break; |
| | | // |
| | | // |
| | | // } |
| | | // }); |
| | | // |
| | | // // 数据保存动作 |
| | | // form.on('submit(save)', function () { |
| | | // if (banMsg != null){ |
| | | // layer.msg(banMsg); |
| | | // return; |
| | | // } |
| | | // method("add"); |
| | | // }); |
| | | // |
| | | // // 数据修改动作 |
| | | // form.on('submit(edit)', function () { |
| | | // method("update") |
| | | // }); |
| | | // |
| | | // function method(name){ |
| | | // var index = layer.load(1, { |
| | | // shade: [0.5,'#000'] //0.1透明度的背景 |
| | | // }); |
| | | // var data = { |
| | | // // id: $('#id').val(), |
| | | // id: $('#id').val(), |
| | | // uuid: $('#uuid').val(), |
| | | // orderNo: $('#orderNo').val(), |
| | | // orderTime: $('#orderTime').val(), |
| | | // docType: $('#docType').val(), |
| | | // itemId: $('#itemId').val(), |
| | | // allotItemId: $('#allotItemId').val(), |
| | | // defNumber: $('#defNumber').val(), |
| | | // number: $('#number').val(), |
| | | // cstmr: $('#cstmr').val(), |
| | | // cstmrName: $('#cstmrName').val(), |
| | | // tel: $('#tel').val(), |
| | | // operMemb: $('#operMemb').val(), |
| | | // totalFee: $('#totalFee').val(), |
| | | // discount: $('#discount').val(), |
| | | // discountFee: $('#discountFee').val(), |
| | | // otherFee: $('#otherFee').val(), |
| | | // actFee: $('#actFee').val(), |
| | | // payType: $('#payType').val(), |
| | | // salesman: $('#salesman').val(), |
| | | // accountDay: $('#accountDay').val(), |
| | | // postFeeType: $('#postFeeType').val(), |
| | | // postFee: $('#postFee').val(), |
| | | // payTime: top.strToDate($('#payTime\\$').val()), |
| | | // sendTime: top.strToDate($('#sendTime\\$').val()), |
| | | // shipName: $('#shipName').val(), |
| | | // shipCode: $('#shipCode').val(), |
| | | // settle: $('#settle').val(), |
| | | // status: $('#status').val(), |
| | | // createBy: $('#createBy').val(), |
| | | // createTime: top.strToDate($('#createTime\\$').val()), |
| | | // updateBy: $('#updateBy').val(), |
| | | // updateTime: top.strToDate($('#updateTime\\$').val()), |
| | | // memo: $('#memo').val(), |
| | | // |
| | | // }; |
| | | // $.ajax({ |
| | | // url: baseUrl+"/order/"+name+"/auth", |
| | | // headers: {'token': localStorage.getItem('token')}, |
| | | // data: top.reObject(data), |
| | | // method: 'POST', |
| | | // success: function (res) { |
| | | // if (res.code === 200){ |
| | | // parent.layer.closeAll(); |
| | | // parent.$(".layui-laypage-btn")[0].click(); |
| | | // $("#data-detail :input").each(function () { |
| | | // $(this).val(""); |
| | | // }); |
| | | // } else if (res.code === 403){ |
| | | // top.location.href = baseUrl+"/"; |
| | | // }else { |
| | | // layer.msg(res.msg) |
| | | // } |
| | | // layer.close(index); |
| | | // } |
| | | // }) |
| | | // } |
| | | // |
| | | // // 复选框事件 |
| | | // form.on('checkbox(detailCheckbox)', function (data) { |
| | | // var el = data.elem; |
| | | // if (el.checked) { |
| | | // $(el).val('Y'); |
| | | // } else { |
| | | // $(el).val('N'); |
| | | // } |
| | | // }); |
| | | // |
| | | // // 搜索栏搜索事件 |
| | | // form.on('submit(search)', function (data) { |
| | | // pageCurr = 1; |
| | |
| | | |
| | | }); |
| | | |
| | | // 关闭动作 |
| | | $(document).on('click','#data-detail-close', function () { |
| | | parent.layer.closeAll(); |
| | | }); |
| | | function right(){ |
| | | top.popupRight = top.layui.admin.popupRight({ |
| | | id: 'LAY_adminPopupLayerTest' |
| | | , area: '750px' |
| | | , type: 2 |
| | | , shade: [0.5,'#000'] |
| | | , content:'order/matQuery.html' |
| | | , success: function(){ |
| | | // $('#'+ this.id).html('<div style="padding: 20px;">放入内容</div>'); |
| | | //admin.view(this.id).render('system/xxx') |
| | | } |
| | | , end: function () { |
| | | $(".layui-laypage-btn")[0].click(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function tableReload(child) { |
| | | var searchData = {}; |
| | |
| | | where: searchData, |
| | | page: { |
| | | curr: pageCurr |
| | | }, |
| | | done: function (res, curr, count) { |
| | | if (res.code === 403) { |
| | | top.location.href = baseUrl+"/"; |
| | | } |
| | | pageCurr=curr; |
| | | if (res.data.length === 0 && count !== 0) { |
| | | tableIns.reload({ |
| | | where: searchData, |
| | | page: { |
| | | curr: pageCurr-1 |
| | | } |
| | | }); |
| | | pageCurr -= 1; |
| | | } |
| | | limit(child); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function setFormVal(el, data, showImg) { |
| | | for (var val in data) { |
| | | var find = el.find(":input[id='" + val + "']"); |
| | | if (find[0]!=null){ |
| | | if (find[0].type === 'checkbox'){ |
| | | if (data[val]==='Y'){ |
| | | find.attr("checked","checked"); |
| | | find.val('Y'); |
| | | } else { |
| | | find.remove("checked"); |
| | | find.val('N'); |
| | | } |
| | | continue; |
| | | } |
| | | } |
| | | find.val(data[val]); |
| | | if (showImg){ |
| | | var next = find.next(); |
| | | if (next.get(0)){ |
| | | if (next.get(0).localName === "img") { |
| | | find.hide(); |
| | | next.attr("src", data[val]); |
| | | next.show(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | function clearFormVal(el) { |
| | | $(':input', el) |
| | | .val('') |
| | | .removeAttr('checked') |
| | | .removeAttr('selected'); |
| | | } |
| | | |
| | | function detailScreen(index) { |
| | | var detail = layer.getChildFrame('#data-detail', index); |
| | | var height = detail.height()+60; |
| | | if (height > ($(window).height()*0.9)) { |
| | | height = ($(window).height()*0.8); |
| | | } |
| | | layer.style(index, { |
| | | // top: (($(window).height()-height)/3)+"px", |
| | | height: height+'px' |
| | | }); |
| | | } |
| | | |
| | | $('body').keydown(function () { |
| | | if (event.keyCode === 13) { |
| | | $("#search").click(); |
| | | } |
| | | }); |