result.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  1. <template>
  2. <!--结果对比 -->
  3. <div class="resultyem" v-show="resultyem">
  4. <div class="publicleft" v-show="clickflat">
  5. <div class="resultime">
  6. <div class="text">指定时间</div>
  7. <!-- <div class="newtime">
  8. <el-date-picker
  9. v-model="zdtime"
  10. type="datetime"
  11. placeholder="Select date and time"
  12. @change="zdtimechange"
  13. />
  14. </div> -->
  15. <div class="time">{{ timeline }}</div>
  16. </div>
  17. <!-- 动画 -->
  18. <div class="L_aside L_aside1 asideg asidegbg leftbgimg1 " :class="{'donghua':isdonghua}">
  19. <el-collapse accordion v-model="activeNames" class="bganimation">
  20. <el-collapse-item name="1" class="imgneon">
  21. <template #title>
  22. <el-icon class="iconimg Frame3" fit="contain"></el-icon>
  23. 动画展示
  24. </template>
  25. <div class="rg_content">
  26. <div class="rg-padding">
  27. <div class="animation_s">
  28. <el-slider :max="endtime" :min="starttime" v-model="formInline.count" @change="sliderchange">
  29. </el-slider>
  30. <div class="tanniu">
  31. <ul>
  32. <li>
  33. <el-image :src="t1" fit="contain" @click="Prev()"></el-image>
  34. </li>
  35. <li v-show="suspendshow">
  36. <el-image :src="t2" fit="contain" @click="play(500)"></el-image>
  37. </li>
  38. <li v-show="playshow">
  39. <el-image :src="t3" fit="contain" @click="play(500)"></el-image>
  40. </li>
  41. <li>
  42. <el-image :src="t4" fit="contain" @click="increment()"></el-image>
  43. </li>
  44. </ul>
  45. </div>
  46. </div>
  47. </div>
  48. </div>
  49. </el-collapse-item>
  50. </el-collapse>
  51. </div>
  52. <!-- 物理量 -->
  53. <div class="heigjie">
  54. <div class="he_pading1 color1">
  55. <el-form-item label="物理量:" v-if="props.classradio == 'Fire'||props.classradio == 'Gass'">
  56. <el-select v-model="formInline.region" @change="regionchange($event)" placeholder="请选择">
  57. <el-option v-for="item in strResultFormatlist" :key="item.id" :label="item.name"
  58. :value="item.value"></el-option>
  59. </el-select>
  60. </el-form-item>
  61. <div class="wotermn" v-else>
  62. <span>物理量:</span>
  63. <span>水位</span>
  64. </div>
  65. </div>
  66. </div>
  67. </div>
  68. <div class="result_left results re_pading">
  69. <div class="resu_title reimg" @click="hazardtype('1')">
  70. {{ mntext1 }}
  71. </div>
  72. <div class="resultleftxian">
  73. <div class="modle">
  74. <resultLeft ref="setleftAid" :region="formInline.region" :count="newcount" />
  75. </div>
  76. <!--检测点信息 -->
  77. <wdisaster ref="wdisasterref" :count="newcount"/>
  78. </div>
  79. <!-- 检测点 -->
  80. </div>
  81. <!-- 第二个 -->
  82. <div class="result_right r results re_pading">
  83. <div class="resu_title reimg" @click="hazardtype('2')">
  84. {{ mntext2 }}
  85. </div>
  86. <div class="resultleftxian">
  87. <div class="modle">
  88. <!-- :count="formInline.count" -->
  89. <resultRight ref="setrightAid" :region="formInline.region" :count="newcount" />
  90. </div>
  91. <!--检测点信息 -->
  92. <wdisaster2 ref="wdisasterref2" :count="newcount"/>
  93. </div>
  94. <!-- 检测点 -->
  95. </div>
  96. </div>
  97. </template>
  98. <script setup>
  99. import { ref, onMounted, onUnmounted, reactive } from "vue";
  100. import { RouterView, RouterLink } from "vue-router";
  101. import { request, uploadFile } from "@/utils/request";
  102. import { ElMessage, ElButton, ElDialog, ElSelect } from "element-plus";
  103. import resultLeft from "./result/resultLeft.vue";
  104. import resultRight from "./result/resultRight.vue";
  105. import wdisaster from "./result/Wdisaster.vue";
  106. import wdisaster2 from "./result/Wdisaster2.vue";
  107. import { timestampToTime, timescount } from "@/js/lindex.js";
  108. import { vtkmodel } from "@/control/vtkModel.js";
  109. import t1 from "@/assets/img/t1.png";
  110. import t2 from "@/assets/img/t2.png";
  111. import t3 from "@/assets/img/t3.png";
  112. import t4 from "@/assets/img/t4.png";
  113. import mn from "@/assets/img/Group204.png";
  114. import t5 from "@/assets/img/Group207.png";
  115. import t6 from "@/assets/img/Frame.png";
  116. import bg from "@/assets/img/303.png";
  117. let emit = defineEmits(["titleclick"]);
  118. const props = defineProps({
  119. classradio: {
  120. type: String,
  121. },
  122. });
  123. let newcount = ref(60);
  124. let activeNames=ref(['1'])
  125. let wdisasterref = ref();
  126. let wdisasterref2 = ref();
  127. let resultyem = ref(false);
  128. let timing = ref(null);
  129. let leftcontentref = ref();
  130. let starttime = ref(1);
  131. let endtime = ref(60);
  132. let timenum = ref(2);
  133. let playshow=ref(true);
  134. let suspendshow=ref(false);
  135. let showfalse=ref(false);
  136. let isdonghua=ref(true);
  137. let time = ref();
  138. let danwei=ref();
  139. const isstop = ref(false);
  140. let aid = ref(Number);
  141. let oldtime = ref();
  142. let timeline = ref("2024-03-22 09:42:06");
  143. let setleftAid = ref();
  144. let setrightAid = ref();
  145. let leftid=ref();
  146. let rightid=ref();
  147. let clickflat = ref(true);
  148. let mntext1 = ref('灾情模拟1');
  149. let mntext2 = ref('灾情模拟2');
  150. const formInline = ref({
  151. region: "",
  152. count: 60,
  153. });
  154. const zdtime = ref("");
  155. const strResultFormatlist = ref([]);
  156. const changeModel= ()=> {
  157. vtkmodel.clearJgAddMode();
  158. vtkmodel.renderWindow.render();
  159. }
  160. const accident6 = (key, id) => {
  161. aid.value = id;
  162. if (key == 2) {
  163. vtkmodel.clearAll();
  164. resultyem.value = true;
  165. console.log(resultyem.value);
  166. } else {
  167. changeModel();
  168. resultyem.value = false;
  169. }
  170. };
  171. // 时间选择
  172. function zdtimechange() {
  173. const zdtimestamp = Date.parse(zdtime.value);
  174. const zdtimeDate = new Date(zdtimestamp);
  175. //console.log(zdtimeDate);
  176. // reddate(zdtimeDate);
  177. }
  178. // 播放按钮的显示隐藏
  179. // playshow.value=true;
  180. //suspendshow.value=false;
  181. //滑块
  182. function sliderchange(val) {
  183. //fcon.step = count.value;
  184. // console.log(val);
  185. suspendshow.value=false;
  186. playshow.value=true;
  187. isstop.value = false;
  188. newcount.value =val;
  189. newtime();
  190. }
  191. // 时间计算
  192. const newtime = () => {
  193. time.value = null;
  194. console.log(formInline.value.count);
  195. time.value = (new Date(oldtime.value).getTime()) / 1000;
  196. if (formInline.value.count == 2) {
  197. let time2 = (formInline.value.count - 1) * 60 + time.value;
  198. timeline.value = timescount(time2);
  199. } else {
  200. let time2 = (formInline.value.count) * 60 + time.value;
  201. timeline.value = timescount(time2);
  202. }
  203. };
  204. //回到上一页
  205. function Prev() {
  206. isstop.value = false;
  207. formInline.value.count--;
  208. newcount.value = formInline.value.count;
  209. newtime();
  210. }
  211. //播放
  212. const play =(time)=>{
  213. showfalse.value=!showfalse.value;
  214. // currentrow1.value=false;
  215. if(showfalse.value){
  216. suspendshow.value=true;
  217. playshow.value=false;
  218. isstop.value = true;//播放
  219. const sleep = (timeout = time) =>
  220. new Promise((resolve, reject) => {
  221. setTimeout(resolve, timeout);
  222. });
  223. let timer = async (timeout) => {
  224. while (formInline.value.count < endtime.value && isstop.value) {
  225. if (isstop.value == true) {
  226. await sleep(time);
  227. formInline.value.count++;
  228. // fcon.step = formInline.value.count ;
  229. // vtkScalarRead();
  230. // getMonitor();
  231. newcount.value = formInline.value.count;
  232. newtime();
  233. }
  234. }
  235. };
  236. timer(time);
  237. }else{
  238. playshow.value=true;
  239. suspendshow.value=false;
  240. isstop.value = false;//暂停
  241. }
  242. }
  243. //暂停
  244. function suspend() {
  245. isstop.value = false;
  246. }
  247. // 快进
  248. function increment() {
  249. isstop.value = false;
  250. if (formInline.value.count == endtime.value) {
  251. return;
  252. }
  253. formInline.value.count++;
  254. newcount.value = formInline.value.count;
  255. newtime();
  256. console.log(formInline.value.count);
  257. // vtkScalarRead();
  258. // getMonitor();
  259. }
  260. // 物理量的选择
  261. function regionchange(val) {
  262. // let newMap = new Map([
  263. // ["Temperature", "(℃)"],
  264. // ["Pressure", "(kg/s)"],
  265. // ["Pressure", "(kg/s)"],
  266. // ["CO2", "(%)"],
  267. // ["CO2", "(%)"],
  268. // ["H2S", "(%)"],
  269. // ["Flow", "(Pa)"],
  270. // ["Height", "m"],
  271. // ]);
  272. // newMap.forEach((value, key) => {
  273. // if (key == val) {
  274. // danwei.value = key + value;
  275. // }
  276. // });
  277. }
  278. const hazardtype = (val) => {
  279. emit("titleclick", "模拟数据", val);
  280. };
  281. const initAid = (leftAid, rightAid) => {
  282. console.log(1112344555)
  283. isdonghua.value=false;
  284. getMonitor(leftAid, rightAid);
  285. // wdisasterref.value.getinit(leftAid);
  286. // wdisasterref2.value.getinit(rightAid);
  287. };
  288. const wdiclick=(id,selid)=>{
  289. if(selid=='1'){//判断选择的那一个
  290. wdisasterref.value.getinit(id);
  291. }else if(selid=='2'){
  292. wdisasterref2.value.getinit(id);
  293. }else{
  294. }
  295. }
  296. //监测点数据获取
  297. async function getMonitor(leftAid, rightAid) {
  298. let name;
  299. const params = {
  300. transCode: "D10018",
  301. aid: leftAid,
  302. step: 1,
  303. };
  304. await request(params)
  305. .then((res) => {
  306. if (res.returnCode == "000000000") {
  307. strResultFormatlist.value = [];
  308. console.log(res);
  309. for (let i = 0; i < res.codes.length; i++) {
  310. let cocode = res.codes[i];
  311. let newMap = new Map([
  312. ["Temperature", "(℃)"],
  313. ["Pressure", "(Pa)"],
  314. ["CO", "(ppm)"],
  315. ["CO2", "(%)"],
  316. ["H2S", "(%)"],
  317. ["HCL", "(ppm)"],
  318. ["NO2", "(ppm)"],
  319. ["SO2", "(ppm)"],
  320. ["Flow", "(Pa)"],
  321. ["Height", "(m)"],
  322. ]);
  323. newMap.forEach((value, key) => {
  324. if ( key == res.codes[i].code ) {
  325. if(key=='Temperature'){
  326. key='温度'
  327. }else if(key=='Pressure'){
  328. key='压强'
  329. }else if(key=='CO'){
  330. key= '一氧化碳'
  331. }else if(key=='CO2'){
  332. key= '二氧化碳'
  333. }else if(key=='HCL'){
  334. key= '氯化氢'
  335. }else if(key=='NO2'){
  336. key= '二氧化氮'
  337. }else if(key=='SO2'){
  338. key= '二氧化硫'
  339. }else if(key=='H2S'){
  340. key= '硫化氢'
  341. }else if(key=='Height'){
  342. key= '水位'
  343. }else if(key=='Flow'){
  344. key= '流量'
  345. }else{
  346. }
  347. // res.codes[i].code = key+value;
  348. name = key+value
  349. }
  350. });
  351. strResultFormatlist.value.push({
  352. id: i,
  353. name: name,
  354. value: cocode.code,
  355. });
  356. }
  357. console.log( strResultFormatlist.value);
  358. formInline.value.region = strResultFormatlist.value[0].value;
  359. console.log(strResultFormatlist.value);
  360. setleftAid.value.leftChangAid(
  361. leftAid,
  362. formInline.value.count + 1,
  363. formInline.value.region
  364. );
  365. setrightAid.value.rightChangAid(
  366. rightAid,
  367. formInline.value.count + 1,
  368. formInline.value.region
  369. );
  370. } else {
  371. ElMessage({
  372. message: res.returnMsg,
  373. type: "error",
  374. });
  375. }
  376. })
  377. .catch((err) => { });
  378. }
  379. onMounted(() => {
  380. // leftcontentref.value.accident2('1','Water')
  381. });
  382. watch(
  383. newcount,
  384. (newVal, oldVal) => {
  385. if( newVal>=endtime.value){
  386. playshow.value=true;
  387. suspendshow.value=false;
  388. isstop.value = false;
  389. }
  390. },
  391. { deep: true }
  392. ); //深度监视
  393. // 卸载时的操作
  394. onUnmounted(() => {
  395. // 清除定时器
  396. if (timing.value) {
  397. clearInterval(timing.value);
  398. }
  399. });
  400. defineExpose({ accident6, initAid, mntext1, mntext2, clickflat, endtime, zdtime, timeline, oldtime,wdiclick });
  401. </script>
  402. <style scoped lang="scss">
  403. .heigjie {
  404. width: 100%;
  405. height: 40px;
  406. line-height:40px;
  407. background-image: url(/src/assets/img/Group10.png) !important;
  408. background-repeat: no-repeat;
  409. background-position: center;
  410. background-size: 100% 100%;
  411. .he_pading1 {
  412. margin-left: 0.137rem;
  413. .asterisk-left{
  414. padding-top: 4px;
  415. }
  416. }
  417. }
  418. .animation_s .el-slider {
  419. padding: 0px 10px;
  420. }
  421. .tanniu {
  422. display: flex;
  423. justify-content: space-between;
  424. align-items: center;
  425. }
  426. .tanniu ul{
  427. margin-top: 24px;
  428. width: 100%;
  429. }
  430. .resultyem {
  431. width: 100%;
  432. position: absolute;
  433. z-index: 12;
  434. top: 70px;
  435. color: #fff;
  436. display: flex;
  437. justify-content: space-between;
  438. height: calc(100vh - 154px);
  439. }
  440. .results {
  441. flex: 1;
  442. position: relative;
  443. overflow:hidden;
  444. }
  445. .result_left {
  446. margin: 0 .0781rem 0 .1563rem;
  447. }
  448. .result_right {
  449. margin: 0 .1563rem 0 .0781rem;
  450. }
  451. .result_left,
  452. .result_right {
  453. height: calc(100vh - 154px);
  454. background: rgba(26, 38, 69, 0.4);
  455. overflow: auto;
  456. }
  457. .publicleft {
  458. width: 2.125rem;
  459. background: rgba(26, 38, 69, 0.4);
  460. margin-left: 0.1563rem;
  461. }
  462. .resultime {
  463. display: flex;
  464. height: 50px;
  465. border: 1px solid;
  466. border-image: linear-gradient(347deg, rgb(16, 92, 240), rgb(18, 48, 102)) 1 1;
  467. }
  468. .resultime .text {
  469. font-size: 0.0792rem;
  470. width: 88px;
  471. font-weight: bold;
  472. line-height: 50px;
  473. text-align: center;
  474. display: inline-block;
  475. border-right: 1px solid;
  476. border-image: linear-gradient(347deg, rgb(16, 92, 240), rgb(18, 48, 102)) 1 1;
  477. float: left;
  478. }
  479. .resultime .time {
  480. line-height: 50px;
  481. font-family: Microsoft YaHei UI, Microsoft YaHei UI;
  482. font-weight: bold;
  483. font-size: .0729rem;
  484. color: #ff0f0f;
  485. line-height: 50px;
  486. text-align: left;
  487. text-align: center;
  488. font-style: normal;
  489. text-transform: none;
  490. width: 189px;
  491. }
  492. </style>
  493. <style>
  494. .heigjie .el-form-item__label {
  495. font-weight: 400;
  496. font-size: 13px;
  497. color: #ffffff;
  498. text-align: left;
  499. font-style: normal;
  500. text-transform: none;
  501. }
  502. .heigjie .el-select .el-input__inner {
  503. color: #fff;
  504. }
  505. .results .elimgmn {
  506. position: absolute;
  507. top: 0;
  508. left: 0;
  509. z-index: 111;
  510. width: 100%;
  511. }
  512. .bceligmn {
  513. width: 212px;
  514. height: 52px;
  515. padding: 0px 20px;
  516. line-height: 52px;
  517. background-image: url(../assets/img/303.png);
  518. margin: 20px;
  519. }
  520. .bceligmn .el-image {
  521. float: left;
  522. margin-top: 13px;
  523. }
  524. .mntext {
  525. overflow: hidden;
  526. white-space: nowrap;
  527. text-overflow: ellipsis;
  528. font-weight: 400;
  529. font-size: 13px;
  530. color: #ffffff;
  531. text-align: left;
  532. font-style: normal;
  533. text-transform: none;
  534. padding-left: 10px;
  535. }
  536. .mnclose {
  537. position: absolute;
  538. right: 10px;
  539. top: 20px;
  540. }
  541. .wotermn {
  542. line-height: .2083rem;
  543. }
  544. .resultime .newtime {
  545. width: 190px;
  546. }
  547. .resultime .newtime .el-input__inner {
  548. line-height: 70px;
  549. font-family: Microsoft YaHei UI, Microsoft YaHei UI;
  550. font-weight: bold;
  551. font-size: 13px;
  552. color: #ff0f0f !important;
  553. line-height: 70px;
  554. text-align: left;
  555. font-style: normal;
  556. text-transform: none;
  557. }
  558. .resultime .el-input__wrapper {
  559. height: 70px;
  560. background: none !important;
  561. border: none;
  562. box-shadow: none;
  563. }
  564. .resultime .el-input__prefix {
  565. display: none;
  566. }
  567. .newtime .el-input {
  568. width: 180px !important;
  569. }
  570. .donghua{
  571. pointer-events: none;
  572. }
  573. </style>