Browse Source

commit some codes

master
xiaowuler 3 years ago
parent
commit
25bb0986ab
  1. 142
      04.系统编码/Frontend/src/components/RamanLidar.vue
  2. 9
      04.系统编码/Frontend/src/router/index.ts
  3. 2
      04.系统编码/Frontend/src/uilts/AxiosStore.ts
  4. 13
      04.系统编码/Frontend/src/uilts/axios.ts

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

@ -60,6 +60,7 @@
<div class="picture-container raman-picture-container" v-show="currentTab === 'boundary-layer-height'">
<div class="picture">
<h2>水汽</h2>
<canvas id='watervapor_single_chart' style="width: 500px;"></canvas>
</div>
</div>
@ -73,6 +74,7 @@
</div>
<div class="picture">
<h2 class="title">消光系数</h2>
<canvas id='extinction_optics_chart' style="width: 500px;"></canvas>
</div>
</div>
@ -83,6 +85,8 @@
</div>
<div class="picture">
<h2 class="title">气溶胶PM</h2>
<canvas id='pm2_5_chart' style="width: 500px;"></canvas>
<canvas id='pm10_chart' style="width: 500px;"></canvas>
</div>
<div class="picture">
@ -93,6 +97,7 @@
<div class="picture-container raman-picture-container" v-show="currentTab === 'BingoCloud'">
<div class="picture">
<h2 class="title">云气溶胶分类</h2>
<canvas id='cloud_sol_chart' style="width: 500px;"></canvas>
</div>
<div class="picture">
<h2 class="title">云层高度</h2>
@ -115,6 +120,7 @@
</div>
<div class="picture">
<h2 class="title">水汽</h2>
<canvas id='watervapor_chart' style="width: 500px;"></canvas>
</div>
</div>
</div>
@ -135,6 +141,7 @@ import {HighChartCreate} from "../model/high-chart-create";
import {CustomeArray} from "../model/custome-array"
import {CoordinateScale, HeatMapDrawer} from "../model/heat-map-drawer";
import { Box, ColorChart } from '../uilts/box-drawer';
import axiosStore from '../uilts/AxiosStore';
export default {
name: 'RamanLidar',
@ -146,14 +153,26 @@ export default {
cloudTopHeight: HighChartCreate
LidarRatio: HighChartCreate,
cloudRecognitionDrawer: HeatMapDrawer,
extinctionDrawer: HeatMapDrawer
extinctionDrawer: HeatMapDrawer,
watervaporDrawer: HeatMapDrawer,
opticsExtinctionDrawer: HeatMapDrawer,
singleWatervaporDrawer: HeatMapDrawer,
cloudSolDrawer: HeatMapDrawer,
pm2Point5Drawer: HeatMapDrawer,
pm10Drawer: HeatMapDrawer
} = {
boundaryLayerHeight: null,
cloudsHeight: null,
cloudTopHeight: null,
LidarRatio: null,
cloudRecognitionDrawer: null,
extinctionDrawer: null
extinctionDrawer: null,
watervaporDrawer: null,
singleWatervaporDrawer: null,
opticsExtinctionDrawer: null,
cloudSolDrawer: null,
pm2Point5Drawer: null,
pm10Drawer: null
}
let options = reactive({
currentTab: 'MWR',
@ -234,10 +253,6 @@ export default {
creates.LidarRatio.init();
}
const initCloudRecognition = () => {
}
const onTabClick = (name) => {
options.currentTab = name;
setTimeout(() => {
@ -247,25 +262,134 @@ export default {
}
const reloadChangeData = () => {
cancelRequest();
if (options.currentTab === 'boundary-layer-height') {
reloadCloudRecognition(101, 'watervapor', drawSingleWatervapor);
} else if (options.currentTab === 'optical-property') {
extinctionApi()
LidarRatioApi()
reloadCloudRecognition(801, 'extinction', drawOpticsExtinction);
} else if (options.currentTab === 'aerosol-product') {
boundaryLayerHeightDate()
reloadCloudRecognition(201, 'pm2_5', drawPm2Point5);
reloadCloudRecognition(201, 'pm10', drawPm10);
// boundaryCharacteristicApi()
//aerosolApi()
} else if (options.currentTab === 'BingoCloud') {
//layerTypeApi()
cloudsHeightApi()
cloudTopHeightApi()
reloadCloudRecognition(801, 'layertype', drawCloudSol);
} else if (options.currentTab === 'MWR') {
//waterVapourApi()
reloadCloudRecognition(801, 'layertype', drawCloudRecognition);
reloadCloudRecognition(801, 'extinction', drawExtinction);
reloadCloudRecognition(1001, 'extinction', drawExtinction);
reloadCloudRecognition(101, 'watervapor', drawWatervapor);
}
}
const cancelRequest = () => {
axiosStore._axiosPromiseCancel.forEach(e=>{
e && e()
});
axiosStore._axiosPromiseCancel = [];
}
const drawPm2Point5 = (result: CustomeArray<any>) => {
if (result.length != 24) return;
if (creates.pm2Point5Drawer != null){
creates.pm2Point5Drawer.close();
}
let matrix = converCloudRecognition(201, result);
creates.pm2Point5Drawer = new HeatMapDrawer(800, 600, matrix, "pm2_5_chart", '米');
creates.pm2Point5Drawer.setAxis(new CoordinateScale([0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24]), new CoordinateScale([0, 1000, 2000, 3000], true, true));
creates.pm2Point5Drawer.setColorChart(preparePmColors());
creates.pm2Point5Drawer.draw();
}
const drawPm10 = (result: CustomeArray<any>) => {
if (result.length != 24) return;
if (creates.pm10Drawer != null){
creates.pm10Drawer.close();
}
let matrix = converCloudRecognition(201, result);
creates.pm10Drawer = new HeatMapDrawer(800, 600, matrix, "pm10_chart", '米');
creates.pm10Drawer.setAxis(new CoordinateScale([0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24]), new CoordinateScale([0, 1000, 2000, 3000], true, true));
creates.pm10Drawer.setColorChart(preparePmColors());
creates.pm10Drawer.draw();
}
const preparePmColors = () => {
return new ColorChart(['#F6EF20','#FEC338', '#C5C22A', '#72CD64', '#31C69F', '#01B8CA', '#259BE8', '#327CFC', '#4853F4', '#422EC1'],
[100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0], true, true
);
}
const drawCloudSol = (result: CustomeArray<any>) => {
if (result.length != 24) return;
if (creates.cloudSolDrawer != null){
creates.cloudSolDrawer.close();
}
let matrix = converCloudRecognition(801, result);
creates.cloudSolDrawer = new HeatMapDrawer(800, 600, matrix, "cloud_sol_chart", '米');
creates.cloudSolDrawer.setAxis(new CoordinateScale([0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24]), new CoordinateScale([0, 2000, 4000, 6000, 8000, 10000, 12000], true, true));
creates.cloudSolDrawer.setColorChart(prepareCloudRecognitionColors());
creates.cloudSolDrawer.draw();
}
const drawOpticsExtinction = (result: CustomeArray<any>) => {
if (result.length != 24) return;
if (creates.opticsExtinctionDrawer != null){
creates.opticsExtinctionDrawer.close();
}
let matrix = converCloudRecognition(801, result);
creates.opticsExtinctionDrawer = new HeatMapDrawer(800, 600, matrix, "extinction_optics_chart", '米');
creates.opticsExtinctionDrawer.setAxis(new CoordinateScale([0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24]), new CoordinateScale([0, 2000, 4000, 6000, 8000, 10000, 12000], true, true));
creates.opticsExtinctionDrawer.setColorChart(prepareExtinctionnColors());
creates.opticsExtinctionDrawer.draw();
}
const drawSingleWatervapor = (result: CustomeArray<any>) => {
if (result.length != 24) return;
if (creates.singleWatervaporDrawer != null){
creates.singleWatervaporDrawer.close();
}
let matrix = converCloudRecognition(101, result);
creates.singleWatervaporDrawer = new HeatMapDrawer(800, 600, matrix, "watervapor_single_chart", '米');
creates.singleWatervaporDrawer.setAxis(new CoordinateScale([0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24]), new CoordinateScale([0, 500, 1000, 1500], true, true));
creates.singleWatervaporDrawer.setColorChart(prepareWatervaporColors());
creates.singleWatervaporDrawer.draw();
}
const drawWatervapor = (result: CustomeArray<any>) => {
if (result.length != 24) return;
if (creates.watervaporDrawer != null){
creates.watervaporDrawer.close();
}
let matrix = converCloudRecognition(101, result);
creates.watervaporDrawer = new HeatMapDrawer(800, 600, matrix, "watervapor_chart", '米');
creates.watervaporDrawer.setAxis(new CoordinateScale([0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24]), new CoordinateScale([0, 500, 1000, 1500], true, true));
creates.watervaporDrawer.setColorChart(prepareWatervaporColors());
creates.watervaporDrawer.draw();
}
const prepareWatervaporColors = () => {
return new ColorChart(['#990000','#CC0000', '#FF0000', '#FF3300', '#FF6600', '#FF9900', '#FFCC00', '#FFFF00', '#CCFF33', '#99FF66',
'#66FF99', '#33FFCC', '#00FFFF', '#00CCFF', '#0099FF', '#0066FF', '#0033FF', '#0000FF', '#0000CC', '#000099'],
[0.02, 0.019, 0.018, 0.017, 0.016, 0.15, 0.014, 0.013, 0.012, 0.011, 0.01, 0.009, 0.008, 0.007, 0.006, 0.005, 0.004, 0.003, 0.002, 0.001, 0], true, true
);
}
const drawExtinction = (result: CustomeArray<any>) => {
@ -283,7 +407,7 @@ export default {
}
const prepareExtinctionnColors = () => {
return new ColorChart(['##990000','#CC0000', '#FF0000', '#FF3300', '#FF6600', '#FF9900', '#FFCC00', '#FFFF00', '#CCFF33', '#99FF66',
return new ColorChart(['#990000','#CC0000', '#FF0000', '#FF3300', '#FF6600', '#FF9900', '#FFCC00', '#FFFF00', '#CCFF33', '#99FF66',
'#66FF99', '#33FFCC', '#00FFFF', '#00CCFF', '#0099FF', '#0066FF', '#0033FF', '#0000FF', '#0000CC', '#000099'],
[10, 8, 6, 4, 2, 1, 0.8, 0.6, 0.4, 0.2, 0.1, 0.08, 0.06, 0.04, 0.02, 0.01, 0.008, 0.006, 0.004, 0.002, 0.001], true, true
);

9
04.系统编码/Frontend/src/router/index.ts

@ -1,4 +1,5 @@
import {createRouter, createWebHashHistory} from 'vue-router';
import axiosStore from '../uilts/AxiosStore';
import {getStaff} from "../uilts/storage";
const routes: any = [
@ -18,6 +19,10 @@ const router = createRouter({
})
router.beforeEach((to,form,next)=>{
if (getStaff('login_staff')){
axiosStore._axiosPromiseCancel.forEach(e=>{
e && e()
});
axiosStore._axiosPromiseCancel = [];
next()
}else {
if (to.path =="/Login"){
@ -29,8 +34,4 @@ router.beforeEach((to,form,next)=>{
})
router.afterEach((to,form,next)=>{
})
export default router;

2
04.系统编码/Frontend/src/uilts/AxiosStore.ts

@ -0,0 +1,2 @@
let axiosStore = {_axiosPromiseCancel: [] };
export default axiosStore;

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

@ -2,9 +2,10 @@ import * as qs from "qs"
import axios from "axios"
import { ElLoading } from 'element-plus'
import { Config } from "./Config";
import axiosStore from "./AxiosStore";
let loading = null;
const CancelToken = axios.CancelToken;
const service = axios.create({
baseURL: Config.url,
timeout: 500000
@ -16,6 +17,10 @@ service.interceptors.request.use(config => {
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0)'
})
// 这个是 取消重点
config.cancelToken = new CancelToken((cancel) => {
axiosStore._axiosPromiseCancel.push(cancel);
});
return config;
}, error => {
Promise.reject(error)
@ -26,7 +31,11 @@ service.interceptors.response.use(response => {
return response.data;
}, error => {
loading.close()
return Promise.reject(error)
if (axios.isCancel(error)) {
return new Promise(() => {});
}else{
return Promise.reject(error);
}
}
)

Loading…
Cancel
Save