| | |
| | | var pageCurr; |
| | | layui.config({ |
| | | base: baseUrl + "/static/layui/lay/modules/" |
| | | }).use(['table','laydate', 'form', 'admin'], function(){ |
| | | }).use(['table','laydate', 'form', 'admin', 'treeTable', 'xmSelect'], function(){ |
| | | var table = layui.table; |
| | | var $ = layui.jquery; |
| | | var layer = layui.layer; |
| | |
| | | limit(); |
| | | } |
| | | }); |
| | | |
| | | var insTb = layui.treeTable.render({ |
| | | elem: '#node', |
| | | url: baseUrl+'/node/tree/auth', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | height: 'full-200', |
| | | tree: { |
| | | iconIndex: 2, // 折叠图标显示在第几列 |
| | | isPidData: true, // 是否是id、pid形式数据 |
| | | idName: 'id', // id字段名称 |
| | | pidName: 'parentId' // pid字段名称 |
| | | }, |
| | | cols: [[ |
| | | {type: 'checkbox'} |
| | | ,{type: 'numbers'} |
| | | ,{field: 'name', align: 'left',title: '名称', minWidth: 150} |
| | | ,{field: 'type$', align: 'center',title: '类型'} |
| | | ,{field: 'leading', align: 'center',title: '负责人'} |
| | | ,{field: 'sort', align: 'center',title: '排序', hide: true} |
| | | ,{field: 'status$', align: 'center',title: '状态'} |
| | | ,{field: 'updateTime$', align: 'center',title: '修改时间'} |
| | | ,{field: 'updateBy$', align: 'center',title: '修改人员', hide: true} |
| | | ,{field: 'memo', align: 'center',title: '备注', hide: true} |
| | | ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:150} |
| | | ]], |
| | | done: function (data) { |
| | | $('.ew-tree-table-box').css('height', '100%'); |
| | | insTb.expandAll(); |
| | | } |
| | | }); |
| | | /* 显示表单弹窗 */ |
| | | function showNodeSelect() { |
| | | admin.open({ |
| | | type: 1, |
| | | area: '400px', |
| | | title: '选择入库货位', |
| | | content: $('#nodeSelect').html(), |
| | | success: function (layero, dIndex) { |
| | | // 表单提交事件 |
| | | form.on('submit(pakin)', function (data) { |
| | | data.field.nodeSel = insXmSel.getValue('valueStr'); |
| | | var loadIndex = layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl+"/work/stock/pakin", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: JSON.stringify({ |
| | | nodeId: data.field.nodeSel, |
| | | mats: matCodeData |
| | | }), |
| | | contentType:'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.close(loadIndex); |
| | | if (res.code === 200){ |
| | | layer.close(dIndex); |
| | | matCodeData = []; |
| | | tableIns.reload({data: matCodeData}); |
| | | limit(); |
| | | layer.msg(res.msg, {icon: 1}); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | // 渲染下拉树 |
| | | var insXmSel = layui.xmSelect.render({ |
| | | el: '#nodeSels', |
| | | height: '250px', |
| | | data: insTb.options.data, |
| | | initValue: [], |
| | | model: {label: {type: 'text'}}, |
| | | prop: { |
| | | name: 'name', |
| | | value: 'id' |
| | | }, |
| | | radio: true, |
| | | clickClose: true, |
| | | tree: { |
| | | show: true, |
| | | indent: 15, |
| | | strict: false, |
| | | expandedKeys: true |
| | | } |
| | | }); |
| | | // 弹窗不出现滚动条 |
| | | $(layero).children('.layui-layer-content').css('overflow', 'visible'); |
| | | layui.form.render('select'); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // 监听排序事件 |
| | | table.on('sort(receiveDetl)', function (obj) { |
| | |
| | | case "add": |
| | | // showEditModel(data); |
| | | startIn(data); |
| | | break; |
| | | case "chooseLoc": |
| | | showNodeSelect(); |
| | | break; |
| | | } |
| | | }); |
| | |
| | | page: {curr: pageCurr} |
| | | }); |
| | | } |
| | | |