修复电池工序验证数据表格显示
This commit is contained in:
@@ -168,15 +168,32 @@ export default {
|
||||
syncProcessOptions () {
|
||||
this.form.processOptions = this.processOptions
|
||||
},
|
||||
normalizeProcessPayload (res) {
|
||||
const payload = res && res.code !== undefined && res.data !== undefined ? res.data : res
|
||||
if (
|
||||
payload &&
|
||||
!Array.isArray(payload) &&
|
||||
payload.data &&
|
||||
!Array.isArray(payload.data) &&
|
||||
(payload.data.flow_process || payload.data.data)
|
||||
) {
|
||||
return payload.data
|
||||
}
|
||||
return payload || {}
|
||||
},
|
||||
normalizeProcessRows (payload) {
|
||||
if (Array.isArray(payload)) return payload
|
||||
return Array.isArray(payload.data) ? payload.data : []
|
||||
},
|
||||
verifyData () {
|
||||
if (!this.ensureBatteryInput()) return
|
||||
this.loading = true
|
||||
verifyBatteryProcessInfo(this.form)
|
||||
.then(res => {
|
||||
const data = res && res.data ? res.data : res
|
||||
const data = this.normalizeProcessPayload(res)
|
||||
this.processOptions = data.flow_process || []
|
||||
this.form.processOptions = this.processOptions
|
||||
this.tableData = data.data || []
|
||||
this.tableData = this.normalizeProcessRows(data)
|
||||
this.showProcess = true
|
||||
})
|
||||
.finally(() => {
|
||||
@@ -192,8 +209,8 @@ export default {
|
||||
this.loading = true
|
||||
changeBatteryProcess(this.form)
|
||||
.then(res => {
|
||||
const data = res && res.data ? res.data : res
|
||||
this.tableData = Array.isArray(data) ? data : (data.data || [])
|
||||
const data = this.normalizeProcessPayload(res)
|
||||
this.tableData = this.normalizeProcessRows(data)
|
||||
})
|
||||
.finally(() => {
|
||||
this.loading = false
|
||||
|
||||
Reference in New Issue
Block a user