result.vue 12 KB

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