From 73fe3c5574c8fbb7b18fa9b76d53b918f6f921e1 Mon Sep 17 00:00:00 2001
From: wangfei <3597712270@qq.com>
Date: 星期三, 12 十一月 2025 11:09:04 +0800
Subject: [PATCH] 更换前端打包方式,将ip地址配置提取到public
---
UI-Project/src/views/GlassStorage/MaterialRackManagement.vue | 970 ++++++++++++++++++++++++++++++++++++--------------------
1 files changed, 626 insertions(+), 344 deletions(-)
diff --git a/UI-Project/src/views/GlassStorage/MaterialRackManagement.vue b/UI-Project/src/views/GlassStorage/MaterialRackManagement.vue
index 2b7b9cc..d8000f9 100644
--- a/UI-Project/src/views/GlassStorage/MaterialRackManagement.vue
+++ b/UI-Project/src/views/GlassStorage/MaterialRackManagement.vue
@@ -1,113 +1,167 @@
<template>
- <div >
- <el-card style="flex: 1; margin-left: 10px; " :loading="loading">
- <div slot="header" class="clearfix" style="display: flex; align-items: center;">
+ <div class="app-container">
+ <el-card style="flex: 1; margin-left: 10px" :loading="loading">
+ <div
+ slot="header"
+ class="clearfix"
+ style="display: flex; align-items: center;margin-top: -20px;"
+ >
+ <!-- 宸︿晶鎸夐挳缁� -->
+ <div>
+ <el-button type="success" @click="storage()"
+ >鍘熺墖浠撳偍璇︽儏</el-button
+ >
+ <el-button type="success" @click="handleInbound()"
+ >鍏ュ簱</el-button
+ >
+ <el-button type="success" >鍚婅浣嶅叆搴�</el-button>
+ </div>
+ <!-- 鍙充晶閫夋嫨妗� -->
+ <el-form-item style="margin-top: 15px; width: 150px;margin-left: 10px;">
+ <el-select v-model="formData2.dzw" placeholder="璇烽�夋嫨鍚婅浣�">
+ <el-option label="鍚婅浣�1" value="鍚婅浣�1"></el-option>
+ <el-option label="鍚婅浣�2" value="鍚婅浣�2"></el-option>
+ </el-select>
+ </el-form-item>
+ </div>
+ <el-dialog v-model="Hidden" top="10vh" width="80%">
+ <el-table
+ :data="tableData"
+ v-model="dialogVisible3"
+ style="width: 98%; height: 200px"
+ @selection-change="handleSelectionChange"
+ :header-cell-style="{ background: '#F2F3F5', color: '#1D2129' }"
+ ref="table"
+ empty-text="No Data"
+ >
+ <el-table-column prop="number" label="搴撲綅鍙�"></el-table-column>
+ <el-table-column prop="rawType" label="绫诲瀷"></el-table-column>
+ <el-table-column prop="rawWidth" label="闀垮害(mm)"></el-table-column>
+ <el-table-column prop="rawHeight" label="楂樺害(mm)"></el-table-column>
+ <el-table-column
+ prop="rawThickness"
+ label="鍘氬害(mm)"
+ ></el-table-column>
+ <el-table-column prop="pieces" label="鏁伴噺"></el-table-column>
+ <el-table-column prop="createTime" label="鍏ュ簱鏃堕棿"></el-table-column>
+ <el-table-column prop="batchId" label="鎵规鍙�"></el-table-column>
-<!-- 宸︿晶鎸夐挳缁� -->
-<div >
- <el-button type="success" size="mini" @click="handleInbound()">鍏ュ簱</el-button>
- <el-button type="success" size="mini" @click="handleInbound()">鍚婅浣嶅叆搴�</el-button>
- <el-button type="success" size="mini" @click="handleInbound()">娣诲姞鍘熺墖</el-button>
-</div>
-
-<!-- 鍙充晶閫夋嫨妗� -->
-<el-form-item style="margin-top: 15px; width: 150px;">
- <el-select v-model="formData2.dzw" placeholder="璇烽�夋嫨鍚婅浣�">
- <el-option label="鍚婅浣�1" value="鍚婅浣�1"></el-option>
- <el-option label="鍚婅浣�2" value="鍚婅浣�2"></el-option>
- <!-- 鏍规嵁瀹為檯鎯呭喌娣诲姞鏇村閫夐」 -->
- </el-select>
-</el-form-item>
-
-</div>
+ <el-table-column
+ align="center"
+ label="鏂欐灦鐘舵��"
+ min-width="80"
+ prop="enableState"
+ >
+ <template #default="scope">
+ <el-tag
+ :type="getTagType(scope.row.enableState)"
+ @click="toggleStatus(scope.row)"
+ >
+ {{ scope.row.enableState === 1 ? "鍚敤" : "鏈惎鐢�" }}
+ </el-tag>
+ </template>
+ </el-table-column>
+ <!-- 鎿嶄綔鍒� -->
+ <el-table-column label="鎿嶄綔" width="250">
+ <template #default="{ row }">
+ <el-button
+ type="primary"
+ @click="edithandleRowClick(row)"
+ >淇敼</el-button
+ >
+ <el-button type="danger" @click="handleDelete(row)"
+ >鍒犻櫎</el-button
+ >
+ <el-button type="warning" @click="handleCheckout(row)"
+ >鍑哄簱</el-button
+ >
+ <!-- <el-button type="success" @click="addglass()">娣诲姞鍘熺墖</el-button> -->
+ </template>
+ </el-table-column>
+ </el-table>
+ <el-pagination
+ v-if="totalItems > 0"
+ background
+ layout="prev, pager, next"
+ :total="totalItems"
+ :page-size="pageSize"
+ @current-change="handleCurrentChange"
+ ></el-pagination>
+ </el-dialog>
<el-table
- :data="tableData"
-
- style="width: 98%; height: 200px"
+ :data="tasktableData"
+ style="width: 98%; height: 150px"
@selection-change="handleSelectionChange"
:header-cell-style="{ background: '#F2F3F5', color: '#1D2129' }"
ref="table"
-
empty-text="No Data"
>
-
- <el-table-column prop="location" label="搴撲綅鍙�"></el-table-column>
- <el-table-column prop="type" label="绫诲瀷"></el-table-column>
- <el-table-column prop="length" label="闀垮害(mm)"></el-table-column>
- <el-table-column prop="height" label="楂樺害(mm)"></el-table-column>
- <el-table-column prop="thickness" label="鍘氬害(mm)"></el-table-column>
- <el-table-column prop="quantity" label="鏁伴噺"></el-table-column>
- <el-table-column prop="entry_time" label="鍏ュ簱鏃堕棿"></el-table-column>
- <el-table-column prop="batchnumber" label="鎵规鍙�"></el-table-column>
-
+ <template #header>
+ <div style="display: flex; align-items: center">
+ <span style="font-size: 16px; font-weight: bold; margin-right: 20px"
+ >浠诲姟鍒楄〃</span
+ >
+ </div>
+ </template>
+ <el-table-column prop="id" label="Glassid"></el-table-column>
<el-table-column
- align="center"
- label="鏂欐灦鐘舵��"
- min-width="80"
- prop="shelf_status"
->
- <template #default="scope">
- <el-tag :type="getTagType(scope.row.shelf_status)">
- {{ scope.row.shelf_status === 1 ? '鍚敤' : '鏈惎鐢�' }}
- </el-tag>
- </template>
-</el-table-column>
+ prop="taskType"
+ label="浠诲姟鎻忚堪"
+ width="250"
+ :formatter="formatTaskType"
+ ></el-table-column>
+ <el-table-column
+ prop="rawThickness"
+ label="鐜荤拑鍘氬害"
+ ></el-table-column>
+ <el-table-column prop="color" label="鐜荤拑鑶滅郴"></el-table-column>
+ <el-table-column prop="startTime" label="鍒涘缓鏃堕棿"></el-table-column>
+ <el-table-column
+ align="center"
+ label="浠诲姟鐘舵��"
+ min-width="80"
+ prop="taskState"
+ >
+ <template #default="scope">
+ <el-tag :type="getTagType2(scope.row.taskState)">
+ {{ scope.row.taskState == "completed" ? "瀹屾垚" : "杩涜涓�" }}
+ </el-tag>
+ </template>
+ </el-table-column>
<!-- 鎿嶄綔鍒� -->
- <el-table-column label="鎿嶄綔" width="300">
+ <el-table-column label="鎿嶄綔" width="350">
<template #default="{ row }">
- <el-button type="primary" size="mini" @click="handleEdit(row)">淇敼</el-button>
- <el-button type="danger" size="mini" @click="handleDelete(row)">鍒犻櫎</el-button>
- <el-button type="warning" size="mini" @click="handleCheckout(row)">鍑哄簱</el-button>
-
+ <el-button type="primary" @click="handleRestart(row)"
+ >閲嶆柊寮�濮�</el-button
+ >
+ <el-button type="danger" @click="handleDeletetask(row)"
+ >鍒犻櫎浠诲姟</el-button
+ >
+ <el-button type="success" @click="handleComplete(row)"
+ >浠诲姟瀹屾垚</el-button
+ >
</template>
</el-table-column>
</el-table>
-
- <el-table
- :data="tasktableData"
- style="width: 98%; height: 150px"
- @selection-change="handleSelectionChange"
- :header-cell-style="{ background: '#F2F3F5', color: '#1D2129' }"
- ref="table"
- empty-text="No Data"
- >
- <el-table-column prop="Glassid" label="Glassid"></el-table-column>
- <el-table-column prop="taskDescription" label="浠诲姟鎻忚堪" width="250"></el-table-column>
- <el-table-column prop="taskStatus" label="浠诲姟鐘舵��"></el-table-column>
- <el-table-column prop="glassThickness" label="鐜荤拑鍘氬害"></el-table-column>
- <el-table-column prop="glassFilm" label="鐜荤拑鑶滅郴"></el-table-column>
- <el-table-column prop="creationTime" label="鍒涘缓鏃堕棿"></el-table-column>
-
- <el-table-column
- align="center"
- label="浠诲姟鐘舵��"
- min-width="80"
- prop="taskStatus"
- >
- <template #default="scope">
- <el-tag :type="getTagType2(scope.row.taskStatus)">
- {{ scope.row.taskStatus == 'completed' ? '瀹屾垚' : '杩涜涓�' }}
- </el-tag>
- </template>
- </el-table-column>
-
- <!-- 鎿嶄綔鍒� -->
- <el-table-column label="鎿嶄綔" width="350">
- <template #default="{ row }">
- <el-button type="primary" size="mini" @click="handleRestart(row)">閲嶆柊寮�濮�</el-button>
- <el-button type="danger" size="mini" @click="handleDelete(row)">鍒犻櫎浠诲姟</el-button>
- <el-button type="success" size="mini" @click="handleComplete(row)">浠诲姟瀹屾垚</el-button>
- </template>
- </el-table-column>
- </el-table>
-
</el-card>
-
- <div ref="chart" id="chart" style="width: 100%; height: 250px;"></div>
-
-
+ <div class="img-ypcc">
+ <div
+ class="img-car1"
+ :style="'z-index:999;left:397px;top:205px;position:absolute;'"
+ >
+ <div
+ v-show="cellshow1"
+ style="
+ margin-top: 10px;
+ width: 200px;
+ height: 5px;
+ background-color: #409eff;
+ "
+ ></div>
+ </div>
+ </div>
<!-- 鍏ュ簱瀵硅瘽妗� -->
<el-dialog
title="鍏ュ簱"
@@ -117,9 +171,9 @@
>
<el-form :model="formData" ref="form" label-width="80px">
<el-form-item label="杩涘簱鏂欐灦">
- <el-select v-model="formData.shelf" placeholder="璇烽�夋嫨杩涘簱鏂欐灦">
- <el-option label="A1" value="A1"></el-option>
- <el-option label="B2" value="B2"></el-option>
+ <el-select v-model="formData.number" placeholder="璇烽�夋嫨杩涘簱鏂欐灦">
+ <el-option label="1" value="1"></el-option>
+ <el-option label="2" value="2"></el-option>
<!-- 鏍规嵁瀹為檯鎯呭喌娣诲姞鏇村閫夐」 -->
</el-select>
</el-form-item>
@@ -131,25 +185,137 @@
</el-select>
</el-form-item>
<el-form-item label="瀹藉害">
- <el-input v-model.number="formData.width" placeholder="璇疯緭鍏ュ搴�"></el-input>
+ <el-input
+ v-model.number="formData.rawWidth"
+ placeholder="璇疯緭鍏ュ搴�"
+ ></el-input>
</el-form-item>
<el-form-item label="楂樺害">
- <el-input v-model.number="formData.height" placeholder="璇疯緭鍏ラ珮搴�"></el-input>
+ <el-input
+ v-model.number="formData.rawHeight"
+ placeholder="璇疯緭鍏ラ珮搴�"
+ ></el-input>
</el-form-item>
<el-form-item label="鍘氬害">
- <el-input v-model.number="formData.thickness" placeholder="璇疯緭鍏ュ帤搴�"></el-input>
+ <el-input
+ v-model.number="formData.rawThickness"
+ placeholder="璇疯緭鍏ュ帤搴�"
+ ></el-input>
</el-form-item>
<el-form-item label="鏁伴噺">
- <el-input v-model.number="formData.quantity" placeholder="璇疯緭鍏ユ暟閲�"></el-input>
+ <el-input
+ v-model.number="formData.pieces"
+ placeholder="璇疯緭鍏ユ暟閲�"
+ ></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">鍙� 娑�</el-button>
- <el-button type="primary" @click="handleConfirmInbound">纭� 瀹�</el-button>
+ <el-button type="primary" @click="handleConfirmInbound"
+ >纭� 瀹�</el-button
+ >
</div>
</el-dialog>
- <div ref="chart" id="chart" style="width: 100%; height: 400px;"></div>
+
+ <el-dialog title="娣诲姞鍘熺墖" v-model="dialogVisible3" width="50%">
+ <el-form :model="formData3" ref="form" label-width="80px">
+ <el-form-item label="棰滆壊鑶滅郴">
+ <el-input
+ v-model="formData.selectedColor"
+ readonly
+ style="width: 250px; height: 35px; font-size: 20px"
+ ></el-input>
+ <el-dropdown @command="handleCommand">
+ <span class="el-dropdown-link">
+ 閫夋嫨<i class="el-icon-arrow-down el-icon--right"></i>
+ </span>
+ <el-dropdown-menu slot="dropdown">
+ <el-dropdown-item
+ v-for="color in colors"
+ :key="color['0_glass_id']"
+ :command="color['0_glass_id']"
+ >
+ {{ color["0_glass_id"] }}
+ </el-dropdown-item>
+ </el-dropdown-menu>
+ </el-dropdown>
+ </el-form-item>
+
+ <el-form-item label="闀垮害">
+ <el-input
+ v-model="formData.width"
+ required
+ style="width: 250px; font-size: 20px"
+ @focus="clearInput('wid')"
+ ></el-input>
+ </el-form-item>
+
+ <el-form-item label="楂樺害">
+ <el-input
+ v-model="formData.height"
+ required
+ style="width: 250px; font-size: 20px"
+ @focus="clearInput('heig')"
+ ></el-input>
+ </el-form-item>
+
+ <el-form-item label="鍘氬害">
+ <el-input
+ v-model="formData.thickness"
+ required
+ style="width: 250px; font-size: 20px"
+ @focus="clearInput('thinkness')"
+ ></el-input>
+ </el-form-item>
+
+ <el-form-item label="鏁伴噺">
+ <el-input-number
+ v-model="formData.quantity"
+ required
+ :min="0"
+ :max="9000"
+ style="width: 250px; font-size: 20px"
+ @focus="clearInput('num')"
+ ></el-input-number>
+ </el-form-item>
+ </el-form>
+
+ <span slot="footer" class="dialog-footer">
+ <el-button @click="dialogVisible3 = false">鍏抽棴</el-button>
+ <el-button type="primary" @click="submitForm">鎻愪氦</el-button>
+ </span>
+ </el-dialog>
+
+ <el-dialog
+ title="缂栬緫"
+ v-model="editdialogVisible"
+ width="30%"
+ @close="edithandleDialogClose"
+ >
+ <el-form :model="editForm" ref="editFormRef" label-width="80px">
+ <el-form-item label="鏁伴噺">
+ <el-input v-model="editForm.pieces"></el-input>
+ </el-form-item>
+ <el-form-item label="鎵规鍙�">
+ <el-input v-model="editForm.batchId"></el-input>
+ </el-form-item>
+ <el-form-item label="闀垮害">
+ <el-input v-model="editForm.rawWidth"></el-input>
+ </el-form-item>
+ <el-form-item label="楂樺害">
+ <el-input v-model="editForm.rawHeight"></el-input>
+ </el-form-item>
+ <el-form-item label="鍘氬害">
+ <el-input v-model="editForm.rawThickness"></el-input>
+ </el-form-item>
+ </el-form>
+
+ <div class="dialog-footer">
+ <el-button @click="editdialogVisible = false">鍙栨秷</el-button>
+ <el-button type="primary" @click="editsaveEdit">淇濆瓨</el-button>
+ </div>
+ </el-dialog>
</div>
</template>
@@ -157,249 +323,365 @@
<script setup>
-import { ref, onMounted, onBeforeUnmount } from 'vue'; // 瀵煎叆 Vue 3 鐨勬ā鍧�
-import * as echarts from 'echarts';
+import { ref, onMounted, onBeforeUnmount,onUnmounted } from "vue"; // 瀵煎叆 Vue 3 鐨勬ā鍧�
+//import * as echarts from 'echarts';
+import { ElMessage, ElMessageBox } from "element-plus";
+// import {tableData} from '@/stores/tableData.js';
+import { WebSocketHost, host } from "@/utils/constants";
+import { initializeWebSocket, closeWebSocket } from "@/utils/WebSocketService";
+import {
+ updateRawUsage,
+ deleteRawUsage,
+ inStorage,
+ outStorage,
+ taskUpdate,
+} from "@/utils/api";
- const loading = ref(false);
- const tableData = ref([
- {
- location: '1',
- type: 'Type A',
- length: '100',
- height: '50',
- thickness: '10',
- quantity: '5',
- entry_time: '2024-06-19',
- batchnumber:"444",
- shelf_status: 1
- },
- {
- location: '2',
- type: 'Type B',
- length: '120',
- height: '60',
- thickness: '12',
- quantity: '10',
- entry_time: '2024-06-18',
- batchnumber:"444",
- shelf_status: 0
- },
- {
- location: '3',
- type: 'Type B',
- length: '120',
- height: '60',
- thickness: '12',
- quantity: '10',
- entry_time: '2024-06-18',
- batchnumber:"444",
- shelf_status: 1
- },
- {
- location: '4',
- type: 'Type B',
- length: '120',
- height: '60',
- thickness: '12',
- quantity: '10',
- entry_time: '2024-06-18',
- batchnumber:"444",
- shelf_status: 1
- },
- {
- location: '5',
- type: 'Type B',
- length: '120',
- height: '60',
- thickness: '12',
- quantity: '10',
- entry_time: '2024-06-18',
- batchnumber:"444",
- shelf_status: 1
- }
- // Add more data as needed
- ]);
-
- const getTagType2 =(status) => {
- switch (status) {
- case 'completed':
- return 'success';
- case 'in-progress':
- return 'info';
- case 'warning':
- return 'warning';
- case 'danger':
- return 'danger';
- default:
- return '';
- }
- }
-
- const getTagType =(status) => {
- return status === 1 ? 'success' : 'danger';
- // 鏍规嵁鐘舵�佸�煎喅瀹氭爣绛剧被鍨嬶紝杩欓噷鍋囪鐘舵�佷负1鏃朵负鎴愬姛锛堢豢鑹诧級锛屽惁鍒欎负澶辫触锛堢孩鑹诧級
- }
-
- const tasktableData=ref([
-
- {
- Glassid: 'G001',
- taskDescription: '浠庡悐瑁呬綅銆�99銆戝埌浠撲綅銆�56銆�',
- taskStatus: 'in-progress',
- glassThickness: '5mm',
- glassFilm: '鑶滅郴A',
- creationTime: '2024-06-19 10:00:00'
- },
- {
- Glassid: 'G002',
- taskDescription: '浠庡悐瑁呬綅銆�99銆戝埌浠撲綅銆�56銆�',
- taskStatus: 'completed',
- glassThickness: '10mm',
- glassFilm: '鑶滅郴B',
- creationTime: '2024-06-19 11:00:00'
- }
- ]);
-
- const dialogVisible = ref(false);
- const formData = ref({
- shelf: '',
- color: '',
- width: '',
- height: '',
- thickness: '',
- quantity: ''
- });
-
- const formData2 = ref({
- dzw: '',
-
- });
-
- const handleEdit = (row) => {
- // 澶勭悊淇敼鏁伴噺閫昏緫
- console.log('Edit Quantity:', row);
- };
-
- const handleDelete = (row) => {
- // 澶勭悊鍒犻櫎閫昏緫
- console.log('Delete:', row);
- };
-
- const handleCheckout = (row) => {
- // 澶勭悊鍑哄簱閫昏緫
- console.log('Checkout:', row);
- };
-
- const handleInbound = () => {
- // 鎵撳紑鍏ュ簱瀵硅瘽妗�
- dialogVisible.value = true;
- };
-
- const handleCloseDialog = () => {
- // 鍏抽棴瀵硅瘽妗嗘椂閲嶇疆琛ㄥ崟鏁版嵁
- formData.value = {
- shelf: '',
- color: '',
- width: '',
- height: '',
- thickness: '',
- quantity: ''
- };
- dialogVisible.value = false;
- };
-
- const handleConfirmInbound = () => {
- // 澶勭悊纭鍏ュ簱閫昏緫锛屽彲浠ュ湪杩欓噷鎻愪氦琛ㄥ崟鎴栬�呮墽琛屽叾浠栨搷浣�
- console.log('Confirm Inbound:', formData.value);
- // 鍏抽棴瀵硅瘽妗�
- dialogVisible.value = false;
- };
-
-
-
- let chartInstance = null;
-
-onMounted(() => {
- // Initialize the chart
- chartInstance = echarts.init(document.getElementById('chart'));
-
- // Simulated data for demonstration
- const chartData = {
- labels: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'],
- datasets: [
- { name: '浣跨敤鎯呭喌缁熻', data: [{ remaining: 4, total: 5 }, { remaining: 9, total: 10 }, { remaining: 0, total: 30 }, { remaining: 0, total: 10 },{ remaining: 4, total: 5 }] }
- ]
- };
-
- const options = {
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'shadow'
- }
- },
- legend: {
- data: ['浣跨敤鎯呭喌缁熻']
- },
- xAxis: {
- type: 'category',
- data: chartData.labels
- },
- yAxis: {
- type: 'value'
- },
- series: chartData.datasets.map(item => ({
- name: item.name,
- type: 'bar',
- stack: '鎬婚噺',
- label: {
- show: true,
- position: 'inside',
- formatter: '{c}%'
- },
- data: item.data.map(dataItem => ({
- value: (dataItem.remaining / dataItem.total * 100).toFixed(2), // 璁$畻鍓╀綑閲忓崰姣旓紝淇濈暀涓や綅灏忔暟
- remaining: dataItem.remaining,
- total: dataItem.total,
- itemStyle: {
- color: getColorByRemaining(dataItem.remaining, dataItem.total)
- }
- }))
- }))
- };
-
- function getColorByRemaining(remaining, total) {
- // 鏍规嵁鍓╀綑閲忎笌鎬婚噺鐨勬瘮渚嬶紝璁剧疆涓嶅悓鐨勯鑹查�昏緫
- const percentage = remaining / total;
- if (percentage >= 0.8) {
- return '#FF6666'; // Red
- } else if (percentage >= 0.5) {
- return '#FFCC66'; // Yellow
- } else {
- return '#66CC66'; // Green
- }
- }
-
- // Set options and render chart
- if (chartInstance) {
- chartInstance.setOption(options);
- }
-});
-
-onBeforeUnmount(() => {
- if (chartInstance) {
- chartInstance.dispose();
- chartInstance = null;
- }
-});
-
-const handleSelectionChange = (selection) => {
- console.log('Selection changed:', selection);
+const loading = ref(false);
+const Hidden = ref(false);
+const tableData = ref([]);
+const totalItems = ref(0);
+totalItems.value = 10;
+const pageSize = 10;
+let currentPage = ref(1);
+const handleCurrentChange = (val) => {
+ currentPage.value = val;
};
-
+const formatTaskType = (row, column) => {
+ if (row.taskType === "浠庝粨浣嶅埌鍚婅浣�") {
+ return `浠庝粨浣�${row.shelfRack}鍒板悐瑁呬綅${row.loadRack}`;
+ } else if (row.taskType === "浠庝粨浣嶅埌涓婄墖浣�") {
+ return `浠庝粨浣�${row.shelfRack}鍒颁笂鐗囦綅${row.loadRack}`;
+ } else if (row.taskType === "浠庝笂鐗囦綅鍒颁粨浣�") {
+ return `浠庝笂鐗囦綅${row.loadRack}鍒颁粨浣�${row.shelfRack}`;
+ } else if (row.taskType === "浠庡悐瑁呬綅鍒颁粨浣�") {
+ return `浠庡悐瑁呬綅${row.loadRack}鍒颁粨浣�${row.shelfRack}`;
+ }
+};
+const getTagType2 = (status) => {
+ switch (status) {
+ case "completed":
+ return "success";
+ case "in-progress":
+ return "info";
+ case "warning":
+ return "warning";
+ case "danger":
+ return "danger";
+ default:
+ return "";
+ }
+};
+const getTagType = (status) => {
+ return status === 1 ? "success" : "danger";
+ // 鏍规嵁鐘舵�佸�煎喅瀹氭爣绛剧被鍨嬶紝杩欓噷鍋囪鐘舵�佷负1鏃朵负鎴愬姛锛堢豢鑹诧級锛屽惁鍒欎负澶辫触锛堢孩鑹诧級
+};
+const toggleStatus = (row) => {
+ // 鍒囨崲鏂欐灦鐘舵�佺殑閫昏緫
+ row.enableState = 1 - row.enableState; // Toggle between 0 and 1
+ // 姝ゅ鍙互娣诲姞淇濆瓨鐘舵�佺殑閫昏緫锛屾瘮濡傝皟鐢� API 鏇存柊鏁版嵁
+};
+let socket = null;
+const socketUrl = `ws://${window.ipConfig.serverUrl}/api/glassStorage/api/talk/storageTask`;
+// 瀹氫箟娑堟伅澶勭悊鍑芥暟锛屾洿鏂� receivedData 鍙橀噺
+const handleMessage = (data) => {
+ // 鏇存柊 tableData 鐨勬暟鎹�
+ tableData.value = data.rack[0]; // 鍋囪 tableData 鏄搷搴斿紡瀵硅薄鎴栧彉閲�
+ tableData.value.forEach((item) => {
+ // 鑾峰彇 createTime 鐨勬椂闂存埑
+ const createTimeTimestamp = item.createTime;
+ // 鍒涘缓鏃ユ湡瀵硅薄
+ const date = new Date(createTimeTimestamp);
+ // 鏍煎紡鍖栨棩鏈熸椂闂翠负鏈湴鏍煎紡
+ const formattedDateTime = date.toLocaleString();
+ // 鏇挎崲鍘熸潵鐨� createTime 瀛楁涓烘牸寮忓寲鍚庣殑鏃ユ湡鏃堕棿瀛楃涓�
+ item.createTime = formattedDateTime;
+ });
+ tasktableData.value = data.tasks[0]; // 鍋囪 tasktableData 鏄搷搴斿紡瀵硅薄鎴栧彉閲�
+ tasktableData.value.forEach((item) => {
+ // 鑾峰彇 createTime 鐨勬椂闂存埑
+ const createTimeTimestamp = item.startTime;
+ // 鍒涘缓鏃ユ湡瀵硅薄
+ const date = new Date(createTimeTimestamp);
+ // 鏍煎紡鍖栨棩鏈熸椂闂翠负鏈湴鏍煎紡
+ const formattedDateTime = date.toLocaleString();
+ // 鏇挎崲鍘熸潵鐨� createTime 瀛楁涓烘牸寮忓寲鍚庣殑鏃ユ湡鏃堕棿瀛楃涓�
+ item.startTime = formattedDateTime;
+ });
+};
+onMounted(() => {
+ socket = initializeWebSocket(socketUrl, handleMessage);
+});
+ onUnmounted(() => {
+ if (socket) {
+ closeWebSocket(socket);
+ }
+ });
+onBeforeUnmount(() => {
+ closeWebSocket();
+});
+const tasktableData = ref([]);
+const dialogVisible = ref(false);
+const formData = ref({
+ number: "",
+ color: "",
+ rawWidth: "",
+ rawHeight: "",
+ rawThickness: "",
+ pieces: "",
+ loadRack: 1,
+});
+const formData2 = ref({
+ dzw: "",
+});
+const handleDelete = (row) => {
+ // 浣跨敤 Element UI 鐨� MessageBox.confirm 鏂规硶杩涜浜屾纭
+ ElMessageBox.confirm("纭畾瑕佹墽琛屽垹闄ゆ搷浣滃悧锛�", "纭鍒犻櫎", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ // 鐐瑰嚮纭鎸夐挳鐨勫洖璋冿紝鎵ц鍑哄簱鎿嶄綔
+ const intNumber = {
+ id: parseInt(row.number),
+ };
+ deleteRawUsage(intNumber);
+ console.log("鎵ц鍒犻櫎鎿嶄綔");
+ })
+ .catch(() => {
+ // 鐐瑰嚮鍙栨秷鎸夐挳鐨勫洖璋冿紝涓嶆墽琛屼换浣曟搷浣�
+ console.log("鍙栨秷鍒犻櫎鎿嶄綔");
+ });
+};
+const handleCheckout = (row) => {
+ // 浣跨敤 Element UI 鐨� MessageBox.confirm 鏂规硶杩涜浜屾纭
+ ElMessageBox.confirm("纭畾瑕佹墽琛屽嚭搴撴搷浣滃悧锛�", "纭鍑哄簱", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ // 鐐瑰嚮纭鎸夐挳鐨勫洖璋冿紝鎵ц鍑哄簱鎿嶄綔
+ const raw={
+ number:parseInt(row.number),
+ loadRack:2
+ }
+ outStorage(raw)
+ console.log("鎵ц鍑哄簱鎿嶄綔", row);
+ })
+ .catch(() => {
+ // 鐐瑰嚮鍙栨秷鎸夐挳鐨勫洖璋冿紝涓嶆墽琛屼换浣曟搷浣�
+ console.log("鍙栨秷鍑哄簱鎿嶄綔");
+ });
+};
+const handleInbound = () => {
+ // 鎵撳紑鍏ュ簱瀵硅瘽妗�
+ dialogVisible.value = true;
+};
+const storage = () => {
+ // 鎵撳紑鍏ュ簱瀵硅瘽妗�
+ Hidden.value = true;
+};
+const handleCloseDialog = () => {
+ // 鍏抽棴瀵硅瘽妗嗘椂閲嶇疆琛ㄥ崟鏁版嵁
+ formData.value = {
+ number: "",
+ color: "",
+ rawWidth: "",
+ rawHeight: "",
+ rawThickness: "",
+ pieces: "",
+ };
+ dialogVisible.value = false;
+};
+const handleConfirmInbound = () => {
+ inStorage(formData.value);
+ // 澶勭悊纭鍏ュ簱閫昏緫锛屽彲浠ュ湪杩欓噷鎻愪氦琛ㄥ崟鎴栬�呮墽琛屽叾浠栨搷浣�
+ // 鍏抽棴瀵硅瘽妗�
+ dialogVisible.value = false;
+};
+const dialogVisible3 = ref(false);
+const colors = ref([
+ { "0_glass_id": "Red" },
+ { "0_glass_id": "Green" },
+ { "0_glass_id": "Blue" },
+ // Add more colors as needed
+]);
+const formData3 = ref({
+ selectedColor: "",
+ wid: "",
+ heig: "",
+ thinkness: "",
+ num: "",
+});
+const addglass = () => {
+ // 鎵撳紑鍏ュ簱瀵硅瘽妗�
+ dialogVisible3.value = true;
+};
+const handleCommand = (command) => {
+ formData.value.selectedColor = command;
+};
+const clearInput = (field) => {
+ formData.value[field] = "";
+};
+const submitForm = () => {
+ dialogVisible3.value = false;
+ // Add your submit logic here
+};
+const editdialogVisible = ref(false);
+const editForm = ref({
+ id: "",
+ pieces: "",
+ batchId: "",
+ rawWidth: "",
+ rawHeight: "",
+ rawThickness: "",
+});
+const editFormRef = ref(null);
+let currentRow = ref(null);
+// 澶勭悊琛岀偣鍑讳簨浠�
+const edithandleRowClick = (row) => {
+ currentRow.value = row;
+ editForm.value.pieces = row.pieces.toString();
+ editForm.value.batchId = row.batchId;
+ editForm.value.rawWidth = row.rawWidth;
+ editForm.value.rawHeight = row.rawHeight;
+ editForm.value.rawThickness = row.rawThickness;
+ editForm.value.id = row.number;
+ editdialogVisible.value = true;
+};
+// 娣诲姞淇濆瓨缂栬緫鍐呭
+const editsaveEdit = () => {
+ if (!currentRow.value) return;
+ // 鏇存柊褰撳墠琛屾暟鎹�
+ currentRow.value.pieces = editForm.value.pieces;
+ currentRow.value.batchId = editForm.value.batchId;
+ currentRow.value.rawWidth = editForm.value.rawWidth;
+ currentRow.value.rawHeight = editForm.value.rawHeight;
+ currentRow.value.rawThickness = editForm.value.rawThickness;
+ // 璋冪敤鏇存柊鍑芥暟锛屽苟澶勭悊鍏惰繑鍥炵殑 Promise
+ updateRawUsage(editForm.value);
+ // 鍏抽棴瀵硅瘽妗�
+ editdialogVisible.value = false;
+};
+// 瀵硅瘽妗嗗叧闂椂閲嶇疆缂栬緫琛ㄥ崟鍜屽綋鍓嶈鏁版嵁
+const edithandleDialogClose = () => {
+ editForm.value.pieces = "";
+ editForm.value.batchId = "";
+ editForm.value.rawWidth = "";
+ editForm.value.rawHeight = "";
+ editForm.value.rawThickness = "";
+ currentRow.value = null;
+};
+const handleRestart = (row) => {
+ // 浣跨敤 Element UI 鐨� MessageBox.confirm 鏂规硶杩涜浜屾纭
+ ElMessageBox.confirm("纭畾瑕佹墽琛岄噸鏂板紑濮嬫搷浣滃悧锛�", "纭閲嶆柊寮�濮�", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ const taskdata={
+ id:row.id,
+ Type:"閲嶆柊寮�濮�"
+ }
+ taskUpdate(taskdata);
+ console.log("鎵ц閲嶆柊寮�濮嬫搷浣�", row);
+ })
+ .catch(() => {
+ // 鐐瑰嚮鍙栨秷鎸夐挳鐨勫洖璋冿紝涓嶆墽琛屼换浣曟搷浣�
+ console.log("鍙栨秷閲嶆柊寮�濮嬫搷浣�");
+ });
+};
+const handleDeletetask = (row) => {
+ // 浣跨敤 Element UI 鐨� MessageBox.confirm 鏂规硶杩涜浜屾纭
+ ElMessageBox.confirm("纭畾瑕佹墽琛屽垹闄や换鍔℃搷浣滃悧锛�", "纭鍒犻櫎浠诲姟", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ // 鐐瑰嚮纭鎸夐挳鐨勫洖璋�
+ const taskdata={
+ id:row.id,
+ Type:"鍒犻櫎"
+ }
+ taskUpdate(taskdata);
+ console.log("鎵ц鍒犻櫎浠诲姟鎿嶄綔", row);
+ })
+ .catch(() => {
+ // 鐐瑰嚮鍙栨秷鎸夐挳鐨勫洖璋冿紝涓嶆墽琛屼换浣曟搷浣�
+ console.log("鍙栨秷鍒犻櫎浠诲姟鎿嶄綔");
+ });
+};
+const handleComplete = (row) => {
+ // 浣跨敤 Element UI 鐨� MessageBox.confirm 鏂规硶杩涜浜屾纭
+ ElMessageBox.confirm("纭畾瑕佹墽琛屼换鍔″畬鎴愭搷浣滃悧锛�", "纭浠诲姟瀹屾垚", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ const taskdata={
+ id:row.id,
+ Type:"瀹屾垚"
+ }
+ taskUpdate(taskdata);
+ // 鐐瑰嚮纭鎸夐挳鐨勫洖璋�
+ console.log("鎵ц浠诲姟瀹屾垚鎿嶄綔", row);
+ })
+ .catch(() => {
+ // 鐐瑰嚮鍙栨秷鎸夐挳鐨勫洖璋冿紝涓嶆墽琛屼换浣曟搷浣�
+ console.log("鍙栨秷浠诲姟瀹屾垚鎿嶄綔");
+ });
+};
</script>
-
-<style>
-
-</style>
+<style scoped>
+#dt {
+ display: block;
+ float: left;
+ line-height: 20px;
+ margin-left: 100px;
+}
+#dta {
+ display: block;
+ float: left;
+ line-height: 20px;
+ margin-left: 80%;
+}
+#dialog-footer {
+ text-align: center;
+ margin-top: -15px;
+}
+.img-ypcc {
+ margin-left: 80px;
+ background-image: url("/ypcc.png");
+ background-repeat: no-repeat;
+ background-attachment: local;
+ min-height: 600px;
+ width: 1400px;
+ max-width: 100%;
+ background-size: 1400px 600px;
+ overflow: hidden;
+ position: relative;
+ margin-top: 0px;
+}
+.img-car1 {
+ background-image: url("/ypccche.png");
+ position: absolute;
+ background-repeat: no-repeat;
+ background-attachment: local;
+ min-height: 400px;
+ width: 200px;
+ max-width: 100%;
+ background-size: 200px 170px;
+ overflow: hidden;
+ position: relative;
+}
+.custom-dialog {
+ max-height: 90vh; /* 鏈�澶ч珮搴︿负瑙嗗彛楂樺害鐨�90% */
+ overflow-y: auto; /* 瀵硅瘽妗嗗唴閮ㄥ嚭鐜板瀭鐩存粴鍔ㄦ潯 */
+}
+</style>
\ No newline at end of file
--
Gitblit v1.8.0