This commit is contained in:
wangzhiqiang 2022-06-13 09:07:13 +08:00
commit 99287497cc
8 changed files with 151 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -0,0 +1,20 @@
import { publicConfig } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d'
import { ProcessConfig } from './index'
import { chartInitConfig } from '@/settings/designSetting'
import cloneDeep from 'lodash/cloneDeep'
export const option = {
dataset: 36,
type: "circle",
color: '#4992FFFF',
// 指标位置(线条时可用)
indicatorPlacement: "outside"
}
export default class Config extends publicConfig implements CreateComponentType {
public key = ProcessConfig.key
public attr = {...chartInitConfig, h: 500, zIndex: -1}
public chartConfig = cloneDeep(ProcessConfig)
public option = cloneDeep(option)
}

View File

@ -0,0 +1,75 @@
<template>
<!-- 默认展开 -->
<CollapseItem
name="进度条" :expanded="true">
<SettingItemBox name="内容">
<SettingItem name="数值">
<!-- config.ts 里的 option 对应 --><!-- n-input-number NaiveUI 的控件 -->
<n-input-number v-model:value="optionData.dataset" size="small" :min="0" placeholder="进度值"></n-input-number>
</SettingItem>
<!-- 颜色粗细等等... -->
</SettingItemBox>
<SettingItemBox name="外观">
<SettingItem name="形状">
<n-select v-model:value="optionData.type" :options="types" placeholder="选择形状" />
</SettingItem>
<SettingItem name="指标位置" v-if="optionData.type == types[0].value">
<n-select v-model:value="optionData.indicatorPlacement" :options="indicatorPlacements" placeholder="选择形状" />
</SettingItem>
<!-- 颜色粗细等等... -->
<SettingItem name="进度条颜色">
<n-color-picker
size="small"
:modes="['hex']"
v-model:value="optionData.color"
></n-color-picker>
</SettingItem>
</SettingItemBox>
</CollapseItem>
</template>
<script setup lang="ts">
import { PropType } from 'vue'
//
import {
CollapseItem,
SettingItemBox,
SettingItem,
} from '@/components/Pages/ChartItemSetting'
// option 便使 typeof
import { option } from './config'
const props = defineProps({
optionData: {
type: Object as PropType<typeof option>,
required: true
}
})
const types = [
{
label: '线形',
value: 'line'
},
{
label: '圆形',
value: 'circle'
},
{
label: '仪表盘',
value: 'dashboard'
},
]
const indicatorPlacements = [
{
label: '里面',
value: 'inside'
},
{
label: '外边',
value: 'outside'
}
]
</script>

View File

@ -0,0 +1,25 @@
// 展示图片
import image from '@/assets/images/chart/charts/process.png'
// 公共类型声明
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d'
// 当前[信息模块]分类声明
import { ChatCategoryEnum,ChatCategoryEnumName } from '../../index.d'
export const ProcessConfig: ConfigType = {
// 唯一key
key: 'Process',
// 图表组件渲染 Components 格式: V + key
chartKey: 'VProcess',
// 配置组件渲染 Components 格式: VC + key
conKey: 'VCProcess',
// 名称
title: '多类进度条',
// 子分类目录
category: ChatCategoryEnum.MORE,
// 子分类目录
categoryName: ChatCategoryEnumName.MORE,
// 包分类
package: PackagesCategoryEnum.CHARTS,
// 图片
image: image
}

View File

@ -0,0 +1,27 @@
<template>
<n-progress
:type="type"
:percentage="dataset"
:indicator-placement="indicatorPlacement"
:color="color"
/>
</template>
<script setup lang="ts">
import { PropType, toRefs, watch } from 'vue'
import { useChartDataFetch } from '@/hooks'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import config from './config'
const props = defineProps({
chartConfig: {
type: Object as PropType<config>,
required: true,
},
})
//
const { type, color, indicatorPlacement, dataset } = toRefs(props.chartConfig.option)
useChartDataFetch(props.chartConfig, useChartEditStore)
</script>

View File

@ -1,3 +1,4 @@
import { ProcessConfig } from './Process/index'
import { RadarConfig } from './Radar/index'
import { FunnelConfig } from './Funnel/index'
import { HeatmapConfig } from './Heatmap/index'
@ -5,4 +6,4 @@ import { PointConfig } from './Point/index'
import { WaterPoloConfig } from './WaterPolo/index'
import { TreeMapConfig } from './TreeMap/index'
export default [RadarConfig, FunnelConfig, HeatmapConfig,PointConfig, WaterPoloConfig, TreeMapConfig]
export default [ProcessConfig, RadarConfig, FunnelConfig, HeatmapConfig, PointConfig, WaterPoloConfig, TreeMapConfig]

View File

@ -4,4 +4,4 @@ import Lines from './Lines'
import Mores from './Mores'
import Maps from './Maps'
export const ChartList = [...Bars, ...Pies, ...Lines, ...Maps , ...Mores]
export const ChartList = [...Bars, ...Pies, ...Lines, ...Maps, ...Mores]

View File

@ -152,6 +152,7 @@ $min-width: 500px;
}
}
.scale-btn {
width: 90px;
font-size: 12px;
@include deep() {
.n-base-selection-label {