+
+
{{ formattedResult }}
{{ suffixContent }}
@@ -393,4 +605,8 @@ defineExpose({
-
+
diff --git a/core/core-frontend/src/custom-component/picture-group/Attr.vue b/core/core-frontend/src/custom-component/picture-group/Attr.vue
index 77c0f55..c516223 100644
--- a/core/core-frontend/src/custom-component/picture-group/Attr.vue
+++ b/core/core-frontend/src/custom-component/picture-group/Attr.vue
@@ -8,8 +8,7 @@ import PictureGroupUploadAttr from '@/custom-component/picture-group/PictureGrou
import PictureGroupDatasetSelect from '@/custom-component/picture-group/PictureGroupDatasetSelect.vue'
import CarouselSetting from '@/custom-component/common/CarouselSetting.vue'
import PictureGroupThreshold from '@/custom-component/picture-group/PictureGroupThreshold.vue'
-
-const props = defineProps({
+defineProps({
themes: {
type: String as PropType
,
default: 'dark'
@@ -73,10 +72,6 @@ const { curComponent, canvasViewInfo, mobileInPc, batchOptStatus } = storeToRefs
margin: 0 6px 0 8px;
}
}
-
- :deep(.ed-collapse-item__content) {
- padding: 16px 8px 0;
- }
:deep(.ed-form-item) {
display: block;
margin-bottom: 8px;
diff --git a/core/core-frontend/src/custom-component/picture-group/Component.vue b/core/core-frontend/src/custom-component/picture-group/Component.vue
index bb014ee..0ce6b1e 100644
--- a/core/core-frontend/src/custom-component/picture-group/Component.vue
+++ b/core/core-frontend/src/custom-component/picture-group/Component.vue
@@ -26,7 +26,6 @@ import {
onBeforeMount
} from 'vue'
import { imgUrlTrans } from '@/utils/imgUtils'
-import eventBus from '@/utils/eventBus'
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
import { getData } from '@/api/chart'
import { parseJson } from '@/views/chart/components/js/util'
@@ -35,7 +34,7 @@ import { storeToRefs } from 'pinia'
import ChartEmptyInfo from '@/views/chart/components/views/components/ChartEmptyInfo.vue'
import ChartError from '@/views/chart/components/views/components/ChartError.vue'
const dvMainStore = dvMainStoreWithOut()
-const { canvasViewInfo, editMode, mobileInPc, canvasStyleData } = storeToRefs(dvMainStore)
+const { canvasViewInfo, mobileInPc, fullscreenFlag } = storeToRefs(dvMainStore)
const state = reactive({
emptyValue: '-',
data: null,
@@ -77,7 +76,9 @@ const dataRowFiledName = ref([])
let carouselTimer = null
const { element, view, showPosition } = toRefs(props)
-const isEditMode = computed(() => showPosition.value.includes('canvas') && !mobileInPc.value)
+const isEditMode = computed(
+ () => showPosition.value.includes('canvas') && !mobileInPc.value && !fullscreenFlag.value
+)
watch(
() => isEditMode.value,
@@ -121,12 +122,6 @@ const imageAdapter = computed(() => {
return style as CSSProperties
})
-const uploadImg = () => {
- nextTick(() => {
- eventBus.emit('uploadImg')
- })
-}
-
const initCurFields = chartDetails => {
dataRowFiledName.value = []
dataRowSelect.value = {}
@@ -251,7 +246,7 @@ const calcData = (viewCalc: Chart, callback) => {
}
// 初始化此处不必刷新
-const renderChart = viewInfo => {
+const renderChart = () => {
//do renderView
}
diff --git a/core/core-frontend/src/custom-component/picture-group/PictureGroupDatasetSelect.vue b/core/core-frontend/src/custom-component/picture-group/PictureGroupDatasetSelect.vue
index f373ebb..f5041d8 100644
--- a/core/core-frontend/src/custom-component/picture-group/PictureGroupDatasetSelect.vue
+++ b/core/core-frontend/src/custom-component/picture-group/PictureGroupDatasetSelect.vue
@@ -32,7 +32,6 @@ const onDatasetUpdate = () => {
res.quotaList.pop()
view.value.xAxis.push(...res.dimensionList, ...res.quotaList)
const viewTarget = view.value
- debugger
useEmitt().emitter.emit('calcData-' + viewTarget.id, viewTarget)
snapshotStore.recordSnapshotCache('calc', view.value.id)
})
diff --git a/core/core-frontend/src/custom-component/picture-group/PictureGroupUploadAttr.vue b/core/core-frontend/src/custom-component/picture-group/PictureGroupUploadAttr.vue
index 32473ef..8533585 100644
--- a/core/core-frontend/src/custom-component/picture-group/PictureGroupUploadAttr.vue
+++ b/core/core-frontend/src/custom-component/picture-group/PictureGroupUploadAttr.vue
@@ -3,8 +3,8 @@ import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot'
import { storeToRefs } from 'pinia'
-import { ElIcon, ElMessage } from 'element-plus-secondary'
-import { ref, onMounted, onBeforeUnmount, watch, PropType, computed } from 'vue'
+import { ElIcon } from 'element-plus-secondary'
+import { ref, onMounted, onBeforeUnmount, watch, PropType } from 'vue'
import { beforeUploadCheck, uploadFileResult } from '@/api/staticResource'
import { imgUrlTrans } from '@/utils/imgUtils'
import eventBus from '@/utils/eventBus'
@@ -42,14 +42,13 @@ const dialogImageUrl = ref('')
const dialogVisible = ref(false)
const uploadDisabled = ref(false)
const files = ref(null)
-const maxImageSize = 15000000
const handlePictureCardPreview = file => {
dialogImageUrl.value = file.url
dialogVisible.value = true
}
-const handleRemove = (file, fileListArray) => {
+const handleRemove = file => {
uploadDisabled.value = false
let file_static_part = file.url.split('static-resource/')[1]
let index = element.value.propValue['urlList'].findIndex(
@@ -79,10 +78,6 @@ const goFile = () => {
files.value.click()
}
-const sizeMessage = () => {
- ElMessage.success('图片大小不符合')
-}
-
const fileListInit = () => {
fileList.value = []
if (element.value.propValue.urlList && element.value.propValue.urlList.length > 0) {
@@ -95,10 +90,6 @@ const init = () => {
fileListInit()
}
-const toolTip = computed(() => {
- return props.themes === 'dark' ? 'ndark' : 'dark'
-})
-
watch(
() => element.value.propValue['urlList'],
() => {
diff --git a/core/core-frontend/src/custom-component/picture/Attr.vue b/core/core-frontend/src/custom-component/picture/Attr.vue
index 965023f..23e153e 100644
--- a/core/core-frontend/src/custom-component/picture/Attr.vue
+++ b/core/core-frontend/src/custom-component/picture/Attr.vue
@@ -5,7 +5,7 @@ import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapsho
import { storeToRefs } from 'pinia'
import { ElIcon, ElMessage } from 'element-plus-secondary'
-import { ref, onMounted, onBeforeUnmount, watch, PropType, reactive, toRefs, computed } from 'vue'
+import { ref, onMounted, onBeforeUnmount, watch, PropType } from 'vue'
import { beforeUploadCheck, uploadFileResult } from '@/api/staticResource'
import { imgUrlTrans } from '@/utils/imgUtils'
import eventBus from '@/utils/eventBus'
@@ -13,7 +13,7 @@ import ImgViewDialog from '@/custom-component/ImgViewDialog.vue'
import { useI18n } from '@/hooks/web/useI18n'
const { t } = useI18n()
-const props = defineProps({
+defineProps({
themes: {
type: String as PropType,
default: 'dark'
@@ -31,7 +31,6 @@ const dialogVisible = ref(false)
const uploadDisabled = ref(false)
const files = ref(null)
const maxImageSize = 15000000
-const state = reactive({})
const handlePictureCardPreview = file => {
dialogImageUrl.value = file.url
@@ -73,7 +72,7 @@ const reUpload = e => {
}
const sizeMessage = () => {
- ElMessage.success('图片大小不符合')
+ ElMessage.success('图片大小不能超过15M')
}
const init = () => {
if (curComponent.value.propValue.url) {
@@ -83,10 +82,6 @@ const init = () => {
}
}
-const toolTip = computed(() => {
- return props.themes === 'dark' ? 'ndark' : 'dark'
-})
-
watch(
() => curComponent.value.propValue.url,
() => {
diff --git a/core/core-frontend/src/custom-component/pop-area/Component.vue b/core/core-frontend/src/custom-component/pop-area/Component.vue
index 885838b..948dda5 100644
--- a/core/core-frontend/src/custom-component/pop-area/Component.vue
+++ b/core/core-frontend/src/custom-component/pop-area/Component.vue
@@ -118,7 +118,7 @@ const handleDragOver = e => {
e.dataTransfer.dropEffect = 'copy'
}
-const handleDragLeave = e => {
+const handleDragLeave = () => {
areaActive.value = false
}
@@ -142,7 +142,7 @@ const handleDrop = e => {
adaptCurThemeCommonStyle(component)
snapshotStore.recordSnapshotCache('renderChart', component.id)
} else {
- ElMessage.error('及支持添加查询组件')
+ ElMessage.error(t('visualization.support_query'))
}
}
}
diff --git a/core/core-frontend/src/custom-component/rich-text/DeRichTextView.vue b/core/core-frontend/src/custom-component/rich-text/DeRichTextView.vue
index 5f9e862..bc82c27 100644
--- a/core/core-frontend/src/custom-component/rich-text/DeRichTextView.vue
+++ b/core/core-frontend/src/custom-component/rich-text/DeRichTextView.vue
@@ -218,7 +218,7 @@ const init = ref({
})
// 监听 mouseup 事件以结束调整
- doc.addEventListener('mouseup', event => {
+ doc.addEventListener('mouseup', () => {
if (cloneHandle) {
// 显示原始手柄并移除克隆手柄
originalHandle.style.display = ''
@@ -370,7 +370,7 @@ const jumpTargetAdaptor = () => {
const assignment = content => {
if (content) {
- const on = content?.match(/\[(.+?)\]/g)
+ const on = content?.match(/\[(.+?)\]/g) || []
if (on) {
const thresholdStyleInfo = conditionAdaptor(state.viewDataInfo)
on.forEach(itm => {
diff --git a/core/core-frontend/src/custom-component/scroll-text/Attr.vue b/core/core-frontend/src/custom-component/scroll-text/Attr.vue
index 6a36820..6c59f47 100644
--- a/core/core-frontend/src/custom-component/scroll-text/Attr.vue
+++ b/core/core-frontend/src/custom-component/scroll-text/Attr.vue
@@ -37,9 +37,6 @@ const { themes } = toRefs(props)
font-size: 12px !important;
font-weight: 400 !important;
}
- :deep(.ed-collapse-item__content) {
- padding: 16px !important;
- }
:deep(.ed-form-item) {
display: block;
margin-bottom: 8px;
diff --git a/core/core-frontend/src/custom-component/scroll-text/Component.vue b/core/core-frontend/src/custom-component/scroll-text/Component.vue
index ee4d676..430e49c 100644
--- a/core/core-frontend/src/custom-component/scroll-text/Component.vue
+++ b/core/core-frontend/src/custom-component/scroll-text/Component.vue
@@ -42,7 +42,7 @@ const props = defineProps({
const { element, showPosition } = toRefs(props)
const dvMainStore = dvMainStoreWithOut()
-const { editMode, curComponent, canvasStyleData } = storeToRefs(dvMainStore)
+const { editMode, curComponent } = storeToRefs(dvMainStore)
const onComponentClick = () => {
if (curComponent.value.id !== element.value.id) {
diff --git a/core/core-frontend/src/custom-component/user-view/Component.vue b/core/core-frontend/src/custom-component/user-view/Component.vue
index c8f7f13..4b067a5 100644
--- a/core/core-frontend/src/custom-component/user-view/Component.vue
+++ b/core/core-frontend/src/custom-component/user-view/Component.vue
@@ -4,6 +4,11 @@ import Chart from '@/views/chart/components/views/index.vue'
import { isISOMobile } from '@/utils/utils'
const props = defineProps({
+ // 公共参数集
+ commonParams: {
+ type: Object,
+ required: false
+ },
active: {
type: Boolean,
default: false
@@ -90,7 +95,7 @@ const autoStyle = computed(() => {
return {}
}
})
-const emits = defineEmits(['onPointClick'])
+const emits = defineEmits(['onPointClick', 'onComponentEvent'])
const onPointClick = param => {
emits('onPointClick', param)
@@ -109,7 +114,9 @@ const onPointClick = param => {
:disabled="disabled"
:suffixId="suffixId"
:font-family="fontFamily"
+ :common-params="commonParams"
@onPointClick="onPointClick"
+ @onComponentEvent="() => emits('onComponentEvent')"
:opt-type="optType"
>
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 782a7ea..d56fd10 100644
--- a/core/core-frontend/src/custom-component/v-query/Component.vue
+++ b/core/core-frontend/src/custom-component/v-query/Component.vue
@@ -2,7 +2,10 @@
import icon_edit_outlined from '@/assets/svg/icon_edit_outlined.svg'
import icon_deleteTrash_outlined from '@/assets/svg/icon_delete-trash_outlined.svg'
import eventBus from '@/utils/eventBus'
+import colorFunctions from 'less/lib/less/functions/color.js'
+import colorTree from 'less/lib/less/tree/color.js'
import { isISOMobile, isMobile } from '@/utils/utils'
+import { cloneDeep } from 'lodash-es'
import { ElMessage } from 'element-plus-secondary'
import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot'
import QueryConditionConfiguration from './QueryConditionConfiguration.vue'
@@ -61,7 +64,8 @@ const { element, view, scale } = toRefs(props)
const { t } = useI18n()
const vQueryRef = ref()
const dvMainStore = dvMainStoreWithOut()
-const { curComponent, canvasViewInfo, mobileInPc, firstLoadMap } = storeToRefs(dvMainStore)
+const { curComponent, canvasViewInfo, mobileInPc, firstLoadMap, editMode } =
+ storeToRefs(dvMainStore)
const canEdit = ref(false)
const queryConfig = ref()
const defaultStyle = {
@@ -88,16 +92,18 @@ 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 = {
- backgroundColor: customStyle.btnColor,
- borderColor: customStyle.btnColor,
color: customStyle.labelColorBtn
} as CSSProperties
if (customStyle.fontSizeBtn) {
@@ -115,6 +121,76 @@ const btnStyle = computed(() => {
return style
})
+function rgbaTo16color(color) {
+ let val = color
+ .replace(/rgba?\(/, '')
+ .replace(/\)/, '')
+ .replace(/[\s+]/g, '')
+ .split(',')
+ let a = parseFloat(val[3] || 1),
+ r = Math.floor(a * parseInt(val[0]) + (1 - a) * 255),
+ g = Math.floor(a * parseInt(val[1]) + (1 - a) * 255),
+ b = Math.floor(a * parseInt(val[2]) + (1 - a) * 255)
+ return (
+ '#' +
+ ('0' + r.toString(16)).slice(-2) +
+ ('0' + g.toString(16)).slice(-2) +
+ ('0' + b.toString(16)).slice(-2)
+ )
+}
+
+const btnHoverStyle = computed(() => {
+ let btnColor = customStyle.btnColor
+ if (customStyle.btnColor.startsWith('rgb')) {
+ btnColor = rgbaTo16color(customStyle.btnColor)
+ }
+
+ if (btnColor.startsWith('#')) {
+ btnColor = btnColor.substr(1)
+ }
+
+ return {
+ rawColor: customStyle.btnColor ?? '#3370ff',
+ hoverColor: customStyle.btnColor
+ ? colorFunctions
+ .mix(new colorTree('ffffff'), new colorTree(btnColor), {
+ value: 15
+ })
+ .toRGB()
+ : '#5285FF',
+ activeColor: customStyle.btnColor
+ ? colorFunctions
+ .mix(new colorTree('000000'), new colorTree(btnColor), {
+ value: 15
+ })
+ .toRGB()
+ : '#2B5FD9'
+ }
+})
+
+const btnPrimaryColor = computed(() => {
+ return btnHoverStyle.value.rawColor
+})
+
+const btnPrimaryHoverColor = computed(() => {
+ return btnHoverStyle.value.hoverColor
+})
+
+const btnPrimaryActiveColor = computed(() => {
+ return btnHoverStyle.value.activeColor
+})
+
+const tagColor = computed(() => {
+ if (customStyle.background && !customStyle.background.toLowerCase().includes('#ffffff')) {
+ return colorFunctions
+ .mix(new colorTree('ffffff'), new colorTree(customStyle.background.substr(1)), {
+ value: 15
+ })
+ .toRGB()
+ }
+ return '#f0f2f5'
+})
+
const btnPlainStyle = computed(() => {
const style = {
backgroundColor: 'transparent',
@@ -162,6 +238,7 @@ const setCustomStyle = val => {
queryConditionWidth,
nameboxSpacing,
queryConditionSpacing,
+ queryConditionHeight,
labelColorBtn,
btnColor,
placeholderSize,
@@ -195,6 +272,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'
@@ -245,12 +323,77 @@ const { emitter } = useEmitt()
const unMountSelect = shallowRef([])
onBeforeMount(() => {
unMountSelect.value = list.value.map(ele => ele.id)
+ ;(props.element.cascade || []).forEach(ele => {
+ ele.forEach(item => {
+ item.currentSelectValue = item.selectValue
+ })
+ })
})
const releaseSelect = id => {
unMountSelect.value = unMountSelect.value.filter(ele => ele !== id)
}
+const getKeyList = next => {
+ let checkedFieldsMapArr = Object.entries(next.checkedFieldsMap).filter(ele =>
+ next.checkedFields.includes(ele[0])
+ )
+ if (next.displayType === '9') {
+ checkedFieldsMapArr = (
+ next.treeCheckedList?.length
+ ? next.treeCheckedList.filter((_, index) => index < next.treeFieldList.length)
+ : next.treeFieldList.map(() => {
+ return {
+ checkedFields: [...next.checkedFields],
+ checkedFieldsMap: cloneDeep(next.checkedFieldsMap)
+ }
+ })
+ )
+ .map(item =>
+ Object.entries(item.checkedFieldsMap).filter(ele => item.checkedFields.includes(ele[0]))
+ )
+ .flat()
+ }
+ return checkedFieldsMapArr.filter(ele => !!ele[1]).map(ele => ele[0])
+}
+
+const fillRequireVal = arr => {
+ 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 (next.displayType === '22') {
+ if (
+ (next.numValueStart !== 0 && !next.numValueStart) ||
+ (next.numValueEnd !== 0 && !next.numValueEnd)
+ ) {
+ next.numValueStart = next.defaultNumValueStart
+ next.numValueEnd = next.defaultNumValueEnd
+ }
+ } else if (
+ (Array.isArray(next.selectValue) && !next.selectValue.length) ||
+ (next.selectValue !== 0 && !next.selectValue)
+ ) {
+ if (
+ next.optionValueSource === 1 &&
+ (next.defaultMapValue?.length || next.displayId) &&
+ ![1, 7].includes(+next.displayType)
+ ) {
+ next.mapValue = next.defaultMapValue
+ next.selectValue = next.multiple ? next.defaultMapValue : next.defaultMapValue[0]
+ } else {
+ next.selectValue = next.defaultValue
+ }
+ }
+ }
+ })
+}
const queryDataForId = id => {
let requiredName = ''
let numName = ''
@@ -302,10 +445,8 @@ const queryDataForId = id => {
requiredName = next.name
}
}
- const keyList = Object.entries(next.checkedFieldsMap)
- .filter(ele => next.checkedFields.includes(ele[0]))
- .filter(ele => !!ele[1])
- .map(ele => ele[0])
+
+ const keyList = getKeyList(next)
pre = [...new Set([...keyList, ...pre])]
return pre
}, [])
@@ -318,6 +459,7 @@ const queryDataForId = id => {
return
}
if (!emitterList.length) return
+ fillRequireVal(emitterList)
emitterList.forEach(ele => {
emitter.emit(`query-data-${ele}`)
})
@@ -490,11 +632,7 @@ const resetData = () => {
}
})
})
-
- const keyList = Object.entries(next.checkedFieldsMap)
- .filter(ele => next.checkedFields.includes(ele[0]))
- .filter(ele => !!ele[1])
- .map(ele => ele[0])
+ const keyList = getKeyList(next)
pre = [...new Set([...keyList, ...pre])]
return pre
}, [])
@@ -525,10 +663,7 @@ const clearData = () => {
next.numValueEnd = undefined
next.numValueStart = undefined
}
- const keyList = Object.entries(next.checkedFieldsMap)
- .filter(ele => next.checkedFields.includes(ele[0]))
- .filter(ele => !!ele[1])
- .map(ele => ele[0])
+ const keyList = getKeyList(next)
pre = [...new Set([...keyList, ...pre])]
return pre
}, [])
@@ -558,6 +693,10 @@ const boxWidth = computed(() => {
return `${customStyle.placeholderSize}px`
})
+const boxHeight = computed(() => {
+ return `${customStyle.queryConditionHeight || 32}px`
+})
+
const queryData = () => {
let requiredName = ''
let numName = ''
@@ -607,10 +746,7 @@ const queryData = () => {
requiredName = next.name
}
}
- const keyList = Object.entries(next.checkedFieldsMap)
- .filter(ele => next.checkedFields.includes(ele[0]))
- .filter(ele => !!ele[1])
- .map(ele => ele[0])
+ const keyList = getKeyList(next)
pre = [...new Set([...keyList, ...pre])]
return pre
}, [])
@@ -657,20 +793,24 @@ const labelStyle = computed(() => {
return style
})
+const comLayout = computed(() => {
+ return customStyle.labelShow ? customStyle.layout : 'horizontal'
+})
+
const paddingTop = computed
(() => {
return {
- paddingTop: customStyle.layout !== 'horizontal' ? customStyle.nameboxSpacing + 22 + 'px' : '0'
+ paddingTop: comLayout.value !== 'horizontal' ? customStyle.nameboxSpacing + 22 + 'px' : '0'
}
})
const marginRight = computed(() => {
return {
- marginRight: customStyle.layout === 'horizontal' ? customStyle.nameboxSpacing + 'px' : '8px'
+ marginRight: comLayout.value === 'horizontal' ? customStyle.nameboxSpacing + 'px' : '8px'
}
})
const autoStyle = computed(() => {
- if (isISOMobile()) {
+ if (isISOMobile() || isFeiShu) {
return {
position: 'absolute',
height: 100 / scale.value + '%!important',
@@ -691,11 +831,7 @@ const autoStyle = computed(() => {
{{ customStyle.title }}
@@ -703,7 +839,7 @@ const autoStyle = computed(() => {
{{ t('v_query.here_or_click') }}
{
+
@@ -2246,7 +2473,7 @@ defineExpose({
{{ t('chart.margin_model_auto') }}
-
+
{{ t('v_query.be_switched_to') }}
@@ -2622,13 +2849,19 @@ defineExpose({
{{ t('v_query.query_condition_configuration') }}
@@ -2636,7 +2869,7 @@ defineExpose({
+
+
+ {{ t('copilot.pls_choose_dataset') }}
+
+
+
+
+
+
+
+
+
+
+
+ {{ node.label }}
+
+
+
+
+
{{ t('v_query.tree_structure_design') }}
@@ -2715,7 +2984,7 @@ defineExpose({
@click="startTreeDesign"
>
-
+
@@ -2731,7 +3000,7 @@ defineExpose({
>
-
-
{{ ele.name }}
+
{{ ele.name }}
+
{{
+ t('common.associated_chart_first')
+ }}
+
+
+ {{ t('common.associated_chart') }}
+
+
-
+
@@ -3158,8 +3435,11 @@ defineExpose({
-
-
+
+
@@ -3169,10 +3449,10 @@ defineExpose({
@@ -3235,7 +3515,7 @@ defineExpose({
min-width: 210px !important;
}
.ed-select-dropdown__header {
- padding: 0 8px;
+ padding: 0 8px !important;
.params-select--header {
--ed-tabs-header-height: 32px;
.ed-tabs__item {
@@ -3287,11 +3567,11 @@ defineExpose({
justify-content: center;
}
- .ed-input .ed-select__prefix--light {
- border-right: none;
- padding: 0;
+ .ed-select__prefix {
font-size: 16px;
- margin-right: 4px;
+ &::after {
+ display: none;
+ }
}
.container {
font-size: 14px;
@@ -3331,6 +3611,17 @@ defineExpose({
color: var(--ed-color-primary);
}
}
+
+ .list-item_box {
+ width: 100%;
+ position: relative;
+ .list-tree_primary {
+ position: absolute;
+ left: 0;
+ padding: 8px 32px;
+ width: 100%;
+ }
+ }
.list-item_primary {
border-radius: 0;
position: relative;
@@ -3533,13 +3824,13 @@ defineExpose({
flex-wrap: wrap;
.search-tree {
width: 100%;
- height: 200px;
+ height: 216px;
margin-top: 8px;
position: relative;
padding: 16px;
box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.12);
- .ed-button {
+ .start-tree_design {
position: absolute;
left: 50%;
top: 50%;
@@ -3563,6 +3854,11 @@ defineExpose({
.field-tree_name {
margin-left: 8px;
+ width: 100px;
+ }
+
+ .field-relationship_chart {
+ margin-left: 8px;
}
}
}
diff --git a/core/core-frontend/src/custom-component/v-query/RangeFilterTime.vue b/core/core-frontend/src/custom-component/v-query/RangeFilterTime.vue
index c73dea8..845c036 100644
--- a/core/core-frontend/src/custom-component/v-query/RangeFilterTime.vue
+++ b/core/core-frontend/src/custom-component/v-query/RangeFilterTime.vue
@@ -1,9 +1,10 @@
@@ -448,6 +483,9 @@ const relativeToCurrentListRange = computed(() => {
--ed-radio-input-height: 16px;
--ed-radio-input-width: 16px;
}
+ .ed-select {
+ --ed-select-width: 100px;
+ }
.title {
font-size: 14px;
font-weight: 500;
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 8043c37..be71a7d 100644
--- a/core/core-frontend/src/custom-component/v-query/Select.vue
+++ b/core/core-frontend/src/custom-component/v-query/Select.vue
@@ -4,6 +4,7 @@ import {
toRefs,
PropType,
onBeforeMount,
+ onMounted,
shallowRef,
watch,
nextTick,
@@ -171,6 +172,7 @@ const getCascadeFieldId = () => {
cascade.value.forEach(ele => {
let condition = null
ele.forEach(item => {
+ // eslint-disable-next-line
const [_, queryId, fieldId] = item.datasetId.split('--')
if (queryId === config.value.id && condition) {
if (item.fieldId) {
@@ -617,6 +619,34 @@ onBeforeMount(() => {
})
})
+const isDataV = ref(false)
+
+const popperClass = computed(() => {
+ let str = 'filter-select-popper_class'
+ if (visible.value) {
+ str = 'load-select ' + str
+ }
+
+ if (isDataV.value) {
+ str = str + ' color-scrollbar__thumb'
+ }
+ return str
+})
+
+onMounted(() => {
+ isDataV.value =
+ Boolean(document.querySelector('#canvas-dv-outer')) ||
+ Boolean(document.querySelector('.datav-preview'))
+})
+
+const tagWidth = computed(() => {
+ return Math.min((getCustomWidth() - 60) / 2, 50) + 'px'
+})
+
+const tagTextWidth = computed(() => {
+ return Math.min((getCustomWidth() - 60) / 2 - 25, 40) + 'px'
+})
+
defineExpose({
displayTypeChange,
mult,
@@ -635,9 +665,7 @@ defineExpose({
filterable
@click="selectHideClick"
@change="handleValueChange"
- :popper-class="
- visible ? 'load-select filter-select-popper_class' : 'filter-select-popper_class'
- "
+ :popper-class="popperClass"
multiple
show-checked
scrollbar-always-on
@@ -661,9 +689,7 @@ defineExpose({
:style="selectStyle"
filterable
radio
- :popper-class="
- visible ? 'load-select filter-select-popper_class' : 'filter-select-popper_class'
- "
+ :popper-class="popperClass"
:options="options"
>
@@ -705,4 +731,23 @@ defineExpose({
color: #1f2329;
}
}
+
+.color-scrollbar__thumb {
+ .ed-scrollbar__thumb {
+ background: #bbbfc4 !important;
+ opacity: 1 !important;
+ }
+}
+
+
+
diff --git a/core/core-frontend/src/custom-component/v-query/TextSearch.vue b/core/core-frontend/src/custom-component/v-query/TextSearch.vue
index 345d8e1..d42ec8c 100644
--- a/core/core-frontend/src/custom-component/v-query/TextSearch.vue
+++ b/core/core-frontend/src/custom-component/v-query/TextSearch.vue
@@ -181,7 +181,8 @@ const handleInnerMouseDown = e => {
.condition-type {
display: flex;
position: relative;
- :deep(.ed-input__wrapper) {
+ :deep(.ed-input__wrapper),
+ :deep(.ed-select__wrapper) {
border: none;
border-radius: 0;
box-shadow: none !important;
diff --git a/core/core-frontend/src/custom-component/v-query/Time.vue b/core/core-frontend/src/custom-component/v-query/Time.vue
index fde6d4e..fb48fb3 100644
--- a/core/core-frontend/src/custom-component/v-query/Time.vue
+++ b/core/core-frontend/src/custom-component/v-query/Time.vue
@@ -7,7 +7,13 @@ 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 {
+ getThisStart,
+ getThisEnd,
+ getLastStart,
+ getAround,
+ getCustomRange
+} from './time-format-dayjs'
import VanPopup from 'vant/es/popup'
import VanDatePicker from 'vant/es/date-picker'
import VanTimePicker from 'vant/es/time-picker'
@@ -139,6 +145,9 @@ watch(
)
const handleValueChange = () => {
+ selectValue.value = Array.isArray(selectValue.value)
+ ? selectValue.value.map(ele => ele && dayjs(ele).format('YYYY/MM/DD HH:mm:ss'))
+ : selectValue.value && dayjs(selectValue.value).format('YYYY/MM/DD HH:mm:ss')
const value = Array.isArray(selectValue.value) ? [...selectValue.value] : selectValue.value
if (!props.isConfig) {
config.value.selectValue = Array.isArray(selectValue.value)
@@ -251,6 +260,7 @@ const disabledDate = val => {
regularOrTrends,
regularOrTrendsValue,
relativeToCurrent,
+ relativeToCurrentRange,
timeNum,
relativeToCurrentType,
around,
@@ -261,6 +271,7 @@ const disabledDate = val => {
aroundRange
} = config.value.timeRange || {}
let isDynamicWindowTime = false
+
if (startWindowTime.value && dynamicWindow) {
isDynamicWindowTime =
dayjs(startWindowTime.value)
@@ -297,6 +308,14 @@ const disabledDate = val => {
case 'lastMonth':
startTime = getLastStart('month')
break
+ case 'thisQuarter':
+ startTime = getThisStart('quarter')
+ break
+ case 'thisWeek':
+ startTime = new Date(
+ dayjs().startOf('week').add(1, 'day').startOf('day').format('YYYY/MM/DD HH:mm:ss')
+ )
+ break
case 'today':
startTime = getThisStart('day')
break
@@ -306,6 +325,9 @@ const disabledDate = val => {
case 'monthBeginning':
startTime = getThisStart('month')
break
+ case 'monthEnd':
+ startTime = getThisEnd('month')
+ break
case 'yearBeginning':
startTime = getThisStart('year')
break
@@ -325,26 +347,31 @@ const disabledDate = val => {
}
if (intervalType === 'timeInterval') {
- const startTime =
- regularOrTrends === 'fixed'
- ? new Date(
- dayjs(new Date(regularOrTrendsValue[0]))
- .startOf(queryTimeType.value)
- .format('YYYY/MM/DD HH:mm:ss')
- )
- : getAround(relativeToCurrentType, around === 'f' ? 'subtract' : 'add', timeNum)
- const endTime =
- regularOrTrends === 'fixed'
- ? new Date(
- dayjs(new Date(regularOrTrendsValue[1]))
- .endOf(queryTimeType.value)
- .format('YYYY/MM/DD HH:mm:ss')
- )
- : getAround(
- relativeToCurrentTypeRange,
- aroundRange === 'f' ? 'subtract' : 'add',
- timeNumRange
- )
+ let endTime
+ if (relativeToCurrentRange === 'custom') {
+ startTime =
+ regularOrTrends === 'fixed'
+ ? new Date(
+ dayjs(new Date(regularOrTrendsValue[0]))
+ .startOf(queryTimeType.value)
+ .format('YYYY/MM/DD HH:mm:ss')
+ )
+ : getAround(relativeToCurrentType, around === 'f' ? 'subtract' : 'add', timeNum)
+ endTime =
+ regularOrTrends === 'fixed'
+ ? new Date(
+ dayjs(new Date(regularOrTrendsValue[1]))
+ .endOf(queryTimeType.value)
+ .format('YYYY/MM/DD HH:mm:ss')
+ )
+ : getAround(
+ relativeToCurrentTypeRange,
+ aroundRange === 'f' ? 'subtract' : 'add',
+ timeNumRange
+ )
+ } else {
+ ;[startTime, endTime] = getCustomRange(relativeToCurrentRange)
+ }
return (
timeStamp < +new Date(startTime) - 1000 ||
timeStamp > +new Date(endTime) ||
@@ -388,21 +415,24 @@ const selectSecond = ref(false)
const setArrValue = () => {
currentDate.value = currentDate.value.slice(0, getIndex() + 1)
+ const timeFormat = [1, 2].includes(currentDate.value.length)
+ ? currentDate.value.concat(Array([0, 2, 1][currentDate.value.length]).fill('01'))
+ : currentDate.value
if (isRange.value) {
const [start, end] = selectValue.value || []
if (selectSecond.value) {
selectValue.value = [
- start ? start : new Date(`${currentDate.value.join('/')} ${currentTime.value.join(':')}`),
- new Date(`${currentDate.value.join('/')} ${currentTime.value.join(':')}`)
+ start ? start : new Date(`${timeFormat.join('/')} ${currentTime.value.join(':')}`),
+ new Date(`${timeFormat.join('/')} ${currentTime.value.join(':')}`)
]
} else {
selectValue.value = [
- new Date(`${currentDate.value.join('/')} ${currentTime.value.join(':')}`),
- end ? end : new Date(`${currentDate.value.join('/')} ${currentTime.value.join(':')}`)
+ new Date(`${timeFormat.join('/')} ${currentTime.value.join(':')}`),
+ end ? end : new Date(`${timeFormat.join('/')} ${currentTime.value.join(':')}`)
]
}
} else {
- selectValue.value = new Date(`${currentDate.value.join('/')} ${currentTime.value.join(':')}`)
+ selectValue.value = new Date(`${timeFormat.join('/')} ${currentTime.value.join(':')}`)
}
}
diff --git a/core/core-frontend/src/custom-component/v-query/Tree.vue b/core/core-frontend/src/custom-component/v-query/Tree.vue
index 1cca661..0b5ff7c 100644
--- a/core/core-frontend/src/custom-component/v-query/Tree.vue
+++ b/core/core-frontend/src/custom-component/v-query/Tree.vue
@@ -66,50 +66,58 @@ const placeholderText = computed(() => {
return ' '
})
const { config } = toRefs(props)
-
+const fromTreeSelectConfirm = ref(false)
const multiple = ref(false)
-
const treeSelectConfirm = val => {
treeValue.value = val
handleValueChange()
}
const handleValueChange = () => {
+ fromTreeSelectConfirm.value = true
const value = Array.isArray(treeValue.value) ? [...treeValue.value] : treeValue.value
if (!props.isConfig) {
config.value.selectValue = Array.isArray(treeValue.value)
? [...treeValue.value]
: treeValue.value
nextTick(() => {
+ fromTreeSelectConfirm.value = false
isConfirmSearch(config.value.id)
})
return
}
config.value.defaultValue = value
+ fromTreeSelectConfirm.value = false
}
+const changeFromId = ref(false)
watch(
- () => config.value.defaultValue,
- val => {
- if (config.value.multiple) {
- treeValue.value = Array.isArray(val) ? [...val] : val
- }
+ () => config.value.id,
+ () => {
+ changeFromId.value = true
+ init()
nextTick(() => {
- multiple.value = config.value.multiple
+ changeFromId.value = false
})
}
)
-
+let oldId
watch(
() => config.value.treeFieldList,
- () => {
+ val => {
+ let idStr = val.map(ele => ele.id).join('-')
+ if (changeFromId.value || idStr === oldId) return
+ oldId = idStr
treeValue.value = config.value.multiple ? [] : undefined
+ config.value.defaultValue = config.value.multiple ? [] : undefined
+ config.value.selectValue = config.value.multiple ? [] : undefined
showOrHide.value = false
getTreeOption()
}
)
const init = () => {
+ loading.value = true
const { defaultValueCheck, multiple: plus, defaultValue } = config.value
if (defaultValueCheck) {
config.value.selectValue = Array.isArray(defaultValue)
@@ -121,17 +129,24 @@ const init = () => {
treeValue.value = plus ? [] : undefined
}
nextTick(() => {
+ oldId = config.value.treeFieldList?.map(ele => ele.id).join('-')
multiple.value = config.value.multiple
})
getTreeOption()
}
-watch(
- () => config.value.id,
- () => {
- init()
- }
-)
+const tagWidth = computed(() => {
+ return Math.min(getCustomWidth() / 3, 50) + 'px'
+})
+
+const tagsWidth = computed(() => {
+ return getCustomWidth() - 40 + 'px'
+})
+
+const tagTextWidth = computed(() => {
+ return Math.min(getCustomWidth() / 3, 50) - 25 + 'px'
+})
+
const showOrHide = ref(true)
const queryConditionWidth = inject('com-width', Function, true)
const isConfirmSearch = inject('is-confirm-search', Function, true)
@@ -148,12 +163,27 @@ onMounted(() => {
})
watch(
- () => config.value.selectValue,
+ () => config.value.defaultValue,
val => {
if (props.isConfig) return
if (config.value.multiple) {
treeValue.value = Array.isArray(val) ? [...val] : val
}
+ nextTick(() => {
+ multiple.value = config.value.multiple
+ })
+ }
+)
+
+watch(
+ () => config.value.selectValue,
+ val => {
+ if (props.isConfig || fromTreeSelectConfirm.value) return
+
+ if (config.value.multiple) {
+ treeValue.value = Array.isArray(val) ? [...val] : val
+ }
+
nextTick(() => {
multiple.value = config.value.multiple
if (!config.value.multiple) {
@@ -164,11 +194,12 @@ watch(
})
}
)
+
const showWholePath = ref(false)
watch(
() => config.value.multiple,
val => {
- if (!props.isConfig) return
+ if (!props.isConfig || changeFromId.value) return
showWholePath.value = false
if (val) {
treeValue.value = []
@@ -227,14 +258,14 @@ watch(
}
}
)
-const fakeValue = ''
+const fakeValue = ref('')
const treeValue = ref()
const getCustomWidth = () => {
if (placeholder?.value?.placeholderShow) {
- if (props.config.queryConditionWidth === undefined) {
- return queryConditionWidth()
+ if (props.config.queryConditionWidth !== undefined) {
+ return props.config.queryConditionWidth
}
- return props.config.queryConditionWidth
+ return queryConditionWidth()
}
return 227
}
@@ -253,12 +284,13 @@ const selectStyle = computed(() => {
:render-after-expand="false"
show-checkbox
showBtn
+ @change="handleValueChange"
:placeholder="placeholderText"
collapse-tags
:filter-node-method="filterMethod"
:showWholePath="showWholePath"
collapse-tags-tooltip
- key="multipleTree"
+ :key="'multipleTree' + getCustomWidth()"
filterable
:style="selectStyle"
multiple
@@ -273,7 +305,7 @@ const selectStyle = computed(() => {
:placeholder="placeholderText"
:render-after-expand="false"
v-else-if="!multiple && !loading"
- key="singleTree"
+ :key="'singleTree' + getCustomWidth()"
:showWholePath="showWholePath"
:style="selectStyle"
filterable
@@ -294,4 +326,15 @@ const selectStyle = computed(() => {
:deep(.ed-select-tags-wrapper) {
display: inline-flex !important;
}
+
+:deep(.ed-select__tags) {
+ max-width: v-bind(tagsWidth) !important;
+ .ed-tag {
+ max-width: v-bind(tagWidth);
+ }
+
+ .ed-select__tags-text {
+ max-width: v-bind(tagTextWidth) !important;
+ }
+}
diff --git a/core/core-frontend/src/custom-component/v-query/TreeFieldDialog.vue b/core/core-frontend/src/custom-component/v-query/TreeFieldDialog.vue
index ff7228a..22aa4a4 100644
--- a/core/core-frontend/src/custom-component/v-query/TreeFieldDialog.vue
+++ b/core/core-frontend/src/custom-component/v-query/TreeFieldDialog.vue
@@ -39,7 +39,7 @@ const cancelClick = () => {
const setCascadeArrBack = () => {
let isError = false
const arr = cloneDeep(treeList.value).map(item => {
- if (!item.field) {
+ if (!item.field?.id) {
isError = true
}
return item.field
@@ -80,7 +80,7 @@ defineExpose({
{{ t('visualization.level') }}{{ indexNumCascade[idx] }}
-
+
-
+
{
com => !['VQuery', 'DeTabs'].includes(com.innerType) && com.component !== 'Group'
)
]
+
+ itx.componentData.forEach(element => {
+ if (element.component === 'Group') {
+ arr = [
+ ...arr,
+ element.propValue.filter(
+ coms =>
+ !['VQuery', 'DeTabs'].includes(coms.innerType) && coms.component !== 'Group'
+ )
+ ]
+ }
+ })
})
} else if (ele.component === 'Group') {
arr = [
diff --git a/core/core-frontend/src/custom-component/v-query/time-format-dayjs.ts b/core/core-frontend/src/custom-component/v-query/time-format-dayjs.ts
index a74df74..754f537 100644
--- a/core/core-frontend/src/custom-component/v-query/time-format-dayjs.ts
+++ b/core/core-frontend/src/custom-component/v-query/time-format-dayjs.ts
@@ -1,10 +1,10 @@
import dayjs from 'dayjs'
import type { ManipulateType } from 'dayjs'
-function getThisStart(val = 'month' as ManipulateType) {
+function getThisStart(val = 'month' as ManipulateType | 'quarter') {
return new Date(dayjs().startOf(val).format('YYYY/MM/DD HH:mm:ss'))
}
-function getThisEnd(val = 'month' as ManipulateType) {
+function getThisEnd(val = 'month' as ManipulateType | 'quarter') {
return new Date(dayjs().endOf(val).format('YYYY/MM/DD HH:mm:ss'))
}
@@ -17,9 +17,19 @@ function getLastEnd(val = 'month' as ManipulateType) {
}
function getAround(val = 'month' as ManipulateType, type = 'add', num = 0) {
+ if (val === 'week') {
+ return new Date(dayjs().endOf('week').add(1, 'day').endOf('day').format('YYYY/MM/DD HH:mm:ss'))
+ }
return new Date(dayjs()[type](num, val).startOf('day').format('YYYY/MM/DD HH:mm:ss'))
}
+function getThisWeek(): [Date, Date] {
+ return [
+ new Date(dayjs().startOf('week').add(1, 'day').startOf('day').format('YYYY/MM/DD HH:mm:ss')),
+ new Date(dayjs().endOf('week').add(1, 'day').endOf('day').format('YYYY/MM/DD HH:mm:ss'))
+ ]
+}
+
function getCustomRange(relativeToCurrentRange: string): [Date, Date] {
switch (relativeToCurrentRange) {
case 'thisYear':
@@ -30,6 +40,10 @@ function getCustomRange(relativeToCurrentRange: string): [Date, Date] {
return [getThisStart('month'), getThisEnd('month')]
case 'lastMonth':
return [getLastStart('month'), getLastEnd('month')]
+ case 'thisQuarter':
+ return [getThisStart('quarter'), getThisEnd('quarter')]
+ case 'thisWeek':
+ return getThisWeek()
case 'LastThreeMonths':
return [
new Date(dayjs().subtract(3, 'month').startOf('month').format('YYYY/MM/DD HH:mm:ss')),
@@ -51,7 +65,7 @@ function getCustomRange(relativeToCurrentRange: string): [Date, Date] {
return [getLastStart('day'), getLastEnd('day')]
case 'LastThreeDays':
return [
- new Date(dayjs().subtract(3, 'day').startOf('day').format('YYYY/MM/DD HH:mm:ss')),
+ new Date(dayjs().subtract(2, 'day').startOf('day').format('YYYY/MM/DD HH:mm:ss')),
getThisEnd('day')
]
case 'monthBeginning':
diff --git a/core/core-frontend/src/custom-component/v-query/time-format.ts b/core/core-frontend/src/custom-component/v-query/time-format.ts
index fbfd433..e709790 100644
--- a/core/core-frontend/src/custom-component/v-query/time-format.ts
+++ b/core/core-frontend/src/custom-component/v-query/time-format.ts
@@ -1,20 +1,19 @@
import type { ManipulateType } from 'dayjs'
import dayjs from 'dayjs'
function getThisYear() {
- return new Date(`${new Date().getFullYear()}/1`)
+ return new Date(dayjs().startOf('year').format('YYYY/MM/DD HH:mm:ss'))
}
function getLastYear() {
- return new Date(`${new Date().getFullYear() - 1}/1`)
+ return new Date(dayjs().subtract(1, 'year').startOf('year').format('YYYY/MM/DD HH:mm:ss'))
}
function getNextYear() {
- return new Date(`${new Date().getFullYear() + 1}/1`)
+ return new Date(dayjs().add(1, 'year').startOf('year').format('YYYY/MM/DD HH:mm:ss'))
}
function getThisMonth() {
- const date = new Date()
- return new Date(`${date.getFullYear()}/${date.getMonth() + 1}`)
+ return new Date(dayjs().startOf('month').format('YYYY/MM/DD HH:mm:ss'))
}
function getLastStart(val = 'month' as ManipulateType) {
@@ -26,23 +25,19 @@ function getLastMonth() {
}
function getNextMonth() {
- const date = getCustomTime(1, 'month', 'month', 'b')
- return new Date(`${date.getFullYear()}/${date.getMonth() + 1}`)
+ return new Date(dayjs().add(1, 'month').startOf('month').format('YYYY/MM/DD HH:mm:ss'))
}
function getToday() {
- const date = new Date()
- return new Date(`${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`)
+ return new Date(dayjs().startOf('day').format('YYYY/MM/DD HH:mm:ss'))
}
function getYesterday() {
- const date = new Date(new Date().getTime() - 24 * 60 * 60 * 1000)
- return new Date(`${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`)
+ return new Date(dayjs().subtract(1, 'day').startOf('day').format('YYYY/MM/DD HH:mm:ss'))
}
function getMonthBeginning() {
- const date = new Date()
- return new Date(`${date.getFullYear()}/${date.getMonth() + 1}/1`)
+ return new Date(dayjs().startOf('month').format('YYYY/MM/DD HH:mm:ss'))
}
function getMonthEnd() {
@@ -50,99 +45,50 @@ function getMonthEnd() {
}
function getYearBeginning() {
- const date = new Date()
- return new Date(`${date.getFullYear()}/1/1`)
+ return new Date(dayjs().startOf('year').format('YYYY/MM/DD HH:mm:ss'))
}
-function getYearMonthRange(result, flag, sort) {
+function getYearMonthRange(result, sort, type) {
const [direction, scene] = (sort || '').split('-')
- const [dateTimeType] = (flag || '').split('range')
if (direction === 'start') {
- return result
+ return new Date(result.startOf(type).format('YYYY/MM/DD HH:mm:ss'))
} else if (direction === 'end') {
if (scene === 'config') {
- return result
+ return new Date(result.format('YYYY/MM/DD HH:mm:ss'))
} else if (scene === 'panel') {
- return new Date(
- +getCustomTime(1, dateTimeType, dateTimeType, 'b', null, flag, 'start-config', result) -
- 1000
- )
+ return new Date(dayjs(result).endOf(type).format('YYYY/MM/DD HH:mm:ss'))
}
}
}
function getCustomTime(
timeNum: number,
- timeType: string,
+ timeType: ManipulateType | 'date',
timeGranularity: string,
around: string,
arbitraryTime?: Date,
timeGranularityMultiple?: string,
- sort?: string,
- withDate?: Date
+ sort?: string
) {
- const date = withDate ? new Date(withDate) : new Date()
- const num = around === 'f' ? -timeNum : timeNum
- const year = date.getFullYear()
- const month = date.getMonth() + 1
- const day = date.getDate()
+ const type = around === 'f' ? 'subtract' : 'add'
- let resultYear = timeType === 'year' ? year + num : year
- let resultMonth = timeType === 'month' ? month + num : month
- if (resultMonth > 12) {
- resultYear += parseInt(`${resultMonth / 12}`)
- resultMonth = resultMonth % 12
- } else if (resultMonth < 0) {
- resultYear += parseInt(`${resultMonth / 12}`) - 1
- resultMonth = (resultMonth % 12) + 12
- } else if (resultMonth === 0) {
- resultYear += parseInt(`${resultMonth / 12}`) - 1
- resultMonth = 12
- }
- const resultDate =
- timeType === 'date' ? new Date(date.getTime() + 24 * 60 * 60 * 1000 * num).getDate() : day
- if (timeType === 'date') {
- resultMonth = new Date(date.getTime() + 24 * 60 * 60 * 1000 * num).getMonth() + 1
- resultYear = new Date(date.getTime() + 24 * 60 * 60 * 1000 * num).getFullYear()
- }
+ const result = dayjs()[type](timeNum, timeType === 'date' ? 'day' : timeType)
- switch (timeGranularityMultiple) {
- case 'monthrange':
- return getYearMonthRange(new Date(`${resultYear}/${resultMonth}/1`), 'monthrange', sort)
- case 'yearrange':
- return getYearMonthRange(new Date(`${resultYear}/1`), 'yearrange', sort)
- case 'daterange':
- return getYearMonthRange(
- new Date(`${resultYear}/${resultMonth}/${resultDate}`),
- 'daterange',
- sort
- )
- default:
- break
+ if (['monthrange', 'yearrange', 'daterange'].includes(timeGranularityMultiple)) {
+ return getYearMonthRange(result, sort, timeGranularityMultiple.split('range')[0])
}
if (!!arbitraryTime) {
- const time = new Date(arbitraryTime)
- time.setFullYear(resultYear)
- time.setMonth(resultMonth - 1)
- time.setDate(resultDate)
- return time
+ const time = dayjs(arbitraryTime).format('YYYY/MM/DD HH:mm:ss')
+ // eslint-disable-next-line
+ const [_, q] = time.split(' ')
+ const [s] = result.format('YYYY/MM/DD HH:mm:ss').split(' ')
+
+ return new Date(`${s} ${q}`)
}
- switch (timeGranularity) {
- case 'year':
- return new Date(`${resultYear}/1`)
- case 'month':
- return new Date(`${resultYear}/${resultMonth}/1`)
- case 'date':
- return new Date(`${resultYear}/${resultMonth}/${resultDate}`)
- case 'monthrange':
- return new Date(`${resultYear}/${resultMonth}/1`)
- case 'yearrange':
- return new Date(`${resultYear}/1`)
- default:
- break
- }
+ const [k] = timeGranularity.split('range')
+ return new Date(result.startOf(k as ManipulateType).format('YYYY/MM/DD HH:mm:ss'))
}
function getDynamicRange({
diff --git a/core/core-frontend/src/custom-component/v-text/Attr.vue b/core/core-frontend/src/custom-component/v-text/Attr.vue
index 6a36820..6c59f47 100644
--- a/core/core-frontend/src/custom-component/v-text/Attr.vue
+++ b/core/core-frontend/src/custom-component/v-text/Attr.vue
@@ -37,9 +37,6 @@ const { themes } = toRefs(props)
font-size: 12px !important;
font-weight: 400 !important;
}
- :deep(.ed-collapse-item__content) {
- padding: 16px !important;
- }
:deep(.ed-form-item) {
display: block;
margin-bottom: 8px;