From 9b6553d99c71cb7f320fcfd3a73c5fa18b1052f9 Mon Sep 17 00:00:00 2001
From: wu <731351411@qq.com>
Date: 星期二, 04 六月 2024 16:56:42 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/HangZhouMes
---
UI-Project/src/views/PurchaseReturn/purchaseReturn.vue | 297 ++++++++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 211 insertions(+), 86 deletions(-)
diff --git a/UI-Project/src/views/PurchaseReturn/purchaseReturn.vue b/UI-Project/src/views/PurchaseReturn/purchaseReturn.vue
index 63dbe54..8fd42ca 100644
--- a/UI-Project/src/views/PurchaseReturn/purchaseReturn.vue
+++ b/UI-Project/src/views/PurchaseReturn/purchaseReturn.vue
@@ -2,26 +2,151 @@
import {Search} from "@element-plus/icons-vue";
import {reactive} from "vue";
import {useRouter} from "vue-router"
-
-import { ref } from 'vue'
-
+import request from "@/utils/request"
+// import { ref } from 'vue'
+import { ref, onMounted, onBeforeUnmount } from 'vue';
+import { WebSocketHost ,host} from '@/utils/constants'
+import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService';
const dialogFormVisible = ref(true)
const dialogFormVisiblea = ref(false)
+const dialogFormVisibleb = ref(false)
+const width = ref(); // 鐢ㄤ簬瀛樺偍process_id鐨勫搷搴斿紡寮曠敤
+const height = ref(); // 鐢ㄤ簬瀛樺偍process_id鐨勫搷搴斿紡寮曠敤
+const adjustedRects = ref([]);
+const adjustedRectsa = ref([]);
+const adjustedRectsb = ref([]);
+// 杩涚倝涓�
-const getTableRow = (row,type) =>{
- switch (type) {
- case 'edit' :{
- //alert('鎴戞帴鏀跺埌瀛愮粍浠朵紶閫佺殑缂栬緫淇℃伅')
- router.push({path: '/main/returns/createReturns', query: { ReturnID: 'TH24010101' }})
- break
- }
- case 'delete':{
- alert('鎴戞帴鏀跺埌瀛愮粍浠朵紶閫佺殑鍒犻櫎淇℃伅')
- break
- }
- }
-}
+const socketUrl = `ws://${WebSocketHost}:${host}/api/temperingGlass/api/talk/temperingGlass`;
+// 瀹氫箟娑堟伅澶勭悊鍑芥暟锛屾洿鏂� receivedData 鍙橀噺
+const handleMessage = (data) => {
+ // 鏇存柊 tableData 鐨勬暟鎹�
+ adjustedRects.value = data.intoGlass[0].map(rect => ({
+ ...rect, // 澶嶅埗鍘熷瀵硅薄鐨勫叾浠栧睘鎬�
+ xcoordinate: rect.xcoordinate, // 灏唜鍊奸櫎浠�3
+ ycoordinate: rect.ycoordinate,
+ width: rect.width ,
+ height: rect.height ,
+ }));
+ adjustedRectsa.value = data.waitingGlass[0].map(rect => ({
+ ...rect, // 澶嶅埗鍘熷瀵硅薄鐨勫叾浠栧睘鎬�
+ xcoordinate: rect.xcoordinate, // 灏唜鍊奸櫎浠�3
+ ycoordinate: rect.ycoordinate,
+ width: rect.width ,
+ height: rect.height ,
+ }));
+
+ adjustedRectsb.value = data.outGlass[0].map(rect => ({
+ ...rect, // 澶嶅埗鍘熷瀵硅薄鐨勫叾浠栧睘鎬�
+ xcoordinate: rect.xcoordinate, // 灏唜鍊奸櫎浠�3
+ ycoordinate: rect.ycoordinate,
+ width: rect.width ,
+ height: rect.height ,
+ }));
+};
+// 鍒濆鍖� WebSocket锛屽苟浼犻�掓秷鎭鐞嗗嚱鏁�
+
+onMounted(() => {
+ // fetchFlowCardId();
+ // fetchTableData(); // 鑾峰彇鏁版嵁
+ initializeWebSocket(socketUrl, handleMessage);
+});
+
+onBeforeUnmount(() => {
+ console.log("鍏抽棴浜�")
+ closeWebSocket();
+});
+// onMounted(async () => {
+// try {
+// const response = await request.get('/temperingGlass/temperingGlassInfo/SelectIntoGlass');
+// if (response.code === 200) {
+// const rawRects = response.data; // 璁剧疆鐭╁舰鏁版嵁
+// console.log(response.data);
+// const { height: newheight,width: newwidth } = response.data; // 鑾峰彇灏哄
+// height.value = newheight;
+// width.value = newwidth;
+
+// adjustedRects.value = rawRects.map(rect => ({
+// ...rect, // 澶嶅埗鍘熷瀵硅薄鐨勫叾浠栧睘鎬�
+// xcoordinate: rect.xcoordinate, // 灏唜鍊奸櫎浠�3
+// ycoordinate: rect.ycoordinate,
+// width: rect.width ,
+// height: rect.height ,
+// }));
+// console.log(rect);
+
+// // console.log( (rect.width*100) / 300 );
+// } else {
+// // console.error('Failed to fetch rectangles from API.');
+// console.error('Failed to fetch rects from API.');
+// }
+// } catch (error) {
+// // console.error('Error fetching rectangles :', error);
+// console.error('Error fetching rects :', error);
+// }
+// });
+// 杩涚倝鍓�
+// const handleConfirm = async () => {
+// try {
+// const response = await request.post('/temperingGlass/temperingGlassInfo/SelectWaitingGlass');
+// if (response.code === 200) {
+// const rawRects = response.data; // 璁剧疆鐭╁舰鏁版嵁
+// console.log(response.data);
+// const { height: newheight,width: newwidth } = response.data; // 鑾峰彇灏哄
+// height.value = newheight;
+// width.value = newwidth;
+
+// adjustedRectsa.value = rawRects.map(rect => ({
+// ...rect, // 澶嶅埗鍘熷瀵硅薄鐨勫叾浠栧睘鎬�
+// xcoordinate: rect.xcoordinate, // 灏唜鍊奸櫎浠�3
+// ycoordinate: rect.ycoordinate,
+// width: rect.width ,
+// height: rect.height ,
+// }));
+// console.log(rect);
+
+// // console.log( (rect.width*100) / 300 );
+// } else {
+// // console.error('Failed to fetch rectangles from API.');
+// console.error('Failed to fetch rects from API.');
+// }
+// } catch (error) {
+// // console.error('Error fetching rectangles :', error);
+// console.error('Error fetching rects :', error);
+// }
+// };
+
+// 宸插嚭鐐�
+// const handleConfirma = async () => {
+// try {
+// const response = await request.get('/temperingGlass/temperingGlassInfo/SelectOutGlass');
+// if (response.code === 200) {
+// const rawRects = response.data; // 璁剧疆鐭╁舰鏁版嵁
+// console.log(response.data);
+// const { height: newheight,width: newwidth } = response.data; // 鑾峰彇灏哄
+// height.value = newheight;
+// width.value = newwidth;
+
+// adjustedRectsb.value = rawRects.map(rect => ({
+// ...rect, // 澶嶅埗鍘熷瀵硅薄鐨勫叾浠栧睘鎬�
+// xcoordinate: rect.xcoordinate, // 灏唜鍊奸櫎浠�3
+// ycoordinate: rect.ycoordinate,
+// width: rect.width ,
+// height: rect.height ,
+// }));
+// console.log(rect);
+
+// // console.log( (rect.width*100) / 300 );
+// } else {
+// // console.error('Failed to fetch rectangles from API.');
+// console.error('Failed to fetch rects from API.');
+// }
+// } catch (error) {
+// // console.error('Error fetching rectangles :', error);
+// console.error('Error fetching rects :', error);
+// }
+// };
const gridOptions = reactive({
border: "full",//琛ㄦ牸鍔犺竟妗�
keepSource: true,//淇濇寔婧愭暟鎹�
@@ -57,85 +182,70 @@
})
</script>
-<template>
+<template>
<div style="margin-top: 10px;">
- <el-button style="margin-left: 15px;" id="searchButton" type="primary" @click="dialogFormVisible = true;dialogFormVisiblea = false">鎽嗙墖鐗堝浘</el-button>
- <el-button id="searchButton" type="success" @click="dialogFormVisiblea = true;dialogFormVisible = false">宸插嚭鐐夌幓鐠�</el-button>
+ <el-button style="margin-left: 15px;" id="searchButton" type="primary" @click="dialogFormVisible = true;dialogFormVisiblea = false;dialogFormVisibleb = false;">杩涚倝涓�</el-button>
+ <el-button style="margin-left: 15px;" id="searchButton" type="primary" @click="handleConfirm();dialogFormVisiblea = true;dialogFormVisible = false;dialogFormVisibleb = false;" >杩涚倝鍓�</el-button>
+ <el-button id="searchButton" type="success" @click="handleConfirma();dialogFormVisibleb = true;dialogFormVisible = false;dialogFormVisiblea = false">宸插嚭鐐夌幓鐠�</el-button>
<div v-if="dialogFormVisible" >
- <el-card style="margin-left: 10px;margin-top: 10px;margin-right: 10px;" v-loading="loading">
- <div style="display: flex;margin-bottom: 20px;">
+ <!-- <div style="display: flex;margin-bottom: 20px;">
<div style="margin-left: 450px;font-size: 20px;">宸ョ▼鍙凤細P20240305001 </div>
<div style="margin-left: 150px;font-size: 20px;">鐗堝浘缂栧彿锛�1</div>
- </div>
- <div>
- <div id="boxa" style="width: 200px;height: 300px;margin-left: 70px;">
- <div style="margin-top: 35px;"> NG202405060798A01-1</div>
- <div> 500脳1000</div>
- </div>
- <div id="boxa" style="width: 200px;height: 300px;">
- <div style="margin-top: 35px;"> NG202405060798A01-1</div>
- <div> 500脳1000</div>
- </div>
- <div id="boxa" style="width: 200px;height: 300px;">
- <div style="margin-top: 35px;"> NG202405060798A01-1</div>
- <div> 500脳1000</div>
- </div>
- <div id="boxa" style="width: 200px;height: 300px;">
- <div style="margin-top: 35px;"> NG202405060798A01-1</div>
- <div> 500脳1000</div>
- </div>
- <div id="boxa" style="width: 200px;height: 300px;">
- <div style="margin-top: 35px;"> NG202405060798A01-1</div>
- <div> 500脳1000</div>
- </div>
- <div id="boxa" style="width: 200px;height: 300px;">
- <div style="margin-top: 35px;"> NG202405060798A01-1</div>
- <div> 500脳1000</div>
- </div>
- </div>
- <div style="margin-top: 20px;">
- <div id="boxa" style="width: 200px;height: 300px;margin-left: 70px;">
- <div style="margin-top: 35px;"> NG202405060798A01-1</div>
- <div> 500脳1000</div>
- </div>
- <div id="boxa" style="width: 200px;height: 300px;">
- <div style="margin-top: 35px;"> NG202405060798A01-1</div>
- <div> 500脳1000</div>
- </div>
- <div id="boxa" style="width: 200px;height: 300px;">
- <div style="margin-top: 35px;"> NG202405060798A01-1</div>
- <div> 500脳1000</div>
- </div>
- <div id="boxa" style="width: 200px;height: 300px;">
- <div style="margin-top: 35px;"> NG202405060798A01-1</div>
- <div> 500脳1000</div>
- </div>
- <div id="boxa" style="width: 200px;height: 300px;">
- <div style="margin-top: 35px;"> NG202405060798A01-1</div>
- <div> 500脳1000</div>
- </div>
- <div id="boxb" style="width: 200px;height: 300px;">
- <div style="margin-top: 35px;"> NG202405060798A01-1</div>
- <div> 500脳1000</div>
- </div>
- </div>
- </el-card>
- </div>
-<div v-if="dialogFormVisiblea">
+ </div> -->
<el-card style="flex: 1;margin-left: 10px;margin-top: 10px;margin-right: 10px;" v-loading="loading">
<el-scrollbar height="630px">
- <div id="home-card">
- <div id="home-item" v-for="n in 20" :key="n">
- <div id="box" style="width: 100px;height: 165px;">100*65</div>
- <div id="box" style="width: 107px;height: 150px;">107*60</div>
- <div id="box" style="width: 107px;height: 155px;">109*60</div>
- </div>
+ <div style="position: relative;width: 1400px;">
+ <div
+ v-for="(rect, index) in adjustedRects"
+ :key="index"
+ class="rect"
+ :style="{ position: 'absolute', top: `${rect.ycoordinate}px`, left: `${rect.xcoordinate}px`, width: `${rect.width}px`, height: `${rect.height}px` }"
+ >
+ <div class="centered-text">
+ <div style="margin-top: 50px;margin-left: -85px;">{{ rect.width }}*{{ rect.height }}</div>
+ </div>
+ </div>
+ </div>
+ </el-scrollbar>
+ </el-card>
</div>
- </el-scrollbar>
- </el-card>
+<div v-if="dialogFormVisiblea">
+ <el-card style="flex: 1;margin-left: 10px;margin-top: 10px;margin-right: 10px;" v-loading="loading">
+ <el-scrollbar height="630px">
+ <div style="position: relative;width: 1400px;">
+ <div
+ v-for="(rect, index) in adjustedRectsa"
+ :key="index"
+ class="rect"
+ :style="{ position: 'absolute', top: `${rect.ycoordinate}px`, left: `${rect.xcoordinate}px`, width: `${rect.width}px`, height: `${rect.height}px` }"
+ >
+ <div class="centered-text">
+ <div style="margin-top: 50px;margin-left: -85px;">{{ rect.width }}*{{ rect.height }}</div>
+ </div>
+ </div>
+ </div>
+ </el-scrollbar>
+ </el-card>
+</div>
+<div v-if="dialogFormVisibleb">
+ <el-card style="flex: 1;margin-left: 10px;margin-top: 10px;margin-right: 10px;" v-loading="loading">
+ <el-scrollbar height="630px">
+ <div style="position: relative;width: 1400px;">
+ <div
+ v-for="(rect, index) in adjustedRectsb"
+ :key="index"
+ class="rect"
+ :style="{ position: 'absolute', top: `${rect.ycoordinate}px`, left: `${rect.xcoordinate}px`, width: `${rect.width}px`, height: `${rect.height}px` }"
+ >
+ <div class="centered-text">
+ <div style="margin-top: 50px;margin-left: -85px;">{{ rect.width }}*{{ rect.height }}</div>
+ </div>
+ </div>
+ </div>
+ </el-scrollbar>
+ </el-card>
</div>
</div>
-
</template>
<style scoped>
@@ -203,4 +313,19 @@
}
}
}
+ .rect {
+ border: 1px solid black; /* 璁剧疆鐭╁舰鐨勮竟妗� */
+ background-color: lightblue; /* 璁剧疆鐭╁舰鐨勮儗鏅壊 */
+}
+#rect {
+ position: relative; /* 纭繚绠ご鍙互鐩稿浜庣煩褰㈠畾浣� */
+ /* 鍏朵粬鏍峰紡 */
+}
+.centered-text {
+ /* 璁剧疆鏂囧瓧灞呬腑鏍峰紡 */
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ height: 100%; /* 纭繚div鍗犳嵁鏁翠釜鐭╁舰鐨勯珮搴� */
+}
</style>
\ No newline at end of file
--
Gitblit v1.8.0