Ext.define('saas.view.sale.saleIn.FormPanel', { extend: 'saas.view.core.form.FormPanel', xtype: 'sale-salein-formpanel', controller: 'sale-salein-formpanel', viewModel: 'sale-salein-formpanel', viewName: 'sale-salein-formpanel', caller: 'SaleIn', //字段属性 _title: '销售退货单', _idField: 'id', _codeField: 'pi_inoutno', _statusField: 'pi_status', _statusCodeField: 'pi_statuscode', _auditmanField: 'pi_auditman', _auditdateField: 'pi_auditdate', _relationColumn: 'pd_piid', _readUrl: '/api/sale/prodinout/read', _saveUrl: '/api/sale/prodinout/save', _auditUrl: '/api/sale/prodinout/audit', _unAuditUrl: '/api/sale/prodinout/unAudit', _deleteUrl: '/api/sale/prodinout/delete', _turnInUrl: '/api/sale/prodinout/turnProdIn', initId: 0, initComponent: function () { Ext.apply(this, { defaultItems: [{ xtype: 'hidden', name: 'id', fieldLabel: 'id' }, { xtype: "hidden", name: "pi_class", fieldLabel: "单据类型", readOnly: true, allowBlank: false, defaultValue: '销售退货单', allowBlank: false }, { xtype: "hidden", name: "pi_custid", fieldLabel: "客户ID" }, { xtype: "hidden", name: "pi_custcode", fieldLabel: "客户编号" }, { xtype: "customerDbfindTrigger", name: "pi_custname", fieldLabel: "客户名称", allowBlank: false, columnWidth: 0.5, setValue: function (value) { var me = this, bind, valueBind; var form = me.ownerCt; var c = form.down('[name=pi_address]'); if (value && value != '') { c.setDisabled(false); } else { c.setDisabled(true); } if (me.hasFocus) { bind = me.getBind(); valueBind = bind && bind.value; if (valueBind && valueBind.syncing) { if ((Ext.isEmpty(value) && Ext.isEmpty(me.value)) || value === me.value) { return me; } else if (Ext.isArray(value) && Ext.isArray(me.value) && Ext.Array.equals(value, me.value)) { return me; } } } else { me.lastSelectedRecords = null; } if (value != null) { me.doSetValue(value); } else { me.suspendEvent('select'); me.valueCollection.beginUpdate(); me.pickerSelectionModel.deselectAll(); me.valueCollection.endUpdate(); me.resumeEvent('select'); } return me; } }, { xtype: 'condbfindtrigger', fieldLabel: '币别汇率', allowBlank: false, dbType: 'currencyDbfindTrigger', dbfinds: [{ from: 'cr_name', to: 'pi_currency' }, { from: 'cr_rate', to: 'pi_rate' }], defaultValue: { pi_currency: 'RMB', pi_rate: 1 }, supFieldConfig: { xtype: 'numberfield', readOnly: false, defaultReadOnly: false, defaultValue: 1, decimalPrecision: 6, vtype: 'positiveNumber' } }, { xtype: "datefield", name: "pi_date", fieldLabel: "单据日期", allowBlank: false, columnWidth: 0.25, defaultValue: new Date() }, { columnWidth: 0.5, name: "pi_address", xtype: "remotecombo", fieldLabel: "交货地址", editable: false, allowBlank: false, storeUrl: '/api/document/customer/getAddressCombo', hiddenBtn: true, //true 则会关闭新增按钮功能 },{ name: "detailGridField", xtype: "detailGridField", detnoColumn: 'pd_pdno', storeModel: 'saas.model.sale.SaleInDetail', deleteDetailUrl: '/api/sale/prodinout/deleteDetail', columns: [{ text: "id", dataIndex: "id", xtype: "numbercolumn", hidden: true }, { text: "物料id", dataIndex: "pd_prodid", width: 0 }, { text: "物料编号", width: 150.0, dataIndex: "pd_prodcode", allowBlank: false, editor: { displayField: "display", editable: true, format: "", hideTrigger: false, maxLength: 100.0, minValue: null, positiveNum: false, queryMode: "local", store: null, valueField: "value", xtype: "productMultiDbfindTrigger" } }, { text: 'model映射需要', dataIndex: 'productDTO', hidden: true, }, { text: "品牌", 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: 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: "型号", width: 200.0, dataIndex: "pr_orispeccode", 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, 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; } }, { text: "仓库ID", dataIndex: "pd_whid", width: 0 }, { text: "仓库", width: 110.0, dataIndex: "pd_whcode", hidden: true }, { text: "仓库", dataIndex: "pd_whname", allowBlank: false, width: 110.0, editor: { displayField: "display", editable: true, format: "", hideTrigger: false, maxLength: 100.0, minValue: null, positiveNum: false, queryMode: "local", store: null, valueField: "value", xtype: "warehouseDbfindTrigger" } }, { text: "数量", xtype: 'numbercolumn', dataIndex: "pd_inqty", width: 110.0, allowBlank: false, editor: { xtype: "numberfield", decimalPrecision: 3, minValue: 0 }, renderer: function(v, m, r) { return saas.util.BaseUtil.numberFormat(v, 3, false); }, summaryType: 'sum', summaryRenderer: function(v, d, f, m) { return saas.util.BaseUtil.numberFormat(v, 3, false); } }, { 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: "单价(元)", xtype: 'numbercolumn', dataIndex: "pd_netprice", width: 120, editor: { xtype: "numberfield", decimalPrecision: 4, minValue: 0 }, renderer: function(v, m, r) { return saas.util.BaseUtil.numberFormat(v, 4, true); }, }, { text: "含税单价(元)", xtype: 'numbercolumn', dataIndex: "pd_sendprice", width: 120, editor: { xtype: "numberfield", decimalPrecision: 4, minValue: 0 }, renderer: function(v, m, r) { return saas.util.BaseUtil.numberFormat(v, 4, true); }, listeners: { edit: function (value, grid) { var r = grid.getSelection()[0], pd_taxrate = r.get('pd_taxrate'); var v = value / (1 + pd_taxrate / 100); r.set('pd_netprice', Number(saas.util.BaseUtil.numberFormat(v, 4, false))); } } }, { text: "金额(元)", xtype: 'numbercolumn', dataIndex: "pd_nettotal", width: 120, renderer: function(v, m, r) { return saas.util.BaseUtil.numberFormat(v, 2, true); }, summaryType: 'sum', summaryRenderer: function(v, d, f, m) { return saas.util.BaseUtil.numberFormat(v, 2, true); } }, { text: "税率(%)", xtype: 'numbercolumn', dataIndex: "pd_taxrate", width: 80, editor: { xtype: "numberfield", decimalPrecision: 0, minValue: 0, maxValue: 100 }, renderer: function(v, m, r) { return saas.util.BaseUtil.numberFormat(v, 2, false); } }, { text: "税额(元)", xtype: 'numbercolumn', dataIndex: "pd_taxamount", width: 120, renderer: function(v, m, r) { return saas.util.BaseUtil.numberFormat(v, 2, true); }, summaryType: 'sum', summaryRenderer: function(v, d, f, m) { return saas.util.BaseUtil.numberFormat(v, 2, true); } }, { text: "价税合计(元)", xtype: 'numbercolumn', dataIndex: "pd_ordertotal", width: 120, renderer: function(v, m, r) { return saas.util.BaseUtil.numberFormat(v, 2, true); }, summaryType: 'sum', summaryRenderer: function(v, d, f, m) { return saas.util.BaseUtil.numberFormat(v, 2, true); } }, { text: "关联出货单号", dataIndex: "pd_iocode", xtype: "numbercolumn", width: 110.0, format: '0', ignore: true, renderer: function(v, m, r) { return v ? v : null; } }, { text: "备注", dataIndex: "pd_remark", width: 250, items: null, editor: { xtype: "textfield" }, }, { dataIndex: "pd_text1", text: "自定义字段1", width: 100, hidden: true, initHidden: false, editor: { xtype: "textfield" }, }, { dataIndex: "pd_text2", text: "自定义字段2", width: 100, hidden: true, initHidden: false, editor: { xtype: "textfield" }, }, { dataIndex: "pd_text3", text: "自定义字段3", width: 100, hidden: true, initHidden: false, editor: { xtype: "textfield" }, }, { dataIndex: "pd_text4", text: "自定义字段4", width: 100, hidden: true, initHidden: false, editor: { xtype: "textfield" }, }, { dataIndex: "pd_text5", text: "自定义字段5", width: 100, hidden: true, initHidden: false, editor: { xtype: "textfield" }, }] }, { xtype: "textfield", name: "pi_remark", fieldLabel: "备注", columnWidth: 1 }, { xtype: "numberfield", name: "pi_nettotal", fieldLabel: "金额(元)", thousandSeparator: ',', readOnly: true }, { xtype: "numberfield", name: "pi_total", fieldLabel: "价税合计(元)", thousandSeparator: ',', readOnly: true }, { xtype: "employeeDbfindTrigger", name: "pi_seller", fieldLabel: "业务员" }, { xtype: "hidden", name: "pi_sellerid", fieldLabel: "业务员ID" }, { xtype: "hidden", name: "pi_sellercode", fieldLabel: "业务员编号", }, { xtype: "hidden", name: "creatorId", fieldLabel: "录入人ID", readOnly: true }, { xtype: "textfield", name: "creatorName", fieldLabel: "录入人", readOnly: true }, { xtype: "datefield", 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: "pi_auditman", fieldLabel: "审核人", readOnly: true }, { xtype: "datefield", name: "pi_auditdate", fieldLabel: "审核日期", readOnly: true }, { xtype: "textfield", name: "pi_text1", fieldLabel: "自定义字段1", hidden: true, initHidden: false }, { xtype: "textfield", name: "pi_text2", fieldLabel: "自定义字段2", hidden: true, initHidden: false }, { xtype: "textfield", name: "pi_text3", fieldLabel: "自定义字段3", hidden: true, initHidden: false }, { xtype: "textfield", name: "pi_text4", fieldLabel: "自定义字段4", hidden: true, initHidden: false }, { xtype: "textfield", name: "pi_text5", fieldLabel: "自定义字段5", hidden: true, initHidden: false }] }); this.callParent(arguments); }, });