Selaa lähdekoodia

修改库位界面,开始编写库位规则

flower_mr 1 kuukausi sitten
vanhempi
commit
12941f9e4c

BIN
db.sqlite3


+ 42 - 0
logs/error.log

@@ -2216,3 +2216,45 @@ Traceback (most recent call last):
   File "D:\Document\code\vue\greater_wms\.\container\serializers.py", line 180, in get_task_wcs
     from wcs.serializers import TaskGetSerializer
 ModuleNotFoundError: No module named 'wcs'
+[2025-04-14 10:31:07,843][django.request.log_response():241] [ERROR] Internal Server Error: /container/container_wcs
+Traceback (most recent call last):
+  File "d:\language\python38\lib\site-packages\asgiref\sync.py", line 472, in thread_handler
+    raise exc_info[1]
+  File "d:\language\python38\lib\site-packages\django\core\handlers\exception.py", line 42, in inner
+    response = await get_response(request)
+  File "d:\language\python38\lib\site-packages\django\utils\deprecation.py", line 148, in __acall__
+    response = await sync_to_async(
+  File "d:\language\python38\lib\site-packages\asgiref\sync.py", line 435, in __call__
+    ret = await asyncio.wait_for(future, timeout=None)
+  File "d:\language\python38\lib\asyncio\tasks.py", line 455, in wait_for
+    return await fut
+  File "d:\language\python38\lib\concurrent\futures\thread.py", line 57, in run
+    result = self.fn(*self.args, **self.kwargs)
+  File "d:\language\python38\lib\site-packages\asgiref\sync.py", line 476, in thread_handler
+    return func(*args, **kwargs)
+  File "d:\language\python38\lib\site-packages\django\middleware\common.py", line 54, in process_request
+    path = self.get_full_path_with_slash(request)
+  File "d:\language\python38\lib\site-packages\django\middleware\common.py", line 88, in get_full_path_with_slash
+    raise RuntimeError(
+RuntimeError: You called this URL via POST, but the URL doesn't end in a slash and you have APPEND_SLASH set. Django can't redirect to the slash URL while maintaining POST data. Change your form to point to 192.168.18.69:8008/container/container_wcs/ (note the trailing slash), or set APPEND_SLASH=False in your Django settings.
+[2025-04-14 14:23:37,444][django.request.log_response():241] [ERROR] Internal Server Error: /container/container_wcs
+Traceback (most recent call last):
+  File "d:\language\python38\lib\site-packages\asgiref\sync.py", line 472, in thread_handler
+    raise exc_info[1]
+  File "d:\language\python38\lib\site-packages\django\core\handlers\exception.py", line 42, in inner
+    response = await get_response(request)
+  File "d:\language\python38\lib\site-packages\django\utils\deprecation.py", line 148, in __acall__
+    response = await sync_to_async(
+  File "d:\language\python38\lib\site-packages\asgiref\sync.py", line 435, in __call__
+    ret = await asyncio.wait_for(future, timeout=None)
+  File "d:\language\python38\lib\asyncio\tasks.py", line 455, in wait_for
+    return await fut
+  File "d:\language\python38\lib\concurrent\futures\thread.py", line 57, in run
+    result = self.fn(*self.args, **self.kwargs)
+  File "d:\language\python38\lib\site-packages\asgiref\sync.py", line 476, in thread_handler
+    return func(*args, **kwargs)
+  File "d:\language\python38\lib\site-packages\django\middleware\common.py", line 54, in process_request
+    path = self.get_full_path_with_slash(request)
+  File "d:\language\python38\lib\site-packages\django\middleware\common.py", line 88, in get_full_path_with_slash
+    raise RuntimeError(
+RuntimeError: You called this URL via POST, but the URL doesn't end in a slash and you have APPEND_SLASH set. Django can't redirect to the slash URL while maintaining POST data. Change your form to point to 192.168.18.69:8008/container/container_wcs/ (note the trailing slash), or set APPEND_SLASH=False in your Django settings.

+ 62 - 0
logs/server.log

@@ -2386,3 +2386,65 @@ ModuleNotFoundError: No module named 'wcs'
 [2025-04-11 17:09:05,898][django.request.log_response():241] [WARNING] Not Found: /cyclecount/qtyrecorviewset/
 [2025-04-11 17:13:22,002][django.request.log_response():241] [WARNING] Not Found: /cyclecount/qtyrecorviewset/
 [2025-04-11 17:22:01,608][django.request.log_response():241] [WARNING] Not Found: //stock/management/
+[2025-04-14 10:31:07,843][django.request.log_response():241] [ERROR] Internal Server Error: /container/container_wcs
+Traceback (most recent call last):
+  File "d:\language\python38\lib\site-packages\asgiref\sync.py", line 472, in thread_handler
+    raise exc_info[1]
+  File "d:\language\python38\lib\site-packages\django\core\handlers\exception.py", line 42, in inner
+    response = await get_response(request)
+  File "d:\language\python38\lib\site-packages\django\utils\deprecation.py", line 148, in __acall__
+    response = await sync_to_async(
+  File "d:\language\python38\lib\site-packages\asgiref\sync.py", line 435, in __call__
+    ret = await asyncio.wait_for(future, timeout=None)
+  File "d:\language\python38\lib\asyncio\tasks.py", line 455, in wait_for
+    return await fut
+  File "d:\language\python38\lib\concurrent\futures\thread.py", line 57, in run
+    result = self.fn(*self.args, **self.kwargs)
+  File "d:\language\python38\lib\site-packages\asgiref\sync.py", line 476, in thread_handler
+    return func(*args, **kwargs)
+  File "d:\language\python38\lib\site-packages\django\middleware\common.py", line 54, in process_request
+    path = self.get_full_path_with_slash(request)
+  File "d:\language\python38\lib\site-packages\django\middleware\common.py", line 88, in get_full_path_with_slash
+    raise RuntimeError(
+RuntimeError: You called this URL via POST, but the URL doesn't end in a slash and you have APPEND_SLASH set. Django can't redirect to the slash URL while maintaining POST data. Change your form to point to 192.168.18.69:8008/container/container_wcs/ (note the trailing slash), or set APPEND_SLASH=False in your Django settings.
+[2025-04-14 11:02:54,042][django.request.log_response():241] [WARNING] Not Found: /cyclecount/qtyrecorviewset/
+[2025-04-14 14:23:37,444][django.request.log_response():241] [ERROR] Internal Server Error: /container/container_wcs
+Traceback (most recent call last):
+  File "d:\language\python38\lib\site-packages\asgiref\sync.py", line 472, in thread_handler
+    raise exc_info[1]
+  File "d:\language\python38\lib\site-packages\django\core\handlers\exception.py", line 42, in inner
+    response = await get_response(request)
+  File "d:\language\python38\lib\site-packages\django\utils\deprecation.py", line 148, in __acall__
+    response = await sync_to_async(
+  File "d:\language\python38\lib\site-packages\asgiref\sync.py", line 435, in __call__
+    ret = await asyncio.wait_for(future, timeout=None)
+  File "d:\language\python38\lib\asyncio\tasks.py", line 455, in wait_for
+    return await fut
+  File "d:\language\python38\lib\concurrent\futures\thread.py", line 57, in run
+    result = self.fn(*self.args, **self.kwargs)
+  File "d:\language\python38\lib\site-packages\asgiref\sync.py", line 476, in thread_handler
+    return func(*args, **kwargs)
+  File "d:\language\python38\lib\site-packages\django\middleware\common.py", line 54, in process_request
+    path = self.get_full_path_with_slash(request)
+  File "d:\language\python38\lib\site-packages\django\middleware\common.py", line 88, in get_full_path_with_slash
+    raise RuntimeError(
+RuntimeError: You called this URL via POST, but the URL doesn't end in a slash and you have APPEND_SLASH set. Django can't redirect to the slash URL while maintaining POST data. Change your form to point to 192.168.18.69:8008/container/container_wcs/ (note the trailing slash), or set APPEND_SLASH=False in your Django settings.
+[2025-04-14 14:26:16,321][django.request.log_response():241] [WARNING] Bad Request: /container/container_wcs/
+[2025-04-14 15:08:27,441][django.request.log_response():241] [WARNING] Bad Request: /container/container_wcs/
+[2025-04-14 15:09:33,564][django.request.log_response():241] [WARNING] Bad Request: /container/container_wcs/
+[2025-04-14 15:11:12,548][django.request.log_response():241] [WARNING] Bad Request: /container/container_wcs/
+[2025-04-14 16:00:50,018][django.request.log_response():241] [WARNING] Not Found: /cyclecount/qtyrecorviewset/
+[2025-04-14 16:09:59,992][django.request.log_response():241] [WARNING] Not Found: /cyclecount/qtyrecorviewset/
+[2025-04-14 16:10:25,210][django.request.log_response():241] [WARNING] Not Found: /cyclecount/qtyrecorviewset/
+[2025-04-14 16:11:53,879][django.request.log_response():241] [WARNING] Not Found: /stock/list/
+[2025-04-14 16:12:10,185][django.request.log_response():241] [WARNING] Not Found: /cyclecount/qtyrecorviewset/
+[2025-04-14 16:12:17,381][django.request.log_response():241] [WARNING] Not Found: /dn/list/
+[2025-04-14 16:15:06,585][django.request.log_response():241] [WARNING] Not Found: /stock/list/
+[2025-04-14 16:15:20,958][django.request.log_response():241] [WARNING] Not Found: /cyclecount/qtyrecorviewset/
+[2025-04-14 16:15:28,579][django.request.log_response():241] [WARNING] Not Found: /dn/list/
+[2025-04-14 17:35:56,492][django.request.log_response():241] [WARNING] Not Found: /cyclecount/qtyrecorviewset/
+[2025-04-14 17:36:27,944][django.request.log_response():241] [WARNING] Not Found: /cyclecount/qtyrecorviewset/
+[2025-04-14 17:37:01,922][django.request.log_response():241] [WARNING] Not Found: /cyclecount/qtyrecorviewset/
+[2025-04-14 17:38:22,962][django.request.log_response():241] [WARNING] Not Found: /cyclecount/qtyrecorviewset/
+[2025-04-14 22:12:51,949][django.request.log_response():241] [WARNING] Not Found: /cyclecount/qtyrecorviewset/
+[2025-04-14 22:24:10,438][django.request.log_response():241] [WARNING] Not Found: /cyclecount/qtyrecorviewset/

+ 1 - 0
shelflist.sql

@@ -1,3 +1,4 @@
+-- database: db.sqlite3
 
 
 

+ 2 - 2
templates/src/boot/axios_request.js

@@ -12,8 +12,8 @@ function getBaseUrl (name) {
   xhr.send(null)
   return xhr.status === okStatus ? xhr.responseText : null
 }
-
-const baseurl = 'http://192.168.31.242:8008'
+// 注意以后修改成服务器的地址
+const baseurl = "http://127.0.0.1:8008"
 
 const axiosInstance = axios.create({
   baseURL: baseurl,

+ 1 - 1
templates/src/boot/bus.js

@@ -1,2 +1,2 @@
 import Vue from 'vue'
-export default new Vue;
+export default new Vue;

+ 22 - 54
templates/src/components/goodscard.vue

@@ -1,12 +1,6 @@
 <template>
-    <div class="goodscard " :style="{ backgroundColor: bgColor }">
-
-        <!-- 行: {{ rowIndex }} 列: {{ colIndex }} -->
-
-        <q-btn dense flat @click=handleclick() class="full-height full-width"
-            style="height: 100%; width: 100%; padding: 0; margin: 0">
-        </q-btn>
-
+    <div  :style="{ backgroundColor: bgColor }">
+        <div style="color: transparent;"></div>
         <q-dialog v-model="clickedinput" transition-show="jump-down" transition-hide="jump-up">
             <q-card style="min-width: 350px; ">
                 <q-bar class="bg-light-blue-10 text-white rounded-borders" style="height: 50px">
@@ -284,7 +278,6 @@ export default {
         layerIndex: Number,
         goodsData: Object,
 
-
     },
     data() {
         return {
@@ -351,7 +344,7 @@ export default {
             storage_dialog: false,
             elevator_dialog: false,
             conveyor_dialog: false,
-            bgColor: "#808080",
+            bgColor: "transparent",
             selected: { label: '请选择一个选项', value: 'undefined' },
             shelf_type: { shelf_type: 'undefined' },
             ip_change: { ip_address: '192.168.1.100', port: 8080, status: 'offline' },
@@ -368,11 +361,12 @@ export default {
     },
     created() {
         this.shelfLocal = this.goodsData.shelf_type;
+       
+        this.handleclick()
 
 
-        // console.log('测试数据:', this.inventoryDetails)
-
     },
+
     methods: {
         deleteInventoryDetail() {
 
@@ -416,7 +410,7 @@ export default {
 
         },
         handleclick() {
-
+            console.log('点击')
             if (this.shelfLocal == "undefined") { this.clickedinput = true, this.storage_dialog = false, this.elevator_dialog = false, this.conveyor_dialog = false }
             if (this.shelfLocal == "storage") { this.getList(), this.clickedinput = false, this.storage_dialog = true, this.elevator_dialog = false, this.conveyor_dialog = false }
             if (this.shelfLocal == "elevator") { this.getList(), this.clickedinput = false, this.storage_dialog = false, this.elevator_dialog = true, this.conveyor_dialog = false }
@@ -433,8 +427,6 @@ export default {
                     this.ip_change.port = this.elevator_form.port
                     this.ip_change.status = this.elevator_form.status
                     putauth(this.pathname + this.goodsData.id + '/', this.ip_change)
-
-
                 }
                 if (this.shelfLocal == "conveyor") {
                     this.ip_change.ip_address = this.conveyor_form.ip
@@ -493,20 +485,20 @@ export default {
             this.getList()
 
         },
-        bgColorchanger() {
-            if (this.shelfLocal == "undefined") {
-                this.bgColor = "#808080" //灰色
-            }
-            if (this.shelfLocal == "elevator") {
-                this.bgColor = "#4CAF50" //绿色
-            }
-            if (this.shelfLocal == "conveyor") {
-                this.bgColor = "#FF9800" //橙色
-            }
-            if (this.shelfLocal == "storage") {
-                this.bgColor = "#008CBA" //蓝色
-            }
-        },
+        // bgColorchanger() {
+        //     if (this.shelfLocal == "undefined") {
+        //         this.bgColor = "#808080" //灰色
+        //     }
+        //     if (this.shelfLocal == "elevator") {
+        //         this.bgColor = "#4CAF50" //绿色
+        //     }
+        //     if (this.shelfLocal == "conveyor") {
+        //         this.bgColor = "#FF9800" //橙色
+        //     }
+        //     if (this.shelfLocal == "storage") {
+        //         this.bgColor = "#008CBA" //蓝色
+        //     }
+        // },
         getList() {
             var _this = this;
             getauth(_this.pathname + _this.goodsData.id + '/')
@@ -549,36 +541,12 @@ export default {
                     });
                 });
         },
-    },
-    watch: {
-        shelfLocal: function (val) {
-            console.log(val)
-            this.bgColorchanger()
-        },
-        goodsData: function (val) {
-            this.shelfLocal = this.goodsData.shelf_type
-            this.bgColorchanger()
-
-        }
-    },
-    mounted() { }
-
-
+    }
 }
 
 </script>
 
 <style scoped>
-.goodscard {
-    border: 1px solid #ddd;
-    border-radius: 8px;
-    height: 100%;
-    width: 100%;
-    background-size: contain;
-    background-repeat: no-repeat;
-    /* background-image: url("/statics/stock/shelfbox.png"); */
-    background-blend-mode: multiply;
-}
 
 
 

+ 110 - 122
templates/src/pages/stock/management.vue

@@ -2,38 +2,10 @@
     <div>
         <q-toolbar class="row items-center ">
             <q-btn-group push class="btn-group">
-                <q-btn-dropdown :label="$t('stock.management_setting')" icon="img:statics/warehouse/binset.png"
-                    @click="handle_setting()">
-                    <div class="row no-wrap q-pa-md">
-                        <div class="column" style="width: 140px">
-                            <q-input flat rounded class="full-width" align="left" :label="$t('stock.shelf_layer')"
-                                v-model="shelf.layer_input"></q-input>
-                            <q-input flat rounded class="full-width" align="left" :label="$t('stock.shelf_row')"
-                                v-model="shelf.row_input"></q-input>
-                            <q-input flat rounded class="full-width" align="left" :label="$t('stock.shelf_col')"
-                                v-model="shelf.col_input"></q-input>
-
-                        </div>
-                        <div class="column" style="width: 140px">
-                            <q-input flat rounded class="full-width" align="left" :label="$t('stock.shelf.shelf_name')"
-                                v-model="shelf_name"></q-input>
-                            <q-input flat rounded class="full-width" align="left"
-                                :label="$t('stock.shelf.shelf_warehouse')" v-model="warehouse_name" readonly></q-input>
-                            <q-input flat rounded class="full-width" align="left"
-                                :label="$t('warehouse.view_warehouse.warehouse_code')" v-model="warehouse_code"
-                                readonly></q-input>
-
-                        </div>
-
-                        <q-btn label='确定更正' color="primary" @click="postrcl()" />
-                    </div>
-                </q-btn-dropdown>
-
                 <q-btn :label="$t('stock.shelf.shelf_up')" icon="upload" @click="handleShelfUp()" />
                 <div class="self-center text-center q-px-sm">
                     {{ $t('stock.layertip') }}
                 </div>
-
                 <q-input dense color="primary" v-model="shelf.layer_now" style="width: 50px;" />
                 <q-btn :label="$t('stock.shelf.shelf_down')" icon="download" @click="handleShelfDown()" />
                 <q-btn :label="$t('refresh')" icon="refresh" @click="reFresh()">
@@ -44,10 +16,19 @@
                 </q-btn>
                 <q-separator />
                 <q-btn :label="$t('stock.edit')" icon="edit" @click="handle_edit()" />
+                
             </q-btn-group>
-
+            <goodscard 
+                v-if="showInventoryDetails"
+                ref ="goodscard"
+                :col-index="select_Inventory.colIndex"
+                :row-index="select_Inventory.rowIndex"
+                :layer-index="select_Inventory.layerIndex"
+                :goods-data="select_Inventory.goods_data"
+                @close="showInventoryDetails = false"
+                 
+        />
         </q-toolbar>
-
         <q-page class="q-pa-md ">
             <div class="grid-system">
                 <!-- Y轴 -->
@@ -76,22 +57,28 @@
 
                 <!-- 网格系统 -->
                 <div class="grid-container">
-
-
                     <!-- 内容层 -->
                     <div class="grid-content">
-                        <div v-for="(row, index) in shelf.rows"  :key="`row-${rowIndex}|${shelf.layer_now}`" class="grid-row">
-                            <div v-for="col in shelf.cols"  :key="`col-${colIndex}|${shelf.layer_now}`" class="grid-item">
-                                <q-btn 
-                                    :key="`${shelf.rows - index}-${col}-${shelf.layer_now}`"
-                                    :row-index="shelf.rows - index" :col-index="col"
-                                    :layer-index="shelf.layer_now"
-                                    :goods-data="goodsMatrix[shelf.rows - index-1][col-1]"
-                                    />
+                        <div v-for="(row, rowIndex) in shelf.rows" :key="`row-${rowIndex}|${shelf.layer_now}`" class="grid-row">
+                            <div v-for="(col, colIndex) in shelf.cols" :key="`col-${colIndex}|${shelf.layer_now}`" class="grid-item">
+                                <q-btn
+                                    v-if="shouldShowButton(
+                                        shelf.rows - rowIndex, 
+                                        colIndex + 1, 
+                                        shelf.layer_now
+                                        )"
+                                    :key="`${shelf.rows - rowIndex}-${col}-${shelf.layer_now}`"
+                                    :style="{
+                                        width: 'var(--cell-d)',
+                                        height: 'var(--cell-d)',
+                                        backgroundColor: getBinColor(shelf.rows - rowIndex, colIndex+1, shelf.layer_now)
+                                    }"
+                                    @click="handleBinClick(shelf.rows - rowIndex, colIndex+1, shelf.layer_now)"
+                                />
                                 <q-tooltip content-class="bg-amber text-black shadow-4" :offset="[20, 20]"
                                     content-style="font-size: 10px">
-                                    {{ $t('stock.rowtip') }} {{ shelf.rows - index }}
-                                    {{ $t('stock.coltip') }} {{ col }}
+                                    {{ $t('stock.rowtip') }} {{ shelf.rows - rowIndex }}
+                                    {{ $t('stock.coltip') }} {{ colIndex + 1 }}
                                 </q-tooltip>
                             </div>
                         </div>
@@ -100,11 +87,16 @@
             </div>
         </q-page>
 
+        
     </div>
+ 
+
+    
 </template>
 
 <script>
 import goodscard from 'components/goodscard.vue'
+
 import { LocalStorage } from 'quasar'
 import { getauth, postauth, putauth, deleteauth, getfile } from 'boot/axios_request'
 
@@ -124,33 +116,49 @@ export default {
                 cols: 29,           // 控制列数
                 layers: 3,      // 控制层数
                 layer_now: 1, // 当前层数
-                row_input: "17",
-                col_input: "29",
-                layer_input: `3`,
             },
-
             filter: "",
             auth_edit: false,
             goodsMap: {},      // 坐标映射表
-            goodsMatrix: []    // 二维数据矩阵
-
+            goodsMatrix: [] ,   // 二维数据矩阵
+   
+            // 颜色配置
+            binColors: {
+            elevator: 'rgba(255, 215, 0, 0.5)',  // 黄色半透明
+            storage: "#4CAF50" ,//绿色,  // 蓝色低透明度
+            occupied: '#32CD3280',  // 绿色带透明度(HEX 8位格式)
+            default: 'transparent' ,  // 完全透明
+            } ,
+            showInventoryDetails : false, // 显示库存详情
+            select_Inventory: {
+                rowIndex : 0,
+                colIndex : 0,
+                layerIndex : 0,
+                goods_data : {}
+            }
         }
     },
+    // 修正后的路由守卫
+    beforeRouteEnter(to, from, next) {
+        next(vm => {
+            // 使用 vm 访问组件实例
+            vm.goodsMatrix = []
+            vm.selectedBin = null
+            vm.goodsMap = {}
+        })
+    },
+    // beforeDestroy() {
+    //     //清空数据
+
+    //     this.goodsMatrix = []
+    //     this.selectedBin = null
+    // },
     methods: {
-        getGoodsData(row, col) {
-            const key = `${row}-${col}`;
-            return this.goodsMap[key] || null;
-        },
-        buildGoodsMatrix() {
-            const { rows, cols } = this.shelf;
-            this.goodsMatrix =
-                Array.from({ length: rows }, (_, row) =>
-                    Array.from({ length: cols }, (_, col) => {
-                        const key = `${row+1}-${col+1}`;
-                        
-                        return this.goodsMap[key] || null;
-                    })
-                );
+        shouldShowButton(row, col, layer) {
+            const bin = this.goodsMap[`${row}-${col}-${layer}`]
+            // 示例:仅显示storage类型的库位
+            return bin?.shelf_type === 'storage' 
+            // return ['storage', 'occupied'].includes(bin?.shelf_type) // 显示多种类型
         },
         getList() {
             var _this = this;
@@ -158,9 +166,11 @@ export default {
                 + '' + _this.warehouse_code + '&max_page=1000' + '&shelf_name=' + _this.shelf_name
                 , {})
                 .then(res => {
-
-                    
-
+                    _this.goodsMap = {};
+                    res.results.forEach(item => {
+                        const key = `${item.row}-${item.col}-${item.layer}`;
+                        _this.goodsMap[key] = item;
+                    });
                 
                     _this.$q.notify({
                         message: res.detail,
@@ -176,34 +186,7 @@ export default {
                     });
                 });
         },
-        postrcl() {
-            this.updateRow()
-            this.updateCol()
-            this.updateLayer()
-            postauth(this.pathname, {
-                warehouse_code: this.warehouse_code,
-                warehouse_name: this.warehouse_name,
-                shelf_name: this.shelf_name,
-                shelf_type: 'storage',
-                rows: this.shelf.rows,
-                cols: this.shelf.cols,
-                layers: this.shelf.layers,
-            })
-                .then(res => {
-                    this.$q.notify({
-                        message: res.detail,
-                        icon: 'done',
-                        color: 'positive'
-                    })
-                })
-                .catch(err => {
-                    this.$q.notify({
-                        message: err.detail,
-                        icon: 'close',
-                        color: 'negative'
-                    })
-                })
-        },
+  
         handle_setting() {
             if (LocalStorage.has('warehouse_code')) {
                 this.warehouse_code = LocalStorage.getItem('warehouse_code')
@@ -212,29 +195,27 @@ export default {
                 this.warehouse_name = LocalStorage.getItem('warehouse_name')
             }
         },
-        updateRow() {
-
-            const newRow = parseInt(this.shelf.row_input)
-            if (!isNaN(newRow) && newRow > 0) {
-                this.shelf.rows = newRow
-            }
-
-
+            // 获取货位颜色
+        getBinColor(row, col, layer) {
+        const bin = this.goodsMap[`${row}-${col}-${layer}`];
+        
+        if (!bin) return this.binColors.default;
+        return this.binColors[bin.shelf_type] || this.binColors.default;
         },
-        updateCol() {
-            const newCol = parseInt(this.shelf.col_input)
-            if (!isNaN(newCol) && newCol > 0) {
-                this.shelf.cols = newCol
-            }
 
+        // 货位点击处理
+        handleBinClick(row, col, layer) {
+            this.select_Inventory.rowIndex = row
+            this.select_Inventory.colIndex = col
+            this.select_Inventory.layerIndex = layer
+            this.select_Inventory.goods_data = this.goodsMap[`${row}-${col}-${layer}`]
+            this.showInventoryDetails = true
+            console.log(this.select_Inventory)
+            this.$refs.goodscard.handleclick()
+          
+            
         },
-        updateLayer() {
-            const newLayer = parseInt(this.shelf.layer_input)
-            if (!isNaN(newLayer) && newLayer > 0) {
-                this.shelf.layers = newLayer
-            }
 
-        },
         updateCSSVariables() {
             const root = document.documentElement
             // 获取组件容器的实际尺寸
@@ -312,13 +293,20 @@ export default {
         this.updateCSSVariables()
         window.addEventListener('resize', this.handleResize)
     },
+    // 添加 beforeUnmount 生命周期
     beforeUnmount() {
+        // 清理数据
+        this.goodsMap = {}
+        this.goodsMatrix = []
+        this.selectedBin = null
+        
+        // 清理事件监听
         window.removeEventListener('resize', this.handleResize)
         clearTimeout(this.resizeTimer)
-    },
-    watch: {
-        shelf: {
-
+        
+        // 清理 DOM
+        if (this.$refs.goodscard) {
+            this.$refs.goodscard.$destroy()
         }
     },
     created() {
@@ -484,17 +472,17 @@ export default {
     /* 固定宽度 */
     height: var(--cell-d);
 
-    border: 1px solid #ddd;
-    box-sizing: border-box;
-
-    background: rgba(255, 255, 255, 0.9);
+    background: transparent;
     transition: transform 0.2s;
+
 }
 
 
 
-.grid-item:hover {
-    transform: translateY(-5px);
+.q-btn:hover {
+    transform: translateY(-2px);
     box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
 }
+
+
 </style>

+ 1 - 0
templates/src/router/routes.js

@@ -15,6 +15,7 @@ const routes = [{
         path: 'management',
         name: 'management',
         component: () => import('pages/stock/management.vue')
+        
       },
 
       {