SpatialAnnlysis.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. <template>
  2. <div class="spatial-analysis-statistic">
  3. <div class="title">{{ title }}</div>
  4. <div class="echart-container" id="defect-column" ref="domRef"></div>
  5. </div>
  6. </template>
  7. <script>
  8. import {
  9. defineComponent,
  10. reactive,
  11. toRefs,
  12. onMounted,
  13. ref,
  14. watch,
  15. getCurrentInstance,
  16. shallowRef,
  17. } from 'vue';
  18. import { queryBusinessStatistics } from '/@/api/interface/interface'
  19. import moment from 'moment';
  20. const props = {
  21. type: {
  22. type: Object,
  23. },
  24. };
  25. export default defineComponent({
  26. name: 'spatialAnnlysis',
  27. components: {},
  28. props,
  29. setup(props) {
  30. const data = reactive({
  31. title: '空间分析统计次数',
  32. });
  33. const domRef = ref(null);
  34. const { proxy } = getCurrentInstance();
  35. const echarts = proxy.$echarts;
  36. const mychart = shallowRef(null);
  37. /**
  38. * 查询空间数据统计分析数据
  39. */
  40. const queryData = async () => {
  41. //const res = await queryBusinessStatistics()
  42. setEcharts();
  43. };
  44. const setEcharts = () => {
  45. if (mychart.value) mychart.value.clear();
  46. mychart.value = echarts.init(domRef.value);
  47. const option = getOption();
  48. mychart.value.setOption(option);
  49. window.onresize = () => {
  50. mychart.value.resize();
  51. };
  52. };
  53. const getOption = () => {
  54. const pathSymbols = {
  55. car: 'path://M49.592,40.883c-0.053,0.354-0.139,0.697-0.268,0.963c-0.232,0.475-0.455,0.519-1.334,0.475 c-1.135-0.053-2.764,0-4.484,0.068c0,0.476,0.018,0.697,0.018,0.697c0.111,1.299,0.697,1.342,0.931,1.342h3.7 c0.326,0,0.628,0,0.861-0.154c0.301-0.196,0.43-0.772,0.543-1.78c0.017-0.146,0.025-0.336,0.033-0.56v-0.01 c0-0.068,0.008-0.154,0.008-0.25V41.58l0,0C49.6,41.348,49.6,41.09,49.592,40.883L49.592,40.883z M6.057,40.883 c0.053,0.354,0.137,0.697,0.268,0.963c0.23,0.475,0.455,0.519,1.334,0.475c1.137-0.053,2.762,0,4.484,0.068 c0,0.476-0.018,0.697-0.018,0.697c-0.111,1.299-0.697,1.342-0.93,1.342h-3.7c-0.328,0-0.602,0-0.861-0.154 c-0.309-0.18-0.43-0.772-0.541-1.78c-0.018-0.146-0.027-0.336-0.035-0.56v-0.01c0-0.068-0.008-0.154-0.008-0.25V41.58l0,0 C6.057,41.348,6.057,41.09,6.057,40.883L6.057,40.883z M49.867,32.766c0-2.642-0.344-5.224-0.482-5.507 c-0.104-0.207-0.766-0.749-2.271-1.773c-1.522-1.042-1.487-0.887-1.766-1.566c0.25-0.078,0.492-0.224,0.639-0.241 c0.326-0.034,0.345,0.274,1.023,0.274c0.68,0,2.152-0.18,2.453-0.48c0.301-0.303,0.396-0.405,0.396-0.672 c0-0.268-0.156-0.818-0.447-1.146c-0.293-0.327-1.541-0.49-2.273-0.585c-0.729-0.095-0.834,0-1.022,0.121 c-0.304,0.189-0.32,1.919-0.32,1.919l-0.713,0.018c-0.465-1.146-1.11-3.452-2.117-5.269c-1.103-1.979-2.256-2.599-2.737-2.754 c-0.474-0.146-0.904-0.249-4.131-0.576c-3.298-0.344-5.922-0.388-8.262-0.388c-2.342,0-4.967,0.052-8.264,0.388 c-3.229,0.336-3.66,0.43-4.133,0.576s-1.633,0.775-2.736,2.754c-1.006,1.816-1.652,4.123-2.117,5.269L9.87,23.109 c0,0-0.008-1.729-0.318-1.919c-0.189-0.121-0.293-0.225-1.023-0.121c-0.732,0.104-1.98,0.258-2.273,0.585 c-0.293,0.327-0.447,0.878-0.447,1.146c0,0.267,0.094,0.379,0.396,0.672c0.301,0.301,1.773,0.48,2.453,0.48 c0.68,0,0.697-0.309,1.023-0.274c0.146,0.018,0.396,0.163,0.637,0.241c-0.283,0.68-0.24,0.524-1.764,1.566 c-1.506,1.033-2.178,1.566-2.271,1.773c-0.139,0.283-0.482,2.865-0.482,5.508s0.189,5.02,0.189,5.86c0,0.354,0,0.976,0.076,1.565 c0.053,0.354,0.129,0.697,0.268,0.966c0.232,0.473,0.447,0.516,1.334,0.473c1.137-0.051,2.779,0,4.477,0.07 c1.135,0.043,2.297,0.086,3.33,0.11c2.582,0.051,1.826-0.379,2.928-0.36c1.102,0.016,5.447,0.196,9.424,0.196 c3.976,0,8.332-0.182,9.423-0.196c1.102-0.019,0.346,0.411,2.926,0.36c1.033-0.018,2.195-0.067,3.332-0.11 c1.695-0.062,3.348-0.121,4.477-0.07c0.886,0.043,1.103,0,1.332-0.473c0.132-0.269,0.218-0.611,0.269-0.966 c0.086-0.592,0.078-1.213,0.078-1.565C49.678,37.793,49.867,35.408,49.867,32.766L49.867,32.766z M13.219,19.735 c0.412-0.964,1.652-2.9,2.256-3.244c0.145-0.087,1.426-0.491,4.637-0.706c2.953-0.198,6.217-0.276,7.73-0.276 c1.513,0,4.777,0.078,7.729,0.276c3.201,0.215,4.502,0.611,4.639,0.706c0.775,0.533,1.842,2.28,2.256,3.244 c0.412,0.965,0.965,2.858,0.861,3.116c-0.104,0.258,0.104,0.388-1.291,0.275c-1.387-0.103-10.088-0.216-14.185-0.216 c-4.088,0-12.789,0.113-14.184,0.216c-1.395,0.104-1.188-0.018-1.291-0.275C12.254,22.593,12.805,20.708,13.219,19.735 L13.219,19.735z M16.385,30.511c-0.619,0.155-0.988,0.491-1.764,0.482c-0.775,0-2.867-0.353-3.314-0.371 c-0.447-0.017-0.842,0.302-1.076,0.362c-0.23,0.06-0.688-0.104-1.377-0.318c-0.688-0.216-1.092-0.155-1.316-1.094 c-0.232-0.93,0-2.264,0-2.264c1.488-0.068,2.928,0.069,5.621,0.826c2.693,0.758,4.191,2.213,4.191,2.213 S17.004,30.357,16.385,30.511L16.385,30.511z M36.629,37.293c-1.23,0.164-6.386,0.207-8.794,0.207c-2.412,0-7.566-0.051-8.799-0.207 c-1.256-0.164-2.891-1.67-1.764-2.865c1.523-1.627,1.24-1.576,4.701-2.023C24.967,32.018,27.239,32,27.834,32 c0.584,0,2.865,0.025,5.859,0.404c3.461,0.447,3.178,0.396,4.699,2.022C39.521,35.623,37.887,37.129,36.629,37.293L36.629,37.293z M48.129,29.582c-0.232,0.93-0.629,0.878-1.318,1.093c-0.688,0.216-1.145,0.371-1.377,0.319c-0.231-0.053-0.627-0.371-1.074-0.361 c-0.448,0.018-2.539,0.37-3.313,0.37c-0.772,0-1.146-0.328-1.764-0.481c-0.621-0.154-0.966-0.154-0.966-0.154 s1.49-1.464,4.191-2.213c2.693-0.758,4.131-0.895,5.621-0.826C48.129,27.309,48.361,28.643,48.129,29.582L48.129,29.582z',
  56. run: 'path://M13.676,32.955c0.919-0.031,1.843-0.008,2.767-0.008v0.007c0.827,0,1.659,0.041,2.486-0.019 c0.417-0.028,1.118,0.325,1.14-0.545c0.014-0.637-0.156-1.279-0.873-1.367c-1.919-0.241-3.858-0.233-5.774,0.019 c-0.465,0.062-0.998,0.442-0.832,1.069C12.715,32.602,13.045,32.977,13.676,32.955z M14.108,29.013 c1.47-0.007,2.96-0.122,4.414,0.035c1.792,0.192,3.1-0.412,4.273-2.105c-3.044,0-5.882,0.014-8.719-0.01 c-0.768-0.005-1.495,0.118-1.461,1C12.642,28.731,13.329,29.014,14.108,29.013z M23.678,36.593c-0.666-0.69-1.258-1.497-2.483-1.448 c-2.341,0.095-4.689,0.051-7.035,0.012c-0.834-0.014-1.599,0.177-1.569,1.066c0.031,0.854,0.812,1.062,1.636,1.043 c1.425-0.033,2.852-0.01,4.278-0.01v-0.01c1.562,0,3.126,0.008,4.691-0.005C23.614,37.239,24.233,37.174,23.678,36.593z M32.234,42.292h-0.002c-1.075,0.793-2.589,0.345-3.821,1.048c-0.359,0.193-0.663,0.465-0.899,0.799 c-1.068,1.623-2.052,3.301-3.117,4.928c-0.625,0.961-0.386,1.805,0.409,2.395c0.844,0.628,1.874,0.617,2.548-0.299 c1.912-2.573,3.761-5.197,5.621-7.814C33.484,42.619,33.032,42.387,32.234,42.292z M43.527,28.401 c-0.688-1.575-2.012-0.831-3.121-0.895c-1.047-0.058-2.119,1.128-3.002,0.345c-0.768-0.677-1.213-1.804-1.562-2.813 c-0.45-1.305-1.495-2.225-2.329-3.583c2.953,1.139,4.729,0.077,5.592-1.322c0.99-1.61,0.718-3.725-0.627-4.967 c-1.362-1.255-3.414-1.445-4.927-0.452c-1.933,1.268-2.206,2.893-0.899,6.11c-2.098-0.659-3.835-1.654-5.682-2.383 c-0.735-0.291-1.437-1.017-2.293-0.666c-2.263,0.927-4.522,1.885-6.723,2.95c-1.357,0.658-1.649,1.593-1.076,2.638 c0.462,0.851,1.643,1.126,2.806,0.617c0.993-0.433,1.994-0.857,2.951-1.374c1.599-0.86,3.044-0.873,4.604,0.214 c1.017,0.707,0.873,1.137,0.123,1.849c-1.701,1.615-3.516,3.12-4.933,5.006c-1.042,1.388-0.993,2.817,0.255,4.011 c1.538,1.471,3.148,2.869,4.708,4.315c0.485,0.444,0.907,0.896-0.227,1.104c-1.523,0.285-3.021,0.694-4.538,1.006 c-1.109,0.225-2.02,1.259-1.83,2.16c0.223,1.07,1.548,1.756,2.687,1.487c3.003-0.712,6.008-1.413,9.032-2.044 c1.549-0.324,2.273-1.869,1.344-3.115c-0.868-1.156-1.801-2.267-2.639-3.445c-1.964-2.762-1.95-2.771,0.528-5.189 c1.394-1.357,1.379-1.351,2.437,0.417c0.461,0.769,0.854,1.703,1.99,1.613c2.238-0.181,4.407-0.755,6.564-1.331 C43.557,30.447,43.88,29.206,43.527,28.401z',
  57. walk: 'path://M29.902,23.275c1.86,0,3.368-1.506,3.368-3.365c0-1.859-1.508-3.365-3.368-3.365 c-1.857,0-3.365,1.506-3.365,3.365C26.537,21.769,28.045,23.275,29.902,23.275z M36.867,30.74c-1.666-0.467-3.799-1.6-4.732-4.199 c-0.932-2.6-3.131-2.998-4.797-2.998s-7.098,3.894-7.098,3.894c-1.133,1.001-2.1,6.502-0.967,6.769 c1.133,0.269,1.266-1.533,1.934-3.599c0.666-2.065,3.797-3.466,3.797-3.466s0.201,2.467-0.398,3.866 c-0.599,1.399-1.133,2.866-1.467,6.198s-1.6,3.665-3.799,6.266c-2.199,2.598-0.6,3.797,0.398,3.664 c1.002-0.133,5.865-5.598,6.398-6.998c0.533-1.397,0.668-3.732,0.668-3.732s0,0,2.199,1.867c2.199,1.865,2.332,4.6,2.998,7.73 s2.332,0.934,2.332-0.467c0-1.401,0.269-5.465-1-7.064c-1.265-1.6-3.73-3.465-3.73-5.265s1.199-3.732,1.199-3.732 c0.332,1.667,3.335,3.065,5.599,3.399C38.668,33.206,38.533,31.207,36.867,30.74z',
  58. none: 'none',
  59. };
  60. const seriesData = [123, 156, 189, 108];
  61. const maxValue = Math.max.apply(null, seriesData);
  62. const colorList = [
  63. {
  64. type: 'linear',
  65. x: 0,
  66. y: 0,
  67. x2: 0,
  68. y2: 1,
  69. colorStops: [
  70. {
  71. offset: 0,
  72. color: 'rgba(6,113,221,1)', // 0% 处的颜色
  73. },
  74. {
  75. offset: 0.5,
  76. color: 'rgba(6,113,221,0.9)', // 0% 处的颜色
  77. },
  78. {
  79. offset: 1,
  80. color: 'rgba(6,113,221,0)', // 100% 处的颜色
  81. },
  82. ],
  83. global: false, // 缺省为 false
  84. },
  85. {
  86. type: 'linear',
  87. x: 0,
  88. y: 0,
  89. x2: 0,
  90. y2: 1,
  91. colorStops: [
  92. {
  93. offset: 0,
  94. color: 'rgba(237,172,75,1)', // 0% 处的颜色
  95. },
  96. {
  97. offset: 0.5,
  98. color: 'rgba(237,172,75,0.9)', // 0% 处的颜色
  99. },
  100. {
  101. offset: 1,
  102. color: 'rgba(237,172,75,0.2)', // 100% 处的颜色 'rgba(6,113,221,0.2)'
  103. },
  104. ],
  105. global: false, // 缺省为 false
  106. },
  107. ];
  108. return {
  109. tooltip: {
  110. trigger: 'axis',
  111. axisPointer: {
  112. type: 'none',
  113. },
  114. formatter: function (params) {
  115. return params[0].name + ': ' + params[0].value;
  116. },
  117. },
  118. xAxis: {
  119. data: ['流沙', '淹没', '降雨', '预报降雨'],
  120. axisTick: { show: false },
  121. axisLine: { show: false },
  122. axisLabel: {
  123. color: '#000', //#e54035
  124. },
  125. axisLine: {
  126. show: true,
  127. lineStyle: {
  128. color: {
  129. type: 'linear',
  130. x: 0,
  131. y: 0,
  132. x2: 1,
  133. y2: 0,
  134. colorStops: [
  135. {
  136. offset: 0,
  137. color: 'rgba(222, 222, 222, 1)', // 0% 处的颜色
  138. },
  139. {
  140. offset: 1,
  141. color: 'rgba(222, 222, 222, 1)', // 100% 处的颜色
  142. },
  143. ],
  144. globalCoord: false, // 缺省为 false
  145. },
  146. },
  147. },
  148. },
  149. yAxis: {
  150. splitLine: { show: false },
  151. axisTick: { show: false },
  152. axisLine: { show: false },
  153. axisLabel: { show: true },
  154. },
  155. grid: {
  156. //极坐标
  157. top: '10%',
  158. left: '1%',
  159. right: '1%',
  160. bottom: '1%',
  161. containLabel: true,
  162. },
  163. series: [
  164. {
  165. name: 'hill',
  166. type: 'pictorialBar',
  167. barCategoryGap: '0%', //柱形开始位置
  168. symbol: 'path://M0,10 L10,10 C5.5,10 5.5,5 5,0 C4.5,5 4.5,10 0,10 z',
  169. itemStyle: {
  170. opacity: 1,
  171. color: (params) => {
  172. let color = colorList[0];
  173. if (params.data === maxValue) color = colorList[1];
  174. return color;
  175. },
  176. },
  177. emphasis: {
  178. //鼠标移动上去的颜色
  179. itemStyle: {
  180. opacity: 1,
  181. color: {
  182. type: 'linear',
  183. x: 0,
  184. y: 0,
  185. x2: 0,
  186. y2: 1,
  187. colorStops: [
  188. {
  189. offset: 0,
  190. color: 'rgba(237,172,75,1)', // 0% 处的颜色
  191. },
  192. {
  193. offset: 1,
  194. color: 'rgba(237,172,75,0.2)', // 100% 处的颜色 'rgba(6,113,221,0.2)'
  195. },
  196. ],
  197. },
  198. },
  199. },
  200. data: seriesData, //[123, 156, 189, 108],
  201. z: 10,
  202. },
  203. {
  204. name: 'glyph',
  205. type: 'pictorialBar',
  206. barGap: '-100%', //'-100%',
  207. symbolPosition: 'end',
  208. symbolSize: 50,
  209. symbolOffset: [0, '-120%'],
  210. data: [
  211. {
  212. //value: 123,
  213. //symbol: pathSymbols.reindeer,
  214. symbol: pathSymbols.none,
  215. symbolSize: [60, 60],
  216. },
  217. {
  218. //value: 60,
  219. //symbol: pathSymbols.rocket,
  220. symbol: pathSymbols.none,
  221. symbolSize: [50, 60],
  222. },
  223. {
  224. //value: 25,
  225. //symbol: pathSymbols.plane,
  226. symbol: pathSymbols.none,
  227. symbolSize: [65, 35],
  228. },
  229. {
  230. //value: 18,
  231. //symbol: pathSymbols.train,
  232. symbol: pathSymbols.none,
  233. symbolSize: [50, 30],
  234. },
  235. ],
  236. },
  237. ],
  238. };
  239. };
  240. onMounted(() => {
  241. queryData();
  242. });
  243. return {
  244. domRef,
  245. mychart,
  246. ...toRefs(data),
  247. queryData,
  248. setEcharts,
  249. getOption,
  250. };
  251. },
  252. });
  253. </script>
  254. <style lang="less" scoped>
  255. .spatial-analysis-statistic {
  256. height: 100%;
  257. width: 100%;
  258. padding: 1rem;
  259. .title {
  260. height: 1.2rem;
  261. font-family: Source Han Sans CN;
  262. font-size: 1.012rem;
  263. font-weight: bold;
  264. line-height: normal;
  265. letter-spacing: 0em;
  266. color: #3d3d3d;
  267. margin-bottom: 1.2rem;
  268. }
  269. .echart-container {
  270. height: calc(100% - 2.4rem);
  271. width: 100%;
  272. }
  273. }
  274. </style>