修复托盘登录电池激活状态显示
This commit is contained in:
@@ -342,6 +342,20 @@ export default {
|
|||||||
const payload = res && res.data ? res.data : (res || {})
|
const payload = res && res.data ? res.data : (res || {})
|
||||||
return payload.data || payload
|
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) {
|
formatLabel (item) {
|
||||||
return `${item.tray_format} / ${item.battery_format} / ${item.battery_count}`
|
return `${item.tray_format} / ${item.battery_format} / ${item.battery_count}`
|
||||||
},
|
},
|
||||||
@@ -454,10 +468,9 @@ export default {
|
|||||||
action: 'check_elements_code',
|
action: 'check_elements_code',
|
||||||
battery_id: batteryId
|
battery_id: batteryId
|
||||||
})
|
})
|
||||||
const payload = res && res.data ? res.data : (res || {})
|
const { code, message, data } = this.normalizeBatteryCheckResult(res)
|
||||||
const data = payload.data || {}
|
if (code !== 0) {
|
||||||
if (payload.code !== undefined && Number(payload.code) !== 0) {
|
this.$message.error(message || this.$t(this.key('format_error')))
|
||||||
this.$message.error(payload.msg || payload.errmsg || this.$t(this.key('format_error')))
|
|
||||||
this.removeBattery(channel)
|
this.removeBattery(channel)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user