feat: 基础结构修改

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

@ -55,8 +55,8 @@
import SvgAnalysis from '../../../svg-analysis/index.vue';
import { EGlobalStoreIntention } from '../../../../store/global/types';
const globalStore = useGlobalStore();
const select_lib = ref('电力系统');
const config_center = ref<IConfigComponentGroup[]>(globalStore.config_center.电力系统);
const select_lib = ref('svg文件');
const config_center = ref<IConfigComponentGroup[]>(globalStore.config_center.svg文件);
const activeNames = ref(['stateful', 'stateless']);
const libChange = (val: any) => {
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';
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 { power_system_circuit_breaker } from './circuit-breaker';
import { circuit_breaker_svg_file } from './circuit-breaker';
export const stateful_group: IConfigComponentGroup = {
groupType: 'stateful',
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',
title: '发电机',
type: EDoneJsonType.File,
props: {
fill: {
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',
title: '牵引变',
type: EDoneJsonType.File,
props: {
fill: {
title: '填充色',

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

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

Loading…
Cancel
Save