workJc.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. <template>
  2. <div class="workJc">
  3. <div class="echart-workJc" :style="{ height: heightT }">
  4. <div class="workJc-l">
  5. <div class="echart-yh"></div>
  6. <div class="echart-line"></div>
  7. <div class="echart-boxs" ref="ring"></div>
  8. </div>
  9. <div class="workJc-r">
  10. <div class="fx-box" v-for="(item, index) in fxLenged" :key="index">
  11. <div class="fx-label">
  12. <div class="fx-label-l">
  13. <div class="bg-pie"></div>
  14. </div>
  15. <div class="fx-label-r">{{ item.name }}</div>
  16. </div>
  17. <div class="fx-val">{{ item.value }}</div>
  18. </div>
  19. </div>
  20. </div>
  21. <div class="card-workJc" :style="{ height: heightB }">
  22. <vue3-seamless-scroll hover-stop="true" :list="cardList" :hover="true" :step="0.15" class="seamless-warp">
  23. <div class="card-box" v-for="(ite, ind) in cardList" :key="ind">
  24. <div class="card-l-label">{{ ite.title }}</div>
  25. <div class="card-l-val">{{ ite.val }}</div>
  26. <div class="card-r-label">{{ ite.label }}</div>
  27. <div class="card-r-content">
  28. <span>{{ `${ite.title1} : ` }}</span>
  29. <span>{{ `${ite.val1}°C` }}</span>
  30. </div>
  31. <!-- <div class="card-r-content1">
  32. <span>{{ `${ite.title2} : ` }}</span>
  33. <span>{{ ite.val2 }}</span>
  34. </div> -->
  35. </div>
  36. </vue3-seamless-scroll>
  37. </div>
  38. </div>
  39. </template>
  40. <script setup lang="ts">
  41. import { ref, reactive, onMounted, nextTick, defineProps, watch } from 'vue';
  42. import { Vue3SeamlessScroll } from 'vue3-seamless-scroll'
  43. import * as echarts from 'echarts';
  44. let props = defineProps({
  45. heightT: {
  46. type: String,
  47. default: '0%',
  48. },
  49. heightB: {
  50. type: String,
  51. default: '0%',
  52. },
  53. cardData: {
  54. type: Array,
  55. default: () => {
  56. return []
  57. }
  58. }
  59. });
  60. //获取dom节点
  61. let ring = ref();
  62. let fxLenged = reactive([
  63. {
  64. name: '低风险',
  65. value: 1,
  66. },
  67. // {
  68. // name: '中风险',
  69. // value: 2,
  70. // },
  71. // {
  72. // name: '高风险',
  73. // value: 3,
  74. // },
  75. // {
  76. // name: '报警',
  77. // value: 4,
  78. // },
  79. // {
  80. // name: '正常',
  81. // value: 5,
  82. // },
  83. ]);
  84. let cardList = ref<any[]>([]);
  85. function getOption() {
  86. nextTick(() => {
  87. let color = ['#1fb3f7', '#3751E6', '#FFC722', '#886EFF', '#008DEC', '#114C90', '#00BFA5'];
  88. let seriesData = [
  89. { name: '低风险', value: 30 },
  90. // { name: '中风险', value: 10 },
  91. // { name: '高风险', value: 15 },
  92. // { name: '报警', value: 23 },
  93. // { name: '正常', value: 10 },
  94. ];
  95. let myChart = echarts.init(ring.value);
  96. let option = {
  97. color: color,
  98. grid: {
  99. top: '15%',
  100. left: 0,
  101. right: '1%',
  102. bottom: 5,
  103. containLabel: true,
  104. },
  105. series: [
  106. {
  107. name: '风险占比',
  108. type: 'pie',
  109. center: ['50%', '50%'],
  110. radius: ['65%', '85%'],
  111. label: {
  112. normal: {
  113. show: false,
  114. position: 'center',
  115. formatter: '{value|{c}}\n{label|{b}}',
  116. rich: {
  117. value: {
  118. padding: 5,
  119. align: 'center',
  120. verticalAlign: 'middle',
  121. fontSize: 16,
  122. },
  123. label: {
  124. align: 'center',
  125. verticalAlign: 'middle',
  126. fontSize: 14,
  127. },
  128. },
  129. },
  130. emphasis: {
  131. show: true,
  132. textStyle: {
  133. fontSize: '10',
  134. },
  135. },
  136. },
  137. labelLine: {
  138. show: false,
  139. length: 0,
  140. length2: 0,
  141. },
  142. data: seriesData,
  143. },
  144. ],
  145. };
  146. myChart.setOption(option);
  147. window.onresize = function () {
  148. myChart.resize();
  149. };
  150. });
  151. }
  152. watch(() => props.cardData, (newC, oldC) => {
  153. console.log(newC, 'newC-------')
  154. cardList.value = newC
  155. }, { immediate: true, deep: true })
  156. onMounted(() => {
  157. getOption();
  158. });
  159. </script>
  160. <style lang="less" scoped>
  161. @font-face {
  162. font-family: douyuFont;
  163. src: url('../../../../../assets/font/douyuFont.otf');
  164. }
  165. .workJc {
  166. width: 100%;
  167. height: 100%;
  168. .echart-workJc {
  169. // height: 45%;
  170. display: flex;
  171. align-items: center;
  172. justify-content: space-between;
  173. width: 100%;
  174. .workJc-l {
  175. @keyframes rotationLine {
  176. 0% {
  177. transform: rotate(0deg);
  178. }
  179. 100% {
  180. transform: rotate(360deg);
  181. }
  182. }
  183. position: relative;
  184. width: 140px;
  185. height: 100%;
  186. .echart-yh {
  187. position: absolute;
  188. top: 50%;
  189. left: 50%;
  190. width: 90px;
  191. height: 90px;
  192. transform: translate(-50%, -50%);
  193. background: url('../../../../../assets/images/fire/firehome/zu-e.png') no-repeat center;
  194. background-size: 100% 100%;
  195. }
  196. .echart-line {
  197. position: absolute;
  198. top: 7%;
  199. left: 10%;
  200. width: 110px;
  201. height: 110px;
  202. animation: rotationLine 10s linear infinite;
  203. background: url('../../../../../assets/images/fire/firehome/ty-e.png') no-repeat center;
  204. background-size: 100% 100%;
  205. }
  206. .echart-boxs {
  207. position: absolute;
  208. top: 50%;
  209. left: 50%;
  210. width: 90px;
  211. height: 90px;
  212. transform: translate(-50%, -50%);
  213. }
  214. }
  215. .workJc-r {
  216. display: flex;
  217. box-sizing: border-box;
  218. align-items: center;
  219. justify-content: flex-start;
  220. width: calc(100% - 140px);
  221. height: 100%;
  222. padding-left: 10px;
  223. .fx-box {
  224. display: flex;
  225. flex-direction: column;
  226. align-items: center;
  227. justify-content: space-around;
  228. height: 80px;
  229. color: #a1b6c2;
  230. .fx-label {
  231. display: flex;
  232. align-items: center;
  233. height: 28px;
  234. .fx-label-l {
  235. position: relative;
  236. box-sizing: border-box;
  237. width: 14px;
  238. height: 14px;
  239. margin-right: 5px;
  240. padding: 1px;
  241. border: 1px solid #1fb3f7;
  242. .bg-pie {
  243. width: 100%;
  244. height: 100%;
  245. border-radius: 50%;
  246. background-color: #1fb3f7;
  247. }
  248. }
  249. }
  250. .fx-val {
  251. font-family: douyuFont;
  252. font-size: 18px;
  253. }
  254. }
  255. }
  256. }
  257. .card-workJc {
  258. position: relative;
  259. // height: 55%;
  260. overflow: hidden;
  261. .seamless-warp {
  262. width: 100%;
  263. .card-box {
  264. position: relative;
  265. width: 100%;
  266. height: 84px;
  267. background: url('../../../../../assets/images/fire/firehome/work-jc.png') no-repeat center;
  268. background-size: 100% 100%;
  269. .card-l-label {
  270. position: absolute;
  271. top: 9%;
  272. left: 5%;
  273. color: #a1b6c2;
  274. font-size: 14px;
  275. letter-spacing: 2px;
  276. }
  277. .card-l-val {
  278. position: absolute;
  279. top: 50%;
  280. left: 6%;
  281. color: #a3d5e5;
  282. font-size: 18px;
  283. }
  284. .card-r-label {
  285. position: absolute;
  286. top: 4%;
  287. left: 20%;
  288. border-bottom: 1px solid #d0d2d3;
  289. color: #d0d2d3;
  290. font-size: 14px;
  291. }
  292. .card-r-content {
  293. position: absolute;
  294. // top: 42%;
  295. top: 52%;
  296. left: 20%;
  297. color: #9da5aa;
  298. }
  299. .card-r-content1 {
  300. position: absolute;
  301. top: 68%;
  302. left: 20%;
  303. color: #9da5aa;
  304. }
  305. }
  306. }
  307. }
  308. }
  309. </style>