/** * 项目编辑 */ Ext.define('saas.view.help.DocProjectWindow', { extend: 'Ext.window.Window', xtype: 'help-docproject-win', viewModel: { data: { form: { id: null, code: null, name: null, homepage: null } }, formulas: { title: function (get) { return (get('form.id') ? '编辑' : '新增') + '项目'; } } }, bind: { title: '{title}' }, bodyPadding: '10 20', width: 500, ui: 'simple', layout: { type: 'vbox', pack: 'start', align: 'stretch' }, onConfirm: Ext.emptyFn, initComponent: function () { var me = this; me.items = [{ xtype: 'textfield', fieldLabel: '编码', labelWidth: 50, bind: '{form.code}' }, { xtype: 'textfield', fieldLabel: '名称', labelWidth: 50, bind: '{form.name}' }, { xtype: 'textfield', fieldLabel: '首页', labelWidth: 50, bind: { value: '{form.homepage}', hidden: '{!form.id}' }, emptyText: '填写文档编码,用于项目默认展示' }, { xtype: 'toolbar', items: [{ xtype: 'tbfill' }, { text: '保存', ui: 'primary', handler: function () { me.onConfirm(me.getViewModel().get('form'), me); }, scope: me, bind: { disabled: '{!form.code||!form.name}' } }, { text: '取消', ui: 'simple', margin: '0', handler: 'close', scope: me }] }]; me.callParent(arguments); }, loadData: function (data) { this.getViewModel().set('form', data); } });