liu.tao3 1 year ago
commit ea4f16b0d9

@ -14,10 +14,13 @@ import java.util.List;
@Data
public class DataSetDataSource extends BaseChartDataSource {
@ApiModelProperty(notes = "数据来源,可能为数据集或者表达式")
private String source;
@ApiModelProperty(notes = "数据集标识")
private String businessKey;
@ApiModelProperty(notes = "数据源标识,仅用于出码时使用")
@ApiModelProperty(notes = "数据源标识")
private String dataSourceKey;
@ApiModelProperty(notes = "数据集类型")

@ -1,18 +0,0 @@
{
"success": false,
"data": [
{
"sum(num)": 1456532
}
],
"columnData": {
"num": {
"type": "bigint",
"tableName": "",
"originalColumn": "num",
"aggregate": "sum",
"alias": "sum(num)",
"remark": "访问次数"
}
}
}

@ -0,0 +1,18 @@
{
"success": false,
"data": [
{
"title": 1234
}
],
"columnData": {
"title": {
"type": "varchar",
"tableName": "",
"originalColumn": "title",
"aggregate": "",
"alias": "title",
"remark": "标题"
}
}
}

@ -6,7 +6,7 @@
}
],
"columnData": {
"num": {
"title": {
"type": "varchar",
"tableName": "",
"originalColumn": "title",

@ -1,6 +1,6 @@
{
"name": "@gcpaas/data-room-ui",
"version": "2.0.1-2023101601-Alpha",
"version": "2.0.1-RELEASE",
"description": "自定义大屏",
"author": "gcpaas",
"license": "MIT",

@ -40,23 +40,23 @@ 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) {
// 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)
}
// 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) {
//
if (config.dataSource.businessKey) {
config.customize.title = data && data.data && data.data.length ? data.data[0][config.dataSource.metricField] : '暂无数据'
config.option.data = data && data.data && data.data.length ? data.data :[]
config.option.data = data && data.data && data.data.length ? data.data : []
}
return config
}

@ -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)
//
this.updateComputedDatas({ code: config.code, name: config.name, data: config.customize.title })
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
}

@ -27,7 +27,7 @@
label="数据来源"
>
<el-radio-group
v-model="dataSourceStyle"
v-model="config.dataSource.source "
class="bs-el-radio-group"
>
<el-radio label="dataset">
@ -39,7 +39,7 @@
</el-radio-group>
</el-form-item>
<el-form-item
v-if="dataSourceStyle === 'dataset'"
v-if="config.dataSource.source === 'dataset'"
label="数据集"
>
<data-set-select
@ -56,7 +56,7 @@
</data-set-select>
</el-form-item>
<el-form-item
v-if="dataSourceStyle === 'expression' && config.option.displayOption.expression && config.option.displayOption.expression.enable"
v-if="config.dataSource.source === 'expression' && config.option.displayOption.expression && config.option.displayOption.expression.enable"
label="表达式"
>
<i
@ -102,7 +102,7 @@ data.forEach(item => {
</div>
</div>
<div
v-if="!['tree','multipleNumberChart','carousel'].includes(config.type) && config.option.displayOption.dataSourceType.enable "
v-if="!['tree','multipleNumberChart','carousel'].includes(config.type) && config.option.displayOption.dataSourceType.enable && config.dataSource.source !== 'expression'"
class="data-setting-data-box"
>
<div class="lc-field-head">
@ -300,7 +300,7 @@ data.forEach(item => {
<el-table-column
prop="width"
label="列宽"
width='90'
width="90"
align="center"
>
<template slot-scope="scope">
@ -470,7 +470,7 @@ data.forEach(item => {
</div>
</div>
<div
v-if="config.option.displayOption.params.enable"
v-if="config.option.displayOption.params.enable && config.dataSource.source !== 'expression'"
class="data-setting-data-box"
>
<div class="lc-field-head">
@ -642,7 +642,6 @@ export default {
},
data () {
return {
dataSourceStyle: 'dataset', //
fieldsList: [],
params: [], //
datasetName: '',
@ -764,11 +763,10 @@ export default {
}
},
methods: {
changeDsid(dsId){
this.clearVerify()
this.config.customize.columnConfig=[]
changeDsid (dsId) {
this.clearVerify()
this.config.customize.columnConfig = []
this.getDataSetDetailsById(dsId, 'treeTable')
},
//
openExpression () {

@ -67,6 +67,7 @@ export default function (customConfig) {
className:
'com.gccloud.dataroom.core.module.chart.components.datasource.DataSetDataSource',
dataSourceKey: '', // 数据源,选择不同数据库
source: 'dataset',
businessKey: '', // 数据集标识
dimensionField: '', // 维度
metricField: '', // 指标

@ -18,6 +18,10 @@ export default {
const pageInfo = handleResData(data)
// 兼容边框配置
pageInfo.chartList.forEach((item) => {
if (item.dataSource) {
item.dataSource.source = item.dataSource?.source || 'dataset'
}
if (!item.border) {
item.border = { type: '', titleHeight: 60, fontSize: 16, isTitle: true, padding: [0, 0, 0, 0] }
}

@ -22,7 +22,10 @@ spring:
url: jdbc:h2:file:/db/h2DBData # jdbc:h2:mem:test
username: root
password: ${DB_PASSWORD:123456}
schema: classpath:init-h2.sql
sql:
init:
schema-locations: classpath:init-h2.sql
mode: always
gc:
starter:
file:

Loading…
Cancel
Save