result.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  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'">
  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(1);
  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: 0,
  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. console.log(val);
  263. let newMap = new Map([
  264. ["Temperature", "(℃)"],
  265. ["Pressure", "(kg/s)"],
  266. ["Pressure", "(kg/s)"],
  267. ["CO2", "(%)"],
  268. ["CO2", "(%)"],
  269. ["H2S", "(%)"],
  270. ["Flow", "(Pa)"],
  271. ["Height", "m"],
  272. ]);
  273. newMap.forEach((value, key) => {
  274. console.log(key, value);
  275. if (key == val) {
  276. danwei.value = key + value;
  277. }
  278. });
  279. }
  280. const hazardtype = (val) => {
  281. emit("titleclick", "模拟数据", val);
  282. };
  283. const initAid = (leftAid, rightAid) => {
  284. console.log(1112344555)
  285. isdonghua.value=false;
  286. getMonitor(leftAid, rightAid);
  287. // wdisasterref.value.getinit(leftAid);
  288. // wdisasterref2.value.getinit(rightAid);
  289. };
  290. const wdiclick=(id,selid)=>{
  291. if(selid=='1'){//判断选择的那一个
  292. wdisasterref.value.getinit(id);
  293. }else if(selid=='2'){
  294. wdisasterref2.value.getinit(id);
  295. }else{
  296. }
  297. }
  298. //监测点数据获取
  299. async function getMonitor(leftAid, rightAid) {
  300. const params = {
  301. transCode: "D10018",
  302. aid: leftAid,
  303. step: 1,
  304. };
  305. await request(params)
  306. .then((res) => {
  307. if (res.returnCode == "000000000") {
  308. strResultFormatlist.value = [];
  309. console.log(res);
  310. for (let i = 0; i < res.codes.length; i++) {
  311. let cocode = res.codes[i];
  312. strResultFormatlist.value.push({
  313. id: i,
  314. name: cocode.code,
  315. value: cocode.code,
  316. });
  317. }
  318. console.log( strResultFormatlist.value);
  319. formInline.value.region = strResultFormatlist.value[0].value;
  320. console.log(strResultFormatlist.value);
  321. setleftAid.value.leftChangAid(
  322. leftAid,
  323. formInline.value.count + 1,
  324. formInline.value.region
  325. );
  326. setrightAid.value.rightChangAid(
  327. rightAid,
  328. formInline.value.count + 1,
  329. formInline.value.region
  330. );
  331. } else {
  332. ElMessage({
  333. message: res.returnMsg,
  334. type: "error",
  335. });
  336. }
  337. })
  338. .catch((err) => { });
  339. }
  340. onMounted(() => {
  341. // leftcontentref.value.accident2('1','Water')
  342. });
  343. // 卸载时的操作
  344. onUnmounted(() => {
  345. // 清除定时器
  346. if (timing.value) {
  347. clearInterval(timing.value);
  348. }
  349. });
  350. defineExpose({ accident6, initAid, mntext1, mntext2, clickflat, endtime, zdtime, timeline, oldtime,wdiclick });
  351. </script>
  352. <style scoped lang="scss">
  353. .heigjie {
  354. width: 100%;
  355. height: 50px;
  356. line-height: 50px;
  357. background-image: url(/src/assets/img/Group10.png) !important;
  358. background-repeat: no-repeat;
  359. background-position: center;
  360. background-size: 100% 100%;
  361. .he_pading1 {
  362. padding: 10px 9px 0 7px;
  363. }
  364. }
  365. .animation_s .el-slider {
  366. padding: 0px 10px;
  367. }
  368. .tanniu {
  369. display: flex;
  370. justify-content: space-between;
  371. align-items: center;
  372. }
  373. .tanniu ul{
  374. margin-top: 24px;
  375. width: 100%;
  376. }
  377. .resultyem {
  378. width: 100%;
  379. position: absolute;
  380. z-index: 12;
  381. top: 70px;
  382. color: #fff;
  383. display: flex;
  384. justify-content: space-between;
  385. height: calc(100vh - 154px);
  386. }
  387. .results {
  388. flex: 1;
  389. position: relative;
  390. overflow:hidden;
  391. }
  392. .result_left {
  393. margin: 0 .0781rem 0 .1563rem;
  394. }
  395. .result_right {
  396. margin: 0 .1563rem 0 .0781rem;
  397. }
  398. .result_left,
  399. .result_right {
  400. height: calc(100vh - 154px);
  401. background: rgba(26, 38, 69, 0.4);
  402. }
  403. .publicleft {
  404. width: 2.125rem;
  405. background: rgba(26, 38, 69, 0.4);
  406. margin-left: 0.1563rem;
  407. }
  408. .resultime {
  409. display: flex;
  410. height: 50px;
  411. border: 1px solid;
  412. border-image: linear-gradient(347deg, rgb(16, 92, 240), rgb(18, 48, 102)) 1 1;
  413. }
  414. .resultime .text {
  415. font-size: 14px;
  416. width: 88px;
  417. font-weight: bold;
  418. line-height: 50px;
  419. text-align: center;
  420. display: inline-block;
  421. border-right: 1px solid;
  422. border-image: linear-gradient(347deg, rgb(16, 92, 240), rgb(18, 48, 102)) 1 1;
  423. float: left;
  424. }
  425. .resultime .time {
  426. line-height: 50px;
  427. font-family: Microsoft YaHei UI, Microsoft YaHei UI;
  428. font-weight: bold;
  429. font-size: .0729rem;
  430. color: #ff0f0f;
  431. line-height: 50px;
  432. text-align: left;
  433. text-align: center;
  434. font-style: normal;
  435. text-transform: none;
  436. width: 189px;
  437. }
  438. </style>
  439. <style>
  440. .heigjie .el-form-item__label {
  441. font-weight: 400;
  442. font-size: 13px;
  443. color: #ffffff;
  444. text-align: left;
  445. font-style: normal;
  446. text-transform: none;
  447. }
  448. .heigjie .el-select .el-input__inner {
  449. color: #fff;
  450. }
  451. .results .elimgmn {
  452. position: absolute;
  453. top: 0;
  454. left: 0;
  455. z-index: 111;
  456. width: 100%;
  457. }
  458. .bceligmn {
  459. width: 212px;
  460. height: 52px;
  461. padding: 0px 20px;
  462. line-height: 52px;
  463. background-image: url(../assets/img/303.png);
  464. margin: 20px;
  465. }
  466. .bceligmn .el-image {
  467. float: left;
  468. margin-top: 13px;
  469. }
  470. .mntext {
  471. overflow: hidden;
  472. white-space: nowrap;
  473. text-overflow: ellipsis;
  474. font-weight: 400;
  475. font-size: 13px;
  476. color: #ffffff;
  477. text-align: left;
  478. font-style: normal;
  479. text-transform: none;
  480. padding-left: 10px;
  481. }
  482. .mnclose {
  483. position: absolute;
  484. right: 10px;
  485. top: 20px;
  486. }
  487. .wotermn {
  488. line-height: 34px;
  489. }
  490. .resultime .newtime {
  491. width: 190px;
  492. }
  493. .resultime .newtime .el-input__inner {
  494. line-height: 70px;
  495. font-family: Microsoft YaHei UI, Microsoft YaHei UI;
  496. font-weight: bold;
  497. font-size: 13px;
  498. color: #ff0f0f !important;
  499. line-height: 70px;
  500. text-align: left;
  501. font-style: normal;
  502. text-transform: none;
  503. }
  504. .resultime .el-input__wrapper {
  505. height: 70px;
  506. background: none !important;
  507. border: none;
  508. box-shadow: none;
  509. }
  510. .resultime .el-input__prefix {
  511. display: none;
  512. }
  513. .newtime .el-input {
  514. width: 180px !important;
  515. }
  516. .donghua{
  517. pointer-events: none;
  518. }
  519. </style>