fix: 【查询组件】-查询条件设置默认值为固定时间,保存后默认值被置空

This commit is contained in:
dataeaseShu 2023-12-04 11:00:48 +08:00
parent defc522ed9
commit b7455ede80
2 changed files with 11 additions and 7 deletions

View File

@ -2,6 +2,7 @@
import { ref, reactive, nextTick, computed, shallowRef, toRefs, watch } from 'vue' import { ref, reactive, nextTick, computed, shallowRef, toRefs, watch } from 'vue'
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain' import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { fieldType } from '@/utils/attr' import { fieldType } from '@/utils/attr'
import { ElMessage } from 'element-plus-secondary' import { ElMessage } from 'element-plus-secondary'
@ -55,6 +56,7 @@ const activeConditionForRename = reactive({
visible: false visible: false
}) })
const datasetMap = {} const datasetMap = {}
const snapshotStore = snapshotStoreWithOut()
const dfsComponentData = () => { const dfsComponentData = () => {
const isMain = componentData.value.some(ele => ele.id === queryElement.value.id) const isMain = componentData.value.some(ele => ele.id === queryElement.value.id)
@ -308,6 +310,7 @@ const confirmClick = () => {
) )
}) })
queryElement.value.propValue = cloneDeep(conditions.value) queryElement.value.propValue = cloneDeep(conditions.value)
snapshotStore.recordSnapshotCache()
} }
const cancelValueSource = () => { const cancelValueSource = () => {

View File

@ -1,4 +1,4 @@
import { deepCopy } from '@/utils/utils' import { cloneDeep } from 'lodash-es'
import componentList, { import componentList, {
COMMON_COMPONENT_BACKGROUND_DARK, COMMON_COMPONENT_BACKGROUND_DARK,
COMMON_COMPONENT_BACKGROUND_LIGHT COMMON_COMPONENT_BACKGROUND_LIGHT
@ -17,12 +17,12 @@ const { curBatchOptComponents, dvInfo, canvasStyleData, componentData, canvasVie
const snapshotStore = snapshotStoreWithOut() const snapshotStore = snapshotStoreWithOut()
export function chartTransStr2Object(targetIn, copy) { export function chartTransStr2Object(targetIn, copy) {
const target = copy === 'Y' ? deepCopy(targetIn) : targetIn const target = copy === 'Y' ? cloneDeep(targetIn) : targetIn
return target return target
} }
export function chartTransObject2Str(targetIn, copy) { export function chartTransObject2Str(targetIn, copy) {
const target = copy === 'Y' ? deepCopy(targetIn) : targetIn const target = copy === 'Y' ? cloneDeep(targetIn) : targetIn
return target return target
} }
@ -37,7 +37,7 @@ export function findNewComponent(componentName, innerType) {
let newComponent let newComponent
componentList.forEach(comp => { componentList.forEach(comp => {
if (comp.component === componentName) { if (comp.component === componentName) {
newComponent = deepCopy(comp) newComponent = cloneDeep(comp)
newComponent.innerType = innerType newComponent.innerType = innerType
if (newComponent.innerType === 'richText') { if (newComponent.innerType === 'richText') {
newComponent.propValue = { newComponent.propValue = {
@ -45,9 +45,9 @@ export function findNewComponent(componentName, innerType) {
} }
} }
if (dvMainStore.curOriginThemes === 'light') { if (dvMainStore.curOriginThemes === 'light') {
newComponent['commonBackground'] = deepCopy(COMMON_COMPONENT_BACKGROUND_LIGHT) newComponent['commonBackground'] = cloneDeep(COMMON_COMPONENT_BACKGROUND_LIGHT)
} else { } else {
newComponent['commonBackground'] = deepCopy(COMMON_COMPONENT_BACKGROUND_DARK) newComponent['commonBackground'] = cloneDeep(COMMON_COMPONENT_BACKGROUND_DARK)
} }
} }
}) })
@ -130,7 +130,7 @@ export function checkIsBatchOptView(viewId) {
} }
export function canvasSave(callBack) { export function canvasSave(callBack) {
const componentDataToSave = deepCopy(componentData.value) const componentDataToSave = cloneDeep(componentData.value)
componentDataToSave.forEach(item => { componentDataToSave.forEach(item => {
if (item.component === 'UserView') { if (item.component === 'UserView') {
item.linkageFilters = [] item.linkageFilters = []
@ -152,6 +152,7 @@ export function canvasSave(callBack) {
canvasViewInfo: canvasViewInfo.value, canvasViewInfo: canvasViewInfo.value,
...dvInfo.value ...dvInfo.value
} }
const method = dvInfo.value.id ? updateCanvas : saveCanvas const method = dvInfo.value.id ? updateCanvas : saveCanvas
method(canvasInfo).then(res => { method(canvasInfo).then(res => {
if (res && res.data) { if (res && res.data) {