This commit is contained in:
sunzhenyu 2021-06-23 18:09:31 +08:00
commit 50102fb62a
4 changed files with 100 additions and 25 deletions

View File

@ -144,9 +144,13 @@ export default class Responder extends Group {
const responderStyle = this.style.Responder || defaultStyle; const responderStyle = this.style.Responder || defaultStyle;
const style = responderStyle.block.mapStyle[model.type] || {fill: '#000'}; const style = responderStyle.block.mapStyle[model.type] || {fill: '#000'};
this.block && this.block.setStyle(style); this.block && this.block.setStyle(style);
[this.delta1, this.delta2].forEach(el => { if (this.delta1) {
model.type == 'IB' ? el.show() : el.hide(); model.type == 'IB' ? this.delta1.show() : this.delta1.hide();
}); }
if (this.delta2) {
model.type == 'IB' ? this.delta2.show() : this.delta2.hide();
}
} }
// 整体图片 // 整体图片
@ -167,7 +171,7 @@ export default class Responder extends Group {
} }
// 设置选中态 // 设置选中态
drawSelected(selected){ drawSelected(selected) {
this.highlight && this.highlight.drawSelected(selected); this.highlight && this.highlight.drawSelected(selected);
} }

View File

@ -47,7 +47,6 @@
<el-tab-pane class="view-control" label="批量操作" name="fourth" :lazy="lazy"> <el-tab-pane class="view-control" label="批量操作" name="fourth" :lazy="lazy">
<responder-batch-operate <responder-batch-operate
:responder-list="responderList" :responder-list="responderList"
:section-list="filterSectionList"
:signal-list="signalList" :signal-list="signalList"
/> />
</el-tab-pane> </el-tab-pane>

View File

