DataList.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * @Description:
  3. * @Author: hy
  4. * @Date: 2019-08-14 17:41:15
  5. * @LastEditTime: 2019-08-19 15:50:58
  6. */
  7. Ext.define('uas.data.DataList', {
  8. requires: [
  9. 'uas.data.Init'
  10. ]
  11. }, function() {
  12. var dataLists = [];
  13. for(let i=0;i<1000;i++){
  14. dataLists.push({
  15. id:(i+1),
  16. code:"PU"+(2019081900000001+Number(i))+"",
  17. status:(i%5)===0?"已审核":"在录入",
  18. date:"2019-08-19",
  19. vendor:(i%2)===0?"广东省深圳市南山区供应商A001":"广东省广州市天河区供应商B002",
  20. price:(Math.random()*(3000-1000)+10).toFixed(2),
  21. currency:"RMB",
  22. recordman:"小明",
  23. auditman:"大明",
  24. special:(i%2)===0?true:false,
  25. })
  26. }
  27. //from https://git.daplie.com/Daplie/knuth-shuffle/
  28. function shuffle (array) {
  29. array = Ext.Array.clone(array);
  30. var currentIndex = array.length,
  31. temporaryValue, randomIndex;
  32. // While there remain elements to shuffle...
  33. while (0 !== currentIndex) {
  34. // Pick a remaining element...
  35. randomIndex = Math.floor(Math.random() * currentIndex);
  36. currentIndex -= 1;
  37. // And swap it with the current element.
  38. temporaryValue = array[currentIndex];
  39. array[currentIndex] = array[randomIndex];
  40. array[randomIndex] = temporaryValue;
  41. }
  42. return array;
  43. }
  44. Ext.ux.ajax.SimManager.register({
  45. type: 'json',
  46. delay: 300,
  47. url:/\/uas\/DataList/,
  48. data: function(ctx) {
  49. //获取过滤条件
  50. // return Ext.Array.filter(dataLists, function(dataList) {
  51. // return dataList.id > start && dataList.id <= page*limit;
  52. // });
  53. return dataLists
  54. }
  55. });
  56. });