| | |
| | | cols: [[ |
| | | {type: 'numbers'}, |
| | | {field: 'orderNo', title: '单据编号', templet: '#orderNoTpl'}, |
| | | { field: 'orderTime', align: 'center', title: '业务时间' }, |
| | | { field: 'cstmrName', align: 'center', title: '客户' }, |
| | | {field: 'docType$', align: 'center', title: '类型', minWidth: 160, width: 160}, |
| | | {align: 'center', title: '明细', toolbar: '#tbLook', minWidth: 160, width: 160}, |
| | | {field: 'createTime$', title: '创建时间', minWidth: 200, width: 200}, |
| | |
| | | if (expTpe) { |
| | | $('#orderNo').attr("disabled", "disabled"); |
| | | } |
| | | // 初始化业务时间日期选择器 |
| | | layDate.render({ |
| | | elem: '#orderTime', |
| | | type: 'datetime', |
| | | format: 'yyyy-MM-dd HH:mm:ss' |
| | | }); |
| | | // 初始化客户选择器 |
| | | var cstmrData = []; |
| | | $.ajax({ |
| | | url: baseUrl + "/client/list/auth", |
| | | headers: { 'token': localStorage.getItem('token') }, |
| | | data: { limit: 9999 }, |
| | | method: 'POST', |
| | | async: false, |
| | | success: function (res) { |
| | | if (res.code === 200) { |
| | | // 转换为 xmSelect 需要的格式 |
| | | res.data.records.forEach(function (item) { |
| | | cstmrData.push({ |
| | | name: item.name, |
| | | value: item.code |
| | | }); |
| | | }); |
| | | } else { |
| | | layer.msg(res.msg, { icon: 2 }); |
| | | } |
| | | } |
| | | }); |
| | | var cstmrXmSelect = xmSelect.render({ |
| | | el: '#cstmrSelect', |
| | | radio: true, |
| | | clickClose: true, |
| | | filterable: true, |
| | | create: function (val, arr) { |
| | | if (arr.length === 0) { |
| | | return { |
| | | name: val, |
| | | value: val |
| | | } |
| | | } |
| | | }, |
| | | model: { |
| | | icon: 'hidden', |
| | | label: { |
| | | type: 'text', |
| | | } |
| | | }, |
| | | data: cstmrData, |
| | | initValue: expTpe && expTpe.cstmr ? [expTpe.cstmr] : [] |
| | | }); |
| | | // 表单提交事件 |
| | | form.on('submit(orderEditSubmit)', function (data) { |
| | | // 验证客户必选 |
| | | if (!cstmrXmSelect.getValue()[0]) { |
| | | layer.msg('请选择客户', { icon: 2 }); |
| | | return false; |
| | | } |
| | | // 组装数据 |
| | | if (xxDataList.length <= 0) { |
| | | layer.tips('请添加单据明细', '#matAddBtnComment', {tips: [1, '#ff4c4c']}); |
| | |
| | | orderId: Number(data.field.id), |
| | | docType: Number(data.field.docType), |
| | | orderNo: data.field.orderNo, |
| | | cstmrName: cstmrXmSelect.getValue()[0] ? cstmrXmSelect.getValue()[0].name : null, |
| | | orderTime: data.field.orderTime, |
| | | orderDetlPakoutList: nList |
| | | }), |
| | | contentType:'application/json;charset=UTF-8', |