| | |
| | | <template> |
| | | <div class="title"></div> |
| | | </template> |
| | | <template> |
| | | <div class="container"> |
| | | <div class="content-wrapper"> |
| | | <!-- æ§å¶é¢æ¿åºå --> |
| | | <!-- <div class="form-group"> |
| | | <label>åºåï¼</label> |
| | | <el-select |
| | | size="mini" |
| | | filterable |
| | | v-model="Area.shelf_code" |
| | | placeholder="è¯·éæ©" |
| | | class="full-width" |
| | | > |
| | | <el-option |
| | | v-for="item in slectData" |
| | | :value="item.shelf_code" |
| | | :label="item.house_name" |
| | | :key="item.house_name" |
| | | ></el-option> |
| | | </el-select> |
| | | </div> --> |
| | | |
| | | <div class="form-group"> |
| | | <div style="display:flex;flex-direction: column;"> |
| | | <h4>ä»åº</h4> |
| | | <el-select size="mini" @change="onWarehouseChange" v-model="Area.warehouse" placeholder="è¯·éæ©ä»åº" |
| | | class="full-width"> |
| | | <el-option v-for="item in warehouseList" :value="item" :label="item" :key="item"></el-option> |
| | | </el-select> |
| | | <h4>è´§ä½æ</h4> |
| | | <el-select size="mini" @change="SCChange" v-model="Area.row" placeholder="è¯·éæ©æ" class="full-width"> |
| | | <el-option v-for="item in scList" :value="item" :label="'第' + item + 'æ'" :key="item"></el-option> |
| | | </el-select> |
| | | <el-button type="success" class="refresh-btn" @click="GetViewData"> |
| | | å·æ° |
| | | </el-button> |
| | | </div> |
| | | |
| | | <div class="legend-section" style="margin-left: 20px;"> |
| | | <h4>说æ</h4> |
| | | <div class="legend-grid"> |
| | | <div class="legend-item" v-for="item in infoMsg" :key="item.bgcolor"> |
| | | <span class="color-box" :style="{ 'background-color': item.bgcolor }"></span> |
| | | <span class="legend-label">{{ item.msg }}</span> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- è´§ä½å±ç¤ºåºå --> |
| | | <div v-if="loading" class="loading-container"> |
| | | <el-icon class="is-loading"> |
| | | <Loading /> |
| | | </el-icon> |
| | | <span>å è½½ä¸...</span> |
| | | </div> |
| | | |
| | | <div v-else-if="locationData.length === 0" class="empty-container"> |
| | | <el-empty description="ææ æ°æ®" /> |
| | | </div> |
| | | |
| | | <div v-else> |
| | | <div class="location-view"> |
| | | <div class="layer-container" v-for="(item, index) in locationData" :key="index"> |
| | | <h3 class="layer-title">第{{ item.layer }}å±</h3> |
| | | <div class="row"> |
| | | <div class="location-cell" :style="{ 'background-color': GetBgColor(column) }" |
| | | v-for="(column, index) in item.locationObj" :key="index" @mouseenter="showTooltip(column, $event)" |
| | | @mouseleave="hideTooltip"> |
| | | {{ column.row }}-{{ column.column }}-{{ column.layer }} |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <!-- æ¬æµ®æç¤ºæ¡ --> |
| | | <div v-if="showTooltipFlag" class="location-tooltip" :style="{ |
| | | left: tooltipPosition.x + 'px', |
| | | top: tooltipPosition.y + 'px', |
| | | }"> |
| | | <div v-if="currentLocation"> |
| | | <p><strong>ä»åº:</strong>{{ Area.warehouse || "æªéæ©" }}</p> |
| | | <p><strong>è´§ä½å·:</strong>{{ currentLocation.locationCode }}</p> |
| | | <!-- <p><strong>æç®±å·:</strong>{{ currentLocation.barCode ? currentLocation.barCode : "æ æç®±" }}</p> --> |
| | | <!-- æ ¹æ®ä»åºç±»åæ¾ç¤ºä¸åçæ ç¾åå
容 --> |
| | | <p v-if="Area.warehouse === 'åæåº'"> |
| | | <strong>RFID:</strong>{{ this.rfidData[currentLocation.locationCode] || "æ " }} |
| | | </p> |
| | | <p v-else-if="Area.warehouse === 'æååº'"> |
| | | <strong>æçå·:</strong>{{ this.rfidData[currentLocation.locationCode] || "æ " }} |
| | | </p> |
| | | <p v-else> |
| | | <strong>æ è¯:</strong>{{ this.rfidData[currentLocation.locationCode] || "æ " }} |
| | | </p> |
| | | <p> |
| | | <strong>æåå±:</strong> {{ currentLocation.row }}æ{{ |
| | | currentLocation.column |
| | | }}å{{ currentLocation.layer }}å± |
| | | </p> |
| | | <p><strong>ç¶æ:</strong> {{ getStatusText(currentLocation) }}</p> |
| | | <!-- <p> |
| | | <strong>ç¦ç¨:</strong> |
| | | {{ currentLocation.location_lock == 3 ? "æ¯" : "å¦" }} |
| | | </p> --> |
| | | <!-- <p v-if="currentLocation.location_state > 0"> |
| | | <strong>ç©æç¼ç :</strong> |
| | | {{ currentLocation.material_code || "æ " }} |
| | | </p> |
| | | <p v-if="currentLocation.location_state > 0"> |
| | | <strong>æ°é:</strong> {{ currentLocation.quantity || "æ " }} |
| | | </p> --> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { ref, reactive } from 'vue' |
| | | import { ElButton, Loading } from "element-plus"; |
| | | |
| | | export default { |
| | | setup() { |
| | | return { |
| | | data() { |
| | | return { |
| | | slectData: [], |
| | | scList: [], |
| | | warehouseList: ["åæåº", "æååº"], |
| | | warehouseMap: { |
| | | "åæåº": 1, |
| | | "æååº": 2 |
| | | }, |
| | | Area: { |
| | | warehouse: "åæåº", |
| | | row: "", |
| | | shelf_code: "" |
| | | }, |
| | | mian_height: "", |
| | | loading: false, |
| | | infoMsg: [ |
| | | { bgcolor: "lightgreen", msg: "空é²", state: 0 }, |
| | | { bgcolor: "orange", msg: "æè´§", state: 100 }, |
| | | { bgcolor: "#2BB3D5", msg: "éå®", state: 1 }, |
| | | ], |
| | | locationData: [], |
| | | showTooltipFlag: false, |
| | | currentLocation: null, |
| | | tooltipPosition: { x: 0, y: 0 }, |
| | | rfidData: {}, // åå¨è´§ä½ç¼å·ä¸RFIDçæ å°å
³ç³» |
| | | }; |
| | | }, |
| | | computed: { |
| | | GetBgColor() { |
| | | return (col) => { |
| | | var bgColor = ""; |
| | | //ä¼å
æ¾ç¤ºç¦ç¨ç¶æ |
| | | if (col.location_lock > 0) { |
| | | this.infoMsg.forEach((el) => { |
| | | if (el.state === col.location_lock) { |
| | | bgColor = el.bgcolor; |
| | | } |
| | | }); |
| | | } |
| | | else { |
| | | return "lightgreen"; |
| | | } |
| | | return bgColor; |
| | | }; |
| | | }, |
| | | }, |
| | | methods: { |
| | | // è·åRFIDä¿¡æ¯ |
| | | getRfidInfo(locationCodes, warehouseId) { |
| | | if (!locationCodes || locationCodes.length === 0) { |
| | | console.log("没æè´§ä½ç¼å·ï¼è·³è¿RFIDæ¥è¯¢"); |
| | | return; |
| | | } |
| | | |
| | | console.log("è°ç¨RFIDæ¥è¯¢API:", { |
| | | locationCodes: locationCodes, |
| | | warehouseId: warehouseId |
| | | }); |
| | | |
| | | this.http |
| | | .post(`/api/LocationInfo/GetRfid`, { locationCodes, warehouseId }, "æ¥è¯¢RFIDä¸") |
| | | .then((response) => { |
| | | console.log("RFIDæ¥è¯¢APIè¿åç»æ:", response); |
| | | if (response.status && response.data) { |
| | | console.log(`æåè·å${response.data.length}æ¡RFIDè®°å½`); |
| | | // æ´æ°rfidDataæ å° |
| | | response.data.forEach((item, index) => { |
| | | try { |
| | | // æ£æ¥å段åï¼æ¯æå¤§å°åä¸¤ç§æ ¼å¼ |
| | | const locationCode = item.LocationCode || item.locationCode; |
| | | const rfidCode = item.RfidCode || item.rfidCode; |
| | | |
| | | if (item && locationCode !== undefined) { |
| | | console.log(`æ´æ°RFIDæ°æ®: ${locationCode} -> ${rfidCode}`); |
| | | this.rfidData[locationCode] = rfidCode; |
| | | } else { |
| | | console.warn(`è·³è¿æ æçRFIDæ°æ®é¡¹(${index}):`, item); |
| | | } |
| | | } catch (error) { |
| | | console.error(`å¤çRFIDæ°æ®é¡¹(${index})æ¶åºé:`, error, item); |
| | | } |
| | | }); |
| | | console.log("æ´æ°åçrfidData:", this.rfidData); |
| | | } else { |
| | | console.log("RFIDæ¥è¯¢APIè¿åç¶æå¤±è´¥ææ°æ®ä¸ºç©º"); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | console.error("è·åRFIDä¿¡æ¯å¤±è´¥:", error); |
| | | }); |
| | | }, |
| | | |
| | | GetViewData() { |
| | | var _this = this; |
| | | |
| | | this.loading = true; |
| | | this.rfidData = {}; // æ¸
空ä¹åçRFIDæ°æ® |
| | | |
| | | let warehouseId = 0; |
| | | if (this.Area.warehouse) { |
| | | warehouseId = this.warehouseMap[this.Area.warehouse] || 1; |
| | | console.log(`å½åéæ©çä»åº: ${this.Area.warehouse}, 对åºçwarehouseId: ${warehouseId}`); |
| | | } |
| | | |
| | | console.log(`è°ç¨GetLocationStatus API: row=${_this.Area.row}, warehouseId=${warehouseId}`); |
| | | |
| | | this.http |
| | | .post(`/api/LocationInfo/GetLocationStatus?row=${_this.Area.row}&warehouseId=${warehouseId}`, {}, "æ¥è¯¢ä¸") |
| | | .then((x) => { |
| | | console.log("GetLocationStatus APIè¿åç»æ:", x); |
| | | this.locationData = x.data || []; |
| | | |
| | | // æåææè´§ä½ç¼å· |
| | | let locationCodes = []; |
| | | this.locationData.forEach(layer => { |
| | | layer.locationObj.forEach(location => { |
| | | locationCodes.push(location.locationCode); |
| | | }); |
| | | }); |
| | | |
| | | console.log(`ä»è´§ä½æ°æ®ä¸æåå°${locationCodes.length}个货ä½ç¼å·`); |
| | | console.log("æåçè´§ä½ç¼å·:", locationCodes); |
| | | |
| | | // è°ç¨APIè·åRFIDä¿¡æ¯ |
| | | this.getRfidInfo(locationCodes, warehouseId); |
| | | }) |
| | | .catch((error) => { |
| | | this.$message.error("è·åæ°æ®å¤±è´¥ï¼è¯·éè¯"); |
| | | console.error("è·åè´§ä½ç¶æå¤±è´¥:", error); |
| | | }) |
| | | .finally(() => { |
| | | this.loading = false; |
| | | }); |
| | | }, |
| | | |
| | | // 忢æ |
| | | SCChange() { |
| | | this.GetViewData(); |
| | | }, |
| | | // 忢ä»åº |
| | | onWarehouseChange() { |
| | | // 忢ä»åºæ¶éç½®æéæ© |
| | | this.GetViewData(); |
| | | }, |
| | | showTooltip(location, event) { |
| | | this.currentLocation = location; |
| | | this.showTooltipFlag = true; |
| | | |
| | | // 设置æç¤ºæ¡ä½ç½®ï¼ç¨å¾®åç§»é¿å
鮿¡é¼ æ |
| | | this.tooltipPosition = { |
| | | x: event.clientX + 10, |
| | | y: event.clientY + 10, |
| | | }; |
| | | }, |
| | | |
| | | hideTooltip() { |
| | | this.showTooltipFlag = false; |
| | | this.currentLocation = null; |
| | | }, |
| | | |
| | | getStatusText(location) { |
| | | // if (location.location_lock === 3) return "ç¦ç¨"; |
| | | if (location.location_lock === 0) return "空é²"; |
| | | if (location.location_lock === 1) return "éå®"; |
| | | if (location.location_lock === 100) return "æè´§"; |
| | | // if (location.location_state > 0 && location.location_state < 100) |
| | | // return "éå®"; |
| | | return "å
¶ä»"; |
| | | }, |
| | | getWarehouseName(location) { |
| | | if (location.warehouseId === 1) return "åæåº"; |
| | | if (location.warehouseId === 2) return "æååº"; |
| | | return "æªç¥ä»åº"; |
| | | }, |
| | | }, |
| | | mounted() { |
| | | var mainHeight = document.getElementById("vol-main"); |
| | | if (mainHeight) { |
| | | this.mian_height = mainHeight.offsetHeight - 40 + "px"; |
| | | } |
| | | } |
| | | } |
| | | var _this = this; |
| | | //å è½½ä¸æé项 |
| | | this.http.post("/api/LocationInfo/GetRow", {}, "æ¥è¯¢ä¸").then((x) => { |
| | | //å 载第ä¸ä¸ªåºåï¼ç¬¬ä¸æ |
| | | // _this.Area.shelf_code = _this.slectData[0].shelf_code; |
| | | _this.scList = x.data; |
| | | if (_this.scList.length > 0) { |
| | | _this.Area.row = _this.scList[0]; |
| | | } |
| | | _this.GetViewData(); |
| | | }); |
| | | }, |
| | | components: { ElButton, Loading }, |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .title { |
| | | line-height: 70vh; |
| | | .container { |
| | | display: flex; |
| | | flex-direction: column; |
| | | height: 100%; |
| | | width: 100%; |
| | | padding: 10px; |
| | | } |
| | | |
| | | .header { |
| | | text-align: center; |
| | | font-size: 28px; |
| | | color: orange; |
| | | margin-bottom: 20px; |
| | | } |
| | | |
| | | .title { |
| | | font-size: 20px; |
| | | font-weight: bold; |
| | | margin: 0; |
| | | } |
| | | |
| | | .content-wrapper { |
| | | display: flex; |
| | | flex: 1; |
| | | min-height: 0; |
| | | padding: 10px; |
| | | } |
| | | |
| | | .full-width { |
| | | width: 100%; |
| | | } |
| | | |
| | | .refresh-btn { |
| | | margin-top: 10px; |
| | | width: 35%; |
| | | } |
| | | |
| | | .legend-section h4 { |
| | | margin-bottom: 10px; |
| | | } |
| | | |
| | | .legend-grid { |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 8px; |
| | | } |
| | | |
| | | .legend-item { |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | .color-box { |
| | | display: inline-block; |
| | | width: 20px; |
| | | height: 20px; |
| | | margin-right: 8px; |
| | | border-radius: 3px; |
| | | } |
| | | |
| | | .legend-label { |
| | | font-size: 13px; |
| | | } |
| | | |
| | | .location-view { |
| | | flex: 1; |
| | | width: 100%; |
| | | max-width: 100%; |
| | | overflow: auto; |
| | | padding: 10px; |
| | | background-color: white; |
| | | border-radius: 4px; |
| | | } |
| | | |
| | | .layer-container { |
| | | margin-bottom: 25px; |
| | | } |
| | | |
| | | .layer-title { |
| | | margin: 0 0 10px 0; |
| | | font-size: 16px; |
| | | color: #333; |
| | | } |
| | | |
| | | .row { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | margin-bottom: 8px; |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .location-cell { |
| | | width: 80px; |
| | | height: 38px; |
| | | margin: 3px; |
| | | text-align: center; |
| | | font-size: 14px; |
| | | border-radius: 3px; |
| | | line-height: 38px; |
| | | box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); |
| | | } |
| | | |
| | | .location-tooltip { |
| | | position: fixed; |
| | | z-index: 9999; |
| | | background-color: white; |
| | | border: 1px solid #ddd; |
| | | border-radius: 4px; |
| | | padding: 10px; |
| | | box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); |
| | | pointer-events: none; |
| | | max-width: 250px; |
| | | } |
| | | |
| | | .location-tooltip p { |
| | | margin: 5px 0; |
| | | font-size: 13px; |
| | | line-height: 1.4; |
| | | } |
| | | |
| | | .location-tooltip strong { |
| | | display: inline-block; |
| | | width: 70px; |
| | | color: #666; |
| | | } |
| | | |
| | | .form-group { |
| | | display: flex; |
| | | } |
| | | |
| | | .loading-container { |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | justify-content: center; |
| | | height: 200px; |
| | | font-size: 16px; |
| | | } |
| | | |
| | | .empty-container { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | height: 200px; |
| | | } |
| | | </style> |