mapDialog.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086
  1. <template>
  2. <div>
  3. <div class="total222" style="height:770px">
  4. <a-tabs v-model:activeKey="activeKey" @change="changeTab">
  5. <a-tab-pane key="1">
  6. <template #tab>
  7. <span> 测站信息 </span>
  8. </template>
  9. <div style="display:flex;flex-direction: column;">
  10. <div>
  11. <div class="map-dialog-title">
  12. <img src="../../assets/images/weatheHome/icon-title.png" />
  13. 基本信息
  14. </div>
  15. <div>
  16. <a-row style="min-height: 100px; padding: 20px">
  17. <a-col :span="8" v-for="(item, index) in detailInfo?.basic_info" :key="index + 1">
  18. <div style="display: flex">
  19. <a-row style="width: 100%; height: 50px">
  20. <a-col :span="8">
  21. <div style="
  22. display: flex;
  23. align-items: center;
  24. justify-content: center;
  25. text-align: center;
  26. width: 100%;
  27. height: 100%;
  28. background-color: #032448;
  29. border: 1px solid #014a9b;
  30. ">{{ Object.keys(item)[0] }}</div>
  31. </a-col>
  32. <a-col :span="16">
  33. <div style="
  34. display: flex;
  35. align-items: center;
  36. justify-content: center;
  37. text-align: center;
  38. width: 100%;
  39. height: 100%;
  40. border: 1px solid #014a9b;
  41. ">{{ Object.values(item)[0] }}</div>
  42. </a-col>
  43. </a-row>
  44. </div>
  45. </a-col>
  46. </a-row>
  47. </div>
  48. </div>
  49. <div style="flex:1">
  50. <div class="map-dialog-title mg-10">
  51. <img src="../../assets/images/weatheHome/icon-title.png" />
  52. 监测信息
  53. <div class="map-dialog-tabp-list" v-if="detailInfo.st_type != 6">
  54. <!-- <div class="active-tabp">
  55. 杨村温度
  56. </div> -->
  57. <div style="font-size: 14px; color: #bed2ff" v-for="(item, index) in detailInfo.sensor"
  58. :key="item.senid" @click="setTabColor(item, index + 1)">{{ item.sensor_name }}</div>
  59. </div>
  60. </div>
  61. <div class="tabp-conetnt">
  62. <div class="tabp-conetnt-left hconetnt" v-if="detailInfo.st_type == 6">
  63. <a-collapse v-model:activeKey="activeMenu.activeKey" :bordered="false">
  64. <template #expandIcon="{ isActive }">
  65. <img class="left-collapse-icon"
  66. :style="{ transform: `rotate(${isActive ? '0' : '-90'}deg)`, marginTop: '-12px' }"
  67. src="../../assets/images/weatheHome/icon-bottom.png" />
  68. </template>
  69. <a-collapse-panel :key="index + 1" :header="ke" :style="activeMenu.customStyle"
  70. v-for="(item, ke, index) in tanshuiList">
  71. <ul class="collapse-ul">
  72. <li :class="''" v-for="(it, index2) in item.value" :key="it.senid"
  73. @click="setTabColor2(it, index, index2)">{{
  74. it.sensor_name
  75. }}</li>
  76. </ul>
  77. </a-collapse-panel>
  78. <!-- <a-collapse-panel key="2" header="4m 灌木层" :style="activeMenu.customStyle">
  79. <ul class="collapse-ul">
  80. <li>温度</li>
  81. <li>湿度</li>
  82. <li class="active">土壤热通量</li>
  83. </ul>
  84. </a-collapse-panel> -->
  85. </a-collapse>
  86. </div>
  87. <div class="tabp-conetnt-right">
  88. <!-- <div class="tabp-right-top">
  89. <div>PID:<span>4223456</span></div>
  90. <div>感器名称:<span>传感器1</span></div>
  91. <div>入库点号:<span>4223456</span></div>
  92. <div>基值:<span>4223456</span></div>
  93. <div>最大值:<span>4223456</span></div>
  94. <div>最小值:<span>4223456</span></div>
  95. <div>精度:<span>4223456</span></div>
  96. </div> -->
  97. <div class="tabp-right-query">
  98. <!-- <div style="margin-right: 10px">
  99. <span class="active">近一周</span>
  100. <span>近一月</span>
  101. <span>近三月</span>
  102. <span>近半年</span>
  103. </div> -->
  104. <a-radio-group v-model:value="value1" button-style="solid"
  105. style="margin-left: 30px; margin-right: 20px" @change="handleChange">
  106. <a-radio-button value="24">近24h</a-radio-button>
  107. <a-radio-button value="0.5">近一周</a-radio-button>
  108. <a-radio-button value="1">近一月</a-radio-button>
  109. <a-radio-button value="2">近三月</a-radio-button>
  110. <a-radio-button value="3">近半年</a-radio-button>
  111. </a-radio-group>
  112. <div>
  113. <a-range-picker :disabled-date="disabledDate" v-model:value="searchTime"
  114. valueFormat="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm" :placeholder="['开始时间', '结束时间']" />
  115. </div>
  116. <div>
  117. <a-button type="primary" @click="search(senid, sensor_name, dchar)">开始查询</a-button>
  118. </div>
  119. </div>
  120. <div class="tabp-right-query-echarts" id='ebox' v-show="!showNodata" :style="{
  121. flex:'1',width: '900px',height: '460px',zoom: `${1 / zooms}`, transform: `scale(${zooms})`, transformOrigin: '0 0'}
  122. ">
  123. <div id="query-echarts" :style="{
  124. width: '100%',
  125. height: '100%',}">
  126. </div>
  127. </div>
  128. <div v-show="showNodata" style="width: 100%; height: 310px; text-align: center">
  129. <img class="none-data" src="../../assets/images/weatheHome/none-data.png" />
  130. </div>
  131. </div>
  132. </div>
  133. </div>
  134. </div>
  135. </a-tab-pane>
  136. <a-tab-pane key="2">
  137. <template #tab>
  138. <span> 图片 </span>
  139. </template>
  140. <div class="tabp-conetnt">
  141. <div class="tabp-conetnt-left">
  142. <a-collapse v-model:activeKey="activeMenu.activeKey" :bordered="false">
  143. <template #expandIcon="{ isActive }">
  144. <img class="left-collapse-icon"
  145. :style="{ transform: `rotate(${isActive ? '0' : '-90'}deg)`, marginTop: '-12px' }"
  146. src="../../assets/images/weatheHome/icon-bottom.png" />
  147. </template>
  148. <a-collapse-panel :key="index + 1" v-for="(item, key, index) in imgtree" :header="key"
  149. :style="activeMenu.customStyle">
  150. <ul class="collapse-ul">
  151. <li v-for="(it, index2) in item" :key="item.id" @click="setTabColor3(it, index, index2)">{{
  152. it.img_name
  153. }}</li>
  154. </ul>
  155. </a-collapse-panel>
  156. <!-- <a-collapse-panel key="2" header="监控布置图" :style="activeMenu.customStyle">
  157. <ul class="collapse-ul">
  158. <li>图片1</li>
  159. <li>图片2</li>
  160. <li class="active">图片3</li>
  161. </ul>
  162. </a-collapse-panel> -->
  163. <img v-if="imgtree.length == 0" style="width: 160px; margin: 0 auto;" lass="none-data"
  164. src="../../assets/images/weatheHome/none-data.png" />
  165. </a-collapse>
  166. </div>
  167. <div class="tabp-conetnt-right">
  168. <a-carousel arrows style="width:100%;position: absolute;top:0;" :beforeChange="setcolor" ref="varousel">
  169. <template #prevArrow>
  170. <div class="custom-slick-arrow" style="z-index: 9999; left: -30px">
  171. <left-circle-outlined />
  172. </div>
  173. </template>
  174. <template #nextArrow>
  175. <div class="custom-slick-arrow" style="right: -30px">
  176. <right-circle-outlined />
  177. </div>
  178. </template>
  179. <div v-for="(item, index) in imgList"><img class="carousel-img" :src="VITE_GLOB_BASE_IMG + item.img_url"
  180. :key="index + 1" /></div>
  181. <!-- <div>
  182. <img class="carousel-img" src="../../assets/images/weatheHome/test-img.png" />
  183. </div>
  184. <div><img class="carousel-img" src="../../assets/images/weatheHome/test-img.png" /></div>
  185. <div><img class="carousel-img" src="../../assets/images/weatheHome/test-img.png" /></div> -->
  186. </a-carousel>
  187. <img v-if="imgtree.length == 0" style="width: 300px; margin: 0 auto;" lass="none-data"
  188. src="../../assets/images/weatheHome/none-data.png" />
  189. <div v-if="imgList.length != 0" class="carousel-title">
  190. <div style="margin-right: 50px;">{{ imgname }}</div>
  191. <div>{{ imgindex }} / {{ imgList.length }}</div>
  192. </div>
  193. </div>
  194. </div>
  195. </a-tab-pane>
  196. <a-tab-pane key="3">
  197. <template #tab>
  198. <span> 视频监控 </span>
  199. </template>
  200. <div>
  201. <div class="tabp-conetnt">
  202. <div class="tabp-conetnt-left">
  203. <ul class="collapse-video-ul">
  204. <!-- <li>视频监控名称1</li>
  205. <li>视频监控名称2</li>
  206. <li class="video-active">图片3</li> -->
  207. <img style="width: 160px; margin: 0 auto;" lass="none-data"
  208. src="../../assets/images/weatheHome/none-data.png" />
  209. </ul>
  210. </div>
  211. <div class="tabp-conetnt-right">
  212. <!-- <img style="width: 100%" class="carousel-img" src="../../assets/images/weatheHome/test-img.png" /> -->
  213. <img class="none-data" src="../../assets/images/weatheHome/none-data.png" />
  214. </div>
  215. </div>
  216. </div>
  217. </a-tab-pane>
  218. <template #renderTabBar="{ DefaultTabBar, ...props }">
  219. <component :is="DefaultTabBar" v-bind="props" :style="{ zIndex: 1, textAlign: 'center' }" />
  220. </template>
  221. </a-tabs>
  222. </div>
  223. </div>
  224. </template>
  225. <script setup>
  226. import { reactive, getCurrentInstance, onMounted, ref, watch, toRef, nextTick } from 'vue';
  227. import { LeftCircleOutlined, RightCircleOutlined } from '@ant-design/icons-vue';
  228. import { getMonitorInfo } from '/@/api/swHome/index';
  229. import moment from 'moment';
  230. import $ from 'jquery';
  231. import eventBus from '/@/utils/eventBus';
  232. import { getAppEnvConfig } from '/@/utils/env';
  233. import { addResizeListener } from '/@/utils/event';
  234. const { VITE_GLOB_BASE_IMG } = getAppEnvConfig()
  235. let zooms = ref('')
  236. eventBus.on('progressHeight', (e) => {
  237. if (e > 1000 && e < 1200) {
  238. setBox(1,e)
  239. } else if (e > 1200) {
  240. setBox(2,e)
  241. } else {
  242. setBox(3,e)
  243. }
  244. zooms.value = document.getElementsByClassName("ant-modal")[0].style.zoom
  245. chart.dispose();
  246. setTimeout(() => {
  247. chart = echarts.init(document.getElementById('query-echarts'));
  248. echarts1();
  249. }, 400)
  250. });
  251. const setBox = (type,e) => {
  252. // alert(e)
  253. if(props.detailInfo.st_type == 6){
  254. $('#ebox').css({ height: '440px',width:'1000px' })
  255. if(type == 3 && e == `calc(100% - 500px)`){
  256. $('#ebox').css({ height: '440px',width:'1650px' })
  257. }else{
  258. $('#ebox').css({ height: '440px',width:'1000px' })
  259. }
  260. }else{
  261. $('#ebox').css({ height: '440px',width:'1200px' })
  262. if(type == 3 && e == `calc(100% - 500px)`){
  263. $('#ebox').css({ height: '440px',width:'1900px' })
  264. }else{
  265. $('#ebox').css({ height: '440px',width:'1200px' })
  266. }
  267. }
  268. }
  269. const props = defineProps({
  270. detailInfo: Object,
  271. title: String
  272. });
  273. const tanshuiList = ref({});
  274. const senid = ref();
  275. const sensor_name = ref();
  276. const dchar = ref();
  277. // 图片展示
  278. const imgList = ref([])
  279. const imgtree = ref({})
  280. const imgname = ref('')
  281. const imgindex = ref(1)
  282. watch(
  283. () => props.detailInfo,
  284. (newV) => {
  285. senid.value = newV.sensor[0].senid;
  286. sensor_name.value = newV.sensor[0].sensor_name;
  287. dchar.value = newV.sensor[0].dchar;
  288. imgList.value = []
  289. imgtree.value = []
  290. if (newV.pic_annex.length > 0) {
  291. let arr = newV.pic_annex
  292. arr.forEach(i => {
  293. let arr = i.img_url.split('/')
  294. i.type = arr[arr.length - 2]
  295. i.img_name = arr[arr.length - 1]
  296. })
  297. imgList.value = arr
  298. let obj = {}
  299. arr.forEach((i, index) => {
  300. i.id = index + 1
  301. if (obj.hasOwnProperty(i.type)) {
  302. obj[i.type].push(i);
  303. } else {
  304. obj[i.type] = [];
  305. obj[i.type].push(i);
  306. }
  307. })
  308. imgtree.value = obj
  309. }
  310. if (newV.st_type == 6) {
  311. let obj = {};
  312. newV.sensor?.forEach((i) => {
  313. if (obj.hasOwnProperty(i.ts_layer)) {
  314. obj[i.ts_layer].value.push(i);
  315. } else {
  316. obj[i.ts_layer] = {};
  317. obj[i.ts_layer].id = null;
  318. obj[i.ts_layer].value = [];
  319. obj[i.ts_layer].value.push(i);
  320. if (i.ts_layer.includes('m')) {
  321. obj[i.ts_layer].id = Number(i.ts_layer.split('m')[0])
  322. } else {
  323. obj[i.ts_layer].id = 0
  324. }
  325. }
  326. });
  327. // console.log(obj, 89);
  328. let sortedObjKeys = Object.keys(obj).sort((a, b) => {
  329. return obj[b].id - obj[a].id
  330. })
  331. let arr = {}
  332. sortedObjKeys.forEach(j => {
  333. arr[j] = obj[j]
  334. })
  335. tanshuiList.value = arr;
  336. // console.log(sortedObjKeys,{...arr}, 89);
  337. }
  338. },
  339. {
  340. deep: true,
  341. immediate: true,
  342. }
  343. );
  344. const varousel = ref('')
  345. const nowTime = ref('');
  346. onMounted(() => {
  347. setTimeout(() => {
  348. zooms.value = document.getElementsByClassName("ant-modal")[0].style.zoom
  349. }, 0);
  350. // setTimeout(() => {
  351. //
  352. // },0)
  353. $(`.map-dialog-tabp-list div:nth-child(1)`).css({
  354. background: 'linear-gradient(0deg, #00f7ff 0%, #007ff6 100%)',
  355. '-webkit-background-clip': 'text',
  356. '-webkit-text-fill-color': 'transparent',
  357. 'background-clip': 'text',
  358. 'text-fill-color': 'transparent',
  359. });
  360. nowTime.value = moment().format('YYYY-MM-DD HH:mm:ss');
  361. searchTime.value = [moment().subtract(1, 'days').format('YYYY-MM-DD HH:mm:ss'), moment().format('YYYY-MM-DD HH:mm:ss')];
  362. search(senid.value, sensor_name.value, dchar.value);
  363. //
  364. console.log(varousel.value);
  365. });
  366. const xdata = ref([]);
  367. const ydata = ref([]);
  368. const showNodata = ref(false);
  369. // id,名字,单位
  370. const search = (id, name, dw) => {
  371. senid.value = id;
  372. sensor_name.value = name;
  373. dchar.value = dw;
  374. xdata.value = [];
  375. ydata.value = [];
  376. getMonitorInfo({ senid: senid.value, start_time: searchTime.value[0], end_time: searchTime.value[1] }).then((res) => {
  377. if (res.code == 200 && res.data.length > 0) {
  378. showNodata.value = false;
  379. res.data.forEach((item) => {
  380. xdata.value.push(item.time);
  381. ydata.value.push(item.factv);
  382. });
  383. } else {
  384. showNodata.value = true;
  385. }
  386. // alert(props.title)
  387. // props.title.split('(')[0]+
  388. tableTitle.value = name + '过程线' + '(' + moment(searchTime.value[0]).format('MM月DD日HH时') + '-' + moment(searchTime.value[1]).format('MM月DD日HH时') + ')'
  389. echarts1();
  390. });
  391. };
  392. const disabledDate = (current) => {
  393. return current > moment().valueOf();
  394. };
  395. const changeTab = () => {
  396. }
  397. const setcolor = (from, to) => {
  398. $(`.ant-collapse .ant-collapse-item li`).css({ background: 'transparent' });
  399. // console.log(imgList.value,2233)
  400. imgname.value = imgList.value[to].img_name
  401. imgindex.value = to + 1
  402. }
  403. const setTabColor = (item, index) => {
  404. // console.log(item,87)
  405. senid.value = item.senid;
  406. sensor_name.value = item.sensor_name;
  407. dchar.value = item.dchar;
  408. $('.map-dialog-tabp-list div').css({ background: 'transparent', color: '#BED2FF', '-webkit-text-fill-color': '#BED2FF' });
  409. $(`.map-dialog-tabp-list div:nth-child(${index})`).css({
  410. background: 'linear-gradient(0deg, #00f7ff 0%, #007ff6 100%)',
  411. '-webkit-background-clip': 'text',
  412. '-webkit-text-fill-color': 'transparent',
  413. 'background-clip': 'text',
  414. 'text-fill-color': 'transparent',
  415. });
  416. // console.log(senid.value,sensor_name.value,dchar.value)
  417. search(senid.value, sensor_name.value, dchar.value);
  418. };
  419. const setTabColor2 = (item, index, index2) => {
  420. senid.value = item.senid;
  421. sensor_name.value = item.sensor_name;
  422. dchar.value = item.dchar;
  423. $(`.ant-collapse .ant-collapse-item li`).css({ background: 'transparent' });
  424. $(`.ant-collapse .ant-collapse-item:nth-child(${index + 1}) li:nth-child(${index2 + 1})`).css({ background: 'rgba(0, 94, 182, 0.24)' });
  425. // console.log(senid.value,sensor_name.value,dchar.value)
  426. search(senid.value, sensor_name.value, dchar.value);
  427. };
  428. const setTabColor3 = (item, index, index2) => {
  429. imgname.value = item.img_name
  430. $(`.ant-collapse .ant-collapse-item li`).css({ background: 'transparent' });
  431. $(`.ant-collapse .ant-collapse-item:nth-child(${index + 1}) li:nth-child(${index2 + 1})`).css({ background: 'rgba(0, 94, 182, 0.24)' });
  432. // console.log(senid.value,sensor_name.value,dchar.value)
  433. varousel.value.goTo(item.id - 1)
  434. };
  435. const handleChange = () => {
  436. searchTime.value = [];
  437. // console.log(value1.value)
  438. if (value1.value == 0.5) {
  439. searchTime.value = [moment().subtract(7, 'days').format('YYYY-MM-DD HH:mm:ss'), moment().format('YYYY-MM-DD HH:mm:ss')];
  440. } else if (value1.value == 1) {
  441. searchTime.value = [moment().subtract(30, 'days').format('YYYY-MM-DD HH:mm:ss'), moment().format('YYYY-MM-DD HH:mm:ss')];
  442. } else if (value1.value == 2) {
  443. searchTime.value = [moment().subtract(3, 'month').format('YYYY-MM-DD HH:mm:ss'), moment().format('YYYY-MM-DD HH:mm:ss')];
  444. } else if (value1.value == 3) {
  445. searchTime.value = [moment().subtract(6, 'month').format('YYYY-MM-DD HH:mm:ss'), moment().format('YYYY-MM-DD HH:mm:ss')];
  446. } else if (value1.value == 24) {
  447. searchTime.value = [moment().subtract(1, 'days').format('YYYY-MM-DD HH:mm:ss'), moment().format('YYYY-MM-DD HH:mm:ss')];
  448. }
  449. };
  450. const value1 = ref('24');
  451. const searchTime = ref([]);
  452. const activeKey = ref('1');
  453. // 下拉菜单
  454. let activeMenu = reactive({
  455. activeKey: '1',
  456. customStyle: 'background:transparent;',
  457. });
  458. // 图表标题
  459. const tableTitle = ref('')
  460. // 引入图表插件
  461. const { proxy } = getCurrentInstance();
  462. const echarts = proxy.$echarts;
  463. function flowFn(max, min) {
  464. let maxValue = Math.ceil(max);
  465. let minValue = Math.floor(min);
  466. let interval = 0;
  467. console.log((max - min) / 5);
  468. if ((max - min) / 5 <= 1) {
  469. interval = 1;
  470. minValue = Math.floor(minValue);
  471. maxValue = Math.ceil(maxValue);
  472. if (maxValue - minValue == 1) {
  473. minValue = minValue - 2
  474. maxValue = maxValue + 2
  475. }
  476. if (maxValue - minValue == 2) {
  477. minValue = minValue - 2
  478. maxValue = maxValue + 1
  479. }
  480. if (maxValue - minValue == 3) {
  481. minValue = minValue - 1
  482. maxValue = maxValue + 1
  483. }
  484. if (maxValue - minValue == 4) {
  485. minValue = minValue - 1
  486. }
  487. } else {
  488. // 获取余数
  489. minValue = minValue - (5 - ((maxValue - minValue) % 5));
  490. interval = (maxValue - minValue) / 5;
  491. }
  492. return {
  493. interval: interval,
  494. maxValue: maxValue,
  495. minValue: minValue,
  496. };
  497. }
  498. function waterLevel(max, min) {
  499. let maxValue = Math.ceil(max);
  500. let minValue = Math.floor(min);
  501. let interval = 0;
  502. console.log((max - min) / 5);
  503. if ((max - min) / 5 <= 0.2) {
  504. interval = 0.2;
  505. maxValue = Math.floor(maxValue);
  506. maxValue = Math.ceil(maxValue);
  507. } else if ((max - min) / 5 <= 0.5) {
  508. interval = 0.5;
  509. maxValue = Math.floor(maxValue);
  510. maxValue = Math.ceil(maxValue);
  511. } else if ((max - min) / 5 <= 1) {
  512. interval = 0.5;
  513. maxValue = Math.floor(maxValue);
  514. maxValue = Math.ceil(maxValue);
  515. } else {
  516. // 获取余数
  517. minValue = minValue - (5 - ((maxValue - minValue) % 5));
  518. interval = (maxValue - minValue) / 5;
  519. }
  520. return {
  521. interval: interval,
  522. maxValue: maxValue,
  523. minValue: minValue,
  524. };
  525. }
  526. function echarts1() {
  527. // const chart = echarts.init(document.getElementById('query-echarts'));
  528. let max = Math.max(...ydata.value)
  529. let min = Math.min(...ydata.value)
  530. let liuliang2 = {}
  531. // 判断是否是雨量,还是水位,还是流量
  532. if (tableTitle.value.indexOf("雨量") != -1) {
  533. liuliang2 = {
  534. interval: null,
  535. maxValue: null,
  536. minValue: null,
  537. }
  538. }
  539. if (tableTitle.value.indexOf("水位") != -1) {
  540. liuliang2 = waterLevel(max, min);
  541. }
  542. if (tableTitle.value.indexOf("流量") != -1) {
  543. liuliang2 = flowFn(max, min);
  544. }
  545. var option;
  546. option = {
  547. title: {
  548. text: tableTitle.value,
  549. x: 'center',
  550. textStyle: {
  551. color: '#fff',
  552. fontSize: 16
  553. }
  554. },
  555. tooltip: {
  556. show: true,
  557. trigger: 'axis',
  558. formatter(params) {
  559. var relVal = params[0].name;
  560. for (var i = 0, l = params.length; i < l; i++) {
  561. console.log('tooltip数据值', params[i].value)
  562. //遍历出来的值一般是字符串,需要转换成数字,再进项tiFixed四舍五入
  563. relVal += '<br/>' + params[i].marker + params[i].seriesName + ' : ' + Number(params[i].value)
  564. }
  565. return relVal;
  566. },
  567. },
  568. dataZoom: [
  569. {
  570. type: "inside" //详细配置可见echarts官网
  571. },
  572. {
  573. type: "inside" //详细配置可见echarts官网
  574. },
  575. ],
  576. toolbox: {
  577. show: true,
  578. feature: {
  579. saveAsImage: {
  580. show: true,
  581. title: '保存图片',
  582. name: tableTitle.value,
  583. iconStyle: {
  584. borderColor: '#fff',
  585. },
  586. backgroundColor: "#021D33"
  587. }, // 保存图表
  588. },
  589. },
  590. // legend: {
  591. // // data: ['test1', 'test2', 'test3'],
  592. // textStyle: {
  593. // fontSize: 14, //字体大小
  594. // color: '#ffffff', //字体颜色
  595. // },
  596. // },
  597. grid: {
  598. top: '12%',
  599. left: '3%',
  600. right: '4%',
  601. bottom: '10%',
  602. containLabel: true,
  603. },
  604. xAxis: {
  605. type: 'category',
  606. boundaryGap: true,
  607. data: xdata.value,
  608. axisLabel: {
  609. //x轴文字的配置
  610. color: 'green',
  611. show: true,
  612. textStyle: {
  613. color: '#fff',
  614. },
  615. formatter: function (val) {
  616. var strs = val.split(''); //字符串数组
  617. var str = '';
  618. for (var i = 0, s; (s = strs[i++]);) {
  619. //遍历字符串数组
  620. if (i > 5 && i < 17) {
  621. str += s;
  622. }
  623. if (!(i % 10)) str += '\n'; //按需要求余
  624. }
  625. return str;
  626. },
  627. },
  628. },
  629. yAxis: {
  630. name: dchar.value,
  631. nameTextStyle: {
  632. color: '#fff',
  633. },
  634. // scale: true,
  635. type: 'value',
  636. axisLabel: {
  637. //x轴文字的配置
  638. show: true,
  639. textStyle: {
  640. color: '#fff',
  641. },
  642. formatter: function (value) {
  643. return value + "";
  644. }
  645. },
  646. splitLine: {
  647. //网格线
  648. lineStyle: {
  649. type: 'dotted', //设置网格线类型 dotted:虚线 solid:实线
  650. width: 1, //y轴线的宽度
  651. color: '#484849',
  652. },
  653. show: true, //隐藏或显示
  654. },
  655. interval: liuliang2.interval, // 步长
  656. min: liuliang2.minValue,
  657. max: liuliang2.maxValue,
  658. },
  659. series: [
  660. {
  661. name: sensor_name.value,
  662. type: sensor_name.value.includes('雨量') ? 'bar' : 'line',
  663. stack: 'Total',
  664. smooth: true,
  665. data: ydata.value,
  666. barMaxWidth: 30
  667. },
  668. ],
  669. };
  670. option && chart.setOption(option);
  671. }
  672. var chart = null
  673. onMounted(() => {
  674. setBox()
  675. chart = echarts.init(document.getElementById('query-echarts'));
  676. });
  677. </script>
  678. <style lang="less" scoped>
  679. // 修改组件样式
  680. ::v-deep(.total222 .ant-tabs-nav .ant-tabs-tab-active) {
  681. // background: url('../../assets/images/sjx1.png') no-repeat 42px 9px;
  682. background: url('../../assets/images/weatheHome/active-bar1.png') no-repeat;
  683. // width: 45px;
  684. background-size: 100%;
  685. height: 40px;
  686. width: 169px;
  687. color: #c9d1d9;
  688. }
  689. ::v-deep(.total222 .ant-tabs-nav > div > div:nth-child(2).ant-tabs-tab-active) {
  690. // background: url('../../assets/images/sjx1.png') no-repeat 42px 9px;
  691. // background: url('../../../assets/images/tab.png') no-repeat;
  692. // width: 45px;
  693. // background-position: 6px 3px;
  694. background-size: 100% 100%;
  695. height: 42px;
  696. // line-height: 42px;
  697. // margin-left: -6px;
  698. }
  699. // ::v-deep(.total222 .ant-tabs-nav > div > div:nth-child(2).ant-tabs-tab-active span) {
  700. // position: relative;
  701. // // top: 10px !important;
  702. // }
  703. .total222 {
  704. margin-top: 20px;
  705. }
  706. ::v-deep(.total222 .ant-tabs-nav .ant-tabs-tab) {
  707. // background-position: 6px 3px;
  708. background-size: 100% 100%;
  709. height: 40px;
  710. // line-height: 42px;
  711. padding: 12px 0px 12px 0px;
  712. margin: 0;
  713. width: 165px;
  714. }
  715. ::v-deep(.total222 .ant-tabs-nav .ant-tabs-tab span) {
  716. position: relative;
  717. top: -4px;
  718. color: #377dff;
  719. }
  720. ::v-deep(.total222 .ant-tabs-nav .ant-tabs-tab-active span) {
  721. color: #c9d1d9 !important;
  722. }
  723. ::v-deep(.ant-tabs-top-bar) {
  724. margin-bottom: 0px !important;
  725. }
  726. ::v-deep(.ant-tabs-ink-bar) {
  727. visibility: hidden;
  728. }
  729. ::v-deep(.ant-collapse-borderless) {
  730. background-color: transparent !important;
  731. }
  732. ::v-deep(.ant-collapse-borderless > .ant-collapse-item) {
  733. border: 0px !important;
  734. }
  735. ::v-deep(.ant-tabs-top > .ant-tabs-nav::before,
  736. .ant-tabs-bottom > .ant-tabs-nav::before,
  737. .ant-tabs-top > div > .ant-tabs-nav::before,
  738. .ant-tabs-bottom > div > .ant-tabs-nav::before) {
  739. border-bottom: 0px;
  740. }
  741. ::v-deep(.ant-tabs) {
  742. color: #fff;
  743. }
  744. ::v-deep(.ant-tabs-tab.ant-tabs-tab-active .ant-tabs-tab-btn) {
  745. color: #ffe75c;
  746. }
  747. ::v-deep(.ant-tabs-tab) {
  748. // font-size: 18px;
  749. // font-weight: bold;
  750. font-size: 16px;
  751. font-weight: normal !important;
  752. }
  753. ::v-deep(.ant-tabs-bar) {
  754. border-bottom: 0px solid #303030 !important;
  755. }
  756. ::v-deep(.ant-tabs-nav) {
  757. background: url('../../assets/images/weatheHome/bar-bg1.png') no-repeat;
  758. background-size: 100%;
  759. width: 505px !important;
  760. height: 48px !important;
  761. padding-top: 3px;
  762. margin: 0 auto;
  763. }
  764. // 修改组件样式结束
  765. .map-dialog-title {
  766. font-size: 16px;
  767. color: #d8e5ff;
  768. position: relative;
  769. img {
  770. display: inline-block;
  771. vertical-align: middle;
  772. position: relative;
  773. top: -3px;
  774. }
  775. }
  776. .map-dialog-table {
  777. ul {
  778. border: 1px solid #014a9b;
  779. margin: 10px 20px;
  780. li {
  781. display: flex;
  782. border-top: 1px solid #014a9b;
  783. line-height: 50px;
  784. text-align: center;
  785. color: #bed2ff;
  786. font-size: 14px;
  787. div {
  788. border-left: 1px solid #014a9b;
  789. }
  790. div:nth-child(1) {
  791. border-left: 0px solid #014a9b;
  792. }
  793. div:nth-child(1),
  794. div:nth-child(3),
  795. div:nth-child(5) {
  796. width: 10%;
  797. background: rgba(0, 50, 105, 0.3);
  798. }
  799. div:nth-child(2),
  800. div:nth-child(4),
  801. div:nth-child(6) {
  802. width: 20%;
  803. }
  804. }
  805. li:nth-child(1) {
  806. border-top: 0px solid #014a9b;
  807. }
  808. }
  809. }
  810. .mg-10 {
  811. margin-top: 20px;
  812. }
  813. .map-dialog-tabp-list {
  814. position: absolute;
  815. display: flex;
  816. left: 100px;
  817. color: #fff;
  818. top: 0px;
  819. &>div {
  820. // width: 189px;
  821. margin-left: 30px;
  822. margin-top: 3px;
  823. cursor: pointer;
  824. text-align: center;
  825. flex-shrink: 0;
  826. }
  827. .active-tabp {
  828. font-size: 14px;
  829. background: linear-gradient(0deg, #00f7ff 0%, #007ff6 100%);
  830. -webkit-background-clip: text;
  831. -webkit-text-fill-color: transparent;
  832. background-clip: text;
  833. text-fill-color: transparent;
  834. position: relative;
  835. img {
  836. width: 100%;
  837. position: absolute;
  838. // bottom: -100px;
  839. }
  840. }
  841. }
  842. .tabp-conetnt {
  843. height: 100%;
  844. margin-top: 20px;
  845. display: flex;
  846. height: 100%;
  847. overflow-y: auto;
  848. .hconetnt {
  849. height: 480px !important;
  850. overflow-y: auto;
  851. }
  852. .tabp-conetnt-left {
  853. width: 14%;
  854. height: 100%;
  855. margin-left: 20px;
  856. // padding: 20px;
  857. background: linear-gradient(180deg, #022d5d 0%, rgba(0, 35, 74, 0.91) 100%);
  858. overflow: auto;
  859. ::v-deep(.ant-collapse) {
  860. border: none;
  861. }
  862. ::v-deep(.ant-collapse-header) {
  863. background: linear-gradient(90deg, rgba(0, 124, 240, 0.24) 0%, rgba(216, 216, 216, 0) 100%);
  864. color: #fff;
  865. font-size: 14px;
  866. }
  867. }
  868. .tabp-conetnt-right {
  869. // height: 100%;
  870. font-size: 14px;
  871. margin-left: 40px;
  872. margin-right: 40px;
  873. flex: 1;
  874. position: relative;
  875. overflow: hidden;
  876. height: 680px;
  877. }
  878. }
  879. .tabp-right-top {
  880. width: 100%;
  881. display: flex;
  882. color: #bed2ff;
  883. justify-content: space-between;
  884. span {
  885. color: #ffffff;
  886. }
  887. }
  888. .collapse-ul {
  889. li {
  890. margin-bottom: 10px;
  891. padding-left: 20px;
  892. color: #bed2ff;
  893. cursor: pointer;
  894. }
  895. .liactive {
  896. background: rgba(0, 94, 182, 0.24);
  897. }
  898. }
  899. .tabp-right-query {
  900. // height: 100%;
  901. margin-top: 10px;
  902. display: flex;
  903. &>div:nth-child(1) {
  904. border: 1px solid #00346e;
  905. span {
  906. border-left: 1px solid #00346e;
  907. display: inline-block;
  908. padding: 5px 10px;
  909. cursor: pointer;
  910. }
  911. span:nth-child(1) {
  912. border-left: 0px solid #00346e;
  913. }
  914. .active {
  915. background-color: rgb(38, 99, 255);
  916. }
  917. }
  918. &>div:nth-child(3) {
  919. margin-left: 20px;
  920. }
  921. ::v-deep(.ant-radio-button-wrapper) {
  922. border: none;
  923. }
  924. ::v-deep(.ant-input) {
  925. border: 1px solid #00346e !important;
  926. }
  927. }
  928. ::v-deep .tabp-right-query .ant-input {
  929. height: 37px;
  930. }
  931. ::v-deep .tabp-right-query .ant-btn {
  932. height: 37px;
  933. }
  934. // 轮播样式开始
  935. .ant-carousel :deep(.slick-slide) {
  936. text-align: center;
  937. height: 750px;
  938. // line-height: 800px;
  939. background: transparent;
  940. overflow: hidden;
  941. color: #fff;
  942. }
  943. .ant-carousel :deep(.slick-arrow.custom-slick-arrow) {
  944. width: 25px;
  945. height: 25px;
  946. font-size: 25px;
  947. color: #fff;
  948. background-color: rgba(31, 45, 61, 0.11);
  949. opacity: 1;
  950. }
  951. .ant-carousel :deep(.custom-slick-arrow:before) {
  952. display: none;
  953. }
  954. .ant-carousel :deep(.custom-slick-arrow:hover) {
  955. opacity: 0.5;
  956. }
  957. .ant-carousel :deep(.slick-slide h3) {
  958. color: #fff;
  959. }
  960. ::v-deep .ant-carousel .slick-dots li.slick-active button {
  961. background-color: #fff !important;
  962. }
  963. ::v-deep .ant-carousel .slick-dots li button {
  964. background-color: #fff !important;
  965. }
  966. ::v-deep .ant-carousel .slick-next:hover {
  967. // background-color: #000 !important;
  968. color: #fff !important;
  969. }
  970. ::v-deep .ant-carousel .slick-prev:hover {
  971. color: #fff !important;
  972. }
  973. .carousel-img {
  974. // width: 100%;
  975. height: 680px;
  976. margin: 0 auto;
  977. }
  978. .carousel-title {
  979. position: absolute;
  980. left: 20px;
  981. bottom: 0px;
  982. z-index: 9999;
  983. color: #bed2ff;
  984. display: flex;
  985. justify-content: space-between;
  986. }
  987. // 轮播样式结束
  988. .collapse-video-ul {
  989. li {
  990. text-align: center;
  991. line-height: 32px;
  992. margin-top: 10px;
  993. }
  994. .video-active {
  995. background: linear-gradient(90deg, rgba(100, 255, 255, 0.29) 0%, rgba(100, 255, 255, 0) 100%);
  996. }
  997. }
  998. #query-echarts {
  999. margin-top: 16px;
  1000. }
  1001. .none-data {
  1002. margin: 20px auto;
  1003. }
  1004. </style>