Release.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /**
  2. * 作业发布
  3. */
  4. Ext.define('school.view.interaction.homework.Release', {
  5. extend: 'school.view.core.form.FormPanel',
  6. xtype: 'interaction-homework-release',
  7. controller: 'interaction-homework-release',
  8. // viewModel: 'purchase-purchase-formpanel',
  9. //字段属性
  10. _title: '作业发布',
  11. _idField: 'task_id',
  12. _codeField: null,
  13. // _readUrl: 'http://10.1.80.47:9560/homework/read',
  14. _readUrl: '/api/school/homework/read',
  15. // _saveUrl: 'http://10.1.80.47:9560/homework/save',
  16. _saveUrl: '/api/school/homework/save',
  17. _deleteUrl: '/api/school/homework/delete',
  18. initId: 0,
  19. initComponent: function () {
  20. Ext.apply(this, {
  21. defaultItems: [{
  22. xtype: 'hidden',
  23. name: 'task_id',
  24. fieldLabel: 'id'
  25. }, {
  26. xtype: "textfield",
  27. name: "task_creator",
  28. fieldLabel: "发布人",
  29. columnWidth: 0.5
  30. }, {
  31. xtype: 'textfield',
  32. name: 'njid',
  33. fieldLabel: '年级id',
  34. hidden: true
  35. }, {
  36. xtype: 'textfield',
  37. name: 'nj',
  38. fieldLabel: '年级'
  39. }, {
  40. xtype: 'textfield',
  41. name: 'bjid',
  42. fieldLabel: '班级id',
  43. hidden: true
  44. }, {
  45. xtype: 'textfield',
  46. name: 'bj',
  47. fieldLabel: '班级'
  48. }, {
  49. xtype: 'datefield',
  50. name: 'start_date',
  51. fieldLabel: '开始时间',
  52. columnWidth: 0.5,
  53. defaultValue: new Date()
  54. }, {
  55. xtype: 'datefield',
  56. name: 'end_date',
  57. fieldLabel: '截止时间',
  58. columnWidth: 0.5
  59. }, {
  60. xtype: "textfield",
  61. name: "task_title",
  62. fieldLabel: "标题",
  63. columnWidth: 1
  64. }, {
  65. xtype: "textareafield",
  66. name: 'task_context',
  67. fieldLabel: "内容",
  68. columnWidth: 1,
  69. height: 250
  70. }, {
  71. xtype: 'textfield',
  72. name: 'fj',
  73. fieldLabel: '附件'
  74. }],
  75. toolBtns: [{
  76. xtype: 'button',
  77. text: '发布',
  78. bind: {
  79. hidden: '{!task_id}'
  80. },
  81. handler: function() {
  82. let id = me.getViewModel().data.task_id;
  83. me.setLoading(true);
  84. school.util.BaseUtil.request({
  85. url: '/api/school/homework/publish/' + id,
  86. method: 'POST'
  87. })
  88. .then(function() {
  89. me.setLoading(false);
  90. school.util.BaseUtil.showSuccessToast('发布成功');
  91. me.getViewModel().set('notify_status', 1);
  92. me.clearDirty();
  93. })
  94. .catch(function(e) {
  95. me.setLoading(false);
  96. school.util.BaseUtil.showErrorToast('发布失败: ' + e.message);
  97. });
  98. }
  99. }]
  100. });
  101. this.callParent();
  102. }
  103. });