DataListModel.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. * Created by zhouy on 2018/10/18.
  3. */
  4. Ext.define('saas.view.document.currencys.DataListModel', {
  5. extend: 'Ext.app.ViewModel',
  6. alias: 'viewmodel.document-currencys-datalist',
  7. stores: {
  8. currencys: {
  9. fields:[
  10. {name: 'id', type: 'int'},
  11. {name: 'cr_rate', type: 'float'},
  12. {name: 'cr_name', type: 'string'},
  13. {name: 'cr_standard', type: 'int'},
  14. ],
  15. proxy: {
  16. type: 'ajax',
  17. url: '/api/document/currency/list',
  18. actionMethods: {
  19. read: 'GET'
  20. },
  21. reader: {
  22. type: 'json',
  23. rootProperty: 'data.list'
  24. },
  25. listeners: {
  26. exception: function(proxy, response, operation, eOpts) {
  27. if(operation.success) {
  28. if(response.timedout) {
  29. saas.util.BaseUtil.showErrorToast('请求超时');
  30. }
  31. }else {
  32. console.error('exception: ', response);
  33. saas.util.BaseUtil.showErrorToast('查询失败:' + (response.responseJson?response.responseJson.message:'请求超时'));
  34. }
  35. }
  36. }
  37. },
  38. pageSize: null,
  39. autoLoad: false,
  40. listeners: {
  41. beforeload: function (store, op) {
  42. Ext.apply(store.proxy.extraParams, {
  43. number: 1,
  44. size: 1000
  45. });
  46. }
  47. }
  48. }
  49. }
  50. });