1.优化修改data中的model属性,其他计算data中设别列表没有更新的问题

2.修改激活状态点击修改后,未重置激活态的问题。
This commit is contained in:
lVAL 2020-11-09 13:01:00 +08:00
parent cc4edd174c
commit 779f76d4ec
19 changed files with 60 additions and 38 deletions

View File

@ -5,6 +5,7 @@ export function traverseLineElements(currentType, elementTypeList, model, style,
const currentTypeList = currentType.elemnetType;
currentTypeList.forEach(element => {
const ClassName = elementTypeList[element];
if (ClassName) {
obj[element] = new ClassName({
zlevel: model.zlevel,
z: 1 + currentType[element].z,
@ -12,6 +13,9 @@ export function traverseLineElements(currentType, elementTypeList, model, style,
modelData:model
});
obj.add(obj[element]);
} else {
console.error(`not find class name: ${ClassName}`);
}
});
}
// 遍历后端返回的状态控制的绘图

View File

@ -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 {
state.map[liststr] = [model];
if (model._dispose) {
list.splice(i, 1);
} else {
list.splice(i, 1, deepClone(model));
}
}
state.map[lstName] = [...list];
} else {
state.map[lstName] = [model];
}
}

View File

@ -459,6 +459,7 @@ export default {
const data = Object.assign({_type: this.editModel.type}, this.editModel);
console.log(data, '=====');
this.$emit('updateMapModel', data);
this.field = '';
}
});
},

View File

@ -468,6 +468,7 @@ export default {
},
updateMapModel(data) {
this.$emit('updateMapModel', data);
this.field = '';
},
deleteObj() {
this.$refs.dataform.deleteObj();

View File

@ -230,6 +230,7 @@ export default {
updateMapModel(data) {
data.uniqueCode = `${data.startStationCode}-${data.endStationCode}-${data.right}`;
this.$emit('updateMapModel', data);
this.field = '';
},
deleteObj() {
this.$refs.dataform.deleteObj();

View File

@ -164,6 +164,7 @@ export default {
},
updateMapModel(data) {
this.$emit('updateMapModel', data);
this.field = '';
},
deleteObj() {
this.$refs.dataform.deleteObj();

View File

@ -325,6 +325,7 @@ export default {
delete data.sectionUnitList;
}
this.$emit('updateMapModel', data);
this.field = '';
}
},
deleteObj() {

View File

@ -236,6 +236,7 @@ export default {
},
updateMapModel(data) {
this.$emit('updateMapModel', data);
this.field = '';
},
//
batchSettings() {

View File

@ -504,6 +504,7 @@ export default {
this.oldPoint = JSON.parse(JSON.stringify(model.points));
this.oldLeftSectionCode = model.leftSectionCode;
this.oldRightSectionCode = model.rightSectionCode;
this.field = '';
} else {
this.$message('还有属性未填写,修改未生效!');
}

View File

@ -478,6 +478,7 @@ export default {
},
updateMapModel(data) {
this.$emit('updateMapModel', data);
this.field = '';
},
signalSectionCode(field) {
this.field = field;

View File

@ -271,6 +271,7 @@ export default {
this.$refs.hostileForm.resetFields();
this.addModel.sectionCode = '';
this.index = '';
this.field = '';
},
generateOverlab() { //
if (!this.addModel.sectionCode) {

View File

@ -163,6 +163,7 @@ export default {
},
updateMapModel(data) {
this.$emit('updateMapModel', data);
this.field = '';
},
deleteObj() {
this.$refs.dataform.deleteObj();

View File

@ -420,6 +420,7 @@ export default {
const centralizedList = this.changeCentralized(this.editModel.centralized);
const models = [this.editModel, ...list, ...centralizedList];
this.$emit('updateMapModel', models);
this.field = '';
}
});
},

View File

@ -417,11 +417,12 @@ export default {
}
});
this.$emit('updateMapModel', models);
this.field = '';
} else {
//
this.$emit('updateMapModel', selected);
this.field = '';
}
},
deleteObj() {
this.$refs.dataform.deleteObj();

View File

@ -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',

View File

@ -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',

View File

@ -1,7 +1,7 @@
<template>
<el-tabs v-model="activeName" class="card">
<el-tab-pane class="view-control" :label="$t('map.property')" name="first" :lazy="lazy">
<switch-model ref="switchModel" v-on="$listeners" @setCenter="setCenter" />
<switch-model ref="switchModel" v-on="$listeners" @setCenter="setCenter" @clrField="field=''"/>
</el-tab-pane>
<el-tab-pane class="view-control" :label="$t('map.newConstruction')" name="second" :lazy="lazy">
<create-switch ref="createSwitch" v-on="$listeners" />

View File

@ -118,6 +118,7 @@ export default {
},
updateMapModel(data) {
this.$emit('updateMapModel', data);
this.$emit('clrField');
},
deleteObj() {
this.$refs.dataform.deleteObj();

View File

@ -355,9 +355,11 @@ export default {
});
models.push(deepAssign(selected, { _dispose: true }));
this.$emit('updateMapModel', models);
this.field = '';
} else {
//
this.$emit('updateMapModel', selected);
this.field = '';
}
},
editTrainWindow() {