update 改进数据初次加载有延时问题

This commit is contained in:
DESKTOP-FUDKNA8\znjsz 2024-01-18 08:44:56 +08:00
parent 1a5749bab2
commit e4637944bb
3 ha cambiato i file con 28 aggiunte e 9 eliminazioni

Vedi File

@ -98,9 +98,9 @@ function updateChartOption(product, scrap) {
chart.value.setOption(options);
}
const productAmount = ref(0);
const scrapAmount = ref(0);
const store = useWsStore();
const productAmount = ref(store.data1.realTimeData?.product || 0);
const scrapAmount = ref(store.data1.realTimeData?.scrap || 0);
store.$subscribe((mutation, state) => {
productAmount.value = state.data1.realTimeData?.product || 0;
scrapAmount.value = state.data1.realTimeData?.scrap || 0;

Vedi File

@ -4,12 +4,22 @@ import { ref } from "vue";
import { useWsStore } from "../store";
const alarmList = ref([]);
const store = useWsStore();
alarmList.value = (store.data1.alarmArrList ?? []).map((item, index) => ({
id: item.id,
eqName: item.equipmentName,
eqIndex: index + 1,
alarmGrade: item.alarmLevel,
alarmDetail: item.alarmDetails,
position: `${item.productLine} - ${item.segment}`,
}));
store.$subscribe((mutation, state) => {
// console.log("====state====\n");
// console.log(state.data1);
// console.log(state.data2);
// console.log(state.data3);
// console.log("====state end====\n");
// console.log("====state====\n");
// console.log(state.data1);
// console.log(state.data2);
// console.log(state.data3);
// console.log("====state end====\n");
alarmList.value = state.data1.alarmArrList.map((item, index) => ({
id: item.id,
eqName: item.equipmentName,

Vedi File

@ -5,9 +5,18 @@ import { useWsStore } from "../store";
const emit = defineEmits(["home"]);
// load
const vertical_content = ref("公告加载中...");
const horizontal_content = ref("公告加载中...");
const store = useWsStore();
const vertical_content = ref(
(store.data3.deliveryNotification || [])
.map((item) => item.deliveryContent || "")
.join("")
.replaceAll(/<br(\s?)\/>/g, "") || "暂无公告"
);
const horizontal_content = ref(
(store.data2.deliveryMsg || [])
.map((item) => item.deliveryContent || "")
.join("\t") || "暂无公告"
);
store.$subscribe((mutation, state) => {
vertical_content.value =
(state.data3.deliveryNotification || [])