Ext.define('make.view.make.makeScrap.FormPanel', { extend: 'saas.view.core.form.FormPanel', xtype: ['make-makescrap-formpanel', 'makescrap-formpanel'], controller: 'make-makescrap-formpanel', viewModel: 'make-makescrap-formpanel', viewName: 'make-makescrap-formpanel', caller: 'MakeScrap', //字段属性 _title: '生产报废单', _idField: 'id', _codeField: 'ms_code', _statusField: 'ms_status', _statusCodeField: 'ms_statuscode', _auditmanField: 'ms_auditman', _auditdateField: 'ms_auditdate', _relationColumn: 'md_piid', _readUrl: '/api/make/makescrap/read', _saveUrl: '/api/make/makescrap/save', _auditUrl: '/api/make/makescrap/audit', _unAuditUrl: '/api/make/makescrap/unAudit', _deleteUrl: '/api/make/makescrap/delete', // _turnOutUrl: '/api/purchase/prodinout/turnPurchaseOut', initId: 0, initComponent: function () { var currentDepart = saas.util.BaseUtil.getCurrentUserDepart(); Ext.apply(this, { toolBtns: [], defaultItems: [{ xtype: 'hidden', name: 'id', fieldLabel: 'id', allowBlank: true, columnWidth: 0 }, { xtype: "datefield", name: "makescrap.createTime", fieldLabel: "单据日期", defaultValue: new Date() }, { xtype: "hidden", name: "ms_class", fieldLabel: "单据类型", readOnly: true, allowBlank: true, defaultValue: '生产报废', columnWidth: 0.25 }, { xtype: 'departDbfindTrigger', name: 'ms_departmentname', fieldLabel: '部门名称', allowBlank: false, columnWidth: 0.25, defaultValue: currentDepart.dp_name }, { xtype: 'hidden', name: 'ms_departmentcode', fieldLabel: '部门编号', allowBlank: true, defaultValue: currentDepart.dp_code },{ name: "detailGridField", xtype: "detailGridField", storeModel: 'make.model.make.MakeScrapDetail', deleteDetailUrl: '/api/make/makescrap/deleteDetail', relativeBinds:{ refFields:['md_maid'], fields:['md_prodcode','pr_detail'] }, detnoColumn: 'md_detno', columns: [{ text: "id", dataIndex: "id", xtype: "numbercolumn", hidden: true },{ text: "制造单号", dataIndex: "md_macode", width: 150.0, allowBlank: false, editor: { displayField: "display", editable: true, format: "", hideTrigger: false, maxLength: 100.0, minValue: null, positiveNum: false, store: null, valueField: "value", xtype: "makeMultiDbfindTrigger", caller: 'MakeReturn' } },{ text: "工单序号", dataIndex: "md_mmdetno", allowBlank: false, align: 'center', width: 80 },{ text: "工单id", dataIndex: "md_maid", xtype: "numbercolumn", hidden: true },{ text: "用料表id", dataIndex: "md_mmid", xtype: "numbercolumn", hidden: true }, { text: "物料id", dataIndex: "md_prodid", xtype: "numbercolumn", hidden: true }, { text: "物料编号", width: 150.0, dataIndex: "md_prodcode", xtype: "", items: null }, { text: "物料名称", width: 150.0, dataIndex: "pr_detail", ignore: true, renderer: function (v, m, r) { if (!v) { return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null; } return v; } }, { text: "厂家/品牌", hidden:true, width: 100.0, dataIndex: "pr_brand", ignore: true, renderer: function (v, m, r) { if (!v) { return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null; } return v; } }, { text: "型号", width: 200.0, dataIndex: "pr_orispeccode", ignore: true, renderer: function (v, m, r) { var str = ''; if(r.data["productDTO"] ){ if(r.data["productDTO"]['pr_brand']){ str += '厂家/品牌:'+ r.data["productDTO"]['pr_brand'] + '
'; } if(r.data["productDTO"]['pr_spec']){ str += '规格:' + r.data["productDTO"]['pr_spec']; } if(str) m.tdAttr = 'data-qtip="'+ str +'"'; if (!v) { return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null; } } return v; } }, { text: "单位", width: 65.0, dataIndex: "pr_unit", ignore: true, renderer: function (v, m, r) { if (!v) { return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null; } return v; } },{ text: "报废数量", dataIndex: "md_qty", xtype: 'numbercolumn', width: 110.0, allowBlank: false, editor: { xtype: "numberfield", decimalPrecision: 6, minValue: 0 }, renderer: function(v, m, r) { return saas.util.BaseUtil.numberFormat(v, 6, true); }, summaryType: 'sum', summaryRenderer: function(v, d, f, m) { return saas.util.BaseUtil.numberFormat(v, 6, true); } }, { text: 'model映射需要', dataIndex: 'productDTO', hidden: true, }, { text: "报废原因", dataIndex: "md_reason", width: 250, items: null, editor: { xtype: "textfield" } }, { text: "成本单价(元)", xtype: 'numbercolumn', width: 120, dataIndex: "md_price", renderer: function(v, m, r) { return saas.util.BaseUtil.numberFormat(v, 8, true); } }, { text: "金额(元)", xtype: 'numbercolumn', dataIndex: "md_total", width: 120, renderer: function(v, m, r) { return saas.util.BaseUtil.numberFixFormat(v, 2, true); }, summaryType: 'sum', summaryRenderer: function(v, d, f, m) { return saas.util.BaseUtil.numberFixFormat(v, 2, true); } }, { text: "备注", dataIndex: "md_remark", width: 250, items: null, editor: { xtype: "textfield" } }, { text: "物料规格", hidden:true, width: 200, dataIndex: "pr_spec", ignore: true, renderer: function (v, m, r) { if (!v) { return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null; } return v; } }, { dataIndex: "md_text1", text: "自定义字段1", width: 100, hidden: true, initHidden: false, editor: { xtype: "textfield" }, }, { dataIndex: "md_text2", text: "自定义字段2", width: 100, hidden: true, initHidden: false, editor: { xtype: "textfield" }, }, { dataIndex: "md_text3", text: "自定义字段3", width: 100, hidden: true, initHidden: false, editor: { xtype: "textfield" }, }, { dataIndex: "md_text4", text: "自定义字段4", width: 100, hidden: true, initHidden: false, editor: { xtype: "textfield" }, }, { dataIndex: "md_text5", text: "自定义字段5", width: 100, hidden: true, initHidden: false, editor: { xtype: "textfield" }, }] }, { xtype: "textfield", name: "ms_remark", fieldLabel: "备注", columnWidth: 1 }, { xtype: "hidden", name: "creatorId", fieldLabel: "录入人ID", readOnly: true }, { xtype: "textfield", name: "creatorName", fieldLabel: "录入人", readOnly: true, columnWidth: 0.3 }, { xtype: "hidden", name: "createTime", fieldLabel: "录入日期", readOnly: true, defaultValue: new Date() }, { xtype: "hidden", name: "updaterId", fieldLabel: "更新人ID", readOnly: true }, { xtype: "hidden", name: "updaterName", fieldLabel: "更新人", readOnly: true }, { xtype: "hidden", name: "updateTime", fieldLabel: "更新日期", readOnly: true, defaultValue: new Date() }, { xtype: "textfield", name: "ms_auditman", fieldLabel: "审核人", columnWidth: 0.3, readOnly: true }, { xtype: "displayfield", name: "ms_amount", fieldLabel: "金额(元)", labelWidth:200, labelAlign : 'right', columnWidth: 0.4, thousandSeparator: ',', renderer: function (v){ if(!v){ v=0; } return '

'+saas.util.BaseUtil.numberFixFormat(v, 2, true)+'' }, readOnly: true }, { xtype: "hidden", name: "ms_auditdate", fieldLabel: "审核日期", readOnly: true }, { xtype: "textfield", name: "ms_text1", fieldLabel: "自定义字段1", hidden: true, initHidden: false }, { xtype: "textfield", name: "ms_text2", fieldLabel: "自定义字段2", hidden: true, initHidden: false }, { xtype: "textfield", name: "ms_text3", fieldLabel: "自定义字段3", hidden: true, initHidden: false }, { xtype: "textfield", name: "ms_text4", fieldLabel: "自定义字段4", hidden: true, initHidden: false }, { xtype: "textfield", name: "ms_text5", fieldLabel: "自定义字段5", hidden: true, initHidden: false }], }); this.callParent(arguments); }, /*beforeAudit: function () { var me = this, viewModel = me.getViewModel(), grid = me.down('detailGridField'), data = grid.getTrueData(); Ext.Array.each(data, function (item) { if (item.md_price == 0) { saas.util.BaseUtil.showErrorToast(item.md_pdno + '行' + item.md_prodcode + '物料单价为0'); } }); return true; }*/ });