fix: 修改展示的错误

This commit is contained in:
奔跑的面条 2022-04-06 19:55:31 +08:00
parent 5d585994ca
commit f2d32d8256
3 changed files with 37 additions and 32 deletions

View File

@ -1,10 +1,6 @@
<template>
<n-timeline class="go-chart-configurations-timeline">
<n-timeline-item
v-if="isCharts"
type="info"
:title="TimelineTitleEnum.MAPPING"
>
<n-timeline-item v-if="isCharts" type="info" :title="TimelineTitleEnum.MAPPING">
<n-table striped>
<thead>
<tr>
@ -21,10 +17,7 @@
<n-text></n-text>
</n-space>
<n-space v-else>
<n-badge
dot
:type="item.result === 1 ? 'success' : 'error'"
></n-badge>
<n-badge dot :type="item.result === 1 ? 'success' : 'error'"></n-badge>
<n-text>匹配{{ item.result === 1 ? '成功' : '失败' }}</n-text>
</n-space>
</td>
@ -94,10 +87,10 @@ const source = ref()
const dimensions = ref()
const dimensionsAndSource = ref()
const { uploadFileListRef, customRequest, beforeUpload, download} = useFile(targetData)
const { uploadFileListRef, customRequest, beforeUpload, download } = useFile(targetData)
//
const isCharts = computed(()=> {
const isCharts = computed(() => {
return targetData.value.chartConfig.package === PackagesCategoryEnum.CHARTS
})
@ -111,7 +104,7 @@ const matchingHandle = (mapping: string) => {
let res = DataResultEnum.SUCCESS
for (let i = 0; i < source.value.length; i++) {
if (source.value[i][mapping] === undefined) {
res = DataResultEnum.FAILURE
res = DataResultEnum.FAILURE
return res
}
}
@ -120,40 +113,44 @@ const matchingHandle = (mapping: string) => {
//
const dimensionsAndSourceHandle = () => {
//
return dimensions.value.map((dimensionsItem: string, index: number) => {
return index === 0 ?
{
//
field: '通用标识',
//
mapping: dimensionsItem,
//
result: DataResultEnum.NULL
} : {
field: `数据项-${index}`,
mapping: dimensionsItem,
result: matchingHandle(dimensionsItem)
}
})
try {
//
return dimensions.value.map((dimensionsItem: string, index: number) => {
return index === 0 ?
{
//
field: '通用标识',
//
mapping: dimensionsItem,
//
result: DataResultEnum.NULL
} : {
field: `数据项-${index}`,
mapping: dimensionsItem,
result: matchingHandle(dimensionsItem)
}
})
} catch (error) {
return []
}
}
watch(() => targetData.value?.option?.dataset, (newData) => {
if (newData) {
// Echarts
source.value = isCharts.value ? newData.source : newData
if(isCharts.value) {
if (isCharts.value) {
dimensions.value = newData.dimensions
dimensionsAndSource.value = dimensionsAndSourceHandle()
}
}
},{
}, {
immediate: true
})
</script>
<style lang="scss" scoped>
@include go('chart-configurations-timeline') {
@include go("chart-configurations-timeline") {
@include deep() {
pre {
white-space: pre-wrap;

View File

@ -53,7 +53,7 @@
type="segment"
>
<n-tab-pane
v-for="(item, index) in canvasTabList"
v-for="(item) in canvasTabList"
:key="item.key"
:name="item.key"
size="small"

View File

@ -12,6 +12,9 @@
</n-icon>
</template>
<!-- 图层内容 -->
<n-space v-if="reverseList.length === 0" justify="center">
<n-text class="not-layer-text">暂无图层~</n-text>
</n-space>
<!-- https://github.com/SortableJS/vue.draggable.next -->
<draggable
item-key="id"
@ -108,6 +111,11 @@ $wight: 170px;
flex-shrink: 0;
overflow: hidden;
@extend .go-transition;
.not-layer-text {
position: relative;
top: 10px;
opacity: .4;
}
&.scoped {
width: 0;
}