From 2ba84edae3ee59e7f325ee237f9857ea1bc6e300 Mon Sep 17 00:00:00 2001 From: sheng <905537351@qq.com> Date: Thu, 25 Jun 2026 23:37:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=89=98=E7=9B=98=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E7=94=B5=E6=B1=A0=E6=BF=80=E6=B4=BB=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tray-registration/index.vue | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/views/planning-production/production-monitoring/tray-registration/index.vue b/src/views/planning-production/production-monitoring/tray-registration/index.vue index d5233287..ffd6eb03 100644 --- a/src/views/planning-production/production-monitoring/tray-registration/index.vue +++ b/src/views/planning-production/production-monitoring/tray-registration/index.vue @@ -342,6 +342,20 @@ export default { const payload = res && res.data ? res.data : (res || {}) return payload.data || payload }, + normalizeBatteryCheckResult (res) { + if (res && res.code !== undefined) { + return { + code: Number(res.code), + message: res.msg || res.errmsg, + data: res.data || {} + } + } + return { + code: 0, + message: '', + data: res || {} + } + }, formatLabel (item) { return `${item.tray_format} / ${item.battery_format} / ${item.battery_count}` }, @@ -454,10 +468,9 @@ export default { action: 'check_elements_code', battery_id: batteryId }) - const payload = res && res.data ? res.data : (res || {}) - const data = payload.data || {} - if (payload.code !== undefined && Number(payload.code) !== 0) { - this.$message.error(payload.msg || payload.errmsg || this.$t(this.key('format_error'))) + const { code, message, data } = this.normalizeBatteryCheckResult(res) + if (code !== 0) { + this.$message.error(message || this.$t(this.key('format_error'))) this.removeBattery(channel) return }