dashboard.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750
  1. define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echarts-theme','form', 'template'], function ($, undefined, Backend, Datatable, Table, Echarts, undefined,Form, Template) {
  2. var Controller = {
  3. index: function () {
  4. // 基于准备好的dom,初始化echarts实例
  5. var myChart = Echarts.init(document.getElementById('echart'), 'walden');
  6. // 指定图表的配置项和数据
  7. var option = {
  8. title: {
  9. text: '',
  10. subtext: ''
  11. },
  12. color: [
  13. "#18d1b1",
  14. "#3fb1e3",
  15. "#626c91",
  16. "#a0a7e6",
  17. "#c4ebad",
  18. "#96dee8"
  19. ],
  20. tooltip: {
  21. trigger: 'axis'
  22. },
  23. legend: {
  24. data: [__('Register user')]
  25. },
  26. toolbox: {
  27. show: false,
  28. feature: {
  29. magicType: {show: true, type: ['stack', 'tiled']},
  30. saveAsImage: {show: true}
  31. }
  32. },
  33. xAxis: {
  34. type: 'category',
  35. boundaryGap: false,
  36. data: Config.column
  37. },
  38. yAxis: {},
  39. grid: [{
  40. left: 'left',
  41. top: 'top',
  42. right: '10',
  43. bottom: 30
  44. }],
  45. series: [{
  46. name: __('Register user'),
  47. type: 'line',
  48. smooth: true,
  49. areaStyle: {
  50. normal: {}
  51. },
  52. lineStyle: {
  53. normal: {
  54. width: 1.5
  55. }
  56. },
  57. data: Config.userdata
  58. }]
  59. };
  60. // 使用刚指定的配置项和数据显示图表。
  61. myChart.setOption(option);
  62. $(window).resize(function () {
  63. myChart.resize();
  64. });
  65. $(document).on("click", ".btn-refresh", function () {
  66. setTimeout(function () {
  67. myChart.resize();
  68. }, 0);
  69. });
  70. },
  71. order: function () {
  72. // 基于准备好的dom,初始化echarts实例
  73. var myChart = Echarts.init(document.getElementById('echart'), 'walden');
  74. // 指定图表的配置项和数据
  75. var option = {
  76. title: {
  77. text: '订单统计'
  78. },
  79. tooltip: {
  80. trigger: 'axis'
  81. },
  82. legend: {
  83. data: ['笔数']
  84. },
  85. grid: {
  86. left: '3%',
  87. right: '4%',
  88. bottom: '3%',
  89. containLabel: true
  90. },
  91. toolbox: {
  92. feature: {
  93. saveAsImage: {}
  94. }
  95. },
  96. xAxis: {
  97. type: 'category',
  98. boundaryGap: false,
  99. data: Config.ec_date
  100. },
  101. yAxis: {
  102. type: 'value'
  103. },
  104. series: [
  105. {
  106. name: '笔数',
  107. type: 'line',
  108. // stack: 'Total',
  109. data: Config.ec_ordernum
  110. },
  111. ]
  112. };
  113. // 使用刚指定的配置项和数据显示图表。
  114. myChart.setOption(option);
  115. $(window).resize(function () {
  116. myChart.resize();
  117. });
  118. $(document).on("click", ".btn-refresh", function () {
  119. setTimeout(function () {
  120. myChart.resize();
  121. }, 0);
  122. });
  123. },
  124. orderservicetype: function () {
  125. // 基于准备好的dom,初始化echarts实例
  126. var myChart = Echarts.init(document.getElementById('echart'), 'walden');
  127. // 指定图表的配置项和数据
  128. var option = {
  129. title: {
  130. text: '订单统计',
  131. subtext: '',
  132. left: 'center'
  133. },
  134. tooltip: {
  135. trigger: 'item'
  136. },
  137. legend: {
  138. orient: 'vertical',
  139. left: 'left'
  140. },
  141. series: [
  142. {
  143. name: 'Access From',
  144. type: 'pie',
  145. radius: '50%',
  146. data: Config.servicetype,
  147. emphasis: {
  148. itemStyle: {
  149. shadowBlur: 10,
  150. shadowOffsetX: 0,
  151. shadowColor: 'rgba(0, 0, 0, 0.5)'
  152. }
  153. }
  154. }
  155. ]
  156. };
  157. // 使用刚指定的配置项和数据显示图表。
  158. myChart.setOption(option);
  159. $(window).resize(function () {
  160. myChart.resize();
  161. });
  162. $(document).on("click", ".btn-refresh", function () {
  163. setTimeout(function () {
  164. myChart.resize();
  165. }, 0);
  166. });
  167. },
  168. datacentertwo: function () {
  169. // 基于准备好的dom,初始化echarts实例
  170. var myChart = Echarts.init(document.getElementById('echart'), 'walden');
  171. // 指定图表的配置项和数据
  172. var option = {
  173. title: {
  174. text: '客户统计',
  175. subtext: '',
  176. left: 'center'
  177. },
  178. tooltip: {
  179. trigger: 'item'
  180. },
  181. legend: {
  182. orient: 'vertical',
  183. left: 'left'
  184. },
  185. series: [
  186. {
  187. name: 'Access From',
  188. type: 'pie',
  189. radius: '50%',
  190. data: Config.comefrom_array,
  191. emphasis: {
  192. itemStyle: {
  193. shadowBlur: 10,
  194. shadowOffsetX: 0,
  195. shadowColor: 'rgba(0, 0, 0, 0.5)'
  196. }
  197. }
  198. }
  199. ]
  200. };
  201. // 使用刚指定的配置项和数据显示图表。
  202. myChart.setOption(option);
  203. $(window).resize(function () {
  204. myChart.resize();
  205. });
  206. $(document).on("click", ".btn-refresh", function () {
  207. setTimeout(function () {
  208. myChart.resize();
  209. }, 0);
  210. });
  211. },
  212. datacenterthree: function () {
  213. // 基于准备好的dom,初始化echarts实例
  214. var myChart = Echarts.init(document.getElementById('echart'), 'walden');
  215. var app = {};
  216. const posList = [
  217. 'left',
  218. 'right',
  219. 'top',
  220. 'bottom',
  221. 'inside',
  222. 'insideTop',
  223. 'insideLeft',
  224. 'insideRight',
  225. 'insideBottom',
  226. 'insideTopLeft',
  227. 'insideTopRight',
  228. 'insideBottomLeft',
  229. 'insideBottomRight'
  230. ];
  231. app.configParameters = {
  232. rotate: {
  233. min: -90,
  234. max: 90
  235. },
  236. align: {
  237. options: {
  238. left: 'left',
  239. center: 'center',
  240. right: 'right'
  241. }
  242. },
  243. verticalAlign: {
  244. options: {
  245. top: 'top',
  246. middle: 'middle',
  247. bottom: 'bottom'
  248. }
  249. },
  250. position: {
  251. options: posList.reduce(function (map, pos) {
  252. map[pos] = pos;
  253. return map;
  254. }, {})
  255. },
  256. distance: {
  257. min: 0,
  258. max: 100
  259. }
  260. };
  261. app.config = {
  262. rotate: 90,
  263. align: 'left',
  264. verticalAlign: 'middle',
  265. position: 'inside',
  266. distance: 18,
  267. onChange: function () {
  268. const labelOption = {
  269. rotate: app.config.rotate,
  270. align: app.config.align,
  271. verticalAlign: app.config.verticalAlign,
  272. position: app.config.position,
  273. distance: app.config.distance
  274. };
  275. myChart.setOption({
  276. series: [
  277. {
  278. label: labelOption
  279. },
  280. {
  281. label: labelOption
  282. },
  283. {
  284. label: labelOption
  285. },
  286. {
  287. label: labelOption
  288. }
  289. ]
  290. });
  291. }
  292. };
  293. const labelOption = {
  294. show: true,
  295. position: app.config.position,
  296. distance: app.config.distance,
  297. align: app.config.align,
  298. verticalAlign: app.config.verticalAlign,
  299. rotate: app.config.rotate,
  300. formatter: '{c} {name|{a}}',
  301. fontSize: 16,
  302. rich: {
  303. name: {}
  304. }
  305. };
  306. var series = Config.servicetype;
  307. for(var i = 0 ; i<series.length ;i++){
  308. series[i].label = labelOption;
  309. }
  310. console.log(series);
  311. // 指定图表的配置项和数据
  312. var option = {
  313. tooltip: {
  314. trigger: 'axis',
  315. axisPointer: {
  316. type: 'shadow'
  317. }
  318. },
  319. legend: {
  320. data: Config.servicename
  321. },
  322. toolbox: {
  323. show: true,
  324. orient: 'vertical',
  325. left: 'right',
  326. top: 'center',
  327. feature: {
  328. mark: { show: true },
  329. dataView: { show: true, readOnly: false },
  330. magicType: { show: true, type: ['line', 'bar', 'stack'] },
  331. restore: { show: true },
  332. saveAsImage: { show: true }
  333. }
  334. },
  335. xAxis: [
  336. {
  337. type: 'category',
  338. axisTick: { show: false },
  339. data: Config.ec_date
  340. }
  341. ],
  342. yAxis: [
  343. {
  344. type: 'value'
  345. }
  346. ],
  347. /* series: [
  348. {
  349. name: 'Forest',
  350. type: 'bar',
  351. barGap: 0,
  352. label: labelOption,
  353. emphasis: {
  354. focus: 'series'
  355. },
  356. data: [320, 332, 301, 334, 390]
  357. },
  358. {
  359. name: 'Steppe',
  360. type: 'bar',
  361. label: labelOption,
  362. emphasis: {
  363. focus: 'series'
  364. },
  365. data: [220, 182, 191, 234, 290]
  366. },
  367. {
  368. name: 'Desert',
  369. type: 'bar',
  370. label: labelOption,
  371. emphasis: {
  372. focus: 'series'
  373. },
  374. data: [150, 232, 201, 154, 190]
  375. },
  376. {
  377. name: 'Wetland',
  378. type: 'bar',
  379. label: labelOption,
  380. emphasis: {
  381. focus: 'series'
  382. },
  383. data: [98, 77, 101, 99, 40]
  384. }
  385. ],*/
  386. series: series,
  387. };
  388. // 使用刚指定的配置项和数据显示图表。
  389. myChart.setOption(option);
  390. $(window).resize(function () {
  391. myChart.resize();
  392. });
  393. $(document).on("click", ".btn-refresh", function () {
  394. setTimeout(function () {
  395. myChart.resize();
  396. }, 0);
  397. });
  398. },
  399. datacenterthree2: function () {
  400. // 基于准备好的dom,初始化echarts实例
  401. var myChart = Echarts.init(document.getElementById('echart'), 'walden');
  402. var app = {};
  403. const posList = [
  404. 'left',
  405. 'right',
  406. 'top',
  407. 'bottom',
  408. 'inside',
  409. 'insideTop',
  410. 'insideLeft',
  411. 'insideRight',
  412. 'insideBottom',
  413. 'insideTopLeft',
  414. 'insideTopRight',
  415. 'insideBottomLeft',
  416. 'insideBottomRight'
  417. ];
  418. app.configParameters = {
  419. rotate: {
  420. min: -90,
  421. max: 90
  422. },
  423. align: {
  424. options: {
  425. left: 'left',
  426. center: 'center',
  427. right: 'right'
  428. }
  429. },
  430. verticalAlign: {
  431. options: {
  432. top: 'top',
  433. middle: 'middle',
  434. bottom: 'bottom'
  435. }
  436. },
  437. position: {
  438. options: posList.reduce(function (map, pos) {
  439. map[pos] = pos;
  440. return map;
  441. }, {})
  442. },
  443. distance: {
  444. min: 0,
  445. max: 100
  446. }
  447. };
  448. app.config = {
  449. rotate: 90,
  450. align: 'left',
  451. verticalAlign: 'middle',
  452. position: 'inside',
  453. distance: 18,
  454. onChange: function () {
  455. const labelOption = {
  456. rotate: app.config.rotate,
  457. align: app.config.align,
  458. verticalAlign: app.config.verticalAlign,
  459. position: app.config.position,
  460. distance: app.config.distance
  461. };
  462. myChart.setOption({
  463. series: [
  464. {
  465. label: labelOption
  466. },
  467. {
  468. label: labelOption
  469. },
  470. {
  471. label: labelOption
  472. },
  473. {
  474. label: labelOption
  475. }
  476. ]
  477. });
  478. }
  479. };
  480. const labelOption = {
  481. show: true,
  482. position: app.config.position,
  483. distance: app.config.distance,
  484. align: app.config.align,
  485. verticalAlign: app.config.verticalAlign,
  486. rotate: app.config.rotate,
  487. formatter: '{c} {name|{a}}',
  488. fontSize: 16,
  489. rich: {
  490. name: {}
  491. }
  492. };
  493. var series = Config.servicetype;
  494. for(var i = 0 ; i<series.length ;i++){
  495. series[i].label = labelOption;
  496. }
  497. console.log(series);
  498. // 指定图表的配置项和数据
  499. var option = {
  500. tooltip: {
  501. trigger: 'axis',
  502. axisPointer: {
  503. type: 'shadow'
  504. }
  505. },
  506. legend: {
  507. data: Config.servicename
  508. },
  509. toolbox: {
  510. show: true,
  511. orient: 'vertical',
  512. left: 'right',
  513. top: 'center',
  514. feature: {
  515. mark: { show: true },
  516. dataView: { show: true, readOnly: false },
  517. magicType: { show: true, type: ['line', 'bar', 'stack'] },
  518. restore: { show: true },
  519. saveAsImage: { show: true }
  520. }
  521. },
  522. xAxis: [
  523. {
  524. type: 'category',
  525. axisTick: { show: false },
  526. data: Config.ec_date
  527. }
  528. ],
  529. yAxis: [
  530. {
  531. type: 'value'
  532. }
  533. ],
  534. /* series: [
  535. {
  536. name: 'Forest',
  537. type: 'bar',
  538. barGap: 0,
  539. label: labelOption,
  540. emphasis: {
  541. focus: 'series'
  542. },
  543. data: [320, 332, 301, 334, 390]
  544. },
  545. {
  546. name: 'Steppe',
  547. type: 'bar',
  548. label: labelOption,
  549. emphasis: {
  550. focus: 'series'
  551. },
  552. data: [220, 182, 191, 234, 290]
  553. },
  554. {
  555. name: 'Desert',
  556. type: 'bar',
  557. label: labelOption,
  558. emphasis: {
  559. focus: 'series'
  560. },
  561. data: [150, 232, 201, 154, 190]
  562. },
  563. {
  564. name: 'Wetland',
  565. type: 'bar',
  566. label: labelOption,
  567. emphasis: {
  568. focus: 'series'
  569. },
  570. data: [98, 77, 101, 99, 40]
  571. }
  572. ],*/
  573. series: series,
  574. };
  575. // 使用刚指定的配置项和数据显示图表。
  576. myChart.setOption(option);
  577. $(window).resize(function () {
  578. myChart.resize();
  579. });
  580. $(document).on("click", ".btn-refresh", function () {
  581. setTimeout(function () {
  582. myChart.resize();
  583. }, 0);
  584. });
  585. },
  586. datacenterfour: function () {
  587. // 基于准备好的dom,初始化echarts实例
  588. var myChart = Echarts.init(document.getElementById('echart'), 'walden');
  589. // 指定图表的配置项和数据
  590. var option = {
  591. title: {
  592. text: '业绩统计'
  593. },
  594. tooltip: {
  595. trigger: 'axis'
  596. },
  597. legend: {
  598. data: ['笔数']
  599. },
  600. grid: {
  601. left: '3%',
  602. right: '4%',
  603. bottom: '3%',
  604. containLabel: true
  605. },
  606. toolbox: {
  607. feature: {
  608. saveAsImage: {}
  609. }
  610. },
  611. xAxis: {
  612. type: 'category',
  613. boundaryGap: false,
  614. data: Config.ec_date
  615. },
  616. yAxis: {
  617. type: 'value'
  618. },
  619. series: [
  620. {
  621. name: '笔数',
  622. type: 'line',
  623. // stack: 'Total',
  624. data: Config.ec_ordernum
  625. },
  626. ]
  627. };
  628. // 使用刚指定的配置项和数据显示图表。
  629. myChart.setOption(option);
  630. $(window).resize(function () {
  631. myChart.resize();
  632. });
  633. $(document).on("click", ".btn-refresh", function () {
  634. setTimeout(function () {
  635. myChart.resize();
  636. }, 0);
  637. });
  638. },
  639. datacenterfive: function () {
  640. // 基于准备好的dom,初始化echarts实例
  641. var myChart = Echarts.init(document.getElementById('echart'), 'walden');
  642. // 指定图表的配置项和数据
  643. var option = {
  644. title: {
  645. text: '业绩统计'
  646. },
  647. tooltip: {
  648. trigger: 'axis'
  649. },
  650. legend: {
  651. data: ['金额']
  652. },
  653. grid: {
  654. left: '3%',
  655. right: '4%',
  656. bottom: '3%',
  657. containLabel: true
  658. },
  659. toolbox: {
  660. feature: {
  661. saveAsImage: {}
  662. }
  663. },
  664. xAxis: {
  665. type: 'category',
  666. boundaryGap: false,
  667. data: Config.ec_date
  668. },
  669. yAxis: {
  670. type: 'value'
  671. },
  672. series: [
  673. {
  674. name: '笔数',
  675. type: 'line',
  676. // stack: 'Total',
  677. data: Config.ec_ordernum
  678. },
  679. ]
  680. };
  681. // 使用刚指定的配置项和数据显示图表。
  682. myChart.setOption(option);
  683. $(window).resize(function () {
  684. myChart.resize();
  685. });
  686. $(document).on("click", ".btn-refresh", function () {
  687. setTimeout(function () {
  688. myChart.resize();
  689. }, 0);
  690. });
  691. },
  692. api: {
  693. bindevent: function () {
  694. Form.api.bindevent($("form[role=form]"));
  695. }
  696. }
  697. };
  698. return Controller;
  699. });