diff --git a/core/core-frontend/src/views/chart/components/editor/filter/FilterTree.vue b/core/core-frontend/src/views/chart/components/editor/filter/FilterTree.vue index e2a5454273..bcb2addeb3 100644 --- a/core/core-frontend/src/views/chart/components/editor/filter/FilterTree.vue +++ b/core/core-frontend/src/views/chart/components/editor/filter/FilterTree.vue @@ -1,7 +1,7 @@ + + + + + + + + {{ logic === 'or' ? 'OR' : 'AND' }} + + + + {{ logic === 'or' ? 'OR' : 'AND' }} + + + + + + + AND + OR + + + + + + + + + + + + + del(idx, item.child)" + @addCondReal="(type, logic) => add(type, item.child, logic)" + :logic="item.logic" + @removeRelationList="removeRelationList(index)" + :relationList="item.child" + > + + + + + + + {{ t('auth.add_condition') }} + + + + {{ t('auth.add_relationship') }} + + + + + + + diff --git a/core/core-frontend/src/views/chart/components/editor/filter/auth-tree-chart/FilterFiled.vue b/core/core-frontend/src/views/chart/components/editor/filter/auth-tree-chart/FilterFiled.vue new file mode 100644 index 0000000000..3ce9582533 --- /dev/null +++ b/core/core-frontend/src/views/chart/components/editor/filter/auth-tree-chart/FilterFiled.vue @@ -0,0 +1,1258 @@ + + + + + + {{ t('auth.filter_fields') }} + + + + + + + + + + + + + + + + + + + {{ ele.name }} + + + + + + + + {{ t('auth.screen_method') }} + + + + + {{ t('auth.fixed_value') }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ i }} + + + + + + {{ t('auth.select_all') }} + + + + + {{ t('auth.added') }}{{ checklist.length }} + + + + {{ t('auth.manual_input') }} + + + + + + + + {{ t('auth.close') }} + + + {{ t('auth.add') }} + + + + + + + + + + + {{ i }} + + + + + + + + + + {{ t('auth.sure') }} + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/core-frontend/src/views/chart/components/editor/filter/auth-tree-chart/RowAuth.vue b/core/core-frontend/src/views/chart/components/editor/filter/auth-tree-chart/RowAuth.vue new file mode 100644 index 0000000000..62b70de1f6 --- /dev/null +++ b/core/core-frontend/src/views/chart/components/editor/filter/auth-tree-chart/RowAuth.vue @@ -0,0 +1,447 @@ + + + + + del(idx)" + @addCondReal="addCondReal" + @removeRelationList="removeRelationList" + @changeAndOrDfs="type => changeAndOrDfs(relationList, type)" + :relationList="relationList" + v-model:logic="logic" + /> + + + + + + + + + + diff --git a/core/core-frontend/src/views/chart/components/editor/filter/auth-tree/FilterFiled.vue b/core/core-frontend/src/views/chart/components/editor/filter/auth-tree/FilterFiled.vue index 3ce9582533..f2e64514d4 100644 --- a/core/core-frontend/src/views/chart/components/editor/filter/auth-tree/FilterFiled.vue +++ b/core/core-frontend/src/views/chart/components/editor/filter/auth-tree/FilterFiled.vue @@ -3,8 +3,6 @@ import icon_searchOutline_outlined from '@/assets/svg/icon_search-outline_outlin import icon_deleteTrash_outlined from '@/assets/svg/icon_delete-trash_outlined.svg' import { ref, inject, computed, watch, onBeforeMount, toRefs, nextTick } from 'vue' import { useI18n } from '@/hooks/web/useI18n' -import type { SelectConfig } from '../TimeDialog.vue' -import TimeDialog from '@/views/chart/components/editor/filter/TimeDialog.vue' import { multFieldValuesForPermissions } from '@/api/dataset' import { textOptions, @@ -23,9 +21,7 @@ export interface Item { enumValue: string name: string value: number - filterTypeTime?: string timeValue: string - dynamicTimeSetting?: SelectConfig } type Props = { @@ -42,9 +38,7 @@ const props = withDefaults(defineProps(), { deType: 0, enumValue: '', name: '', - filterTypeTime: 'dateValue', value: null, - dynamicTimeSetting: null, timeValue: '' }) }) @@ -175,80 +169,6 @@ const initEnumOptions = () => { } } -const dialogVisible = ref(false) -const timeDialog = ref() -const handleClick = () => { - dialogVisible.value = true - nextTick(() => { - timeDialog.value.init(item.value.dynamicTimeSetting || {}) - }) -} - -const relativeToCurrentTypeMap = { - year: '年', - month: '月', - date: '日', - datetime: '日' -} - -const confirmTimeSelect = () => { - item.value.dynamicTimeSetting = { ...timeDialog.value.curComponent } - const { - timeGranularity, - timeNum, - relativeToCurrentType, - around, - arbitraryTime, - relativeToCurrent - } = item.value.dynamicTimeSetting - if (relativeToCurrent !== 'custom') { - item.value.timeValue = [ - { - label: '今年', - value: 'thisYear' - }, - { - label: '去年', - value: 'lastYear' - }, - { - label: '本月', - value: 'thisMonth' - }, - { - label: '上月', - value: 'lastMonth' - }, - { - label: '今天', - value: 'today' - }, - { - label: '昨天', - value: 'yesterday' - }, - { - label: '月初', - value: 'monthBeginning' - }, - { - label: '年初', - value: 'yearBeginning' - } - ].find(ele => ele.value === relativeToCurrent).label - dialogVisible.value = false - return - } - item.value.timeValue = `${timeNum}${relativeToCurrentTypeMap[relativeToCurrentType]}${ - around === 'f' ? '前' : '后' - }` - if (timeGranularity === 'datetime') { - item.value.timeValue += new Date(arbitraryTime).toLocaleString().split(' ')[1] - } - - dialogVisible.value = false -} - const optionData = data => { if (!data) return null return data.filter(item => !!item) @@ -272,9 +192,7 @@ const selectItem = ({ name, id, deType }) => { enumValue: '', value: '', term: '', - filterTypeTime: 'dateValue', - timeValue: '', - dynamicTimeSetting: {} + timeValue: '' }) filterListInit(deType) checklist.value = [] @@ -296,16 +214,6 @@ const filterListInit = deType => { } } -const filterListTime = [ - { - value: 'dateValue', - label: '固定值' - }, - { - value: 'dynamicDate', - label: '动态值' - } -] const clearAll = () => { checklist.value = [] } @@ -394,42 +302,22 @@ const emits = defineEmits(['update:item', 'del']) - - {{ t('auth.screen_method') }} - {{ t('auth.screen_method') }} + + - - - - {{ t('auth.fixed_value') }} - - - - - - - + + + {{ t('auth.fixed_value') }} - @@ -607,21 +482,6 @@ const emits = defineEmits(['update:item', 'del']) /> - - - - - - diff --git a/core/core-frontend/src/views/chart/components/editor/filter/auth-tree/RowAuth.vue b/core/core-frontend/src/views/chart/components/editor/filter/auth-tree/RowAuth.vue index 62b70de1f6..b26e407bcb 100644 --- a/core/core-frontend/src/views/chart/components/editor/filter/auth-tree/RowAuth.vue +++ b/core/core-frontend/src/views/chart/components/editor/filter/auth-tree/RowAuth.vue @@ -40,16 +40,7 @@ const submit = () => { errorMessage: errorMessage.value }) } -const errorDetected = ({ - enumValue, - deType, - filterType, - term, - value, - name, - timeValue, - filterTypeTime -}) => { +const errorDetected = ({ enumValue, deType, filterType, term, value, name, timeValue }) => { if (!name) { errorMessage.value = t('data_set.cannot_be_empty_') return @@ -73,8 +64,7 @@ const errorDetected = ({ !term.includes('null') && !term.includes('empty') && ['', null, undefined].includes(timeValue) && - deType === 1 && - filterTypeTime === 'dynamicDate' + deType === 1 ) { errorMessage.value = t('chart.filter_value_can_null') return @@ -94,68 +84,6 @@ const errorDetected = ({ } } -const getTimeValue = dynamicTimeSetting => { - const relativeToCurrentTypeMap = { - year: '年', - month: '月', - date: '日', - datetime: '日' - } - let timeValue = '' - const { - timeGranularity, - timeNum, - relativeToCurrentType, - around, - arbitraryTime, - relativeToCurrent - } = dynamicTimeSetting || {} - if (relativeToCurrent !== 'custom') { - timeValue = [ - { - label: '今年', - value: 'thisYear' - }, - { - label: '去年', - value: 'lastYear' - }, - { - label: '本月', - value: 'thisMonth' - }, - { - label: '上月', - value: 'lastMonth' - }, - { - label: '今天', - value: 'today' - }, - { - label: '昨天', - value: 'yesterday' - }, - { - label: '月初', - value: 'monthBeginning' - }, - { - label: '年初', - value: 'yearBeginning' - } - ].find(ele => ele.value === relativeToCurrent)?.label - return timeValue - } - timeValue = `${timeNum}${relativeToCurrentTypeMap[relativeToCurrentType]}${ - around === 'f' ? '前' : '后' - }` - if (timeGranularity === 'datetime') { - timeValue += new Date(arbitraryTime).toLocaleString().split(' ')[1] - } - - return timeValue -} const dfsInit = arr => { const elementList = [] arr.forEach(ele => { @@ -165,25 +93,14 @@ const dfsInit = arr => { const child = dfsInit(items) elementList.push({ logic, child }) } else { - const { - enumValue, - filterTypeTime, - dynamicTimeSetting, - fieldId, - filterType, - term, - value, - field - } = ele + const { enumValue, fieldId, filterType, term, value, timeValue, field } = ele const { name, deType } = field || {} elementList.push({ enumValue: enumValue.join(','), fieldId, filterType, term, - timeValue: getTimeValue(dynamicTimeSetting), - filterTypeTime, - dynamicTimeSetting, + timeValue, value, name, deType @@ -206,33 +123,18 @@ const dfsSubmit = arr => { term: '', type: 'tree', value: '', - filterTypeTime: 'dateValue', timeValue: '', - dynamicTimeSetting: {}, subTree: { logic, items: subTree } }) } else { - const { - enumValue, - filterTypeTime, - dynamicTimeSetting, - fieldId, - filterType, - deType, - term, - value, - name, - timeValue - } = ele - errorDetected({ deType, enumValue, filterType, term, value, name, timeValue, filterTypeTime }) + const { enumValue, fieldId, filterType, deType, term, value, name, timeValue } = ele + errorDetected({ deType, enumValue, filterType, term, value, name, timeValue }) if (fieldId) { items.push({ enumValue: enumValue ? enumValue.split(',') : [], fieldId, timeValue, filterType, - filterTypeTime, - dynamicTimeSetting, term, value, type: 'item', @@ -378,8 +280,6 @@ const addCondReal = (type, logic) => { filterType: 'logic', name: '', timeValue: '', - filterTypeTime: 'dateValue', - dynamicTimeSetting: {}, deType: '' } : { child: [], logic }