| | |
| | | var cols = [ |
| | | {type: 'checkbox'} |
| | | ,{field: 'tagId$', align: 'center',title: '归类', templet: '#tagTpl'} |
| | | ,{field: 'store_max', align: 'center',title: '库存上限',hide:true} |
| | | ,{field: 'store_min', align: 'center',title: '库存下限',hide:true} |
| | | ,{field: 'store_max_date', align: 'center',title: '库龄上限(天)',hide:true} |
| | | ]; |
| | | cols.push.apply(cols, matCols); |
| | | cols.push( |
| | |
| | | case 'edit': |
| | | showEditModel(data) |
| | | break; |
| | | case 'editBarcode': |
| | | showEditModelBarcode(data) |
| | | break; |
| | | } |
| | | }); |
| | | |
| | |
| | | }); |
| | | } |
| | | |
| | | /* 显示表单弹窗 */ |
| | | function showEditModelBarcode(mData) { |
| | | admin.open({ |
| | | type: 1, |
| | | area: '600px', |
| | | title: '绑定商品', |
| | | content: $('#editDialogBarcode').html(), |
| | | success: function (layero, dIndex) { |
| | | // 回显表单数据 |
| | | form.val('detail', mData); |
| | | // 表单提交事件 |
| | | form.on('submit(editSubmit)', function (data) { |
| | | console.log(data) |
| | | data.field.tagId = insXmSel.getValue('valueStr'); |
| | | if (isEmpty(data.field.tagId)) { |
| | | layer.msg('分类不能为空', {icon: 2}); |
| | | return false; |
| | | } |
| | | var loadIndex = layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl+"/mat/barcode/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}); |
| | | $(".layui-laypage-btn")[0].click(); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | // 渲染下拉树 |
| | | var insXmSel = xmSelect.render({ |
| | | el: '#tagSelBarcode', |
| | | height: '250px', |
| | | data: insTb.options.data, |
| | | initValue: mData ? [mData.tagId] : [], |
| | | 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'); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // 模板选择 |
| | | form.on('radio(selectTemplateRadio)', function (data) { |
| | | $('.template-preview').hide(); |