You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

243 lines
9.9 KiB

3 years ago
<template>
3 years ago
<div class="tabs">
3 years ago
<div class="tab-item" @click="onTabClick('kuoxian')" :class="{'active': currentTab === 'kuoxian'}">
3 years ago
垂直廓线
3 years ago
<img src="/images/line.png" v-if="currentTab === 'kuoxian'" />
3 years ago
</div>
3 years ago
<div class="tab-item" @click="onTabClick('对流指数')" :class="{'active': currentTab === '对流指数'}">
对流指数
<img src="/images/line.png" v-if="currentTab === '对流指数'" />
3 years ago
</div>
<div class="tab-item" @click="onTabClick('T-logP图')" :class="{'active': currentTab === 'T-logP图'}">
T-logP图
<img src="/images/line.png" v-if="currentTab === 'T-logP图'" />
</div>
<div class="tab-item" @click="onTabClick('BP反演产品')" :class="{'active': currentTab === 'BP反演产品'}">
BP反演产品
<img src="/images/line.png" v-if="currentTab === 'BP反演产品'" />
</div>
3 years ago
</div>
<div class="main">
<div class="menu panel">
<div class="menu-item">
<h2 class="tip">区域选择</h2>
<el-row :gutter="12">
3 years ago
<el-col :span="8"><span @click="onRegionClick('jiangning')" :class="{'active': currentRegion === 'jiangning'}">江宁</span></el-col>
<el-col :span="8"><span @click="onRegionClick('liuhe')" :class="{'active': currentRegion === 'liuhe'}">六合</span></el-col>
<el-col :span="8"><span @click="onRegionClick('pukou')" :class="{'active': currentRegion === 'pukou'}">浦口</span></el-col>
<el-col :span="8"><span @click="onRegionClick('gaochun')" :class="{'active': currentRegion === 'gaochun'}">高淳</span></el-col>
<el-col :span="8"><span @click="onRegionClick('lishui')" :class="{'active': currentRegion === 'lishui'}">溧水</span></el-col>
3 years ago
</el-row>
</div>
3 years ago
<div class="menu-item" v-if="currentTab === 'kuoxian'">
3 years ago
<h2 class="tip">要素选择</h2>
<el-row :gutter="12">
3 years ago
<el-col :span="8"><span @click="onElementClick('TEMP')" :class="{'active': currentElement === 'TEMP'}">温度</span></el-col>
<el-col :span="8"><span @click="onElementClick('RH')" :class="{'active': currentElement === 'RH'}">湿度</span></el-col>
3 years ago
</el-row>
</div>
3 years ago
<div class="menu-item" v-if="currentTab === '对流指数'">
<h2 class="tip">要素选择</h2>
<el-row :gutter="12">
<el-col :span="8"><span @click="onCategoryClick('CAPE')" :class="{'active': currentCategory === 'CAPE'}">CAPE</span></el-col>
<el-col :span="8"><span @click="onCategoryClick('CIN')" :class="{'active': currentCategory === 'CIN'}">CIN</span></el-col>
</el-row>
</div>
3 years ago
</div>
3 years ago
<div class="container panel">
<div class="toolbar">
3 years ago
<div class="times">
3 years ago
<div class="time-item" v-for="(time, index) in times" :key="index" :class="{'active': currentTime === time.date, 'first-hour': time.minute === '00'}">
3 years ago
<span class="hour">{{time.hour}}</span>
3 years ago
<span class="minute" @click="onTimeClick(time)">{{time.minute}}</span>
3 years ago
</div>
</div>
3 years ago
<el-date-picker v-model="date" type="date" placeholder="请选择" :clearable="false" :editable="false" class="date-picker" @change="onDateChange">
3 years ago
</el-date-picker>
<div class="control-btn">
3 years ago
<span @click="onPrevDayClick"><img src="/images/prev.png" /></span>
<span @click="onNextDayClick"><img src="/images/next.png" /></span>
3 years ago
</div>
3 years ago
<el-select v-model="currentHour" placeholder="" @change="onHourChange">
3 years ago
<el-option
v-for="item in hours"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
3 years ago
<p class="unit"></p>
<div class="refresh-btn">
<img src="/images/refresh.png" />
</div>
<div class="btns-group">
<span>播放动画</span>
<span>下载动画</span>
</div>
3 years ago
</div>
3 years ago
<div class="picture-view">
3 years ago
<span class="arrow arrow-prev" @click="onPrevImgClick"><img src="/images/prev-btn.png" /></span>
<span class="arrow arrow-next" @click="onNextImgClick"><img src="/images/next-btn.png" /></span>
3 years ago
<span class="save-btn"><img src="/images/save.png" /></span>
3 years ago
<h2 class="title">{{title}}</h2>
3 years ago
<div class="picture">
<el-image
3 years ago
:src="imgUrl"
:preview-src-list="srcList"
:initial-index="1"
fit="contain"
3 years ago
>
</el-image>
</div>
</div>
3 years ago
</div>
3 years ago
</div>
3 years ago
</template>
<script lang="ts">
3 years ago
import { onMounted, reactive, toRefs } from 'vue';
3 years ago
import moment from "moment";
3 years ago
import { MicrowaveRadiationConfig } from '../hooks/Config';
3 years ago
3 years ago
export default {
name: 'MicrowaveRadiation',
setup() {
3 years ago
let options = reactive({
3 years ago
currentTab: 'kuoxian',
currentRegion: 'jiangning',
currentElement: 'TEMP',
3 years ago
currentCategory: 'CAPE',
3 years ago
date: moment().format('YYYY-MM-DD'),
3 years ago
currentHour: '10',
3 years ago
hours: [],
3 years ago
times: [],
3 years ago
currentTime: null,
3 years ago
imgUrl: null,
srcList: ['/images/picture.png'],
isPlay: false,
title: null,
test: []
3 years ago
})
3 years ago
onMounted(() => {
3 years ago
initHours();
initTimeLine();
activeImage();
setTitle(moment(options.date, 'YYYY-MM-DD').hour(parseInt(options.currentHour)))
3 years ago
})
3 years ago
const onTabClick = (name) => {
options.currentTab = name;
}
3 years ago
const onRegionClick = (region) => {
options.currentRegion = region;
}
3 years ago
const onElementClick = (element) => {
options.currentElement = element;
}
const onCategoryClick = (category) => {
options.currentCategory = category;
3 years ago
}
3 years ago
const setTitle = (date) => {
console.log(date)
options.title = date.format('YYYY.MM.DD HH:mm') + ' ' + options.currentElement;
}
const activeImage = () => {
console.log(MicrowaveRadiationConfig.getUrl("jingning", "kuoxian_TEMP", moment()));
options.imgUrl = MicrowaveRadiationConfig.getUrl(options.currentRegion, options.currentTab + '_' + options.currentElement, moment(options.date).hour(parseInt(options.currentHour)).minute(0));
console.log(options.imgUrl)
}
const initTimeLine = () => {
options.times = [];
options.currentTime = moment(options.date).hour(parseInt(options.currentHour)).format('YYYY-MM-DD HH:mm');
let now = moment(options.date).hour(parseInt(options.currentHour) - 2);
3 years ago
let minute = now.minute();
const remainder = minute % 6;
if (remainder > 0){
now.minute(minute + (6 - remainder));
}
now.minute(now.minute() - 6);
3 years ago
for (let i = 0; i < 21 ; i++) {
3 years ago
options.times.push({
hour: now.add(6, 'minute').format('HH时'),
minute: now.format('mm'),
date: now.format('YYYY-MM-DD HH:mm'),
name: 'hour' + now.format('HH')
});
}
}
3 years ago
const initHours = () => {
for (let i = 0; i < 23; i++) {
options.hours.push({
value: i,
label: i < 10 ? '0' + i : i,
})
}
}
3 years ago
const onTimeClick = (time) => {
options.currentTime = time.date;
3 years ago
setTitle(moment(time.date, 'YYYY-MM-DD HH:mm'));
activeImage();
}
const onPrevDayClick = () => {
options.date = moment(options.date).add(-1, 'day').format('YYYY-MM-DD')
}
const onNextDayClick = () => {
options.date = moment(options.date).add(1, 'day').format('YYYY-MM-DD')
}
const onPrevImgClick = () => {
}
const onNextImgClick = () => {
}
const onHourChange = () => {
initTimeLine();
setTitle(moment(options.date).hour(parseInt(options.currentHour)));
}
const onDateChange = () => {
initTimeLine();
setTitle(moment(options.date).hour(parseInt(options.currentHour)));
3 years ago
}
3 years ago
return {
...toRefs(options),
3 years ago
onTabClick,
onRegionClick,
3 years ago
onElementClick,
3 years ago
onCategoryClick,
3 years ago
onTimeClick,
onPrevDayClick,
onNextDayClick,
onPrevImgClick,
onNextImgClick,
onHourChange,
onDateChange
3 years ago
}
3 years ago
}
}
</script>
<style lang="less" scoped>
</style>
3 years ago