refactor(wms/report/zha): 统一从configJson解析报表配置参数

将多个页面中直接从res.rows[0]读取参数的逻辑,改为先解析configJson字段再取值,优化代码一致性和可维护性
This commit is contained in:
2026-05-26 09:13:06 +08:00
parent 6f7a85025d
commit 6f3bd2165f
7 changed files with 40 additions and 33 deletions

View File

@@ -36,11 +36,12 @@ export default {
}).then(res => { }).then(res => {
console.log(res) console.log(res)
if (res.rows.length == 1) { if (res.rows.length == 1) {
this.actionTypes = res.rows[0].actionTypes const config = JSON.parse(res.rows[0].configJson)
this.actionQueryParams = res.rows[0].actionQueryParams this.actionTypes = config.actionTypes
this.baseQueryParams = res.rows[0].baseQueryParams this.actionQueryParams = config.actionQueryParams
this.warehouseOptions = res.rows[0].warehouseOptions this.baseQueryParams = config.baseQueryParams
this.productionLine = res.rows[0].productionLine this.warehouseOptions = config.warehouseOptions
this.productionLine = config.productionLine
this.loading = false this.loading = false
} }
}) })

View File

@@ -36,11 +36,12 @@ export default {
}).then(res => { }).then(res => {
console.log(res) console.log(res)
if (res.rows.length == 1) { if (res.rows.length == 1) {
this.actionTypes = res.rows[0].actionTypes const config = JSON.parse(res.rows[0].configJson)
this.actionQueryParams = res.rows[0].actionQueryParams this.actionTypes = config.actionTypes
this.baseQueryParams = res.rows[0].baseQueryParams this.actionQueryParams = config.actionQueryParams
this.warehouseOptions = res.rows[0].warehouseOptions this.baseQueryParams = config.baseQueryParams
this.productionLine = res.rows[0].productionLine this.warehouseOptions = config.warehouseOptions
this.productionLine = config.productionLine
this.loading = false this.loading = false
} }
}) })

View File

@@ -36,11 +36,12 @@ export default {
}).then(res => { }).then(res => {
console.log(res) console.log(res)
if (res.rows.length == 1) { if (res.rows.length == 1) {
this.actionTypes = res.rows[0].actionTypes const config = JSON.parse(res.rows[0].configJson)
this.actionQueryParams = res.rows[0].actionQueryParams this.actionTypes = config.actionTypes
this.baseQueryParams = res.rows[0].baseQueryParams this.actionQueryParams = config.actionQueryParams
this.warehouseOptions = res.rows[0].warehouseOptions this.baseQueryParams = config.baseQueryParams
this.productionLine = res.rows[0].productionLine this.warehouseOptions = config.warehouseOptions
this.productionLine = config.productionLine
this.loading = false this.loading = false
} }
}) })

View File

@@ -36,11 +36,12 @@ export default {
}).then(res => { }).then(res => {
console.log(res) console.log(res)
if (res.rows.length == 1) { if (res.rows.length == 1) {
this.actionTypes = res.rows[0].actionTypes const config = JSON.parse(res.rows[0].configJson)
this.actionQueryParams = res.rows[0].actionQueryParams this.actionTypes = config.actionTypes
this.baseQueryParams = res.rows[0].baseQueryParams this.actionQueryParams = config.actionQueryParams
this.warehouseOptions = res.rows[0].warehouseOptions this.baseQueryParams = config.baseQueryParams
this.productionLine = res.rows[0].productionLine this.warehouseOptions = config.warehouseOptions
this.productionLine = config.productionLine
this.loading = false this.loading = false
} }
}) })

View File

@@ -34,9 +34,10 @@ export default {
}).then(res => { }).then(res => {
console.log(res) console.log(res)
if (res.rows.length == 1) { if (res.rows.length == 1) {
this.baseQueryParams = res.rows[0].baseQueryParams const config = JSON.parse(res.rows[0].configJson)
this.warehouseOptions = res.rows[0].warehouseOptions this.baseQueryParams = config.baseQueryParams
this.productionLine = res.rows[0].productionLine this.warehouseOptions = config.warehouseOptions
this.productionLine = config.productionLine
this.loading = false this.loading = false
} }
}) })

View File

@@ -36,11 +36,12 @@ export default {
}).then(res => { }).then(res => {
console.log(res) console.log(res)
if (res.rows.length == 1) { if (res.rows.length == 1) {
this.actionTypes = res.rows[0].actionTypes const config = JSON.parse(res.rows[0].configJson)
this.actionQueryParams = res.rows[0].actionQueryParams this.actionTypes = config.actionTypes
this.baseQueryParams = res.rows[0].baseQueryParams this.actionQueryParams = config.actionQueryParams
this.warehouseOptions = res.rows[0].warehouseOptions this.baseQueryParams = config.baseQueryParams
this.productionLine = res.rows[0].productionLine this.warehouseOptions = config.warehouseOptions
this.productionLine = config.productionLine
this.loading = false this.loading = false
} }
}) })

View File

@@ -36,11 +36,12 @@ export default {
}).then(res => { }).then(res => {
console.log(res) console.log(res)
if (res.rows.length == 1) { if (res.rows.length == 1) {
this.actionTypes = res.rows[0].actionTypes const config = JSON.parse(res.rows[0].configJson)
this.actionQueryParams = res.rows[0].actionQueryParams this.actionTypes = config.actionTypes
this.baseQueryParams = res.rows[0].baseQueryParams this.actionQueryParams = config.actionQueryParams
this.warehouseOptions = res.rows[0].warehouseOptions this.baseQueryParams = config.baseQueryParams
this.productionLine = res.rows[0].productionLine this.warehouseOptions = config.warehouseOptions
this.productionLine = config.productionLine
this.loading = false this.loading = false
} }
}) })