| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358 |
- 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:basePath+'ducument/customer/read/',
- _saveUrl:basePath+'ducument/customer/save',
- _openUrl:basePath+'ducument/customer/open',
- _closeUrl:basePath+'ducument/customer/close',
- _deleteUrl:basePath+'ducument/customer/delete/',
- initId:0,
- defaultItems: [{
- xtype: 'hidden',
- name: 'id',
- fieldLabel: 'id',
- allowBlank: true,
- columnWidth: 0.25
- },{
- xtype: 'textfield',
- name: 'cu_name',
- fieldLabel: '客户名称',
- allowBlank: false,
- columnWidth: 0.25
- },{
- xtype: 'textfield',
- name: 'cu_code',
- fieldLabel: '客户编号',
- allowBlank: true,
- columnWidth: 0.25
- },{
- xtype: 'textfield',
- name: 'cu_status',
- fieldLabel: '状态',
- allowBlank: true,
- columnWidth: 0.25
- },{
- xtype: 'hidden',
- name: 'cu_statuscode',
- fieldLabel: '状态码',
- allowBlank: true,
- columnWidth: 0.25
- },{
- xtype : "remotecombo",
- storeUrl:basePath+'ducument/customerkind/getCombo',
- name : "cu_type",
- fieldLabel : "客户类型",
- allowBlank : true,
- queryMode: 'local',
- displayField: 'display',
- valueField: 'value',
- columnWidth : 0.25,
- etc:{
- customerkind:{
- keyField:'id',
- dataField:'ck_name',
- reqUrl:basePath+'ducument/customerkind/save',
- delUrl:basePath+'ducument/customerkind/delete'
- }
- },
- addHandler:function(b){
- var form = this.ownerCmp.ownerCt;
- this.dialog = form.getController().getView().add({
- xtype: 'document-kind-childwin',
- bind: {
- title: '新增客户类型'
- },
- dataKind:'customerkind',
- belong:this.ownerCmp.etc['customerkind'],
- _parent:form,
- record:null,
- session: true
- });
- this.dialog.show();
- }
- },{
- format : "Y-m-d",
- xtype : "datefield",
- name : "createTime",
- fieldLabel : "创建时间",
- allowBlank : true,
- columnWidth : 0.25
- },{
- format : "Y-m-d",
- xtype : "datefield",
- name : "cu_begindate",
- fieldLabel : "期初日期",
- allowBlank : true,
- columnWidth : 0.25
- },{
- xtype : "numberfield",
- hideTrigger:true,
- name : "cu_beginaramount",
- fieldLabel : "期初应收",
- allowBlank : true,
- columnWidth : 0.25
- },{
- xtype : "numberfield",
- hideTrigger:true,
- name : "cu_beginprerecamount",
- fieldLabel : "期初预收",
- allowBlank : true,
- columnWidth : 0.25
- },{
- xtype : "numberfield",
- hideTrigger:true,
- name : "cu_promisedays",
- fieldLabel : "承付天数",
- allowBlank : true,
- columnWidth : 0.25
- },{
- xtype : "numberfield",
- name : "cu_taxrate",
- fieldLabel : "税率",
- allowBlank : true,
- columnWidth : 0.25
- },{
- xtype : "numberfield",
- name : "cu_ta",
- fieldLabel : "应收款余额",
- allowBlank : true,
- readOnly:true,
- editable:false,
- columnWidth : 0.25
- },{
- xtype:'textfield',
- name : "cu_uu",
- fieldLabel : "客户UU",
- allowBlank : true,
- columnWidth : 0.25
- },{
- format : "Y-m-d",
- xtype : "datefield",
- name : "updateTime",
- fieldLabel : "更新时间",
- allowBlank : true,
- columnWidth : 0.25
- }, {
- xtype : "detailGridField",
- detnoColumn: 'cc_detno',
- storeModel:'saas.model.document.customercontact',
- deleteDetailUrl:basePath+'ducument/customer/deletecontact/',
- columns : [
- {
- text : "ID",
- dataIndex : "id",
- width : 0,
- xtype : "numbercolumn"
- },
- {
- text : "关联ID",
- dataIndex : "cc_cuid",
- width : 0,
- xtype : "numbercolumn"
- },
- {
- text : "联系人",
- editor : {
- xtype : "textfield"
- },
- dataIndex : "cc_name",
- width : 120.0,
- xtype : "",
- items : null
- },
- {
- text : "电话",
- editor : {
- xtype : "textfield"
- },
- dataIndex : "cc_tel",
- width : 120.0,
- xtype : "",
- items : null
- },
- {
- text : "微信/QQ",
- editor : {
- xtype : "textfield"
- },
- dataIndex : "cc_qq",
- width : 120.0,
- xtype : "",
- items : null
- },
- {
- text : "邮箱",
- editor : {
- xtype : "textfield"
- },
- dataIndex : "cc_email",
- width : 120.0,
- xtype : "",
- items : null
- },
- {
- editor : {
- displayField : "display",
- editable : true,
- format : "",
- hideTrigger : false,
- maxLength : 100.0,
- minValue : null,
- positiveNum : false,
- queryMode : "local",
- valueField : "value",
- xtype : "combo",
- store:{
- fields: ['display', 'value'],
- data : [
- {"display":"是", "value":'1'},
- {"display":"否", "value":'0'}
- ]
- }
- },
- text : "是否默认联系人",
- width : 200.0,
- dataIndex : "cc_default",
- xtype : "",
- renderer: function (v, m, r) {
- if(v=='0'){
- return '';
- }else if(v=='1'){
- return '是';
- }
- return v;
- }
- }]
- } ,{
- xtype : "detailGridField",
- detnoColumn: 'ca_detno',
- storeModel:'saas.model.document.customeraddress',
- deleteDetailUrl:basePath+'ducument/customer/deleteaddress/',
- columns : [
- {
- text : "ID",
- dataIndex : "id",
- width : 0,
- xtype : "numbercolumn"
- },
- {
- text : "关联ID",
- dataIndex : "ca_cuid",
- width : 0,
- xtype : "numbercolumn"
- },
- {
- text : "送货地址",
- editor : {
- xtype : "textfield"
- },
- dataIndex : "ca_address",
- width : 120.0,
- xtype : "",
- items : null
- },
- {
- text : "联系人",
- editor : {
- xtype : "textfield"
- },
- dataIndex : "ca_person",
- width : 120.0,
- xtype : "",
- items : null
- },
- {
- text : "联系电话",
- editor : {
- xtype : "textfield"
- },
- dataIndex : "ca_phone",
- width : 120.0,
- xtype : "",
- items : null
- },
- {
- editor : {
- displayField : "display",
- editable : true,
- format : "",
- hideTrigger : false,
- maxLength : 100.0,
- minValue : null,
- positiveNum : false,
- queryMode : "local",
- valueField : "value",
- xtype : "combo",
- store:{
- fields: ['display', 'value'],
- data : [
- {"display":"是", "value":'1'},
- {"display":"否", "value":'0'}
- ]
- },
- listeners:{
- 'change':function(c,newVal,oldVal){
- var grid = c.ownerCt.column.ownerCt.ownerCt;
- var nowId = grid.selModel.lastSelected.id;
- var items = grid.store.data.items
- }
- }
- },
- text : "是否默认地址",
- width : 200.0,
- dataIndex : "ca_default",
- xtype : "",
- renderer: function (v, m, r) {
- if(v=='0'){
- return '';
- }else if(v=='1'){
- return '是';
- }
- return v;
- }
- }]
- }],
- /**
- * 一些初始化viewModel的方法
- */
- initViewModel: function() {
- var me = this,
- codeField = me._codeField,
- statusField = me._statusField,
- statusCodeField = me._statusCodeField,
- viewModel = me.getViewModel();
-
- viewModel.set(codeField, '');
- viewModel.set('createTime', new Date());
- viewModel.set('updateTime', new Date());
- if(statusCodeField) {
- var o = {};
- o['auditBtnText'] = {
- bind: '{' + statusCodeField + '}',
- get: function(value) {
- viewModel.set(statusField, value == 'OPEN' ? '启用' : '禁用');
- return value == 'OPEN' ? '禁用' : '启用'
- }
- };
- viewModel.setFormulas(o);
- viewModel.set(statusCodeField, "OPEN");
- }else {
- viewModel.set('auditBtnText', "禁用");
- }
- }
- });
|