调整列车创建

This commit is contained in:
zyy 2019-12-17 15:37:11 +08:00
parent fce5242e06
commit b05d71667e
3 changed files with 30 additions and 40 deletions

View File

@ -45,6 +45,7 @@
</template>
<script>
import { mapGetters } from 'vuex';
import { getUID } from '@/jmapNew/utils/Uid';
export default {
@ -70,6 +71,9 @@ export default {
};
},
computed: {
...mapGetters('map', [
'trainList'
]),
rules() {
return {
range: [

View File

@ -102,7 +102,7 @@ export default {
}
},
create(list) {
this.$emit('addOrUpdateMapModel', list);
this.$emit('updateMapModel', list);
},
//
edit(elem) {

View File

@ -118,8 +118,8 @@ export default {
field: '',
addModel: {
pointY: '',
width: '',
height: '',
width: 40,
height: 15,
modelList: []
},
mergeRules: {
@ -289,6 +289,13 @@ export default {
_dispose: true
});
});
this.sectionList.forEach(elem => {
if (elem.trainWindowCode) {
const section = deepAssign({}, elem);
section.trainWindowCode = '';
remove.push(section);
}
});
this.$emit('updateMapModel', remove);
}
}).catch(() => {
@ -298,24 +305,10 @@ export default {
//
createTrainWindow() {
const models = [];
const switchSectionList = [];
// const PhysicalSectionList = [];
this.addList = [];
const remove = []; //
if (this.trainWindowList && this.trainWindowList.length) {
this.trainWindowList.forEach(elem => {
remove.push({
_type: 'TrainWindow',
code: elem.code,
_dispose: true
});
});
this.$emit('updateMapModel', remove);
}
this.addList = []; // codelist
if (this.sectionList && this.sectionList.length) {
this.sectionList.forEach(elem => {
if (elem.type !== '04' && !elem.isSwitchSection && (elem.logicSectionNum.length == 0 || elem.logicSectionNum.length == 1 && elem.logicSectionNum[0] == 0)) {
if (elem.type !== '04' && !elem.isSwitchSection && !elem.trainWindowCode && (elem.logicSectionNum.length == 0 || elem.logicSectionNum.length == 1 && elem.logicSectionNum[0] == 0)) {
const triangle = new JTriangle(elem.points[0], elem.points[elem.points.length - 1]);
const param = this.createModel({
triangle: triangle,
@ -323,36 +316,19 @@ export default {
});
models.push(param);
const section = deepAssign(elem, { trainWindowCode: param.code });
// if (section.type == '02') {
// if (!switchSectionList.find(ele => { return ele.code == section.parentCode; })) {
// const sectionParent = deepAssign({}, this.$store.getters['map/getDeviceByCode'](section.parentCode));
// sectionParent['trainWindowCode'] = section.trainWindowCode;
// switchSectionList.push(sectionParent);
// }
// }
switchSectionList.push(section);
models.push(section);
this.addList.push(param);
} else if (elem.type === '04') {
} else if (elem.type === '04' && !elem.trainWindowCode) {
const param = this.createModel({
section: elem
});
models.push(param);
const section = deepAssign(elem, { trainWindowCode: param.code });
switchSectionList.push(section);
models.push(section);
this.addList.push(param);
}
});
}
switchSectionList.forEach(elem => {
if (elem.type === '04') {
elem.relevanceSectionList.forEach(item => {
const section = deepAssign({}, this.$store.getters['map/getDeviceByCode'](item));
section['trainWindowCode'] = elem.trainWindowCode;
models.push(section);
});
}
models.push(elem);
});
this.$emit('updateMapModel', models);
},
@ -375,7 +351,17 @@ export default {
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
_that.$emit('updateMapModel', {...selected, _dispose: true});
const models = [];
this.sectionList.forEach(elem => {
if (elem.trainWindowCode == selected.code) {
const section = deepAssign({}, elem);
section.trainWindowCode = '';
models.push(section);
}
});
models.push(deepAssign(selected, { _dispose: true }));
console.log(models);
_that.$emit('updateMapModel', models);
_that.deviceSelect();
}).catch(() => {
_that.$message.info(this.$t('tip.cancelledDelete'));