DataListModel.js 1.6 KB

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