From 7aa5197fd7b1c6b9ac39fa2a9f2ed982382162d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B8=B8=E7=86=9F=E5=90=B4=E5=BD=A6=E7=A5=96?= Date: Sun, 20 Sep 2026 17:20:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E6=8B=A3=E7=9C=8B=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dashboard/autoJ1SortingBoard54.vue | 55 +++++++------------ .../dashboard/autoJ2SortingBoard54.vue | 55 +++++++------------ .../dashboard/sortingBoard54.vue | 54 +++++++----------- 3 files changed, 62 insertions(+), 102 deletions(-) diff --git a/src/views/modules/haianWarehouse/dashboard/autoJ1SortingBoard54.vue b/src/views/modules/haianWarehouse/dashboard/autoJ1SortingBoard54.vue index 226958f..c1d2c18 100644 --- a/src/views/modules/haianWarehouse/dashboard/autoJ1SortingBoard54.vue +++ b/src/views/modules/haianWarehouse/dashboard/autoJ1SortingBoard54.vue @@ -4,11 +4,11 @@
-

海安 · {{ boardTitle }} +

{{ boardTitle }}

- 分拣位 {{ sortingStation }} · 工厂 {{ site || '未设置' }} +
@@ -19,11 +19,12 @@ 未完成 {{ pendingCount }} 已完成 {{ completedCount }} -
- {{ connectionText }} - {{ displayMessage }} - 刷新 -
+ + + + + + @@ -53,15 +54,13 @@ {{ item.status }} {{ item.message || '-' }} - - {{ displayMessage }} - + @@ -116,12 +115,10 @@ export default { }, watch: { // 地址参数变化时清空旧数据并递增请求版本,迟到响应不能覆盖新请求 - rqrq - '$route.fullPath' () { this.initializeBoard() }, - // 工厂变化立即断开旧订阅,禁止继续消费旧工厂数据 - rqrq - '$store.state.user.site' () { this.initializeBoard() } + '$route.fullPath' () { this.initializeBoard() } }, mounted () { - // 先初始化显式site再查询,初始化失败仅展示错误,不使用默认工厂发请求 - rqrq + // 海安专用屏先初始化固定工厂54再查询,直接访问无需登录或补充地址参数 - rqrq this.initializeBoard() this.clockTimer = setInterval(() => { this.now = Date.now() }, 1000) // 每30秒只复查配置,关闭时不查业务数据;配置重启生效后页面自动建立或关闭连接 - rqrq @@ -137,7 +134,7 @@ export default { clearInterval(this.scrollTimer) }, methods: { - // 固定屏支持URL显式site=54;登录态已有其他工厂则拒绝覆盖,防止看板改坏当前会话 - rqrq + // 专用屏独立使用工厂54,不读取或修改登录工厂;兼容site=54地址,错误工厂参数仍拒绝查询 - rqrq initializeBoard () { this.requestVersion++ this.disconnectWebSocket() @@ -151,20 +148,12 @@ export default { this.updatedAt = 0 this.lastReceivedAt = 0 this.siteReady = false - this.site = '' - const storeSite = String(this.$store.state.user.site || '').trim() + this.site = '54' const querySite = this.$route.query.site if (querySite !== undefined && (typeof querySite !== 'string' || querySite.trim() !== '54')) { this.message = '海安看板的工厂参数必须为 site=54' return } - const site = querySite === undefined ? storeSite : querySite.trim() - if (site !== '54' || (storeSite && storeSite !== '54')) { - this.message = '请使用海安工厂打开看板;独立屏地址需带 ?site=54' - return - } - this.$store.commit('user/updateSite', site) - this.site = site this.siteReady = true this.message = '正在获取分拣数据…' this.$nextTick(() => { @@ -178,7 +167,8 @@ export default { const version = this.requestVersion this.configLoading = true try { - const { data } = await getSortingBoardConfig({ site: this.$store.state.user.site }) + // 显式传本屏工厂54读取开关,避免未登录或登录其他工厂时查错配置 - rqrq + const { data } = await getSortingBoardConfig({ site: this.site }) if (version !== this.requestVersion) return if (!data || data.code !== 0 || !data.row || data.row.site !== this.site) throw new Error('配置查询失败') this.pushEnabled = data.row.enabled === true @@ -245,8 +235,8 @@ export default { // HTTP手动刷新与推送按相同结构消费,完整核对site/位置;异常与空任务分开显示 - rqrq applyBoard (data) { if (!this.pushEnabled) return - const site = String(this.$store.state.user.site || '').trim() - if (!data || data.code !== 0 || !data.row || site !== this.site || data.row.site !== site || data.row.sortingStation !== this.sortingStation) { + // 响应必须属于本屏固定工厂及分拣位,登录工厂变化不影响独立屏 - rqrq + if (!data || data.code !== 0 || !data.row || data.row.site !== this.site || data.row.sortingStation !== this.sortingStation) { this.available = false this.rows = [] this.message = '看板数据校验失败,请检查工厂和分拣位' @@ -265,14 +255,11 @@ export default { const version = this.requestVersion const dataVersion = this.dataVersion const station = this.sortingStation - const site = String(this.$store.state.user.site || '').trim() - if (site !== this.site) { - this.initializeBoard() - return - } + // 与配置查询及WebSocket主题使用同一本屏工厂,刷新不依赖登录态 - rqrq + const site = this.site this.queryLoading = true try { - const { data } = await getAutoJ1SortingBoard({ site: this.$store.state.user.site, sortingStation: station }) + const { data } = await getAutoJ1SortingBoard({ site, sortingStation: station }) if (version !== this.requestVersion || !this.pushEnabled || dataVersion !== this.dataVersion) return if (!data || data.code !== 0 || !data.row) { this.rows = [] diff --git a/src/views/modules/haianWarehouse/dashboard/autoJ2SortingBoard54.vue b/src/views/modules/haianWarehouse/dashboard/autoJ2SortingBoard54.vue index 8b2c5b2..dd72b41 100644 --- a/src/views/modules/haianWarehouse/dashboard/autoJ2SortingBoard54.vue +++ b/src/views/modules/haianWarehouse/dashboard/autoJ2SortingBoard54.vue @@ -4,11 +4,11 @@
-

海安 · {{ boardTitle }} +

{{ boardTitle }}

- 分拣位 {{ sortingStation }} · 工厂 {{ site || '未设置' }} +
@@ -19,11 +19,12 @@ 未完成 {{ pendingCount }} 已完成 {{ completedCount }} -
- {{ connectionText }} - {{ displayMessage }} - 刷新 -
+ + + + + + @@ -53,15 +54,13 @@ {{ item.status }} {{ item.message || '-' }} - - {{ displayMessage }} - + @@ -116,12 +115,10 @@ export default { }, watch: { // 地址参数变化时清空旧数据并递增请求版本,迟到响应不能覆盖新请求 - rqrq - '$route.fullPath' () { this.initializeBoard() }, - // 工厂变化立即断开旧订阅,禁止继续消费旧工厂数据 - rqrq - '$store.state.user.site' () { this.initializeBoard() } + '$route.fullPath' () { this.initializeBoard() } }, mounted () { - // 先初始化显式site再查询,初始化失败仅展示错误,不使用默认工厂发请求 - rqrq + // 海安专用屏先初始化固定工厂54再查询,直接访问无需登录或补充地址参数 - rqrq this.initializeBoard() this.clockTimer = setInterval(() => { this.now = Date.now() }, 1000) // 每30秒只复查配置,关闭时不查业务数据;配置重启生效后页面自动建立或关闭连接 - rqrq @@ -137,7 +134,7 @@ export default { clearInterval(this.scrollTimer) }, methods: { - // 固定屏支持URL显式site=54;登录态已有其他工厂则拒绝覆盖,防止看板改坏当前会话 - rqrq + // 专用屏独立使用工厂54,不读取或修改登录工厂;兼容site=54地址,错误工厂参数仍拒绝查询 - rqrq initializeBoard () { this.requestVersion++ this.disconnectWebSocket() @@ -151,20 +148,12 @@ export default { this.updatedAt = 0 this.lastReceivedAt = 0 this.siteReady = false - this.site = '' - const storeSite = String(this.$store.state.user.site || '').trim() + this.site = '54' const querySite = this.$route.query.site if (querySite !== undefined && (typeof querySite !== 'string' || querySite.trim() !== '54')) { this.message = '海安看板的工厂参数必须为 site=54' return } - const site = querySite === undefined ? storeSite : querySite.trim() - if (site !== '54' || (storeSite && storeSite !== '54')) { - this.message = '请使用海安工厂打开看板;独立屏地址需带 ?site=54' - return - } - this.$store.commit('user/updateSite', site) - this.site = site this.siteReady = true this.message = '正在获取分拣数据…' this.$nextTick(() => { @@ -178,7 +167,8 @@ export default { const version = this.requestVersion this.configLoading = true try { - const { data } = await getSortingBoardConfig({ site: this.$store.state.user.site }) + // 显式传本屏工厂54读取开关,避免未登录或登录其他工厂时查错配置 - rqrq + const { data } = await getSortingBoardConfig({ site: this.site }) if (version !== this.requestVersion) return if (!data || data.code !== 0 || !data.row || data.row.site !== this.site) throw new Error('配置查询失败') this.pushEnabled = data.row.enabled === true @@ -245,8 +235,8 @@ export default { // HTTP手动刷新与推送按相同结构消费,完整核对site/位置;异常与空任务分开显示 - rqrq applyBoard (data) { if (!this.pushEnabled) return - const site = String(this.$store.state.user.site || '').trim() - if (!data || data.code !== 0 || !data.row || site !== this.site || data.row.site !== site || data.row.sortingStation !== this.sortingStation) { + // 响应必须属于本屏固定工厂及分拣位,登录工厂变化不影响独立屏 - rqrq + if (!data || data.code !== 0 || !data.row || data.row.site !== this.site || data.row.sortingStation !== this.sortingStation) { this.available = false this.rows = [] this.message = '看板数据校验失败,请检查工厂和分拣位' @@ -265,14 +255,11 @@ export default { const version = this.requestVersion const dataVersion = this.dataVersion const station = this.sortingStation - const site = String(this.$store.state.user.site || '').trim() - if (site !== this.site) { - this.initializeBoard() - return - } + // 与配置查询及WebSocket主题使用同一本屏工厂,刷新不依赖登录态 - rqrq + const site = this.site this.queryLoading = true try { - const { data } = await getAutoJ2SortingBoard({ site: this.$store.state.user.site, sortingStation: station }) + const { data } = await getAutoJ2SortingBoard({ site, sortingStation: station }) if (version !== this.requestVersion || !this.pushEnabled || dataVersion !== this.dataVersion) return if (!data || data.code !== 0 || !data.row) { this.rows = [] diff --git a/src/views/modules/haianWarehouse/dashboard/sortingBoard54.vue b/src/views/modules/haianWarehouse/dashboard/sortingBoard54.vue index 49dd4fe..d6b233b 100644 --- a/src/views/modules/haianWarehouse/dashboard/sortingBoard54.vue +++ b/src/views/modules/haianWarehouse/dashboard/sortingBoard54.vue @@ -4,11 +4,11 @@
-

海安 · {{ boardTitle }} +

{{ boardTitle }}

- 分拣位 {{ sortingStation }} · 工厂 {{ site || '未设置' }} +
@@ -19,11 +19,11 @@ 未完成 {{ pendingCount }} 已完成 {{ completedCount }} -
- {{ connectionText }} - {{ displayMessage }} - 刷新 -
+ + + + + @@ -53,15 +53,13 @@ {{ item.status }} {{ item.message || '-' }} - - {{ displayMessage }} - + @@ -117,12 +115,10 @@ export default { }, watch: { // 同组件切换四个人工路由时清空旧数据并递增请求版本,迟到响应不能覆盖新位置 - rqrq - '$route.fullPath' () { this.initializeBoard() }, - // 工厂变化立即断开旧订阅,禁止继续消费旧工厂数据 - rqrq - '$store.state.user.site' () { this.initializeBoard() } + '$route.fullPath' () { this.initializeBoard() } }, mounted () { - // 先初始化显式site再查询,初始化失败仅展示错误,不使用默认工厂发请求 - rqrq + // 海安专用屏先初始化固定工厂54再查询,直接访问无需登录或补充地址参数 - rqrq this.initializeBoard() this.clockTimer = setInterval(() => { this.now = Date.now() }, 1000) // 每30秒只复查配置,关闭时不查业务数据;配置重启生效后页面自动建立或关闭连接 - rqrq @@ -138,7 +134,7 @@ export default { clearInterval(this.scrollTimer) }, methods: { - // 固定屏支持URL显式site=54;登录态已有其他工厂则拒绝覆盖,防止看板改坏当前会话 - rqrq + // 专用屏独立使用工厂54,不读取或修改登录工厂;兼容site=54地址,错误工厂参数仍拒绝查询 - rqrq initializeBoard () { this.requestVersion++ this.disconnectWebSocket() @@ -152,25 +148,17 @@ export default { this.updatedAt = 0 this.lastReceivedAt = 0 this.siteReady = false - this.site = '' + this.site = '54' // 人工共用页仅接收R1H-R4H,错误路由不得请求自动分拣数据 - rqrq if (!['R1H', 'R2H', 'R3H', 'R4H'].includes(this.sortingStation)) { this.message = '人工看板仅支持 R1H–R4H 分拣位' return } - const storeSite = String(this.$store.state.user.site || '').trim() const querySite = this.$route.query.site if (querySite !== undefined && (typeof querySite !== 'string' || querySite.trim() !== '54')) { this.message = '海安看板的工厂参数必须为 site=54' return } - const site = querySite === undefined ? storeSite : querySite.trim() - if (site !== '54' || (storeSite && storeSite !== '54')) { - this.message = '请使用海安工厂打开看板;独立屏地址需带 ?site=54' - return - } - this.$store.commit('user/updateSite', site) - this.site = site this.siteReady = true this.message = '正在获取分拣数据…' this.$nextTick(() => { @@ -184,7 +172,8 @@ export default { const version = this.requestVersion this.configLoading = true try { - const { data } = await getSortingBoardConfig({ site: this.$store.state.user.site }) + // 显式传本屏工厂54读取开关,避免未登录或登录其他工厂时查错配置 - rqrq + const { data } = await getSortingBoardConfig({ site: this.site }) if (version !== this.requestVersion) return if (!data || data.code !== 0 || !data.row || data.row.site !== this.site) throw new Error('配置查询失败') this.pushEnabled = data.row.enabled === true @@ -251,8 +240,8 @@ export default { // HTTP手动刷新与推送按相同结构消费,完整核对site/位置;异常与空任务分开显示 - rqrq applyBoard (data) { if (!this.pushEnabled) return - const site = String(this.$store.state.user.site || '').trim() - if (!data || data.code !== 0 || !data.row || site !== this.site || data.row.site !== site || data.row.sortingStation !== this.sortingStation) { + // 响应必须属于本屏固定工厂及分拣位,登录工厂变化不影响独立屏 - rqrq + if (!data || data.code !== 0 || !data.row || data.row.site !== this.site || data.row.sortingStation !== this.sortingStation) { this.available = false this.rows = [] this.message = '看板数据校验失败,请检查工厂和分拣位' @@ -271,14 +260,11 @@ export default { const version = this.requestVersion const dataVersion = this.dataVersion const station = this.sortingStation - const site = String(this.$store.state.user.site || '').trim() - if (site !== this.site) { - this.initializeBoard() - return - } + // 与配置查询及WebSocket主题使用同一本屏工厂,刷新不依赖登录态 - rqrq + const site = this.site this.queryLoading = true try { - const { data } = await getManualSortingBoard({ site: this.$store.state.user.site, sortingStation: station }) + const { data } = await getManualSortingBoard({ site, sortingStation: station }) if (version !== this.requestVersion || !this.pushEnabled || dataVersion !== this.dataVersion) return if (!data || data.code !== 0 || !data.row) { this.rows = []