fix:修复组件查看数据的问题

main
liu.shiyi 1 year ago
parent cb00c0805a
commit b196affbe0

@ -40,17 +40,17 @@ export default {
//
getDataByExpression (config) {
//
const len = this.config.expressionCodes ? this.config.expressionCodes.length : 0
const len1 = this.currentComputedDatas ? Object.keys(this.currentComputedDatas).length : 0
const len2 = this.currentDataset ? Object.keys(this.currentDataset).length : 0
if (len && len === len1 + len2) {
// const len = this.config.expressionCodes ? this.config.expressionCodes.length : 0
// const len1 = this.currentComputedDatas ? Object.keys(this.currentComputedDatas).length : 0
// const len2 = this.currentDataset ? Object.keys(this.currentDataset).length : 0
// if (len && len === len1 + len2) {
// eslint-disable-next-line no-new-func
const result = new Function('dataset', 'computedDatas', this.config.expression)
config.customize.title = result(this.dataset, this.computedDatas)
//
this.updateComputedDatas({ code: config.code, name: config.name, data: config.customize.title })
// this.changeChartConfig(config)
}
// }
},
dataFormatting (config, data) {
//

@ -40,17 +40,19 @@ export default {
//
getDataByExpression (config) {
//
const len = this.config.expressionCodes ? this.config.expressionCodes.length : 0
const len1 = this.currentComputedDatas ? Object.keys(this.currentComputedDatas).length : 0
const len2 = this.currentDataset ? Object.keys(this.currentDataset).length : 0
if (len && len === len1 + len2) {
// const len = this.config.expressionCodes ? this.config.expressionCodes.length : 0
// const len1 = this.currentComputedDatas ? Object.keys(this.currentComputedDatas).length : 0
// const len2 = this.currentDataset ? Object.keys(this.currentDataset).length : 0
// console.log('len', len, len1, len2)
// if (len && len === len1 + len2) {
// eslint-disable-next-line no-new-func
const result = new Function('dataset', 'computedDatas', this.config.expression)
config.customize.title = result(this.dataset, this.computedDatas)
console.log(result(this.dataset, this.computedDatas))
//
this.updateComputedDatas({ code: config.code, name: config.name, data: config.customize.title })
// this.changeChartConfig(config)
}
// }
},
dataFormatting (config, data) {
//

@ -107,7 +107,7 @@ export default {
getDataList (config) {
this.loading = true
// G2option
if (['customComponent', 'remoteComponent', 'echartsComponent'].includes(config.type) && (!config.dataSource.businessKey)) {
if ((['customComponent', 'remoteComponent', 'echartsComponent'].includes(config.type) && (!config.dataSource.businessKey)) || (config.expressionCodes && config.expressionCodes.length)) {
this.getDataByOption(config)
this.fieldsFormat()
this.loading = false
@ -146,6 +146,8 @@ export default {
list = config.option.data.children
} else if (config.type === 'tables') {
list = config.option.tableData
} else if (config.expressionCodes && config.expressionCodes.length) {
list = [{ title: config.customize.title }]
} else {
list = config.option.data
}

Loading…
Cancel
Save