my_team.js 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echarts-theme', 'template','form'], function ($, undefined, Backend, Datatable, Table, Echarts, undefined, Template,Form) {
  2. return {
  3. cate_check() {
  4. Form.events.daterangepicker($('.form'))
  5. Table.api.init()
  6. var table = $("#table");
  7. var table1 = $("#table1");
  8. // 初始化表格
  9. table.bootstrapTable({
  10. url: location.href+'&type=1',
  11. pk: 'id',
  12. sortName: 'id',
  13. searchFormVisible: false,
  14. showExport: true,
  15. commonSearch: false,
  16. search: false,
  17. columns: [
  18. [
  19. {field: 'rank', title: __('排名'), operate: false,},
  20. {field: 'category_name', title: __('名称'), operate: false,},
  21. {field: 'num', title: __('数量'), operate: false,},
  22. ]
  23. ],
  24. onLoadSuccess(row){
  25. let a=Echarts.init(document.getElementById('charts1'))
  26. let items=[]
  27. row.rows.forEach(item=>{
  28. items.push({value:item.num,name:item.category_name})
  29. })
  30. console.log(items)
  31. a.setOption({
  32. title: {
  33. text: '订单量排名',
  34. left: 'center'
  35. },
  36. tooltip: {
  37. trigger: 'item'
  38. },
  39. legend: {
  40. orient: 'vertical',
  41. left: 'left'
  42. },
  43. series: [
  44. {
  45. name: '品类',
  46. type: 'pie',
  47. radius: '50%',
  48. data: items,
  49. emphasis: {
  50. itemStyle: {
  51. shadowBlur: 10,
  52. shadowOffsetX: 0,
  53. shadowColor: 'rgba(0, 0, 0, 0.5)'
  54. }
  55. }
  56. }
  57. ]
  58. })
  59. }
  60. });
  61. table1.bootstrapTable({
  62. url: location.href+'&type=2',
  63. pk: 'id',
  64. sortName: 'id',
  65. searchFormVisible: false,
  66. showExport: true,
  67. commonSearch: false,
  68. search: false,
  69. columns: [
  70. [
  71. {field: 'rank', title: __('排名'), operate: false,},
  72. {field: 'category_name', title: __('销售人'), operate: false,},
  73. {field: 'num', title: __('金额'), operate: false,},
  74. ]
  75. ],
  76. onLoadSuccess(row){
  77. let a=Echarts.init(document.getElementById('charts2'))
  78. let items=[]
  79. row.rows.forEach(item=>{
  80. items.push({value:item.num,name:item.category_name})
  81. })
  82. console.log(items)
  83. a.setOption({
  84. title: {
  85. text: '销售额排名',
  86. left: 'center'
  87. },
  88. tooltip: {
  89. trigger: 'item'
  90. },
  91. legend: {
  92. orient: 'vertical',
  93. left: 'left'
  94. },
  95. series: [
  96. {
  97. name: '品类',
  98. type: 'pie',
  99. radius: '50%',
  100. data: items,
  101. emphasis: {
  102. itemStyle: {
  103. shadowBlur: 10,
  104. shadowOffsetX: 0,
  105. shadowColor: 'rgba(0, 0, 0, 0.5)'
  106. }
  107. }
  108. }
  109. ]
  110. })
  111. }
  112. });
  113. Table.api.bindevent(table);
  114. Table.api.bindevent(table1);
  115. },
  116. profit_static() {
  117. Form.events.daterangepicker($('.form'))
  118. },
  119. order_num_amount_rank(){
  120. Form.events.daterangepicker($('.form'))
  121. Table.api.init()
  122. var table = $("#table");
  123. var table1 = $("#table1");
  124. // 初始化表格
  125. table.bootstrapTable({
  126. url: location.href+'&type=1',
  127. pk: 'id',
  128. sortName: 'id',
  129. searchFormVisible: false,
  130. showExport: true,
  131. commonSearch: false,
  132. search: false,
  133. columns: [
  134. [
  135. {field: 'rank', title: __('排名'), operate: false,},
  136. {field: 'nickname', title: __('用户名'), operate: false,},
  137. {field: 'num', title: __('数量'), operate: false,},
  138. ]
  139. ],
  140. onLoadSuccess(row){
  141. let a=Echarts.init(document.getElementById('charts1'))
  142. let items=[]
  143. row.rows.forEach(item=>{
  144. items.push({value:item.num,name:item.nickname})
  145. })
  146. console.log(items)
  147. a.setOption({
  148. title: {
  149. text: '用户订单量排名',
  150. left: 'center'
  151. },
  152. tooltip: {
  153. trigger: 'item'
  154. },
  155. legend: {
  156. orient: 'vertical',
  157. left: 'left'
  158. },
  159. series: [
  160. {
  161. name: '品类',
  162. type: 'pie',
  163. radius: '50%',
  164. data: items,
  165. emphasis: {
  166. itemStyle: {
  167. shadowBlur: 10,
  168. shadowOffsetX: 0,
  169. shadowColor: 'rgba(0, 0, 0, 0.5)'
  170. }
  171. }
  172. }
  173. ]
  174. })
  175. }
  176. });
  177. table1.bootstrapTable({
  178. url: location.href+'&type=2',
  179. pk: 'id',
  180. sortName: 'id',
  181. searchFormVisible: false,
  182. showExport: true,
  183. commonSearch: false,
  184. search: false,
  185. columns: [
  186. [
  187. {field: 'rank', title: __('排名'), operate: false,},
  188. {field: 'nickname', title: __('用户名'), operate: false,},
  189. {field: 'num', title: __('金额'), operate: false,},
  190. ]
  191. ],
  192. onLoadSuccess(row){
  193. let a=Echarts.init(document.getElementById('charts2'))
  194. let items=[]
  195. row.rows.forEach(item=>{
  196. items.push({value:item.num,name:item.nickname})
  197. })
  198. console.log(items)
  199. a.setOption({
  200. title: {
  201. text: '用户订单金额排名',
  202. left: 'center'
  203. },
  204. tooltip: {
  205. trigger: 'item'
  206. },
  207. legend: {
  208. orient: 'vertical',
  209. left: 'left'
  210. },
  211. series: [
  212. {
  213. name: '品类',
  214. type: 'pie',
  215. radius: '50%',
  216. data: items,
  217. emphasis: {
  218. itemStyle: {
  219. shadowBlur: 10,
  220. shadowOffsetX: 0,
  221. shadowColor: 'rgba(0, 0, 0, 0.5)'
  222. }
  223. }
  224. }
  225. ]
  226. })
  227. }
  228. });
  229. Table.api.bindevent(table);
  230. Table.api.bindevent(table1);
  231. }
  232. };
  233. });