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">
|
|
|
|
|
<el-button type="primary" size="small" @click="edit">{{ $t('map.updateObj') }}</el-button>
|
|
|
|
|
<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">
|
2019-12-05 18:01:09 +08:00
|
|
|
|
<el-button
|
2019-12-06 10:31:19 +08:00
|
|
|
|
icon="el-icon-plus"
|
|
|
|
|
circle
|
2019-12-05 18:01:09 +08:00
|
|
|
|
size="small"
|
2019-12-06 10:31:19 +08:00
|
|
|
|
style="position: absolute; right: 50px; top: 0px; z-index: 10;"
|
|
|
|
|
class="point-button"
|
|
|
|
|
@click="addModelList"
|
|
|
|
|
/>
|
2019-11-29 12:51:58 +08:00
|
|
|
|
<el-form ref="make" label-width="140px" :model="addModel" size="mini" :rules="mergeRules">
|
2019-12-05 18:01:09 +08:00
|
|
|
|
<el-form-item label="距区段高度:" prop="positionY">
|
|
|
|
|
<el-input-number v-model="addModel.positionY" />
|
2019-11-29 12:51:58 +08:00
|
|
|
|
</el-form-item>
|
2019-12-05 18:01:09 +08:00
|
|
|
|
<el-table :data="addModel.modelList" style="width: 100%">
|
2019-12-06 10:31:19 +08:00
|
|
|
|
<el-table-column label="计轴区段" prop="sectionName" width="160">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-select v-model="scope.row.sectionCode" filterable size="mini" placeholder="请选择">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in PhysicalSectionList"
|
|
|
|
|
:key="item.code"
|
|
|
|
|
:label="item.name + '(' + item.code +')'"
|
|
|
|
|
:value="item.code"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
2019-12-05 18:01:09 +08:00
|
|
|
|
<el-table-column label="车站名称">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-input v-model="scope.row.stationName" placeholder="请输入内容" size="mini" />
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="控制模式">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-checkbox v-model="scope.row.control" />
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="操作">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-button size="mini" type="text" @click="handleDelete(scope.$index, scope.row)">{{ $t('map.deleteObj') }}</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
2019-11-29 12:51:58 +08:00
|
|
|
|
</el-form>
|
|
|
|
|
</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-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: 'StationDraft',
|
|
|
|
|
components: {
|
|
|
|
|
ConfigList
|
|
|
|
|
},
|
|
|
|
|
props: {
|
|
|
|
|
selected: {
|
|
|
|
|
type: Object,
|
|
|
|
|
default: function () {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
activeName: 'first',
|
2019-12-06 10:31:19 +08:00
|
|
|
|
// field: '',
|
2019-12-03 13:24:22 +08:00
|
|
|
|
chargeStation:[],
|
2019-12-17 16:22:07 +08:00
|
|
|
|
controlled:false,
|
2019-11-29 12:51:58 +08:00
|
|
|
|
editModel: {
|
|
|
|
|
centralized: false,
|
2019-12-17 16:22:07 +08:00
|
|
|
|
// concentrateStationCode: '', // 所属集中站
|
2019-12-18 13:05:29 +08:00
|
|
|
|
ciStation: false, // 是否联锁站
|
2020-02-25 10:52:13 +08:00
|
|
|
|
depot:false, // 是否停车场或者车辆段
|
|
|
|
|
reentry:false, // 是否折返车站
|
2019-12-13 16:13:10 +08:00
|
|
|
|
number:'', // 编号
|
2019-11-29 12:51:58 +08:00
|
|
|
|
code: '',
|
|
|
|
|
zcCode: '',
|
|
|
|
|
visible: true,
|
|
|
|
|
runPlanName: '',
|
|
|
|
|
name: '',
|
|
|
|
|
nameFont: '',
|
|
|
|
|
nameFontColor: '#FFFFFF',
|
2019-12-13 16:13:10 +08:00
|
|
|
|
subheadDisplay:false,
|
|
|
|
|
subhead:'', // 副标题
|
|
|
|
|
subheadFont:'',
|
|
|
|
|
subheadFontColor:'#FFFFFF',
|
|
|
|
|
subheadPosition:{ x: 0, y: 0 },
|
2019-11-29 12:51:58 +08:00
|
|
|
|
kmPostShow: '',
|
|
|
|
|
kmRange: 0,
|
|
|
|
|
kmPost: '',
|
|
|
|
|
kmPostFont: '',
|
|
|
|
|
kmPostFontColor: '#FFFFFF',
|
|
|
|
|
isShowControlMode: '',
|
2019-12-03 13:24:22 +08:00
|
|
|
|
chargeStationCodeList:[],
|
2019-12-04 14:59:04 +08:00
|
|
|
|
position: { x: 0, y: 0 },
|
2019-12-12 15:31:01 +08:00
|
|
|
|
kilometerPosition: { x: 0, y: 0 }, // 公里标偏移坐标
|
2019-12-17 16:22:07 +08:00
|
|
|
|
// controlled:false,
|
2019-12-18 13:05:29 +08:00
|
|
|
|
createControlMode:false,
|
|
|
|
|
createTurnBack:false,
|
2020-03-05 16:39:49 +08:00
|
|
|
|
guideTotalLock: false,
|
|
|
|
|
guideTotalLockPoint: {x: 0, y: 0},
|
2019-12-06 10:31:19 +08:00
|
|
|
|
turnBackPoint: {x: 0, y: 0}, // 按图折返坐标
|
2019-12-04 18:39:28 +08:00
|
|
|
|
controlModePoint: { x: 0, y: 0 } // 控制模式坐标
|
2019-11-29 12:51:58 +08:00
|
|
|
|
},
|
|
|
|
|
addModel: {
|
2019-12-05 18:01:09 +08:00
|
|
|
|
modelList: [],
|
|
|
|
|
positionY: 0
|
2019-11-29 12:51:58 +08:00
|
|
|
|
},
|
|
|
|
|
skins: [],
|
|
|
|
|
mergeRules: {
|
2019-12-05 18:01:09 +08:00
|
|
|
|
positionY: [
|
|
|
|
|
{ required: true, message: '请输入高度值', trigger: 'blur' }
|
2019-11-29 12:51:58 +08:00
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
...mapGetters('map', [
|
|
|
|
|
'stationList',
|
|
|
|
|
'sectionList',
|
|
|
|
|
'zcList',
|
2019-12-03 14:56:18 +08:00
|
|
|
|
'lineCode',
|
|
|
|
|
'stationStandList'
|
2019-11-29 12:51:58 +08:00
|
|
|
|
]),
|
|
|
|
|
form() {
|
|
|
|
|
return {
|
|
|
|
|
labelWidth: '130px',
|
|
|
|
|
items: {
|
|
|
|
|
code: {
|
|
|
|
|
name: '',
|
|
|
|
|
item: []
|
|
|
|
|
},
|
|
|
|
|
draw: {
|
|
|
|
|
name: this.$t('map.drawData'),
|
|
|
|
|
item: [
|
|
|
|
|
{ prop: 'code', label: this.$t('map.stationCode'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.stationList, change: true, deviceChange: this.deviceChange },
|
|
|
|
|
{ prop: 'name', label: this.$t('map.stationName'), type: 'input' },
|
2019-12-13 14:58:28 +08:00
|
|
|
|
{ prop: 'number', label: this.$t('map.stationNumber'), type: 'input' },
|
2019-11-29 12:51:58 +08:00
|
|
|
|
{ prop: 'position', label: this.$t('map.stationPosition'), 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' }
|
|
|
|
|
] },
|
|
|
|
|
{ prop: 'visible', label: this.$t('map.stationstandShowName'), type: 'checkbox' },
|
|
|
|
|
{ prop: 'nameFont', label: this.$t('map.stationNameFont'), type: 'font', placeholder: this.$t('tip.stationFont') },
|
|
|
|
|
{ prop: 'nameFontColor', label: this.$t('map.stationNameFontColor'), type: 'color' },
|
2019-12-13 16:13:10 +08:00
|
|
|
|
{ prop: 'subheadDisplay', label: this.$t('map.subheadDisplay'), type: 'checkbox' },
|
|
|
|
|
{ prop: 'subhead', label: this.$t('map.subhead'), type: 'input', isHidden:!this.editModel.subheadDisplay },
|
|
|
|
|
{ prop: 'subheadFont', label: this.$t('map.subheadFont'), type: 'font', isHidden:!this.editModel.subheadDisplay },
|
|
|
|
|
{ prop: 'subheadFontColor', label: this.$t('map.subheadFontColor'), type: 'color', isHidden:!this.editModel.subheadDisplay },
|
|
|
|
|
{ prop: 'subheadPosition', label: this.$t('map.subheadPosition'), type: 'coordinate', width: '120px', isHidden:!this.editModel.subheadDisplay, children: [
|
|
|
|
|
{ prop: 'subheadPosition.x', firstLevel: 'subheadPosition', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' },
|
|
|
|
|
{ prop: 'subheadPosition.y', firstLevel: 'subheadPosition', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
|
|
|
|
|
] },
|
2020-02-25 10:52:13 +08:00
|
|
|
|
|
|
|
|
|
{ prop: 'depot', label: this.$t('map.isParkingArea'), type: 'checkbox' },
|
|
|
|
|
{ prop: 'reentry', label: this.$t('map.isReentryStation'), type: 'checkbox' },
|
|
|
|
|
|
2019-12-12 15:31:01 +08:00
|
|
|
|
{ prop: 'kilometerPosition', label: '公里标偏移坐标:', type: 'coordinate', width: '120px', children: [
|
|
|
|
|
{ prop: 'kilometerPosition.x', firstLevel: 'kilometerPosition', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' },
|
|
|
|
|
{ prop: 'kilometerPosition.y', firstLevel: 'kilometerPosition', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
|
|
|
|
|
] },
|
2019-11-29 12:51:58 +08:00
|
|
|
|
{ prop: 'kmRange', label: this.$t('map.stationKmRange'), type: 'number', min: 0, placeholder: this.$t('tip.meter') },
|
|
|
|
|
{ prop: 'kmPost', label: this.$t('map.stationKmPost'), type: 'input' },
|
|
|
|
|
{ prop: 'kmPostFont', label: this.$t('map.stationKmPostFont'), type: 'font', placeholder: this.$t('tip.kilometerFont') },
|
2019-12-04 18:39:28 +08:00
|
|
|
|
{ prop: 'kmPostFontColor', label: this.$t('map.stationKmPostFontColor'), type: 'color' },
|
2019-12-18 13:05:29 +08:00
|
|
|
|
{ prop: 'createControlMode', label: '控制模式:', type: 'checkbox', change:true, deviceChange:this.changeControlMode},
|
|
|
|
|
{ prop: 'controlModePoint', label: this.$t('map.stationControlPosition'), type: 'coordinate', width: '120px', isHidden:!this.editModel.createControlMode, children: [
|
2019-12-05 10:19:41 +08:00
|
|
|
|
{ prop: 'controlModePoint.x', firstLevel: 'controlModePoint', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px'},
|
|
|
|
|
{ prop: 'controlModePoint.y', firstLevel: 'controlModePoint', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px'}
|
|
|
|
|
] },
|
2019-12-18 13:05:29 +08:00
|
|
|
|
{ prop: 'createTurnBack', label: '按图折返:', type: 'checkbox' },
|
2019-12-06 10:31:19 +08:00
|
|
|
|
{ prop: 'turnBackPoint', label: '按图折返坐标:', type: 'coordinate', width: '120px', isHidden: !this.isPointsShow, children: [
|
|
|
|
|
{ prop: 'turnBackPoint.x', firstLevel: 'turnBackPoint', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' },
|
|
|
|
|
{ prop: 'turnBackPoint.y', firstLevel: 'turnBackPoint', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
|
2020-03-05 16:39:49 +08:00
|
|
|
|
] },
|
|
|
|
|
{ prop: 'guideTotalLock', label: '引导总锁:', type: 'checkbox'},
|
|
|
|
|
{ prop: 'guideTotalLockPoint', label: '引导总锁坐标:', type: 'coordinate', width: '120px', isHidden: !this.isGuidePointsShow, children: [
|
|
|
|
|
{ prop: 'guideTotalLockPoint.x', firstLevel: 'guideTotalLockPoint', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' },
|
|
|
|
|
{ prop: 'guideTotalLockPoint.y', firstLevel: 'guideTotalLockPoint', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
|
2019-12-06 10:31:19 +08:00
|
|
|
|
] }
|
2019-11-29 12:51:58 +08:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
map: {
|
|
|
|
|
name: this.$t('map.mapData'),
|
|
|
|
|
item: [
|
2019-12-18 13:05:29 +08:00
|
|
|
|
{ prop: 'ciStation', label: this.$t('map.isCIStation'), type: 'checkbox'},
|
2019-12-17 16:22:07 +08:00
|
|
|
|
{ prop: 'centralized', label: this.$t('map.centralized'), type: 'checkbox', disabled:this.controlled, change:true, deviceChange:this.changeCentralized },
|
2019-12-17 19:03:38 +08:00
|
|
|
|
{ prop: 'zcCode', label: this.$t('map.zcCode'), type: 'select', optionLabel: 'code&&name', optionValue: 'code', options: this.zcList, isHidden: !this.isZcCode, disabled:true },
|
2019-12-03 13:24:22 +08:00
|
|
|
|
{ prop: 'chargeStationCodeList', label: this.$t('map.chargeStationList'), type: 'multiSelect', optionLabel: 'name', optionValue: 'code', options: this.chargeStation, isHidden: !this.isZcCode, deviceChange:this.changeChargeStation},
|
2019-12-04 18:39:28 +08:00
|
|
|
|
{ prop: 'runPlanName', label: this.$t('map.stationRunPlanName'), type: 'input' }
|
2019-11-29 12:51:58 +08:00
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
rules() {
|
|
|
|
|
return {
|
|
|
|
|
code: [
|
|
|
|
|
{ required: true, message: this.$t('rules.selectEquipment'), trigger: 'change' }
|
|
|
|
|
],
|
|
|
|
|
name: [
|
|
|
|
|
{ required: true, message: this.$t('rules.stationName'), trigger: 'blur' }
|
|
|
|
|
],
|
|
|
|
|
kmRange: [
|
|
|
|
|
{ required: true, message: this.$t('rules.stationKmRange'), trigger: 'blur' }
|
|
|
|
|
],
|
|
|
|
|
kmPost: [
|
|
|
|
|
{ required: true, message: this.$t('rules.stationKmPost'), trigger: 'blur' }
|
|
|
|
|
],
|
|
|
|
|
'position.x': [
|
|
|
|
|
{ required: true, message: this.$t('rules.pleaseEnterXCoordinate'), trigger: 'blur' }
|
|
|
|
|
],
|
|
|
|
|
'position.y': [
|
|
|
|
|
{ required: true, message: this.$t('rules.pleaseEnterYCoordinate'), trigger: 'blur' }
|
|
|
|
|
]
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
PhysicalSectionList() {
|
|
|
|
|
let list = [];
|
|
|
|
|
if (this.sectionList && this.sectionList.length) {
|
2019-12-18 11:17:57 +08:00
|
|
|
|
list = this.sectionList.filter(elem => { return elem.type === '01' && !elem.switchSection; });
|
2019-11-29 12:51:58 +08:00
|
|
|
|
}
|
|
|
|
|
return list;
|
|
|
|
|
},
|
2019-12-05 10:25:07 +08:00
|
|
|
|
|
|
|
|
|
isPointsShow() {
|
2019-12-18 13:05:29 +08:00
|
|
|
|
return this.editModel.createTurnBack;
|
2019-12-05 10:25:07 +08:00
|
|
|
|
},
|
2020-03-05 16:39:49 +08:00
|
|
|
|
isGuidePointsShow() {
|
|
|
|
|
return this.editModel.guideTotalLock;
|
|
|
|
|
},
|
2019-11-29 12:51:58 +08:00
|
|
|
|
isZcCode() {
|
|
|
|
|
return this.editModel.centralized;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
selected: function (val) {
|
|
|
|
|
this.deviceSelect(val);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
deviceChange(code) {
|
|
|
|
|
this.$emit('setCenter', code);
|
|
|
|
|
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
|
|
|
|
|
},
|
|
|
|
|
deviceSelect(selected) {
|
2019-12-04 13:00:24 +08:00
|
|
|
|
// this.$refs.make.resetFields();
|
2019-12-06 10:31:19 +08:00
|
|
|
|
if (selected && selected._type.toUpperCase() === 'Station'.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);
|
|
|
|
|
this.editModel.runPlanName = selected.runPlanName || '';
|
2019-12-17 19:03:38 +08:00
|
|
|
|
// 被控制的车站数据
|
|
|
|
|
const beCentralizedStation = {};
|
2019-12-17 16:22:07 +08:00
|
|
|
|
this.stationList.forEach(data=>{
|
2019-12-17 19:03:38 +08:00
|
|
|
|
if (data.centralized) {
|
2019-12-17 16:22:07 +08:00
|
|
|
|
data.chargeStationCodeList.forEach(charge=>{
|
2019-12-17 19:03:38 +08:00
|
|
|
|
beCentralizedStation[charge] = data.code;
|
|
|
|
|
});
|
2019-12-17 16:22:07 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
2019-12-03 14:56:18 +08:00
|
|
|
|
// 筛选数据 去掉已经是集中站的数据,去掉自己本身,去掉被别的集中站选中的数据
|
2019-12-03 13:24:22 +08:00
|
|
|
|
this.chargeStation = this.stationList.filter(data=>{
|
2019-12-17 16:22:07 +08:00
|
|
|
|
return !data.centralized && data.code != this.editModel.code && !(beCentralizedStation[data.code] && beCentralizedStation[data.code] != this.editModel.code);
|
2019-12-03 13:24:22 +08:00
|
|
|
|
});
|
2019-12-17 19:03:38 +08:00
|
|
|
|
this.controlled = !!beCentralizedStation[selected.code];
|
2019-12-17 16:22:07 +08:00
|
|
|
|
// this.chargeStation = this.stationList.filter(data=>{
|
|
|
|
|
// return !data.centralized && data.code != this.editModel.code && !(data.controlled && data.concentrateStationCode != this.editModel.code);
|
|
|
|
|
// });
|
2019-11-29 12:51:58 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
2019-12-05 10:19:41 +08:00
|
|
|
|
changeControlMode(data) {
|
|
|
|
|
if (data) {
|
|
|
|
|
this.editModel.controlModePoint = {
|
|
|
|
|
x:this.editModel.position.x,
|
|
|
|
|
y:this.editModel.position.y + 30
|
|
|
|
|
};
|
|
|
|
|
} else {
|
|
|
|
|
this.editModel.controlModePoint = {
|
|
|
|
|
x:0,
|
|
|
|
|
y:0
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2019-12-03 14:56:18 +08:00
|
|
|
|
// 选择管理车站
|
2019-12-03 13:24:22 +08:00
|
|
|
|
changeChargeStation(data) {
|
|
|
|
|
if (data.length > 0) {
|
|
|
|
|
this.chargeStation.forEach(station=>{
|
|
|
|
|
const newModal = Object.assign({}, station);
|
2019-12-17 16:22:07 +08:00
|
|
|
|
// newModal.controlled = false;
|
|
|
|
|
// newModal.concentrateStationCode = '';
|
2019-12-03 17:52:39 +08:00
|
|
|
|
this.setStationStand(station, '');
|
2019-12-03 13:24:22 +08:00
|
|
|
|
data.forEach(each=>{
|
|
|
|
|
switch (each) {
|
|
|
|
|
case station.code: {
|
2019-12-17 16:22:07 +08:00
|
|
|
|
// newModal.controlled = true;
|
|
|
|
|
// newModal.concentrateStationCode = this.editModel.code;
|
2019-12-03 17:52:39 +08:00
|
|
|
|
this.setStationStand(station, this.editModel.code);
|
2019-12-03 13:24:22 +08:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.$emit('updateMapModel', newModal);
|
|
|
|
|
});
|
|
|
|
|
} else {
|
2019-12-03 15:22:16 +08:00
|
|
|
|
// 没有选中数据,直接将其他车站设置为非控制
|
2019-12-03 14:56:18 +08:00
|
|
|
|
this.modifyChargeStation();
|
2019-12-03 13:24:22 +08:00
|
|
|
|
}
|
|
|
|
|
this.edit();
|
|
|
|
|
},
|
|
|
|
|
changeCentralized(data) {
|
|
|
|
|
if (!data) {
|
2019-12-03 14:56:18 +08:00
|
|
|
|
// 将当前车站选为非集中站
|
2019-12-03 13:24:22 +08:00
|
|
|
|
this.editModel.chargeStationCodeList = [];
|
|
|
|
|
this.edit();
|
2019-12-03 14:56:18 +08:00
|
|
|
|
this.modifyChargeStation();
|
2019-12-03 15:22:16 +08:00
|
|
|
|
this.setStationStand(this.editModel, '');
|
2019-12-03 17:52:39 +08:00
|
|
|
|
} else {
|
2019-12-03 15:22:16 +08:00
|
|
|
|
this.setStationStand(this.editModel, this.editModel.code);
|
2019-12-03 13:24:22 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
2019-12-03 15:22:16 +08:00
|
|
|
|
modifyChargeStation() {
|
2019-12-03 14:56:18 +08:00
|
|
|
|
this.chargeStation.forEach(station=>{
|
|
|
|
|
const newModal = Object.assign({}, station);
|
2019-12-17 16:22:07 +08:00
|
|
|
|
// newModal.controlled = false;
|
|
|
|
|
// newModal.concentrateStationCode = '';
|
2019-12-03 14:56:18 +08:00
|
|
|
|
|
|
|
|
|
// 将原来被控制的车站下的站台,属性{所属设备集中站}设置为空
|
2019-12-03 15:22:16 +08:00
|
|
|
|
this.setStationStand(station, '');
|
|
|
|
|
|
2019-12-03 14:56:18 +08:00
|
|
|
|
this.$emit('updateMapModel', newModal);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 设置属性{所属设备集中站}
|
2019-12-03 15:22:16 +08:00
|
|
|
|
setStationStand(station, code) {
|
2019-12-03 14:56:18 +08:00
|
|
|
|
this.stationStandList.forEach(elem=>{
|
2019-12-03 15:22:16 +08:00
|
|
|
|
if (elem.stationCode == station.code) {
|
2019-12-03 14:56:18 +08:00
|
|
|
|
const stationStand = Object.assign({}, elem);
|
2019-12-03 15:22:16 +08:00
|
|
|
|
stationStand.deviceStationCode = code;
|
2019-12-03 14:56:18 +08:00
|
|
|
|
this.$emit('updateMapModel', stationStand);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
2019-12-06 10:31:19 +08:00
|
|
|
|
// hover(field) {
|
|
|
|
|
// this.field = field === this.field ? '' : field;
|
|
|
|
|
// this.$emit('stationSectionCode', this.field);
|
|
|
|
|
// },
|
2019-11-29 12:51:58 +08:00
|
|
|
|
create() {
|
|
|
|
|
this.$refs['make'].validate((valid) => {
|
|
|
|
|
if (valid) {
|
2019-12-05 18:01:09 +08:00
|
|
|
|
if (this.addModel.modelList.length) {
|
2019-12-04 15:33:08 +08:00
|
|
|
|
const models = [];
|
2019-12-05 18:01:09 +08:00
|
|
|
|
this.addModel.modelList.forEach((item) => {
|
2019-12-06 13:56:18 +08:00
|
|
|
|
const uid = getUID('Station', [...this.stationList, ...models]);
|
2019-12-04 15:33:08 +08:00
|
|
|
|
const model = {
|
|
|
|
|
_type: 'Station',
|
|
|
|
|
code: uid,
|
2019-12-05 18:01:09 +08:00
|
|
|
|
name: item.stationName,
|
2019-12-13 14:58:28 +08:00
|
|
|
|
number:'',
|
2019-12-13 16:13:10 +08:00
|
|
|
|
subheadDisplay:false,
|
2019-12-04 15:33:08 +08:00
|
|
|
|
zcCode: '',
|
|
|
|
|
runPlanName: '',
|
|
|
|
|
visible: true,
|
2019-12-10 15:44:46 +08:00
|
|
|
|
nameFont: '22px consolas',
|
2019-12-04 15:33:08 +08:00
|
|
|
|
nameFontColor: '#FFFFFF',
|
|
|
|
|
kmPost: '1000km~2000km',
|
|
|
|
|
kmPostShow: true,
|
|
|
|
|
kmPostFont: '8px consolas',
|
|
|
|
|
kmPostFontColor: '#FFFFFF',
|
2019-12-12 15:31:01 +08:00
|
|
|
|
kilometerPosition: { x: 0, y: 0 },
|
2019-12-04 15:33:08 +08:00
|
|
|
|
centralized: false,
|
2020-02-25 10:52:13 +08:00
|
|
|
|
depot:false,
|
|
|
|
|
reentry:false,
|
2019-12-17 16:22:07 +08:00
|
|
|
|
// concentrateStationCode: '',
|
|
|
|
|
// controlled: false,
|
2019-12-05 18:01:09 +08:00
|
|
|
|
chargeStationCodeList:[],
|
2019-12-18 13:05:29 +08:00
|
|
|
|
createControlMode: item.control,
|
2020-03-05 18:17:47 +08:00
|
|
|
|
guideTotalLock: false,
|
|
|
|
|
guideTotalLockPoint: {x: 0, y: 0},
|
2019-12-18 13:05:29 +08:00
|
|
|
|
createTurnBack: false,
|
2019-12-06 10:31:19 +08:00
|
|
|
|
turnBackPoint: {x: 0, y: 0} // 按图折返坐标
|
2019-12-04 15:33:08 +08:00
|
|
|
|
};
|
|
|
|
|
this.sectionList.forEach(elem => {
|
2019-12-05 18:01:09 +08:00
|
|
|
|
if (elem.code === item.sectionCode) {
|
2019-12-04 15:33:08 +08:00
|
|
|
|
const l = 0;
|
|
|
|
|
const r = elem.points.length - 1;
|
|
|
|
|
model.position = {
|
|
|
|
|
x: elem.points[l].x + (elem.points[r].x - elem.points[l].x) / 2,
|
2019-12-05 18:01:09 +08:00
|
|
|
|
y: elem.points[l].y - this.addModel.positionY
|
2019-12-04 15:33:08 +08:00
|
|
|
|
};
|
2019-12-05 18:01:09 +08:00
|
|
|
|
if (item.control) {
|
|
|
|
|
model.controlModePoint = {
|
|
|
|
|
x: elem.points[l].x + (elem.points[r].x - elem.points[l].x) / 2,
|
|
|
|
|
y: elem.points[l].y - this.addModel.positionY + 30
|
|
|
|
|
};
|
|
|
|
|
}
|
2019-12-04 15:33:08 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
models.push(model);
|
2019-11-29 12:51:58 +08:00
|
|
|
|
});
|
2019-12-04 15:33:08 +08:00
|
|
|
|
this.$emit('updateMapModel', models);
|
2019-12-05 18:01:09 +08:00
|
|
|
|
this.addModel = {
|
|
|
|
|
modelList: [],
|
|
|
|
|
positionY: 0
|
|
|
|
|
};
|
|
|
|
|
} else {
|
|
|
|
|
this.$message('请添加数据');
|
2019-11-29 12:51:58 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 修改对象
|
|
|
|
|
edit() {
|
|
|
|
|
this.$refs['dataform'].validate((valid) => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
const data = Object.assign({_type: 'Station'}, this.editModel);
|
|
|
|
|
this.$emit('updateMapModel', data);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 删除对象
|
|
|
|
|
deleteObj() {
|
|
|
|
|
const selected = this.$store.getters['map/getDeviceByCode'](this.editModel.code);
|
|
|
|
|
if (selected && selected._type.toUpperCase() === 'Station'.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(() => {
|
|
|
|
|
_that.$emit('updateMapModel', {...selected, _dispose: true});
|
|
|
|
|
_that.deviceSelect();
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
_that.$message.info(this.$t('tip.cancelledDelete'));
|
|
|
|
|
});
|
|
|
|
|
}
|
2019-12-05 10:25:07 +08:00
|
|
|
|
},
|
2019-12-05 18:01:09 +08:00
|
|
|
|
handleDelete(index, row) {
|
|
|
|
|
this.addModel.modelList.splice(index, 1);
|
2019-12-06 10:31:19 +08:00
|
|
|
|
},
|
|
|
|
|
addModelList() {
|
|
|
|
|
this.addModel.modelList.push({
|
|
|
|
|
sectionCode: '',
|
|
|
|
|
sectionName: '',
|
|
|
|
|
stationName: `车站 ${this.addModel.modelList.length + 1}`,
|
|
|
|
|
control: false
|
|
|
|
|
});
|
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>
|