@ -10,7 +10,7 @@
<script> <script>
export default { export default {
name: "responderBatchOperate", name: "responderBatchOperate",
props: ["responderList", "sectionList", "signalList"], props: ["responderList", "signalList"],
data() { data() {
return {}; return {};
}, },

View File

@ -55,7 +55,7 @@ export default {
name: '', name: '',
managedSectionList:[], managedSectionList:[],
// visible: '', // visible: '',
// concentrateStationList:[], concentrateStationList:[],
position: { position: {
x: 0, x: 0,
y: 0 y: 0
@ -65,7 +65,7 @@ export default {
code: '', code: '',
name: '', name: '',
// visible: '', // visible: '',
// concentrateStationList:[], concentrateStationList:[],
position: { position: {
x: 0, x: 0,
y: 0 y: 0
@ -82,9 +82,9 @@ export default {
// visible: [ // visible: [
// { required: true, message: this.$t('rules.visible'), trigger: 'change' } // { required: true, message: this.$t('rules.visible'), trigger: 'change' }
// ], // ],
// concentrateStationList:[ concentrateStationList:[
// { required: true, message: this.$t('rules.selectConcentrateStation'), trigger: 'change' } { required: true, message: this.$t('rules.selectConcentrateStation'), trigger: 'change' }
// ], ],
'position.x': [ 'position.x': [
{ required: true, message: this.$t('rules.trainPositionX'), trigger: 'blur' } { required: true, message: this.$t('rules.trainPositionX'), trigger: 'blur' }
], ],
@ -97,6 +97,7 @@ export default {
computed: { computed: {
...mapGetters('map', [ ...mapGetters('map', [
'zcList', 'zcList',
'stationList',
'seclectDeviceList' 'seclectDeviceList'
]), ]),
isButtonType() { isButtonType() {
@ -120,8 +121,9 @@ export default {
{ prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px' }, { prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px' },
{ prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px' } { prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px' }
] }, ] },
{ prop:'concentrateStationList', label:this.$t('map.concentrateStationList'), type: 'multiSelect', optionLabel: 'name', optionValue: 'code', options: this.concertrateStation },
// deviceChange: this.changeConcertrateStation
{ prop:'managedSectionList', label:'管理区段列表: ', type: 'checkBoxDevice', getName:this.getName, mouseenter:this.mouseenter, mouseleave:this.mouseleave, buttonShowType:this.isButtonType, hover:this.hover, buttonType:'checkZcSection', clear:this.clear} { prop:'managedSectionList', label:'管理区段列表: ', type: 'checkBoxDevice', getName:this.getName, mouseenter:this.mouseenter, mouseleave:this.mouseleave, buttonShowType:this.isButtonType, hover:this.hover, buttonType:'checkZcSection', clear:this.clear}
// { prop:'concentrateStationList', label:this.$t('map.concentrateStationList'), type: 'multiSelect', optionLabel: 'name', optionValue: 'code', options: this.concertrateStation, deviceChange: this.changeConcentrateStation }
] ]
} }
} }
@ -139,9 +141,9 @@ export default {
{ prop: 'position', label: this.$t('map.stateSignalsPlotCoordinates'), type: 'coordinate', width: '140px', children: [ { prop: 'position', label: this.$t('map.stateSignalsPlotCoordinates'), type: 'coordinate', width: '140px', children: [
{ prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px' }, { prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px' },
{ prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px' } { prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px' }
] } ] },
// // deviceChange: this.changeConcertrateStation
// { prop:'concentrateStationList', label:this.$t('map.concentrateStationList'), type: 'multiSelect', optionLabel: 'name', optionValue: 'code', options: this.concertrateStation, deviceChange: this.changeConcentrateStation } { prop:'concentrateStationList', label:this.$t('map.concentrateStationList'), type: 'multiSelect', optionLabel: 'name', optionValue: 'code', options: this.concertrateStation }
] ]
} }
} }
@ -150,10 +152,13 @@ export default {
} }
}, },
watch: { watch: {
stationList() {
this.getConcertrateStation();
}
},
mounted() {
this.getConcertrateStation();
}, },
// mounted() {
// this.getConcertrateStation();
// },
methods: { methods: {
deviceChange(code) { deviceChange(code) {
this.$emit('setCenter', code); this.$emit('setCenter', code);
@ -165,9 +170,11 @@ export default {
if (selected && selected._type.toUpperCase() === 'CheckBox'.toUpperCase()) { if (selected && selected._type.toUpperCase() === 'CheckBox'.toUpperCase()) {
this.activeName = 'first'; this.activeName = 'first';
this.seclectDeviceList.forEach(item => { this.seclectDeviceList.forEach(item => {
if (item._type == 'Section' && (item.type == '01' || item.type == '04') && !this.editModel.managedSectionList.includes(selected.code)) { if (item._type == 'Section' && (item.type == '01' || item.type == '04')) {
if (!this.editModel.managedSectionList.includes(item.code)) {
this.editModel.managedSectionList.push(item.code); this.editModel.managedSectionList.push(item.code);
} }
}
}); });
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase()) { } else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase()) {
if (selected._type == 'Section' && (selected.type == '01' || selected.type == '04') && !this.editModel.managedSectionList.includes(selected.code)) { if (selected._type == 'Section' && (selected.type == '01' || selected.type == '04') && !this.editModel.managedSectionList.includes(selected.code)) {
@ -176,15 +183,46 @@ export default {
} else if (selected && selected._type.toUpperCase() === 'ZcControl'.toUpperCase()) { } else if (selected && selected._type.toUpperCase() === 'ZcControl'.toUpperCase()) {
this.$refs.dataform && this.$refs.dataform.resetFields(); this.$refs.dataform && this.$refs.dataform.resetFields();
this.activeName = 'first'; this.activeName = 'first';
this.editModel = deepAssign(this.editModel, selected); // this.editModel = deepAssign({}, selected);
this.editModel = {
code: selected.code,
name: selected.name,
concentrateStationList:selected.concentrateStationList || [],
managedSectionList:selected.managedSectionList || [],
position: Object.assign({}, selected.position)
};
// this.editModel
// if (this.editModel.concentrateStationList) { delete this.editModel.concentrateStationList; }
// if (!this.editModel.managedSectionList) { this.editModel.managedSectionList = []; }
} }
}, },
getConcertrateStation() {
//
const beConcentrateStation = {};
this.zcList.forEach(data=>{
if (data.concentrateStationList) {
data.concentrateStationList.forEach(concentrate=>{
beConcentrateStation[concentrate] = data.code;
});
}
});
this.concertrateStation = this.stationList.filter(station=>{
// if (this.activeName == 'first') {
// return station.centralized && !( beConcentrateStation[station.code] && (beConcentrateStation[station.code] != this.editModel.code));
return station.centralized;
// } else {
// return station.centralized && !( beConcentrateStation[station.code]);
// }
});
},
clear() { clear() {
this.editModel.managedSectionList = []; this.editModel.managedSectionList = [];
}, },
create() { create() {
const uid = getUID('ZcControl', this.zcList); const uid = getUID('ZcControl', this.zcList);
const models = []; let models = [];
const model = { const model = {
_type: 'ZcControl', _type: 'ZcControl',
code: uid, code: uid,
@ -195,8 +233,13 @@ export default {
} }
}; };
models.push(model); models.push(model);
model.concentrateStationList.forEach(stationCode=>{
const arr = this.setStationStand(stationCode, model.code);
models = [...models, ...arr];
});
this.$emit('updateMapModel', models); this.$emit('updateMapModel', models);
this.getConcertrateStation();
this.$refs.createForm.resetForm(); this.$refs.createForm.resetForm();
}, },
// //
@ -204,7 +247,11 @@ export default {
this.$refs['dataform'].validate((valid) => { this.$refs['dataform'].validate((valid) => {
if (valid) { if (valid) {
const data = Object.assign({_type: 'ZcControl'}, this.editModel); const data = Object.assign({_type: 'ZcControl'}, this.editModel);
const models = [data]; let models = [data];
data.concentrateStationList.forEach(stationCode=>{
const arr = this.setStationStand(stationCode, data.code);
models = [...models, ...arr];
});
this.$emit('updateMapModel', models); this.$emit('updateMapModel', models);
this.$emit('deviceSelect', ''); this.$emit('deviceSelect', '');
} }
@ -219,6 +266,16 @@ export default {
cancelButtonText: this.$t('tip.cancel'), cancelButtonText: this.$t('tip.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.concertrateStation.forEach(station=>{
selected.concentrateStationList.forEach(stationCode=>{
switch (stationCode) {
case station.code: {
this.setStationStand(station.code, '');
break;
}
}
});
});
this.$emit('updateMapModel', {...selected, _dispose: true}); this.$emit('updateMapModel', {...selected, _dispose: true});
this.$refs.dataform && this.$refs.dataform.resetFields(); this.$refs.dataform && this.$refs.dataform.resetFields();
}).catch(() => { }).catch(() => {
@ -226,6 +283,21 @@ export default {
}); });
} }
}, },
// ZC
setStationStand(stationCode, code) {
const arr = [];
this.stationList.forEach(elem=>{
if (elem.code == stationCode) {
const station = deepAssign({}, elem);
// const station = Object.assign({}, elem);
station.zcCode = code;
arr.push(station);
// this.$emit('updateMapModel', station);
}
});
return arr; // list
},
getName(code) { getName(code) {
const section = this.$store.getters['map/getDeviceByCode'](code); const section = this.$store.getters['map/getDeviceByCode'](code);
return section.name || ''; return section.name || '';