fix(数据集): 编辑数据集-关联表-未关联计算字段-确认时提示弹窗-未正确显示计算字段

This commit is contained in:
dataeaseShu 2024-09-04 14:37:21 +08:00
parent 71a450d44f
commit 2f9bccf65f
10 changed files with 46 additions and 29 deletions

View File

@ -31,7 +31,7 @@ interface AppearanceState {
showDemoTips?: boolean
demoTipsContent?: string
community: boolean
fontList: Array<{ name: string; id: string }>
fontList: Array<{ name: string; id: string; isDefault: boolean }>
}
const { wsCache } = useCache()
export const useAppearanceStore = defineStore('appearanceStore', {

View File

@ -23,7 +23,7 @@ import {
} from '@/custom-component/component-list'
import { get, set } from 'lodash-es'
import { viewFieldTimeTrans } from '@/utils/viewUtils'
import { isMainCanvas } from '@/utils/canvasUtils'
import { useAppearanceStoreWithOut } from '@/store/modules/appearance'
export const dvMainStore = defineStore('dataVisualization', {
state: () => {
@ -410,6 +410,7 @@ export const dvMainStore = defineStore('dataVisualization', {
componentData.push(component)
this.setCurComponent({ component: component, index: componentData.length - 1 })
}
const currentFont = useAppearanceStoreWithOut().fontList.find(ele => ele.isDefault)
//如果当前的组件是UserView 图表则想canvasView中增加一项 UserView ID 和componentID保持一致
if (component.component === 'UserView') {
const defaultConfig = JSON.parse(JSON.stringify(BASE_VIEW_CONFIG))
@ -436,6 +437,7 @@ export const dvMainStore = defineStore('dataVisualization', {
newView = chartViewInstance.setupDefaultOptions(newView)
newView['title'] = component.name
}
currentFont && (newView.customStyle.text.fontFamily = currentFont.name)
this.canvasViewInfo[component.id] = newView
}
if (component.component === 'VQuery') {

View File

@ -147,11 +147,17 @@ const setupSeriesColor = () => {
}
}
const flag = ref(1)
const switchSeriesColor = (seriesColor, index) => {
seriesColorPickerRef.value?.hide()
seriesColorState.curSeriesColor = cloneDeep(seriesColor)
seriesColorState.curColorIndex = index
seriesColorState.seriesColorPickerId = '#series-color-picker-' + seriesColor.id
const id = '#series-color-picker-' + seriesColor.id + `-${flag.value}`
if (document.querySelectorAll(id).length > 1) {
flag.value = 2
}
seriesColorState.seriesColorPickerId = '#series-color-picker-' + seriesColor.id + `-${flag.value}`
nextTick(() => {
seriesColorPickerRef.value?.show()
})
@ -462,7 +468,7 @@ const colorItemBorderColor = (index, state) => {
class="color-list-item"
>
<div
:id="`series-color-picker-${item.id}`"
:id="`series-color-picker-${item.id}-${flag}`"
:class="{
active: item.id === seriesColorState.curSeriesColor?.id
}"

View File

@ -434,7 +434,7 @@ export const DEFAULT_TITLE_STYLE: ChartTextStyle = {
remarkShow: false,
remark: '',
remarkBackgroundColor: '#ffffff',
fontFamily: 'Microsoft YaHei',
fontFamily: '',
letterSpace: '0',
fontShadow: false
}
@ -483,7 +483,7 @@ export const DEFAULT_TITLE_STYLE_BASE: ChartTextStyle = {
isBolder: true,
remarkShow: false,
remark: '',
fontFamily: 'Microsoft YaHei',
fontFamily: '',
letterSpace: '0',
fontShadow: false,
color: '',

View File

@ -277,10 +277,13 @@ const initTitle = () => {
CHART_FONT_FAMILY_MAP[ele.name] = ele.name
})
}
state.title_class.fontFamily = customStyle.text.fontFamily
? CHART_FONT_FAMILY_MAP[customStyle.text.fontFamily]
: DEFAULT_TITLE_STYLE.fontFamily
if (!CHART_FONT_FAMILY_MAP[customStyle.text.fontFamily]) {
state.title_class.fontFamily = appearanceStore.fontList.find(ele => ele.isDefault)?.name
customStyle.text.fontFamily = state.title_class.fontFamily
}
appearanceStore.setCurrentFont(state.title_class.fontFamily)
state.title_class.letterSpacing =
(customStyle.text.letterSpace

View File

@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed, nextTick, onMounted, onUnmounted, reactive, ref } from 'vue'
import { computed, nextTick, onMounted, onUnmounted, reactive, ref, watch } from 'vue'
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
import { storeToRefs } from 'pinia'
import findComponent from '../../utils/components'

View File

@ -95,6 +95,7 @@ const uploadFail = response => {
const emits = defineEmits(['finish'])
const cancel = () => {
Object.assign(ruleForm, cloneDeep(defaultForm))
ruleFormRef.value.clearValidate()
state.fileList = null
dialogVisible.value = false
}

View File

@ -1,8 +1,13 @@
<script lang="ts" setup>
import { onMounted, ref, computed } from 'vue'
import UploadDetail from './UploadDetail.vue'
import { deleteById, edit, list, defaultFont } from '@/api/font'
import { useAppearanceStoreWithOut } from '@/store/modules/appearance'
import { deleteById, edit, defaultFont } from '@/api/font'
import { ElMessage, ElMessageBox } from 'element-plus-secondary'
import { cloneDeep } from 'lodash-es'
const appearanceStore = useAppearanceStoreWithOut()
const fontKeyword = ref('')
const fontList = ref([])
const basePath = import.meta.env.VITE_API_BASEPATH
@ -13,15 +18,11 @@ const uploadFont = (title, type, item) => {
uploadDetail.value.init(title, type, item)
}
const listFont = () => {
const listFont = async () => {
loading.value = true
list({})
.then(res => {
fontList.value = res
})
.finally(() => {
loading.value = false
})
await appearanceStore.setFontList()
fontList.value = cloneDeep(appearanceStore.fontList)
loading.value = false
}
const fontListComputed = computed(() => {
@ -96,16 +97,12 @@ const getDefaultFont = () => {
)
})
}
const uploadFilish = () => {
const uploadFilish = async () => {
loading.value = true
list({})
.then(res => {
fontList.value = res
getDefaultFont()
})
.finally(() => {
loading.value = false
})
await appearanceStore.setFontList()
fontList.value = cloneDeep(appearanceStore.fontList)
loading.value = false
getDefaultFont()
}
onMounted(() => {

View File

@ -352,7 +352,10 @@ const confirmEditUnion = () => {
if (!!ids.length) {
const idArr = allfields.value.reduce((pre, next) => {
if (next.extField === 2) {
const idMap = next.originName.match(/\[(.+?)\]/g)
let idMap = next.originName.match(/\[(.+?)\]/g)
idMap = idMap.filter(
itx => !next.params?.map(element => element.id).includes(itx.slice(1, -1))
)
const result = idMap.map(itm => {
return itm.slice(1, -1)
})

View File

@ -459,7 +459,11 @@ const delFieldByIdFake = (arr, fakeAllfields) => {
fakeAllfields = fakeAllfields.filter(ele => {
if (ele.extField !== 2) return true
const idMap = ele.originName.match(/\[(.+?)\]/g)
if (!idMap) return true
if (
!idMap ||
idMap.every(itx => ele.params?.map(element => element.id).includes(itx.slice(1, -1)))
)
return true
const result = idMap.every(itm => {
const id = itm.slice(1, -1)
return allfieldsId.includes(id)
@ -478,7 +482,8 @@ const deleteField = item => {
let tip = ''
const idArr = allfields.value.reduce((pre, next) => {
if (next.extField !== 2) return pre
const idMap = next.originName.match(/\[(.+?)\]/g) || []
let idMap = next.originName.match(/\[(.+?)\]/g) || []
idMap = idMap.filter(itx => !next.params?.map(element => element.id).includes(itx.slice(1, -1)))
const result = idMap.map(itm => {
return itm.slice(1, -1)
})