fix: 修复设计器添加业务组件时,出现配置面板数据不对应的情况

main
wu.jian2 2 years ago
parent 4c0e317f52
commit f86b00279d

@ -431,7 +431,13 @@ export default {
}
config.code = this.focus.code
config.name = this.focus.name
config = getRemoteComponentConfig(this.focus.code, this.focus.name)
this.$nextTick(() => {
config = cloneDeep(getRemoteComponentConfig(this.focus.code, this.focus.name))
config.setting = this.resolveStrSetting(this.focus.settingContent).setting
this.$emit('setRemoteComponent', config)
})
// config = getRemoteComponentConfig(this.focus.code, this.focus.name)
this.$emit('setRemoteComponent', config)
}
},
@ -472,6 +478,38 @@ export default {
})
}
},
/**
* 处理当前组件的字符串配置
*/
resolveStrSetting (settingContent) {
// eslint-disable-next-line prefer-const
let option = {}
// eslint-disable-next-line prefer-const
let setting = []
// eslint-disable-next-line prefer-const, no-unused-vars
let title = []
// eslint-disable-next-line prefer-const, no-unused-vars
let data = []
// eslint-disable-next-line prefer-const
settingContent = settingContent.replaceAll('const ', '')
// export default
settingContent = settingContent.replace(/export default[\s\S]*/, '')
eval(settingContent)
if (this.config?.option) {
this.config.option = {
...this.config.option,
...option
}
}
if (this.config?.setting) {
this.config.setting = setting
}
console.log('resolveStrSetting', option, setting)
return {
option,
setting
}
},
//
getCatalogList () {
const url = this.activeName === 'combination' ? '/bigScreen/type/list/componentCatalog' : '/bigScreen/type/list/bizComponentCatalog'

@ -373,7 +373,7 @@ export default {
this.form.refreshConfig = []
} else {
this.pageInfo.chartList.forEach(chart => {
if (chart.dataSource.businessKey) {
if (chart.dataSource?.businessKey) {
this.chartOptions.push({
code: chart.code,
title: chart.title,
@ -470,7 +470,7 @@ export default {
this.$emit('close')
},
timerEmptyState () {
return this.pageInfo.chartList.every(chart => chart.dataSource.businessKey === '')
return this.pageInfo.chartList.every(chart => chart.dataSource?.businessKey === '')
}
}
}

@ -32,5 +32,4 @@ export default function speak ({ text, speechRate, lang, volume, pitch }, endEve
startEvent && startEvent()
}
speechSynthesis.speak(speechUtterance)
console.log(2)
}

Loading…
Cancel
Save