Browse Source

commit

master
hehongxing 3 years ago
parent
commit
c40704af24
  1. 2
      04.系统编码/Backend/src/main/java/com/userinformation/backend/service/ImageService.java
  2. 40
      04.系统编码/Frontend/src/components/DecisionSupport.vue
  3. 26
      04.系统编码/Frontend/src/components/MicrowaveRadiation.vue
  4. 55
      04.系统编码/Frontend/src/components/RamanLidar.vue
  5. 39
      04.系统编码/Frontend/src/components/SynergyEvaluation.vue
  6. 4
      04.系统编码/Frontend/src/uilts/axios.ts

2
04.系统编码/Backend/src/main/java/com/userinformation/backend/service/ImageService.java

@ -66,7 +66,7 @@ public class ImageService {
e.setRepeat(0); e.setRepeat(0);
e.start(targetPath); e.start(targetPath);
for(File file : files){ for(File file : files){
e.setDelay(500); e.setDelay(1000);
BufferedImage bufferedImage = ImageIO.read(file); BufferedImage bufferedImage = ImageIO.read(file);
e.addFrame(bufferedImage); e.addFrame(bufferedImage);
} }

40
04.系统编码/Frontend/src/components/DecisionSupport.vue

@ -19,7 +19,10 @@
</div> </div>
</div> </div>
<div class="container panel decision-container"> <div class="container panel decision-container">
<span class="save-btn"><img src="/images/save.png" /></span> <span class="save-btn" @click="onSaveClick"><img src="/images/save.png" /></span>
<div class="download-pictures" id="pictures">
<a v-for="(url, index) in urls" :key="index" download></a>
</div>
<div class="picture-view advice-picture-view" v-if="currentIndicator === 'plan-advice'"> <div class="picture-view advice-picture-view" v-if="currentIndicator === 'plan-advice'">
<el-row :gutter="0"> <el-row :gutter="0">
@ -115,7 +118,8 @@ import { post } from '../uilts/axios';
preview: [] preview: []
}], }],
indicatorImg: '/product/picture/images/decision-support/pollution-indicator/pollution-indicator.png', indicatorImg: '/product/picture/images/decision-support/pollution-indicator/pollution-indicator.png',
indicatorPreview: ['/product/picture/images/decision-support/pollution-indicator/pollution-indicator.png'] indicatorPreview: ['/product/picture/images/decision-support/pollution-indicator/pollution-indicator.png'],
urls: []
}) })
onMounted(() => { onMounted(() => {
@ -138,6 +142,8 @@ import { post } from '../uilts/axios';
for(let index = 0; index < 6; index ++){ for(let index = 0; index < 6; index ++){
initImage(type, options.items[index].imgName, index); initImage(type, options.items[index].imgName, index);
} }
options.urls = options.items;
} }
const initImage = (type, imgName, index) => { const initImage = (type, imgName, index) => {
@ -152,10 +158,38 @@ import { post } from '../uilts/axios';
}) })
} }
const onSaveClick = () => {
let pictures = document.getElementById('pictures');
for (let i = 0; i < options.urls.length; i++) {
let img = new Image();
img.src = options.urls[i].imgUrl;
let canvas = document.createElement("canvas") as HTMLCanvasElement;
canvas.width = img.width;
canvas.height = img.height;
let ctx = canvas.getContext("2d");
let base64 = '';
img.setAttribute("crossOrigin",'Anonymous');
img.onload = function() {
ctx.drawImage(img, 0, 0);
base64 = canvas.toDataURL("image/png");
pictures.children[i].setAttribute('href', base64);
let button: HTMLElement = pictures.children[i] as HTMLElement;
setTimeout(() => {
button.click();
}, 500);
};
}
}
return { return {
...toRefs(options), ...toRefs(options),
onIndicatorClick, onIndicatorClick,
onProductClick onProductClick,
onSaveClick
} }
} }
} }

26
04.系统编码/Frontend/src/components/MicrowaveRadiation.vue

