diff --git a/src/jmapNew/shape/utils/ShapeStatusCovert.js b/src/jmapNew/shape/utils/ShapeStatusCovert.js index 181e218c3..afedfc490 100644 --- a/src/jmapNew/shape/utils/ShapeStatusCovert.js +++ b/src/jmapNew/shape/utils/ShapeStatusCovert.js @@ -4,14 +4,18 @@ export function traverseLineElements(currentType, elementTypeList, model, style, obj) { const currentTypeList = currentType.elemnetType; currentTypeList.forEach(element => { - const ClassName = elementTypeList[element]; - obj[element] = new ClassName({ - zlevel: model.zlevel, - z: 1 + currentType[element].z, - style: style, - modelData:model - }); - obj.add(obj[element]); + const ClassName = elementTypeList[element]; + if (ClassName) { + obj[element] = new ClassName({ + zlevel: model.zlevel, + z: 1 + currentType[element].z, + style: style, + modelData:model + }); + obj.add(obj[element]); + } else { + console.error(`not find class name: ${ClassName}`); + } }); } // 遍历后端返回的状态控制的绘图 diff --git a/src/jmapNew/utils/parser.js b/src/jmapNew/utils/parser.js index c7fd5cf8f..264f83bd2 100644 --- a/src/jmapNew/utils/parser.js +++ b/src/jmapNew/utils/parser.js @@ -255,19 +255,22 @@ export function parser(data, skinCode, showConfig) { } // 同步绘制数据到原始数据 -export function updateForList(model, state, liststr) { - const list = state.map[liststr]; +export function updateForList(model, state, lstName) { + const list = state.map[lstName]; if (list && list instanceof Array) { const i = list.findIndex(elem => elem.code == model.code ); - if (model._dispose) { - i >= 0 && list.splice(i, 1); // 删除 - } else if (!list[i]) { + if (list[i] < 0) { list.push(deepClone(model)); // 新增 - } else if (i >= 0) { - list[i] = deepClone(model); // item map 数据 model 页面表单数据 - } + } else { + if (model._dispose) { + list.splice(i, 1); + } else { + list.splice(i, 1, deepClone(model)); + } + } + state.map[lstName] = [...list]; } else { - state.map[liststr] = [model]; + state.map[lstName] = [model]; } } diff --git a/src/views/newMap/newMapdraft/mapoperate/ControlDraft.vue b/src/views/newMap/newMapdraft/mapoperate/ControlDraft.vue index b7675b66b..7c68e63a1 100644 --- a/src/views/newMap/newMapdraft/mapoperate/ControlDraft.vue +++ b/src/views/newMap/newMapdraft/mapoperate/ControlDraft.vue @@ -458,7 +458,8 @@ export default { if (valid) { const data = Object.assign({_type: this.editModel.type}, this.editModel); console.log(data, '====='); - this.$emit('updateMapModel', data); + this.$emit('updateMapModel', data); + this.field = ''; } }); }, diff --git a/src/views/newMap/newMapdraft/mapoperate/controlLamp.vue b/src/views/newMap/newMapdraft/mapoperate/controlLamp.vue index 65bdca927..80bb2d794 100644 --- a/src/views/newMap/newMapdraft/mapoperate/controlLamp.vue +++ b/src/views/newMap/newMapdraft/mapoperate/controlLamp.vue @@ -467,7 +467,8 @@ export default { }); }, updateMapModel(data) { - this.$emit('updateMapModel', data); + this.$emit('updateMapModel', data); + this.field = ''; }, deleteObj() { this.$refs.dataform.deleteObj(); diff --git a/src/views/newMap/newMapdraft/mapoperate/directionRod.vue b/src/views/newMap/newMapdraft/mapoperate/directionRod.vue index de6fb3dd0..dfcf6c757 100644 --- a/src/views/newMap/newMapdraft/mapoperate/directionRod.vue +++ b/src/views/newMap/newMapdraft/mapoperate/directionRod.vue @@ -229,7 +229,8 @@ export default { }, updateMapModel(data) { data.uniqueCode = `${data.startStationCode}-${data.endStationCode}-${data.right}`; - this.$emit('updateMapModel', data); + this.$emit('updateMapModel', data); + this.field = ''; }, deleteObj() { this.$refs.dataform.deleteObj(); diff --git a/src/views/newMap/newMapdraft/mapoperate/espDraft.vue b/src/views/newMap/newMapdraft/mapoperate/espDraft.vue index 79d91985a..cd48a662c 100644 --- a/src/views/newMap/newMapdraft/mapoperate/espDraft.vue +++ b/src/views/newMap/newMapdraft/mapoperate/espDraft.vue @@ -163,7 +163,8 @@ export default { } }, updateMapModel(data) { - this.$emit('updateMapModel', data); + this.$emit('updateMapModel', data); + this.field = ''; }, deleteObj() { this.$refs.dataform.deleteObj(); diff --git a/src/views/newMap/newMapdraft/mapoperate/power.vue b/src/views/newMap/newMapdraft/mapoperate/power.vue index 9e224c59f..5e768a019 100644 --- a/src/views/newMap/newMapdraft/mapoperate/power.vue +++ b/src/views/newMap/newMapdraft/mapoperate/power.vue @@ -324,7 +324,8 @@ export default { } else { delete data.sectionUnitList; } - this.$emit('updateMapModel', data); + this.$emit('updateMapModel', data); + this.field = ''; } }, deleteObj() { diff --git a/src/views/newMap/newMapdraft/mapoperate/psdDraft.vue b/src/views/newMap/newMapdraft/mapoperate/psdDraft.vue index e08fe55bd..8c1abd1c5 100644 --- a/src/views/newMap/newMapdraft/mapoperate/psdDraft.vue +++ b/src/views/newMap/newMapdraft/mapoperate/psdDraft.vue @@ -235,7 +235,8 @@ export default { this.$refs.createForm.resetForm(); }, updateMapModel(data) { - this.$emit('updateMapModel', data); + this.$emit('updateMapModel', data); + this.field = ''; }, // 批量设置 batchSettings() { diff --git a/src/views/newMap/newMapdraft/mapoperate/section/index.vue b/src/views/newMap/newMapdraft/mapoperate/section/index.vue index 2315198ea..d7ff698be 100644 --- a/src/views/newMap/newMapdraft/mapoperate/section/index.vue +++ b/src/views/newMap/newMapdraft/mapoperate/section/index.vue @@ -503,7 +503,8 @@ export default { this.$emit('updateMapModel', models); this.oldPoint = JSON.parse(JSON.stringify(model.points)); this.oldLeftSectionCode = model.leftSectionCode; - this.oldRightSectionCode = model.rightSectionCode; + this.oldRightSectionCode = model.rightSectionCode; + this.field = ''; } else { this.$message('还有属性未填写,修改未生效!'); } diff --git a/src/views/newMap/newMapdraft/mapoperate/signal/index.vue b/src/views/newMap/newMapdraft/mapoperate/signal/index.vue index 8d67934ed..cf8c54abc 100644 --- a/src/views/newMap/newMapdraft/mapoperate/signal/index.vue +++ b/src/views/newMap/newMapdraft/mapoperate/signal/index.vue @@ -477,7 +477,8 @@ export default { } }, updateMapModel(data) { - this.$emit('updateMapModel', data); + this.$emit('updateMapModel', data); + this.field = ''; }, signalSectionCode(field) { this.field = field; diff --git a/src/views/newMap/newMapdraft/mapoperate/splitScreen.vue b/src/views/newMap/newMapdraft/mapoperate/splitScreen.vue index 8f1dded37..31e0b80d7 100644 --- a/src/views/newMap/newMapdraft/mapoperate/splitScreen.vue +++ b/src/views/newMap/newMapdraft/mapoperate/splitScreen.vue @@ -270,7 +270,8 @@ export default { clear() { this.$refs.hostileForm.resetFields(); this.addModel.sectionCode = ''; - this.index = ''; + this.index = ''; + this.field = ''; }, generateOverlab() { // 生成 if (!this.addModel.sectionCode) { diff --git a/src/views/newMap/newMapdraft/mapoperate/splitStation.vue b/src/views/newMap/newMapdraft/mapoperate/splitStation.vue index e72bde749..44ad8380e 100644 --- a/src/views/newMap/newMapdraft/mapoperate/splitStation.vue +++ b/src/views/newMap/newMapdraft/mapoperate/splitStation.vue @@ -162,7 +162,8 @@ export default { this.$refs.createForm.resetForm(); }, updateMapModel(data) { - this.$emit('updateMapModel', data); + this.$emit('updateMapModel', data); + this.field = ''; }, deleteObj() { this.$refs.dataform.deleteObj(); diff --git a/src/views/newMap/newMapdraft/mapoperate/station.vue b/src/views/newMap/newMapdraft/mapoperate/station.vue index ba2741374..ef3d2fc61 100644 --- a/src/views/newMap/newMapdraft/mapoperate/station.vue +++ b/src/views/newMap/newMapdraft/mapoperate/station.vue @@ -419,7 +419,8 @@ export default { const list = this.changeChargeStation(this.editModel.chargeStationCodeList); const centralizedList = this.changeCentralized(this.editModel.centralized); const models = [this.editModel, ...list, ...centralizedList]; - this.$emit('updateMapModel', models); + this.$emit('updateMapModel', models); + this.field = ''; } }); }, diff --git a/src/views/newMap/newMapdraft/mapoperate/stationstand.vue b/src/views/newMap/newMapdraft/mapoperate/stationstand.vue index 256b7b1c6..c5cbd997f 100644 --- a/src/views/newMap/newMapdraft/mapoperate/stationstand.vue +++ b/src/views/newMap/newMapdraft/mapoperate/stationstand.vue @@ -416,12 +416,13 @@ export default { models.push(deepAssign(item, { _dispose: true })); } }); - this.$emit('updateMapModel', models); + this.$emit('updateMapModel', models); + this.field = ''; } else { // 用于更新 - this.$emit('updateMapModel', selected); + this.$emit('updateMapModel', selected); + this.field = ''; } - }, deleteObj() { this.$refs.dataform.deleteObj(); diff --git a/src/views/newMap/newMapdraft/mapoperate/switch/create.vue b/src/views/newMap/newMapdraft/mapoperate/switch/create.vue index 423b823d1..981fa9e6d 100644 --- a/src/views/newMap/newMapdraft/mapoperate/switch/create.vue +++ b/src/views/newMap/newMapdraft/mapoperate/switch/create.vue @@ -325,7 +325,7 @@ export default { namePosition: point, switchSection: true, relSwitchCode: elem.relSwitchCode, - relevanceSectionList: elem.relevanceSectionList, + relevanceSectionList: [...elem.relevanceSectionList], points: [{ x: 0, y: 0 }, { x: 0, y: 0 }], sepTypeLeft: '00', sepTypeRight: '00', diff --git a/src/views/newMap/newMapdraft/mapoperate/switch/createAxle.vue b/src/views/newMap/newMapdraft/mapoperate/switch/createAxle.vue index 9609e0598..e0c1929eb 100644 --- a/src/views/newMap/newMapdraft/mapoperate/switch/createAxle.vue +++ b/src/views/newMap/newMapdraft/mapoperate/switch/createAxle.vue @@ -109,7 +109,7 @@ export default { }, switchSection: true, relSwitchCode: this.fromData.relevanceSwitchList[0], - relevanceSectionList: this.fromData.relevanceSectionList, + relevanceSectionList: [...this.fromData.relevanceSectionList], points: [{ x: 0, y: 0 }, { x: 0, y: 0 }], sepTypeLeft: '00', sepTypeRight: '00', diff --git a/src/views/newMap/newMapdraft/mapoperate/switch/index.vue b/src/views/newMap/newMapdraft/mapoperate/switch/index.vue index 8e9b996fc..b9c67254a 100644 --- a/src/views/newMap/newMapdraft/mapoperate/switch/index.vue +++ b/src/views/newMap/newMapdraft/mapoperate/switch/index.vue @@ -1,7 +1,7 @@