List.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /**
  2. * 学科信息
  3. */
  4. Ext.define('school.view.basic.subject.List', {
  5. extend: 'school.view.core.base.BasePanel',
  6. xtype: 'basic-subject-list',
  7. // dataUrl: 'http://10.1.80.47:9560/subject/list',
  8. dataUrl: '/api/school/subject/list',
  9. _title: '学科信息',
  10. caller: 'Subject',
  11. pathKey: 'subject',
  12. controller: 'basic-subject-list',
  13. viewModel: 'basic-subject-list',
  14. initComponent: function() {
  15. var me = this;
  16. Ext.apply(this, {
  17. searchField: [{
  18. xtype: 'textfield',
  19. name: 'subject_name',
  20. fieldLabel: '名称'
  21. }],
  22. gridConfig: {
  23. addTitle: '学科信息',
  24. addXtype: 'basic-subject-detail',
  25. idField: 'subject_id',
  26. codeField: null,
  27. detailField: null,
  28. dataUrl: me.dataUrl,
  29. caller: null,
  30. rootProperty: 'data.list',
  31. totalProperty: 'data.total',
  32. actionColumn: [],
  33. selModel: {
  34. type: 'cellmodel'
  35. },
  36. hiddenTools: false,
  37. toolBtns: [{
  38. xtype: 'button',
  39. text: '新增',
  40. handler: 'onAddClick'
  41. }],
  42. columns : [{
  43. text: 'id',
  44. dataIndex: 'subject_id',
  45. hidden: true
  46. }, {
  47. text: '名称',
  48. dataIndex: 'subject_name',
  49. width: 150
  50. }, {
  51. xtype:'actioncolumn',
  52. width:70,
  53. dataIndex:'actioncolumn',
  54. text:'操作',
  55. align: 'center',
  56. items: [{
  57. tooltip: '编辑',
  58. iconCls: 'x-fa fa-pencil fa-fw',
  59. scope:this,
  60. listeners: {
  61. click: function() {
  62. debugger;
  63. }
  64. }
  65. },{
  66. text:'删除',
  67. iconCls:'x-fa fa-trash-o fa-fw',
  68. tooltip: '删除',
  69. scope:this
  70. }],
  71. listeners: {
  72. click: 'onActionClick'
  73. }
  74. }]
  75. },
  76. });
  77. this.callParent(arguments);
  78. },
  79. /**
  80. * 处理部分字段值
  81. */
  82. getConditionValue: function (field, value) {
  83. var me = this,
  84. xtypes = field.getXTypes().split('/'),
  85. conditionValue;
  86. if (me.isContainsAny(xtypes, ['datefield'])) {
  87. conditionValue = Ext.Date.format(new Date(from), 'Y-m-d H:i:s');
  88. } else if (me.isContainsAny(xtypes, ['conmonthfield'])) {
  89. var from = value.from,
  90. to = value.to;
  91. conditionValue = from + ',' + to;
  92. } else if (me.isContainsAny(xtypes, ['condatefield'])) {
  93. var from = value.from,
  94. to = value.to;
  95. 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');
  96. } else if (me.isContainsAny(xtypes, ['dbfindtrigger'])) {
  97. conditionValue = value;
  98. } else if (me.isContainsAny(xtypes, ['combobox', 'combo'])) {
  99. conditionValue = value;
  100. } else if (me.isContainsAny(xtypes, ['multicombo'])) {
  101. conditionValue = value.map ? value.map(function (v) {
  102. return v.value;
  103. }).join(',') : '';
  104. } else {
  105. conditionValue = value;
  106. }
  107. return conditionValue;
  108. },
  109. getExtraParams: function(store, op, condition) {
  110. var temp = {};
  111. for(let x = 0; x < condition.length; x++) {
  112. let c = condition[x];
  113. if(c.field == 'keyword') {
  114. temp.keyword = c.value;
  115. }else if(c.field == 'date') {
  116. temp.fromDate = new Date(c.value.split(',')[0]).getTime();
  117. temp.endDate = new Date(c.value.split(',')[1]).getTime();
  118. }else if(c.field == 'quoted') {
  119. temp.quoted = c.value == 'all' ? null : c.value;
  120. }else if(c.field == 'closed') {
  121. // temp.endDate = c.value == 'all' ? null : (
  122. // c.value == '0' ?
  123. // );
  124. }
  125. }
  126. let obj = {
  127. pageNumber: store.exportNumber?store.exportNumber:op._page,
  128. pageSize: store.exportPageSize?store.exportPageSize:store.pageSize
  129. };
  130. for(let k in temp) {
  131. if(!!temp[k]) {
  132. obj[k] = temp[k];
  133. }
  134. }
  135. return obj;
  136. },
  137. });