fix: 组态优化 支持快速输入 默认置底 增加底座
BIN
src/assets/images/chart/decorates/Base1.png
Normal file
After Width: | Height: | Size: 77 KiB |
BIN
src/assets/images/chart/decorates/Base2.png
Normal file
After Width: | Height: | Size: 60 KiB |
BIN
src/assets/images/chart/decorates/Base3.png
Normal file
After Width: | Height: | Size: 155 KiB |
BIN
src/assets/images/chart/decorates/Base4.png
Normal file
After Width: | Height: | Size: 64 KiB |
BIN
src/assets/images/chart/decorates/Base5.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
src/assets/images/chart/decorates/Base6.png
Normal file
After Width: | Height: | Size: 53 KiB |
BIN
src/assets/images/chart/decorates/Base7.png
Normal file
After Width: | Height: | Size: 44 KiB |
BIN
src/assets/images/chart/decorates/Base8.png
Normal file
After Width: | Height: | Size: 65 KiB |
@ -10,7 +10,7 @@ import { GraphConfig } from './Graph/index'
|
|||||||
|
|
||||||
export default [
|
export default [
|
||||||
// ProcessConfig,
|
// ProcessConfig,
|
||||||
RadarConfig,
|
// RadarConfig,
|
||||||
// FunnelConfig,
|
// FunnelConfig,
|
||||||
// HeatmapConfig,
|
// HeatmapConfig,
|
||||||
WaterPoloConfig,
|
WaterPoloConfig,
|
||||||
|
@ -14,7 +14,7 @@ export const option = {
|
|||||||
top: 0,
|
top: 0,
|
||||||
scale: 1,
|
scale: 1,
|
||||||
// 展示标题
|
// 展示标题
|
||||||
isThereATitleComponet: true,
|
isThereATitleComponet: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Config extends PublicConfigClass implements CreateComponentType
|
export default class Config extends PublicConfigClass implements CreateComponentType
|
||||||
|
@ -1,5 +1,21 @@
|
|||||||
<template>
|
<template>
|
||||||
<CollapseItem name="组态" :expanded="true">
|
<CollapseItem name="组态" :expanded="true">
|
||||||
|
<SettingItemBox name="标题">
|
||||||
|
<SettingItem name="如果有标题将展示">
|
||||||
|
<n-space justify="start">
|
||||||
|
<n-switch v-model:value="optionData.isThereATitleComponet" size="small" />
|
||||||
|
</n-space>
|
||||||
|
</SettingItem>
|
||||||
|
</SettingItemBox>
|
||||||
|
<SettingItemBox name="快捷输入" :alone="true">
|
||||||
|
<SettingItem name="输入0,0,1相当于距离顶部0,距离左侧0,缩放为1">
|
||||||
|
<n-input
|
||||||
|
v-model:value="allValue"
|
||||||
|
size="small"
|
||||||
|
placeholder="请输入"
|
||||||
|
></n-input>
|
||||||
|
</SettingItem>
|
||||||
|
</SettingItemBox>
|
||||||
<SettingItemBox name="位置">
|
<SettingItemBox name="位置">
|
||||||
<SettingItem name="距离顶部">
|
<SettingItem name="距离顶部">
|
||||||
<n-input-number
|
<n-input-number
|
||||||
@ -18,21 +34,20 @@
|
|||||||
<SettingItem name="缩放">
|
<SettingItem name="缩放">
|
||||||
<n-input-number
|
<n-input-number
|
||||||
v-model:value="optionData.scale"
|
v-model:value="optionData.scale"
|
||||||
|
step="0.1"
|
||||||
size="small"
|
size="small"
|
||||||
placeholder="请输入"
|
placeholder="请输入"
|
||||||
></n-input-number>
|
></n-input-number>
|
||||||
</SettingItem>
|
</SettingItem>
|
||||||
</SettingItemBox>
|
</SettingItemBox>
|
||||||
<SettingItemBox name="标题">
|
<SettingItemBox name="提示" :alone="true">
|
||||||
<SettingItem name="如果有将展示">
|
<n-text>在预览页使用alt+滚轮进行缩放</n-text>
|
||||||
<n-switch v-model:value="optionData.isThereATitleComponet" size="small" />
|
|
||||||
</SettingItem>
|
|
||||||
</SettingItemBox>
|
</SettingItemBox>
|
||||||
</CollapseItem>
|
</CollapseItem>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { PropType } from 'vue'
|
import { PropType, ref, watch } from 'vue'
|
||||||
import {
|
import {
|
||||||
CollapseItem,
|
CollapseItem,
|
||||||
SettingItemBox,
|
SettingItemBox,
|
||||||
@ -46,6 +61,18 @@ const props = defineProps({
|
|||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const allValue = ref('')
|
||||||
|
|
||||||
|
watch(() => allValue.value, v => {
|
||||||
|
v.split(',').forEach((item, i) => {
|
||||||
|
if(!isNaN(Number(item)) && item !== '') {
|
||||||
|
if(i === 0) props.optionData.top = Number(item)
|
||||||
|
else if(i === 1) props.optionData.left = Number(item)
|
||||||
|
else if(i === 2) props.optionData.scale = Number(item)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
28
src/packages/components/Decorates/Base/Base/config.ts
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import { PublicConfigClass } from '@/packages/public'
|
||||||
|
import { CreateComponentType } from '@/packages/index.d'
|
||||||
|
import { BaseConfig } from './index'
|
||||||
|
import cloneDeep from 'lodash/cloneDeep'
|
||||||
|
|
||||||
|
export const option = {
|
||||||
|
// 图片
|
||||||
|
dataset: '',
|
||||||
|
// 适应方式
|
||||||
|
fit: 'fill',
|
||||||
|
// 圆角
|
||||||
|
// borderRadius: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class Config extends PublicConfigClass implements CreateComponentType
|
||||||
|
{
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
this.attr = {
|
||||||
|
...this.attr,
|
||||||
|
w: 500,
|
||||||
|
h: 500,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public key = BaseConfig.key
|
||||||
|
public chartConfig = cloneDeep(BaseConfig)
|
||||||
|
public option = cloneDeep(option)
|
||||||
|
}
|
62
src/packages/components/Decorates/Base/Base/config.vue
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
<template>
|
||||||
|
<collapse-item name="属性" :expanded="true">
|
||||||
|
<setting-item-box name="样式">
|
||||||
|
<setting-item name="类型">
|
||||||
|
<n-select
|
||||||
|
v-model:value="optionData.fit"
|
||||||
|
size="small"
|
||||||
|
:options="fitList"
|
||||||
|
></n-select>
|
||||||
|
</setting-item>
|
||||||
|
<!-- <setting-item name="圆角">-->
|
||||||
|
<!-- <n-input-number-->
|
||||||
|
<!-- v-model:value="optionData.borderRadius"-->
|
||||||
|
<!-- size="small"-->
|
||||||
|
<!-- :min="0"-->
|
||||||
|
<!-- placeholder="圆角"-->
|
||||||
|
<!-- ></n-input-number>-->
|
||||||
|
<!-- </setting-item>-->
|
||||||
|
</setting-item-box>
|
||||||
|
</collapse-item>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { PropType } from 'vue'
|
||||||
|
import { option } from './config'
|
||||||
|
import {
|
||||||
|
CollapseItem,
|
||||||
|
SettingItemBox,
|
||||||
|
SettingItem,
|
||||||
|
} from '@/components/Pages/ChartItemSetting'
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
optionData: {
|
||||||
|
type: Object as PropType<typeof option>,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// 适应类型
|
||||||
|
const fitList = [
|
||||||
|
{
|
||||||
|
value: 'fill',
|
||||||
|
label: 'fill'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'contain',
|
||||||
|
label: 'contain'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'cover',
|
||||||
|
label: 'cover'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'scale-down',
|
||||||
|
label: 'scale-down'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'none',
|
||||||
|
label: 'none'
|
||||||
|
},
|
||||||
|
]
|
||||||
|
</script>
|
14
src/packages/components/Decorates/Base/Base/index.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
||||||
|
import { ChatCategoryEnum,ChatCategoryEnumName } from '@/packages/components/Decorates/index.d'
|
||||||
|
|
||||||
|
export const BaseConfig: ConfigType = {
|
||||||
|
key: 'Base',
|
||||||
|
chartKey: 'VBase',
|
||||||
|
conKey: 'VCBase',
|
||||||
|
title: '底座',
|
||||||
|
category: ChatCategoryEnum.BASE,
|
||||||
|
categoryName: ChatCategoryEnumName.BASE,
|
||||||
|
package: PackagesCategoryEnum.DECORATES,
|
||||||
|
chartFrame: ChartFrameEnum.STATIC,
|
||||||
|
image: ''
|
||||||
|
}
|
48
src/packages/components/Decorates/Base/Base/index.vue
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<template>
|
||||||
|
<div :style="getStyle(borderRadius)">
|
||||||
|
<n-image
|
||||||
|
:object-fit="fit"
|
||||||
|
preview-disabled
|
||||||
|
:src="imageInfo"
|
||||||
|
:fallback-src="requireErrorImg()"
|
||||||
|
:width="w"
|
||||||
|
lazy
|
||||||
|
style="position: absolute;left: 0;width: 100%;height: 100%"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { PropType, ref, toRefs } from 'vue'
|
||||||
|
import { requireErrorImg } from '@/utils'
|
||||||
|
import { CreateComponentType } from '@/packages/index.d'
|
||||||
|
import { fetchImages } from "@/packages/index";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
chartConfig: {
|
||||||
|
type: Object as PropType<CreateComponentType>,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const { w, h } = toRefs(props.chartConfig.attr)
|
||||||
|
const { dataset, fit, borderRadius } = toRefs(props.chartConfig.option)
|
||||||
|
|
||||||
|
let imageInfo = ref('')
|
||||||
|
// 获取图片
|
||||||
|
const fetchImageUrl = async () => {
|
||||||
|
imageInfo.value = await fetchImages(props.chartConfig.chartConfig)
|
||||||
|
}
|
||||||
|
fetchImageUrl()
|
||||||
|
|
||||||
|
const getStyle = (radius: number) => {
|
||||||
|
return {
|
||||||
|
// borderRadius: `${radius}px`,
|
||||||
|
overflow: 'hidden'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
</style>
|
27
src/packages/components/Decorates/Base/index.ts
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import { BaseConfig } from './Base/index'
|
||||||
|
import { PackagesCategoryEnum } from '@/packages/index.d'
|
||||||
|
import { ChatCategoryEnum, ChatCategoryEnumName } from '../index.d'
|
||||||
|
|
||||||
|
const topbarNames = [
|
||||||
|
'Base1.png',
|
||||||
|
'Base2.png',
|
||||||
|
'Base3.png',
|
||||||
|
'Base4.png',
|
||||||
|
'Base5.png',
|
||||||
|
'Base6.png',
|
||||||
|
'Base7.png',
|
||||||
|
'Base8.png',
|
||||||
|
]
|
||||||
|
const base = topbarNames.map((name, i) => ({
|
||||||
|
...BaseConfig,
|
||||||
|
category: ChatCategoryEnum.BASE,
|
||||||
|
categoryName: ChatCategoryEnumName.BASE,
|
||||||
|
package: PackagesCategoryEnum.DECORATES,
|
||||||
|
dataset: name,
|
||||||
|
// 既是缩略图 又是背景图
|
||||||
|
image: name,
|
||||||
|
title: `底座${i + 1}`,
|
||||||
|
redirectComponent: `${BaseConfig.package}/${BaseConfig.category}/${BaseConfig.key}` // 跳转组件路径规则:packageName/categoryName/componentKey
|
||||||
|
}))
|
||||||
|
|
||||||
|
export default base
|
6
src/packages/components/Decorates/index.d.ts
vendored
@ -3,7 +3,8 @@ export enum ChatCategoryEnum {
|
|||||||
DECORATE = 'Decorates',
|
DECORATE = 'Decorates',
|
||||||
THREE = 'Three',
|
THREE = 'Three',
|
||||||
MORE = 'Mores',
|
MORE = 'Mores',
|
||||||
TOPBARS = 'TopBars'
|
TOPBARS = 'TopBars',
|
||||||
|
BASE = 'Base'
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum ChatCategoryEnumName {
|
export enum ChatCategoryEnumName {
|
||||||
@ -11,5 +12,6 @@ export enum ChatCategoryEnumName {
|
|||||||
DECORATE = '装饰',
|
DECORATE = '装饰',
|
||||||
THREE = '三维',
|
THREE = '三维',
|
||||||
MORE = '更多',
|
MORE = '更多',
|
||||||
TOPBARS = '顶栏'
|
TOPBARS = '顶栏',
|
||||||
|
BASE = '底座'
|
||||||
}
|
}
|
@ -1,8 +1,9 @@
|
|||||||
import Borders from './Borders'
|
import Borders from './Borders'
|
||||||
import TopBars from './TopBars'
|
import TopBars from './TopBars'
|
||||||
|
import Base from './Base'
|
||||||
import Decorates from './Decorates'
|
import Decorates from './Decorates'
|
||||||
// import Three from './Three'
|
// import Three from './Three'
|
||||||
import Mores from './Mores'
|
import Mores from './Mores'
|
||||||
|
|
||||||
// export const DecorateList = [...Borders, ...Decorates, ...Three, ...Mores]
|
// export const DecorateList = [...Borders, ...Decorates, ...Three, ...Mores]
|
||||||
export const DecorateList = [...Borders, ...TopBars, ...Decorates, ...Mores]
|
export const DecorateList = [...Borders, ...TopBars, ...Base, ...Decorates, ...Mores]
|
||||||
|
@ -128,8 +128,11 @@ const dblclickHandle = async (item: ConfigType) => {
|
|||||||
newComponent.chartConfig.title = item.title
|
newComponent.chartConfig.title = item.title
|
||||||
newComponent.chartConfig.chartFrame = item.chartFrame
|
newComponent.chartConfig.chartFrame = item.chartFrame
|
||||||
}
|
}
|
||||||
|
let isHead = false
|
||||||
|
let isHeadList = ['EngineeringConfig']
|
||||||
|
if(isHeadList.includes(newComponent.chartConfig.key)) isHead = true
|
||||||
// 添加
|
// 添加
|
||||||
chartEditStore.addComponentList(newComponent, false, true)
|
chartEditStore.addComponentList(newComponent, isHead, true)
|
||||||
// 选中
|
// 选中
|
||||||
chartEditStore.setTargetSelectChart(newComponent.id)
|
chartEditStore.setTargetSelectChart(newComponent.id)
|
||||||
loadingFinish()
|
loadingFinish()
|
||||||
|