1
This commit is contained in:
@@ -231,34 +231,48 @@ export default {
|
||||
console.log('加载配置响应:', res)
|
||||
|
||||
// 重置配置列表
|
||||
this.configList = []
|
||||
this.configList.splice(0, this.configList.length)
|
||||
|
||||
if (res && res.code === 200 && res.rows && res.rows.length > 0) {
|
||||
console.log('原始配置数据:', res.rows)
|
||||
|
||||
// 过滤并转换配置项
|
||||
const configs = res.rows
|
||||
.filter(item => {
|
||||
// 确保 configKey 存在且以配置前缀开头,并且不是正好等于前缀(即必须有分销标识后缀)
|
||||
return item && item.configKey &&
|
||||
const isValid = item && item.configKey &&
|
||||
item.configKey.startsWith(this.configKeyPrefix) &&
|
||||
item.configKey.length > this.configKeyPrefix.length
|
||||
if (!isValid && item) {
|
||||
console.warn('过滤掉的无效配置项:', item)
|
||||
}
|
||||
return isValid
|
||||
})
|
||||
.map(item => {
|
||||
const distributionMark = item.configKey.replace(this.configKeyPrefix, '').trim()
|
||||
return {
|
||||
const configItem = {
|
||||
distributionMark: distributionMark,
|
||||
touser: item.configValue || '',
|
||||
configId: item.configId,
|
||||
configKey: item.configKey,
|
||||
configName: item.configName || `${distributionMark}分销标识接收人`
|
||||
}
|
||||
console.log('解析配置项:', item.configKey, '->', configItem)
|
||||
return configItem
|
||||
})
|
||||
.filter(item => {
|
||||
// 再次过滤,确保分销标识不为空
|
||||
return item.distributionMark && item.distributionMark.length > 0
|
||||
const isValid = item.distributionMark && item.distributionMark.length > 0
|
||||
if (!isValid) {
|
||||
console.warn('过滤掉的分销标识为空的配置项:', item)
|
||||
}
|
||||
return isValid
|
||||
})
|
||||
|
||||
this.configList = configs
|
||||
// 使用 splice 确保 Vue 2 的响应式更新
|
||||
this.configList.splice(0, 0, ...configs)
|
||||
console.log('解析后的配置列表:', this.configList)
|
||||
console.log('配置列表长度:', this.configList.length)
|
||||
|
||||
if (configs.length > 0) {
|
||||
this.$message.success(`成功加载 ${configs.length} 条配置`)
|
||||
|
||||
Reference in New Issue
Block a user