diff --git a/src/iscs_new/plugins/shapeBuilder/entry.vue b/src/iscs_new/plugins/shapeBuilder/entry.vue index c29e265b4..ec5361121 100644 --- a/src/iscs_new/plugins/shapeBuilder/entry.vue +++ b/src/iscs_new/plugins/shapeBuilder/entry.vue @@ -19,26 +19,36 @@ import elementConst from '@/iscs_new/core/form/elementConst'; import formBuilder from '@/iscs_new/core/form/formBuilder'; import { EventBus } from '@/scripts/event-bus'; +const exec = (fm, name, ...args) => fm && fm[name] && fm[name](...args); + export default { data () { return { visible: true, - shapeType: 'compose', + enum: 'Compose', graphicType: [], - builderMap: { + strategyMap: { 'Compose': { - init() { + init: () => { this.graphicType = Object.fromEntries(Object.keys(graphic).filter(type => !['Group'].includes(type)).map(type => [type, type])) }, - doBuilder(type) { - + doBuilder: (type) => { + const form = formBuilder.buildForm(elementConst[type]); + const model = utils.deepClone(form.model); + model.code = utils.getUID(type); + model.type = type; + model.name = '<名称>'; + model.base.position = [300, 100]; + model.stateList = []; + this.$iscs && this.$iscs.render([{model, action: {shapeType: shapeType.Element, order: orders.Add}}]); + EventBus.$emit('getComposeElemList'); } }, 'Map': { - init() { + init: () =>{ }, - doBuilder(type) { + doBuilder: (type) => { } } @@ -47,24 +57,14 @@ export default { }; }, mounted() { - + this.init(); }, methods: { init() { - if (shapeType) { - this.graphicType = Object.fromEntries(Object.keys(graphic).filter(type => !['Group'].includes(type)).map(type => [type, type])); - } + exec(this.strategyMap[this.enum], 'init') }, doBuilder(type) { - const form = formBuilder.buildForm(elementConst[type]); - const model = utils.deepClone(form.model); - model.code = utils.getUID(type); - model.type = type; - model.name = '<名称>'; - model.base.position = [300, 100]; - model.stateList = []; - this.$iscs && this.$iscs.render([{model, action: {shapeType: shapeType.Element, order: orders.Add}}]); - EventBus.$emit('getComposeElemList'); + exec(this.strategyMap[this.enum], 'doBuilder', type) } } }; diff --git a/src/jmapNew/shape/Section/index.js b/src/jmapNew/shape/Section/index.js index b9b079ad7..652087db2 100644 --- a/src/jmapNew/shape/Section/index.js +++ b/src/jmapNew/shape/Section/index.js @@ -4,6 +4,7 @@ import ELimitLines from './ELimitLines'; // 区段限速 (私有) import ELines from './ELines'; // 创建多线条 曲线 (私有) import EblockLines from './EblockLines'; // 区段封锁特有 import ESeparator from './ESeparator'; // 分隔符 (私有) +import EDerailer from './EDerailer'; // 脱轨器 import EMouse from './EMouse'; import EAxle from './EAxle'; // 创建计轴 // import { EBackArrow, EBackArrowTriangle } from './EBackArrow'; // 折返进路箭头 @@ -61,7 +62,8 @@ export default class Section extends Group { 'separator': ESeparator, // 分隔符 'speedLimit': ELimitLines, // 限速线 'speedLimitName': ELimitName, // 限速线名称 - 'shuttleBack': EBackArrowGroup // 折返箭头 (成都三号线显示) + 'shuttleBack': EBackArrowGroup, // 折返箭头 (成都三号线显示) + 'derailer': EDerailer, //脱轨器 }; // 遍历当前线路下的绘图元素 const model = this.model; diff --git a/src/router/index.js b/src/router/index.js index 7d8961700..46929e7c6 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -217,6 +217,24 @@ export const constantRoutes = [ component: Test, hidden: true }, + { + path:'/iscs_new/design/compose/edit', + hidden: true, + component: IscsNewDraw, + meta: { + i18n: 'router.iscsDraw', + roles: [admin] + } + }, + { + path:'/iscs_new/design/map/edit', + hidden: true, + component: IscsNewDesign, + meta: { + i18n: 'router.iscsDraw', + roles: [admin] + } + }, { path: '/demo', component: Demo, @@ -1153,24 +1171,6 @@ export const asyncRouter = [ } ] }, - { - path:'/iscs_new/design/compose/edit', - hidden: true, - component: IscsNewDraw, - meta: { - i18n: 'router.iscsDraw', - roles: [admin] - } - }, - { - path:'/iscs_new/design/map/edit', - hidden: true, - component: IscsNewDesign, - meta: { - i18n: 'router.iscsDraw', - roles: [admin] - } - }, { // iscs系统 path: '/iscs', component: Layout,