mapDialog.vue 35 KB

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