| | |
| | | // number.value = ''; |
| | | import request from "@/utils/request" |
| | | const ida = ref(null); |
| | | import { ref, onMounted } from "vue"; |
| | | import { ref, onMounted, onUnmounted } from "vue"; |
| | | // import http from "@/http/index"; |
| | | |
| | | let ruleForm = ref({ |
| | |
| | | // ElMessage.error('获取表格数据失败,请重试'); |
| | | } |
| | | }; |
| | | request.get("/loadGlass/LoadGlass/list").then((res) => { |
| | | onMounted(async () => { |
| | | await fetchTableData(); |
| | | |
| | | // 设置定时器来定期刷新数据 |
| | | const intervalId = setInterval(async () => { |
| | | await fetchTableData(); |
| | | }, 1000); // 每1秒刷新一次 |
| | | |
| | | // 组件卸载时清除定时器 |
| | | onUnmounted(() => { |
| | | clearInterval(intervalId); |
| | | }); |
| | | }); |
| | | onMounted(async () => { |
| | | await fetchTableDataa(); |
| | | |
| | | // 设置定时器来定期刷新数据 |
| | | const intervalId = setInterval(async () => { |
| | | await fetchTableDataa(); |
| | | }, 1000); // 每1秒刷新一次 |
| | | |
| | | // 组件卸载时清除定时器 |
| | | onUnmounted(() => { |
| | | clearInterval(intervalId); |
| | | }); |
| | | }); |
| | | // request.get("/loadGlass/LoadGlass/list").then((res) => { |
| | | // if (res.code === 200) { |
| | | // console.log(res.data); |
| | | // tableDataa.value = res.data; |
| | | |
| | | // if (tableDataa.value.length === 2) { |
| | | // if (tableDataa.value[0].patternWidth > 0) { |
| | | // flake.value = true; |
| | | // } |
| | | |
| | | // if (tableDataa.value[1].patternWidth > 0) { |
| | | // flakea.value = true; |
| | | // } |
| | | // } |
| | | // } else { |
| | | // ElMessage.warning(res.msg); |
| | | // // router.push("/login"); |
| | | // } |
| | | // }); |
| | | async function fetchTableDataa() { |
| | | try { |
| | | const res = await request.get("/loadGlass/LoadGlass/list"); |
| | | if (res.code === 200) { |
| | | console.log(res.data); |
| | | tableDataa.value = res.data; |
| | | |
| | | if (tableDataa.value.length === 2) { |
| | | if (tableDataa.value[0].patternWidth > 0) { |
| | | // 根据数据更新 flake 和 flakea 的值 |
| | | if (res.data.length >= 2) { |
| | | if (res.data[0].patternWidth > 0) { |
| | | flake.value = true; |
| | | } else { |
| | | flake.value = false; |
| | | } |
| | | |
| | | if (tableDataa.value[1].patternWidth > 0) { |
| | | if (res.data[1].patternWidth > 0) { |
| | | flakea.value = true; |
| | | } else { |
| | | flakea.value = false; |
| | | } |
| | | } |
| | | } else { |
| | | ElMessage.warning(res.msg); |
| | | // router.push("/login"); |
| | | } |
| | | }); |
| | | } catch (error) { |
| | | console.error('获取表格数据失败', error); |
| | | // 可以在这里添加额外的错误处理逻辑 |
| | | } |
| | | } |
| | | // request.get("/loadGlass/LoadGlass/list").then((res) => { |
| | | // window.localStorage.setItem('patternWidth', res.data.patternWidth) |
| | | // window.localStorage.setItem('workstationId', res.data.workstationId) |
| | |
| | | } |
| | | } |
| | | onMounted(fetchTableData); |
| | | onMounted(fetchTableDataa); |
| | | function getStatusText(state: number) { |
| | | switch (state) { |
| | | case 0: |