Ext.define('saas.view.document.customer.FormPanel', { extend: 'saas.view.core.form.FormPanel', xtype: 'document-customer-formpanel', controller: 'document-customer-formpanel', viewModel: 'document-customer-formpanel', caller:'Customer', //字段属性 _title:'客户资料', _idField: 'id', _codeField: 'cu_code', _statusField: 'cu_status', _statusCodeField: 'cu_statuscode', _readUrl:'/api/document/customer/read', _saveUrl:'/api/document/customer/save', _openUrl:'/api/document/customer/open', _closeUrl:'/api/document/customer/close', _deleteUrl:'/api/document/customer/delete', initId:0, codeInHeader: false, defaultItems: [{ xtype: 'hidden', name: 'id', fieldLabel: 'id', allowBlank: true, columnWidth: 0.25, group: '基础信息', },{ xtype: 'textfield', name: 'cu_code', fieldLabel: '客户编号', allowBlank: false, columnWidth: 0.25, group: '基础信息', },{ xtype: 'textfield', name: 'cu_name', fieldLabel: '客户名称', allowBlank: false, columnWidth: 0.25, group: '基础信息', },{ xtype: 'textfield', name: 'cu_shortname', fieldLabel: '客户简称', columnWidth: 0.25, hidden: true, group: '基础信息', },{ editable:false, xtype : "remotecombo", storeUrl:'/api/document/customerkind/getCombo', name : "cu_type", fieldLabel : "客户类型", columnWidth : 0.25, hiddenBtn:false,//true 则会关闭新增按钮功能, group: '基础信息', addHandler:function(b){ var document = Ext.create('saas.view.document.kind.Kind',{}); var form = this.ownerCmp.ownerCt; this.dialog = form.getController().getView().add({ xtype: 'document-kind-childwin', bind: { title: '新增客户类型' }, dataKind:'customerkind', belong:document.etc['customerkind'], _parent:form, _combo:this.ownerCmp, record:null, session: true }); this.dialog.show(); } },{ xtype: 'hidden', name: 'cu_status', fieldLabel: '状态', allowBlank: true, columnWidth: 0 },{ xtype: 'hidden', name: 'cu_statuscode', fieldLabel: '状态码', allowBlank: true, columnWidth: 0.25 },{ xtype : "datefield", name : "cu_begindate", format:'Y-m-d', fieldLabel : "期初日期", allowBlank : true, columnWidth : 0.25, group: '交易信息', },{ xtype : "numberfield", hideTrigger:true, name : "cu_beginaramount", fieldLabel : "期初应收(元)", allowBlank : true, columnWidth : 0.25, decimalPrecision: 2, thousandSeparator: ',', minValue:0, group: '交易信息', renderer : function(v) { return saas.util.BaseUtil.numberFormat(v, 2, true); }, },{ xtype : "numberfield", hideTrigger:true, name : "cu_beginprerecamount", fieldLabel : "期初预收(元)", allowBlank : true, columnWidth : 0.25, decimalPrecision: 2, thousandSeparator: ',', minValue:0, group: '交易信息', renderer : function(v) { return saas.util.BaseUtil.numberFormat(v, 2, true); }, },{ xtype:'textfield', name : "cu_leftamount", fieldLabel : "应收余额(元)", allowBlank : true, readOnly:true, columnWidth : 0.25, decimalPrecision: 2, thousandSeparator: ',', group: '交易信息', renderer : function(v) { return saas.util.BaseUtil.numberFormat(v, 2, true); }, },{ xtype : "numberfield", name : "cu_taxrate", fieldLabel : "税率(%)", allowBlank : false, columnWidth : 0.25, minValue:0, maxValue:100, group: '交易信息', },{ xtype : "numberfield", hideTrigger:true, name : "cu_promisedays", fieldLabel : "结算天数", allowBlank : true, columnWidth : 0.25, decimalPrecision:0, minValue:0, group: '交易信息', }, { xtype : "hidden", name : "cu_sellerid", fieldLabel : "业务员id", defaultValue:saas.util.BaseUtil.getCurrentUser().id, group: '交易信息', }, { xtype : "hidden", name : "cu_sellercode", fieldLabel : "业务员code", group: '交易信息', }, { xtype : "employeeDbfindTrigger", name : "cu_sellername", fieldLabel : "业务员", columnWidth : 0.25, defaultValue:saas.util.BaseUtil.getCurrentUser().realname, group: '交易信息', },{ xtype : "numberfield", hideTrigger:true, name : "cu_credit", fieldLabel : "额度", allowBlank : true, columnWidth : 0.25, decimalPrecision: 2, minValue:0, group: '交易信息', renderer : function(v) { return saas.util.BaseUtil.numberFormat(v, 2, true); }, },{ xtype : "hidden", name : "cu_nsrzh", fieldLabel : "纳税人识别号", allowBlank : true, columnWidth : 0.25 },{ xtype : "hidden", name : "cu_bankaccount", fieldLabel : "开户银行", allowBlank : true, columnWidth : 0.25 },{ xtype : "hidden", name : "cu_bankcode", fieldLabel : "银行账户", allowBlank : true, columnWidth : 0.25 },{ xtype:'hidden', name : "cu_uu", fieldLabel : "客户UU", allowBlank : true, readOnly:true, editable:false, columnWidth : 0.25 },{ xtype : "datefield", name : "createTime", fieldLabel : "创建时间", allowBlank : true, hidden:true, columnWidth : 0 },{ xtype : "datefield", name : "updateTime", fieldLabel : "更新时间", allowBlank : true, hidden:true, columnWidth : 0 },{ fieldLabel : "备注", xtype:'textfield', name : "cu_remark", columnWidth : 1 }, { xtype : "detailGridField", storeModel:'saas.model.document.customercontact', detnoColumn: 'cc_detno', showCount: false, deleteDetailUrl:'/api/document/customer/deletecontact', // minHeight:145, emptyRows: 3, columns : [ { text : "ID", dataIndex : "id", hidden : true, xtype : "numbercolumn" }, { text : "关联ID", dataIndex : "cc_cuid", hidden : true, xtype : "numbercolumn" }, { allowBlank:false, text : "联系人", editor : { xtype : "textfield" }, dataIndex : "cc_name", width:110 }, { allowBlank:false, text : "电话", editor : { // regex:/^1(3|4|5|7|8|9)\d{9}$/, // regexText:'请输入正确的手机号码', hideTrigger:true, xtype : "textfield" }, dataIndex : "cc_tel", width:200 }, { allowBlank:true, text : "微信/QQ", editor : { xtype : "textfield" }, dataIndex : "cc_qq", width:110 }, { text : "邮箱", editor : { xtype : "textfield" }, dataIndex : "cc_email", width:180 }, { text : "默认联系人", width:110 , dataIndex : "cc_default", xtype : "yncolumn" }] } ,{ xtype : "detailGridField", storeModel:'saas.model.document.customeraddress', detnoColumn: 'ca_detno', showCount: false, deleteDetailUrl:'/api/document/customer/deleteaddress', // height:145, emptyRows: 3, columns : [ { text : "ID", dataIndex : "id", hidden : true, xtype : "numbercolumn" }, { text : "关联ID", dataIndex : "ca_cuid", hidden : true, xtype : "numbercolumn" }, { allowBlank:false, text : "送货地址", editor : { xtype : "textfield" }, dataIndex : "ca_address", width:300 }, { allowBlank:true, text : "联系人", editor : { xtype : "textfield" }, dataIndex : "ca_person", width:110 }, { allowBlank:true, text : "联系电话", editor : { // regex:/^1(3|4|5|7|8|9)\d{9}$/, // regexText:'请输入正确的手机号码', xtype : "textfield", hideTrigger:true, }, dataIndex : "ca_phone", width:200 }, { text : "默认地址", dataIndex : "ca_default", width:110, xtype:'yncolumn' }] }], defaultButtons:[{ cls: 'x-formpanel-btn-blue', xtype: 'button', text: '新增', bind: { hidden: '{!id}' }, handler: 'add' }, { xtype: 'button', text: '保存', handler: 'onSave', }, { xtype: 'button', text: '删除', handler: 'delete' }, { xtype: 'button', bind: { text: '{auditBtnText}' }, handler: "auditBtnClick", }], auditTexts: { auditCode: 'BANNED', auditText: '已禁用', unAuditCode: 'ENABLE', unAuditText: '已启用', auditBtnText: '禁用', unAuditBtnText: '启用', } });