update src/packages/components/Charts/Mores/Process/index.vue.

修复进度条一直是默认值的问题

Signed-off-by: Admin <12544914+hangzhou-zhide-software_0@user.noreply.gitee.com>
This commit is contained in:
Admin 2023-06-02 06:20:41 +00:00 committed by Gitee
parent 67e2e52ff5
commit 9c12d17f7a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -8,6 +8,8 @@
:color="color"
:rail-color="railColor"
:offset-degree="offsetDegree"
:show-indicator="showindicator"
:border-radius="borderradius"
>
<n-text
:style="{
@ -25,7 +27,7 @@ import { PropType, toRefs, watch, shallowReactive } from 'vue'
import { useChartDataFetch } from '@/hooks'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import config, { option as configOption } from './config'
import { toNumber } from '@/utils'
import { isPreview, isString, isNumber, colorGradientCustomMerge } from '@/utils'
const props = defineProps({
chartConfig: {
@ -33,7 +35,12 @@ const props = defineProps({
required: true
}
})
//
const dataHandle = (newData: number | string) => {
newData = isString(newData) ? parseFloat(newData) : newData
return parseFloat(newData.toFixed(2))
}
//
const { w, h } = toRefs(props.chartConfig.attr)
const {
@ -46,19 +53,21 @@ const {
indicatorPlacement,
indicatorTextSize,
offsetDegree,
dataset
dataset,
showindicator,
borderradius
} = toRefs(props.chartConfig.option)
const option = shallowReactive({
dataset: configOption.dataset
dataset: props.chartConfig.option.dataset
})
//
watch(
() => props.chartConfig.option.dataset,
(newData: any) => {
try {
option.dataset = toNumber(newData, 2)
option.dataset = dataHandle(newData)
} catch (error) {
console.log(error)
}
@ -69,6 +78,7 @@ watch(
)
//
useChartDataFetch(props.chartConfig, useChartEditStore, (newData: number) => {
option.dataset = toNumber(newData, 2)
option.dataset =dataHandle(newData)
})
</script>