From 05beaea41133a9e1bfd544a2a5d5f727bb930468 Mon Sep 17 00:00:00 2001 From: ZengTao <2773468879@qq.com> Date: 星期二, 28 五月 2024 10:18:04 +0800 Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/HangZhouMes --- UI-Project/src/views/Returns/returns.vue | 172 +++++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 111 insertions(+), 61 deletions(-) diff --git a/UI-Project/src/views/Returns/returns.vue b/UI-Project/src/views/Returns/returns.vue index c917ca0..eddab30 100644 --- a/UI-Project/src/views/Returns/returns.vue +++ b/UI-Project/src/views/Returns/returns.vue @@ -14,10 +14,19 @@ const adda = ref(false) const flake = ref(false) const flakea = ref(false) -// 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({ @@ -57,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) @@ -244,8 +307,14 @@ if (response.code == 200) { // 缁戝畾鎴愬姛锛屽鐞嗛�昏緫 ElMessage.success(response.message); - window.location.reload() + // 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') { @@ -277,8 +346,9 @@ if (response.code == 200) { // 缁戝畾鎴愬姛锛屽鐞嗛�昏緫 ElMessage.success(response.message); - window.location.reload() + // window.location.reload() add.value = false; + tableDataa.value = response.data; window.localStorage.setItem('workstationId', response.data.workstationId) let workstationId = window.localStorage.getItem('workstationId') if (workstationId == '1') { @@ -320,6 +390,7 @@ // 缁戝畾鎴愬姛锛屽鐞嗛�昏緫 ElMessage.success(response.message); adda.value = false; + tableDataa.value = response.data; window.localStorage.setItem('workstationId', response.data.workstationId) let workstationId = window.localStorage.getItem('workstationId') if (workstationId == '1') { @@ -345,8 +416,9 @@ if (response.code == 200) { // 缁戝畾鎴愬姛锛屽鐞嗛�昏緫 ElMessage.success(response.message); - window.location.reload() + // window.location.reload() dialogFormVisible.value = false; + selectedProjectNo.value = '' } else { // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭� ElMessage.error(response.msg); @@ -367,8 +439,10 @@ if (response.code == 200) { // 缁戝畾鎴愬姛锛屽鐞嗛�昏緫 ElMessage.success(response.message); - window.location.reload() + // window.location.reload() blind.value = false; + tableData.splice(0, tableData.length, ...response.data); + selectedProjectNoa.value = '' } else { // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭� ElMessage.error(response.msg); @@ -379,36 +453,6 @@ console.error(error); } } -// const handle = async () => { -// try { -// let engineeringId = window.localStorage.getItem('engineeringId') -// console.log(engineeringId); -// if (engineeringId !== '') { -// const response = await request.post('/loadGlass/engineering/engineering/changeTask', { -// engineeringId: engineerId.va, -// state: 1, -// }) -// if (response.code == 200) { -// // 缁戝畾鎴愬姛锛屽鐞嗛�昏緫 -// ElMessage.success(response.message); -// blind.value = false; -// } else { -// // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭� -// ElMessage.error(response.msg); -// } -// } -// else { -// ElMessage({ -// type: 'info', -// message: '宸ョ▼鍙蜂笉鑳戒负绌猴紒', -// }) -// } -// } -// catch (error) { -// // 澶勭悊閿欒 -// console.error(error); -// } -// } // 鏆傚仠 const handlea = async () => { try { @@ -422,8 +466,11 @@ if (response.code == 200) { // 缁戝畾鎴愬姛锛屽鐞嗛�昏緫 ElMessage.success(response.message); - window.location.reload() + // window.location.reload() blinda.value = false; + // tableData.value = response.data + // tableData.value = []; + tableData.splice([]); } else { // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭� ElMessage.error(response.msg); @@ -454,9 +501,10 @@ if (response.code == 200) { // 缁戝畾鎴愬姛锛屽鐞嗛�昏緫 ElMessage.success(response.message); - window.location.reload() + // window.location.reload() blindb.value = false; - } else { + tableData.splice([]); + // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭� ElMessage.error(response.msg); } @@ -474,11 +522,13 @@ } } onMounted(fetchTableData); -function getStatusText(state: number) { - switch (state) { +onMounted(fetchTableDataa); +function getStatusText(state: number) { + switch (state) { case 0: return '绛夊緟涓�'; case 1: + return '涓婄墖涓�'; case 2: return '涓婄墖涓�'; case 100: @@ -697,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"> @@ -717,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