SchoolNotice.js 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /**
  2. * 学校通知
  3. */
  4. Ext.define('school.view.interaction.notice.SchoolNotice', {
  5. extend: 'school.view.core.form.FormPanel',
  6. xtype: 'interaction-notice-schoolnotice',
  7. controller: 'interaction-notice-schoolnotice',
  8. // viewModel: 'purchase-purchase-formpanel',
  9. //字段属性
  10. _title: '学校通知',
  11. _idField: 'notify_id',
  12. _codeField: null,
  13. // _readUrl: 'http://10.1.80.47:9560/notice/read',
  14. _readUrl: '/api/school/notice/read',
  15. // _saveUrl: 'http://10.1.80.47:9560/notice/save',
  16. _saveUrl: '/api/school/notice/save',
  17. _deleteUrl: '/api/school/notice/delete',
  18. initId: 0,
  19. initComponent: function () {
  20. Ext.apply(this, {
  21. defaultItems: [{
  22. xtype: 'hidden',
  23. name: 'notify_id',
  24. fieldLabel: 'id'
  25. }, {
  26. xtype: "textfield",
  27. name: "notify_creator",
  28. fieldLabel: "发布人",
  29. columnWidth: 0.5
  30. }, {
  31. xtype: 'combobox',
  32. name: 'notify_status',
  33. fieldLabel: '发布状态',
  34. displayField: 'name',
  35. valueField: 'value',
  36. editable: false,
  37. readOnly: true,
  38. defaultValue: 2,
  39. store: Ext.create('Ext.data.ArrayStore', {
  40. fields: ['name', 'value'],
  41. data: [['未发布', 2], ['已发布', 1]]
  42. }),
  43. minChars: 0,
  44. queryMode: 'local'
  45. }, {
  46. xtype: 'datefield',
  47. name: 'create_date',
  48. fieldLabel: '发布时间',
  49. columnWidth: 0.5,
  50. formatter: 'Y-m-d H:i:s'
  51. }, {
  52. xtype: "textfield",
  53. name: "notify_title",
  54. fieldLabel: "标题",
  55. columnWidth: 1
  56. }, {
  57. xtype: "textareafield",//文本域
  58. name: 'notify_details',
  59. fieldLabel: "内容",
  60. height: 300,
  61. columnWidth: 1,
  62. }, {
  63. xtype: 'textfield',
  64. name: 'fj',
  65. fieldLabel: '附件'
  66. }],
  67. toolBtns: [{
  68. xtype: 'button',
  69. text: '发布',
  70. bind: {
  71. hidden: '{!notify_id}'
  72. },
  73. handler: function() {
  74. let id = me.getViewModel().data.notify_id;
  75. me.setLoading(true);
  76. school.util.BaseUtil.request({
  77. url: '/api/school/notice/publish/' + id,
  78. method: 'POST'
  79. })
  80. .then(function() {
  81. me.setLoading(false);
  82. school.util.BaseUtil.showSuccessToast('发布成功');
  83. me.getViewModel().set('notify_status', 1);
  84. me.clearDirty();
  85. })
  86. .catch(function(e) {
  87. me.setLoading(false);
  88. school.util.BaseUtil.showErrorToast('发布失败: ' + e.message);
  89. });
  90. }
  91. }]
  92. });
  93. this.callParent();
  94. }
  95. });