List.js 4.5 KB

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