mirror of
https://github.com/dataease/dataease.git
synced 2025-02-24 11:32:57 +08:00
refactor(仪表板、数据大屏): 外部参数支持传入比对操作模式,修复日期跳转外部参数无法查询到数据问题,国际化问题
Some checks are pending
Typos Check / Spell Check with Typos (push) Waiting to run
Some checks are pending
Typos Check / Spell Check with Typos (push) Waiting to run
This commit is contained in:
parent
edccd53f03
commit
69c7d5486c
@ -872,7 +872,7 @@ const save = () => {
|
||||
}
|
||||
}
|
||||
if (subCheckCount > 0) {
|
||||
ElMessage.error(t('visualization.delete_warn', [linkJumpInfo.sourceFieldName]))
|
||||
ElMessage.error(t('visualization.jump_null_tips', [linkJumpInfo.sourceFieldName]))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -1042,6 +1042,7 @@ export const dvMainStore = defineStore('dataVisualization', {
|
||||
addOuterParamsFilter(paramsPre, curComponentData = this.componentData, source = 'inner') {
|
||||
// params 结构 {key1:value1,key2:value2}
|
||||
const params = {}
|
||||
const paramsVersion = (paramsPre && paramsPre['outerParamsVersion']) || 'v1'
|
||||
if (this.nowPanelOuterParamsBaseInfo) {
|
||||
let errorCount = 0
|
||||
let errorMes = ''
|
||||
@ -1079,7 +1080,14 @@ export const dvMainStore = defineStore('dataVisualization', {
|
||||
for (let index = 0; index < curComponentData.length; index++) {
|
||||
const element = curComponentData[index]
|
||||
if (['UserView', 'VQuery'].includes(element.component)) {
|
||||
this.trackOuterFilterCursor(element, params, preActiveComponentIds, trackInfo, source)
|
||||
this.trackOuterFilterCursor(
|
||||
element,
|
||||
params,
|
||||
preActiveComponentIds,
|
||||
trackInfo,
|
||||
source,
|
||||
paramsVersion
|
||||
)
|
||||
this.componentData[index] = element
|
||||
} else if (element.component === 'Group') {
|
||||
element.propValue.forEach((groupItem, index) => {
|
||||
@ -1088,7 +1096,8 @@ export const dvMainStore = defineStore('dataVisualization', {
|
||||
params,
|
||||
preActiveComponentIds,
|
||||
trackInfo,
|
||||
source
|
||||
source,
|
||||
paramsVersion
|
||||
)
|
||||
element.propValue[index] = groupItem
|
||||
})
|
||||
@ -1100,7 +1109,8 @@ export const dvMainStore = defineStore('dataVisualization', {
|
||||
params,
|
||||
preActiveComponentIds,
|
||||
trackInfo,
|
||||
source
|
||||
source,
|
||||
paramsVersion
|
||||
)
|
||||
tabItem.componentData[index] = tabComponent
|
||||
})
|
||||
@ -1115,7 +1125,14 @@ export const dvMainStore = defineStore('dataVisualization', {
|
||||
useEmitt().emitter.emit('query-data-' + element.id)
|
||||
}
|
||||
},
|
||||
trackOuterFilterCursor(element, params, preActiveComponentIds, trackInfo, source) {
|
||||
trackOuterFilterCursor(
|
||||
element,
|
||||
params,
|
||||
preActiveComponentIds,
|
||||
trackInfo,
|
||||
source,
|
||||
outerParamsVersion = 'v1'
|
||||
) {
|
||||
// 弹窗区域禁用时 在弹窗区域的组件不生效
|
||||
if (
|
||||
!['UserView', 'VQuery'].includes(element.component) ||
|
||||
@ -1127,9 +1144,17 @@ export const dvMainStore = defineStore('dataVisualization', {
|
||||
// 外部参数 可能会包含多个参数
|
||||
Object.keys(params).forEach(function (sourceInfo) {
|
||||
// 获取外部参数的值 sourceInfo 是外部参数名称 支持数组传入
|
||||
let paramValue = params[sourceInfo]
|
||||
let paramValueStr = params[sourceInfo]
|
||||
const parmaValueSource = params[sourceInfo]
|
||||
let operatorV2, paramValue, paramValueStr, parmaValueSource
|
||||
if (outerParamsVersion === 'v2') {
|
||||
operatorV2 = params[sourceInfo].operator
|
||||
paramValue = params[sourceInfo].value
|
||||
paramValueStr = params[sourceInfo].value
|
||||
parmaValueSource = params[sourceInfo].value
|
||||
} else {
|
||||
paramValue = params[sourceInfo]
|
||||
paramValueStr = params[sourceInfo]
|
||||
parmaValueSource = params[sourceInfo]
|
||||
}
|
||||
let operator = 'in'
|
||||
if (paramValue && !Array.isArray(paramValue)) {
|
||||
paramValue = [paramValue]
|
||||
@ -1157,7 +1182,7 @@ export const dvMainStore = defineStore('dataVisualization', {
|
||||
const targetFieldId = targetInfoArray[1] // 目标图表列ID
|
||||
const condition = {
|
||||
fieldId: targetFieldId,
|
||||
operator: operator,
|
||||
operator: operatorV2 || operator,
|
||||
value: paramValue,
|
||||
viewIds: [targetViewId]
|
||||
}
|
||||
|
@ -516,7 +516,7 @@ export function checkCanvasChangePre(callBack) {
|
||||
const tips =
|
||||
(dvInfo.value.type === 'dashboard'
|
||||
? t('work_branch.dashboard')
|
||||
: t('work_branch.big_data_screen')) + t('work_branch.save_conflict_tips')
|
||||
: t('work_branch.big_data_screen')) + t('visualization.save_conflict_tips')
|
||||
checkCanvasChange(params).then(rsp => {
|
||||
if (rsp && rsp.data === 'Repeat') {
|
||||
ElMessageBox.confirm(tips, {
|
||||
|
@ -495,13 +495,17 @@ const jumpClick = param => {
|
||||
curFilter.filter.forEach(filterItem => {
|
||||
targetViewInfoList.forEach(targetViewInfo => {
|
||||
if (targetViewInfo.sourceFieldActiveId === filterItem.filterId) {
|
||||
filterOuterParams[targetViewInfo.outerParamsName] = filterItem.value
|
||||
filterOuterParams[targetViewInfo.outerParamsName] = {
|
||||
operator: filterItem.operator,
|
||||
value: filterItem.value
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
let attachParamsInfo
|
||||
if (Object.keys(filterOuterParams).length > 0) {
|
||||
filterOuterParams['outerParamsVersion'] = 'v2'
|
||||
attachParamsInfo =
|
||||
'&attachParams=' + encodeURIComponent(Base64.encode(JSON.stringify(filterOuterParams)))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user