Browse Source

Merge remote-tracking branch 'origin/master'

master
常熟吴彦祖 2 months ago
parent
commit
5c81bbb7d0
  1. 2
      index.html
  2. 15
      src/views/modules/dashboard/buffer-board.vue
  3. 15
      src/views/modules/dashboard/exception-board.vue
  4. 38
      src/views/modules/dashboard/finished-product-board.vue
  5. 38
      src/views/modules/dashboard/material-receiving-board.vue
  6. 15
      src/views/modules/dashboard/picking-board.vue
  7. 38
      src/views/modules/dashboard/robot-picking-board.vue
  8. 39
      src/views/modules/dashboard/slitting-board.vue
  9. 89
      src/views/modules/dashboard/warehouse-3d-board.vue
  10. 15
      src/views/modules/dashboard/workshop-feeding-board.vue
  11. 4
      static/config/init.js

2
index.html

@ -10,7 +10,7 @@
<script>document.write('<script src="./config/index.js?t=' + new Date().getTime() + '"><\/script>');</script>
<% }else { %>
<!-- 开发环境 -->
<link rel="shortcut icon" type="image/x-icon" href="./static/img/ccl.ico">
<link rel="shortcut icon" type="image/x-icon" href="./static/img/favicon.ico">
<script src="./static/config/index.js"></script>
<script src="./static/plugins/mock-1.0.0-beta3/mock-min.js"></script>
<script src="./static/plugins/echarts-3.8.5/echarts.common.min.js"></script>

15
src/views/modules/dashboard/buffer-board.vue

@ -162,10 +162,8 @@ export default {
},
mounted() {
this.updateTime()
this.timeInterval = setInterval(() => {
this.updateTime()
}, 1000)
// HTTP API使
this.currentTime = '等待服务器时间同步...'
//
this.getDataList()
@ -177,9 +175,6 @@ export default {
},
beforeDestroy() {
if (this.timeInterval) {
clearInterval(this.timeInterval)
}
if (this.dataInterval) {
clearInterval(this.dataInterval)
}
@ -193,6 +188,12 @@ export default {
bufferBoard({}).then(({data}) => {
if (data && data.code === 200) {
console.log('获取缓存区数据成功:', data.data)
//
if (data.serverTime) {
this.currentTime = data.serverTime
}
// TODO:
// if (data.data) {
// this.bufferList = data.data.bufferList || []

15
src/views/modules/dashboard/exception-board.vue

@ -292,10 +292,8 @@ export default {
},
mounted() {
this.updateTime()
this.timeInterval = setInterval(() => {
this.updateTime()
}, 1000)
// HTTP API使
this.currentTime = '等待服务器时间同步...'
//
this.getDataList()
@ -307,9 +305,6 @@ export default {
},
beforeDestroy() {
if (this.timeInterval) {
clearInterval(this.timeInterval)
}
if (this.dataInterval) {
clearInterval(this.dataInterval)
}
@ -323,6 +318,12 @@ export default {
exceptionBoard({}).then(({data}) => {
if (data && data.code === 200) {
console.log('获取异常处理区数据成功:', data.data)
//
if (data.serverTime) {
this.currentTime = data.serverTime
}
// TODO:
// if (data.data) {
// this.exceptionList = data.data.exceptionList || []

38
src/views/modules/dashboard/finished-product-board.vue

@ -136,6 +136,7 @@ export default {
return {
currentTime: '',
timeInterval: null,
serverTimeOffset: 0, //
// WebSocket
useWebSocket: true, // 使WebSocketfalse
@ -151,8 +152,10 @@ export default {
},
mounted() {
//
this.updateTime()
//
this.currentTime = '等待服务器时间同步...'
//
this.timeInterval = setInterval(() => {
this.updateTime()
}, 1000)
@ -164,11 +167,10 @@ export default {
},
beforeDestroy() {
//
//
if (this.timeInterval) {
clearInterval(this.timeInterval)
}
// WebSocket
this.disconnectWebSocket()
},
@ -209,6 +211,11 @@ export default {
*/
handleWebSocketMessage(message) {
if (message && message.code === 0) {
//
if (message.serverTime) {
this.updateServerTimeOffset(message.serverTime)
}
this.packagingList = message.data.packagingList || []
this.inboundList = message.data.inboundList || []
}
@ -275,10 +282,27 @@ export default {
},
/**
* 更新当前时间
* 更新服务器时间偏移量
*/
updateServerTimeOffset(serverTimeString) {
try {
const timeStr = serverTimeString.split(' ')[0] + ' ' + serverTimeString.split(' ')[1]
const serverTime = new Date(timeStr).getTime()
const localTime = new Date().getTime()
if (!isNaN(serverTime)) {
this.serverTimeOffset = serverTime - localTime
}
} catch (error) {
console.warn('解析服务器时间失败:', error)
}
},
/**
* 更新当前时间使用服务器时间偏移量
*/
updateTime() {
const now = new Date()
const now = new Date(new Date().getTime() + this.serverTimeOffset)
const year = now.getFullYear()
const month = String(now.getMonth() + 1).padStart(2, '0')
const day = String(now.getDate()).padStart(2, '0')
@ -288,7 +312,7 @@ export default {
const weekDays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
const weekDay = weekDays[now.getDay()]
this.currentTime = `${year}-${month}-${day} ${weekDay} ${hours}:${minutes}:${seconds}`
this.currentTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds} ${weekDay}`
},
/**

38
src/views/modules/dashboard/material-receiving-board.vue

@ -134,6 +134,7 @@ export default {
return {
currentTime: '',
timeInterval: null,
serverTimeOffset: 0, //
// WebSocket
useWebSocket: true, // 使WebSocketfalse
@ -149,8 +150,10 @@ export default {
},
mounted() {
//
this.updateTime()
//
this.currentTime = '等待服务器时间同步...'
//
this.timeInterval = setInterval(() => {
this.updateTime()
}, 1000)
@ -162,11 +165,10 @@ export default {
},
beforeDestroy() {
//
//
if (this.timeInterval) {
clearInterval(this.timeInterval)
}
// WebSocket
this.disconnectWebSocket()
},
@ -207,6 +209,11 @@ export default {
*/
handleWebSocketMessage(message) {
if (message && message.code === 0) {
//
if (message.serverTime) {
this.updateServerTimeOffset(message.serverTime)
}
this.receivingList = message.data.receivingList || []
this.inboundList = message.data.inboundList || []
}
@ -275,10 +282,27 @@ export default {
},
/**
* 更新当前时间
* 更新服务器时间偏移量
*/
updateServerTimeOffset(serverTimeString) {
try {
const timeStr = serverTimeString.split(' ')[0] + ' ' + serverTimeString.split(' ')[1]
const serverTime = new Date(timeStr).getTime()
const localTime = new Date().getTime()
if (!isNaN(serverTime)) {
this.serverTimeOffset = serverTime - localTime
}
} catch (error) {
console.warn('解析服务器时间失败:', error)
}
},
/**
* 更新当前时间使用服务器时间偏移量
*/
updateTime() {
const now = new Date()
const now = new Date(new Date().getTime() + this.serverTimeOffset)
const year = now.getFullYear()
const month = String(now.getMonth() + 1).padStart(2, '0')
const day = String(now.getDate()).padStart(2, '0')
@ -288,7 +312,7 @@ export default {
const weekDays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
const weekDay = weekDays[now.getDay()]
this.currentTime = `${year}-${month}-${day} ${weekDay} ${hours}:${minutes}:${seconds}`
this.currentTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds} ${weekDay}`
},
/**

15
src/views/modules/dashboard/picking-board.vue

@ -145,10 +145,8 @@ export default {
},
mounted() {
this.updateTime()
this.timeInterval = setInterval(() => {
this.updateTime()
}, 1000)
// HTTP API使
this.currentTime = '等待服务器时间同步...'
//
this.getDataList()
@ -160,9 +158,6 @@ export default {
},
beforeDestroy() {
if (this.timeInterval) {
clearInterval(this.timeInterval)
}
if (this.dataInterval) {
clearInterval(this.dataInterval)
}
@ -174,6 +169,12 @@ export default {
manualPicking({}).then(({data}) => {
if (data && data.code === 200) {
console.log('获取数据成功:', data.data)
//
if (data.serverTime) {
this.currentTime = data.serverTime
}
// TODO:
// if (data.data) {
// this.leftPanelList = data.data.leftPanelList || []

38
src/views/modules/dashboard/robot-picking-board.vue

@ -140,6 +140,7 @@ export default {
return {
currentTime: '',
timeInterval: null,
serverTimeOffset: 0, //
// WebSocket
useWebSocket: true, // 使WebSocketfalse
@ -155,8 +156,10 @@ export default {
},
mounted() {
//
this.updateTime()
//
this.currentTime = '等待服务器时间同步...'
//
this.timeInterval = setInterval(() => {
this.updateTime()
}, 1000)
@ -168,11 +171,10 @@ export default {
},
beforeDestroy() {
//
//
if (this.timeInterval) {
clearInterval(this.timeInterval)
}
// WebSocket
this.disconnectWebSocket()
},
@ -220,10 +222,27 @@ export default {
},
/**
* 更新当前时间
* 更新服务器时间偏移量
*/
updateServerTimeOffset(serverTimeString) {
try {
const timeStr = serverTimeString.split(' ')[0] + ' ' + serverTimeString.split(' ')[1]
const serverTime = new Date(timeStr).getTime()
const localTime = new Date().getTime()
if (!isNaN(serverTime)) {
this.serverTimeOffset = serverTime - localTime
}
} catch (error) {
console.warn('解析服务器时间失败:', error)
}
},
/**
* 更新当前时间使用服务器时间偏移量
*/
updateTime() {
const now = new Date()
const now = new Date(new Date().getTime() + this.serverTimeOffset)
const year = now.getFullYear()
const month = String(now.getMonth() + 1).padStart(2, '0')
const day = String(now.getDate()).padStart(2, '0')
@ -233,7 +252,7 @@ export default {
const weekDays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
const weekDay = weekDays[now.getDay()]
this.currentTime = `${year}-${month}-${day} ${weekDay} ${hours}:${minutes}:${seconds}`
this.currentTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds} ${weekDay}`
},
/**
@ -283,6 +302,11 @@ export default {
*/
handleWebSocketMessage(message) {
if (message && message.code === 0) {
//
if (message.serverTime) {
this.updateServerTimeOffset(message.serverTime)
}
this.containerPickingList = message.data.containerList || []
this.materialPickingList = message.data.materialList || []

39
src/views/modules/dashboard/slitting-board.vue

@ -136,6 +136,7 @@ export default {
return {
currentTime: '',
timeInterval: null,
serverTimeOffset: 0, //
// WebSocket
useWebSocket: true, // 使WebSocketfalse
@ -151,8 +152,10 @@ export default {
},
mounted() {
//
this.updateTime()
//
this.currentTime = '等待服务器时间同步...'
//
this.timeInterval = setInterval(() => {
this.updateTime()
}, 1000)
@ -164,11 +167,10 @@ export default {
},
beforeDestroy() {
//
//
if (this.timeInterval) {
clearInterval(this.timeInterval)
}
// WebSocket
this.disconnectWebSocket()
},
@ -214,8 +216,28 @@ export default {
/**
* 更新当前时间
*/
/**
* 更新服务器时间偏移量
*/
updateServerTimeOffset(serverTimeString) {
try {
const timeStr = serverTimeString.split(' ')[0] + ' ' + serverTimeString.split(' ')[1]
const serverTime = new Date(timeStr).getTime()
const localTime = new Date().getTime()
if (!isNaN(serverTime)) {
this.serverTimeOffset = serverTime - localTime
}
} catch (error) {
console.warn('解析服务器时间失败:', error)
}
},
/**
* 更新当前时间使用服务器时间偏移量
*/
updateTime() {
const now = new Date()
const now = new Date(new Date().getTime() + this.serverTimeOffset)
const year = now.getFullYear()
const month = String(now.getMonth() + 1).padStart(2, '0')
const day = String(now.getDate()).padStart(2, '0')
@ -225,7 +247,7 @@ export default {
const weekDays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
const weekDay = weekDays[now.getDay()]
this.currentTime = `${year}-${month}-${day} ${weekDay} ${hours}:${minutes}:${seconds}`
this.currentTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds} ${weekDay}`
},
/**
@ -277,6 +299,11 @@ export default {
*/
handleWebSocketMessage(message) {
if (message && message.code === 0) {
//
if (message.serverTime) {
this.updateServerTimeOffset(message.serverTime)
}
this.assistArmList = message.data.assistArmList || []
this.slittingInboundList = message.data.slittingInboundList || []
}

89
src/views/modules/dashboard/warehouse-3d-board.vue

@ -292,6 +292,9 @@ export default {
data() {
return {
currentTime: '',
timeInterval: null, //
serverTimeOffset: 0, //
refreshCheckInterval: null, //
// WebSocket
useWebSocket: true, // 使WebSocketfalse
@ -373,7 +376,7 @@ export default {
const empty = this.storageData.emptyContainerInventory || {}
return (empty.flatPallet || 0) + (empty.framePallet || 0) + (empty.steelPallet || 0)
},
/**
* 计算可用库位数总库位 - 已使用库位
*/
@ -383,8 +386,16 @@ export default {
},
mounted() {
this.updateTime()
this.timeInterval = setInterval(this.updateTime, 1000)
//
this.currentTime = '等待服务器时间同步...'
//
this.timeInterval = setInterval(() => {
this.updateTime()
}, 1000)
//
this.startRefreshCheck()
// DOM
this.$nextTick(() => {
@ -407,9 +418,14 @@ export default {
},
beforeDestroy() {
//
if (this.timeInterval) {
clearInterval(this.timeInterval)
}
//
if (this.refreshCheckInterval) {
clearInterval(this.refreshCheckInterval)
}
// resize
window.removeEventListener('resize', this.handleResize)
//
@ -421,6 +437,34 @@ export default {
},
methods: {
/**
* 启动定时刷新检查
* 每分钟检查一次如果到达凌晨5点则自动刷新页面
*/
startRefreshCheck() {
console.log('[智能立体仓库看板] 已启动定时刷新检查,将在每天凌晨5:00自动刷新页面')
//
this.refreshCheckInterval = setInterval(() => {
this.checkAndRefreshPage()
}, 60000) // 60 = 1
//
this.checkAndRefreshPage()
},
/**
* 检查当前时间如果是凌晨5点则刷新页面
*/
checkAndRefreshPage() {
const now = new Date()
const hours = now.getHours()
const minutes = now.getMinutes()
// 5:00-5:10
if (hours === 5 && minutes === 10) {
location.reload()
}
},
/**
* 处理窗口大小变化
@ -435,10 +479,32 @@ export default {
},
/**
* 更新时间显示
* 更新服务器时间偏移量
*
* @param {string} serverTimeString - 服务器时间字符串
*/
updateServerTimeOffset(serverTimeString) {
try {
// "2025-11-01 14:30:25 "
const timeStr = serverTimeString.split(' ')[0] + ' ' + serverTimeString.split(' ')[1]
const serverTime = new Date(timeStr).getTime()
const localTime = new Date().getTime()
if (!isNaN(serverTime)) {
this.serverTimeOffset = serverTime - localTime
console.log('服务器时间偏移量更新:', this.serverTimeOffset, 'ms')
}
} catch (error) {
console.warn('解析服务器时间失败:', error)
}
},
/**
* 更新时间显示使用服务器时间偏移量
*/
updateTime() {
const now = new Date()
// 使 +
const now = new Date(new Date().getTime() + this.serverTimeOffset)
const year = now.getFullYear()
const month = String(now.getMonth() + 1).padStart(2, '0')
const date = String(now.getDate()).padStart(2, '0')
@ -498,6 +564,11 @@ export default {
handleWebSocketMessage(message) {
if (message && message.code === 0) {
console.log('[智能立体仓库看板] 收到WebSocket推送数据:', message.data)
//
if (message.serverTime) {
this.updateServerTimeOffset(message.serverTime)
}
//
if (message.data.taskData && Object.keys(message.data.taskData).length > 0) {
@ -519,9 +590,9 @@ export default {
...(message.data.storageData.emptyContainerInventory || {})
}
}
console.log('[智能立体仓库看板] 库位数据已更新:', this.storageData)
//
this.$nextTick(() => {
this.initStorageChart()
@ -644,7 +715,7 @@ export default {
const materialSteelPallet = materialInventory.steelPallet || 0
const materialFramePallet = materialInventory.framePallet || 0
const materialFlatPallet = materialInventory.flatPallet || 0
//
const availableSlots = this.availableSlots
@ -759,7 +830,7 @@ export default {
},
{
value: availableSlots,
name: '可用库位(' + availableSlots + ')',
name: '可用库位(' + availableSlots + ')',
itemStyle: {
color: {
type: 'linear',

15
src/views/modules/dashboard/workshop-feeding-board.vue

@ -135,10 +135,8 @@ export default {
},
mounted() {
this.updateTime()
this.timeInterval = setInterval(() => {
this.updateTime()
}, 1000)
// HTTP API使
this.currentTime = '等待服务器时间同步...'
//
this.getDataList()
@ -150,9 +148,6 @@ export default {
},
beforeDestroy() {
if (this.timeInterval) {
clearInterval(this.timeInterval)
}
if (this.dataInterval) {
clearInterval(this.dataInterval)
}
@ -166,6 +161,12 @@ export default {
workshopFeedingBoard({}).then(({data}) => {
if (data && data.code === 200) {
console.log('获取车间AGV放料区数据成功:', data.data)
//
if (data.serverTime) {
this.currentTime = data.serverTime
}
// TODO:
// if (data.data) {
// this.feedingList = data.data.feedingList || []

4
static/config/init.js

@ -3,7 +3,7 @@
*/
;(function() {
var resList = {
icon: window.SITE_CONFIG.cdnUrl + '/static/img/favicon.ico',
icon: window.SITE_CONFIG.cdnUrl + '/static/img/ccl.ico',
css: [
window.SITE_CONFIG.cdnUrl + '/static/css/app.css',
],
@ -73,4 +73,4 @@
createScripts();
}
};
})();
})();
Loading…
Cancel
Save