rt-sim-training-client/src/views/newMap/newMapdraft/mapoperate/stationstand.vue

547 lines
29 KiB
Vue
Raw Normal View History

2019-11-29 12:51:58 +08:00
<template>
<el-tabs v-model="activeName" class="card">
<el-tab-pane class="view-control" :label="$t('map.property')" name="first">
<div style="height: calc(100% - 46px);">
<el-scrollbar wrap-class="scrollbar-wrapper">
<config-list ref="dataform" :form="form" :form-model="editModel" :rules="rules" />
</el-scrollbar>
</div>
<div class="button_box">
<el-button-group class="map-draft-group">
2019-12-03 15:30:41 +08:00
<el-button type="primary" size="small" @click="edit">{{ $t('map.updateObj') }}</el-button>
2019-11-29 12:51:58 +08:00
<el-button type="danger" size="small" @click="deleteObj">{{ $t('map.deleteObj') }}</el-button>
</el-button-group>
</div>
</el-tab-pane>
<el-tab-pane class="view-control" :label="$t('map.newConstruction')" name="second">
<div style="height: calc(100% - 46px);">
<el-scrollbar wrap-class="scrollbar-wrapper">
<config-list ref="make" :form="addForm" :form-model="addModel" :rules="createRules" />
2019-11-29 12:51:58 +08:00
</el-scrollbar>
</div>
<div class="button_box">
<el-button-group class="map-draft-group">
<el-button type="primary" size="small" @click="create">{{ $t('map.create') }}</el-button>
</el-button-group>
</div>
</el-tab-pane>
<el-tab-pane class="view-control" :label="$t('map.batchSettings')" name="three">
<div style="height: 100%;">
<el-scrollbar wrap-class="scrollbar-wrapper">
<el-form ref="oprt" :model="allModel" label-width="130px" size="mini">
<el-form-item label="站台宽度:" prop="width">
<el-input-number v-model="allModel.width" style="width: 140px" />
</el-form-item>
<el-form-item label="站台高度:" prop="height">
<el-input-number v-model="allModel.height" style="width: 140px" />
</el-form-item>
<el-form-item>
<el-button-group>
<el-button type="primary" @click="batchSettings">{{ $t('global.set') }}</el-button>
</el-button-group>
</el-form-item>
</el-form>
</el-scrollbar>
</div>
</el-tab-pane>
2019-11-29 12:51:58 +08:00
</el-tabs>
</template>
<script>
import { mapGetters } from 'vuex';
2019-12-06 10:31:19 +08:00
import { getUID } from '@/jmapNew/utils/Uid';
2019-11-29 12:51:58 +08:00
import ConfigList from './config/list';
import { deepAssign } from '@/utils/index';
export default {
name: 'StationStandDraft',
components: {
ConfigList
},
props: {
selected: {
type: Object,
default: function () {
return null;
}
}
},
data() {
return {
activeName: 'first',
DoorLocationTypeList: [],
RunDirectionTypeList: [],
/*
{ code: '01', name: '朝下' },
{ code: '02', name: '朝上' }
*/
2019-12-13 13:10:11 +08:00
isRightList: [
{ code: false, name: '向左'},
{ code: true, name: '向右'}
2019-12-13 13:10:11 +08:00
],
reentryStrategyList: [
{ code: '02', name: '自动无人折返'},
{ code: '03', name: '自动换端'}
],
2019-11-29 12:51:58 +08:00
editModel: {
code: '',
name: '',
// doorLocationType: '', // 站台方向
deviceStationCode: '', // 设备集中站
// hasDoor: false, // 屏蔽门是否显示
2019-11-29 12:51:58 +08:00
width: 0,
height: 0,
stationCode: '', // 所属车站
position: { x: 0, y: 0 },
2019-12-13 13:10:11 +08:00
visible: true, // 是否显示
inside: false, // 内外站台显示
2019-12-18 13:05:29 +08:00
right: true,
2019-12-13 13:10:11 +08:00
standTrackCode: '',
2020-03-05 18:17:47 +08:00
small: false,
defaultReentryStrategy: '', // 默认折返策略
2020-03-05 18:17:47 +08:00
stopJumpLamp: false, // 跳停功能按钮
stopJumpLampPoint: {x: 0, y: 0}, // 跳停功能按钮坐标
cancelStopJumpLamp: false, // 取消跳停功能按钮
cancelStopJumpLampPoint: {x: 0, y: 0}, // 取消跳停功能按钮坐标
upDetainLamp: false, // 上行扣车功能按钮
upDetainLampPoint: {x: 0, y: 0}, // 上行扣车功能按钮坐标
downDetainLamp: false, // 下行扣车功能按钮
downDetainLampPoint: {x: 0, y: 0} // 下行扣车功能按钮坐标
// direction: '' // 上下行方向
2019-11-29 12:51:58 +08:00
},
2019-12-04 13:00:24 +08:00
field: '',
2019-11-29 12:51:58 +08:00
addModel: {
stationCode: '', // 所属车站
deviceStationCode: '', // 设备集中站
pointY: 0, // y坐标
width: 60,
height: 20,
standTrackCode: '', // 关联站台轨
standTrackUpCode: '', // 上行站台轨
standTrackDownCode: '', // 下行站台轨
2019-12-13 13:10:11 +08:00
stationstandDirection: '02', // 屏蔽门方向
2019-12-18 13:05:29 +08:00
right: true,
defaultReentryStrategy: '', // 默认折返策略
inside: false, // 内外站台
2020-03-05 18:17:47 +08:00
small: false,
stopJumpLamp: false, // 跳停功能按钮
stopJumpLampPoint: {x: 0, y: 0}, // 跳停功能按钮坐标
cancelStopJumpLamp: false, // 取消跳停功能按钮
cancelStopJumpLampPoint: {x: 0, y: 0}, // 取消跳停功能按钮坐标
upDetainLamp: false, // 上行扣车功能按钮
upDetainLampPoint: {x: 0, y: 0}, // 上行扣车功能按钮坐标
downDetainLamp: false, // 下行扣车功能按钮
downDetainLampPoint: {x: 0, y: 0} // 下行扣车功能按钮坐标
},
allModel: {
width: '',
height: ''
2019-11-29 12:51:58 +08:00
}
};
},
computed: {
...mapGetters('map', [
'stationList',
'stationStandList',
'sectionList',
2019-12-19 13:12:34 +08:00
'psdList',
'espList'
2019-11-29 12:51:58 +08:00
]),
form() {
const form = {
labelWidth: '130px',
items: {
code: {
name: '',
item: []
},
draw: {
name: this.$t('map.drawData'),
item: [
{ prop: 'code', label: this.$t('map.relStandCode'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.stationStandList, change: true, deviceChange: this.deviceChange },
{ prop: 'name', label: this.$t('map.stationstandNameColon'), type: 'input' },
2019-11-29 12:51:58 +08:00
{ prop: 'position', label: this.$t('map.stationstandPosition'), type: 'coordinate', width: '120px', children: [
{ prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' },
{ prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
2019-11-29 12:51:58 +08:00
] },
{ prop: 'visible', label: this.$t('map.stationVisible'), type: 'checkbox' },
{ prop: 'width', label: this.$t('map.stationstandWidth'), type: 'number', min: 0, max: 2000, placeholder: 'px' },
2019-12-13 13:10:11 +08:00
{ prop: 'height', label: this.$t('map.stationstandHeight'), type: 'number', min: 0, max: 2000, placeholder: 'px' },
2019-12-13 14:19:38 +08:00
{ prop: 'standTrackCode', label: '站台轨:', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.PhysicalSectionList, hover: this.hover, buttonType: 'editSectionSelectCode', buttonShowType: this.isButtonTypeES },
2019-12-18 13:05:29 +08:00
{ prop: 'right', label: '行驶方向:', type: 'radio', optionLabel: 'name', optionValue: 'code', border: true, radioList: this.isRightList },
{ prop: 'defaultReentryStrategy', label: '默认折返策略:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.reentryStrategyList },
{ prop: 'small', label: '是否小型站台:', type: 'checkbox', disabled: true },
2020-03-05 18:17:47 +08:00
{ prop: 'inside', label: '是否内站台:', type: 'checkbox' },
{ prop: 'stopJumpLamp', label: '跳停按钮:', type: 'checkbox'},
{ prop: 'stopJumpLampPoint', label: '跳停按钮坐标:', type: 'coordinate', width: '120px', isHidden: !this.isStopJumpPointsShow, children: [
{ prop: 'stopJumpLampPoint.x', firstLevel: 'stopJumpLampPoint', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' },
{ prop: 'stopJumpLampPoint.y', firstLevel: 'stopJumpLampPoint', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
] },
{ prop: 'cancelStopJumpLamp', label: '取消跳停按钮:', type: 'checkbox'},
{ prop: 'cancelStopJumpLampPoint', label: '取消跳停按钮坐标:', type: 'coordinate', width: '120px', isHidden: !this.isCancelStopJumpPointsShow, children: [
{ prop: 'cancelStopJumpLampPoint.x', firstLevel: 'cancelStopJumpLampPoint', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' },
{ prop: 'cancelStopJumpLampPoint.y', firstLevel: 'cancelStopJumpLampPoint', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
] },
{ prop: 'upDetainLamp', label: '上行扣车按钮:', type: 'checkbox'},
{ prop: 'upDetainLampPoint', label: '上行扣车按钮坐标:', type: 'coordinate', width: '120px', isHidden: !this.isUpDetainPointsShow, children: [
{ prop: 'upDetainLampPoint.x', firstLevel: 'upDetainLampPoint', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' },
{ prop: 'upDetainLampPoint.y', firstLevel: 'upDetainLampPoint', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
] },
{ prop: 'downDetainLamp', label: '下行扣车按钮:', type: 'checkbox'},
{ prop: 'downDetainLampPoint', label: '下行扣车坐标:', type: 'coordinate', width: '120px', isHidden: !this.isDownDetainPointsShow, children: [
{ prop: 'downDetainLampPoint.x', firstLevel: 'downDetainLampPoint', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' },
{ prop: 'downDetainLampPoint.y', firstLevel: 'downDetainLampPoint', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
] }
2019-11-29 12:51:58 +08:00
]
},
map: {
name: this.$t('map.mapData'),
item: [
{ prop: 'deviceStationCode', label: this.$t('map.equipmentStation'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.stationList, disabled:true},
{ prop: 'stationCode', label: this.$t('map.belongsStation'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.stationList, change: true, deviceChange: this.changeStation }
2019-11-29 12:51:58 +08:00
]
}
}
};
return form;
},
rules() {
const rules = {
code: [
{ required: true, message: this.$t('rules.pleaseReSelectDevice'), trigger: 'change' }
],
stationCode: [
{ required: true, message: this.$t('rules.stationCode'), trigger: 'change' }
],
name: [
{ required: true, message: this.$t('rules.stationstandCountName'), trigger: 'change' }
],
width: [
{ required: true, message: this.$t('rules.stationstandWidth'), trigger: 'change' }
],
height: [
{ required: true, message: this.$t('rules.stationstandHeight'), trigger: 'change' }
],
'position.x': [
{ required: true, message: this.$t('rules.trainPositionX'), trigger: 'change' }
],
'position.y': [
{ required: true, message: this.$t('rules.trainPositionY'), trigger: 'change' }
2019-12-13 13:10:11 +08:00
],
standTrackCode: [
{ required: true, message: '请选择关联站台轨', trigger: 'change' }
2019-11-29 12:51:58 +08:00
]
};
// 清空表单验证提示信息
this.$nextTick(() => {
this.$refs.dataform &&
this.$refs.dataform.clearValidate();
});
return rules;
},
addForm() {
return {
labelWidth: '130px',
items: {
stand: {
name: '站台数据',
item: [
{ prop: 'stationCode', label: this.$t('map.stationstandName'), type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.stationList, hover: this.hover, buttonType: 'standSelectStationCode', buttonShowType: this.isButtonType },
{ prop: 'pointY', label: 'Y 坐标:', type: 'number' },
{ prop: 'width', label: this.$t('map.stationstandWidth'), type: 'number', min: 0, max: 2000, placeholder: 'px' },
2019-12-13 13:10:11 +08:00
{ prop: 'height', label: this.$t('map.stationstandHeight'), type: 'number', min: 0, max: 2000, placeholder: 'px' },
2019-12-13 16:28:34 +08:00
{ prop: 'standTrackCode', label: '站台轨:', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.PhysicalSectionList, hover: this.hover, buttonType: 'sectionSelectCode', buttonShowType: this.isButtonTypeS },
2019-12-18 13:05:29 +08:00
{ prop: 'right', label: '行驶方向:', type: 'radio', optionLabel: 'name', optionValue: 'code', border: true, radioList: this.isRightList },
{ prop: 'defaultReentryStrategy', label: '默认折返策略:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.reentryStrategyList, clearable: true },
{ prop: 'small', label: '是否小型站台:', type: 'checkbox' },
2020-03-05 18:17:47 +08:00
{ prop: 'inside', label: '是否内站台:', type: 'checkbox' },
{ prop: 'stopJumpLamp', label: '跳停按钮:', type: 'checkbox'},
{ prop: 'stopJumpLampPoint', label: '跳停按钮坐标:', type: 'coordinate', width: '120px', isHidden: !this.isStopJumpPointsShow, children: [
{ prop: 'stopJumpLampPoint.x', firstLevel: 'stopJumpLampPoint', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' },
{ prop: 'stopJumpLampPoint.y', firstLevel: 'stopJumpLampPoint', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
] },
{ prop: 'cancelStopJumpLamp', label: '取消跳停按钮:', type: 'checkbox'},
{ prop: 'cancelStopJumpLampPoint', label: '取消跳停按钮坐标:', type: 'coordinate', width: '120px', isHidden: !this.isCancelStopJumpPointsShow, children: [
{ prop: 'cancelStopJumpLampPoint.x', firstLevel: 'cancelStopJumpLampPoint', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' },
{ prop: 'cancelStopJumpLampPoint.y', firstLevel: 'cancelStopJumpLampPoint', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
] },
{ prop: 'upDetainLamp', label: '上行扣车按钮:', type: 'checkbox'},
{ prop: 'upDetainLampPoint', label: '上行扣车按钮坐标:', type: 'coordinate', width: '120px', isHidden: !this.isUpDetainPointsShow, children: [
{ prop: 'upDetainLampPoint.x', firstLevel: 'upDetainLampPoint', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' },
{ prop: 'upDetainLampPoint.y', firstLevel: 'upDetainLampPoint', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
] },
{ prop: 'downDetainLamp', label: '下行扣车按钮:', type: 'checkbox'},
{ prop: 'downDetainLampPoint', label: '下行扣车坐标:', type: 'coordinate', width: '120px', isHidden: !this.isDownDetainPointsShow, children: [
{ prop: 'downDetainLampPoint.x', firstLevel: 'downDetainLampPoint', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' },
{ prop: 'downDetainLampPoint.y', firstLevel: 'downDetainLampPoint', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
] }
]
},
door: {
name: '屏蔽门数据',
item: [
2019-12-17 17:27:35 +08:00
{ prop: 'stationstandDirection', label: '屏蔽门朝向:', type: 'radio', optionLabel: 'label', optionValue: 'value', radioList: this.DoorLocationTypeList }
]
}
}
};
},
2019-11-29 12:51:58 +08:00
createRules() {
return {
stationCode: [
{ required: true, message: this.$t('rules.stationCode'), trigger: 'change' }
],
pointY: [
{ required: true, message: '请输入y坐标', trigger: 'blur' }
],
width: [
{ required: true, message: '请输入站台宽度', trigger: 'blur' }
],
height: [
{ required: true, message: '请输入站台高度', trigger: 'blur' }
],
standTrackCode: [
{ required: true, message: '请选择关联站台轨', trigger: 'change' }
2019-12-03 17:52:39 +08:00
]
2019-11-29 12:51:58 +08:00
};
},
isButtonType() {
return this.field == 'standSelectStationCode';
},
isButtonTypeS() {
return this.field == 'sectionSelectCode';
},
2019-12-13 14:19:38 +08:00
isButtonTypeES() {
return this.field === 'editSectionSelectCode';
},
2020-03-05 18:17:47 +08:00
isStopJumpPointsShow() {
return this.activeName === 'first' ? this.editModel.stopJumpLamp : this.addModel.stopJumpLamp;
},
isCancelStopJumpPointsShow() {
return this.activeName === 'first' ? this.editModel.cancelStopJumpLamp : this.addModel.cancelStopJumpLamp;
},
isUpDetainPointsShow() {
return this.activeName === 'first' ? this.editModel.upDetainLamp : this.addModel.upDetainLamp;
},
isDownDetainPointsShow() {
return this.activeName === 'first' ? this.editModel.downDetainLamp : this.addModel.downDetainLamp;
},
PhysicalSectionList() {
let list = [];
if (this.sectionList && this.sectionList.length) {
list = this.sectionList.filter(elem => { return elem.type === '01'; });
}
return list;
2019-11-29 12:51:58 +08:00
}
},
watch: {
selected: function (val, oldVal) {
this.deviceSelect(val);
}
},
mounted() {
this.$Dictionary.doorLocationType().then(list => {
this.DoorLocationTypeList = [];
list.forEach(item => {
const param = { value: item.code, label: item.name };
this.DoorLocationTypeList.push(param);
});
2019-11-29 12:51:58 +08:00
});
this.$Dictionary.runDirectionType().then(list => {
this.RunDirectionTypeList = list;
});
},
methods: {
deviceChange(code) {
this.$emit('setCenter', code);
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
2019-12-02 13:17:41 +08:00
},
2019-12-04 13:00:24 +08:00
hover(field) {
this.field = field === this.field ? '' : field;
2019-12-04 13:38:32 +08:00
this.$emit('standStationCode', this.field);
2019-12-04 13:00:24 +08:00
},
changeStation(station) {
this.editModel.deviceStationCode = this.getDeviceStationCode(station);
},
2019-11-29 12:51:58 +08:00
deviceSelect(selected) {
2019-12-04 13:00:24 +08:00
if (this.field.toUpperCase() != 'standSelectStationCode'.toUpperCase() && selected && selected._type.toUpperCase() === 'StationStand'.toUpperCase()) {
2019-12-04 13:38:32 +08:00
this.$refs.dataform.resetFields();
2019-11-29 12:51:58 +08:00
this.activeName = 'first';
this.editModel = deepAssign(this.editModel, selected);
2019-12-04 13:00:24 +08:00
}
if (selected && selected._type.toUpperCase() === 'Station'.toUpperCase() && this.field.toUpperCase() === 'standSelectStationCode'.toUpperCase()) {
2019-11-29 12:51:58 +08:00
this.addModel.stationCode = selected.code;
2019-12-04 13:00:24 +08:00
this.activeName = 'second';
this.field = '';
2019-12-04 13:38:32 +08:00
this.$emit('standStationCode', '');
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'sectionSelectCode'.toUpperCase()) {
this.addModel.standTrackCode = selected.code;
this.activeName = 'second';
this.field = '';
this.$emit('standStationCode', '');
2019-12-13 14:19:38 +08:00
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'editSectionSelectCode'.toUpperCase()) {
this.editModel.standTrackCode = selected.code;
this.activeName = 'first';
this.field = '';
this.$emit('standStationCode', '');
2019-11-29 12:51:58 +08:00
}
},
create() {
this.$refs.make.validate((valid) => {
if (valid) {
const models = [];
const space = this.$store.state.map.map.skinVO.code == '07' ? 0 : 8;
const Standuid = getUID('PF', this.stationStandList);
2019-11-29 12:51:58 +08:00
const model = {
_type: 'StationStand',
code: Standuid,
name: `PF${this.stationStandList.length + 1}`,
width: this.addModel.width,
height: this.addModel.height,
deviceStationCode: this.getDeviceStationCode(this.addModel.stationCode),
visible: true,
position: {
x: 0,
y: this.addModel.pointY
2019-12-13 13:10:11 +08:00
},
standTrackCode: this.addModel.standTrackCode,
2019-12-18 13:05:29 +08:00
right: this.addModel.right,
small: this.addModel.small,
2020-03-05 18:17:47 +08:00
inside: this.addModel.inside,
stopJumpLamp: this.addModel.stopJumpLamp, // 跳停功能按钮
stopJumpLampPoint: this.addModel.stopJumpLampPoint, // 跳停功能按钮坐标
cancelStopJumpLamp: this.addModel.cancelStopJumpLamp, // 取消跳停功能按钮
cancelStopJumpLampPoint: this.addModel.cancelStopJumpLampPoint, // 取消跳停功能按钮坐标
upDetainLamp: this.addModel.upDetainLamp, // 上行扣车功能按钮
upDetainLampPoint: this.addModel.upDetainLampPoint, // 上行扣车功能按钮坐标
downDetainLamp: this.addModel.downDetainLamp, // 下行扣车功能按钮
downDetainLampPoint: this.addModel.downDetainLampPoint // 下行扣车功能按钮坐标
2019-11-29 12:51:58 +08:00
};
this.stationList.forEach(elem => {
if (elem.code == this.addModel.stationCode) {
2019-11-29 12:51:58 +08:00
model.stationCode = elem.code;
}
});
2019-12-17 18:17:33 +08:00
const section = deepAssign({}, this.$store.getters['map/getDeviceByCode'](this.addModel.standTrackCode));
model.position.x = Math.abs(section.points[section.points.length - 1].x - section.points[0].x) / 2 + section.points[0].x;
models.push(model);
2019-12-13 14:19:38 +08:00
if (!this.addModel.small) {
const uid = getUID('Psd', this.psdList);
const param = {
_type: 'Psd',
code: uid,
name: `Psd${this.psdList.length + 1}`,
width: this.addModel.width,
height: this.$store.state.map.map.skinVO.code == '07' ? this.addModel.height : 3,
standCode: Standuid, // 关联站台唯一code
position: {
x: models[0].position.x,
y: this.addModel.pointY - (this.addModel.height / 2) - space
}
};
if (this.addModel.stationstandDirection == '01') { // 朝下
param.position.y = this.addModel.pointY + (this.addModel.height / 2) + space;
}
if (this.$store.state.map.map.skinVO.code == '07') {
param.position.y = this.addModel.pointY;
}
models.push(param);
2019-12-19 13:12:34 +08:00
const espUid = getUID('Esp', this.espList); // 创建紧急停车按钮
models.push({
_type: 'Esp',
code: espUid,
name: `Esp${this.espList.length + 1}`,
standCode: Standuid
});
}
section.standTrack = !this.addModel.small;
models.push(section);
this.$emit('updateMapModel', models);
2019-11-29 12:51:58 +08:00
}
});
},
getDeviceStationCode(stationCode) {
2019-12-18 10:01:58 +08:00
// 创建新站台的时候,判断该站台对应的车站是否集中站,如果不是集中站,判断该车站是否被控制
// 被控制的车站数据
let beCentralizedStation = {};
2019-12-19 13:14:29 +08:00
this.stationList.some(data=>{
2019-12-18 10:01:58 +08:00
if (data.centralized) {
if (data.code == stationCode) {
2019-12-18 10:01:58 +08:00
beCentralizedStation = {};
beCentralizedStation[stationCode] = data.code;
2019-12-19 13:14:29 +08:00
return true;
2019-12-18 10:01:58 +08:00
}
data.chargeStationCodeList.forEach(charge=>{
beCentralizedStation[charge] = data.code;
});
}
});
return beCentralizedStation[stationCode] || '';
2019-12-18 10:01:58 +08:00
},
2019-11-29 12:51:58 +08:00
// 修改对象
edit() {
this.$refs.dataform.validate((valid) => {
if (valid) {
const data = Object.assign({_type: 'StationStand'}, this.editModel);
this.$emit('updateMapModel', data);
}
});
},
// 删除对象
deleteObj() {
const selected = this.$store.getters['map/getDeviceByCode'](this.editModel.code);
if (selected && selected._type.toUpperCase() === 'StationStand'.toUpperCase()) {
const _that = this;
this.$confirm(this.$t('tip.confirmDeletion'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
2019-12-19 13:12:34 +08:00
const models = [];
models.push(deepAssign(selected, { _dispose: true }));
this.espList.forEach(item => {
if (item.standCode == selected.code) {
models.push(deepAssign(item, { _dispose: true }));
}
});
2019-12-23 09:15:25 +08:00
this.psdList.forEach(item => {
if (item.standCode == selected.code) {
models.push(deepAssign(item, { _dispose: true }));
}
});
2019-12-19 13:12:34 +08:00
_that.$emit('updateMapModel', models);
2019-11-29 12:51:58 +08:00
_that.deviceSelect();
2019-12-06 09:01:05 +08:00
this.$refs.dataform.resetFields();
2019-11-29 12:51:58 +08:00
}).catch(() => {
_that.$message.info(this.$t('tip.cancelledDelete'));
});
}
},
// 批量设置
batchSettings() {
const models = [];
this.stationStandList.forEach(stationStand => {
if (!stationStand.small) {
const model = deepAssign({}, stationStand);
model.width = this.allModel.width;
model.height = this.allModel.height;
models.push(model);
}
});
this.$emit('updateMapModel', models);
2019-11-29 12:51:58 +08:00
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.view-control{
height: 100%;
}
.card {
height: 100%;
}
</style>