index.vue 62 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506
  1. <template>
  2. <div class="table-box">
  3. <div class="card mb10">
  4. <div class="queryInfo">
  5. <div style="display: flex;align-items: center;" class="top_item">
  6. <span style="flex-shrink: 0;">自动站:</span>
  7. <!-- <el-select v-model="queryInfo" clearable placeholder="设备系统" style="width: 180px;">
  8. <el-option label="M1986" :value="0" />
  9. <el-option label="M1987" :value="1" />
  10. </el-select> -->
  11. <el-select v-model="pageable.as_code" filterable placeholder="请搜索自动站" remote reserve-keyword
  12. clearable style="width: 200px" @change="changeStation">
  13. <el-option v-for="item in platformList" :key="item.as_code"
  14. :label="item.as_code + ' ' + item.as_name" :value="item.as_code" />
  15. <template #prefix>
  16. <el-icon class="el-input__icon">
  17. <search />
  18. </el-icon>
  19. </template>
  20. </el-select>
  21. </div>
  22. <div class="top_item">站名:{{ selectPlatform?.as_name }}</div>
  23. <div class="top_item">站址:{{
  24. selectPlatform?.as_province + selectPlatform?.as_city + selectPlatform?.as_area +
  25. selectPlatform?.as_address
  26. }}</div>
  27. <div class="top_item">经度:{{ selectPlatform?.as_lon }}</div>
  28. <div class="top_item">纬度:{{ selectPlatform?.as_lat }}</div>
  29. <div class="top_item">观测时间:{{ dataItemInfo && dataItemInfo.data_time_i ?
  30. formatDate(dataItemInfo?.data_time_i, 2) : '--' }}
  31. </div>
  32. </div>
  33. <div class="header-button-ri">
  34. <slot name="toolButton">
  35. <img class="setting" src="@/assets/images/setting2.png" @click="handleSetting" />
  36. </slot>
  37. </div>
  38. </div>
  39. <div class="main_list">
  40. <el-row :gutter="15">
  41. <el-col :xs="12" :sm="8" :md="8" :lg="8" :xl="4">
  42. <div class="chart_item zhuti" style="overflow: auto;">
  43. <div style="font-weight: bold;">天气现象</div>
  44. <div class="mt15">
  45. <div style="height: 200px;">
  46. <!-- <div v-if="dataItemInfo && dataItemInfo[601] === '--' && dataItemInfo[602] === '--' && dataItemInfo[603] === '--' && dataItemInfo[604] === '--' && dataItemInfo[605] === '--'" -->
  47. <div class="wweatherBox" style="padding-top: 10px;"
  48. v-if="dangerWeather && dangerWeather.length > 0"
  49. :style="{ marginBottom: dangerWeather && dangerWeather.length <= 2 ? '40px' : '20px' }">
  50. <div class="weatherItem" v-for="item in dangerWeather" :key="item.data_id">{{
  51. getYenSymbolLaterCharacters(item.remark) }}
  52. </div>
  53. <!-- <div class="weatherItem" v-if="dataItemInfo && dataItemInfo[602] != '--'">{{
  54. getYenSymbolLaterCharacters(dataItemInfo.data_list.find(item => item.data_id ==
  55. 602)?.remark) }}
  56. </div>
  57. <div class="weatherItem" v-if="dataItemInfo && dataItemInfo[603] != '--'">{{
  58. getYenSymbolLaterCharacters(dataItemInfo.data_list.find(item => item.data_id ==
  59. 603)?.remark) }}
  60. </div>
  61. <div class="weatherItem" v-if="dataItemInfo && dataItemInfo[604] != '--'">{{
  62. getYenSymbolLaterCharacters(dataItemInfo.data_list.find(item => item.data_id ==
  63. 604)?.remark) }}
  64. </div>
  65. <div class="weatherItem" v-if="dataItemInfo && dataItemInfo[605] != '--'">{{
  66. getYenSymbolLaterCharacters(dataItemInfo.data_list.find(item => item.data_id ==
  67. 605)?.remark) }}
  68. </div> -->
  69. </div>
  70. <div v-else
  71. style="text-align: center;margin-bottom: 40px;padding-top: 10px;font-weight: bold;">
  72. 无明显天气现象</div>
  73. <div style="font-weight: bold;">危险天气</div>
  74. <div v-if="!weatherInfoArr || weatherInfoArr.length <= 0"
  75. style="text-align: center;margin-top: 15px;padding-bottom: 20px;color: red;font-weight: bold;">
  76. 无</div>
  77. <div v-else v-for="item in weatherInfoArr" :key="item"
  78. style="text-align: center;margin-top: 15px;padding-bottom: 20px;color: red;font-weight: bold;">
  79. {{ findLabelByValue(dataTypeList, item.data_type) }}-{{ item.data_value }}</div>
  80. </div>
  81. </div>
  82. </div>
  83. </el-col>
  84. <el-col :xs="12" :sm="8" :md="8" :lg="8" :xl="4">
  85. <div class="chart_item zhuti">
  86. <div style="font-weight: bold;">瞬时风 ( m/s )</div>
  87. <div class="mt15 box1">
  88. <div ref="windSpeed" class="ve-ring" style="height: 200px"></div>
  89. <div class="icon icon1">{{ dataItemInfo && dataItemInfo[9] ? dataItemInfo[9] : '--' }}
  90. <span>°</span>
  91. </div>
  92. <div class="icon icon2">{{ dataItemInfo && dataItemInfo[8] ? dataItemInfo[8] : '--' }}
  93. <span>m/s</span>
  94. </div>
  95. </div>
  96. </div>
  97. </el-col>
  98. <el-col :xs="12" :sm="8" :md="8" :lg="8" :xl="4">
  99. <div class="chart_item zhuti">
  100. <div style="font-weight: bold;">温度 ( ℃ )</div>
  101. <div class="mt15">
  102. <div ref="pie" class="ve-ring" style="height: 200px"></div>
  103. </div>
  104. </div>
  105. </el-col>
  106. <el-col :xs="12" :sm="8" :md="8" :lg="8" :xl="4">
  107. <div class="chart_item zhuti">
  108. <div style="font-weight: bold;">相对湿度 ( % )</div>
  109. <div class="mt15">
  110. <div ref="humidity" class="ve-ring" style="height: 200px"></div>
  111. </div>
  112. </div>
  113. </el-col>
  114. <el-col :xs="12" :sm="8" :md="8" :lg="8" :xl="4">
  115. <div class="chart_item zhuti">
  116. <div style="font-weight: bold;">本站气压 ( hPa )</div>
  117. <div class="mt15">
  118. <div ref="pressure" class="ve-ring" style="height: 200px"></div>
  119. </div>
  120. </div>
  121. </el-col>
  122. <el-col :xs="12" :sm="8" :md="8" :lg="8" :xl="4">
  123. <div class="chart_item zhuti">
  124. <div style="font-weight: bold;">小时/分钟雨量 ( mm )</div>
  125. <div class="mt15">
  126. <div style="height: 200px">
  127. <div class="gradient-container">
  128. <div class="item">
  129. <div class="gradient-box" :style="gradientStyle">
  130. <span style="right: -30px;display: flex;align-items: center"
  131. :style="arrowStyle"><el-icon style="color: #007aff;">
  132. <CaretLeft />
  133. </el-icon><span style="font-size: 20px;">{{
  134. currentValue }}</span></span>
  135. <span style="position: absolute;top: 0;left: -25px;">40</span>
  136. <span style="position: absolute;bottom: 0;left: -15px;">0</span>
  137. </div>
  138. <div style="position: absolute;bottom: 0;left: 20px;">小时雨量</div>
  139. </div>
  140. <div class="item">
  141. <div class="gradient-box" :style="minStyle">
  142. <span style="right: -30px;display: flex;align-items: center"
  143. :style="minarrowStyle">
  144. <el-icon style="color: #007aff;">
  145. <CaretLeft />
  146. </el-icon><span style="font-size: 20px;">{{
  147. mincurrentValue }}</span>
  148. </span>
  149. <span style="position: absolute;top: 0;left: -15px;">4</span>
  150. <span style="position: absolute;bottom: 0;left: -15px;">0</span>
  151. </div>
  152. <div style="position: absolute;bottom: 0;left: 20px;">分钟雨量</div>
  153. </div>
  154. </div>
  155. </div>
  156. </div>
  157. </div>
  158. </el-col>
  159. </el-row>
  160. <el-row :gutter="15">
  161. <el-col :xs="12" :sm="8" :md="8" :lg="4" :xl="4"
  162. v-for="item in selectElement.length > 0 ? selectElement : customizeColumns" :key="item.data_id">
  163. <div class="chart_item info_box zhuti">
  164. <div class="info_title">{{ item.data_name }} ( {{ item.data_unit }} )</div>
  165. <div class="mt15 ">
  166. <div class="info_content">
  167. {{ item.data_value ? item.data_value : '--' }}
  168. </div>
  169. </div>
  170. </div>
  171. </el-col>
  172. <!-- <el-col :xs="12" :sm="8" :md="8" :lg="4" :xl="4">
  173. <div class="chart_item info_box zhuti">
  174. <div class="info_title">瞬时风速 ( m/s )</div>
  175. <div class="mt15 ">
  176. <div class="info_content">
  177. 0.2
  178. </div>
  179. </div>
  180. </div>
  181. </el-col>
  182. <el-col :xs="12" :sm="8" :md="8" :lg="4" :xl="4">
  183. <div class="chart_item info_box zhuti">
  184. <div class="info_title">瞬时风向 ( ° )</div>
  185. <div class="mt15 ">
  186. <div class="info_content">
  187. 35
  188. </div>
  189. </div>
  190. </div>
  191. </el-col>
  192. <el-col :xs="12" :sm="8" :md="8" :lg="4" :xl="4">
  193. <div class="chart_item info_box zhuti">
  194. <div class="info_title">气温 ( ℃ )</div>
  195. <div class="mt15 ">
  196. <div class="info_content">
  197. 23.5
  198. </div>
  199. </div>
  200. </div>
  201. </el-col>
  202. <el-col :xs="12" :sm="8" :md="8" :lg="4" :xl="4">
  203. <div class="chart_item info_box zhuti">
  204. <div class="info_title">相对湿度 ( % )</div>
  205. <div class="mt15 ">
  206. <div class="info_content">
  207. 86
  208. </div>
  209. </div>
  210. </div>
  211. </el-col>
  212. <el-col :xs="12" :sm="8" :md="8" :lg="4" :xl="4">
  213. <div class="chart_item info_box zhuti">
  214. <div class="info_title">露点温度 ( ℃ )</div>
  215. <div class="mt15 ">
  216. <div class="info_content">
  217. 12.5
  218. </div>
  219. </div>
  220. </div>
  221. </el-col>
  222. <el-col :xs="12" :sm="8" :md="8" :lg="4" :xl="4">
  223. <div class="chart_item info_box zhuti">
  224. <div class="info_title">地面温度 ( ℃ )</div>
  225. <div class="mt15 ">
  226. <div class="info_content">
  227. 26.8
  228. </div>
  229. </div>
  230. </div>
  231. </el-col>
  232. <el-col :xs="12" :sm="8" :md="8" :lg="4" :xl="4">
  233. <div class="chart_item info_box zhuti">
  234. <div class="info_title">云底高度 ( m )</div>
  235. <div class="mt15 ">
  236. <div class="info_content">
  237. 1800
  238. </div>
  239. </div>
  240. </div>
  241. </el-col>
  242. <el-col :xs="12" :sm="8" :md="8" :lg="4" :xl="4">
  243. <div class="chart_item info_box zhuti">
  244. <div class="info_title">静电场强度 ( kV/m )</div>
  245. <div class="mt15 ">
  246. <div class="info_content" style="color:red ;">
  247. 10.9
  248. </div>
  249. </div>
  250. </div>
  251. </el-col>
  252. <el-col :xs="12" :sm="8" :md="8" :lg="4" :xl="4">
  253. <div class="chart_item info_box zhuti">
  254. <div class="info_title">总云量 ( 成 )</div>
  255. <div class="mt15 ">
  256. <div class="info_content">
  257. 5
  258. </div>
  259. </div>
  260. </div>
  261. </el-col>
  262. <el-col :xs="12" :sm="8" :md="8" :lg="4" :xl="4">
  263. <div class="chart_item info_box zhuti">
  264. <div class="info_title">低云云量 ( 成 )</div>
  265. <div class="mt15 ">
  266. <div class="info_content">
  267. 2
  268. </div>
  269. </div>
  270. </div>
  271. </el-col>
  272. <el-col :xs="12" :sm="8" :md="8" :lg="4" :xl="4">
  273. <div class="chart_item info_box zhuti">
  274. <div class="info_title">光照度 ( lx )</div>
  275. <div class="mt15 ">
  276. <div class="info_content">
  277. 1
  278. </div>
  279. </div>
  280. </div>
  281. </el-col>
  282. <el-col :xs="12" :sm="8" :md="8" :lg="4" :xl="4">
  283. <div class="chart_item info_box zhuti">
  284. <div class="info_title">小时累计日照时数 ( min )</div>
  285. <div class="mt15 ">
  286. <div class="info_content">
  287. 29
  288. </div>
  289. </div>
  290. </div>
  291. </el-col> -->
  292. </el-row>
  293. <el-row :gutter="15">
  294. <el-col :xs="12" :sm="8" :md="8" :lg="8">
  295. <div class="chart_item zhuti">
  296. <div style="font-weight: bold;" class="item_title">
  297. <span>风向 / 风速 ( m/s )</span>
  298. <el-select v-model="timeValue" @change="changeTime" placeholder="请选择" size="small"
  299. style="width: 150px;">
  300. <el-option v-for="item in options" :key="item.value" :label="item.label"
  301. :value="item.value">
  302. </el-option>
  303. </el-select>
  304. </div>
  305. <div class="mt15">
  306. <div ref="wind" class="ve-ring" style="height: 200px"></div>
  307. </div>
  308. </div>
  309. </el-col>
  310. <el-col :xs="12" :sm="8" :md="8" :lg="8">
  311. <div class="chart_item zhuti">
  312. <div style="font-weight: bold;" class="item_title">
  313. <span>气温 ( ℃ ) / 相对湿度 ( % )</span>
  314. <el-select v-model="timeValue" @change="changeTime" placeholder="请选择" size="small"
  315. style="width: 150px;">
  316. <el-option v-for="item in options" :key="item.value" :label="item.label"
  317. :value="item.value">
  318. </el-option>
  319. </el-select>
  320. </div>
  321. <div class="mt15">
  322. <div ref="tempLine" class="ve-ring" style="height: 200px"></div>
  323. </div>
  324. </div>
  325. </el-col>
  326. <el-col :xs="12" :sm="8" :md="8" :lg="8">
  327. <div class="chart_item zhuti">
  328. <div style="font-weight: bold;" class="item_title">
  329. <span>本站气压 ( hPa )</span>
  330. <el-select v-model="timeValue" @change="changeTime" placeholder="请选择" size="small"
  331. style="width: 150px;">
  332. <el-option v-for="item in options" :key="item.value" :label="item.label"
  333. :value="item.value">
  334. </el-option>
  335. </el-select>
  336. </div>
  337. <div class="mt15">
  338. <div ref="pressureLine" class="ve-ring" style="height: 200px"></div>
  339. </div>
  340. </div>
  341. </el-col>
  342. </el-row>
  343. </div>
  344. <!-- 添加或修改岗位对话框 -->
  345. <el-dialog :title="dialog.title" v-model="dialog.visible" width="1200px" append-to-body>
  346. <div style="height: 500px;display: flex">
  347. <el-tabs tab-position="left" class="demo-tabs" style="height: 100%">
  348. <el-tab-pane label="风">
  349. <div class="container-tag">
  350. <template v-for="item in elementList" :key="item.id">
  351. <div v-if="item.data_type === '风'" :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
  352. @click="toggleSelection(item)">{{ item.data_name }}</div>
  353. </template>
  354. </div>
  355. </el-tab-pane>
  356. <el-tab-pane label="温湿度">
  357. <div class="container-tag">
  358. <template v-for="item in elementList" :key="item.id">
  359. <div v-if="item.data_type === '温湿度'" :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
  360. @click="toggleSelection(item)">{{ item.data_name }}</div>
  361. </template>
  362. </div>
  363. </el-tab-pane>
  364. <el-tab-pane label="气压">
  365. <div class="container-tag">
  366. <template v-for="item in elementList" :key="item.id">
  367. <div v-if="item.data_type === '气压'" :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
  368. @click="toggleSelection(item)">{{ item.data_name }}</div>
  369. </template>
  370. </div>
  371. </el-tab-pane>
  372. <el-tab-pane label="降水">
  373. <div class="container-tag">
  374. <template v-for="item in elementList" :key="item.id">
  375. <div v-if="item.data_type === '降水'" :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
  376. @click="toggleSelection(item)">{{ item.data_name }}</div>
  377. </template>
  378. </div>
  379. </el-tab-pane>
  380. <el-tab-pane label="云">
  381. <div class="container-tag">
  382. <template v-for="item in elementList" :key="item.id">
  383. <div v-if="item.data_type === '云'" :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
  384. @click="toggleSelection(item)">{{ item.data_name }}</div>
  385. </template>
  386. </div>
  387. </el-tab-pane>
  388. <el-tab-pane label="能见度">
  389. <div class="container-tag">
  390. <template v-for="item in elementList" :key="item.id">
  391. <div v-if="item.data_type === '能见度'" :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
  392. @click="toggleSelection(item)">{{ item.data_name }}</div>
  393. </template>
  394. </div>
  395. </el-tab-pane>
  396. <el-tab-pane label="天气现象">
  397. <div class="container-tag">
  398. <template v-for="item in elementList" :key="item.id">
  399. <div v-if="item.data_type === '天气现象'"
  400. :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
  401. @click="toggleSelection(item)">{{ item.data_name }}</div>
  402. </template>
  403. </div>
  404. </el-tab-pane>
  405. <el-tab-pane label="积雪">
  406. <div class="container-tag">
  407. <template v-for="item in elementList" :key="item.id">
  408. <div v-if="item.data_type === '积雪'" :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
  409. @click="toggleSelection(item)">{{ item.data_name }}</div>
  410. </template>
  411. </div>
  412. </el-tab-pane>
  413. <el-tab-pane label="地面温度">
  414. <div class="container-tag">
  415. <template v-for="item in elementList" :key="item.id">
  416. <div v-if="item.data_type === '地面温度'"
  417. :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
  418. @click="toggleSelection(item)">{{ item.data_name }}</div>
  419. </template>
  420. </div>
  421. </el-tab-pane>
  422. <el-tab-pane label="大气电场">
  423. <div class="container-tag">
  424. <template v-for="item in elementList" :key="item.id">
  425. <div v-if="item.data_type === '大气电场'"
  426. :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
  427. @click="toggleSelection(item)">{{ item.data_name }}</div>
  428. </template>
  429. </div>
  430. </el-tab-pane>
  431. <el-tab-pane label="闪电">
  432. <div class="container-tag">
  433. <template v-for="item in elementList" :key="item.id">
  434. <div v-if="item.data_type === '闪电'" :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
  435. @click="toggleSelection(item)">{{ item.data_name }}</div>
  436. </template>
  437. </div>
  438. </el-tab-pane>
  439. <el-tab-pane label="日照">
  440. <div class="container-tag">
  441. <template v-for="item in elementList" :key="item.id">
  442. <div v-if="item.data_type === '日照'" :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
  443. @click="toggleSelection(item)">{{ item.data_name }}</div>
  444. </template>
  445. </div>
  446. </el-tab-pane>
  447. <el-tab-pane label="总辐射">
  448. <div class="container-tag">
  449. <template v-for="item in elementList" :key="item.id">
  450. <div v-if="item.data_type === '总辐射'" :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
  451. @click="toggleSelection(item)">{{ item.data_name }}</div>
  452. </template>
  453. </div>
  454. </el-tab-pane>
  455. <el-tab-pane label="日照文">
  456. <div class="container-tag">
  457. <template v-for="item in elementList" :key="item.id">
  458. <div v-if="item.data_type === '日照文'" :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
  459. @click="toggleSelection(item)">{{ item.data_name }}</div>
  460. </template>
  461. </div>
  462. </el-tab-pane>
  463. <el-tab-pane label="水文">
  464. <div class="container-tag">
  465. <template v-for="item in elementList" :key="item.id">
  466. <div v-if="item.data_type === '水文'" :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
  467. @click="toggleSelection(item)">{{ item.data_name }}</div>
  468. </template>
  469. </div>
  470. </el-tab-pane>
  471. </el-tabs>
  472. <div class="selected-list-box">
  473. <div class="disposition-title" style="margin-top: 0px">已选要素</div>
  474. <div class="selected-list-c">
  475. <template v-for="(item, index) in copiedCustomizeColumns" :key="item.id">
  476. <div :class="selectedItemIndex === index ? 'selected-item-tag-active' : 'selected-item-tag'"
  477. @click="changeSelected(index)">{{ item.data_name }}</div>
  478. </template>
  479. </div>
  480. <div class="button-container">
  481. <el-button type="primary" plain class="top-left" @click="changeMoveUp">上移</el-button>
  482. <el-button type="primary" plain class="top-right" @click="changeMoveDown">下移</el-button>
  483. <el-button type="primary" plain class="bottom-left" @click="changeRemove">移除</el-button>
  484. <el-button type="primary" plain class="bottom-right" @click="changeCleared">清空</el-button>
  485. </div>
  486. </div>
  487. </div>
  488. <template #footer>
  489. <div class="dialog-footer">
  490. <el-button @click="cancel">取 消</el-button>
  491. <el-button type="primary" @click="submitForm">确 定</el-button>
  492. </div>
  493. </template>
  494. </el-dialog>
  495. </div>
  496. </template>
  497. <script setup lang="tsx" name="singleData">
  498. import * as echarts from 'echarts';
  499. import { ref, onMounted, reactive, watch, onDeactivated, onActivated,computed } from "vue";
  500. import { useGlobalStore } from "@/stores/modules/global";
  501. import { getDataItemList, getPlatformList, getRgDataList, getTacRecordList } from "@/api/modules/allData";
  502. import { Platform } from "@/api/interface";
  503. import { ElLoading } from "element-plus";
  504. import {useUserStore} from "@/stores/modules/user";
  505. /* 全局请求 loading */
  506. const loading = ref()
  507. /**
  508. * @description 开启 Loading
  509. * */
  510. const startFullLoading = () => {
  511. loading.value = ElLoading.service({
  512. fullscreen: true,
  513. lock: true,
  514. text: "Loading",
  515. background: "rgba(0, 0, 0, 0.7)"
  516. });
  517. };
  518. /**
  519. * @description 结束 Loading
  520. * */
  521. const endFullLoading = () => {
  522. loading.value.close();
  523. };
  524. const timeValue = ref(1);
  525. const queryInfo = ref(0)
  526. const pageable = ref({
  527. data_type: true,
  528. time_order: 1,
  529. as_code: undefined,
  530. data_items: [],
  531. pageNum: 1,
  532. pageSize: 20,
  533. total: 0
  534. });
  535. const pressure = ref()
  536. const humidity = ref()
  537. const windSpeed = ref()
  538. const wind = ref()
  539. const pie = ref()
  540. const tempLine = ref()
  541. const pressureLine = ref()
  542. const dialog = reactive<any>({
  543. visible: false,
  544. title: ''
  545. });
  546. const globalStore = useGlobalStore();
  547. const isDark = computed(() => globalStore.isDark);
  548. //自定义部分表头
  549. let customizeColumns = ref<any>([
  550. {
  551. data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
  552. data_id: 2,
  553. data_type: "风",
  554. data_item: "ER_FEN_ZHONG_PING_JUN_FENG_XIANG",
  555. data_name: "2分钟风向",
  556. data_unit: "°",
  557. data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
  558. data_value: "",
  559. data_order: 0,
  560. data_condition: 0
  561. },
  562. {
  563. data_id: 1,
  564. data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
  565. data_type: "风",
  566. data_name: "2分钟风速",
  567. data_item: "ER_FEN_ZHONG_PING_JUN_FENG_SU",
  568. data_unit: "m/s",
  569. data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
  570. data_value: "",
  571. data_order: 0,
  572. data_condition: 0
  573. },
  574. {
  575. data_id: 4,
  576. data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
  577. data_type: "风",
  578. data_name: "10分钟风向",
  579. data_item: "SHI_FEN_ZHONG_PING_JUN_FENG_XIANG",
  580. data_unit: "°",
  581. data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
  582. data_value: "",
  583. data_order: 0,
  584. data_condition: 0
  585. },
  586. {
  587. data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
  588. data_id: 3,
  589. data_type: "风",
  590. data_item: "SHI_FEN_ZHONG_PING_JUN_FENG_SU",
  591. data_name: "10分钟风速",
  592. data_unit: "m/s",
  593. data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
  594. data_value: "",
  595. data_order: 0,
  596. data_condition: 0
  597. },
  598. {
  599. data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
  600. data_id: 501,
  601. data_type: "能见度",
  602. data_item: "YI_FEN_ZHONG_PING_JUN_NENG_JIAN_DU",
  603. data_name: "1分钟平均能见度",
  604. data_unit: "m",
  605. data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
  606. data_value: "",
  607. data_order: 0,
  608. data_condition: 0
  609. },
  610. {
  611. data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
  612. data_id: 101,
  613. data_type: "温湿度",
  614. data_item: "QI_WEN",
  615. data_name: "气温",
  616. data_unit: "℃",
  617. data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
  618. data_value: "",
  619. data_order: 0,
  620. data_condition: 0
  621. },
  622. {
  623. data_id: 201,
  624. data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
  625. data_type: "气压",
  626. data_name: "水汽压",
  627. data_item: "SHUI_QI_YA",
  628. data_unit: "hPa",
  629. data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
  630. data_value: "",
  631. data_order: 0,
  632. data_condition: 0
  633. },
  634. {
  635. data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
  636. data_id: 109,
  637. data_type: "温湿度",
  638. data_item: "LU_DIAN_WEN_DU",
  639. data_name: "露点温度",
  640. data_unit: "℃",
  641. data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
  642. data_value: "",
  643. data_order: 0,
  644. data_condition: 0
  645. },
  646. {
  647. data_id: 202,
  648. data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
  649. data_type: "气压",
  650. data_name: "本站气压",
  651. data_item: "BEN_ZHAN_QI_YA",
  652. data_unit: "hPa",
  653. data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
  654. data_value: "",
  655. data_order: 0,
  656. data_condition: 0
  657. }, {
  658. data_id: 207,
  659. data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
  660. data_type: "气压",
  661. data_name: "海平面气压",
  662. data_item: "HAI_PING_MIAN_QI_YA",
  663. data_unit: "hPa",
  664. data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
  665. data_value: "",
  666. data_order: 0,
  667. data_condition: 0
  668. },
  669. {
  670. data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
  671. data_id: 312,
  672. data_type: "降水",
  673. data_item: "XIAO_SHI_LEI_JI_JIANG_SHUI_LIANG_CHENG_ZHONG",
  674. data_name: "小时累计降水量(称重)",
  675. data_unit: "mm",
  676. data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
  677. data_value: "",
  678. data_order: 0,
  679. data_condition: 0
  680. }
  681. ]);
  682. let defaultColumns = [
  683. {
  684. data_id: 8,
  685. data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
  686. data_type: "风",
  687. data_name: "瞬时风速",
  688. data_item: "SHUN_SHI_FENG_SU",
  689. data_unit: "m/s",
  690. data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
  691. data_value: "",
  692. data_order: 0,
  693. data_condition: 0,
  694. isSelected: true
  695. },
  696. {
  697. data_id: 9,
  698. data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
  699. data_type: "风",
  700. data_name: "瞬时风向",
  701. data_item: "SHUN_SHI_FENG_XIANG",
  702. data_unit: "°",
  703. data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
  704. data_value: "",
  705. data_order: 0,
  706. data_condition: 0,
  707. isSelected: true
  708. },
  709. {
  710. data_id: 202,
  711. data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
  712. data_type: "气压",
  713. data_name: "本站气压",
  714. data_item: "BEN_ZHAN_QI_YA",
  715. data_unit: "hPa",
  716. data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
  717. data_value: "",
  718. data_order: 0,
  719. data_condition: 0
  720. },
  721. {
  722. data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
  723. data_id: 101,
  724. data_type: "温湿度",
  725. data_item: "QI_WEN",
  726. data_name: "气温",
  727. data_unit: "℃",
  728. data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
  729. data_value: "",
  730. data_order: 0,
  731. data_condition: 0
  732. },
  733. {
  734. data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
  735. data_id: 106,
  736. data_type: "温湿度",
  737. data_item: "XIANG_DUI_SHI_DU",
  738. data_name: "相对湿度",
  739. data_unit: "%",
  740. data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
  741. data_value: "",
  742. data_order: 0,
  743. data_condition: 0,
  744. isSelected: true
  745. },
  746. {
  747. data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
  748. data_id: 312,
  749. data_type: "降水",
  750. data_item: "XIAO_SHI_LEI_JI_JIANG_SHUI_LIANG_CHENG_ZHONG",
  751. data_name: "小时累计降水量(称重)",
  752. data_unit: "mm",
  753. data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
  754. data_value: "",
  755. data_order: 0,
  756. data_condition: 0
  757. }, {
  758. data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
  759. data_id: 311,
  760. data_type: "降水",
  761. data_item: "FEN_ZHONG_JIANG_SHUI_LIANG_CHENG_ZHONG",
  762. data_name: "分钟降水量(称重)",
  763. data_unit: "mm",
  764. data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
  765. data_value: "",
  766. data_order: 0,
  767. data_condition: 0,
  768. isSelected: true
  769. },
  770. {
  771. data_id: 301,
  772. data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
  773. data_type: "降水",
  774. data_name: "分钟降水量(翻斗)",
  775. data_item: "FEN_ZHONG_JIANG_SHUI_LIANG_FAN_DOU",
  776. data_unit: "mm",
  777. data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
  778. data_value: "",
  779. data_order: 0,
  780. data_condition: 0,
  781. isSelected: true
  782. },
  783. {
  784. data_id: 302,
  785. data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
  786. data_type: "降水",
  787. data_name: "小时累计降水量(翻斗)",
  788. data_item: "XIAO_SHI_LEI_JI_JIANG_SHUI_LIANG_FAN_DOU",
  789. data_unit: "mm",
  790. data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
  791. data_value: "",
  792. data_order: 0,
  793. data_condition: 0,
  794. isSelected: true
  795. },
  796. {
  797. data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
  798. data_id: 601,
  799. data_type: "天气现象",
  800. data_item: "SHI_CHENG_ZHANG_AI_XIAN_XIANG",
  801. data_name: "视程障碍现象",
  802. data_unit: "",
  803. data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
  804. data_value: "",
  805. data_order: 0,
  806. data_condition: 0
  807. },
  808. {
  809. data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
  810. data_id: 602,
  811. data_type: "天气现象",
  812. data_item: "JIANG_SHUI_XIAN_XIANG",
  813. data_name: "降水现象",
  814. data_unit: "",
  815. data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
  816. data_value: "",
  817. data_order: 0,
  818. data_condition: 0
  819. },
  820. {
  821. data_id: 603,
  822. data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
  823. data_type: "天气现象",
  824. data_name: "雷暴现象",
  825. data_item: "LEI_BAO_XIAN_XIANG",
  826. data_unit: "",
  827. data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
  828. data_value: "",
  829. data_order: 0,
  830. data_condition: 0
  831. },
  832. {
  833. data_id: 604,
  834. data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
  835. data_type: "天气现象",
  836. data_name: "地面凝结现象",
  837. data_item: "DI_MIAN_NING_JIE_XIAN_XIANG",
  838. data_unit: "",
  839. data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
  840. data_value: "",
  841. data_order: 0,
  842. data_condition: 0
  843. },
  844. {
  845. data_id: 605,
  846. data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
  847. data_type: "天气现象",
  848. data_name: "其他现象",
  849. data_item: "QI_TA_XIAN_XIANG",
  850. data_unit: "",
  851. data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
  852. data_value: "",
  853. data_order: 0,
  854. data_condition: 0
  855. }
  856. ];
  857. let historyColumns = [
  858. {
  859. data_id: 8,
  860. data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
  861. data_type: "风",
  862. data_name: "瞬时风速",
  863. data_item: "SHUN_SHI_FENG_SU",
  864. data_unit: "m/s",
  865. data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
  866. data_value: "",
  867. data_order: 0,
  868. data_condition: 0,
  869. isSelected: true
  870. },
  871. {
  872. data_id: 9,
  873. data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
  874. data_type: "风",
  875. data_name: "瞬时风向",
  876. data_item: "SHUN_SHI_FENG_XIANG",
  877. data_unit: "°",
  878. data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
  879. data_value: "",
  880. data_order: 0,
  881. data_condition: 0,
  882. isSelected: true
  883. },
  884. {
  885. data_id: 202,
  886. data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
  887. data_type: "气压",
  888. data_name: "本站气压",
  889. data_item: "BEN_ZHAN_QI_YA",
  890. data_unit: "hPa",
  891. data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
  892. data_value: "",
  893. data_order: 0,
  894. data_condition: 0
  895. },
  896. {
  897. data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
  898. data_id: 101,
  899. data_type: "温湿度",
  900. data_item: "QI_WEN",
  901. data_name: "气温",
  902. data_unit: "℃",
  903. data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
  904. data_value: "",
  905. data_order: 0,
  906. data_condition: 0
  907. },
  908. {
  909. data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
  910. data_id: 106,
  911. data_type: "温湿度",
  912. data_item: "XIANG_DUI_SHI_DU",
  913. data_name: "相对湿度",
  914. data_unit: "%",
  915. data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
  916. data_value: "",
  917. data_order: 0,
  918. data_condition: 0,
  919. isSelected: true
  920. },
  921. ]
  922. const sensorList = ref<any>([])
  923. // 被选中当条数据下标
  924. const selectedItemIndex = ref(0)
  925. const changeMoveUp = () => {
  926. //上移
  927. if (selectedItemIndex.value > 0) {
  928. const temp = copiedCustomizeColumns.value[selectedItemIndex.value - 1]
  929. copiedCustomizeColumns.value[selectedItemIndex.value - 1] = copiedCustomizeColumns.value[selectedItemIndex.value]
  930. copiedCustomizeColumns.value[selectedItemIndex.value] = temp
  931. selectedItemIndex.value--
  932. }
  933. }
  934. const changeMoveDown = () => {
  935. //下移
  936. if (selectedItemIndex.value < copiedCustomizeColumns.value.length - 1) {
  937. const temp = copiedCustomizeColumns.value[selectedItemIndex.value + 1]
  938. copiedCustomizeColumns.value[selectedItemIndex.value + 1] = copiedCustomizeColumns.value[selectedItemIndex.value]
  939. copiedCustomizeColumns.value[selectedItemIndex.value] = temp
  940. selectedItemIndex.value++
  941. }
  942. }
  943. const changeRemove = () => {
  944. //删除数据
  945. if (copiedCustomizeColumns.value.length > 0) {
  946. const custom = copiedCustomizeColumns.value[selectedItemIndex.value];
  947. const se_type = custom.se_type
  948. for (let i = 0; i < sensorList.value.length; i++) {
  949. if (sensorList.value[i].se_type === se_type) {
  950. sensorList.value[i].isSelected = false;
  951. }
  952. }
  953. copiedCustomizeColumns.value.splice(selectedItemIndex.value, 1)
  954. if (selectedItemIndex.value === copiedCustomizeColumns.value.length) {
  955. selectedItemIndex.value--
  956. }
  957. }
  958. }
  959. const changeCleared = () => {
  960. //清空所有数据
  961. selectedItemIndex.value = 0
  962. copiedCustomizeColumns.value = []
  963. for (let i = 0; i < sensorList.value.length; i++) {
  964. sensorList.value[i].isSelected = false;
  965. }
  966. }
  967. const changeSelected = (index) => {
  968. selectedItemIndex.value = index
  969. }
  970. const dataTypeList = [
  971. {
  972. value: 0,
  973. label: '能见度',
  974. },
  975. {
  976. value: 1,
  977. label: '风速',
  978. },
  979. {
  980. value: 2,
  981. label: '大气电场',
  982. }, {
  983. value: 3,
  984. label: '云量',
  985. }, {
  986. value: 4,
  987. label: '云高',
  988. }, {
  989. value: 5,
  990. label: '温度',
  991. }, {
  992. value: 6,
  993. label: '湿度',
  994. }, {
  995. value: 7,
  996. label: '小时雨量',
  997. }
  998. ]
  999. function findLabelByValue(noticeTypeList, value) {
  1000. const item = noticeTypeList.find(item => item.value === value);
  1001. return item ? item.label : null;
  1002. }
  1003. // 判断风级的方法
  1004. function getWindLevel(windSpeed) {
  1005. // 定义风级表
  1006. const windScale = [
  1007. { start: 0.0, end: 0.2, level: 0 },
  1008. { start: 0.3, end: 1.5, level: 1 },
  1009. { start: 1.6, end: 3.3, level: 2 },
  1010. { start: 3.4, end: 5.4, level: 3 },
  1011. { start: 5.5, end: 7.9, level: 4 },
  1012. { start: 8.0, end: 10.7, level: 5 },
  1013. { start: 10.8, end: 13.8, level: 6 },
  1014. { start: 13.9, end: 17.1, level: 7 },
  1015. { start: 17.2, end: 20.7, level: 8 },
  1016. { start: 20.8, end: 24.4, level: 9 },
  1017. { start: 24.5, end: 28.4, level: 10 },
  1018. { start: 28.5, end: 32.6, level: 11 },
  1019. { start: 32.7, end: 36.9, level: 12 },
  1020. { start: 37.0, end: 41.4, level: 13 },
  1021. { start: 41.5, end: 46.1, level: 14 },
  1022. { start: 46.2, end: 50.9, level: 15 },
  1023. { start: 51.0, end: 56.0, level: 16 },
  1024. // 对于最后一个范围,我们可以使用Number.MAX_SAFE_INTEGER来表示DBL_MAX
  1025. { start: 56.1, end: Number.MAX_SAFE_INTEGER, level: 17 }
  1026. ];
  1027. for (let i = 0; i < windScale.length; i++) {
  1028. if (Number(windSpeed) >= Number(windScale[i].start) && (Number(windSpeed) <= Number(windScale[i].end) || Number(windSpeed) === Number.MAX_SAFE_INTEGER)) {
  1029. return windScale[i].level;
  1030. }
  1031. }
  1032. // 如果没有匹配到任何风级(理论上不应该发生),返回-1或其他错误码
  1033. return '--';
  1034. }
  1035. // const updateColumns = () => {
  1036. // pageable.value.data_items = [...customizeColumns.value,...defaultColumns];
  1037. // // getList();
  1038. // }
  1039. //操作 自定义部分表头
  1040. const copiedCustomizeColumns = ref<any>([...customizeColumns.value]);
  1041. // 查询自动站列表
  1042. const queryas = ref<Platform>({
  1043. pageSize: 5000,
  1044. pageNum: 1,
  1045. currentpage: 1
  1046. })
  1047. const userStore = useUserStore();
  1048. const platformList =ref<any>(computed(() => userStore.stations))
  1049. const selectPlatform = ref()
  1050. const getPlatforms = async () => {
  1051. pageable.value.as_code = platformList.value[0].as_code
  1052. selectPlatform.value = platformList.value[0]
  1053. getList()
  1054. // getHistoryList()
  1055. weatherInfo()
  1056. };
  1057. const changeStation = (e) => {
  1058. selectPlatform.value = platformList.value.find(item => item.as_code === e);
  1059. // pageable.value.as_code = selectPlatform.value.as_code
  1060. getList()
  1061. // getHistoryList()
  1062. weatherInfo()
  1063. }
  1064. const changeTime = () => {
  1065. getHistoryList()
  1066. }
  1067. //时间戳转换为指定格式的日期字符串
  1068. function formatDate(timestamp, type) {
  1069. const date = new Date(timestamp * 1000); // 将时间戳转换为毫秒
  1070. const year = date.getFullYear();
  1071. const month = String(date.getMonth() + 1).padStart(2, '0');
  1072. const day = String(date.getDate()).padStart(2, '0');
  1073. const hours = String(date.getHours()).padStart(2, '0');
  1074. const minutes = String(date.getMinutes()).padStart(2, '0');
  1075. if (type === 1) {
  1076. return `${month}/${day} ${hours}:${minutes}`;
  1077. } else {
  1078. return `${year}-${month}-${day} ${hours}:${minutes}`;
  1079. }
  1080. }
  1081. // 获取天气现象
  1082. function getYenSymbolLaterCharacters(inputString) {
  1083. // 使用正则表达式匹配¥符号及其后面的字符
  1084. const regex = /#([\s\S]*)/;
  1085. const match = inputString.match(regex);
  1086. // 如果匹配成功,则返回¥后面的字符,否则返回null
  1087. if (match && match.length > 1) {
  1088. return match[1];
  1089. } else {
  1090. return null;
  1091. }
  1092. }
  1093. // 获取指定时间戳之前的时间戳
  1094. function getTimeStamp(type, timestamp) {
  1095. let date = new Date(timestamp * 1000); // 将秒的时间戳转换为毫秒的时间戳
  1096. let now = date;
  1097. let timestampResult;
  1098. switch (type) {
  1099. case 0:
  1100. // 获取当前时间的时间戳
  1101. timestampResult = Math.floor(now.getTime() / 1000);
  1102. break;
  1103. case 1:
  1104. // 获取30分钟之前的时间戳
  1105. now.setMinutes(now.getMinutes() - 30);
  1106. timestampResult = Math.floor(now.getTime() / 1000);
  1107. break;
  1108. case 2:
  1109. // 获取24小时之前的整点时间戳
  1110. now.setHours(now.getHours() - 24, 0, 0, 0);
  1111. timestampResult = Math.floor(now.getTime() / 1000);
  1112. break;
  1113. case 3:
  1114. // 获取48小时之前的整点时间戳
  1115. now.setHours(now.getHours() - 48, 0, 0, 0);
  1116. timestampResult = Math.floor(now.getTime() / 1000);
  1117. break;
  1118. case 4:
  1119. // 获取现在的整点时间戳
  1120. now.setMinutes(0, 0, 0);
  1121. timestampResult = Math.floor(now.getTime() / 1000);
  1122. break;
  1123. default:
  1124. throw new Error('Invalid type');
  1125. }
  1126. return timestampResult;
  1127. }
  1128. // 获取指定id的数组
  1129. function getObjectById(array, id) {
  1130. return array.find(item => item.id === id);
  1131. }
  1132. // 查询所有人工要素字典表
  1133. const elementList = ref<any>([])
  1134. const getAllRgDataList = async () => {
  1135. const { data } = await getRgDataList();
  1136. elementList.value = data.list
  1137. };
  1138. const dataItemInfo = ref<any>({})
  1139. const selectElement = ref<any>([])
  1140. const dangerWeather = ref<any>([])
  1141. const getList = async () => {
  1142. const arr = [...customizeColumns.value, ...defaultColumns].reduce((acc, item) => {
  1143. if (!acc.some(existingItem => existingItem.data_id === item.data_id)) {
  1144. acc.push(item);
  1145. }
  1146. return acc;
  1147. }, []);
  1148. const res = await getDataItemList({ ...pageable.value, as_code_list: [pageable.value.as_code], data_items: arr });
  1149. dataItemInfo.value = res.data.list ? (res.data.list.length === 0 ? {} : res.data.list[0]) : {};
  1150. // console.log(dataItemInfo.value, 555);
  1151. showTemp()
  1152. showHumidity()
  1153. showPressure()
  1154. showWindSpeed()
  1155. currentValue.value = dataItemInfo.value[312] && dataItemInfo.value[312] != 0 && dataItemInfo.value[312] != '--' ? dataItemInfo.value[302] : dataItemInfo.value[302] && dataItemInfo.value[302] != 0 ? dataItemInfo.value[302] : '--'
  1156. // currentValue.value = dataItemInfo.value[312] && dataItemInfo.value[312] != 0 && dataItemInfo.value[312] != '--' ? dataItemInfo.value[302] : dataItemInfo.value[302] && dataItemInfo.value[302] != 0 ? dataItemInfo.value[302] : 0
  1157. mincurrentValue.value = dataItemInfo.value[311] && dataItemInfo.value[311] != 0 && dataItemInfo.value[311] != '--' ? dataItemInfo.value[301] : dataItemInfo.value[301] && dataItemInfo.value[301] != 0 ? dataItemInfo.value[302] : '--'
  1158. selectElement.value = res.data.list ? dataItemInfo.value?.data_list.filter(itemB => customizeColumns.value.some(itemA => itemA.data_id === itemB.data_id)) : [];
  1159. const ids = [601, 602, 603, 604, 605]
  1160. dangerWeather.value = res.data.list ? dataItemInfo.value.data_list
  1161. .filter(item => ids.includes(item.data_id) && item.data_value !== '--' && item.data_value !== '')
  1162. .map(item => item) : []
  1163. console.log(dangerWeather.value, 666);
  1164. // .filter(item => ids.includes(item.data_id) && getYenSymbolLaterCharacters(item.remark) !== '无明显天气现象')
  1165. getHistoryList()
  1166. };
  1167. function adjustValue(value) {
  1168. if (value === 'C') {
  1169. return 0
  1170. } else if (value <= 180) {
  1171. return '-' + value;
  1172. } else {
  1173. return 360 - value;
  1174. }
  1175. }
  1176. const showChart = ref(false)
  1177. const timeArr = ref()
  1178. const tempLineArr = ref()
  1179. const humidityLineArr = ref()
  1180. const pressureLineArr = ref()
  1181. const windLineArr = ref()
  1182. const getHistoryList = async () => {
  1183. showChart.value = false
  1184. const arr = [...customizeColumns.value, ...defaultColumns].reduce((acc, item) => {
  1185. if (!acc.some(existingItem => existingItem.data_id === item.data_id)) {
  1186. acc.push(item);
  1187. }
  1188. return acc;
  1189. }, []);
  1190. const { data } = await getDataItemList({ ...pageable.value, pageSize: 999, as_code_list: [pageable.value.as_code], data_items: historyColumns, data_type: false, begin_time: getTimeStamp(timeValue.value, dataItemInfo.value.data_time_i), end_time: getTimeStamp(timeValue.value == 1 ? 0 : 4, dataItemInfo.value.data_time_i), time_space: timeValue.value == 1 ? 1 : 60 });
  1191. timeArr.value = data.list?.map(item => {
  1192. return formatDate(item.data_time_i, 1)
  1193. })
  1194. tempLineArr.value = data.list?.map(item => {
  1195. return item[101]
  1196. })
  1197. humidityLineArr.value = data.list?.map(item => {
  1198. return item[106]
  1199. })
  1200. pressureLineArr.value = data.list?.map(item => {
  1201. return item[202]
  1202. })
  1203. windLineArr.value = data.list?.map(item => {
  1204. return {
  1205. value: item[8],
  1206. symbolRotate: adjustValue(item[9]),
  1207. symbolRotateStr: item[9] === 'C' ? 0 : item[9]
  1208. }
  1209. })
  1210. showTempLine()
  1211. showPressureLine()
  1212. showWind()
  1213. showChart.value = true
  1214. };
  1215. // 要素的选中和取消
  1216. const toggleSelection = (item) => {
  1217. item.isSelected = !item.isSelected
  1218. if (item.isSelected) {
  1219. //添加
  1220. copiedCustomizeColumns.value.push(item)
  1221. } else {
  1222. //删除
  1223. copiedCustomizeColumns.value = copiedCustomizeColumns.value.filter(column => column.data_id !== item.data_id);
  1224. }
  1225. }
  1226. const handleSetting = () => {
  1227. copiedCustomizeColumns.value = [...customizeColumns.value]
  1228. elementList.value.forEach(element => {
  1229. const column = copiedCustomizeColumns.value.find(col => col.data_id === element.data_id);
  1230. if (column) {
  1231. element.isSelected = true;
  1232. } else {
  1233. element.isSelected = false;
  1234. }
  1235. });
  1236. dialog.title = "列表字段设置"
  1237. dialog.visible = true;
  1238. }
  1239. const submitForm = async () => {
  1240. dialog.visible = false;
  1241. customizeColumns.value = [...copiedCustomizeColumns.value]
  1242. // updateColumns()
  1243. await getList()
  1244. await weatherInfo()
  1245. // await getHistoryList()
  1246. saveCustomizeColumns()
  1247. }
  1248. const cancel = () => {
  1249. dialog.visible = false;
  1250. }
  1251. const wertherColumns = ref<any>({
  1252. tact_state_on: true,
  1253. tact_data_on: false,
  1254. tact_state: 0,
  1255. tact_data: 0,
  1256. begin_time: undefined,
  1257. end_time: undefined,
  1258. pageNum: 1,
  1259. pageSize: 20,
  1260. total: 1
  1261. });
  1262. const weatherInfoArr = ref()
  1263. const weatherInfo = async () => {
  1264. const { data } = await getTacRecordList({ ...wertherColumns.value, as_code_list: [pageable.value.as_code] });
  1265. weatherInfoArr.value = data.list
  1266. };
  1267. const options = [{
  1268. value: 1,
  1269. label: '30分钟'
  1270. }, {
  1271. value: 2,
  1272. label: '24小时'
  1273. }, {
  1274. value: 3,
  1275. label: '48小时'
  1276. }]
  1277. const currentValue = ref<any>(0);
  1278. const mincurrentValue = ref<any>(0)
  1279. const gradientStyle = computed(() => {
  1280. return {
  1281. height: '180px',
  1282. background: 'linear-gradient(to top, #D9FDD5, #CCFB99,#FDFFAC,#FCF4C6,#F7D2A6,#EB9C8B,#E46528,#D32E22,#C71D11,#BC1408,#B41408,#9A0D03)', // 从下到上,从红色到白色
  1283. width: '40px', // 盒子的宽度
  1284. };
  1285. });
  1286. const minStyle = computed(() => {
  1287. return {
  1288. height: '180px',
  1289. background: 'linear-gradient(to top, #D9FDD5, #CCFB99,#FDFFAC,#FCF4C6,#F7D2A6,#EB9C8B,#E46528,#D32E22)', // 从下到上,从红色到白色
  1290. width: '40px', // 盒子的宽度
  1291. };
  1292. });
  1293. const arrowStyle = computed(() => {
  1294. // 计算箭头顶部位置,使其指向盒子内的相应位置
  1295. // 由于盒子高度是150px,而值域是0-100,因此需要进行缩放
  1296. const maxTop = '0px'; // 表示100的位置
  1297. const scaleFactor = 180 / 40; // 缩放因子
  1298. // const top = `${(180 - (currentValue.value / 40) * 180)}px`; // 从底部开始计算
  1299. const calculatedTop = `${(180 - (Math.min(currentValue.value=='--'?0:currentValue.value, 40) / 40) * 180)}px`;
  1300. const top = (currentValue.value=='--'?0:currentValue.value) > 40 ? maxTop : calculatedTop;
  1301. return {
  1302. top,
  1303. position: 'absolute',
  1304. // right: '10', // 箭头紧贴盒子右侧
  1305. transform: 'translateY(-50%) translateX(50%)', // 旋转并尝试垂直居中(但这里的-50%是相对于箭头自身的)
  1306. };
  1307. });
  1308. const minarrowStyle = computed(() => {
  1309. // 计算箭头顶部位置,使其指向盒子内的相应位置
  1310. // 由于盒子高度是150px,而值域是0-100,因此需要进行缩放
  1311. const scaleFactor = 180 / 4; // 缩放因子
  1312. const top = `${(180 - (mincurrentValue.value==='--'?0:mincurrentValue.value / 4) * 180)}px`; // 从底部开始计算
  1313. return {
  1314. top,
  1315. position: 'absolute',
  1316. // right: '10', // 箭头紧贴盒子右侧
  1317. transform: 'translateY(-50%) translateX(50%)', // 旋转并尝试垂直居中(但这里的-50%是相对于箭头自身的)
  1318. };
  1319. });
  1320. const showPressure = () => {
  1321. let gradientColor = {
  1322. type: 'linear',
  1323. x: 0,
  1324. y: 0,
  1325. x2: 0,
  1326. y2: 1,
  1327. colorStops: [
  1328. {
  1329. offset: 0,
  1330. color: '#760202'
  1331. },
  1332. {
  1333. offset: 0.5,
  1334. color: '#DE3333'
  1335. },
  1336. {
  1337. offset: 1,
  1338. color: 'rgba(236, 111, 105,0.1)'
  1339. }
  1340. ]
  1341. };
  1342. let mychart = echarts.init(pressure.value);
  1343. let option = {
  1344. series: [
  1345. {
  1346. type: 'gauge',
  1347. radius: '100%',
  1348. min: 500,
  1349. max: 1100,
  1350. splitNumber: 6,
  1351. axisLine: {
  1352. lineStyle: {
  1353. width: 4,
  1354. color: [
  1355. [0.4, {
  1356. type: "linear",
  1357. colorStops: [
  1358. { offset: 0, color: "#99A9F9" },
  1359. { offset: 1, color: "#99A9F9" }
  1360. ]
  1361. }],
  1362. [0.55, {
  1363. type: "linear",
  1364. colorStops: [
  1365. { offset: 0, color: "#99A9F9" },
  1366. { offset: 1, color: "#3734c8" }
  1367. ]
  1368. }],
  1369. [0.8, {
  1370. type: "linear",
  1371. colorStops: [
  1372. { offset: 0, color: "#3734c8" },
  1373. { offset: 1, color: "#140AC4" }
  1374. ]
  1375. }],
  1376. [1, {
  1377. type: "linear",
  1378. colorStops: [
  1379. { offset: 0, color: "#140AC4" },
  1380. { offset: 1, color: "#140AC4" }
  1381. ]
  1382. }],
  1383. ]
  1384. }
  1385. },
  1386. pointer: {
  1387. width: 3,
  1388. length: '50%',
  1389. offsetCenter: ['0%', '-30%'],
  1390. itemStyle: {
  1391. color: gradientColor
  1392. }
  1393. },
  1394. axisTick: {
  1395. distance: 5,
  1396. splitNumber: 10,
  1397. length: 5,
  1398. lineStyle: {
  1399. color: 'auto',
  1400. width: 1
  1401. }
  1402. },
  1403. splitLine: {
  1404. distance: 0,
  1405. length: 10,
  1406. lineStyle: {
  1407. color: 'auto',
  1408. width: 2
  1409. }
  1410. },
  1411. axisLabel: {
  1412. color: isDark.value ? '#fff' : "#666",
  1413. distance: 8,
  1414. fontSize: 10
  1415. },
  1416. detail: {
  1417. offsetCenter: [0, 0],
  1418. valueAnimation: true,
  1419. formatter: '{value}',
  1420. color: isDark.value ? '#fff' : "#000",
  1421. fontSize: 30,
  1422. },
  1423. data: [
  1424. {
  1425. value: dataItemInfo.value && dataItemInfo.value[202] ? dataItemInfo.value[202] : '--'
  1426. }
  1427. ]
  1428. }
  1429. ]
  1430. };
  1431. mychart.setOption(option)
  1432. window.addEventListener("resize", function () {
  1433. mychart.resize();
  1434. });
  1435. }
  1436. const showHumidity = () => {
  1437. let gradientColor = {
  1438. type: 'linear',
  1439. x: 0,
  1440. y: 0,
  1441. x2: 0,
  1442. y2: 1,
  1443. colorStops: [
  1444. {
  1445. offset: 0,
  1446. color: '#760202'
  1447. },
  1448. {
  1449. offset: 0.5,
  1450. color: '#DE3333'
  1451. },
  1452. {
  1453. offset: 1,
  1454. color: 'rgba(236, 111, 105,0.1)'
  1455. }
  1456. ]
  1457. };
  1458. let mychart = echarts.init(humidity.value);
  1459. let option = {
  1460. series: [
  1461. {
  1462. type: 'gauge',
  1463. radius: '100%',
  1464. min: 0,
  1465. max: 100,
  1466. axisLine: {
  1467. lineStyle: {
  1468. width: 4,
  1469. color: [
  1470. [0.6, {
  1471. type: "linear",
  1472. colorStops: [
  1473. { offset: 0, color: "#016FE8" },
  1474. { offset: 1, color: "#016FE8" }
  1475. ]
  1476. }],
  1477. [0.7, {
  1478. type: "linear",
  1479. colorStops: [
  1480. { offset: 0, color: "#016FE8" },
  1481. { offset: 1, color: "#4058a4" }
  1482. ]
  1483. }],
  1484. [0.8, {
  1485. type: "linear",
  1486. colorStops: [
  1487. { offset: 0, color: "#4058a4" },
  1488. { offset: 1, color: "#824161" }
  1489. ]
  1490. }],
  1491. [0.90, {
  1492. type: "linear",
  1493. colorStops: [
  1494. { offset: 0, color: "#824161" },
  1495. { offset: 1, color: "#aa3339" }
  1496. ]
  1497. }],
  1498. [0.98, {
  1499. type: "linear",
  1500. colorStops: [
  1501. { offset: 0, color: "#aa3339" },
  1502. { offset: 1, color: "#b03133" }
  1503. ]
  1504. }],
  1505. [1, {
  1506. type: "linear",
  1507. colorStops: [
  1508. { offset: 0, color: "#C92A1D" },
  1509. { offset: 1, color: "#C92A1D" }
  1510. ]
  1511. }]
  1512. ]
  1513. }
  1514. },
  1515. pointer: {
  1516. width: 3,
  1517. length: '50%',
  1518. offsetCenter: ['0%', '-30%'],
  1519. itemStyle: {
  1520. color: gradientColor
  1521. }
  1522. },
  1523. axisTick: {
  1524. distance: 5,
  1525. splitNumber: 10,
  1526. length: 5,
  1527. lineStyle: {
  1528. color: 'auto',
  1529. width: 1
  1530. }
  1531. },
  1532. splitLine: {
  1533. distance: 0,
  1534. length: 10,
  1535. lineStyle: {
  1536. color: 'auto',
  1537. width: 2
  1538. }
  1539. },
  1540. axisLabel: {
  1541. color: isDark.value ? '#fff' : "#666",
  1542. distance: 8,
  1543. fontSize: 10
  1544. },
  1545. detail: {
  1546. offsetCenter: [0, 0],
  1547. valueAnimation: true,
  1548. formatter: '{value}',
  1549. color: isDark.value ? '#fff' : "#000",
  1550. fontSize: 30,
  1551. },
  1552. data: [
  1553. {
  1554. value: dataItemInfo.value && dataItemInfo.value[106] ? dataItemInfo.value[106] : '--'
  1555. }
  1556. ]
  1557. }
  1558. ]
  1559. };
  1560. mychart.setOption(option)
  1561. window.addEventListener("resize", function () {
  1562. mychart.resize();
  1563. });
  1564. }
  1565. const showWindSpeed = () => {
  1566. let gradientColor = {
  1567. type: 'linear',
  1568. x: 0,
  1569. y: 0,
  1570. x2: 0,
  1571. y2: 1,
  1572. colorStops: [
  1573. {
  1574. offset: 0,
  1575. color: '#760202'
  1576. },
  1577. {
  1578. offset: 0.5,
  1579. color: '#DE3333'
  1580. },
  1581. {
  1582. offset: 1,
  1583. color: 'rgba(236, 111, 105,0.1)'
  1584. }
  1585. ]
  1586. };
  1587. let mychart = echarts.init(windSpeed.value);
  1588. let option = {
  1589. series: [
  1590. {
  1591. type: 'gauge',
  1592. radius: '100%',
  1593. // detail: {
  1594. // show: false
  1595. // },
  1596. // detail: {
  1597. // offsetCenter: [0, 0],
  1598. // valueAnimation: true,
  1599. // formatter: function(params) {
  1600. // return params.name + 'm/s';
  1601. // },
  1602. // color: 'black',
  1603. // fontSize: 30,
  1604. // },
  1605. title: {
  1606. show: true,
  1607. offsetCenter: [0, '-0%'], // x, y,单位px
  1608. textStyle: {
  1609. color: isDark.value ? '#fff' : "#000",
  1610. fontSize: 30
  1611. }
  1612. },
  1613. // detail: {
  1614. // formatter: function (params) {
  1615. // // 返回数据项的 name 属性
  1616. // return params.name;
  1617. // }
  1618. // },
  1619. startAngle: 90,
  1620. splitNumber: 8,
  1621. endAngle: 450,
  1622. min: 0,
  1623. max: 360,
  1624. axisLine: {
  1625. lineStyle: {
  1626. width: 4,
  1627. color: [
  1628. [1, {
  1629. type: "linear",
  1630. colorStops: [
  1631. { offset: 0, color: "#016fe8" },
  1632. { offset: 1, color: "#016fe8" }
  1633. ]
  1634. }]
  1635. ]
  1636. }
  1637. },
  1638. pointer: {
  1639. width: 3,
  1640. length: '50%',
  1641. offsetCenter: ['0%', '-30%'],
  1642. itemStyle: {
  1643. color: gradientColor
  1644. }
  1645. },
  1646. axisTick: {
  1647. distance: 5,
  1648. splitNumber: 10,
  1649. length: 5,
  1650. lineStyle: {
  1651. color: 'auto',
  1652. width: 1
  1653. }
  1654. },
  1655. splitLine: {
  1656. distance: 3,
  1657. length: 10,
  1658. lineStyle: {
  1659. color: 'auto',
  1660. width: 2
  1661. }
  1662. },
  1663. axisLabel: {
  1664. fontSize: 10,
  1665. distance: 10,
  1666. color: isDark.value ? '#fff' : "#666",
  1667. formatter: function (value) {
  1668. if (value === 0) {
  1669. return '北';
  1670. }
  1671. else if (value === 45) {
  1672. return '东北';
  1673. }
  1674. else if (value === 90) {
  1675. return '东';
  1676. }
  1677. else if (value === 135) {
  1678. return '东南';
  1679. }
  1680. else if (value === 180) {
  1681. return '南';
  1682. }
  1683. else if (value === 225) {
  1684. return '西南';
  1685. }
  1686. else if (value === 270) {
  1687. return '西';
  1688. }
  1689. else if (value === 315) {
  1690. return '西北';
  1691. }
  1692. }
  1693. },
  1694. detail: {
  1695. offsetCenter: [-12, 5],
  1696. valueAnimation: true,
  1697. formatter: getWindLevel(dataItemInfo.value && dataItemInfo.value[8] ? dataItemInfo.value[8] : -1).toString(),
  1698. // formatter:'2' ,
  1699. color: isDark.value ? '#fff' : "#000",
  1700. // fontSize: 10,
  1701. },
  1702. data: [
  1703. {
  1704. // value:270,
  1705. value: dataItemInfo.value && dataItemInfo.value[9] == 'C' ? 0 : Number(dataItemInfo.value[9]),
  1706. name: '级',
  1707. detail: {
  1708. fontSize: 40,
  1709. // fontWeight: 400
  1710. },
  1711. title: {
  1712. offsetCenter: [12, 10],
  1713. fontSize: 15,
  1714. fontWeight: 400
  1715. }
  1716. }
  1717. ]
  1718. // detail: {
  1719. // offsetCenter: [0, 0],
  1720. // valueAnimation: true,
  1721. // formatter: '2',
  1722. // color: 'black',
  1723. // fontSize: 30,
  1724. // },
  1725. // data: [{
  1726. // value: 270,
  1727. // name: '2级',
  1728. // detail: {
  1729. // fontSize: 39
  1730. // }
  1731. // }]
  1732. }
  1733. ]
  1734. };
  1735. mychart.setOption(option)
  1736. window.addEventListener("resize", function () {
  1737. mychart.resize();
  1738. });
  1739. }
  1740. const showWind = () => {
  1741. // 数据格式
  1742. let mychart = echarts.init(wind.value);
  1743. let option = {
  1744. title: {
  1745. text: '暂无数据',
  1746. show: !timeArr.value ? true : false,
  1747. x: 'center',
  1748. y: 'center',
  1749. textStyle: {
  1750. fontSize: 14,
  1751. fontWeight: 'normal',
  1752. }
  1753. },
  1754. grid: {
  1755. left: '10',
  1756. right: '10',
  1757. bottom: '3%',
  1758. top: 20,
  1759. containLabel: true
  1760. },
  1761. // X轴
  1762. xAxis: {
  1763. type: 'category',
  1764. splitLine: {
  1765. show: false
  1766. },
  1767. boundaryGap: true,
  1768. axisTick: {
  1769. alignWithLabel: true, // true:标签位于刻度线正下方;false:标签位于2个刻度线中间
  1770. },
  1771. data: timeArr.value,
  1772. axisLabel: {
  1773. interval: 4,
  1774. formatter: function (value) {
  1775. // if (value.index % 4 === 0) {
  1776. // return value.replace(/ /g, '\n');
  1777. // } else {
  1778. // return '';
  1779. // }
  1780. return value.replace(/ /g, '\n');
  1781. },
  1782. },
  1783. },
  1784. // Y轴
  1785. // yAxis: {
  1786. // type: 'value',
  1787. // // name: "风速(m/s)",
  1788. // },
  1789. yAxis: {
  1790. min: 0,
  1791. max: 10,
  1792. type: 'value'
  1793. },
  1794. // 鼠标悬浮提示
  1795. tooltip: {
  1796. trigger: "axis",
  1797. formatter(params) {
  1798. let tip =
  1799. "时间:" +
  1800. params[0].axisValue +
  1801. "<br/>风速:" +
  1802. (params[0].value ? params[0].value : "--") +
  1803. "m/s<br/>风向:" +
  1804. (params[0].data ? params[0].data.symbolRotateStr + '°' : "--")
  1805. return tip;
  1806. },
  1807. },
  1808. // 数据
  1809. series: [{
  1810. data: windLineArr.value,
  1811. type: 'line',
  1812. smooth: true, //这句就是让曲线变平滑的
  1813. symbol: 'path://M4.866,0,0,15.193l4.866-4.449L9.738,15.2Z',
  1814. symbolSize: 11,
  1815. //折线样式
  1816. lineStyle: {
  1817. color: '#a5cfff',
  1818. width: 1,
  1819. },
  1820. // label: {
  1821. // normal: {
  1822. // formatter: '{c}',
  1823. // show: false,
  1824. // position: 'top',
  1825. // distance: 15
  1826. // }
  1827. // },
  1828. itemStyle: {
  1829. normal: {
  1830. },
  1831. },
  1832. }]
  1833. };
  1834. mychart.setOption(option)
  1835. window.addEventListener("resize", function () {
  1836. mychart.resize();
  1837. });
  1838. }
  1839. const showTemp = () => {
  1840. let gradientColor = {
  1841. type: 'linear',
  1842. x: 0,
  1843. y: 0,
  1844. x2: 0,
  1845. y2: 1,
  1846. colorStops: [
  1847. {
  1848. offset: 0,
  1849. color: '#760202'
  1850. },
  1851. {
  1852. offset: 0.5,
  1853. color: '#DE3333'
  1854. },
  1855. {
  1856. offset: 1,
  1857. color: 'rgba(236, 111, 105,0.1)'
  1858. }
  1859. ]
  1860. };
  1861. let mychart = echarts.init(pie.value);
  1862. let option = {
  1863. series: [
  1864. {
  1865. type: 'gauge',
  1866. radius: '100%',
  1867. min: -50,
  1868. max: 50,
  1869. axisLine: {
  1870. lineStyle: {
  1871. width: 4,
  1872. color: [
  1873. [0.5, {
  1874. type: "linear",
  1875. colorStops: [
  1876. { offset: 0, color: "#0000FF" },
  1877. { offset: 1, color: "#1DA0FF" }
  1878. ]
  1879. }],
  1880. [0.7, {
  1881. type: "linear",
  1882. colorStops: [
  1883. { offset: 0, color: "#1DA0FF" },
  1884. { offset: 1, color: "#00B461" }
  1885. ]
  1886. }],
  1887. [0.8, {
  1888. type: "linear",
  1889. colorStops: [
  1890. { offset: 0, color: "#00B461" },
  1891. { offset: 1, color: "#E6DE00" }
  1892. ]
  1893. }],
  1894. [0.99, {
  1895. type: "linear",
  1896. colorStops: [
  1897. { offset: 1, color: "#E6DE00" },
  1898. { offset: 0, color: "#E80000" }
  1899. ]
  1900. }],
  1901. [1, {
  1902. type: "linear",
  1903. colorStops: [
  1904. { offset: 0, color: "#E80000" },
  1905. { offset: 1, color: "#FF0000" }
  1906. ]
  1907. }]
  1908. ]
  1909. }
  1910. },
  1911. pointer: {
  1912. width: 3,
  1913. length: '50%',
  1914. offsetCenter: ['0%', '-30%'],
  1915. itemStyle: {
  1916. color: gradientColor
  1917. }
  1918. },
  1919. axisTick: {
  1920. distance: 5,
  1921. splitNumber: 10,
  1922. length: 5,
  1923. lineStyle: {
  1924. color: 'auto',
  1925. width: 1
  1926. }
  1927. },
  1928. splitLine: {
  1929. distance: 0,
  1930. length: 10,
  1931. lineStyle: {
  1932. color: 'auto',
  1933. width: 2
  1934. }
  1935. },
  1936. axisLabel: {
  1937. color: isDark.value ? '#fff' : "#666",
  1938. distance: 8,
  1939. fontSize: 10
  1940. },
  1941. detail: {
  1942. offsetCenter: [0, 0],
  1943. valueAnimation: true,
  1944. formatter: '{value}',
  1945. color: isDark.value ? '#fff' : "#000",
  1946. fontSize: 30,
  1947. },
  1948. data: [
  1949. {
  1950. value: dataItemInfo.value[101],
  1951. }
  1952. ]
  1953. }
  1954. ]
  1955. };
  1956. mychart.setOption(option)
  1957. window.addEventListener("resize", function () {
  1958. mychart.resize();
  1959. });
  1960. }
  1961. const showTempLine = () => {
  1962. // 获取最大值方法
  1963. function calMax(arr) {
  1964. let max = Math.max.apply(null, arr); // 获取最大值方法
  1965. let maxint = Math.ceil(max / 5); // 向上以5的倍数取整
  1966. let maxval = max >= 100 ? maxint * 5 : maxint * 5 + 5; // 最终设置的最大值
  1967. return maxval; // 输出最大值
  1968. }
  1969. // 获取最小值方法
  1970. function calMin(arr) {
  1971. let min = Math.min.apply(null, arr); // 获取最小值方法
  1972. let minint = Math.floor(min / 1); // 向下以1的倍数取整
  1973. let minval = minint * 1 - 5; // 最终设置的最小值
  1974. return minval <= 0 ? 0 : minval; // 输出最小值
  1975. }
  1976. // 调用方法,获取数据的最大值&最小值
  1977. let maxData1 = calMax(tempLineArr.value);
  1978. let maxData2 = calMax(humidityLineArr.value);
  1979. let minData1 = calMin(tempLineArr.value);
  1980. let minData2 = calMin(humidityLineArr.value);
  1981. let mychart = echarts.init(tempLine.value);
  1982. let option = {
  1983. title: {
  1984. text: '暂无数据',
  1985. show: !timeArr.value ? true : false,
  1986. x: 'center',
  1987. y: 'center',
  1988. textStyle: {
  1989. fontSize: 14,
  1990. fontWeight: 'normal',
  1991. }
  1992. },
  1993. // 直角坐标系内绘图网格
  1994. // grid: {
  1995. // show: true,
  1996. // x: 120,
  1997. // y: 50,
  1998. // x2: 120,
  1999. // y2: 50
  2000. // },
  2001. grid: {
  2002. left: '10',
  2003. right: '10',
  2004. bottom: '3%',
  2005. top: 25,
  2006. containLabel: true
  2007. },
  2008. legend: {
  2009. data: ['气温', '相对湿度'],
  2010. // left: 10
  2011. top: 0,
  2012. textStyle: {//图例文字的样式
  2013. color: isDark.value ? '#fff' : "#000",
  2014. }
  2015. },
  2016. // X轴
  2017. xAxis: {
  2018. type: 'category',
  2019. splitLine: {
  2020. show: false
  2021. },
  2022. boundaryGap: false,
  2023. axisTick: {
  2024. alignWithLabel: true, // true:标签位于刻度线正下方;false:标签位于2个刻度线中间
  2025. },
  2026. data: timeArr.value,
  2027. axisLabel: {
  2028. interval: 4,
  2029. formatter: function (value) {
  2030. // if (value.index % 4 === 0) {
  2031. // return value.replace(/ /g, '\n');
  2032. // } else {
  2033. // return '';
  2034. // }
  2035. return value.replace(/ /g, '\n');
  2036. },
  2037. },
  2038. },
  2039. yAxis: [
  2040. {
  2041. type: "value",
  2042. // boundaryGap: [0, '30%'],
  2043. min: minData1,
  2044. max: maxData1,
  2045. splitNumber: 5, //设置坐标轴的分割段数
  2046. interval: (maxData1 - minData1) / 5, // 标轴分割间隔
  2047. axisLabel: {
  2048. formatter: function (v) {
  2049. return v.toFixed(1); //0表示小数为0位,1表示1位小数,2表示2位小数
  2050. },
  2051. }
  2052. },
  2053. {
  2054. type: "value",
  2055. min: minData2,
  2056. max: maxData2,
  2057. splitNumber: 5,
  2058. interval: (maxData2 - minData2) / 5,
  2059. axisLabel: {
  2060. formatter: function (v) {
  2061. return v.toFixed(2); //0表示小数为0位,1表示1位小数,2表示2位小数
  2062. }
  2063. }
  2064. }
  2065. ],
  2066. // 鼠标悬浮提示
  2067. tooltip: {
  2068. trigger: "axis",
  2069. // formatter(params) {
  2070. // let tip =
  2071. // "时间:" +
  2072. // params[0].axisValue +
  2073. // "<br/>风速:" +
  2074. // (params[0].value ? params[0].value : "--") +
  2075. // "m/s<br/>风向:" +
  2076. // (params[0].data ? params[0].data.symbolRotateStr : "--")
  2077. // return tip;
  2078. // },
  2079. },
  2080. // 数据
  2081. series: [
  2082. {
  2083. name: "气温",
  2084. type: "line",
  2085. color: ["#fc8452"],
  2086. smooth: true,
  2087. data: tempLineArr.value
  2088. },
  2089. {
  2090. name: "相对湿度",
  2091. type: "line",
  2092. color: ["#5470c6"],
  2093. smooth: true,
  2094. yAxisIndex: 1, //在单个图表实例中存在多个y轴的时候有用
  2095. data: humidityLineArr.value
  2096. }
  2097. ]
  2098. };
  2099. mychart.setOption(option)
  2100. window.addEventListener("resize", function () {
  2101. mychart.resize();
  2102. });
  2103. }
  2104. const showPressureLine = () => {
  2105. // 获取最大值方法
  2106. function calMax(arr) {
  2107. let max = Math.max.apply(null, arr); // 获取最大值方法
  2108. let maxint = Math.ceil(max / 5); // 向上以5的倍数取整
  2109. let maxval = maxint * 5 + 5; // 最终设置的最大值
  2110. return maxval; // 输出最大值
  2111. }
  2112. // 获取最小值方法
  2113. function calMin(arr) {
  2114. let min = Math.min.apply(null, arr); // 获取最小值方法
  2115. let minint = Math.floor(min / 1); // 向下以1的倍数取整
  2116. let minval = minint * 1 - 5; // 最终设置的最小值
  2117. return minval; // 输出最小值
  2118. }
  2119. // 调用方法,获取数据的最大值&最小值
  2120. let maxData1 = calMax(pressureLineArr.value);
  2121. let minData1 = calMin(pressureLineArr.value);
  2122. let mychart = echarts.init(pressureLine.value);
  2123. let option = {
  2124. title: {
  2125. text: '暂无数据',
  2126. show: !timeArr.value ? true : false,
  2127. x: 'center',
  2128. y: 'center',
  2129. textStyle: {
  2130. fontSize: 14,
  2131. fontWeight: 'normal',
  2132. }
  2133. },
  2134. grid: {
  2135. left: '10',
  2136. right: '10',
  2137. bottom: '3%',
  2138. top: 10,
  2139. containLabel: true
  2140. },
  2141. // X轴
  2142. xAxis: {
  2143. type: 'category',
  2144. splitLine: {
  2145. show: false
  2146. },
  2147. boundaryGap: false,
  2148. axisTick: {
  2149. alignWithLabel: true, // true:标签位于刻度线正下方;false:标签位于2个刻度线中间
  2150. },
  2151. data: timeArr.value,
  2152. axisLabel: {
  2153. interval: 4,
  2154. formatter: function (value) {
  2155. // if (value.index % 4 === 0) {
  2156. // return value.replace(/ /g, '\n');
  2157. // } else {
  2158. // return '';
  2159. // }
  2160. return value.replace(/ /g, '\n');
  2161. },
  2162. },
  2163. },
  2164. yAxis: {
  2165. min: minData1,
  2166. max: maxData1,
  2167. type: 'value',
  2168. },
  2169. // 鼠标悬浮提示
  2170. tooltip: {
  2171. trigger: "axis",
  2172. // formatter(params) {
  2173. // let tip =
  2174. // "时间:" +
  2175. // params[0].axisValue +
  2176. // "<br/>风速:" +
  2177. // (params[0].value ? params[0].value : "--") +
  2178. // "m/s<br/>风向:" +
  2179. // (params[0].data ? params[0].data.symbolRotateStr : "--")
  2180. // return tip;
  2181. // },
  2182. },
  2183. // 数据
  2184. series: [
  2185. {
  2186. name: "气压",
  2187. type: "line",
  2188. smooth: true,
  2189. data: pressureLineArr.value,
  2190. },
  2191. ]
  2192. };
  2193. mychart.setOption(option)
  2194. window.addEventListener("resize", function () {
  2195. mychart.resize();
  2196. });
  2197. }
  2198. watch(isDark, () => {
  2199. showTemp()
  2200. showWind()
  2201. showWindSpeed()
  2202. showHumidity()
  2203. showPressure()
  2204. showTempLine()
  2205. showPressureLine()
  2206. });
  2207. onMounted(() => {
  2208. loadCustomizeColumns()
  2209. // updateColumns()
  2210. getPlatforms()
  2211. // weatherInfo()
  2212. getAllRgDataList()
  2213. showTemp()
  2214. // showWind()
  2215. showWindSpeed()
  2216. showHumidity()
  2217. showPressure()
  2218. // showTempLine()
  2219. // showPressureLine()
  2220. })
  2221. // 保存customizeColumns数组到localStorage
  2222. function saveCustomizeColumns() {
  2223. const jsonString = JSON.stringify(customizeColumns.value);
  2224. localStorage.setItem('customizeColumns', jsonString);
  2225. }
  2226. // 从localStorage中获取customizeColumns数组
  2227. function loadCustomizeColumns() {
  2228. const jsonString = localStorage.getItem('customizeColumns');
  2229. if (jsonString) {
  2230. customizeColumns.value = JSON.parse(jsonString);
  2231. }
  2232. }
  2233. let intervalId;
  2234. onActivated(() => {
  2235. intervalId = setInterval(() => {
  2236. getList();
  2237. weatherInfo()
  2238. // getHistoryList()
  2239. }, 600 * 1000);
  2240. });
  2241. onDeactivated(() => {
  2242. clearInterval(intervalId);
  2243. });
  2244. </script>
  2245. <style lang="scss" scoped>
  2246. .card {
  2247. padding: 15px;
  2248. display: flex;
  2249. justify-content: space-between;
  2250. }
  2251. .queryInfo {
  2252. display: flex;
  2253. align-items: center;
  2254. font-size: 14px;
  2255. .top_item {
  2256. margin-right: 25px;
  2257. }
  2258. }
  2259. .main_list {
  2260. background: transparent !important;
  2261. box-shadow: none !important;
  2262. padding: 0 !important;
  2263. height: calc(100vh - 150px);
  2264. margin-bottom: 10px;
  2265. overflow-y: scroll;
  2266. overflow-x: hidden;
  2267. .chart_item {
  2268. border-radius: 10px;
  2269. padding: 10px;
  2270. background-color: #fff;
  2271. // background-color: var(--el-bg-color) !important;
  2272. // border: 1px solid var(--el-border-color-light);
  2273. // height: 100%;
  2274. // margin-bottom: 15px;
  2275. .item_title {
  2276. display: flex;
  2277. justify-content: space-between;
  2278. align-items: center;
  2279. }
  2280. }
  2281. .info_box {
  2282. .info_title {
  2283. color: #999999;
  2284. font-size: 16px;
  2285. }
  2286. .info_content {
  2287. height: 40px;
  2288. font-weight: bold;
  2289. // color: #000;
  2290. font-size: 26px;
  2291. }
  2292. }
  2293. }
  2294. .box1 {
  2295. position: relative;
  2296. .icon {
  2297. // color: #000;
  2298. font-weight: bold;
  2299. position: absolute;
  2300. span {
  2301. // color: #666;
  2302. font-weight: normal;
  2303. }
  2304. }
  2305. .icon1 {
  2306. bottom: 0;
  2307. left: 0;
  2308. }
  2309. .icon2 {
  2310. bottom: 0;
  2311. right: 0;
  2312. span {
  2313. font-size: 12px;
  2314. }
  2315. }
  2316. }
  2317. .el-row .el-col {
  2318. margin-bottom: 15px;
  2319. }
  2320. .gradient-container {
  2321. // position: relative;
  2322. display: flex;
  2323. justify-content: space-between;
  2324. height: 200px;
  2325. /* 盒子的高度 */
  2326. .item {
  2327. flex: 1;
  2328. padding-left: 30px;
  2329. position: relative;
  2330. }
  2331. }
  2332. .gradient-box {
  2333. position: relative;
  2334. width: 100%;
  2335. height: 100%;
  2336. align-items: flex-end;
  2337. /* 确保箭头从底部开始 */
  2338. }
  2339. .wweatherBox {
  2340. .weatherItem {
  2341. text-align: center;
  2342. font-weight: bold;
  2343. }
  2344. }
  2345. </style>