| | |
| | | var pageCurr; |
| | | layui.use(['table','laydate', 'form'], function(){ |
| | | layui.use(['table','laydate', 'form','upload'], function(){ |
| | | var table = layui.table; |
| | | var $ = layui.jquery; |
| | | var layer = layui.layer; |
| | | var layDate = layui.laydate; |
| | | var upload = layui.upload; |
| | | var form = layui.form; |
| | | |
| | | // 数据渲染 |
| | |
| | | ,{field: 'matName', align: 'center',title: '物料名称'} |
| | | ,{field: 'str1', align: 'center',title: '物料单位'} |
| | | ,{field: 'str2', align: 'center',title: '物料规格'} |
| | | ,{field: 'str3', align: 'center',title: ''} |
| | | ,{field: 'str4', align: 'center',title: ''} |
| | | ,{field: 'str5', align: 'center',title: ''} |
| | | ,{field: 'str6', align: 'center',title: ''} |
| | | ,{field: 'str7', align: 'center',title: ''} |
| | | ,{field: 'str8', align: 'center',title: ''} |
| | | ,{field: 'str9', align: 'center',title: ''} |
| | | ,{field: 'str10', align: 'center',title: ''} |
| | | ,{field: 'str11', align: 'center',title: ''} |
| | | ,{field: 'str12', align: 'center',title: ''} |
| | | ,{field: 'str13', align: 'center',title: ''} |
| | | ,{field: 'str14', align: 'center',title: ''} |
| | | ,{field: 'str15', align: 'center',title: ''} |
| | | ,{field: 'str16', align: 'center',title: ''} |
| | | ,{field: 'str17', align: 'center',title: ''} |
| | | ,{field: 'str18', align: 'center',title: ''} |
| | | ,{field: 'str19', align: 'center',title: ''} |
| | | ,{field: 'str20', align: 'center',title: ''} |
| | | ,{field: 'str21', align: 'center',title: ''} |
| | | ,{field: 'str22', align: 'center',title: ''} |
| | | ,{field: 'str23', align: 'center',title: ''} |
| | | ,{field: 'num1', align: 'center',title: ''} |
| | | ,{field: 'num2', align: 'center',title: ''} |
| | | ,{field: 'num3', align: 'center',title: ''} |
| | | ,{field: 'num4', align: 'center',title: ''} |
| | | ,{field: 'num5', align: 'center',title: ''} |
| | | ,{field: 'num6', align: 'center',title: ''} |
| | | ,{field: 'date1$', align: 'center',title: ''} |
| | | ,{field: 'appeUser$', align: 'center',title: '创建者',event: 'appeUser', style: 'cursor:pointer'} |
| | | ,{field: 'appeTime$', align: 'center',title: '添加时间'} |
| | | ,{field: 'modiUser$', align: 'center',title: '修改人员',event: 'modiUser', style: 'cursor:pointer'} |
| | | ,{field: 'modiTime$', align: 'center',title: '修改时间'} |
| | | ,{field: 'status', align: 'center',title: ''} |
| | | // ,{field: 'str3', align: 'center',title: ''} |
| | | // ,{field: 'str4', align: 'center',title: ''} |
| | | // ,{field: 'str5', align: 'center',title: ''} |
| | | // ,{field: 'str6', align: 'center',title: ''} |
| | | // ,{field: 'str7', align: 'center',title: ''} |
| | | // ,{field: 'str8', align: 'center',title: ''} |
| | | // ,{field: 'str9', align: 'center',title: ''} |
| | | // ,{field: 'str10', align: 'center',title: ''} |
| | | // ,{field: 'str11', align: 'center',title: ''} |
| | | // ,{field: 'str12', align: 'center',title: ''} |
| | | // ,{field: 'str13', align: 'center',title: ''} |
| | | // ,{field: 'str14', align: 'center',title: ''} |
| | | // ,{field: 'str15', align: 'center',title: ''} |
| | | // ,{field: 'str16', align: 'center',title: ''} |
| | | // ,{field: 'str17', align: 'center',title: ''} |
| | | // ,{field: 'str18', align: 'center',title: ''} |
| | | // ,{field: 'str19', align: 'center',title: ''} |
| | | // ,{field: 'str20', align: 'center',title: ''} |
| | | // ,{field: 'str21', align: 'center',title: ''} |
| | | // ,{field: 'str22', align: 'center',title: ''} |
| | | // ,{field: 'str23', align: 'center',title: ''} |
| | | // ,{field: 'num1', align: 'center',title: ''} |
| | | // ,{field: 'num2', align: 'center',title: ''} |
| | | // ,{field: 'num3', align: 'center',title: ''} |
| | | // ,{field: 'num4', align: 'center',title: ''} |
| | | // ,{field: 'num5', align: 'center',title: ''} |
| | | // ,{field: 'num6', align: 'center',title: ''} |
| | | // ,{field: 'date1$', align: 'center',title: ''} |
| | | // ,{field: 'appeUser$', align: 'center',title: '创建者',event: 'appeUser', style: 'cursor:pointer'} |
| | | // ,{field: 'appeTime$', align: 'center',title: '添加时间'} |
| | | // ,{field: 'modiUser$', align: 'center',title: '修改人员',event: 'modiUser', style: 'cursor:pointer'} |
| | | // ,{field: 'modiTime$', align: 'center',title: '修改时间'} |
| | | // ,{field: 'status', align: 'center',title: ''} |
| | | |
| | | ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:150} |
| | | ]], |
| | |
| | | }); |
| | | } |
| | | break; |
| | | // 导出 |
| | | case 'exportData': |
| | | layer.confirm('确定导出Excel吗', function(){ |
| | | layer.confirm('确定导出Excel吗', {shadeClose: true,}, function(){ |
| | | var titles=[]; |
| | | var fields=[]; |
| | | obj.config.cols[0].map(function (col) { |
| | |
| | | url: baseUrl+"/matCode/export/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: JSON.stringify(param), |
| | | dataType:'json', |
| | | // 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) |
| | | } |
| | | // 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; |
| | | // 导入 |
| | | case 'intoData': |
| | | layer.open({ |
| | | type: 1, |
| | | title: '数据导入', |
| | | shadeClose: true, |
| | | content: $('#importDataDiv'), |
| | | success: function(layero, index){ |
| | | uploader.reload(); |
| | | }, |
| | | end: function () { |
| | | $('#uploadDesc').show(); |
| | | $('#uploadDemoView').hide(); |
| | | $('#fileMame').html(""); |
| | | } |
| | | }); |
| | | break; |
| | | } |
| | | }); |
| | | |
| | | // 导入excel |
| | | var uploader = upload.render({ |
| | | elem: '#uploadEx' |
| | | , url: baseUrl + '/matCode/import/auth' |
| | | , headers: {token: localStorage.getItem('token')} |
| | | , accept: 'file' |
| | | , exts: 'xls|excel|xlsx' |
| | | , auto: false |
| | | , bindAction: '#uploadDo' |
| | | , before: function(obj){ |
| | | layer.closeAll(); |
| | | layer.load(1, {shade: [0.1,'#fff']}); |
| | | } |
| | | , choose: function(obj){ |
| | | $('#uploadDesc').hide(); |
| | | $('#uploadDemoView').show(); |
| | | obj.preview(function(index, file, result){ |
| | | $('#fileMame').html(file.name); |
| | | }); |
| | | } |
| | | , done: function (res) { |
| | | limit(); |
| | | $('#uploadDesc').show(); |
| | | $('#uploadDemoView').hide(); |
| | | $('#fileMame').html(""); |
| | | layer.closeAll('loading'); |
| | | layer.msg(res.msg); |
| | | } |
| | | , error: function(index, upload){ |
| | | layer.closeAll('loading'); |
| | | } |
| | | }) |
| | | |
| | | // 监听行工具事件 |
| | | table.on('tool(matCode)', function(obj){ |
| | | var data = obj.data; |