Няма описание

personal.js 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /**
  2. * Created by TT on 2017/4/21.
  3. */
  4. ;
  5. spa_define(function () {
  6. return $.use(["spa", "code", "form", "util", "dict"], function (spa, code, form, util, dict) {
  7. return {
  8. main: function () {
  9. var root = spa.findInMain(".sys_personal_index");
  10. var cr = code.parseCode(root.find(".dt-tpl"));
  11. var myChart = echarts.init(document.getElementById('type'));
  12. cr.shell("count", function (env) {
  13. var v = env.cd[this.k];
  14. if (v === 0) {
  15. return 0;
  16. }
  17. return v;
  18. });
  19. var loadChart = function () {
  20. util.get("../ajax/sys/user/pictable/"+util.data("loginUser").id,null,function (data) {
  21. var colors = ['#c23531', '#82C8FA'];
  22. var option = {
  23. color: colors,
  24. title: {
  25. text: '个人业绩统计',
  26. subtext: '最近7天'
  27. },
  28. tooltip: {
  29. trigger: 'axis'
  30. },
  31. legend: {
  32. data: ['新增用户', '新增激活用户']
  33. },
  34. xAxis: {
  35. data: data.map(function (item) {
  36. return item.createTime;
  37. }),
  38. boundaryGap: false
  39. },
  40. yAxis: {
  41. splitLine: {
  42. show: false
  43. },
  44. boundaryGap: false,
  45. type: "value",
  46. // interval: 1,
  47. min: 0
  48. },
  49. toolbox: {
  50. show: true,
  51. feature: {
  52. dataZoom: {
  53. yAxisIndex: 'none'
  54. },
  55. dataView: {readOnly: false},
  56. magicType: {type: ['line', 'bar']},
  57. restore: {},
  58. saveAsImage: {}
  59. }
  60. },
  61. dataZoom: [{
  62. startValue: ""
  63. }, {
  64. type: 'inside'
  65. }],
  66. visualMap: {
  67. top: 10,
  68. right: 10,
  69. },
  70. series: [{
  71. name: '新增用户',
  72. type: 'line',
  73. data: data.map(function (item) {
  74. return item.znum;
  75. }),
  76. }, {
  77. name: '新增激活用户',
  78. type: 'line',
  79. data: data.map(function (item) {
  80. return item.jnum;
  81. })
  82. }
  83. ]
  84. };
  85. cr.val(data);
  86. myChart.setOption(option);
  87. })
  88. };
  89. cr.listen(dict.doTransfer);
  90. loadChart();
  91. }
  92. }
  93. });
  94. });