update
This commit is contained in:
parent
53835d046e
commit
917ad2433f
6
src/http/config/index.ts
Normal file
6
src/http/config/index.ts
Normal file
@ -0,0 +1,6 @@
|
||||
import {get,post} from "@/utils/http"
|
||||
|
||||
// 根据参数键名查询参数值
|
||||
export function getConfigKey(configKey) {
|
||||
return get('/system/config/configKey/' + configKey)
|
||||
}
|
@ -53,7 +53,15 @@ export const Offsite = defineStore(Names.offsite, {
|
||||
offsitegatewayStatus: [],
|
||||
devtype: [],
|
||||
devlist: [],
|
||||
EquipmentStatusDiagram:[]
|
||||
EquipmentStatusDiagram: [],
|
||||
limit: {
|
||||
temp_bottom: -11,
|
||||
temp_top: 45,
|
||||
humidity_bottom: 15,
|
||||
humidity_top: 75,
|
||||
dust10: 150,
|
||||
dust25: 75,
|
||||
}
|
||||
};
|
||||
},
|
||||
//computed 修改一些值
|
||||
|
@ -15,7 +15,10 @@
|
||||
<script setup lang="ts">
|
||||
import { EDataPerson, EDataPersonItem } from "@/type/generalEnvironment";
|
||||
import { getCurrentInstance, markRaw, onMounted, reactive, ref, watch } from "vue";
|
||||
import { Offsite } from "@/store/module/offsite";
|
||||
const { proxy } = getCurrentInstance() as any;
|
||||
|
||||
let store = Offsite();
|
||||
let props = defineProps<{
|
||||
name: String;
|
||||
title: any;
|
||||
@ -29,6 +32,19 @@ const echartsData = reactive<EDataPerson>({
|
||||
box: null,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
function calculateRatio(min, max, limit) {
|
||||
if (max === min) {
|
||||
return 0; // 处理max等于min的情况,返回0
|
||||
}
|
||||
let ratio = (limit - min) / (max - min);
|
||||
ratio = Math.max(0, Math.min(1, ratio)); // 限制比例在0到1之间
|
||||
ratio = Math.round(ratio * 100) / 100; // 四舍五入到两位小数
|
||||
return ratio;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @函数功能:
|
||||
* @param {*} value 需要设置的数据
|
||||
@ -80,8 +96,8 @@ const setData = (value: any) => {
|
||||
lineStyle: {
|
||||
width: 5,
|
||||
color: [
|
||||
[0.15, '#FF6E76'],
|
||||
[0.75, '#7CFFB2'],
|
||||
[calculateRatio(-30,70,store.limit.temp_bottom), '#FF6E76'],
|
||||
[calculateRatio(-30,70,store.limit.temp_top), '#7CFFB2'],
|
||||
[1, '#FF6E76']
|
||||
]
|
||||
}
|
||||
@ -155,8 +171,8 @@ const setData = (value: any) => {
|
||||
lineStyle: {
|
||||
width: 10,
|
||||
color: [
|
||||
[0.15, '#FF6E76'],
|
||||
[0.75, '#7CFFB2'],
|
||||
[calculateRatio(0,100,store.limit.humidity_bottom), '#FF6E76'],
|
||||
[calculateRatio(0,100,store.limit.humidity_top), '#7CFFB2'],
|
||||
[1, '#FF6E76']
|
||||
]
|
||||
}
|
||||
|
@ -14,13 +14,28 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { EDataPerson, EDataPersonItem } from "@/type/generalEnvironment";
|
||||
import { Offsite } from "@/store/module/offsite";
|
||||
import { getCurrentInstance, markRaw, onMounted, reactive, ref, watch } from "vue";
|
||||
const { proxy } = getCurrentInstance() as any;
|
||||
let store = Offsite();
|
||||
let props = defineProps<{
|
||||
name: String;
|
||||
title: any;
|
||||
}>();
|
||||
let humiture = ref();
|
||||
|
||||
|
||||
|
||||
function calculateRatio(min, max, limit) {
|
||||
if (max === min) {
|
||||
return 0; // 处理max等于min的情况,返回0
|
||||
}
|
||||
let ratio = (limit - min) / (max - min);
|
||||
ratio = Math.max(0, Math.min(1, ratio)); // 限制比例在0到1之间
|
||||
ratio = Math.round(ratio * 100) / 100; // 四舍五入到两位小数
|
||||
return ratio;
|
||||
}
|
||||
|
||||
const echartsData = reactive<EDataPerson>({
|
||||
humiture: {
|
||||
div: null,
|
||||
@ -37,6 +52,9 @@ const echartsData = reactive<EDataPerson>({
|
||||
* @函数备注:
|
||||
*/
|
||||
const setData = (value: any) => {
|
||||
|
||||
let pmmax = props.title=="PM10"?200:100;
|
||||
let pmratemax = props.title=="PM10"?store.limit.dust10:store.limit.dust25;
|
||||
echartsData.humiture!.div = humiture.value;
|
||||
echartsData.humiture!.title = props.title;
|
||||
echartsData.humiture!.data = {
|
||||
@ -70,7 +88,7 @@ const setData = (value: any) => {
|
||||
width: 10,
|
||||
color: [
|
||||
[0.35, "#7CFFB2"],
|
||||
[0.75, "#FDDD60"],
|
||||
[calculateRatio(0,pmmax,pmratemax), "#FDDD60"],
|
||||
[1, "#FF6E76"],
|
||||
],
|
||||
},
|
||||
|
@ -64,6 +64,7 @@ import { calcWH } from "@/components/ts/selfAdaption";
|
||||
import { connectWebsocket, closeWebsocket } from "@/utils/websocket";
|
||||
import { Offsite } from "@/store/module/offsite";
|
||||
import { getSensorByDept } from "@/http/PaintShopView/index";
|
||||
import { getConfigKey } from "@/http/config/index";
|
||||
import bottom from "./bottom.vue";
|
||||
import right from "./right.vue";
|
||||
import top from "./top.vue";
|
||||
@ -110,6 +111,32 @@ async function getSensorByDeptfun() {
|
||||
rightref.value.setcontentData(result.data);
|
||||
}
|
||||
}
|
||||
|
||||
function getConfigKeyFun() {
|
||||
let axios_arr = [
|
||||
getConfigKey("temp_bottom"),
|
||||
getConfigKey("temp_top"),
|
||||
getConfigKey("humidity_bottom"),
|
||||
getConfigKey("humidity_top"),
|
||||
getConfigKey("dust10"),
|
||||
getConfigKey("dust25"),
|
||||
]
|
||||
|
||||
Promise.all(axios_arr).then((res:any) => {
|
||||
let limit = {
|
||||
temp_bottom: res[0].msg,
|
||||
temp_top: res[1].msg,
|
||||
humidity_bottom: res[2].msg,
|
||||
humidity_top: res[3].msg,
|
||||
dust10: res[4].msg,
|
||||
dust25: res[5].msg,
|
||||
}
|
||||
store.limit = limit;
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function getWebsocket(val) {
|
||||
// headerref.value.HeadergetWebsocket(val)
|
||||
try {
|
||||
@ -147,6 +174,7 @@ onMounted(() => {
|
||||
WH(contentBox);
|
||||
}, 1000);
|
||||
});
|
||||
getConfigKeyFun();
|
||||
getSensorByDeptfun();
|
||||
connectWebsocket(null, null, getWebsocket, errWebsocket);
|
||||
});
|
||||
|
@ -50,7 +50,6 @@
|
||||
import border6 from "@/components/borderBox/border6.vue";
|
||||
import border3 from "@/components/borderBox/border3.vue";
|
||||
import pm from "./chart/pm.vue";
|
||||
import power from "./chart/power2023.vue";
|
||||
import chart from "@/components/assembly/chart2.vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { useEnergyConsumeStore } from "@/store/module/energyConsume";
|
||||
|
Loading…
Reference in New Issue
Block a user