fix: 修改数据内容二次过滤的问题
This commit is contained in:
parent
942ff14d82
commit
7218fe57fc
@ -72,7 +72,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</n-space>
|
</n-space>
|
||||||
<n-card size="small">
|
<n-card size="small">
|
||||||
<n-code :code="filterRes(source)" language="json"></n-code>
|
<n-code :code="toString(source)" language="json"></n-code>
|
||||||
</n-card>
|
</n-card>
|
||||||
</n-space>
|
</n-space>
|
||||||
</n-timeline-item>
|
</n-timeline-item>
|
||||||
@ -81,7 +81,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed, watch } from 'vue'
|
import { ref, computed, watch } from 'vue'
|
||||||
import { CreateComponentType, PackagesCategoryEnum } from '@/packages/index.d'
|
import { PackagesCategoryEnum } from '@/packages/index.d'
|
||||||
import { RequestDataTypeEnum } from '@/enums/httpEnum'
|
import { RequestDataTypeEnum } from '@/enums/httpEnum'
|
||||||
import { icon } from '@/plugins'
|
import { icon } from '@/plugins'
|
||||||
import { DataResultEnum, TimelineTitleEnum } from '../../index.d'
|
import { DataResultEnum, TimelineTitleEnum } from '../../index.d'
|
||||||
@ -89,7 +89,6 @@ import { ChartDataMonacoEditor } from '../ChartDataMonacoEditor'
|
|||||||
import { useFile } from '../../hooks/useFile.hooks'
|
import { useFile } from '../../hooks/useFile.hooks'
|
||||||
import { useTargetData } from '../../../hooks/useTargetData.hook'
|
import { useTargetData } from '../../../hooks/useTargetData.hook'
|
||||||
import isObject from 'lodash/isObject'
|
import isObject from 'lodash/isObject'
|
||||||
import cloneDeep from 'lodash/cloneDeep'
|
|
||||||
import { toString } from '@/utils'
|
import { toString } from '@/utils'
|
||||||
|
|
||||||
const { targetData } = useTargetData()
|
const { targetData } = useTargetData()
|
||||||
@ -163,20 +162,6 @@ const dimensionsAndSourceHandle = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 过滤结果
|
|
||||||
const filterRes = (data: any) => {
|
|
||||||
try {
|
|
||||||
if (targetData.value.filter) {
|
|
||||||
const fn = new Function('data', targetData.value.filter)
|
|
||||||
const res = fn(cloneDeep(data))
|
|
||||||
return toString(res)
|
|
||||||
}
|
|
||||||
return toString(cloneDeep(data))
|
|
||||||
} catch (error) {
|
|
||||||
return '过滤函数错误'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => targetData.value?.option?.dataset,
|
() => targetData.value?.option?.dataset,
|
||||||
(
|
(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user