From fa5b49d1bb57c5620389cfb3d477c8704ac2564d Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Tue, 24 Jun 2025 16:06:08 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=9F=A5=E8=AF=A2=E7=BB=84=E4=BB=B6):=20v?= =?UTF-8?q?2=E6=96=87=E6=9C=AC=E4=B8=8B=E6=8B=89=E6=A1=86=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=80=BC=EF=BC=8C=E5=B8=8C=E6=9C=9B=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=B8=BA=E5=8A=A8=E6=80=81=E5=80=BC=20#12071?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../custom-component/v-query/Component.vue | 81 +++++++++++++------ .../src/custom-component/v-query/Select.vue | 2 +- core/core-frontend/src/locales/en.ts | 1 + core/core-frontend/src/locales/tw.ts | 1 + core/core-frontend/src/locales/zh-CN.ts | 1 + 5 files changed, 62 insertions(+), 24 deletions(-) diff --git a/core/core-frontend/src/custom-component/v-query/Component.vue b/core/core-frontend/src/custom-component/v-query/Component.vue index 7d09d314b1..b1e04649ad 100644 --- a/core/core-frontend/src/custom-component/v-query/Component.vue +++ b/core/core-frontend/src/custom-component/v-query/Component.vue @@ -16,6 +16,7 @@ import { reactive, ref, toRefs, + unref, watch, computed, onMounted, @@ -64,8 +65,7 @@ const { element, view, scale } = toRefs(props) const { t } = useI18n() const vQueryRef = ref() const dvMainStore = dvMainStoreWithOut() -const { curComponent, canvasViewInfo, mobileInPc, firstLoadMap, editMode } = - storeToRefs(dvMainStore) +const { curComponent, canvasViewInfo, mobileInPc, firstLoadMap } = storeToRefs(dvMainStore) const canEdit = ref(false) const queryConfig = ref() const defaultStyle = { @@ -92,14 +92,12 @@ const defaultStyle = { queryConditionWidth: 227, nameboxSpacing: 8, queryConditionSpacing: 16, + queryConditionHeight: 32, btnColor: '#3370ff', labelColorBtn: '#ffffff' } const customStyle = reactive({ ...defaultStyle }) const snapshotStore = snapshotStoreWithOut() -const userAgent = navigator.userAgent.toLowerCase() -// 判断是否为飞书内置浏览器 -const isFeiShu = /lark/i.test(userAgent) const btnStyle = computed(() => { const style = { @@ -237,6 +235,7 @@ const setCustomStyle = val => { queryConditionWidth, nameboxSpacing, queryConditionSpacing, + queryConditionHeight, labelColorBtn, btnColor, placeholderSize, @@ -270,6 +269,7 @@ const setCustomStyle = val => { customStyle.queryConditionWidth = queryConditionWidth ?? 227 customStyle.nameboxSpacing = nameboxSpacing ?? 8 customStyle.queryConditionSpacing = queryConditionSpacing ?? 16 + customStyle.queryConditionHeight = queryConditionHeight ?? 32 customStyle.labelColorBtn = labelColorBtn || '#ffffff' customStyle.labelShow = labelShow ?? true customStyle.btnColor = btnColor || '#3370ff' @@ -355,22 +355,26 @@ const getKeyList = next => { } const fillRequireVal = arr => { - element.value.propValue.forEach(next => { + element.value.propValue?.forEach(next => { if (arr.some(itx => next.checkedFields.includes(itx)) && next.required) { if (next.displayType === '8') { const { conditionValueF, conditionValueS, conditionType } = next if (conditionType === 0 && conditionValueF === '') { next.conditionValueF = next.defaultConditionValueF - } else if (conditionValueF === '' || conditionValueS === '') { - next.conditionValueF = next.defaultConditionValueF - next.conditionValueS = next.defaultConditionValueS + } else { + if (conditionValueF === '') { + next.conditionValueF = next.defaultConditionValueF + } + if (conditionValueS === '') { + next.conditionValueS = next.defaultConditionValueS + } } } else if (next.displayType === '22') { - if ( - (next.numValueStart !== 0 && !next.numValueStart) || - (next.numValueEnd !== 0 && !next.numValueEnd) - ) { + if (next.numValueStart !== 0 && !next.numValueStart) { next.numValueStart = next.defaultNumValueStart + } + + if (next.numValueEnd !== 0 && !next.numValueEnd) { next.numValueEnd = next.defaultNumValueEnd } } else if ( @@ -475,8 +479,8 @@ const getPlaceholder = computed(() => { } }) -const isConfirmSearch = id => { - if (componentWithSure.value) return +const isConfirmSearch = (id, disabledFirstItem = false) => { + if (componentWithSure.value && !disabledFirstItem) return queryDataForId(id) } @@ -498,7 +502,7 @@ onBeforeUnmount(() => { const updateQueryCriteria = () => { if (dvMainStore.mobileInPc && !isMobile()) return Array.isArray(element.value.propValue) && - element.value.propValue.forEach(ele => { + element.value.propValue?.forEach(ele => { if (ele.auto) { const componentInfo = { datasetId: ele.dataset.id, @@ -590,10 +594,26 @@ const addCriteriaConfigOut = () => { queryConfig.value.setConditionOut() } +const reRenderAll = (oldArr, newArr) => { + const newArrIds = newArr.map(ele => ele.id) + const emitterList = (oldArr || []).reduce((pre, next) => { + if (newArrIds.includes(next.id)) return pre + const keyList = getKeyList(next) + pre = [...new Set([...keyList, ...pre])] + return pre + }, []) + if (!emitterList.length) return + emitterList.forEach(ele => { + emitter.emit(`query-data-${ele}`) + }) +} + const delQueryConfig = index => { + const com = cloneDeep(unref(list)) list.value.splice(index, 1) element.value.propValue = [...list.value] snapshotStore.recordSnapshotCache('delQueryConfig') + reRenderAll(com, cloneDeep(unref(list))) } const resetData = () => { @@ -690,6 +710,10 @@ const boxWidth = computed(() => { return `${customStyle.placeholderSize}px` }) +const boxHeight = computed(() => { + return `${customStyle.queryConditionHeight || 32}px` +}) + const queryData = () => { let requiredName = '' let numName = '' @@ -803,7 +827,7 @@ const marginRight = computed(() => { }) const autoStyle = computed(() => { - if (isISOMobile() || isFeiShu) { + if (isISOMobile()) { return { position: 'absolute', height: 100 / scale.value + '%!important', @@ -832,7 +856,7 @@ const autoStyle = computed(() => {
{{ t('v_query.here_or_click') }} {
{ :query-element="element" @queryData="queryData" ref="queryConfig" + @reRenderAll="reRenderAll" > @@ -949,6 +972,17 @@ const autoStyle = computed(() => { background-color: v-bind(tagColor); } + :deep(.ed-input), + :deep(.ed-date-editor) { + --ed-input-height: v-bind(boxHeight); + } + + :deep(.ed-select__wrapper), + :deep(.text-search-select .ed-input__wrapper), + :deep(.text-search-select .ed-select__wrapper) { + height: v-bind(boxHeight); + } + .ed-button--primary { --ed-button-bg-color: v-bind(btnHoverStyle.rawColor); --ed-button-border-color: v-bind(btnHoverStyle.rawColor); @@ -971,7 +1005,8 @@ const autoStyle = computed(() => { --ed-tag-font-size: v-bind(boxWidth); } - :deep(.ed-select-v2) { + :deep(.ed-select-v2), + :deep(.ed-select__wrapper) { font-size: v-bind(boxWidth); } @@ -1216,4 +1251,4 @@ const autoStyle = computed(() => { } } } - + \ No newline at end of file diff --git a/core/core-frontend/src/custom-component/v-query/Select.vue b/core/core-frontend/src/custom-component/v-query/Select.vue index 63c9b7d743..6050b07ed1 100644 --- a/core/core-frontend/src/custom-component/v-query/Select.vue +++ b/core/core-frontend/src/custom-component/v-query/Select.vue @@ -830,4 +830,4 @@ defineExpose({ max-width: v-bind(tagTextWidth) !important; } } - + \ No newline at end of file diff --git a/core/core-frontend/src/locales/en.ts b/core/core-frontend/src/locales/en.ts index 90731e87e4..44dad8957a 100644 --- a/core/core-frontend/src/locales/en.ts +++ b/core/core-frontend/src/locales/en.ts @@ -12,6 +12,7 @@ export default { the_application_id: 'Please enter the application ID', embed: 'Embed', empty: ' ', + first_item: 'First Item', cross_source: 'Cross-source', single_source: 'Single-source', source_tips: diff --git a/core/core-frontend/src/locales/tw.ts b/core/core-frontend/src/locales/tw.ts index 847d9bc2f9..5ab219c7ed 100644 --- a/core/core-frontend/src/locales/tw.ts +++ b/core/core-frontend/src/locales/tw.ts @@ -12,6 +12,7 @@ export default { the_application_id: '請輸入應用程式 ID', embed: '嵌入', empty: '', + first_item: '首項', cross_source: '跨源', single_source: '單源', source_tips: '資料集存在跨源情況,請檢查其他 SQL 節點的語法,是否確認將類型改為單源?', diff --git a/core/core-frontend/src/locales/zh-CN.ts b/core/core-frontend/src/locales/zh-CN.ts index 71ee725964..9d03c45982 100644 --- a/core/core-frontend/src/locales/zh-CN.ts +++ b/core/core-frontend/src/locales/zh-CN.ts @@ -12,6 +12,7 @@ export default { the_application_id: '请输入应用 ID', embed: '嵌入', empty: '', + first_item: '首项', cross_source: '跨源', single_source: '单源', source_tips: '数据集存在跨源情况,请检查其他 SQL 节点的语法,是否确认将类型改为单源?',