|
@@ -68,23 +68,26 @@
|
|
|
<el-input v-model="computedSearchKey" clearable placeholder="输入以搜索" size="mini"></el-input>
|
|
|
</div>
|
|
|
<div class="fields" style="height: 462px">
|
|
|
- <div class="tab">维度</div>
|
|
|
+ <div class="tab">主表名:{{tableName}}</div>
|
|
|
<template v-for="field of tobeChooseWeiduSearched">
|
|
|
<div v-if="nowComputedField.columnTitle !== field.columnTitle" :key="field.columnTitle" :title="field.columnName" class="weidu" @click="onComputedAddField(field)">
|
|
|
{{ field.columnTitle + '【' + field.columnName + '】' }}
|
|
|
</div>
|
|
|
</template>
|
|
|
- <div class="tab">指标</div>
|
|
|
- <template v-for="field of tobeChooseZhibiaoSearched">
|
|
|
- <div v-if="nowComputedField.columnTitle !== field.columnTitle" :key="field.columnTitle" :title="field.columnName" class="zhibiao" @click="onComputedAddField(field)">
|
|
|
- {{ field.columnTitle + '【' + field.columnName + '】' }}
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- <div class="tab">关联字段</div>
|
|
|
- <template v-for="field of associationList">
|
|
|
- <div v-if="nowComputedField.columnTitle !== field.columnTitle" :key="field.columnTitle" :title="field.columnName" class="zhibiao guanlian" @click="onComputedAddAssociationField(field)">
|
|
|
- {{ field.columnTitle + '【' + field.columnName + '】' }}
|
|
|
- </div>
|
|
|
+<!-- <div class="tab">指标</div>-->
|
|
|
+<!-- <template v-for="field of tobeChooseZhibiaoSearched">-->
|
|
|
+<!-- <div v-if="nowComputedField.columnTitle !== field.columnTitle" :key="field.columnTitle" :title="field.columnName" class="zhibiao" @click="onComputedAddField(field)">-->
|
|
|
+<!-- {{ field.columnTitle + '【' + field.columnName + '】' }}-->
|
|
|
+<!-- </div>-->
|
|
|
+<!-- </template>-->
|
|
|
+
|
|
|
+ <template v-for="field of associationListFilter">
|
|
|
+ <div class="tab">关联表:{{ field.tableName }}</div>
|
|
|
+ <template v-for="fieldChild of field.children">
|
|
|
+ <div v-if="nowComputedField.columnTitle !== fieldChild.columnTitle" :key="fieldChild.columnTitle" :title="fieldChild.columnName" class="zhibiao guanlian" @click="onComputedAddAssociationField(fieldChild)">
|
|
|
+ {{ fieldChild.columnTitle + '【' + fieldChild.columnName + '】' }}
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
</template>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -110,7 +113,7 @@
|
|
|
<div class="btns">
|
|
|
<el-button size="mini" @click="showEditComputedField = false"> 取消</el-button>
|
|
|
<el-button size="mini" type="primary" @click="onEditComputedFieldConfirm"> 确定</el-button>
|
|
|
- <el-button size="mini" type="success" @click="parserSqlClick">语法检查</el-button>
|
|
|
+ <el-button size="mini" type="success" v-if="datasource && datasource.dsTypeSyl === 'mysql' " @click="parserSqlClick">语法检查</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
@@ -134,6 +137,7 @@ export default {
|
|
|
name: 'customEventExpression',
|
|
|
data() {
|
|
|
return {
|
|
|
+ tableName:'',
|
|
|
showEditComputedField: false,
|
|
|
datasource: null,
|
|
|
functionList: [], // 用于创建计算字段的函数列表
|
|
@@ -181,6 +185,28 @@ export default {
|
|
|
return this.tobeChooseZhibiao.filter((i) => {
|
|
|
return i.columnName.toUpperCase().includes(key) || i.columnTitle.includes(key)
|
|
|
})
|
|
|
+ },
|
|
|
+ associationListFilter(){
|
|
|
+ let list = this.associationList.reduce((acc, o) => {
|
|
|
+ const existing = acc.find(l => l.tableName === o.tableName);
|
|
|
+ if (!existing) {
|
|
|
+ acc.push({
|
|
|
+ id: acc.length,
|
|
|
+ tableName: o.tableName,
|
|
|
+ children: []
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return acc;
|
|
|
+ }, []);
|
|
|
+ // 合并子列表
|
|
|
+ list.forEach((item) => {
|
|
|
+ this.associationList.forEach((value) => {
|
|
|
+ if (item.tableName === value.tableName) {
|
|
|
+ item.children.push(value);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ return list
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -240,17 +266,16 @@ export default {
|
|
|
this.fillback(this.dbLinkId)
|
|
|
this.getInitData()
|
|
|
this.datasourceId = this.dbSourceId
|
|
|
- this.onDataSourceId(this.dbSourceId)
|
|
|
+ // this.onDataSourceId(this.dbSourceId)
|
|
|
this.getGlobalData()
|
|
|
},
|
|
|
// 获取初始化数据,
|
|
|
getInitData() {
|
|
|
//获取数据集
|
|
|
cubeFieldList({ cubeDataId: this.dbLinkId }).then((res) => {
|
|
|
- let tableFieldsWeidu = res.data.data.filter((i) => i.dimensionType === 'WEIDU').sort((a, b) => a.sortNum - b.sortNum)
|
|
|
- let tableFieldsZhibiao = res.data.data.filter((i) => i.dimensionType === 'ZHIBIAO').sort((a, b) => a.sortNum - b.sortNum)
|
|
|
+ let tableFieldsWeidu = res.data.data
|
|
|
+ if (tableFieldsWeidu && tableFieldsWeidu.length) this.tableName = tableFieldsWeidu[0].tableName
|
|
|
this.tobeChooseWeidu = tableFieldsWeidu.filter((i) => i.columnAttr == 'NORMAL')
|
|
|
- this.tobeChooseZhibiao = tableFieldsZhibiao.filter((i) => i.columnAttr == 'NORMAL')
|
|
|
})
|
|
|
jsfuncAttrList().then((res) => {
|
|
|
let list = res.data.data
|
|
@@ -259,14 +284,14 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
async fillback(id) {
|
|
|
- let cubeRes = await cubeDetail({ cubeDataId: id })
|
|
|
- if (!cubeRes.data.code === 200) return
|
|
|
- let { datasourceId } = cubeRes.data.data
|
|
|
- // 获取数据源详情
|
|
|
- getDatasourceDetail({ id: datasourceId }).then((res) => {
|
|
|
- this.datasource = res.data.data
|
|
|
- this.getFuncList()
|
|
|
- })
|
|
|
+ // let cubeRes = await cubeDetail({ cubeDataId: id })
|
|
|
+ // if (!cubeRes.data.code === 200) return
|
|
|
+ // let { datasourceId } = cubeRes.data.data
|
|
|
+ // // 获取数据源详情
|
|
|
+ // getDatasourceDetail({ id: datasourceId }).then((res) => {
|
|
|
+ // this.datasource = res.data.data
|
|
|
+ // this.getFuncList()
|
|
|
+ // })
|
|
|
reportdatasourcePage({ current: 1, size: 1000 }).then((res) => {
|
|
|
this.dbSourceList = res.data.data.records
|
|
|
})
|
|
@@ -302,6 +327,12 @@ export default {
|
|
|
this.tableListed = res.data.data.records
|
|
|
this.dbsoursTableLoading = false
|
|
|
})
|
|
|
+ // 获取数据源详情
|
|
|
+ getDatasourceDetail({ id: val }).then((res) => {
|
|
|
+ this.datasource = res.data.data
|
|
|
+ if (this.datasource.dsTypeSyl === 'mysql') this.getFuncList()
|
|
|
+
|
|
|
+ })
|
|
|
},
|
|
|
onSelectTable(val) {
|
|
|
this.tableListed = this.tableList.filter((i) => (i.tableComments && i.tableComments.includes(val)) || i.tableViewName.includes(val))
|