From 031da535a58f83913db6287b5f29f5983435cfa2 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期三, 24 七月 2024 15:46:41 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
UI-Project/src/views/PurchaseReturn/purchaseReturn.vue | 89 +++++++++++++++++++++++++++++++++++++-------
1 files changed, 75 insertions(+), 14 deletions(-)
diff --git a/UI-Project/src/views/PurchaseReturn/purchaseReturn.vue b/UI-Project/src/views/PurchaseReturn/purchaseReturn.vue
index 42ec676..ee5825e 100644
--- a/UI-Project/src/views/PurchaseReturn/purchaseReturn.vue
+++ b/UI-Project/src/views/PurchaseReturn/purchaseReturn.vue
@@ -5,6 +5,7 @@
import request from "@/utils/request"
import { ref, onMounted, onBeforeUnmount } from 'vue';
import { WebSocketHost ,host} from '@/utils/constants'
+import { ElMessage, ElMessageBox } from 'element-plus'
import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService';
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
@@ -19,6 +20,8 @@
const adjustedRects2 = ref([]);
const adjustedRectsa = ref([]);
const adjustedRectsb = ref([]);
+const currentGlassId = ref(null);
+const currenttemperingFeedSequence = ref(null);
const socketUrl = `ws://${WebSocketHost}:${host}/api/temperingGlass/api/talk/temperingGlass`;
const handleMessage = (data) => {
// 杩涚倝涓�
@@ -140,19 +143,64 @@
onMounted(() => {
initializeWebSocket(socketUrl, handleMessage);
});
-function getRectColor(state) {
+function updateRectColors() {
+ adjustedRectsa.value.forEach(rect => {
+ if (rect.glassId === glassId) {
+ rect.state = 5;
+ }
+ });
+}
+function getRectColora(state) {
switch (state) {
case 0:
- return '#f8e3c5';
+ return '#d1edc4';
case 1:
- return '#d1edc4';
+ return '#E6E6FA';
case -1:
return '#dedfe0';
+ case 5:
+ return '#911005';
+ }
+}
+function getRectColorb(state) {
+ switch (state) {
+ case 3:
+ return '#f8e3c5';
+ case 4:
+ return '#F0F8FF';
+ case 5:
+ return '#911005';
}
-}
-function showDialog(row) {
+}
+function showDialog(rect) {
+ currentGlassId.value = rect.glassId;
+ currenttemperingFeedSequence.value = rect.temperingFeedSequence;
blind.value = true;
}
+// 鐮存崯
+const handleDamage = async () => {
+ try {
+ const response = await request.post('/temperingGlass/temperingGlassInfo/updateTemperingState', {
+ glassId: currentGlassId.value,
+ // temperingFeedSequence: currenttemperingFeedSequence.value,
+ line: 4001,
+ status: 2,
+ workingProcedure: '閽㈠寲',
+ })
+ if (response.code == 200) {
+ ElMessage.success(response.message);
+ blind.value = false;
+ updateRectColors();
+ } else {
+ // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
+ ElMessage.error(response.message);
+ }
+}
+catch (error) {
+ // 澶勭悊閿欒
+ console.error(error);
+ }
+}
onBeforeUnmount(() => {
console.log("鍏抽棴浜�")
closeWebSocket();
@@ -173,8 +221,14 @@
<div
v-for="(rect, index) in adjustedRects"
:key="index"
+ @click="showDialog(rect)"
class="rect"
- :style="{ position: 'absolute', top: `${rect.ycoordinate}px`, left: `${rect.xcoordinate}px`, width: `${rect.width}px`, height: `${rect.height}px` }"
+ :style="{ position: 'absolute',
+ top: `${rect.ycoordinate}px`,
+ left: `${rect.xcoordinate}px`,
+ width: `${rect.width}px`,
+ height: `${rect.height}px`,
+ backgroundColor: rect.state === 5 ? '#911005' : 'lightblue' }"
>
<div class="centered-text">
<div >{{ rect.glassId }}</div>
@@ -194,9 +248,15 @@
<div
v-for="(rect, index) in adjustedRects2"
:key="index"
+ @click="showDialog(rect)"
class="rect"
- :style="{ position: 'absolute', top: `${rect.ycoordinate}px`, left: `${rect.xcoordinate}px`, width: `${rect.width}px`, height: `${rect.height}px` }"
- >
+ :style="{ position: 'absolute',
+ top: `${rect.ycoordinate}px`,
+ left: `${rect.xcoordinate}px`,
+ width: `${rect.width}px`,
+ height: `${rect.height}px`,
+ backgroundColor: rect.state === 5 ? '#911005' : 'lightblue' }"
+ >
<div class="centered-text">
<div >{{ rect.glassId }}</div>
<div >{{ rect.flowCardId }}</div>
@@ -214,17 +274,16 @@
<el-card style="flex: 1;margin-left: 10px;margin-top: 10px;margin-right: 10px;height: 600px;" v-loading="loading">
<div v-if="adjustedRectsa.length > 0">
<div style="text-align: center;">鐐夊彿锛歿{ adjustedRects[0].engineerId }}-{{ adjustedRects[0].temperingLayoutId }}</div>
- <!-- <div style="text-align: center;">娴佺▼鍗�: {{ adjustedRectsa[0].flowCardId }}</div> -->
<el-scrollbar height="550px" style="background-color: #e9e9eb;">
<div style="position: relative;max-width: 1400px;">
<div
v-for="(rect, index) in adjustedRectsa"
:key="index"
- @click="showDialog"
+ @click="showDialog(rect)"
class="rect"
:style="{ position: 'absolute', top: `${rect.y}px`, left: `${rect.x}px`,
width: `${rect.width}px`, height: `${rect.height}px`,
- backgroundColor: getRectColor(rect.state) }">
+ backgroundColor: getRectColora(rect.state) }">
<div class="centered-text">
<div>{{ rect.glassId }}</div>
<div >{{ rect.flowCardId }}</div>
@@ -246,10 +305,12 @@
<div
v-for="(rect, index) in adjustedRectsb"
:key="index"
+ @click="showDialog(rect)"
class="rect"
:style="{ position: 'absolute', top: `${rect.y}px`, left: `${rect.x}px`,
width: `${rect.width}px`, height: `${rect.height}px`,
- backgroundColor: rect.state === 4 ? '#911005' : '#f8e3c5' }">
+ backgroundColor: getRectColorb(rect.state) }">
+ <!-- backgroundColor: rect.state === 4 ? '#911005' : '#f8e3c5' }"> -->
<div class="centered-text">
<div >{{ rect.glassId }}</div>
<div >{{ rect.flowCardId }}</div>
@@ -263,7 +324,7 @@
</div>
<el-dialog v-model="blind" top="30vh" width="15%" style="text-align: center;">
- <el-button type="warning" plain :icon="Delete" @click="handleDamage(currentGlassId)" style="width: 140px;margin-left: 10px;">
+ <el-button type="warning" plain :icon="Delete" @click="handleDamage" style="width: 140px;margin-left: 10px;">
{{ $t('order.dilapidation') }}
</el-button>
</el-dialog>
@@ -348,6 +409,6 @@
justify-content: center;
align-items: center;
height: 100%; /* 纭繚div鍗犳嵁鏁翠釜鐭╁舰鐨勯珮搴� */
- font-size: small;
+ /* font-size: small; */
}
</style>
\ No newline at end of file
--
Gitblit v1.8.0