@ -68,8 +68,8 @@
</div> </div>
<div class="btns-group"> <div class="btns-group">
<span @click="onPlayClick">{{isPlay ? '暂停动画' : '播放动画'}}</span> <span @click="onPlayClick">{{isPlay ? '暂停动画' : '播放动画'}}</span>
<a @click="onDownloadClick">下载动画</a> <!-- :href=""--> <a @click="onDownloadClick">下载动画</a>
<a id="weboDownload" download :href='downloadSrc' style="display: none;">下载隐藏层</a> <a id="weboDownload" download :href="downloadSrc" style="display: none;">下载隐藏层</a>
</div> </div>
</div> </div>
<div class="picture-view"> <div class="picture-view">
@ -119,7 +119,7 @@ import { post } from '../uilts/axios';
currentType: 'TEMP', currentType: 'TEMP',
currentElement: 'TEMPERATURE', currentElement: 'TEMPERATURE',
currentCategory: 'CAPE', currentCategory: 'CAPE',
date: moment('2020-07-01').format('YYYY-MM-DD'), date: moment('2021-11-01').format('YYYY-MM-DD'),
currentHour: '10', currentHour: '10',
hours: [], hours: [],
times: [], times: [],
@ -215,6 +215,7 @@ import { post } from '../uilts/axios';
let reader = new FileReader(); let reader = new FileReader();
reader.onloadend = function(){ reader.onloadend = function(){
options.downloadSrc = reader.result; options.downloadSrc = reader.result;
setTimeout(() => { setTimeout(() => {
document.getElementById("weboDownload").click(); document.getElementById("weboDownload").click();
options.downloadSrc = null; options.downloadSrc = null;
@ -229,7 +230,7 @@ import { post } from '../uilts/axios';
return { return {
model: 'weibo', model: 'weibo',
station: options.currentRegion, station: options.currentRegion,
elementCode: options.currentElement, elementCode: options.currentType,
type: options.currentTab, type: options.currentTab,
time: moment(options.times[0].date).format("YYYYMMDDHHmmss") + '-' + moment(options.times[options.times.length - 1].date).format("YYYYMMDDHHmmss"), time: moment(options.times[0].date).format("YYYYMMDDHHmmss") + '-' + moment(options.times[options.times.length - 1].date).format("YYYYMMDDHHmmss"),
urls: prepareUrls() urls: prepareUrls()
@ -238,9 +239,8 @@ import { post } from '../uilts/axios';
const prepareUrls = () => { const prepareUrls = () => {
let urls = []; let urls = [];
for(let index = 0, len = options.hours.length; index < len; index++){ for(let index = 0, len = options.times.length; index < len; index++){
let date = moment(options.times[options.index].date); let time = moment(options.times[index].date);
let time = moment(options.date).hour(date.hour()).minute(date.minute());
let type = (options.currentTab === 'T-logP' || options.currentTab === 'BPFY') ? options.currentTab : (options.currentTab + '_' + options.currentType); let type = (options.currentTab === 'T-logP' || options.currentTab === 'BPFY') ? options.currentTab : (options.currentTab + '_' + options.currentType);
urls.push(MicrowaveRadiationConfig.getUrl(options.currentRegion, type, time)); urls.push(MicrowaveRadiationConfig.getUrl(options.currentRegion, type, time));
} }
@ -322,7 +322,6 @@ import { post } from '../uilts/axios';
} }
const onPrevImgClick = () => { const onPrevImgClick = () => {
console.log(options.index);
let element = getCurrentElement(); let element = getCurrentElement();
options.index--; options.index--;
@ -344,8 +343,15 @@ import { post } from '../uilts/axios';
const onRefreshClick = () => { const onRefreshClick = () => {
cancelActive(); cancelActive();
options.date = moment('2020-07-01').format('YYYY-MM-DD'); let element = getCurrentElement();;
options.currentHour = '10'; options.currentHour = '10';
options.date = moment('2021-11-01').format('YYYY-MM-DD');
options.currentTime = moment(options.date).hour(parseInt(options.currentHour)).format('YYYY-MM-DD HH:mm');
setTitle(moment(options.currentTime, 'YYYY-MM-DD HH:mm'));
activeImage(moment(options.currentTime).hour(), moment(options.currentTime).minute());
element.children[options.times.length - 1].classList.add('active');
} }
const onPlayClick = () => { const onPlayClick = () => {
@ -360,7 +366,7 @@ import { post } from '../uilts/axios';
const timeExcute = () => { const timeExcute = () => {
clearTimer(); clearTimer();
let element = getCurrentElement();; let element = getCurrentElement();
timer = setInterval( () => { timer = setInterval( () => {
options.index++; options.index++;

55
04.系统编码/Frontend/src/components/RamanLidar.vue

@ -49,7 +49,8 @@
</div> </div>
<div class="btns-group"> <div class="btns-group">
<span @click="onPlayClick">{{isPlay ? '暂停动画' : '播放动画'}}</span> <span @click="onPlayClick">{{isPlay ? '暂停动画' : '播放动画'}}</span>
<a @click="onDownloadClick">下载动画</a> <!-- :href=""--> <a @click="onDownloadClick">下载动画</a>
<a id="radarDownload" :href="downloadSrc" download style="display: none;">下载隐藏层</a>
</div> </div>
</div> </div>
<div class="picture-view"> <div class="picture-view">
@ -87,6 +88,7 @@
import { onMounted, reactive, toRefs } from 'vue'; import { onMounted, reactive, toRefs } from 'vue';
import moment from "moment"; import moment from "moment";
import { RamanLidarConfig } from '../uilts/Config'; import { RamanLidarConfig } from '../uilts/Config';
import { post } from '../uilts/axios';
export default { export default {
name: 'RamanLidar', name: 'RamanLidar',
@ -96,7 +98,7 @@
currentRegion: 'jiangning', currentRegion: 'jiangning',
currentElement: 'lidar-ratio', currentElement: 'lidar-ratio',
currentType: '激光雷达比', currentType: '激光雷达比',
date: moment('2020-07-01').format('YYYY-MM-DD'), date: moment('2021-11-01').format('YYYY-MM-DD'),
currentHour: '10', currentHour: '10',
hours: [], hours: [],
times: [], times: [],
@ -106,7 +108,8 @@
srcList: [], srcList: [],
isPlay: false, isPlay: false,
title: null, title: null,
index: 0 index: 0,
downloadSrc: null
}) })
onMounted(() => { onMounted(() => {
@ -153,9 +156,48 @@
} }
const onDownloadClick = () => { const onDownloadClick = () => {
let params = { post("/image/createGif", prepareParams(), 'application/json').then((response: any) => {
station: options.currentRegion if (response.error != 0){
console.log(response.message);
return;
} }
fetch(response.data).then(res => {
return res.blob();
}).then(blob => {
let reader = new FileReader();
reader.onloadend = function(){
options.downloadSrc = reader.result;
setTimeout(() => {
document.getElementById("radarDownload").click();
options.downloadSrc = null;
}, 500);
};
reader.readAsDataURL(blob);
}).catch(console.error);
})
}
const prepareParams = () => {
return {
model: 'radar',
station: options.currentRegion,
elementCode: options.currentElement,
type: null,
time: moment(options.times[0].date).format("YYYYMMDDHHmmss") + '-' + moment(options.times[options.times.length - 1].date).format("YYYYMMDDHHmmss"),
urls: prepareUrls()
}
}
const prepareUrls = () => {
let urls = [];
for(let index = 0, len = options.times.length; index < len; index++){
let time = moment(options.times[index].date);
urls.push(RamanLidarConfig.getUrl(options.currentRegion, options.currentElement, time));
}
return urls;
} }
const converToBase64 = (path) => { const converToBase64 = (path) => {
@ -254,7 +296,8 @@
const onRefreshClick = () => { const onRefreshClick = () => {
cancelActive(); cancelActive();
options.date = moment('2020-07-01').format('YYYY-MM-DD'); options.date = moment('2021-11-01').format('YYYY-MM-DD');
options.currentTime = options.times[options.times.length - 1];
options.currentHour = '10'; options.currentHour = '10';
} }

39
04.系统编码/Frontend/src/components/SynergyEvaluation.vue

@ -50,7 +50,10 @@
</div> </div>
</div> </div>
<div class="container panel synergy-container"> <div class="container panel synergy-container">
<span class="save-btn" ><img src="/images/save.png" /></span> <span class="save-btn" @click="onSaveClick"><img src="/images/save.png" /></span>
<div class="download-pictures" id="pictures">
<a v-for="(url, index) in urls" :key="index" download></a>
</div>
<div class="element-select" v-if="currentTab === 'element-change-trend' || currentTab === 'element-monitor'"> <div class="element-select" v-if="currentTab === 'element-change-trend' || currentTab === 'element-monitor'">
<div class="surface-temperature" v-if="currentTab === 'element-change-trend'"> <div class="surface-temperature" v-if="currentTab === 'element-change-trend'">
<span @click="onSurfaceTemperatureClick('time0130')" :class="{'active': currentSurfaceTemperatureTime === 'time0130'}">地表温度01:30</span> <span @click="onSurfaceTemperatureClick('time0130')" :class="{'active': currentSurfaceTemperatureTime === 'time0130'}">地表温度01:30</span>
@ -231,7 +234,8 @@ import { post } from '../uilts/axios';
type: 'month_12', type: 'month_12',
imgUrl: '/images/default-picture.png', imgUrl: '/images/default-picture.png',
preview: [] preview: []
}] }],
urls: []
}) })
onMounted(() => { onMounted(() => {
@ -242,6 +246,7 @@ import { post } from '../uilts/axios';
for(let index = 0; index < number; index ++){ for(let index = 0; index < number; index ++){
initImage(options.currentTab, element, values[index].type, index, values); initImage(options.currentTab, element, values[index].type, index, values);
} }
options.urls = values;
} }
const initImage = (tabName, elementName, type, index, values) => { const initImage = (tabName, elementName, type, index, values) => {
@ -253,7 +258,7 @@ import { post } from '../uilts/axios';
values[index].imgUrl = response.data; values[index].imgUrl = response.data;
values[index].preview = [response.data]; values[index].preview = [response.data];
}) });
} }
const onTabClick = (name) => { const onTabClick = (name) => {
@ -294,6 +299,33 @@ import { post } from '../uilts/axios';
setImage(12, options.trendItems, options.currentCategory + '/' + options.currentTime + '/' + options.currentYear); setImage(12, options.trendItems, options.currentCategory + '/' + options.currentTime + '/' + options.currentYear);
} }
const onSaveClick = () => {
let pictures = document.getElementById('pictures');
for (let i = 0; i < options.urls.length; i++) {
let img = new Image();
img.src = options.urls[i].imgUrl;
let canvas = document.createElement("canvas") as HTMLCanvasElement;
canvas.width = img.width;
canvas.height = img.height;
let ctx = canvas.getContext("2d");
let base64 = '';
img.setAttribute("crossOrigin",'Anonymous');
img.onload = function() {
ctx.drawImage(img, 0, 0);
base64 = canvas.toDataURL("image/png");
pictures.children[i].setAttribute('href', base64);
let button: HTMLElement = pictures.children[i] as HTMLElement;
setTimeout(() => {
button.click();
}, 500);
};
}
}
return { return {
...toRefs(options), ...toRefs(options),
onTabClick, onTabClick,
@ -302,6 +334,7 @@ import { post } from '../uilts/axios';
onSurfaceTemperatureClick, onSurfaceTemperatureClick,
onYearClick, onYearClick,
onTimeClick, onTimeClick,
onSaveClick
} }
} }
} }

4
04.系统编码/Frontend/src/uilts/axios.ts

@ -5,8 +5,8 @@ import { ElLoading } from 'element-plus'
let loading = null; let loading = null;
const service = axios.create({ const service = axios.create({
// baseURL:"http://112.124.40.88:8002", baseURL:"http://112.124.40.88:8002",
baseURL: "http://localhost:8002", // baseURL: "http://localhost:8002",
// baseURL: "", // baseURL: "",
timeout: 500000 timeout: 500000
}) })

Loading…
Cancel
Save