workOrderTrend.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template>
  2. <moduleEnclosure title="近30天工单趋势">
  3. <div id="main2" style="width: 100%; height: 100%"></div>
  4. </moduleEnclosure>
  5. </template>
  6. <script>
  7. import moduleEnclosure from '@/components/moduleEnclosure.vue';
  8. import * as echarts from 'echarts';
  9. import { getQuery11 } from '@/api/bigView.js';
  10. import { csize } from '@/utils/const.js';
  11. let myChart3;
  12. export default {
  13. components: {
  14. moduleEnclosure,
  15. },
  16. data() {
  17. return {
  18. myChart2: null,
  19. };
  20. },
  21. mounted() {
  22. // this.timeId = getQuery11((res) => {
  23. // this.init_myChart2(res.data);
  24. // }, 30000);
  25. },
  26. beforeUnmount() {
  27. this.timeId();
  28. },
  29. methods: {
  30. init_myChart2(value) {
  31. var times = value.map((item) => {
  32. var str1 = item.ddate.split(' ')[0];
  33. return str1.slice(5);
  34. });
  35. var data1 = value.map((item) => {
  36. return item.completeMachine;
  37. });
  38. var data2 = value.map((item) => {
  39. return item.completeOrder;
  40. });
  41. if (myChart3) {
  42. myChart3.dispose();
  43. }
  44. myChart3 = new echarts.init(document.getElementById('main2'));
  45. myChart3.setOption({
  46. tooltip: {
  47. trigger: 'axis',
  48. formatter: function (params) {
  49. var res = '';
  50. for (var i = 0, l = params.length; i < l; i++) {
  51. res +=
  52. '' + params[i].seriesName + ' : ' + params[i].value + '<br>';
  53. }
  54. return `<div style="color:#fff;">${res}</div>`;
  55. },
  56. transitionDuration: 0,
  57. backgroundColor: '#092a66',
  58. borderColor: '#0462b5',
  59. borderRadius: 8,
  60. borderWidth: 2,
  61. padding: [5, 10],
  62. axisPointer: {
  63. type: 'line',
  64. lineStyle: {
  65. type: 'dashed',
  66. color: '#8AB1DC',
  67. },
  68. },
  69. },
  70. legend: {
  71. icon: 'circle',
  72. itemWidth: 8,
  73. itemHeight: 8,
  74. itemGap: 10,
  75. top: '16',
  76. right: '10',
  77. data: ['新增', '完成'],
  78. textStyle: {
  79. fontSize: csize(16),
  80. color: '#8AB1DC',
  81. },
  82. },
  83. grid: {
  84. x: csize(65),
  85. y: csize(50),
  86. x2: csize(30),
  87. y2: csize(30),
  88. containLabel: false,
  89. },
  90. xAxis: [
  91. {
  92. type: 'category',
  93. boundaryGap: false,
  94. axisLabel: {
  95. interval: Math.floor(times.length / 10),
  96. showMinLabel: true, //是否显示最小 tick 的 label
  97. showMaxLabel: true, //是否显示最大 tick 的 label
  98. fontSize: csize(12),
  99. },
  100. axisLine: {
  101. show: false,
  102. lineStyle: {
  103. color: '#8AB1DC',
  104. },
  105. },
  106. axisTick: {
  107. show: false,
  108. },
  109. data: times,
  110. },
  111. ],
  112. yAxis: [
  113. {
  114. type: 'value',
  115. name: '单',
  116. nameTextStyle: {
  117. fontSize: csize(16),
  118. },
  119. axisLine: {
  120. show: false,
  121. lineStyle: {
  122. color: '#8AB1DC',
  123. },
  124. },
  125. axisLabel: {
  126. margin: 10,
  127. textStyle: {
  128. fontSize: csize(12),
  129. },
  130. },
  131. splitLine: {
  132. lineStyle: {
  133. color: '#364D95',
  134. },
  135. },
  136. axisTick: {
  137. show: false,
  138. },
  139. },
  140. ],
  141. series: [
  142. {
  143. name: '新增',
  144. type: 'line',
  145. smooth: true,
  146. showSymbol: false,
  147. lineStyle: {
  148. normal: {
  149. width: 2,
  150. },
  151. },
  152. areaStyle: {
  153. normal: {
  154. color: new echarts.graphic.LinearGradient(
  155. 0,
  156. 0,
  157. 0,
  158. 1,
  159. [
  160. {
  161. offset: 0,
  162. color: 'rgba(137, 189, 27, 0.3)',
  163. },
  164. {
  165. offset: 0.8,
  166. color: 'rgba(137, 189, 27, 0)',
  167. },
  168. ],
  169. false
  170. ),
  171. shadowColor: 'rgba(0, 0, 0, 0.1)',
  172. shadowBlur: 10,
  173. },
  174. },
  175. itemStyle: {
  176. normal: {
  177. color: '#1cc840',
  178. },
  179. },
  180. data: data1,
  181. },
  182. {
  183. name: '完成',
  184. type: 'line',
  185. smooth: true,
  186. showSymbol: false,
  187. lineStyle: {
  188. normal: {
  189. width: 2,
  190. },
  191. },
  192. areaStyle: {
  193. normal: {
  194. color: new echarts.graphic.LinearGradient(
  195. 0,
  196. 0,
  197. 0,
  198. 1,
  199. [
  200. {
  201. offset: 0,
  202. color: 'rgba(0, 136, 212, 0.3)',
  203. },
  204. {
  205. offset: 0.8,
  206. color: 'rgba(0, 136, 212, 0)',
  207. },
  208. ],
  209. false
  210. ),
  211. shadowColor: 'rgba(0, 0, 0, 0.1)',
  212. shadowBlur: 10,
  213. },
  214. },
  215. itemStyle: {
  216. normal: {
  217. color: '#43bbfb',
  218. },
  219. },
  220. data: data2,
  221. },
  222. ],
  223. });
  224. },
  225. },
  226. };
  227. </script>
  228. <style></style>