legend.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  1. <template>
  2. <div>
  3. <!-- <div class="realTime">
  4. <div class="leiji"></div>
  5. <div class="benyue"></div>
  6. </div> -->
  7. <div
  8. class="legend-box"
  9. @click="
  10. () => {
  11. tuliType = !tuliType;
  12. }
  13. "
  14. >
  15. <img src="./static/img/legend/legend.png" />
  16. </div>
  17. <!-- 图例模块 -->
  18. <div v-drag class="tuli" v-show="tuliType">
  19. <div class="box">
  20. <div class="title">
  21. <div class="close-legend" @click="tuliType = !tuliType;"></div>
  22. </div>
  23. <div class="tuil-body">
  24. <div class="title2" @click="siteShow=!siteShow">
  25. <img src="./static/img/legend/arrow.png" style="display: inline;margin-top: -4px;" v-if="siteShow"/>
  26. <img src="./static/img/legend/arrow.png" style="display: inline;transform: rotate(-90deg);margin-top: -4px;" v-else/>
  27. <span>站点</span>
  28. </div>
  29. <div class="title2-body" v-if="siteShow">
  30. <div class="legend-item">
  31. <div class="img-box">
  32. <img src="./static/img/legend/shuiwen.png" style="display: inline" />
  33. </div>
  34. 水文站
  35. </div>
  36. <div class="legend-item">
  37. <div class="img-box"><img :src="'./static/img/legend/shuiwei.png'" style="display: inline" /></div>
  38. 水位站
  39. </div>
  40. <div class="legend-item">
  41. <div class="img-box"> <img :src="'./static/img/legend/qixiang2.png'" style="display: inline" /></div>
  42. 一般气象站
  43. </div>
  44. <div class="legend-item">
  45. <div class="img-box"> <img :src="'./static/img/legend/qixiang.png'" style="display: inline" /></div>
  46. 标准气象站
  47. </div>
  48. <div class="legend-item">
  49. <div class="img-box"><img :src="'./static/img/legend/yuliang.png'" style="display: inline" /></div>
  50. 雨量站
  51. </div>
  52. <div class="legend-item">
  53. <div class="img-box"><img :src="'./static/img/legend/tanshui.png'" style="display: inline" /></div>
  54. 碳水通量站
  55. </div>
  56. <div class="legend-item">
  57. <div class="img-box"><img :src="'./static/img/legend/gc.png'" style="display: inline" /></div>
  58. 工程
  59. </div>
  60. </div>
  61. <!-- <div class="title2" @click="rainShow=!rainShow">
  62. <img src="../../assets/images/legend/arrow.png" style="display: inline;margin-top: -4px;" v-if="rainShow"/>
  63. <img src="../../assets/images/legend/arrow.png" style="display: inline;transform: rotate(-90deg);margin-top: -4px;" v-else/>
  64. <span>雨量(mm)</span>
  65. </div>
  66. <div class="title2-body" v-if="rainShow">
  67. <div class="legend-item" v-for="item in rainLegend">
  68. <div class="color-box" :style="item.style"></div>
  69. {{ item.value }}
  70. </div>
  71. </div> -->
  72. <!-- <div class="title2" @click="wdShow=!wdShow">
  73. <img src="../../assets/images/legend/arrow.png" style="display: inline;margin-top: -4px;" v-if="wdShow"/>
  74. <img src="../../assets/images/legend/arrow.png" style="display: inline;transform: rotate(-90deg);margin-top: -4px;" v-else/>
  75. <span>温度(℃)</span>
  76. </div>
  77. <div class="title2-body" v-if="wdShow">
  78. <a-row>
  79. <a-col :span="12">
  80. <div class="legend-item" v-for="item in wdLegend2">
  81. <div class="color-box" :style="item.style"></div>
  82. {{ item.value }}
  83. </div>
  84. </a-col>
  85. <a-col :span="12">
  86. <div class="legend-item" v-for="item in wdLegend">
  87. <div class="color-box" :style="item.style"></div>
  88. {{ item.value }}
  89. </div>
  90. </a-col>
  91. </a-row>
  92. </div> -->
  93. </div>
  94. <div class="light"></div>
  95. </div>
  96. </div>
  97. </div>
  98. </template>
  99. <script setup>
  100. import { ref, reactive } from 'vue';
  101. import { CloseOutlined } from '@ant-design/icons-vue';
  102. import eventBus from '/@/utils/eventBus';
  103. window.eventBus = eventBus;
  104. eventBus.on('legendColor', (e) => {
  105. // console.log('legendColor', e);
  106. if(e.flag){
  107. tuliType.value=true
  108. if(e.maptype==1||e.maptype==2||e.maptype==0){
  109. tuliType.value=true
  110. siteShow.value=false
  111. rainShow.value=true
  112. wdShow.value=false
  113. }else if(e.maptype==3){
  114. tuliType.value=true
  115. siteShow.value=false
  116. rainShow.value=false
  117. wdShow.value=true
  118. }else{
  119. tuliType.value=false
  120. siteShow.value=true
  121. rainShow.value=false
  122. wdShow.value=false
  123. }
  124. }else{
  125. tuliType.value=false
  126. siteShow.value=true
  127. rainShow.value=false
  128. wdShow.value=false
  129. }
  130. });
  131. let showZaihai = ref(true);
  132. let showDev = ref(true);
  133. const tuliType = ref(false);
  134. const siteShow = ref(true);
  135. const rainShow = ref(false);
  136. const wdShow = ref(false);
  137. const rainLegend=reactive([
  138. {
  139. style:'background:#fd00f9',
  140. value:'>100'
  141. },
  142. {
  143. style:'background:#0000f7',
  144. value:'50~100'
  145. },
  146. {
  147. style:'background:#62b7fb',
  148. value:'25~50'
  149. },
  150. {
  151. style:'background:#43b635',
  152. value:'10~25'
  153. },
  154. {
  155. style:'background:#6dd969',
  156. value:'5~10'
  157. },
  158. {
  159. style:'background:#b4f7a3',
  160. value:'2.5~5'
  161. },
  162. {
  163. style:'background:#d9f9ce',
  164. value:'0~2.5'
  165. },
  166. ])
  167. const wdLegend=reactive([
  168. {
  169. style:'background:#e60101',
  170. value:'>40'
  171. },
  172. {
  173. style:'background:#f55900',
  174. value:'37~40'
  175. },
  176. {
  177. style:'background:#f99782',
  178. value:'35~37'
  179. },
  180. {
  181. style:'background:#fecda1',
  182. value:'32~35'
  183. },
  184. {
  185. style:'background:#fef2c2',
  186. value:'28~32'
  187. },
  188. {
  189. style:'background:#fdfb96',
  190. value:'24~28'
  191. },
  192. {
  193. style:'background:#bffb91',
  194. value:'20~24'
  195. },
  196. {
  197. style:'background:#ccffcc',
  198. value:'16~20'
  199. },
  200. ])
  201. const wdLegend2=reactive([
  202. {
  203. style:'background:#f3fdee',
  204. value:'12~16'
  205. },
  206. {
  207. style:'background:#cffcff',
  208. value:'8~12'
  209. },
  210. {
  211. style:'background:#abe9f8',
  212. value:'4~8'
  213. },
  214. {
  215. style:'background:#82d1ff',
  216. value:'0~4'
  217. },
  218. {
  219. style:'background:#3f9fe9',
  220. value:'-4~0'
  221. },
  222. {
  223. style:'background:#1d75d4',
  224. value:'-8~-4'
  225. },
  226. {
  227. style:'background:#195da7',
  228. value:'-12~-8'
  229. },
  230. {
  231. style:'background:#032b8b',
  232. value:'<-12'
  233. },
  234. ])
  235. </script>
  236. <style lang="less" scoped>
  237. .legend-box {
  238. position: absolute;
  239. right: 450px;
  240. bottom: 100px;
  241. z-index: 10;
  242. width: 36px;
  243. height: 36px;
  244. border-radius: 12px;
  245. opacity: 1;
  246. /* 工具栏背景色 */
  247. background: rgba(10, 80, 110, 0.9);
  248. line-height: 34px;
  249. text-align: center;
  250. img {
  251. display: inline-block;
  252. }
  253. }
  254. .tuli {
  255. position: absolute;
  256. width: 160px;
  257. height: 270px;
  258. overflow: hidden;
  259. padding: 0px;
  260. bottom: 100px;
  261. right: 500px;
  262. border: 1px solid rgba(0, 106, 255, 0.5);
  263. background: rgba(0, 22, 44, 0.7);
  264. box-sizing: border-box;
  265. opacity: 1;
  266. border-radius: 2px;
  267. z-index: 11;
  268. .box {
  269. height: 100%;
  270. width: 100%;
  271. position: relative;
  272. .title {
  273. position: relative;
  274. height: 34px;
  275. background: url('/@/assets/images/legend/legendtitle.png');
  276. background-size: 100% 100%;
  277. .close-legend{
  278. width: 20px;
  279. height: 20px;
  280. // background: red;
  281. // opacity: 0.4;
  282. position: absolute;
  283. right: 3px;
  284. top: 6px;
  285. cursor: pointer;
  286. }
  287. }
  288. .tuil-body {
  289. height: calc(100% - 34px);
  290. padding: 9px;
  291. overflow: auto;
  292. .title2 {
  293. width: 124px;
  294. height: 20px;
  295. background: linear-gradient(90deg, rgba(0, 124, 240, 0.24) 0%, rgba(216, 216, 216, 0) 100%);
  296. cursor: pointer;
  297. }
  298. .title2-body {
  299. padding: 5px 0;
  300. .legend-item {
  301. width: 100%;
  302. height: 25px;
  303. line-height: 25px;
  304. padding: 0 0 0 20px;
  305. margin-bottom: 5px;
  306. overflow: hidden;
  307. display: flex;
  308. align-items: center;
  309. .img-box {
  310. width: 15px;
  311. display: inline-block;
  312. text-align: center;
  313. margin-right: 10px;
  314. }
  315. .color-box {
  316. width: 15px;
  317. height: 15px;
  318. display: inline-block;
  319. text-align: center;
  320. background: #fff;
  321. border-radius: 10px;
  322. margin-right: 10px;
  323. }
  324. }
  325. }
  326. }
  327. .light {
  328. background: url('/@/assets/images/legend/light.png');
  329. background-position: center center;
  330. height: 10px;
  331. width: 100%;
  332. position: absolute;
  333. bottom: -5px;
  334. }
  335. }
  336. }
  337. .layerListTitle {
  338. display: flex;
  339. // background-color: aliceblue;
  340. line-height: 30px;
  341. height: 30px;
  342. background-image: linear-gradient(to left, rgba(0, 139, 253, 0.2), rgba(67, 255, 249, 0.2)); /* 设置背景颜色 */
  343. // width: 200px;
  344. img {
  345. margin-top: 6px;
  346. margin-left: 0px;
  347. margin-right: 5px;
  348. width: 20px;
  349. height: 19px;
  350. }
  351. }
  352. .leiji {
  353. width: 143px;
  354. height: 22px;
  355. position: absolute;
  356. top: 100px;
  357. left: 470px;
  358. background: url('/@/assets/images/legend/leij.png');
  359. z-index: 11;
  360. }
  361. .benyue {
  362. width: 143px;
  363. height: 22px;
  364. position: absolute;
  365. top: 150px;
  366. left: 470px;
  367. background: url('/@/assets/images/legend/benyue.png');
  368. z-index: 11;
  369. }
  370. </style>