DataListModel.js 1.8 KB

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