List.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /**
  2. * 校长信箱
  3. */
  4. Ext.define('school.view.interaction.mailbox.List', {
  5. extend: 'school.view.core.base.BasePanel',
  6. xtype: 'interaction-mailbox-list',
  7. dataUrl: '/api/school/principal/list',
  8. initComponent: function() {
  9. var me = this;
  10. Ext.apply(this, {
  11. searchField: [{
  12. xtype: 'textfield',
  13. name: 'keyword',
  14. fieldLabel: '关键字'
  15. }],
  16. gridConfig: {
  17. idField: null,
  18. codeField: null,
  19. statusCodeField: null,
  20. dataUrl: me.dataUrl,
  21. caller: null,
  22. rootProperty: 'data.list',
  23. totalProperty: 'data.total',
  24. actionColumn: [],
  25. selModel: {
  26. type: 'cellmodel'
  27. },
  28. hiddenTools: false,
  29. disableDetail: true,
  30. toolBtns: [{
  31. xtype: 'button',
  32. text: '导出'
  33. }, {
  34. xtype: 'button',
  35. text: '批量回复'
  36. }, {
  37. xtype: 'button',
  38. text: '删除'
  39. }],
  40. columns : [{
  41. text: '标题',
  42. dataIndex: 'mailboxTitle',
  43. width: 120
  44. }, {
  45. text: '内容',
  46. dataIndex: 'mailboxContext',
  47. width: 300
  48. }, {
  49. xtype: 'datecolumn',
  50. text: '日期',
  51. dataIndex: 'createDate'
  52. }, {
  53. text: '提出人',
  54. dataIndex: 'mailboxCreator',
  55. width: 120
  56. }]
  57. },
  58. });
  59. this.callParent(arguments);
  60. },
  61. /**
  62. * 处理部分字段值
  63. */
  64. getConditionValue: function (field, value) {
  65. var me = this,
  66. xtypes = field.getXTypes().split('/'),
  67. conditionValue;
  68. if (me.isContainsAny(xtypes, ['datefield'])) {
  69. conditionValue = Ext.Date.format(new Date(from), 'Y-m-d H:i:s');
  70. } else if (me.isContainsAny(xtypes, ['conmonthfield'])) {
  71. var from = value.from,
  72. to = value.to;
  73. conditionValue = from + ',' + to;
  74. } else if (me.isContainsAny(xtypes, ['condatefield'])) {
  75. var from = value.from,
  76. to = value.to;
  77. 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');
  78. } else if (me.isContainsAny(xtypes, ['dbfindtrigger'])) {
  79. conditionValue = value;
  80. } else if (me.isContainsAny(xtypes, ['combobox', 'combo'])) {
  81. conditionValue = value;
  82. } else if (me.isContainsAny(xtypes, ['multicombo'])) {
  83. conditionValue = value.map ? value.map(function (v) {
  84. return v.value;
  85. }).join(',') : '';
  86. } else {
  87. conditionValue = value;
  88. }
  89. return conditionValue;
  90. },
  91. getExtraParams: function(store, op, condition) {
  92. var temp = {};
  93. for(let x = 0; x < condition.length; x++) {
  94. let c = condition[x];
  95. if(c.field == 'keyword') {
  96. temp.keyword = c.value;
  97. }else if(c.field == 'date') {
  98. temp.fromDate = new Date(c.value.split(',')[0]).getTime();
  99. temp.endDate = new Date(c.value.split(',')[1]).getTime();
  100. }else if(c.field == 'quoted') {
  101. temp.quoted = c.value == 'all' ? null : c.value;
  102. }else if(c.field == 'closed') {
  103. // temp.endDate = c.value == 'all' ? null : (
  104. // c.value == '0' ?
  105. // );
  106. }
  107. }
  108. let obj = {
  109. pageNumber: store.exportNumber?store.exportNumber:op._page,
  110. pageSize: store.exportPageSize?store.exportPageSize:store.pageSize
  111. };
  112. for(let k in temp) {
  113. if(!!temp[k]) {
  114. obj[k] = temp[k];
  115. }
  116. }
  117. return obj;
  118. },
  119. });