windSpeedRank.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. <template>
  2. <Dialog custom-show type="md" title="风速排行" hide-footer @close="handleClose">
  3. <div>(过去24小时)</div>
  4. <div class="title-box">
  5. <el-select
  6. v-model="timeOption"
  7. class="custom-select"
  8. popper-class="custom-select-popper"
  9. :teleported="false"
  10. style="width: 236px"
  11. @change="initData"
  12. >
  13. <el-option v-for="item in timeOptions" :key="item.value" :label="item.name" :value="item.value" />
  14. </el-select>
  15. </div>
  16. <div class="table">
  17. <div class="table-header">
  18. <div class="td">序号</div>
  19. <div class="td">
  20. <el-select
  21. v-model="queryParams.area"
  22. placeholder="地市"
  23. size="large"
  24. class="custom-select2"
  25. popper-class="custom-select-popper2"
  26. :teleported="false"
  27. >
  28. <el-option label="区县" value="" />
  29. <el-option v-for="item in district_type" :key="item.value" :label="item.label" :value="item.value" />
  30. </el-select>
  31. </div>
  32. <div class="td">区县</div>
  33. <div class="td">站址</div>
  34. <div class="td td-cursor">
  35. <span>风速(m/s)</span>
  36. <i :class="queryParams.sort === 'desc' ? 'desc-icon' : 'asc-icon'" @click="handleSort" />
  37. </div>
  38. </div>
  39. <div v-for="(item, index) in rangeData" :key="index" class="tr">
  40. <div class="td">
  41. <div :class="getRankClass(item.rn)">{{ item.rn }}</div>
  42. </div>
  43. <div class="td">{{ item.area }}</div>
  44. <div class="td">{{ item.township }}</div>
  45. <div class="td btn3" @click="handleClick(item)">
  46. <div class="chart-icon"></div>
  47. {{ item.address }}
  48. </div>
  49. <div class="gradient-text2 td">{{ item.rainfall }}</div>
  50. </div>
  51. </div>
  52. <div class="footer">
  53. <el-pagination
  54. background
  55. :hide-on-single-page="true"
  56. layout="total, prev, pager, next"
  57. :total="total"
  58. :page-size="queryParams.size"
  59. :current-page="queryParams.current"
  60. @current-change="handleChangePage"
  61. />
  62. </div>
  63. </Dialog>
  64. <WindSpeedChart v-if="showDialog" v-model:show="showDialog" :rainData="rainData" />
  65. </template>
  66. <script lang="ts" setup name="RainRank">
  67. import { getRainfallRange2 } from '@/api/globalMap/rainMonitor';
  68. import { getNextAreaInfo } from '@/api/common';
  69. import WindSpeedChart from '@/views/globalMap/RightMenu/WindMonitor/windSpeedChart.vue';
  70. interface Props {
  71. modelValue: boolean;
  72. location: string | number[];
  73. }
  74. withDefaults(defineProps<Props>(), {});
  75. const emits = defineEmits(['update:modelValue']);
  76. const { proxy } = getCurrentInstance() as ComponentInternalInstance;
  77. const { district_type } = toRefs<any>(proxy?.useDict('district_type'));
  78. const timeOption = ref('24');
  79. const timeOptions = reactive([
  80. { name: '1小时', value: '1' },
  81. { name: '3小时', value: '3' },
  82. { name: '6小时', value: '6' },
  83. { name: '12小时', value: '12' },
  84. { name: '24小时', value: '24' }
  85. ]);
  86. const rangeData = ref([]);
  87. const queryParams = reactive({
  88. current: 1,
  89. size: 10,
  90. area: '',
  91. township: '',
  92. sort: 'desc'
  93. });
  94. const townshipList = ref([]);
  95. const total = ref(0);
  96. const showDialog = ref(false);
  97. const rainData = ref({});
  98. const getRankClass = (rank) => {
  99. let res = 'rank-other';
  100. if (rank === 1) {
  101. res = 'rank1';
  102. } else if (rank === 2) {
  103. res = 'rank2';
  104. } else if (rank === 3) {
  105. res = 'rank3';
  106. }
  107. return res;
  108. };
  109. const handleSort = () => {
  110. if (queryParams.sort === 'desc') {
  111. queryParams.sort = 'asc';
  112. } else {
  113. queryParams.sort = 'desc';
  114. }
  115. initData();
  116. };
  117. function handleChangePage(newNum) {
  118. queryParams.current = newNum;
  119. initData();
  120. }
  121. const initData = () => {
  122. let area = '';
  123. for (let i = 0; i < district_type.value.length; i++) {
  124. if (district_type.value[i].value === queryParams.area) {
  125. area = district_type.value[i].label;
  126. }
  127. }
  128. const params = {
  129. current: queryParams.current,
  130. size: queryParams.size,
  131. query: {
  132. area: area,
  133. township: queryParams.township,
  134. sort: queryParams.sort,
  135. timeOption: timeOption.value
  136. }
  137. };
  138. getRainfallRange2(params).then((res) => {
  139. total.value = res.total;
  140. rangeData.value = res.rows;
  141. });
  142. };
  143. watch(
  144. () => queryParams.area,
  145. () => {
  146. queryParams.township = '';
  147. townshipList.value = [];
  148. if (queryParams.area) {
  149. getNextAreaInfo(queryParams.area).then((res) => {
  150. townshipList.value = res.data.list;
  151. });
  152. }
  153. initData();
  154. },
  155. { immediate: true }
  156. );
  157. const handleClose = () => {
  158. emits('update:modelValue', false);
  159. };
  160. const handleClick = (item) => {
  161. rainData.value = item;
  162. showDialog.value = true;
  163. };
  164. </script>
  165. <style lang="scss" scoped>
  166. .dialog-container {
  167. position: fixed;
  168. top: 50%;
  169. left: 50%;
  170. transform: translate(-50%, -50%);
  171. z-index: 9;
  172. width: 2001px;
  173. height: 1562px;
  174. background: url('@/assets/images/map/rightMenu/rainMonitor/dialog2.png') no-repeat;
  175. padding: 170px 30px 20px 40px;
  176. font-size: 36px;
  177. color: #ffffff;
  178. }
  179. .title-box {
  180. position: absolute;
  181. top: 25px;
  182. left: 70px;
  183. display: flex;
  184. align-items: center;
  185. .title {
  186. font-size: 84px;
  187. margin-right: 20px;
  188. }
  189. }
  190. .close-btn {
  191. position: absolute;
  192. top: 0px;
  193. right: 0px;
  194. width: 75px;
  195. height: 70px;
  196. background: url('@/assets/images/map/rightMenu/close.png') no-repeat;
  197. background-size: 100% 100%;
  198. cursor: pointer;
  199. }
  200. .table {
  201. margin-left: 28px;
  202. .table-header {
  203. width: 1864px;
  204. height: 96px;
  205. background: url('@/assets/images/common/header.png') no-repeat;
  206. background-size: 100% 100%;
  207. display: flex;
  208. align-items: center;
  209. .td-cursor {
  210. cursor: pointer;
  211. }
  212. }
  213. .tr {
  214. width: 1864px;
  215. height: 96px;
  216. background: url('@/assets/images/common/tr.png') no-repeat;
  217. background-size: 100% 100%;
  218. display: flex;
  219. align-items: center;
  220. margin-top: 10px;
  221. .td {
  222. white-space: nowrap;
  223. overflow: hidden;
  224. text-overflow: ellipsis;
  225. }
  226. .btn3 {
  227. cursor: pointer;
  228. color: #00d0ee;
  229. display: flex;
  230. .chart-icon {
  231. width: 52px;
  232. height: 51px;
  233. background: url('@/assets/images/map/rightMenu/rainMonitor/icon5.png') no-repeat;
  234. margin-right: 5px;
  235. }
  236. }
  237. }
  238. .gradient-text2 {
  239. color: transparent !important;
  240. }
  241. .td {
  242. font-size: 38px;
  243. color: #edfaff;
  244. display: flex;
  245. justify-content: center;
  246. align-items: center;
  247. &:nth-child(1) {
  248. width: 140px;
  249. }
  250. &:nth-child(2) {
  251. width: 220px;
  252. }
  253. &:nth-child(3) {
  254. width: 280px;
  255. }
  256. &:nth-child(4) {
  257. flex: 1;
  258. }
  259. &:nth-child(5) {
  260. width: 230px;
  261. }
  262. }
  263. .down-icon {
  264. display: inline-block;
  265. width: 33px;
  266. height: 15px;
  267. background: url('@/assets/images/map/rightMenu/rainMonitor/down.png') no-repeat;
  268. cursor: pointer;
  269. margin-left: 8px;
  270. }
  271. .asc-icon {
  272. display: inline-block;
  273. width: 33px;
  274. height: 33px;
  275. background: url('@/assets/images/common/asc.png') no-repeat;
  276. cursor: pointer;
  277. margin-left: 8px;
  278. }
  279. .desc-icon {
  280. display: inline-block;
  281. width: 33px;
  282. height: 33px;
  283. background: url('@/assets/images/common/desc.png') no-repeat;
  284. cursor: pointer;
  285. margin-left: 8px;
  286. }
  287. .rank1,
  288. .rank2,
  289. .rank3,
  290. .rank-other {
  291. width: 50px;
  292. height: 48px;
  293. color: #ecfaff;
  294. font-family: BEBAS-1;
  295. display: flex;
  296. align-items: center;
  297. justify-content: center;
  298. }
  299. .rank1 {
  300. height: 47px;
  301. background: url('@/assets/images/map/rightMenu/rainMonitor/first.png') no-repeat;
  302. }
  303. .rank2 {
  304. background: url('@/assets/images/map/rightMenu/rainMonitor/second.png') no-repeat;
  305. }
  306. .rank3 {
  307. background: url('@/assets/images/map/rightMenu/rainMonitor/third.png') no-repeat;
  308. }
  309. .rank-other {
  310. background: url('@/assets/images/map/rightMenu/rainMonitor/other.png') no-repeat;
  311. }
  312. }
  313. .footer {
  314. display: flex;
  315. justify-content: flex-end;
  316. margin-top: 30px;
  317. padding-right: 40px;
  318. :deep(.el-pagination__total) {
  319. color: #a7ccdf;
  320. font-size: 32px;
  321. }
  322. :deep(.el-pagination) {
  323. .btn-next,
  324. .btn-prev {
  325. background-color: transparent;
  326. border: none;
  327. .el-icon {
  328. font-size: 22px;
  329. color: #a7ccdf;
  330. }
  331. }
  332. .el-pager li {
  333. width: 64px;
  334. height: 64px;
  335. line-height: 64px;
  336. text-align: center;
  337. font-size: 32px;
  338. color: #a7ccdf;
  339. background-color: #0e3064;
  340. border: 1px solid #0c57a7;
  341. margin: 0 6px;
  342. &:hover {
  343. background-color: #038dff;
  344. border: 1px solid #038dff;
  345. }
  346. }
  347. .el-pager li.is-active {
  348. background-color: #038dff;
  349. border: 1px solid #038dff;
  350. }
  351. }
  352. }
  353. </style>