feat: 基础结构修改

Re-1.0
咬轮猫 3 years ago
parent 35b5db898c
commit 2ec8f34c9c

@ -55,8 +55,8 @@
import SvgAnalysis from '../../../svg-analysis/index.vue'; import SvgAnalysis from '../../../svg-analysis/index.vue';
import { EGlobalStoreIntention } from '../../../../store/global/types'; import { EGlobalStoreIntention } from '../../../../store/global/types';
const globalStore = useGlobalStore(); const globalStore = useGlobalStore();
const select_lib = ref('电力系统'); const select_lib = ref('svg文件');
const config_center = ref<IConfigComponentGroup[]>(globalStore.config_center.电力系统); const config_center = ref<IConfigComponentGroup[]>(globalStore.config_center.svg文件);
const activeNames = ref(['stateful', 'stateless']); const activeNames = ref(['stateful', 'stateless']);
const libChange = (val: any) => { const libChange = (val: any) => {
config_center.value = []; config_center.value = [];

@ -1,6 +1,9 @@
import { power_system_config_center } from './power-system'; import { power_system_config_center } from './svg-file';
import { IConfigCenter } from './types'; import { IConfigCenter } from './types';
export const configCenter: IConfigCenter = { export const configCenter: IConfigCenter = {
: power_system_config_center svg: power_system_config_center,
vue: [],
: [],
: []
}; };

@ -1,17 +0,0 @@
import { EConfigItemPropsType, EConfigItemStateType, IConfigItem } from '../../../types';
export const power_system_circuit_breaker: IConfigItem = {
name: 'circuit-breaker',
title: '断路器',
props: {
fill: {
title: '填充色',
type: EConfigItemPropsType.Color,
val: '#ff0000'
}
},
state: {
type: EConfigItemStateType.Switch,
default: false
}
};

@ -1,8 +0,0 @@
import { IConfigComponentGroup } from '../../types';
import { power_system_alternator } from './alternator';
import { power_system_traction_transformer } from './traction-transformer';
export const stateless_group: IConfigComponentGroup = {
groupType: 'stateless',
title: '无状态',
list: [power_system_alternator, power_system_traction_transformer]
};

@ -0,0 +1,24 @@
import { EConfigItemPropsType, EDoneJsonType, IConfigItem } from '../../../types';
export const circuit_breaker_svg_file: IConfigItem = {
name: 'circuit-breaker',
title: '断路器',
type: EDoneJsonType.File,
props: {
fill: {
title: '填充色',
type: EConfigItemPropsType.Switch,
val: '#ff0000',
options: [
{
value: '#ff0000',
label: '关'
},
{
value: '#00ff00',
label: '开'
}
]
}
}
};

@ -1,8 +1,8 @@
import { IConfigComponentGroup } from '../../types'; import { IConfigComponentGroup } from '../../types';
import { power_system_circuit_breaker } from './circuit-breaker'; import { circuit_breaker_svg_file } from './circuit-breaker';
export const stateful_group: IConfigComponentGroup = { export const stateful_group: IConfigComponentGroup = {
groupType: 'stateful', groupType: 'stateful',
title: '有状态', title: '有状态',
list: [power_system_circuit_breaker] list: [circuit_breaker_svg_file]
}; };

@ -1,8 +1,9 @@
import { EConfigItemPropsType, IConfigItem } from '../../../types'; import { EConfigItemPropsType, EDoneJsonType, IConfigItem } from '../../../types';
export const power_system_alternator: IConfigItem = { export const alternator_svg_file: IConfigItem = {
name: 'alternator', name: 'alternator',
title: '发电机', title: '发电机',
type: EDoneJsonType.File,
props: { props: {
fill: { fill: {
title: '填充色', title: '填充色',

@ -0,0 +1,8 @@
import { IConfigComponentGroup } from '../../types';
import { alternator_svg_file } from './alternator';
import { traction_transformer_svg_file } from './traction-transformer';
export const stateless_group: IConfigComponentGroup = {
groupType: 'stateless',
title: '无状态',
list: [alternator_svg_file, traction_transformer_svg_file]
};

@ -1,8 +1,9 @@
import { EConfigItemPropsType, IConfigItem } from '../../../types'; import { EConfigItemPropsType, EDoneJsonType, IConfigItem } from '../../../types';
export const power_system_traction_transformer: IConfigItem = { export const traction_transformer_svg_file: IConfigItem = {
name: 'traction-transformer', name: 'traction-transformer',
title: '牵引变', title: '牵引变',
type: EDoneJsonType.File,
props: { props: {
fill: { fill: {
title: '填充色', title: '填充色',

@ -19,24 +19,23 @@ export interface IConfigItem {
name: string; name: string;
title: string; title: string;
props: IConfigItemProps; props: IConfigItemProps;
state?: IConfigItemState; type: EDoneJsonType;
} }
export interface IConfigItemProps { export interface IConfigItemProps {
[key: string]: { [key: string]: {
title: string; title: string;
type: EConfigItemPropsType; type: EConfigItemPropsType;
val: string; val: string;
options?: { value: any; label: string }[];
}; };
} }
export enum EConfigItemPropsType { export enum EConfigItemPropsType {
Input = 'Input', Input = 'Input',
Color = 'Color', Color = 'Color',
InputNumber = 'InputNumber' InputNumber = 'InputNumber',
Switch = 'Switch' //此类型option默认索引0为关闭
} }
export interface IConfigItemState { export enum EDoneJsonType {
type: EConfigItemStateType; File = 'File',
default: any; StraightLine = 'StraightLine'
}
export enum EConfigItemStateType {
Switch = 'Switch'
} }

@ -10,8 +10,8 @@ export const useConfigStore = defineStore('config-store', {
background_color: '#fff', background_color: '#fff',
scale: 1, scale: 1,
position_center: { position_center: {
x: -50, x: -295,
y: -50 y: -95
} }
} }
}; };

Loading…
Cancel
Save