DocItemWindow.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /**
  2. * 目录编辑
  3. */
  4. Ext.define('saas.view.help.DocItemWindow', {
  5. extend: 'Ext.window.Window',
  6. xtype: 'help-docitem-win',
  7. viewModel: {
  8. data: {
  9. form: {
  10. id: null,
  11. code: null,
  12. name: null,
  13. article: true
  14. }
  15. },
  16. formulas: {
  17. title: function (get) {
  18. return (get('form.id') ? '编辑' : '新增') + (get('form.article') ? '文档' : '文件夹');
  19. }
  20. }
  21. },
  22. bind: {
  23. title: '{title}'
  24. },
  25. bodyPadding: '10 20',
  26. width: 500,
  27. ui: 'simple',
  28. layout: {
  29. type: 'vbox',
  30. pack: 'start',
  31. align: 'stretch'
  32. },
  33. onConfirm: Ext.emptyFn,
  34. initComponent: function () {
  35. var me = this;
  36. me.items = [{
  37. xtype: 'textfield',
  38. fieldLabel: '编码',
  39. labelWidth: 50,
  40. bind: '{form.code}'
  41. }, {
  42. xtype: 'textfield',
  43. fieldLabel: '名称',
  44. labelWidth: 50,
  45. bind: '{form.name}'
  46. }, {
  47. xtype: 'toolbar',
  48. items: [{
  49. xtype: 'tbfill'
  50. }, {
  51. text: '保存',
  52. ui: 'primary',
  53. handler: function () {
  54. var data = Ext.clone(me.getViewModel().get('form'));
  55. me.close();
  56. me.onConfirm(data, me);
  57. },
  58. scope: me,
  59. bind: {
  60. disabled: '{!form.code||!form.name}'
  61. }
  62. }, {
  63. text: '取消',
  64. ui: 'simple',
  65. margin: '0',
  66. handler: 'close',
  67. scope: me
  68. }]
  69. }];
  70. me.callParent(arguments);
  71. },
  72. loadData: function (data) {
  73. this.getViewModel().set('form', data);
  74. }
  75. });