List.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /**
  2. * 课程表
  3. */
  4. Ext.define('school.view.interaction.timetable.List', {
  5. extend: 'school.view.core.base.BasePanel',
  6. xtype: 'interaction-timetable-list',
  7. controller: 'interaction-timetable-list',
  8. // dataUrl: 'http://10.1.80.36:9520/api/school/curriculum/list',
  9. dataUrl: '/api/school/curriculum/list',
  10. initComponent: function() {
  11. var me = this;
  12. Ext.apply(this, {
  13. searchField: [{
  14. xtype: 'textfield',
  15. name: 'term',
  16. fieldLabel: '学期'
  17. }, {
  18. xtype: 'textfield',
  19. name: 'grade',
  20. fieldLabel: '年级'
  21. }, {
  22. xtype: 'textfield',
  23. name: 'class',
  24. fieldLabel: '班级'
  25. }],
  26. caller: null,
  27. _formXtype: null,
  28. _title: null,
  29. _deleteUrl: null,
  30. _batchOpenUrl: null,
  31. _batchCloseUrl: null,
  32. _batchDeleteUrl: null,
  33. gridConfig: {
  34. addTitle: '课程表',
  35. addXtype: 'interaction-timetable-detail',
  36. idField: 'notify_id',
  37. codeField: null,
  38. detailField: 'notify_title',
  39. dataUrl: me.dataUrl,
  40. caller: null,
  41. rootProperty: 'data.list',
  42. totalProperty: 'data.total',
  43. actionColumn: [],
  44. selModel: {
  45. checkOnly:true,
  46. type:'checkboxmodel',
  47. mode : "MULTI" ,
  48. ignoreRightMouseSelection : false
  49. },
  50. hiddenTools: false,
  51. toolBtns: [{
  52. xtype: 'button',
  53. text: '删除'
  54. }, {
  55. xtype: 'button',
  56. text: '新增',
  57. handler: 'onAddClick'
  58. }],
  59. columns : [{
  60. text: '课表名称',
  61. dataIndex: 'name',
  62. width: 120,
  63. tdCls: 'x-detail-column',
  64. listeners: {
  65. click: function(view, td, row, col, e, record, tr, eOpts, event) {
  66. let gridConfig = me.gridConfig;
  67. school.util.BaseUtil.openTab(gridConfig.addXtype, gridConfig.addTitle + '(' + record.get('name') + ')', gridConfig.addXtype + record.get(gridConfig.idField), {
  68. initId: record.get(gridConfig.idField)
  69. });
  70. }
  71. }
  72. }, {
  73. text: '年级',
  74. dataIndex: 'gradeName'
  75. }, {
  76. text: '班级',
  77. dataIndex: 'clazzName'
  78. }, {
  79. text: '学期',
  80. dataIndex: 'termName',
  81. width: 120
  82. }, {
  83. text: '状态',
  84. dataIndex: 'status'
  85. }]
  86. },
  87. });
  88. this.callParent(arguments);
  89. },
  90. /**
  91. * 处理部分字段值
  92. */
  93. getConditionValue: function (field, value) {
  94. var me = this,
  95. xtypes = field.getXTypes().split('/'),
  96. conditionValue;
  97. if (me.isContainsAny(xtypes, ['datefield'])) {
  98. conditionValue = Ext.Date.format(new Date(from), 'Y-m-d H:i:s');
  99. } else if (me.isContainsAny(xtypes, ['conmonthfield'])) {
  100. var from = value.from,
  101. to = value.to;
  102. conditionValue = from + ',' + to;
  103. } else if (me.isContainsAny(xtypes, ['condatefield'])) {
  104. var from = value.from,
  105. to = value.to;
  106. conditionValue = Ext.Date.format(new Date(from), 'Y-m-d 00:00:00') + ',' + Ext.Date.format(new Date(to), 'Y-m-d 23:59:59');
  107. } else if (me.isContainsAny(xtypes, ['dbfindtrigger'])) {
  108. conditionValue = value;
  109. } else if (me.isContainsAny(xtypes, ['combobox', 'combo'])) {
  110. conditionValue = value;
  111. } else if (me.isContainsAny(xtypes, ['multicombo'])) {
  112. conditionValue = value.map ? value.map(function (v) {
  113. return v.value;
  114. }).join(',') : '';
  115. } else {
  116. conditionValue = value;
  117. }
  118. return conditionValue;
  119. },
  120. getExtraParams: function(store, op, condition) {
  121. var temp = {};
  122. for(let x = 0; x < condition.length; x++) {
  123. let c = condition[x];
  124. if(c.field == 'keyword') {
  125. temp.keyword = c.value;
  126. }else if(c.field == 'date') {
  127. temp.fromDate = new Date(c.value.split(',')[0]).getTime();
  128. temp.endDate = new Date(c.value.split(',')[1]).getTime();
  129. }else if(c.field == 'quoted') {
  130. temp.quoted = c.value == 'all' ? null : c.value;
  131. }else if(c.field == 'closed') {
  132. // temp.endDate = c.value == 'all' ? null : (
  133. // c.value == '0' ?
  134. // );
  135. }
  136. }
  137. let obj = {
  138. pageNumber: store.exportNumber?store.exportNumber:op._page,
  139. pageSize: store.exportPageSize?store.exportPageSize:store.pageSize
  140. };
  141. for(let k in temp) {
  142. if(!!temp[k]) {
  143. obj[k] = temp[k];
  144. }
  145. }
  146. return obj;
  147. },
  148. });