浏览代码

fix:登录成功展示登录名称
fix:数据大屏五分钟获取一次数据

liziliang 2 月之前
父节点
当前提交
62777eab96

+ 1 - 2
src/store/modules/user.ts

@@ -53,8 +53,7 @@ export const useUserStore = defineStore("user", () => {
             return;
           }
           user.value.userId = data.id;
-          user.value.username = data.username;
-
+          user.value.username = data.userName;
           user.value.avatar = data.avatar ?? "";
           isGetAuth.value = true;
 

+ 9 - 3
src/views/screens/screen-components/BanZuChuQinTongJi.vue

@@ -22,8 +22,8 @@ const props = defineProps({
   },
 });
 const bigScreenData: any = inject("bigScreenData");
-onMounted(async () => {
-  let res = await teamAttendance();
+const loadData = async () => {
+  let res = await teamAttendance()
   if (res.data.length > 0) {
     let dicts = {
       deptName: `<span style='font-size:${bigScreenData.value.fontSize * 1.5}px'>班组名称</span>`,
@@ -57,7 +57,13 @@ onMounted(async () => {
       },
     };
   }
-});
+}
+onMounted(() => {
+  loadData()
+  const timer = setInterval(loadData, 60 * 5 * 1000) // 60秒 = 60000毫秒
+  // 组件卸载时清除定时器
+  onUnmounted(() => clearInterval(timer))
+})
 
 const tableHover = (data: any) => {
   // console.log("mouseover", data.row[data.columnIndex]);

+ 9 - 3
src/views/screens/screen-components/ChengPinRuKuQingKuang.vue

@@ -21,9 +21,8 @@ const props = defineProps({
     required: true,
   },
 });
-const bigScreenData: any = inject("bigScreenData");
-onMounted(async () => {
-  let res = await productStorageFinishedSituation();
+const loadData = async () => {
+  let res = await productStorageFinishedSituation()
   if (res.data.length > 0) {
     let dicts = {
       workOrderCode: `<span style='font-size:${bigScreenData.value.fontSize * 1.5}px'>批号</span>`,
@@ -55,6 +54,13 @@ onMounted(async () => {
       },
     };
   }
+}
+const bigScreenData: any = inject("bigScreenData");
+onMounted(async () => {
+  loadData()
+  const timer = setInterval(loadData, 60 * 5 * 1000) // 60秒 = 60000毫秒
+  // 组件卸载时清除定时器
+  onUnmounted(() => clearInterval(timer))
 });
 
 const tableHover = (data: any) => {

+ 8 - 1
src/views/screens/screen-components/ProductionSituation.vue

@@ -13,7 +13,7 @@ import { allChartColors } from "@/views/screens/configs/chartsConfig";
 const bigScreenData: any = inject("bigScreenData");
 const chartRef = ref(null);
 
-onMounted(async () => {
+const loadData = async () => {
   const chart = echarts.init(chartRef.value, "dark");
   let res: any = await stationProduction();
 
@@ -54,6 +54,13 @@ onMounted(async () => {
     ],
   };
   chart.setOption(option);
+}
+
+onMounted(async () => {
+  loadData();
+  const timer = setInterval(loadData, 60 * 5 * 1000);
+  // 组件卸载时清除定时器
+  onUnmounted(() => clearInterval(timer));
 });
 
 const props = defineProps({

+ 8 - 2
src/views/screens/screen-components/ShengChanJiHuaQingKuang.vue

@@ -22,8 +22,7 @@ const props = defineProps({
     required: true,
   },
 });
-
-onMounted(async () => {
+const loadData = async () => {
   let res = await productionPlan();
   if (res.data.length > 0) {
     let dicts = {
@@ -63,6 +62,13 @@ onMounted(async () => {
       carousel: "page",
     };
   }
+}
+
+onMounted(async () => {
+  loadData();
+  const timer = setInterval(loadData, 60 * 5 * 1000)
+  // 组件卸载时清除定时器
+  onUnmounted(() => clearInterval(timer));
 });
 </script>
 

+ 7 - 1
src/views/screens/screen-components/WeiDianZiCheJianGongGao.vue

@@ -47,13 +47,19 @@ const bsFS = bigScreenData.value.fontSize * 2;
 const bsFSLH = bigScreenData.value.fontSize * 2 + 5 + "px";
 
 const taskRateArray = ref<any[]>([]);
-onMounted(async () => {
+const loadData = async () => {
   let res = await microelectronicWorkshopNotice();
   taskRateArray.value = res.data;
 
   nextTick(() => {
     ShowScrollRef1.value.setActive(3);
   });
+};
+onMounted(async () => {
+  loadData()
+  const timer = setInterval(loadData, 60 * 5 * 1000) // 60秒 = 60000毫秒
+  // 组件卸载时清除定时器
+  onUnmounted(() => clearInterval(timer))
 });
 
 const tableHover = (data: any) => {

+ 8 - 1
src/views/screens/screen-components/XiaFaGongDanJinDu.vue

@@ -33,7 +33,7 @@ const progressOption = ref({
   comNum: 0,
 });
 
-onMounted(async () => {
+const loadData = async () => {
   let res: any = await productionQuantity();
   let { data } = res;
 
@@ -43,6 +43,13 @@ onMounted(async () => {
     orderNum: Number(data.orderNum),
     comNum: Number(data.completeNum),
   };
+}
+
+onMounted(async () => {
+  loadData();
+  const timer = setInterval(loadData, 60 * 5 * 1000) // 60秒 = 60000毫秒
+  // 组件卸载时清除定时器
+  onUnmounted(() => clearInterval(timer))
 });
 
 const props = defineProps({