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

@ -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}`);
}
});
}
// 遍历后端返回的状态控制的绘图

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 {
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];
}
}

View File

@ -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 = '';
}
});
},

View File

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

View File

@ -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();

View File

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

View File

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

View File

@ -235,7 +235,8 @@ export default {
this.$refs.createForm.resetForm();
},
updateMapModel(data) {
this.$emit('updateMapModel', data);
this.$emit('updateMapModel', data);
this.field = '';
},
//
batchSettings() {

View File

@ -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('还有属性未填写,修改未生效!');
}

View File

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

View File

@ -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) {

View File

@ -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();

View File

@ -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 = '';
}
});
},

View File

@ -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();

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

@ -117,14 +117,15 @@ export default {
this.editModel = deepAssign(this.editModel, data);
},
updateMapModel(data) {
this.$emit('updateMapModel', data);
this.$emit('updateMapModel', data);
this.$emit('clrField');
},
deleteObj() {
this.$refs.dataform.deleteObj();
},
//
edit() {
this.$refs.dataform.edit();
this.$refs.dataform.edit();
}
}
};

View File

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