From f39fd71eedfd828e715d33356a8c38ffbe66eb1a Mon Sep 17 00:00:00 2001 From: wuyouming666 <2265557248@qq.com> Date: 星期五, 24 五月 2024 15:28:09 +0800 Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/HangZhouMes --- UI-Project/src/views/Returns/returns.vue | 126 ++++++++++++++++++++++++++++++++--------- 1 files changed, 97 insertions(+), 29 deletions(-) diff --git a/UI-Project/src/views/Returns/returns.vue b/UI-Project/src/views/Returns/returns.vue index 84188cb..eddab30 100644 --- a/UI-Project/src/views/Returns/returns.vue +++ b/UI-Project/src/views/Returns/returns.vue @@ -14,11 +14,19 @@ const adda = ref(false) const flake = ref(false) const flakea = ref(false) -const state = reactive({updateKey: 0}) -// const value = ref('') +// const patternHeight = ref(''); +// const patternWidth = ref(''); +// const filmsId = ref(''); +// const patternThickness = ref(''); +// const number = ref(''); +// patternHeight.value = ''; + // patternWidth.value = ''; + // filmsId.value = ''; + // patternThickness.value = ''; + // 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({ @@ -58,28 +66,82 @@ } } catch (error) { // 澶勭悊璇锋眰澶辫触鐨勬儏鍐� - ElMessage.error('鑾峰彇琛ㄦ牸鏁版嵁澶辫触锛岃閲嶈瘯'); + // ElMessage.error('鑾峰彇琛ㄦ牸鏁版嵁澶辫触锛岃閲嶈瘯'); } }; - request.get("/loadGlass/LoadGlass/list").then((res) => { - if (res.code === 200) { - console.log(res.data); - tableDataa.value = res.data; +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.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"); - } - }); + // 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) { + tableDataa.value = res.data; + + // 鏍规嵁鏁版嵁鏇存柊 flake 鍜� flakea 鐨勫�� + if (res.data.length >= 2) { + if (res.data[0].patternWidth > 0) { + flake.value = true; + } else { + flake.value = false; + } + + if (res.data[1].patternWidth > 0) { + flakea.value = true; + } else { + flakea.value = false; + } + } + } else { + ElMessage.warning(res.msg); + } + } 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) @@ -248,6 +310,11 @@ // window.location.reload() add.value = false; tableDataa.value = response.data; + // patternHeight = ''; + // patternWidth.value = ''; + // filmsId.value = ''; + // patternThickness.value = ''; + // number.value = ''; window.localStorage.setItem('workstationId', response.data.workstationId) let workstationId = window.localStorage.getItem('workstationId') if (workstationId == '1') { @@ -351,6 +418,7 @@ ElMessage.success(response.message); // window.location.reload() dialogFormVisible.value = false; + selectedProjectNo.value = '' } else { // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭� ElMessage.error(response.msg); @@ -374,7 +442,7 @@ // window.location.reload() blind.value = false; tableData.splice(0, tableData.length, ...response.data); - + selectedProjectNoa.value = '' } else { // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭� ElMessage.error(response.msg); @@ -400,10 +468,9 @@ ElMessage.success(response.message); // window.location.reload() blinda.value = false; + // tableData.value = response.data + // tableData.value = []; tableData.splice([]); - console.log(response) - console.log(tableData) - // state.updateKey ++ } else { // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭� ElMessage.error(response.msg); @@ -436,7 +503,7 @@ ElMessage.success(response.message); // window.location.reload() blindb.value = false; - state.updateKey ++ + tableData.splice([]); // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭� ElMessage.error(response.msg); @@ -455,6 +522,7 @@ } } onMounted(fetchTableData); +onMounted(fetchTableDataa); function getStatusText(state: number) { switch (state) { case 0: @@ -578,7 +646,7 @@ <el-button style="margin-top: 5px;margin-left: 20px;" id="searchButton" type="danger" @click="handleBindb">鍋滄浠诲姟</el-button> <el-card style="flex: 1;margin-left: 10px;margin-top: 15px;" v-loading="loading"> - <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;" :key="state.updateKey"> + <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;"> <el-table height="150" ref="table" @@ -679,7 +747,7 @@ :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}" > <el-table-column prop="patternWidth" align="center" label="瀹�" min-width="80" /> - <el-table-column prop="patternHeight" align="center" label="闀�" min-width="80" /> + <el-table-column prop="patternHeight" align="center" label="楂�" min-width="80" /> <el-table-column prop="filmsId" align="center" label="鑶滅郴" min-width="80" /> <el-table-column prop="number" align="center" label="鏁伴噺" min-width="80" /> <el-table-column fixed="right" label="鎿嶄綔" align="center" width="150"> @@ -699,7 +767,7 @@ <el-col :span="6"> <div id="dt" style="font-size: 15px;"> <div> - <el-form-item label="闀匡細" :required="true" style="width: 14vw"> + <el-form-item label="楂橈細" :required="true" style="width: 14vw"> <el-input v-model="patternHeight" autocomplete="off" /> </el-form-item></div></div> </el-col> -- Gitblit v1.8.0