信号机添加所属车站&批量设置
This commit is contained in:
parent
6aea2334e6
commit
5f3300e889
@ -1,7 +1,41 @@
|
||||
<template>
|
||||
<div class="view-control">
|
||||
<div class="content-box">
|
||||
<div v-for="item in modelList" :key="item.type" class="content-box-list">
|
||||
<el-tabs v-model="activeName" type="card" @tab-click="handleClick">
|
||||
<el-tab-pane label="批量设置集中站" name="first">
|
||||
<div class="select-box">
|
||||
<el-select v-model="stationCode" filterable size="mini">
|
||||
<el-option
|
||||
v-for="item in centralizedStationList"
|
||||
:key="item.code"
|
||||
:label="item.name + item.code"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="button-box">
|
||||
<el-button type="primary" size="mini" @click="handleSectionStationCode">{{ $t('map.setStationCode') }}</el-button>
|
||||
<el-button type="" size="mini" @click="clearList">清空</el-button>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="批量设置所属车站" name="second">
|
||||
<div class="select-box">
|
||||
<el-select v-model="belongStationCode" filterable size="mini">
|
||||
<el-option
|
||||
v-for="item in stationList"
|
||||
:key="item.code"
|
||||
:label="item.name + item.code"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="button-box">
|
||||
<el-button type="primary" size="mini" @click="handleBelongStationCode">批量设置所属车站</el-button>
|
||||
<el-button type="" size="mini" @click="clearList">清空</el-button>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<div v-for="item in showList" :key="item.type" class="content-box-list" style="margin-top: 10px;">
|
||||
<div class="title-box">{{ item.name }}</div>
|
||||
<div class="list-box">
|
||||
<div v-for="nor in item.list" :key="nor.code" class="list-content" @mouseenter="mouseenter(nor)" @mouseleave="mouseleave(nor)">
|
||||
@ -10,20 +44,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="select-box">
|
||||
<el-select v-model="stationCode" filterable size="mini">
|
||||
<el-option
|
||||
v-for="item in centralizedStationList"
|
||||
:key="item.code"
|
||||
:label="item.name + item.code"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="button-box">
|
||||
<el-button type="primary" size="mini" @click="handleSectionStationCode">{{ $t('map.setStationCode') }}</el-button>
|
||||
<el-button type="" size="mini" @click="clearList">清空</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -47,6 +67,9 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
stationCode: '',
|
||||
belongStationCode: '',
|
||||
activeName: 'first',
|
||||
showList: [],
|
||||
modelList: [
|
||||
{
|
||||
type: 'Section',
|
||||
@ -63,6 +86,13 @@ export default {
|
||||
name: '信号机列表',
|
||||
list: []
|
||||
}
|
||||
],
|
||||
modelSignalList: [
|
||||
{
|
||||
type: 'Signal',
|
||||
name: '信号机列表',
|
||||
list: []
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
@ -86,8 +116,16 @@ export default {
|
||||
// this.$emit('setCenter', code);
|
||||
// this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
|
||||
// },
|
||||
handleClick() {
|
||||
if (this.activeName === 'first') {
|
||||
this.showList = this.modelList;
|
||||
} else {
|
||||
this.showList = this.modelSignalList;
|
||||
}
|
||||
},
|
||||
deviceSelect(selected) {
|
||||
if (selected && selected._type.toUpperCase() == 'CheckBox'.toUpperCase()) {
|
||||
this.activeName = 'first';
|
||||
this.clearModelList();
|
||||
let count = 0;
|
||||
this.seclectDeviceList.forEach(item => {
|
||||
@ -99,6 +137,7 @@ export default {
|
||||
this.modelList[1].list.push(item);
|
||||
} else if (item._type == 'Signal') {
|
||||
this.modelList[2].list.push(item);
|
||||
this.modelSignalList[0].list.push(item);
|
||||
}
|
||||
if (item.stationCode == this.seclectDeviceList[0].stationCode) {
|
||||
count++;
|
||||
@ -109,12 +148,16 @@ export default {
|
||||
} else {
|
||||
this.stationCode = '';
|
||||
}
|
||||
this.belongStationCode = this.stationList[0].code;
|
||||
this.showList = this.modelList;
|
||||
}
|
||||
},
|
||||
clearModelList() {
|
||||
this.showList = [];
|
||||
this.modelList.forEach(item => {
|
||||
item.list = [];
|
||||
});
|
||||
this.modelSignalList[0].list = [];
|
||||
},
|
||||
// 删除当前选中
|
||||
delList(model, list) {
|
||||
@ -152,9 +195,24 @@ export default {
|
||||
this.stationCode = '';
|
||||
}
|
||||
},
|
||||
handleBelongStationCode() {
|
||||
if (this.belongStationCode && this.modelSignalList[0].list.length) {
|
||||
const models = [];
|
||||
this.modelSignalList[0].list.forEach(item => {
|
||||
const Model = deepAssign({}, this.$store.getters['map/getDeviceByCode'](item.code));
|
||||
Model.belongStationCode = this.belongStationCode;
|
||||
models.push(Model);
|
||||
});
|
||||
this.$emit('updateMapModel', models);
|
||||
this.$message.success('设置所属车站成功!');
|
||||
this.belongStationCode = '';
|
||||
}
|
||||
},
|
||||
clearList() { // 清空数据
|
||||
this.stationCode = '';
|
||||
this.belongStationCode = '';
|
||||
this.$store.commit('map/setSeclectDeviceList', []);
|
||||
this.showList = [];
|
||||
this.modelList = [
|
||||
{
|
||||
type: 'Section',
|
||||
@ -172,6 +230,13 @@ export default {
|
||||
list: []
|
||||
}
|
||||
];
|
||||
this.modelSignalList = [
|
||||
{
|
||||
type: 'Signal',
|
||||
name: '信号机列表',
|
||||
list: []
|
||||
}
|
||||
];
|
||||
},
|
||||
mouseenter(model) {
|
||||
if (model._type == 'Section') {
|
||||
|
@ -147,6 +147,7 @@ export default {
|
||||
item: [
|
||||
{ prop: 'stationCode', label: this.$t('map.equipmentStation'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.centralizedStationList },
|
||||
{ prop: 'interlockStationCode', label: '所属联锁站', type: 'select', optionLabel: 'name&&code', optionValue: 'code', clearable: true, options: this.ciStationList},
|
||||
{ prop: 'belongStationCode', label: '所属车站', type: 'select', optionLabel: 'name&&code', optionValue: 'code', clearable: true, options: this.stationList },
|
||||
{ prop: 'uniqueName', label: this.$t('map.signalUniqueName'), type: 'input' },
|
||||
{ prop: 'sectionCode', label: this.$t('map.belongsSection'), type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.signalSectionList, hover: this.hover, buttonType: 'signalSection', buttonShowType: this.signalSectionShow },
|
||||
{ prop: 'sectionOffset', label: this.$t('map.signalOffset'), type: 'number', min: 0, placeholder: this.$t('tip.meter') }
|
||||
|
Loading…
Reference in New Issue
Block a user