feat: 国际化

This commit is contained in:
dataeaseShu 2024-11-01 18:14:07 +08:00
parent 1c1d57daf6
commit 058fb82c0c
13 changed files with 444 additions and 295 deletions

View File

@ -11,7 +11,7 @@ const { curComponent } = storeToRefs(dvMainStore)
<div class="attr-list">
<CommonAttr :element="curComponent"></CommonAttr>
<div class="content">
<span>内容</span>
<span>{{ $t('visualization.content') }}</span>
<el-input v-model="curComponent['propValue']" type="textarea" :rows="3" />
</div>
</div>

View File

@ -296,7 +296,7 @@ const queryDataForId = id => {
return pre
}, [])
if (!!requiredName) {
ElMessage.error(`${requiredName}查询条件是必填项,请设置选项值后,再进行查询!`)
ElMessage.error(`${requiredName}${t('v_query.before_querying')}`)
return
}
if (!emitterList.length) return
@ -572,7 +572,7 @@ const queryData = () => {
return pre
}, [])
if (!!requiredName) {
ElMessage.error(`${requiredName}查询条件是必填项,请设置选项值后,再进行查询!`)
ElMessage.error(`${requiredName}${t('v_query.before_querying')}`)
return
}
if (!emitterList.length) return
@ -640,13 +640,13 @@ const autoStyle = computed(() => {
>
<div v-if="!listVisible.length" class="no-list-label flex-align-center">
<div class="container flex-align-center">
将右侧的字段拖拽到这里 点击
{{ t('v_query.here_or_click') }}
<el-button
:disabled="showPosition === 'preview' || mobileInPc"
@click="addCriteriaConfigOut"
text
>
添加查询条件
{{ t('v_query.add_query_condition') }}
</el-button>
</div>
</div>
@ -677,12 +677,16 @@ const autoStyle = computed(() => {
class="label-wrapper-tooltip"
v-if="showPosition !== 'preview' && !dvMainStore.mobileInPc"
>
<el-tooltip effect="dark" content="设置过滤条件" placement="top">
<el-tooltip
effect="dark"
:content="t('v_query.set_filter_condition')"
placement="top"
>
<el-icon @click="editeQueryConfig(ele.id)">
<Icon name="icon_edit_outlined"><icon_edit_outlined class="svg-icon" /></Icon>
</el-icon>
</el-tooltip>
<el-tooltip effect="dark" content="删除条件" placement="top">
<el-tooltip effect="dark" :content="t('v_query.delete_condition')" placement="top">
<el-icon style="margin-left: 8px" @click="delQueryConfig(index)">
<Icon name="icon_delete-trash_outlined"
><icon_deleteTrash_outlined class="svg-icon"

View File

@ -69,15 +69,15 @@ const relativeToCurrentTypeList = computed(() => {
}
return [
{
label: '年',
label: t('chart.chart'),
value: 'year'
},
{
label: '月',
label: t('dynamic_time.month'),
value: 'month'
},
{
label: '日',
label: t('dynamic_time.date'),
value: 'date'
}
].slice(0, index)
@ -90,11 +90,11 @@ const relativeToCurrentList = computed(() => {
case 'year':
list = [
{
label: '今年',
label: t('dynamic_year.current'),
value: 'thisYear'
},
{
label: '去年',
label: t('dynamic_year.last'),
value: 'lastYear'
}
]
@ -102,11 +102,11 @@ const relativeToCurrentList = computed(() => {
case 'month':
list = [
{
label: '本月',
label: t('cron.this_month'),
value: 'thisMonth'
},
{
label: '上月',
label: t('dynamic_month.last'),
value: 'lastMonth'
}
]
@ -114,19 +114,19 @@ const relativeToCurrentList = computed(() => {
case 'date':
list = [
{
label: '今天',
label: t('dynamic_time.today'),
value: 'today'
},
{
label: '昨天',
label: t('dynamic_time.yesterday'),
value: 'yesterday'
},
{
label: '月初',
label: t('dynamic_time.firstOfMonth'),
value: 'monthBeginning'
},
{
label: '年初',
label: t('dynamic_time.firstOfYear'),
value: 'yearBeginning'
}
]
@ -134,19 +134,19 @@ const relativeToCurrentList = computed(() => {
case 'datetime':
list = [
{
label: '今天',
label: t('dynamic_time.today'),
value: 'today'
},
{
label: '昨天',
label: t('dynamic_time.yesterday'),
value: 'yesterday'
},
{
label: '月初',
label: t('dynamic_time.firstOfMonth'),
value: 'monthBeginning'
},
{
label: '年初',
label: t('dynamic_time.firstOfYear'),
value: 'yearBeginning'
}
]
@ -159,7 +159,7 @@ const relativeToCurrentList = computed(() => {
return [
...list,
{
label: '自定义',
label: t('dynamic_time.custom'),
value: 'custom'
}
]
@ -172,11 +172,11 @@ const relativeToCurrentListRange = computed(() => {
case 'yearrange':
list = [
{
label: '今年',
label: t('dynamic_year.current'),
value: 'thisYear'
},
{
label: '去年',
label: t('dynamic_year.last'),
value: 'lastYear'
}
]
@ -184,23 +184,23 @@ const relativeToCurrentListRange = computed(() => {
case 'monthrange':
list = [
{
label: '本月',
label: t('cron.this_month'),
value: 'thisMonth'
},
{
label: '上月',
label: t('dynamic_month.dynamic_month'),
value: 'lastMonth'
},
{
label: '最近 3 个 月',
label: t('v_query.last_3_months'),
value: 'LastThreeMonths'
},
{
label: '最近 6 个 月',
label: t('v_query.last_6_months'),
value: 'LastSixMonths'
},
{
label: '最近 12 个 月',
label: t('v_query.last_12_months'),
value: 'LastTwelveMonths'
}
]
@ -209,23 +209,23 @@ const relativeToCurrentListRange = computed(() => {
case 'datetimerange':
list = [
{
label: '今天',
label: t('dynamic_time.today'),
value: 'today'
},
{
label: '昨天',
label: t('dynamic_time.yesterday'),
value: 'yesterday'
},
{
label: '最近 3 天',
label: t('v_query.last_3_days'),
value: 'LastThreeDays'
},
{
label: '月初至今',
label: t('v_query.month_to_date'),
value: 'monthBeginning'
},
{
label: '年初至今',
label: t('v_query.year_to_date'),
value: 'yearBeginning'
}
]
@ -238,7 +238,7 @@ const relativeToCurrentListRange = computed(() => {
return [
...list,
{
label: '自定义',
label: t('dynamic_time.custom'),
value: 'custom'
}
]
@ -246,11 +246,11 @@ const relativeToCurrentListRange = computed(() => {
const aroundList = [
{
label: '前',
label: t('dynamic_time.before'),
value: 'f'
},
{
label: '后',
label: t('dynamic_time.after'),
value: 'b'
}
]
@ -262,11 +262,11 @@ const dynamicTime = computed(() => {
const operators = [
{
label: '精确匹配',
label: t('v_query.exact_match'),
value: 'eq'
},
{
label: '模糊匹配',
label: t('v_query.fuzzy_match'),
value: 'like'
}
]
@ -320,18 +320,11 @@ defineExpose({
mult,
single
})
const handleInputStart = value => {
curComponent.value.defaultNumValueStart = value.replace(/[^\d.]/g, '')
}
const handleInputEnd = value => {
curComponent.value.defaultNumValueEnd = value.replace(/[^\d.]/g, '')
}
</script>
<template>
<div class="list-item top-item" v-if="curComponent.displayType === '8'" @click.stop>
<div class="label">设置默认值</div>
<div class="label">{{ t('dynamic_time.set_default') }}</div>
<div class="value" :class="curComponent.hideConditionSwitching && 'hide-condition_switching'">
<div class="condition-type">
<el-select
@ -352,7 +345,9 @@ const handleInputEnd = value => {
<div class="bottom-line"></div>
</div>
<div class="condition-type" v-if="[1, 2].includes(curComponent.conditionType)">
<sapn class="condition-type-tip">{{ curComponent.conditionType === 1 ? '与' : '或' }}</sapn>
<sapn class="condition-type-tip">{{
curComponent.conditionType === 1 ? t('chart.and') : t('chart.or')
}}</sapn>
<el-select
v-if="!curComponent.hideConditionSwitching"
class="condition-value-select"
@ -374,19 +369,22 @@ const handleInputEnd = value => {
</div>
<div class="list-item top-item" v-if="curComponent.displayType === '22'" @click.stop>
<div class="label">
<el-checkbox v-model="curComponent.defaultValueCheck" label="设置默认值" />
<el-checkbox
v-model="curComponent.defaultValueCheck"
:label="t('dynamic_time.set_default')"
/>
</div>
<div class="setting-content" style="display: flex; align-items: center">
<el-input-number
:disabled="!curComponent.defaultValueCheck"
placeholder="请输入最小值"
:placeholder="t('system.the_minimum_value')"
style="width: 192.5px"
controls-position="right"
v-model="curComponent.defaultNumValueStart"
/>
<div class="num-value_line"></div>
<el-input-number
placeholder="请输入最大值"
:placeholder="t('system.the_maximum_value')"
style="width: 192.5px"
controls-position="right"
:disabled="!curComponent.defaultValueCheck"
@ -398,7 +396,7 @@ const handleInputEnd = value => {
v-if="!['1', '7', '8', '22'].includes(curComponent.displayType) && showFlag"
class="list-item"
>
<div class="label">选项类型</div>
<div class="label">{{ t('v_query.option_type') }}</div>
<div class="value">
<el-radio-group
class="larger-radio"
@ -412,7 +410,7 @@ const handleInputEnd = value => {
</div>
<div v-if="curComponent.displayType === '7' && showFlag" class="list-item">
<div class="label">
<el-checkbox v-model="curComponent.setTimeRange" label="设置时间筛选范围" />
<el-checkbox v-model="curComponent.setTimeRange" :label="t('v_query.time_filter_range')" />
</div>
<div class="setting-content">
<el-popover
@ -433,7 +431,7 @@ const handleInputEnd = value => {
<template #icon>
<Icon name="icon_admin_outlined"><icon_admin_outlined class="svg-icon" /></Icon>
</template>
设置
{{ t('dynamic_time.set') }}
</el-button>
</template>
<RangeFilterTime
@ -446,7 +444,7 @@ const handleInputEnd = value => {
curComponent.timeRange.intervalType !== 'none' || curComponent.timeRange.dynamicWindow
"
class="config-flag range-filter-time-flag"
>已配置</span
>{{ t('v_query.configured') }}</span
>
</div>
</div>
@ -457,21 +455,24 @@ const handleInputEnd = value => {
<div class="label">
<el-tooltip
effect="dark"
content="绑定参数后,不支持传空数据"
:content="t('v_query.is_not_supported')"
:disabled="!curComponent.parametersCheck"
placement="top"
>
<el-checkbox
:disabled="curComponent.parametersCheck"
v-model="curComponent.showEmpty"
label="选项值包含空数据"
:label="t('v_query.contains_empty_data')"
/>
</el-tooltip>
</div>
</div>
<div v-if="!['8', '22'].includes(curComponent.displayType)" class="list-item">
<div class="label">
<el-checkbox v-model="curComponent.defaultValueCheck" label="设置默认值" />
<el-checkbox
v-model="curComponent.defaultValueCheck"
:label="t('dynamic_time.set_default')"
/>
</div>
<div
class="setting-content"
@ -479,13 +480,13 @@ const handleInputEnd = value => {
>
<div class="setting">
<el-radio-group @change="handleTimeTypeChange" v-model="curComponent.timeType">
<el-radio label="fixed">固定时间</el-radio>
<el-radio label="dynamic">动态时间</el-radio>
<el-radio label="fixed">{{ t('dynamic_time.fix') }}</el-radio>
<el-radio label="dynamic">{{ t('dynamic_time.dynamic') }}</el-radio>
</el-radio-group>
</div>
<template v-if="dynamicTime && curComponent.displayType === '1'">
<div class="setting">
<div class="setting-label">相对当前</div>
<div class="setting-label">{{ t('dynamic_time.relative') }}</div>
<div class="setting-value select">
<el-select @focus="handleDialogClick" v-model="curComponent.relativeToCurrent">
<el-option
@ -533,7 +534,7 @@ const handleInputEnd = value => {
</template>
<template v-else-if="dynamicTime && curComponent.displayType === '7'">
<div class="setting">
<div class="setting-label">相对当前</div>
<div class="setting-label">{{ t('dynamic_time.relative') }}</div>
<div class="setting-value select">
<el-select @focus="handleDialogClick" v-model="curComponent.relativeToCurrentRange">
<el-option
@ -554,7 +555,7 @@ const handleInputEnd = value => {
) && 'is-year-month-range'
"
>
<div class="setting-label">开始时间</div>
<div class="setting-label">{{ t('datasource.start_time') }}</div>
<div class="setting-input with-date range">
<el-input-number
step-strictly
@ -590,7 +591,7 @@ const handleInputEnd = value => {
) && 'is-year-month-range'
"
>
<div class="setting-label">结束时间</div>
<div class="setting-label">{{ t('datasource.end_time') }}</div>
<div class="setting-input with-date range">
<el-input-number
v-model="curComponent.timeNumRange"

View File

@ -36,7 +36,7 @@ const cancelClick = () => {
const confirmClick = () => {
const { isError, arr } = setCascadeArrBack()
if (isError) {
ElMessage.error('查询条件或字段不能为空!')
ElMessage.error(t('v_query.cannot_be_empty'))
return
}
emits('saveCascade', arr)
@ -141,7 +141,7 @@ const addCascadeItem = item => {
item.push({
datasetId: '',
fieldId: '',
placeholder: item.length ? '' : '第一级无需配置被级联字段',
placeholder: item.length ? '' : t('v_query.the_first_level'),
id: guid()
})
}
@ -158,7 +158,7 @@ const setPlaceholder = () => {
item.datasetId &&
item.datasetId.split('--')[0] === ele[idx - 1].datasetId.split('--')[0]
) {
item.placeholder = '与上一级使用同一个数据集,无需配置被级联字段'
item.placeholder = t('v_query.configure_cascaded_fields')
item.fieldId = ''
}
})
@ -168,7 +168,7 @@ const setPlaceholder = () => {
const deleteCascade = (idx, item) => {
item.splice(idx, 1)
item[0].fieldId = ''
item[0].placeholder = '第一级无需配置被级联字段'
item[0].placeholder = t('v_query.the_first_level')
setPlaceholder()
}
@ -182,7 +182,14 @@ const addCascadeBlock = () => {
cascadeList.value.push(arr)
}
const indexCascade = ' 一二三四五'
const indexCascade = [
' ',
t('report.week_mon'),
t('report.week_tue'),
t('report.week_wed'),
t('report.week_thu'),
t('report.week_fri')
]
defineExpose({
init
@ -201,21 +208,22 @@ defineExpose({
>
<template #title>
<div class="title">
查询条件级联配置<span class="tip">(仅上级能级联下级,不可反向级联)</span>
{{ t('v_query.condition_cascade_configuration')
}}<span class="tip">{{ t('v_query.not_reverse_cascade') }}</span>
</div>
</template>
<div class="content">
<el-icon style="font-size: 16px">
<Icon name="icon_info_colorful"><icon_info_colorful class="svg-icon" /></Icon>
</el-icon>
基于当前查询组件的查询条件如果需要进行级联配置需要满足以下条件<br />
1. 展示类型文本下拉组件和数字下拉组件2. 选项值来源选择数据集<br />
{{ t('v_query.must_be_met') }}<br />
{{ t('v_query.select_data_set') }}<br />
</div>
<el-button text @click="addCascadeBlock">
<template #icon>
<Icon name="icon_add_outlined"><icon_add_outlined class="svg-icon" /></Icon>
</template>
添加级联配置
{{ t('v_query.add_cascade_configuration') }}
</el-button>
<div class="cascade-content" v-for="(item, index) in cascadeList" :key="index">
<div style="display: flex; align-items: center; justify-content: space-between">
@ -223,7 +231,7 @@ defineExpose({
<template #icon>
<Icon name="icon_add_outlined"><icon_add_outlined class="svg-icon" /></Icon>
</template>
添加级联条件
{{ t('v_query.add_cascade_condition') }}
</el-button>
<el-button @click="deleteCascadeBlock(index)" class="cascade-delete-block" text>
<template #icon>
@ -234,13 +242,13 @@ defineExpose({
</el-button>
</div>
<div class="cascade-item">
<div class="label">查询条件层级</div>
<div class="item-name">请选择查询条件</div>
<div class="label">{{ t('v_query.query_condition_level') }}</div>
<div class="item-name">{{ t('v_query.select_query_condition') }}</div>
<div class="cascade-icon"></div>
<div class="item-field">请选择被级联字段</div>
<div class="item-field">{{ t('v_query.select_cascaded_field') }}</div>
</div>
<div class="cascade-item" v-for="(ele, idx) in item" :key="ele.id">
<div class="label">{{ indexCascade[idx + 1] }}</div>
<div class="label">{{ t('v_query.level_1', { msg: indexCascade[idx + 1] }) }}</div>
<div class="item-name">
<el-select
@visible-change="val => visibleChange(val, index, idx)"

View File

@ -307,11 +307,11 @@ const showDatasetError = computed(() => {
})
const typeList = [
{
label: '重命名',
label: t('data_fill.rename'),
command: 'rename'
},
{
label: '删除',
label: t('data_fill.delete'),
command: 'del'
}
]
@ -831,19 +831,19 @@ const notTimeRangeType = computed(() => {
const timeList = [
{
label: '年',
label: t('dynamic_time.year'),
value: 'year'
},
{
label: '年月',
label: t('chart.y_M'),
value: 'month'
},
{
label: '年月日',
label: t('chart.y_M_d'),
value: 'date'
},
{
label: '年月日时分秒',
label: t('chart.y_M_d_H_m_s'),
value: 'datetime'
}
]
@ -924,17 +924,14 @@ const confirmIdChange = () => {
const handleDatasetChange = () => {
if (!!newDatasetId && !!oldDatasetId) {
curComponent.value.dataset.id = oldDatasetId
ElMessageBox.confirm(
'数据集的修改,会导致级联配置失效,因此对应的级联关系将被清除,确定修改吗?',
{
confirmButtonType: 'primary',
type: 'warning',
confirmButtonText: '确定',
cancelButtonText: '取消',
autofocus: false,
showClose: false
}
).then(() => {
ElMessageBox.confirm(t('v_query.to_modify_it'), {
confirmButtonType: 'primary',
type: 'warning',
confirmButtonText: t('commons.confirm'),
cancelButtonText: t('commons.cancel'),
autofocus: false,
showClose: false
}).then(() => {
confirmIdChange()
})
return
@ -1115,7 +1112,14 @@ const clearCascadeArrDataset = id => {
cascadeArr = cascadeArr.filter(ele => !!ele.length)
}
const indexCascade = ' 一二三四五'
const indexCascade = [
' ',
t('report.week_mon'),
t('report.week_tue'),
t('report.week_wed'),
t('report.week_thu'),
t('report.week_fri')
]
const validateConditionType = ({
defaultConditionValueF,
@ -1146,11 +1150,11 @@ const validate = () => {
return conditions.value.some(ele => {
if (ele.auto) return false
if (!ele.checkedFields?.length || ele.checkedFields.some(itx => !ele.checkedFieldsMap[itx])) {
ElMessage.error('请先勾选需要联动的图表及字段')
ElMessage.error(t('v_query.be_linked_first'))
return true
}
let displayTypeField = null
let errorTips = '所选字段类型不一致,无法进行查询配置'
let errorTips = t('v_query.cannot_be_performed')
let hasParameterTimeArrType = 0
let hasParameterNumArrType = 0
if (
@ -1180,7 +1184,7 @@ const validate = () => {
}
if (ele.checkedFieldsMapArrNum?.[id]?.length === 1 && ele.displayType === '22') {
errorTips = '数值参数配置必须配置最大值和最小值'
errorTips = t('v_query.numerical_parameter_configuration')
return true
}
@ -1209,7 +1213,7 @@ const validate = () => {
}
if (ele.checkedFieldsMapArr?.[id]?.length === 1 && ele.displayType === '7') {
errorTips = '时间参数配置必须配置开始时间和结束时间'
errorTips = t('v_query.and_end_time')
return true
}
@ -1228,12 +1232,12 @@ const validate = () => {
return false
}
if (displayTypeField.type?.length !== field.type?.length) {
errorTips = '时间格式不一致'
errorTips = t('v_query.format_is_inconsistent')
return true
}
for (let index = 0; index < displayTypeField.type.length; index++) {
if (displayTypeField.type[index] !== field.type[index]) {
errorTips = '时间格式不一致'
errorTips = t('v_query.format_is_inconsistent')
return true
}
}
@ -1250,13 +1254,13 @@ const validate = () => {
setParams(ele)
const result = validateConditionType(ele)
if (result) {
ElMessage.error('查询条件为必填项,默认值不能为空')
ElMessage.error(t('v_query.cannot_be_empty_de'))
}
return result
}
if (!ele.defaultValueCheck) {
ElMessage.error('查询条件为必填项,默认值不能为空')
ElMessage.error(t('v_query.cannot_be_empty_de'))
return true
}
@ -1265,7 +1269,7 @@ const validate = () => {
(ele.defaultNumValueEnd !== 0 && !ele.defaultNumValueEnd) ||
(ele.defaultNumValueStart !== 0 && !ele.defaultNumValueStart)
) {
ElMessage.error('查询条件为必填项,默认值不能为空')
ElMessage.error(t('v_query.cannot_be_empty_de'))
return true
}
return false
@ -1275,7 +1279,7 @@ const validate = () => {
(Array.isArray(ele.defaultValue) && !ele.defaultValue.length) ||
(ele.defaultValue !== 0 && !ele.defaultValue)
) {
ElMessage.error('查询条件为必填项,默认值不能为空')
ElMessage.error(t('v_query.cannot_be_empty_de'))
return true
}
}
@ -1295,7 +1299,7 @@ const validate = () => {
if (!ele.defaultValueCheck) return false
if (ele.timeType === 'fixed') {
if (!ele.defaultValue) {
ElMessage.error('默认时间不能为空!')
ElMessage.error(t('v_query.cannot_be_empty_time'))
return true
}
}
@ -1306,7 +1310,7 @@ const validate = () => {
if (ele.timeType === 'fixed') {
const [s, e] = ele.defaultValue || []
if (!s || !e) {
ElMessage.error('默认时间不能为空!')
ElMessage.error(t('v_query.cannot_be_empty_time'))
return true
}
}
@ -1353,7 +1357,7 @@ const validate = () => {
;[startTime, endTime] = getCustomRange(relativeToCurrentRange)
}
if (+startTime > +endTime) {
ElMessage.error('结束时间必须大于开始时间!')
ElMessage.error(t('v_query.the_start_time'))
return true
}
if (!ele.setTimeRange) return false
@ -1368,7 +1372,7 @@ const validate = () => {
: +endTime
)
) {
ElMessage.error('默认值超出日期筛选范围内,请重新设置!')
ElMessage.error(t('v_query.range_please_reset'))
return true
}
return false
@ -1383,12 +1387,14 @@ const validate = () => {
ele.optionValueSource === 2 &&
!ele.valueSource?.filter(ele => !!ele).length
) {
ElMessage.error('手工输入-选项值不能为空')
ElMessage.error(t('v_query.cannot_be_empty_input'))
return true
}
if (!['9', '22'].includes(ele.displayType) && ele.optionValueSource === 1 && !ele.field.id) {
ElMessage.error(!ele.dataset?.id ? '请选择数据集及选项值字段' : '请选择数据集的选项值字段')
ElMessage.error(
!ele.dataset?.id ? t('v_query.option_value_field') : t('v_query.the_data_set')
)
return true
}
})
@ -1455,7 +1461,7 @@ const confirmValueSource = () => {
return false
})
) {
ElMessage.error('手工输入-选项值不能为空')
ElMessage.error(t('v_query.cannot_be_empty_input'))
return
}
@ -1776,11 +1782,11 @@ const relativeToCurrentList = computed(() => {
case 'year':
list = [
{
label: '今年',
label: t('dynamic_year.current'),
value: 'thisYear'
},
{
label: '去年',
label: t('dynamic_year.last'),
value: 'lastYear'
}
]
@ -1788,11 +1794,11 @@ const relativeToCurrentList = computed(() => {
case 'month':
list = [
{
label: '本月',
label: t('cron.this_month'),
value: 'thisMonth'
},
{
label: '上月',
label: t('dynamic_month.last'),
value: 'lastMonth'
}
]
@ -1800,19 +1806,19 @@ const relativeToCurrentList = computed(() => {
case 'date':
list = [
{
label: '今天',
label: t('dynamic_time.today'),
value: 'today'
},
{
label: '昨天',
label: t('dynamic_time.yesterday'),
value: 'yesterday'
},
{
label: '月初',
label: t('dynamic_time.firstOfMonth'),
value: 'monthBeginning'
},
{
label: '年初',
label: t('dynamic_time.firstOfYear'),
value: 'yearBeginning'
}
]
@ -1820,19 +1826,19 @@ const relativeToCurrentList = computed(() => {
case 'datetime':
list = [
{
label: '今天',
label: t('dynamic_time.today'),
value: 'today'
},
{
label: '昨天',
label: t('dynamic_time.yesterday'),
value: 'yesterday'
},
{
label: '月初',
label: t('dynamic_time.firstOfMonth'),
value: 'monthBeginning'
},
{
label: '年初',
label: t('dynamic_time.firstOfYear'),
value: 'yearBeginning'
}
]
@ -1845,7 +1851,7 @@ const relativeToCurrentList = computed(() => {
return [
...list,
{
label: '自定义',
label: t('dynamic_time.custom'),
value: 'custom'
}
]
@ -1858,11 +1864,11 @@ const relativeToCurrentListRange = computed(() => {
case 'yearrange':
list = [
{
label: '今年',
label: t('dynamic_year.current'),
value: 'thisYear'
},
{
label: '去年',
label: t('dynamic_year.last'),
value: 'lastYear'
}
]
@ -1870,23 +1876,23 @@ const relativeToCurrentListRange = computed(() => {
case 'monthrange':
list = [
{
label: '本月',
label: t('cron.this_month'),
value: 'thisMonth'
},
{
label: '上月',
label: t('dynamic_month.dynamic_month'),
value: 'lastMonth'
},
{
label: '最近 3 个 月',
label: t('v_query.last_3_months'),
value: 'LastThreeMonths'
},
{
label: '最近 6 个 月',
label: t('v_query.last_6_months'),
value: 'LastSixMonths'
},
{
label: '最近 12 个 月',
label: t('v_query.last_12_months'),
value: 'LastTwelveMonths'
}
]
@ -1895,23 +1901,23 @@ const relativeToCurrentListRange = computed(() => {
case 'datetimerange':
list = [
{
label: '今天',
label: t('dynamic_time.today'),
value: 'today'
},
{
label: '昨天',
label: t('dynamic_time.yesterday'),
value: 'yesterday'
},
{
label: '最近 3 天',
label: t('v_query.last_3_days'),
value: 'LastThreeDays'
},
{
label: '月初至今',
label: t('v_query.month_to_date'),
value: 'monthBeginning'
},
{
label: '年初至今',
label: t('v_query.year_to_date'),
value: 'yearBeginning'
}
]
@ -1924,7 +1930,7 @@ const relativeToCurrentListRange = computed(() => {
return [
...list,
{
label: '自定义',
label: t('dynamic_time.custom'),
value: 'custom'
}
]
@ -2018,7 +2024,7 @@ const dfs = arr => {
const renameInputBlur = () => {
if (activeConditionForRename.name.trim() === '') {
ElMessage.error('字段名称不能为空')
ElMessage.error(t('v_query.cannot_be_empty_name'))
renameInput.value[0]?.focus()
return
}
@ -2058,7 +2064,7 @@ defineExpose({
class="query-condition-configuration"
v-model="dialogVisible"
width="1200px"
title="查询条件设置"
:title="t('v_query.query_condition_setting')"
@click.stop
:before-close="handleBeforeClose"
@mousedown.stop
@ -2067,7 +2073,7 @@ defineExpose({
<div class="container" @click="handleDialogClick">
<div class="query-condition-list">
<div class="title">
查询条件
{{ t('v_query.query_condition') }}
<el-icon @click="addQueryCriteriaAndSelect">
<Icon name="icon_add_outlined"><icon_add_outlined class="svg-icon" /></Icon>
</el-icon>
@ -2127,17 +2133,17 @@ defineExpose({
<div v-if="!!curComponent" class="chart-field" :class="curComponent.auto && 'hidden'">
<div class="mask" v-if="curComponent.auto"></div>
<div class="title flex-align-center">
选择关联图表及字段
{{ t('v_query.chart_and_field') }}
<el-radio-group class="ml-4 larger-radio" v-model="curComponent.auto">
<el-radio :disabled="!curComponent.auto" :label="true">
<div class="flex-align-center">
自动
{{ t('chart.margin_model_auto') }}
<el-tooltip effect="dark" placement="top">
<template #content>
<div>
注意:自动模式支持同数据集自动关联字段可切换到
{{ t('v_query.be_switched_to') }}
<br />
自定义模式切换到自定义模式后无法再切换为自动
{{ t('v_query.to_automatic_again') }}
</div>
</template>
<el-icon style="margin-left: 4px; color: #646a73">
@ -2225,9 +2231,13 @@ defineExpose({
</template>
<template #header>
<el-tabs stretch class="params-select--header" v-model="field.activelist">
<el-tab-pane disabled label="维度" name="dimensionList"></el-tab-pane>
<el-tab-pane disabled label="指标" name="quotaList"></el-tab-pane>
<el-tab-pane label="参数" name="parameterList"></el-tab-pane>
<el-tab-pane
disabled
:label="t('chart.dimension')"
name="dimensionList"
></el-tab-pane>
<el-tab-pane disabled :label="t('chart.quota')" name="quotaList"></el-tab-pane>
<el-tab-pane :label="t('dataset.param')" name="parameterList"></el-tab-pane>
</el-tabs>
</template>
<el-option
@ -2260,9 +2270,9 @@ defineExpose({
>
{{
curComponent.checkedFieldsMapStart[field.componentId] === ele.id
? '开始时间'
? t('dataset.start_time')
: curComponent.checkedFieldsMapEnd[field.componentId] === ele.id
? '结束时间'
? t('dataset.end_time')
: ''
}}
<el-icon>
@ -2322,9 +2332,13 @@ defineExpose({
</template>
<template #header>
<el-tabs stretch class="params-select--header" v-model="field.activelist">
<el-tab-pane disabled label="维度" name="dimensionList"></el-tab-pane>
<el-tab-pane disabled label="指标" name="quotaList"></el-tab-pane>
<el-tab-pane label="参数" name="parameterList"></el-tab-pane>
<el-tab-pane
disabled
:label="t('chart.dimension')"
name="dimensionList"
></el-tab-pane>
<el-tab-pane disabled :label="t('chart.quota')" name="quotaList"></el-tab-pane>
<el-tab-pane :label="t('dataset.param')" name="parameterList"></el-tab-pane>
</el-tabs>
</template>
<el-option
@ -2357,9 +2371,9 @@ defineExpose({
>
{{
curComponent.checkedFieldsMapStartNum[field.componentId] === ele.id
? '最小值'
? t('chart.min')
: curComponent.checkedFieldsMapEndNum[field.componentId] === ele.id
? '最大值'
? t('chart.max')
: ''
}}
<el-icon>
@ -2408,15 +2422,15 @@ defineExpose({
</template>
<template #header>
<el-tabs stretch class="params-select--header" v-model="field.activelist">
<el-tab-pane label="维度" name="dimensionList"></el-tab-pane>
<el-tab-pane :label="t('chart.dimension')" name="dimensionList"></el-tab-pane>
<el-tab-pane
:disabled="curComponent.displayType === '9'"
label="指标"
:label="t('chart.quota')"
name="quotaList"
></el-tab-pane>
<el-tab-pane
v-if="field.hasParameter"
label="参数"
:label="t('dataset.param')"
:disabled="curComponent.displayType === '9'"
name="parameterList"
></el-tab-pane>
@ -2435,7 +2449,7 @@ defineExpose({
>
<div
class="flex-align-center icon"
:title="ele.desensitized ? '脱敏字段,不能被设置为查询条件' : ''"
:title="ele.desensitized ? t('v_query.as_query_conditions') : ''"
>
<el-icon>
<Icon :className="`field-icon-${fieldType[ele.deType]}`"
@ -2463,7 +2477,7 @@ defineExpose({
"
class="range-time_setting"
>
{{ isNumParameter ? '数值' : '时间' }}
{{ isNumParameter ? t('chart.value_formatter_value') : t('dataset.time') }}
<el-icon>
<Icon>
<icon_edit_outlined class="svg-icon"></icon_edit_outlined>
@ -2481,11 +2495,11 @@ defineExpose({
<div v-if="!!curComponent" class="condition-configuration">
<div class="mask condition" v-if="curComponent.auto"></div>
<div class="title flex-align-center">
查询条件配置
{{ t('v_query.query_condition_configuration') }}
<el-checkbox
:disabled="curComponent.auto"
v-model="curComponent.required"
label="必填项"
:label="t('v_query.required_items')"
/>
</div>
<div
@ -2493,7 +2507,7 @@ defineExpose({
class="configuration-list"
>
<div class="list-item">
<div class="label">展示类型</div>
<div class="label">{{ t('v_query.display_type') }}</div>
<div class="value">
<el-select
@focus="handleDialogClick"
@ -2502,12 +2516,12 @@ defineExpose({
>
<el-option
:disabled="!['0', '8', '9'].includes(curComponent.displayType)"
label="文本下拉"
:label="t('v_query.text_drop_down')"
value="0"
/>
<el-option
:disabled="!['0', '8', '9'].includes(curComponent.displayType)"
label="文本搜索"
:label="t('v_query.text_search')"
value="8"
/>
<el-option
@ -2515,26 +2529,26 @@ defineExpose({
!['0', '8', '9'].includes(curComponent.displayType) ||
!!curComponent.parameters.length
"
label="下拉树"
:label="t('v_query.drop_down_tree')"
value="9"
/>
<template v-if="['2', '22'].includes(curComponent.displayType)">
<el-option
:disabled="!['2', '22'].includes(curComponent.displayType) || notNumRange"
label="数字下拉"
:label="t('v_query.number_drop_down')"
value="2"
/>
<el-option
:disabled="!['2', '22'].includes(curComponent.displayType) || canNotNumRange"
label="数值区间"
:label="t('v_query.number_range')"
value="22"
/>
</template>
<el-option
v-else
:disabled="curComponent.displayType !== '5'"
label="数字下拉"
:label="t('v_query.number_drop_down')"
value="5"
/>
<el-option
@ -2542,7 +2556,7 @@ defineExpose({
!['1', '7'].includes(curComponent.displayType) ||
(isTimeParameter && notTimeRange)
"
label="时间"
:label="t('dataset.time')"
value="1"
/>
<el-option
@ -2550,24 +2564,24 @@ defineExpose({
!['1', '7'].includes(curComponent.displayType) ||
(isTimeParameter && !notTimeRange)
"
label="时间范围"
:label="t('common.component.dateRange')"
value="7"
/>
</el-select>
</div>
</div>
<div class="list-item" v-if="curComponent.displayType === '9'">
<div class="label">选项值数量</div>
<div class="label">{{ t('v_query.of_option_values') }}</div>
<div class="value">
<el-radio-group class="larger-radio" v-model="curComponent.resultMode">
<el-radio :label="0">默认</el-radio>
<el-radio :label="1">全部</el-radio>
<el-radio :label="0">{{ t('login.default_login') }}</el-radio>
<el-radio :label="1">{{ t('chart.result_mode_all') }}</el-radio>
</el-radio-group>
</div>
</div>
<div class="list-item" v-if="curComponent.displayType === '9'">
<div class="label" style="width: 135px; height: 26px; line-height: 26px">
下拉树结构设计
{{ t('v_query.tree_structure_design') }}
<el-button
v-if="curComponent.treeFieldList && !!curComponent.treeFieldList.length"
text
@ -2585,7 +2599,9 @@ defineExpose({
:key="ele.id"
class="tree-field"
>
<span class="level-index">层级{{ indexCascade[index + 1] }}</span>
<span class="level-index"
>{{ t('visualization.level') }}{{ indexCascade[index + 1] }}</span
>
<span class="field-type"
><el-icon>
<Icon :className="`field-icon-${fieldType[ele.deType]}`"
@ -2603,31 +2619,31 @@ defineExpose({
<template #icon>
<Icon name="icon_add_outlined"><icon_add_outlined class="svg-icon" /></Icon>
</template>
点击进行树结构设计
{{ t('v_query.the_tree_structure') }}
</el-button>
</div>
<TreeFieldDialog ref="treeDialog" @save-tree="saveTree"></TreeFieldDialog>
</div>
<div class="list-item" v-if="['1', '7'].includes(curComponent.displayType)">
<div class="label">时间粒度</div>
<div class="label">{{ t('v_query.time_granularity') }}</div>
<div class="value">
<template v-if="curComponent.displayType === '7' && !isTimeParameter">
<el-select
@change="timeGranularityMultipleChange"
placeholder="请选择时间粒度"
:placeholder="t('v_query.the_time_granularity')"
@focus="handleDialogClick"
v-model="curComponent.timeGranularityMultiple"
>
<el-option label="年" value="yearrange" />
<el-option label="年月" value="monthrange" />
<el-option label="年月日" value="daterange" />
<el-option label="年月日时分秒" value="datetimerange" />
<el-option :label="t('chart.y')" value="yearrange" />
<el-option :label="t('chart.y_M')" value="monthrange" />
<el-option :label="t('chart.y_M_d')" value="daterange" />
<el-option :label="t('chart.y_M_d_H_m_s')" value="datetimerange" />
</el-select>
</template>
<template v-else>
<el-select
@change="timeGranularityChange"
placeholder="请选择时间粒度"
:placeholder="t('v_query.the_time_granularity')"
v-model="curComponent.timeGranularity"
>
<el-option
@ -2644,7 +2660,7 @@ defineExpose({
class="list-item top-item"
v-if="!['1', '7', '8', '9', '22'].includes(curComponent.displayType)"
>
<div class="label">选项值来源</div>
<div class="label">{{ t('v_query.option_value_source') }}</div>
<div class="value">
<div class="value">
<el-radio-group
@ -2656,7 +2672,7 @@ defineExpose({
t('chart.margin_model_auto')
}}</el-radio>
<el-radio :label="1">{{ t('chart.select_dataset') }}</el-radio>
<el-radio :label="2">手动输入</el-radio>
<el-radio :label="2">{{ t('v_query.manual_input') }}</el-radio>
</el-radio-group>
</div>
<template v-if="curComponent.optionValueSource === 1">
@ -2665,7 +2681,7 @@ defineExpose({
:teleported="false"
v-model="curComponent.dataset.id"
:data="datasetTree"
placeholder="请选择数据集"
:placeholder="t('copilot.pls_choose_dataset')"
@change="handleDatasetChange"
@current-change="handleCurrentChange"
:props="dsSelectProps"
@ -2693,10 +2709,10 @@ defineExpose({
</el-tree-select>
</div>
<div class="value">
<span class="label">查询字段</span>
<span class="label">{{ t('v_query.query_field') }}</span>
<el-select
@change="handleFieldChange"
placeholder="查询字段"
:placeholder="t('v_query.query_field')"
class="search-field"
v-model="curComponent.field.id"
>
@ -2735,7 +2751,7 @@ defineExpose({
>
<div
class="flex-align-center icon"
:title="ele.desensitized ? '脱敏字段,不能被设置为查询条件' : ''"
:title="ele.desensitized ? t('v_query.as_query_conditions') : ''"
>
<el-icon>
<Icon :className="`field-icon-${fieldType[ele.deType]}`"
@ -2754,9 +2770,9 @@ defineExpose({
</el-select>
</div>
<div class="value">
<span class="label">显示字段</span>
<span class="label">{{ t('v_query.display_field') }}</span>
<el-select
placeholder="显示字段"
:placeholder="t('v_query.display_field')"
class="search-field"
v-model="curComponent.displayId"
>
@ -2795,7 +2811,7 @@ defineExpose({
>
<div
class="flex-align-center icon"
:title="ele.desensitized ? '脱敏字段,不能被设置为查询条件' : ''"
:title="ele.desensitized ? t('v_query.as_query_conditions') : ''"
>
<el-icon>
<Icon :className="`field-icon-${fieldType[ele.deType]}`"
@ -2814,10 +2830,10 @@ defineExpose({
</el-select>
</div>
<div class="value">
<span class="label">排序字段</span>
<span class="label">{{ t('chart.total_sort_field') }}</span>
<el-select
clearable
placeholder="请选择排序字段"
:placeholder="t('v_query.the_sorting_field')"
v-model="curComponent.sortId"
class="sort-field"
@change="handleFieldChange"
@ -2850,7 +2866,7 @@ defineExpose({
>
<div
class="flex-align-center icon"
:title="ele.desensitized ? '脱敏字段,不能被设置为查询条件' : ''"
:title="ele.desensitized ? t('v_query.as_query_conditions') : ''"
>
<el-icon>
<Icon
@ -2872,8 +2888,8 @@ defineExpose({
v-model="curComponent.sort"
@change="handleFieldChange"
>
<el-option label="升序" value="asc" />
<el-option label="降序" value="desc" />
<el-option :label="t('chart.asc')" value="asc" />
<el-option :label="t('chart.desc')" value="desc" />
</el-select>
</div>
</template>
@ -2898,7 +2914,7 @@ defineExpose({
<div class="manual-input-container">
<div class="title">{{ t('auth.manual_input') }}</div>
<div class="select-value">
<span> 选项值 </span>
<span> {{ t('data_fill.form.option_value') }} </span>
<div :key="index" v-for="(_, index) in valueSource" class="select-item">
<el-input
maxlength="20"
@ -2933,7 +2949,7 @@ defineExpose({
><icon_add_outlined class="svg-icon"
/></Icon>
</template>
添加选项值
{{ t('data_fill.form.add_option') }}
</el-button>
</div>
<div class="manual-footer flex-align-center">
@ -2945,36 +2961,39 @@ defineExpose({
</div>
</el-popover>
<div v-if="!!curComponent.valueSource.length" class="config-flag flex-align-center">
已配置
{{ t('v_query.configured') }}
</div>
</div>
</div>
<div class="label" style="margin-top: 10.5px">选项值数量</div>
<div class="label" style="margin-top: 10.5px">{{ t('v_query.of_option_values') }}</div>
<div class="value" style="margin-top: 10.5px">
<el-radio-group class="larger-radio" v-model="curComponent.resultMode">
<el-radio :label="0">默认</el-radio>
<el-radio :label="1">全部</el-radio>
<el-radio :label="0">{{ t('chart.default') }}</el-radio>
<el-radio :label="1">{{ t('data_set.all') }}</el-radio>
</el-radio-group>
</div>
</div>
<div class="list-item top-item" v-if="curComponent.displayType === '8'">
<div class="label">条件类型</div>
<div class="label">{{ t('v_query.condition_type') }}</div>
<div class="value">
<div class="value">
<el-radio-group class="larger-radio" v-model="curComponent.conditionType">
<el-radio :label="0">单条件</el-radio>
<el-radio :label="1" :disabled="!!curComponent.parameters.length"
>与条件</el-radio
>
<el-radio :label="2" :disabled="!!curComponent.parameters.length"
>或条件</el-radio
>
<el-radio :label="0">{{ t('v_query.single_condition') }}</el-radio>
<el-radio :label="1" :disabled="!!curComponent.parameters.length">{{
t('v_query.single_condition')
}}</el-radio>
<el-radio :label="2" :disabled="!!curComponent.parameters.length">{{
t('v_query.or_condition')
}}</el-radio>
</el-radio-group>
</div>
</div>
</div>
<div style="margin-bottom: 10.5px" v-if="curComponent.displayType === '8'">
<el-checkbox v-model="curComponent.hideConditionSwitching" label="隐藏条件切换" />
<el-checkbox
v-model="curComponent.hideConditionSwitching"
:label="t('v_query.hide_condition_switch')"
/>
</div>
<condition-default-configuration
ref="defaultConfigurationRef"
@ -2983,19 +3002,21 @@ defineExpose({
></condition-default-configuration>
</div>
<div v-if="showTypeError && showConfiguration" class="empty">
<empty-background description="所选字段类型不一致,无法进行查询配置" img-type="error" />
<empty-background :description="t('v_query.cannot_be_performed')" img-type="error" />
</div>
<div v-else-if="showDatasetError && showConfiguration" class="empty">
<empty-background description="图表所使用的数据集不同, 无法展示配置项" img-type="error" />
<empty-background :description="t('v_query.cannot_be_displayed')" img-type="error" />
</div>
<div v-else-if="!showConfiguration" class="empty">
<empty-background description="请先勾选需要联动的图表及字段" img-type="noneWhite" />
<empty-background :description="t('v_query.be_linked_first')" img-type="noneWhite" />
</div>
</div>
</div>
<template #footer>
<div class="dialog-footer">
<el-button class="query-cascade" @click="openCascadeDialog">查询组件级联配置</el-button>
<el-button class="query-cascade" @click="openCascadeDialog">{{
t('v_query.component_cascade_configuration')
}}</el-button>
<el-button @click="cancelClick">{{ t('chart.cancel') }} </el-button>
<el-button @click="confirmClick" type="primary">{{ t('chart.confirm') }} </el-button>
</div>
@ -3003,32 +3024,32 @@ defineExpose({
</el-dialog>
<el-dialog :title="timeName" v-model="timeDialogShow" width="420px">
<el-form label-position="top">
<el-form-item label="时间类型" class="form-item" prop="name">
<el-form-item :label="t('v_query.time_type')" class="form-item" prop="name">
<el-radio-group v-model="timeParameterType">
<el-radio :label="0">时间</el-radio>
<el-radio :label="1">开始时间</el-radio>
<el-radio :label="2">结束时间</el-radio>
<el-radio :label="0">{{ t('data_set.time') }}</el-radio>
<el-radio :label="1">{{ t('datasource.start_time') }}</el-radio>
<el-radio :label="2">{{ t('datasource.end_time') }}</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<template #footer>
<el-button secondary @click="timeDialogShow = false">取消</el-button>
<el-button type="primary" @click="timeTypeChange">确认</el-button>
<el-button secondary @click="timeDialogShow = false">{{ t('chart.cancel') }}</el-button>
<el-button type="primary" @click="timeTypeChange">{{ t('chart.confirm') }}</el-button>
</template>
</el-dialog>
<el-dialog :title="numName" v-model="numDialogShow" width="420px">
<el-form label-position="top">
<el-form-item label="类型" class="form-item" prop="name">
<el-form-item :label="t('chart.map_line_type')" class="form-item" prop="name">
<el-radio-group v-model="numParameterType">
<el-radio :label="0">数值</el-radio>
<el-radio :label="1">最小值</el-radio>
<el-radio :label="2">最大值</el-radio>
<el-radio :label="0">{{ t('chart.value_formatter_value') }}</el-radio>
<el-radio :label="1">{{ t('chart.min') }}</el-radio>
<el-radio :label="2">{{ t('chart.max') }}</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<template #footer>
<el-button secondary @click="numDialogShow = false">取消</el-button>
<el-button type="primary" @click="numTypeChange">确认</el-button>
<el-button secondary @click="numDialogShow = false">{{ t('dataset.cancel') }}</el-button>
<el-button type="primary" @click="numTypeChange">{{ t('dataset.confirm') }}</el-button>
</template>
</el-dialog>
<CascadeDialog @saveCascade="saveCascade" ref="cascadeDialog"></CascadeDialog>

View File

@ -1,6 +1,7 @@
<script lang="ts" setup>
import { toRefs, computed, PropType } from 'vue'
import { type TimeRange } from './time-format'
import { useI18n } from '@/hooks/web/useI18n'
import DynamicTime from './DynamicTimeFiltering.vue'
import DynamicTimeRange from './DynamicTimeRangeFiltering.vue'
const props = defineProps({
@ -27,21 +28,23 @@ const props = defineProps({
default: 'yearrange'
}
})
const { t } = useI18n()
const intervalTypeList = [
{
label: '无',
label: t('chart.line_symbol_none'),
value: 'none'
},
{
label: '开始于',
label: t('v_query.start_at'),
value: 'start'
},
{
label: '结束于',
label: t('v_query.end_at'),
value: 'end'
},
{
label: '时间区间',
label: t('v_query.time_interval'),
value: 'timeInterval'
}
]
@ -60,11 +63,11 @@ const filterTypeCom = computed(() => {
const aroundList = [
{
label: '前',
label: t('dynamic_time.before'),
value: 'f'
},
{
label: '后',
label: t('dynamic_time.after'),
value: 'b'
}
]
@ -76,15 +79,15 @@ const relativeToCurrentTypeList = computed(() => {
) + 1
return [
{
label: '年',
label: t('dynamic_time.year'),
value: 'year'
},
{
label: '月',
label: t('dynamic_time.month'),
value: 'month'
},
{
label: '日',
label: t('dynamic_time.date'),
value: 'day'
}
].slice(0, index)
@ -100,11 +103,11 @@ const relativeToCurrentList = computed(() => {
case 'yearrange':
list = [
{
label: '今年',
label: t('dynamic_year.current'),
value: 'thisYear'
},
{
label: '去年',
label: t('dynamic_year.last'),
value: 'lastYear'
}
]
@ -112,11 +115,11 @@ const relativeToCurrentList = computed(() => {
case 'monthrange':
list = [
{
label: '本月',
label: t('cron.this_month'),
value: 'thisMonth'
},
{
label: '上月',
label: t('dynamic_month.last'),
value: 'lastMonth'
}
]
@ -124,19 +127,19 @@ const relativeToCurrentList = computed(() => {
case 'daterange':
list = [
{
label: '今天',
label: t('dynamic_time.today'),
value: 'today'
},
{
label: '昨天',
label: t('dynamic_time.yesterday'),
value: 'yesterday'
},
{
label: '月初',
label: t('dynamic_time.firstOfMonth'),
value: 'monthBeginning'
},
{
label: '年初',
label: t('dynamic_time.firstOfYear'),
value: 'yearBeginning'
}
]
@ -144,19 +147,19 @@ const relativeToCurrentList = computed(() => {
case 'datetimerange':
list = [
{
label: '今天',
label: t('dynamic_time.today'),
value: 'today'
},
{
label: '昨天',
label: t('dynamic_time.yesterday'),
value: 'yesterday'
},
{
label: '月初',
label: t('dynamic_time.firstOfMonth'),
value: 'monthBeginning'
},
{
label: '年初',
label: t('dynamic_time.firstOfYear'),
value: 'yearBeginning'
}
]
@ -169,7 +172,7 @@ const relativeToCurrentList = computed(() => {
return [
...list,
{
label: '自定义',
label: t('dynamic_time.custom'),
value: 'custom'
}
]
@ -182,11 +185,11 @@ const relativeToCurrentListRange = computed(() => {
case 'yearrange':
list = [
{
label: '今年',
label: t('dynamic_year.current'),
value: 'thisYear'
},
{
label: '去年',
label: t('dynamic_year.last'),
value: 'lastYear'
}
]
@ -194,23 +197,23 @@ const relativeToCurrentListRange = computed(() => {
case 'monthrange':
list = [
{
label: '本月',
label: t('cron.this_month'),
value: 'thisMonth'
},
{
label: '上月',
label: t('dynamic_month.dynamic_month'),
value: 'lastMonth'
},
{
label: '最近 3 个 月',
label: t('v_query.last_3_months'),
value: 'LastThreeMonths'
},
{
label: '最近 6 个 月',
label: t('v_query.last_6_months'),
value: 'LastSixMonths'
},
{
label: '最近 12 个 月',
label: t('v_query.last_12_months'),
value: 'LastTwelveMonths'
}
]
@ -219,23 +222,23 @@ const relativeToCurrentListRange = computed(() => {
case 'datetimerange':
list = [
{
label: '今天',
label: t('dynamic_time.today'),
value: 'today'
},
{
label: '昨天',
label: t('dynamic_time.yesterday'),
value: 'yesterday'
},
{
label: '最近 3 天',
label: t('v_query.last_3_days'),
value: 'LastThreeDays'
},
{
label: '月初至今',
label: t('v_query.month_to_date'),
value: 'monthBeginning'
},
{
label: '年初至今',
label: t('v_query.year_to_date'),
value: 'yearBeginning'
}
]
@ -248,7 +251,7 @@ const relativeToCurrentListRange = computed(() => {
return [
...list,
{
label: '自定义',
label: t('dynamic_time.custom'),
value: 'custom'
}
]
@ -257,9 +260,9 @@ const relativeToCurrentListRange = computed(() => {
<template>
<div class="set-time-filtering-range">
<div class="title">设置时间筛选范围</div>
<div class="title">{{ t('v_query.time_filter_range') }}</div>
<div class="list-item">
<div class="label">区间类型</div>
<div class="label">{{ t('v_query.interval_type') }}</div>
<div class="setting-content">
<div class="setting">
<el-radio-group v-model="timeRange.intervalType">
@ -275,13 +278,13 @@ const relativeToCurrentListRange = computed(() => {
<div class="setting-content">
<div class="setting">
<el-radio-group v-model="timeRange.regularOrTrends">
<el-radio label="fixed">固定时间</el-radio>
<el-radio label="dynamic">动态时间</el-radio>
<el-radio label="fixed">{{ t('dynamic_time.fix') }}</el-radio>
<el-radio label="dynamic">{{ t('dynamic_time.dynamic') }}</el-radio>
</el-radio-group>
</div>
<template v-if="dynamicTime && timeRange.intervalType !== 'timeInterval'">
<div class="setting" v-if="timeRange.intervalType !== 'timeInterval'">
<div class="setting-label">相对当前</div>
<div class="setting-label">{{ t('dynamic_time.relative') }}</div>
<div class="setting-value select">
<el-select v-model="timeRange.relativeToCurrent">
<el-option
@ -317,7 +320,7 @@ const relativeToCurrentListRange = computed(() => {
</template>
<template v-else-if="dynamicTime && timeRange.intervalType === 'timeInterval'">
<div class="setting">
<div class="setting-label">相对当前</div>
<div class="setting-label">{{ t('dynamic_time.relative') }}</div>
<div class="setting-value select">
<el-select v-model="timeRange.relativeToCurrentRange">
<el-option
@ -337,7 +340,7 @@ const relativeToCurrentListRange = computed(() => {
'is-year-month-range'
"
>
<div class="setting-label">开始时间</div>
<div class="setting-label">{{ t('datasource.start_time') }}</div>
<div class="setting-input range">
<el-input-number
step-strictly
@ -370,7 +373,7 @@ const relativeToCurrentListRange = computed(() => {
'is-year-month-range'
"
>
<div class="setting-label">结束时间</div>
<div class="setting-label">{{ t('datasource.end_time') }}</div>
<div class="setting-input range">
<el-input-number
v-model="timeRange.timeNumRange"
@ -413,10 +416,10 @@ const relativeToCurrentListRange = computed(() => {
</div>
<div class="list-item">
<div class="label">
<el-checkbox v-model="timeRange.dynamicWindow" label="动态查询时间窗口" />
<el-checkbox v-model="timeRange.dynamicWindow" :label="t('v_query.query_time_window')" />
</div>
<div v-if="timeRange.dynamicWindow" class="setting-content maximum-single-query">
单次查询最多
{{ t('v_query.maximum_single_query') }}
<el-input-number
v-model="timeRange.maximumSingleQuery"
:min="1"

View File

@ -15,6 +15,7 @@ import {
import { enumValueObj, type EnumValue, getEnumValue } from '@/api/dataset'
import { cloneDeep, debounce } from 'lodash-es'
import { useEmitt } from '@/hooks/web/useEmitt'
import { useI18n } from '@/hooks/web/useI18n'
interface SelectConfig {
selectValue: any
@ -46,6 +47,8 @@ interface SelectConfig {
}[]
}
const { t } = useI18n()
const props = defineProps({
config: {
type: Object as PropType<SelectConfig>,
@ -367,7 +370,7 @@ const setEmptyData = () => {
const [s] = options.value
if (showEmpty) {
if (s?.value !== '_empty_$') {
options.value = [{ label: '空数据', value: '_empty_$' }, ...options.value]
options.value = [{ label: t('v_query.empty_data'), value: '_empty_$' }, ...options.value]
}
} else {
if (s?.value === '_empty_$') {

View File

@ -2,6 +2,7 @@
import { toRefs, onBeforeMount, type PropType, type Ref, inject, computed, nextTick } from 'vue'
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
import { storeToRefs } from 'pinia'
import { useI18n } from '@/hooks/web/useI18n'
interface SelectConfig {
id: string
conditionValueOperatorF: string
@ -17,6 +18,7 @@ interface SelectConfig {
conditionType: number
}
const placeholder: Ref = inject('placeholder')
const { t } = useI18n()
const placeholderText = computed(() => {
if (placeholder.value.placeholderShow) {
@ -27,11 +29,11 @@ const placeholderText = computed(() => {
const operators = [
{
label: '精确匹配',
label: t('v_query.exact_match'),
value: 'eq'
},
{
label: '模糊匹配',
label: t('v_query.fuzzy_match'),
value: 'like'
}
]
@ -120,7 +122,9 @@ const lineWidth = computed(() => {
<div :style="lineWidth" class="bottom-line"></div>
</div>
<div class="condition-type" v-if="[1, 2].includes(config.conditionType)">
<sapn class="condition-type-tip">{{ config.conditionType === 1 ? '与' : '或' }}</sapn>
<sapn class="condition-type-tip">{{
config.conditionType === 1 ? t('chart.and') : t('chart.or')
}}</sapn>
<el-select
v-if="!config.hideConditionSwitching"
class="condition-value-select"

View File

@ -5,6 +5,7 @@ import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
import type { ManipulateType } from 'dayjs'
import { type TimeRange } from './time-format'
import dayjs from 'dayjs'
import { useI18n } from '@/hooks/web/useI18n'
import { useShortcuts } from './shortcuts'
import { getThisStart, getLastStart, getAround } from './time-format-dayjs'
import VanPopup from 'vant/es/popup'
@ -28,6 +29,7 @@ interface SelectConfig {
placeholder: string
setTimeRange: boolean
}
const { t } = useI18n()
const props = defineProps({
config: {
@ -453,9 +455,9 @@ const formatDate = computed(() => {
@confirm="onConfirm"
@cancel="onCancel"
v-if="showTimePick"
title="时间选择"
:tabs="['选择日期', '选择时间']"
next-step-text="下一步"
:title="t('v_query.time_selection')"
:tabs="[t('dataset.select_date'), t('dataset.select_time')]"
:next-step-text="t('sync_datasource.next')"
>
<van-date-picker
:min-date="minDate"
@ -466,7 +468,7 @@ const formatDate = computed(() => {
<van-time-picker :columns-type="['hour', 'minute', 'second']" v-model="currentTime" />
</van-picker-group>
<van-date-picker
title="选择日期"
:title="t('dataset.select_date')"
:columns-type="columnsType"
@confirm="onConfirm"
@cancel="onCancel"

View File

@ -2,6 +2,7 @@
import icon_add_outlined from '@/assets/svg/icon_add_outlined.svg'
import icon_deleteTrash_outlined from '@/assets/svg/icon_delete-trash_outlined.svg'
import { guid } from '@/views/visualized/data/dataset/form/util.js'
import { useI18n } from '@/hooks/web/useI18n'
import { ElMessage } from 'element-plus-secondary'
import { ref, shallowRef, computed } from 'vue'
import { cloneDeep } from 'lodash-es'
@ -10,7 +11,7 @@ const dialogVisible = ref(false)
const treeList = ref([])
const datasetMap = shallowRef([])
const emits = defineEmits(['saveTree'])
const { t } = useI18n()
const addCascadeItem = () => {
treeList.value.push({
field: null,
@ -50,13 +51,20 @@ const setCascadeArrBack = () => {
const confirmClick = () => {
const { isError, arr } = setCascadeArrBack()
if (isError) {
ElMessage.error('层级字段不能为空,请选择字段!')
ElMessage.error(t('v_query.select_a_field'))
return
}
emits('saveTree', arr)
handleBeforeClose()
}
const indexCascade = ' 一二三四五'
const indexCascade = [
' ',
t('report.week_mon'),
t('report.week_tue'),
t('report.week_wed'),
t('report.week_thu'),
t('report.week_fri')
]
const deleteCascade = idx => {
treeList.value.splice(idx, 1)
@ -75,7 +83,7 @@ defineExpose({
:before-close="handleBeforeClose"
@mousedown.stop
@mousedup.stop
title="下拉树结构设计"
:title="t('v_query.tree_structure_design')"
>
<div class="cascade-content">
<div style="display: flex; align-items: center; justify-content: space-between">
@ -83,15 +91,15 @@ defineExpose({
<template #icon>
<Icon name="icon_add_outlined"><icon_add_outlined class="svg-icon" /></Icon>
</template>
添加层级
{{ t('v_query.add_level') }}
</el-button>
</div>
<div class="cascade-item">
<div class="label">层级</div>
<div class="item-name">下拉树查询字段</div>
<div class="label">{{ t('visualization.level') }}</div>
<div class="item-name">{{ t('v_query.tree_query_field') }}</div>
</div>
<div class="cascade-item" v-for="(ele, idx) in treeList" :key="ele.id">
<div class="label">层级{{ indexCascade[idx + 1] }}</div>
<div class="label">{{ t('visualization.level') }}{{ indexCascade[idx + 1] }}</div>
<div class="item-name">
<el-select
:disabled="idx === 0 && ele.field"
@ -119,8 +127,8 @@ defineExpose({
</div>
<template #footer>
<div class="dialog-footer">
<el-button secondary @click="cancelClick">取消</el-button>
<el-button type="primary" @click="confirmClick"> 确定 </el-button>
<el-button secondary @click="cancelClick">{{ t('v_query.cancel') }}</el-button>
<el-button type="primary" @click="confirmClick"> {{ t('pblink.sure_bt') }} </el-button>
</div>
</template>
</el-dialog>

View File

@ -1,5 +1,7 @@
import type { ComponentInfo } from '@/api/chart'
import { guid } from '@/views/visualized/data/dataset/form/util.js'
import { useI18n } from '@/hooks/web/useI18n'
const { t } = useI18n()
const infoFormat = (obj: ComponentInfo) => {
const { id, name, deType, type, datasetId } = obj
@ -67,7 +69,7 @@ const infoFormat = (obj: ComponentInfo) => {
const addQueryCriteriaConfig = () => {
const componentInfo: ComponentInfo = {
id: '',
name: '未命名',
name: t('v_query.unnamed'),
deType: 0,
type: 'VARCHAR',
datasetId: ''

View File

@ -2553,6 +2553,97 @@ export default {
sql_variable: {
variable_mgm: '参数设置'
},
v_query: {
before_querying: '查询条件是必填项请设置选项值后再进行查询',
here_or_click: '将右侧的字段拖拽到这里 点击',
add_query_condition: '添加查询条件',
set_filter_condition: '设置过滤条件',
delete_condition: '删除条件',
last_3_months: '最近 3 ',
last_6_months: '最近 6 ',
last_12_months: '最近 12 ',
last_3_days: '最近 3 ',
month_to_date: '月初至今',
year_to_date: '年初至今',
exact_match: '精确匹配',
fuzzy_match: '模糊匹配',
option_type: '选项类型',
time_filter_range: '设置时间筛选范围',
configured: '已配置',
is_not_supported: '绑定参数后不支持传空数据',
contains_empty_data: '选项值包含空数据',
unnamed: '未命名',
cannot_be_empty: '查询条件或字段不能为空',
the_first_level: '第一级无需配置被级联字段',
configure_cascaded_fields: '与上一级使用同一个数据集,无需配置被级联字段',
condition_cascade_configuration: '查询条件级联配置',
not_reverse_cascade: '(仅上级能级联下级,不可反向级联)',
must_be_met: '基于当前查询组件的查询条件如果需要进行级联配置需要满足以下条件',
select_data_set: '1. 展示类型文本下拉组件和数字下拉组件2. 选项值来源选择数据集',
add_cascade_configuration: '添加级联配置',
add_cascade_condition: '添加级联条件',
query_condition_level: '查询条件层级',
select_query_condition: '请选择查询条件',
select_cascaded_field: '请选择被级联字段',
level_1: '{msg}',
to_modify_it: '数据集的修改会导致级联配置失效因此对应的级联关系将被清除确定修改吗',
be_linked_first: '请先勾选需要联动的图表及字段',
cannot_be_performed: '所选字段类型不一致无法进行查询配置',
numerical_parameter_configuration: '数值参数配置必须配置最大值和最小值',
format_is_inconsistent: '时间格式不一致',
cannot_be_empty_de: '查询条件为必填项,默认值不能为空',
the_start_time: '结束时间必须大于开始时间!',
and_end_time: '时间参数配置必须配置开始时间和结束时间',
cannot_be_empty_time: '默认时间不能为空!',
range_please_reset: '默认值超出日期筛选范围内请重新设置',
cannot_be_empty_input: '手工输入-选项值不能为空',
option_value_field: '请选择数据集及选项值字段',
the_data_set: '请选择数据集的选项值字段',
cannot_be_empty_name: '字段名称不能为空',
query_condition_setting: '查询条件设置',
query_condition: '查询条件',
chart_and_field: '选择关联图表及字段',
be_switched_to: '注意:自动模式支持同数据集自动关联字段可切换到',
to_automatic_again: '自定义模式切换到自定义模式后无法再切换为自动',
as_query_conditions: '脱敏字段不能被设置为查询条件',
query_condition_configuration: '查询条件配置',
required_items: '必填项',
display_type: '展示类型',
text_drop_down: '文本下拉',
text_search: '文本搜索',
drop_down_tree: '下拉树',
number_drop_down: '数字下拉',
number_range: '数值区间',
of_option_values: '选项值数量',
tree_structure_design: '下拉树结构设计',
the_tree_structure: '点击进行树结构设计',
time_granularity: '时间粒度',
the_time_granularity: '请选择时间粒度',
option_value_source: '选项值来源',
manual_input: '手动输入',
query_field: '查询字段',
display_field: '显示字段',
the_sorting_field: '请选择排序字段',
condition_type: '条件类型',
single_condition: '单条件',
with_condition: '与条件',
or_condition: '或条件',
hide_condition_switch: '隐藏条件切换',
cannot_be_displayed: '图表所使用的数据集不同, 无法展示配置项',
component_cascade_configuration: '查询组件级联配置',
time_type: '时间类型',
start_at: '开始于',
end_at: '结束于',
time_interval: '时间区间',
interval_type: '区间类型',
query_time_window: '动态查询时间窗口',
maximum_single_query: '单次查询最多',
empty_data: '空数据',
time_selection: '时间选择',
select_a_field: '层级字段不能为空,请选择字段!',
add_level: '添加层级',
tree_query_field: '下拉树查询字段'
},
panel: {
column_name: '字段名称'
},

View File

@ -12,6 +12,7 @@ import { useCache } from '@/hooks/web/useCache'
import Personal from './personal/index.vue'
import VanTabbar from 'vant/es/tabbar'
import VanTabbarItem from 'vant/es/tabbar-item'
import { useI18n } from '@/hooks/web/useI18n'
import VanOverlay from 'vant/es/overlay'
import VanLoading from 'vant/es/loading'
import 'vant/es/tabbar-item/style'
@ -23,6 +24,7 @@ const activeTabbar = ref('home')
const showLoading = ref(false)
const hiddenTabbar = ref(false)
const { wsCache } = useCache('sessionStorage')
const { t } = useI18n()
onBeforeMount(() => {
activeTabbar.value = wsCache.get('activeTabbar') || 'home'