调整绘图相关调整_(控制模式多个创建)

This commit is contained in:
fan 2019-12-03 15:20:23 +08:00
parent 7d262fc7c9
commit f00a560327

View File

@ -18,7 +18,7 @@
<el-scrollbar wrap-class="scrollbar-wrapper">
<el-form ref="make" :model="addModel" label-width="120px" size="mini" :rules="makeRules">
<el-form-item :label="$t('map.stationstandName')" prop="stationCode">
<el-select v-model="addModel.stationCode" filterable>
<el-select v-model="addModel.stationCode" filterable multiple style="width: 350px;">
<el-option
v-for="item in stationList"
:key="item.code"
@ -77,7 +77,7 @@ export default {
// lskContent: ''
},
addModel: {
stationCode: ''
stationCode: []
},
makeRules: {
stationCode: [
@ -190,27 +190,31 @@ export default {
create() {
this.$refs['make'].validate((valid) => {
if (valid) {
if (this.addModel.stationCode) {
const uid = getUID('StationControl');
const model = {
_type: 'StationControl',
code: uid
// zokContent: '',
// zbjkContent: '',
// zakContent: '',
// jjzkContent: '',
// zzkContent: '',
// lskContent: ''
};
this.stationList.forEach(elem => {
if (elem.code === this.addModel.stationCode) {
model.name = 'StationControl_' + elem.name.replace('Station_', '');
model.position = { x: elem.position.x, y: elem.position.y };
model.stationCode = elem.code;
}
if (this.addModel.stationCode.length) {
const models = [];
this.addModel.stationCode.forEach(item => {
const uid = getUID('StationControl');
const model = {
_type: 'StationControl',
code: uid
// zokContent: '',
// zbjkContent: '',
// zakContent: '',
// jjzkContent: '',
// zzkContent: '',
// lskContent: ''
};
this.stationList.forEach(elem => {
if (elem.code === item) {
model.name = 'StationControl_' + elem.name.replace('Station_', '');
model.position = { x: elem.position.x, y: elem.position.y + 30 };
model.stationCode = elem.code;
}
});
console.log(model);
models.push(model);
});
this.$emit('updateMapModel', model);
this.$emit('updateMapModel', models);
} else {
this.$messageBox(this.$t('tip.selectedStationEmpty'));
}