List.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /**
  2. * 出入校记录
  3. */
  4. Ext.define('school.view.interaction.access.List', {
  5. extend: 'school.view.core.base.BasePanel',
  6. xtype: 'interaction-access-list',
  7. dataUrl: '/api/school/record/list',
  8. initComponent: function () {
  9. var me = this;
  10. Ext.apply(this, {
  11. searchField: [{
  12. xtype: 'textfield',
  13. name: 'keyword',
  14. fieldLabel: '姓名'
  15. }],
  16. caller: null,
  17. _formXtype: null,
  18. _title: null,
  19. _deleteUrl: null,
  20. _batchOpenUrl: null,
  21. _batchCloseUrl: null,
  22. _batchDeleteUrl: null,
  23. gridConfig: {
  24. idField: null,
  25. codeField: null,
  26. statusCodeField: null,
  27. dataUrl: me.dataUrl,
  28. caller: null,
  29. rootProperty: 'data.list',
  30. totalProperty: 'data.total',
  31. actionColumn: [],
  32. selModel: {
  33. checkOnly: true,
  34. type: 'checkboxmodel',
  35. mode: "MULTI",
  36. ignoreRightMouseSelection: false
  37. },
  38. hiddenTools: true,
  39. toolBtns: [],
  40. columns: [{
  41. text: 'id',
  42. dataIndex: 'record_id',
  43. hidden: true
  44. }, {
  45. text: '类型',
  46. dataIndex: 'record_name'
  47. }, {
  48. text: '学号',
  49. dataIndex: 'stu_number'
  50. }, {
  51. text: '姓名',
  52. dataIndex: 'stu_name'
  53. }, {
  54. text: '年级',
  55. dataIndex: 'grade_name'
  56. }, {
  57. text: '班级',
  58. dataIndex: 'clazz_name'
  59. }, {
  60. text: '时间',
  61. dataIndex: 'in_date',
  62. xtype: 'datecolumn',
  63. format: 'Y-m-d H:i:s',
  64. width: 150,
  65. renderer: function(v, m, r) {
  66. if(r.get('record_name') == '入校记录') {
  67. return r.get('in_date');
  68. }else {
  69. return r.get('out_date');
  70. }
  71. }
  72. }]
  73. },
  74. });
  75. this.callParent(arguments);
  76. },
  77. /**
  78. * 处理部分字段值
  79. */
  80. getConditionValue: function (field, value) {
  81. var me = this,
  82. xtypes = field.getXTypes().split('/'),
  83. conditionValue;
  84. if (me.isContainsAny(xtypes, ['datefield'])) {
  85. conditionValue = Ext.Date.format(new Date(from), 'Y-m-d H:i:s');
  86. } else if (me.isContainsAny(xtypes, ['conmonthfield'])) {
  87. var from = value.from,
  88. to = value.to;
  89. conditionValue = from + ',' + to;
  90. } else if (me.isContainsAny(xtypes, ['condatefield'])) {
  91. var from = value.from,
  92. to = value.to;
  93. 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');
  94. } else if (me.isContainsAny(xtypes, ['dbfindtrigger'])) {
  95. conditionValue = value;
  96. } else if (me.isContainsAny(xtypes, ['combobox', 'combo'])) {
  97. conditionValue = value;
  98. } else if (me.isContainsAny(xtypes, ['multicombo'])) {
  99. conditionValue = value.map ? value.map(function (v) {
  100. return v.value;
  101. }).join(',') : '';
  102. } else {
  103. conditionValue = value;
  104. }
  105. return conditionValue;
  106. },
  107. getExtraParams: function (store, op, condition) {
  108. var temp = {};
  109. for (let x = 0; x < condition.length; x++) {
  110. let c = condition[x];
  111. if (c.field == 'keyword') {
  112. temp.keyword = c.value;
  113. } else if (c.field == 'date') {
  114. temp.fromDate = new Date(c.value.split(',')[0]).getTime();
  115. temp.endDate = new Date(c.value.split(',')[1]).getTime();
  116. } else if (c.field == 'quoted') {
  117. temp.quoted = c.value == 'all' ? null : c.value;
  118. } else if (c.field == 'closed') {
  119. // temp.endDate = c.value == 'all' ? null : (
  120. // c.value == '0' ?
  121. // );
  122. }
  123. }
  124. let obj = {
  125. pageNumber: store.exportNumber ? store.exportNumber : op._page,
  126. pageSize: store.exportPageSize ? store.exportPageSize : store.pageSize
  127. };
  128. for (let k in temp) {
  129. if (!!temp[k]) {
  130. obj[k] = temp[k];
  131. }
  132. }
  133. return obj;
  134. },
  135. });