From d5d652d23a0bdf64ce527a6b592713a849abac7d Mon Sep 17 00:00:00 2001 From: ZengTao <2773468879@qq.com> Date: 星期四, 17 十月 2024 15:22:37 +0800 Subject: [PATCH] Merge branch 'master' of http://bore.pub:10439/r/HangZhouMes --- UI-Project/src/views/NewPage.vue | 276 +++++++++++++++++++++++++++--------------------------- 1 files changed, 138 insertions(+), 138 deletions(-) diff --git a/UI-Project/src/views/NewPage.vue b/UI-Project/src/views/NewPage.vue index 6fd5636..b61641b 100644 --- a/UI-Project/src/views/NewPage.vue +++ b/UI-Project/src/views/NewPage.vue @@ -1,151 +1,151 @@ <template> - <div> - <div style="display: flex;"> - <div style="margin-left: 50px;margin-top: 15px;font-size:large">宸ョ▼鍙�:</div> + <div> +<div style="display: flex;"> + <div style="margin-left: 50px;margin-top: 15px;font-size:large">宸ョ▼鍙�:</div> <el-input v-model="current" style="margin-left: 20px;margin-top: 15px;width: 240px" placeholder="璇疯緭鍏ュ伐绋嬪彿" @input="updateUrl"/> - <el-button style="margin-top: 15px;margin-left: 15px;" type="primary" @click="fetchData">鏌ヨ</el-button> - </div> - <el-card style="flex: 1;margin-left: 10px;margin-top: 20px;margin-right: 10px;width: 1850px;" height="900" v-loading="loading"> - <div v-for="(row, rowIndex) in divsData" :key="rowIndex" class="row"> - <div v-for="(rect, colIndex) in row" :key="colIndex" class="div-container"> - <el-scrollbar height="430px" width="900px" style="background-color: #e9e9eb;"> - <div style="position: relative;width: 100%;height: 100%;"> - <div - v-for="(rect, index) in getAdjustedRectsForRow(rowIndex)" - :key="index" - class="rect" - :style="{ position: 'absolute', - top: `${rect.y_axis}px`, - left: `${rect.x_axis}px`, - width: `${rect.width}px`, - height: `${rect.height}px`, - backgroundColor: '#911005'}"> - <div class="centered-text"> - <div style="font-size: 15px;font-weight: bold;">{{ rect.process_id }}</div> - <div style="font-size: 15px;font-weight: bold;">{{ rect.project_no }}</div> - <div style="font-size: 30px;font-weight: bold;">{{ rect.widtha }}*{{ rect.heighta }}</div> - </div> - </div> - </div> - </el-scrollbar> - </div> - </div> - </el-card> - </div> -</template> - -<script setup> -import {onMounted, ref, watch} from 'vue'; -import {useRoute, useRouter} from 'vue-router'; -import request from "@/utils/request" - -const route = useRoute(); -const router = useRouter(); -const current = ref(route.query.current || ''); -const adjustedRects = ref([]); -const loading = ref(false); -const adjustedRectsPerRow = ref([]); -const divsData = ref([]); -const rawData = ref([]); -onMounted(() => { - if (route.query.current) { - current.value = route.query.current; - console.log(current.value); - window.localStorage.setItem('current', current.value) - } - }); - onMounted(async () => { - try { - let current = window.localStorage.getItem('current') - const response = await request.post(`/cacheGlass/taskCache/temperingTerritory?current=${current}`); - if (response.code === 200) { - rawData.value = response.data; - console.log(rawData.value); - processData(rawData.value); - } else { - // ElMessage.warning(res.msg) - } - } catch (error) { - // console.error('Error fetching rects :', error); + <el-button style="margin-top: 15px;margin-left: 15px;" type="primary" @click="fetchData">鏌ヨ</el-button> + </div> + <el-card style="flex: 1;margin-left: 10px;margin-top: 20px;margin-right: 10px;width: 1850px;" height="900" v-loading="loading"> + <div v-for="(row, rowIndex) in divsData" :key="rowIndex" class="row"> + <div v-for="(rect, colIndex) in row" :key="colIndex" class="div-container"> + <el-scrollbar height="430px" width="900px" style="background-color: #e9e9eb;"> + <div style="position: relative;width: 100%;height: 100%;"> + <div + v-for="(rect, index) in getAdjustedRectsForRow(rowIndex)" + :key="index" + class="rect" + :style="{ position: 'absolute', + top: `${rect.y_axis}px`, + left: `${rect.x_axis}px`, + width: `${rect.width}px`, + height: `${rect.height}px`, + backgroundColor: '#911005'}"> + <div class="centered-text"> + <div style="font-size: 15px;font-weight: bold;">{{ rect.process_id }}</div> + <div style="font-size: 15px;font-weight: bold;">{{ rect.project_no }}</div> + <div style="font-size: 30px;font-weight: bold;">{{ rect.widtha }}*{{ rect.heighta }}</div> +</div> +</div> + </div> + </el-scrollbar> + </div> + </div> + </el-card> +</div> +</template> + + <script setup> + import { ref, onMounted, watch, watchEffect } from 'vue'; + import { useRoute, useRouter } from 'vue-router'; + import request from "@/utils/request" + const route = useRoute(); + const router = useRouter(); + const current = ref(route.query.current || ''); + const adjustedRects = ref([]); + const loading = ref(false); + const adjustedRectsPerRow = ref([]); + const divsData = ref([]); + const rawData = ref([]); + onMounted(() => { + if (route.query.current) { + current.value = route.query.current; + console.log(current.value); + window.localStorage.setItem('current', current.value) + } + }); + onMounted(async () => { + try { + let current = window.localStorage.getItem('current') + const response = await request.post(`/cacheGlass/taskCache/temperingTerritory?current=${current}`); + if (response.code === 200) { + rawData.value = response.data; + console.log(rawData.value); + processData(rawData.value); + } else { + // ElMessage.warning(res.msg) } - }); - watch( - current, - (newVal) => { - router.replace({ query: { current: newVal } }); - }, - { immediate: true } // 浣跨敤 immediate: true 鏉ョ‘淇濆湪缁勪欢鎸傝浇鏃剁珛鍗虫墽琛屼竴娆� watch 鍥炶皟 - ); - const fetchData = async () => { - try { - const response = await request.post(`/cacheGlass/taskCache/temperingTerritory?current=${current.value}`); - if (response.code === 200) { - rawData.value = response.data; - console.log(rawData.value); - processData(rawData.value); - } - } catch (error) { - console.error('Failed to fetch data:', error); - } finally { - loading.value = false; + } catch (error) { + // console.error('Error fetching rects :', error); + } + }); + watch( + current, + (newVal) => { + router.replace({ query: { current: newVal } }); + }, + { immediate: true } // 浣跨敤 immediate: true 鏉ョ‘淇濆湪缁勪欢鎸傝浇鏃剁珛鍗虫墽琛屼竴娆� watch 鍥炶皟 + ); + const fetchData = async () => { + try { + const response = await request.post(`/cacheGlass/taskCache/temperingTerritory?current=${current.value}`); + if (response.code === 200) { + rawData.value = response.data; + console.log(rawData.value); + processData(rawData.value); } +} catch (error) { + console.error('Failed to fetch data:', error); +} finally { + loading.value = false; +} }; - function processData(data) { - const groupedData = []; - for (let i = 0; i < data.length; i += 2) { - groupedData.push(data.slice(i, i + 2)); - } - divsData.value = groupedData; + function processData(data) { +const groupedData = []; +for (let i = 0; i < data.length; i += 2) { + groupedData.push(data.slice(i, i + 2)); +} +divsData.value = groupedData; adjustedRectsPerRow.value = divsData.value.map(() => []); - divsData.value.forEach((row, rowIndex) => { - const rawRowData = rawData.value[rowIndex]; - if (rawRowData) { +divsData.value.forEach((row, rowIndex) => { + const rawRowData = rawData.value[rowIndex]; + if (rawRowData) { adjustedRectsPerRow.value[rowIndex] = rawRowData.map(rect => { - let adjustedWidth, adjustedHeight,newX; - if (rect.rotate_angle === 0) { - newX = rect.olHeight -(rect.y_axis + rect.height); - adjustedWidth = rect.height * (900/rect.olHeight); - adjustedHeight = rect.width * (430/rect.olWidth); - } else { - newX = rect.olHeight -(rect.y_axis + rect.width); - adjustedWidth = rect.width * (900/rect.olHeight); - adjustedHeight = rect.height * (430/rect.olWidth); - } - let adjustedRect = { - ...rect, - // x_axis: rect.y_axis * (959.35/rect.olHeight), - y_axis: rect.x_axis * (430/rect.olWidth), - x_axis: newX * (900/rect.olHeight), - // y_axis: rect.x_axis * (430/rect.olWidth), - width: adjustedWidth, - height: adjustedHeight, - widtha: rect.width, - heighta: rect.height, - }; - return adjustedRect; - }); - } - }); + let adjustedWidth, adjustedHeight,newX; + if (rect.rotate_angle === 0) { + newX = rect.olHeight -(rect.y_axis + rect.height); + adjustedWidth = rect.height * (900/rect.olHeight); + adjustedHeight = rect.width * (430/rect.olWidth); + } else { + newX = rect.olHeight -(rect.y_axis + rect.width); + adjustedWidth = rect.width * (900/rect.olHeight); + adjustedHeight = rect.height * (430/rect.olWidth); + } + // 璇ラ〉闈负椤烘椂閽堟棆杞�90搴� + let adjustedRect = { + ...rect, + // x_axis: rect.y_axis * (959.35/rect.olHeight), + y_axis: rect.x_axis * (430/rect.olWidth), + x_axis: newX * (900/rect.olHeight), + // y_axis: rect.x_axis * (430/rect.olWidth), + width: adjustedWidth, + height: adjustedHeight, + widtha: rect.width, + heighta: rect.height, + }; + return adjustedRect; + }); + } +}); } // 鏂规硶鐢ㄤ簬鑾峰彇褰撳墠琛岀殑adjustedRects function getAdjustedRectsForRow(rowIndex) { - return adjustedRectsPerRow.value[rowIndex] || []; +return adjustedRectsPerRow.value[rowIndex] || []; } - </script> - - - <style scoped> -.row { - display: flex; - justify-content: space-between; - margin-bottom: 20px; -} + </script> + -.div-container { - width: 900px; - float: left; - background-color: #f4f4f5; - height: 430px; - box-sizing: border-box; +<style scoped> +.row { +display: flex; +justify-content: space-between; +margin-bottom: 20px; } - </style> \ No newline at end of file + +.div-container { +width: 900px; +float: left; +background-color: #f4f4f5; +height: 430px; +box-sizing: border-box; +} +</style> \ No newline at end of file -- Gitblit v1.8.0