fix: 修改数据内容二次过滤的问题

This commit is contained in:
奔跑的面条 2022-07-20 20:55:45 +08:00
parent f6d605da62
commit 3b12503e77

View File

@ -72,7 +72,7 @@
</div>
</n-space>
<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-space>
</n-timeline-item>
@ -81,7 +81,7 @@
<script setup lang="ts">
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 { icon } from '@/plugins'
import { DataResultEnum, TimelineTitleEnum } from '../../index.d'
@ -89,7 +89,6 @@ import { ChartDataMonacoEditor } from '../ChartDataMonacoEditor'
import { useFile } from '../../hooks/useFile.hooks'
import { useTargetData } from '../../../hooks/useTargetData.hook'
import isObject from 'lodash/isObject'
import cloneDeep from 'lodash/cloneDeep'
import { toString } from '@/utils'
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(
() => targetData.value?.option?.dataset,
(