2020-03-05 16:39:49 +08:00
|
|
|
<template>
|
|
|
|
<el-tabs v-model="activeName" class="card" @tab-click="handleClick">
|
2020-04-30 14:50:27 +08:00
|
|
|
<el-tab-pane class="view-control" :label="$t('map.property')" name="first" :lazy="lazy">
|
2020-07-16 10:50:59 +08:00
|
|
|
<div class="view-control-content">
|
2020-07-16 16:18:13 +08:00
|
|
|
<config-list ref="dataform" :form="form" :form-model="editModel" :rules="rules">
|
2020-08-24 11:30:57 +08:00
|
|
|
<fieldset v-if="editModel.type == 'StationTurnBack'" class="card-box">
|
2020-08-28 14:43:30 +08:00
|
|
|
<legend class="card_title">站后折返数据</legend>
|
2020-07-16 16:18:13 +08:00
|
|
|
<div>
|
|
|
|
<el-table :data="editModel.optionList" border style="width: 100%">
|
2020-08-24 11:30:57 +08:00
|
|
|
<el-table-column prop="id" label="编号" width="50px" />
|
|
|
|
<el-table-column prop="label" label="描述" />
|
2020-08-28 14:43:30 +08:00
|
|
|
<el-table-column label="配置默认" width="100px">
|
2020-08-24 11:30:57 +08:00
|
|
|
<template slot-scope="scope">
|
2020-08-28 14:43:30 +08:00
|
|
|
<el-checkbox v-model="scope.row.checked" @click.native.prevent="checkOverlab(editModel.optionList, scope.$index)" />
|
2020-08-24 11:30:57 +08:00
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column label="操作" width="100px">
|
2020-07-16 16:18:13 +08:00
|
|
|
<template slot-scope="scope">
|
|
|
|
<el-button type="text" size="small" @click.native.prevent="deleteOverlab(editModel.optionList, scope.$index)">移出</el-button>
|
|
|
|
<el-button type="text" size="small" @click.native.prevent="editOverlab(editModel.optionList, scope.$index)">编辑</el-button>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table>
|
|
|
|
<el-card class="box-card" shadow="never">
|
|
|
|
<div slot="header" class="clearfix">
|
|
|
|
<span style="font-size: 12px;">{{ cardTitle }}</span>
|
|
|
|
<el-button v-if="cardMode === 'generate'" style="float: right; padding: 3px 0" type="text" @click="generateOverlab">生成</el-button>
|
|
|
|
<el-button-group v-else-if=" cardMode === 'edit'" style="float: right;">
|
|
|
|
<el-button type="text" style="padding:3px 3px" @click="updateOverlab">修改</el-button>
|
|
|
|
<el-button type="text" style="padding:3px 0" @click="cancelOverlab">取消</el-button>
|
|
|
|
</el-button-group>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<el-form ref="hostileForm" :model="addBackModel" :rules="addBackRules" label-width="135px" size="mini" style="margin-top: 15px;padding-right: 10px;">
|
|
|
|
<el-form-item label="类型:" prop="type">
|
|
|
|
<el-select v-model="addBackModel.type" clearable :filterable="true">
|
|
|
|
<el-option v-for="item in turnBackList" :key="item.value" :label="item.name" :value="item.value" />
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="描述:" prop="label">
|
|
|
|
<el-input v-model="addBackModel.label" type="text" maxlength="30" :show-word-limit="true" />
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item v-if="addBackModel.type != 'NONE'" label="折返轨:" prop="sectionList">
|
2020-07-17 15:45:44 +08:00
|
|
|
<el-select v-model="addBackModel.sectionList" clearable multiple filterable>
|
|
|
|
<el-option v-for="item in sectionList" :key="item.code" :label="`${item.name}(${item.code})`" :value="item.code" />
|
2020-07-16 16:18:13 +08:00
|
|
|
</el-select>
|
|
|
|
<el-button :type="field === 'sectionCode1' ? 'danger' : 'primary'" @click="hover('sectionCode1')">激活</el-button>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form>
|
|
|
|
</div>
|
|
|
|
</el-card>
|
2020-06-04 17:29:18 +08:00
|
|
|
</div>
|
2020-08-24 11:30:57 +08:00
|
|
|
</fieldset>
|
2020-07-16 16:18:13 +08:00
|
|
|
</config-list>
|
2020-03-05 16:39:49 +08:00
|
|
|
</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>
|
2020-04-30 14:50:27 +08:00
|
|
|
<el-tab-pane class="view-control" :label="$t('map.newConstruction')" name="second" :lazy="lazy">
|
2020-07-24 17:51:55 +08:00
|
|
|
<create-operate
|
|
|
|
ref="createForm"
|
|
|
|
:create-form="formMake"
|
|
|
|
:add-model="addModel"
|
|
|
|
:create-rules="createRules"
|
|
|
|
@create="create"
|
|
|
|
/>
|
2020-03-05 16:39:49 +08:00
|
|
|
</el-tab-pane>
|
|
|
|
</el-tabs>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { mapGetters } from 'vuex';
|
|
|
|
import { getUID } from '@/jmapNew/utils/Uid';
|
|
|
|
import ConfigList from './config/list';
|
2020-07-24 17:51:55 +08:00
|
|
|
import CreateOperate from './components/createOperate';
|
2020-03-05 16:39:49 +08:00
|
|
|
import { deepAssign } from '@/utils/index';
|
2020-03-17 16:12:15 +08:00
|
|
|
import { getRouteNewList, getAutoReentryList } from '@/api/jmap/mapdraft';
|
2020-03-05 16:39:49 +08:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'AutoMaticRoute',
|
|
|
|
components: {
|
|
|
|
ConfigList,
|
2020-07-24 17:51:55 +08:00
|
|
|
CreateOperate
|
2020-03-05 16:39:49 +08:00
|
|
|
},
|
|
|
|
props: {
|
|
|
|
selected: {
|
|
|
|
type: Object,
|
|
|
|
default: function () {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
activeName: 'first',
|
2020-04-30 14:50:27 +08:00
|
|
|
lazy: true,
|
2020-03-05 16:39:49 +08:00
|
|
|
autoList: [],
|
2020-06-04 17:29:18 +08:00
|
|
|
field: '',
|
|
|
|
turnBackList: [
|
|
|
|
{ name: '按计划执行', value: 'NONE' },
|
|
|
|
{ name: '仅某个折返轨', value: 'ONLY' },
|
|
|
|
{ name: '等价折返', value: 'EQUAL' },
|
|
|
|
{ name: '优先/次之', value: 'FIRST' }
|
|
|
|
],
|
2020-03-17 16:12:15 +08:00
|
|
|
typeList: [
|
2020-03-18 09:10:57 +08:00
|
|
|
{ name: '自动折返', value: 'AutoTurnBack' },
|
2020-03-17 16:12:15 +08:00
|
|
|
{ name: '计轴复位', value: 'AxleReset' },
|
|
|
|
{ name: '自动进路', value: 'AutomaticRoute' },
|
|
|
|
{ name: '引导总锁', value: 'GuideLock' },
|
2020-06-04 17:29:18 +08:00
|
|
|
{ name: '全线临时限速', value: 'LimitControl' },
|
|
|
|
{ name: '站后折返', value: 'StationTurnBack' }
|
2020-03-17 16:12:15 +08:00
|
|
|
],
|
2020-06-04 17:29:18 +08:00
|
|
|
cardMode: 'generate',
|
|
|
|
addBackModel: {
|
|
|
|
id: '',
|
|
|
|
type: '',
|
|
|
|
label: '',
|
|
|
|
sectionList: [],
|
|
|
|
parentIndex: 0
|
|
|
|
},
|
2020-03-05 16:39:49 +08:00
|
|
|
editModel: {
|
|
|
|
code: '',
|
2020-03-17 16:12:15 +08:00
|
|
|
type: '',
|
2020-03-05 16:39:49 +08:00
|
|
|
name: '',
|
2020-06-04 17:29:18 +08:00
|
|
|
show: true, // 站后折返显示
|
2020-08-28 14:43:30 +08:00
|
|
|
subtitleName: '',
|
|
|
|
initId: '',
|
2020-06-04 17:29:18 +08:00
|
|
|
optionList: [], // 战后折返列表
|
2020-03-05 16:39:49 +08:00
|
|
|
automaticRouteCode: '', // 关联自动进路code
|
2020-03-17 16:12:15 +08:00
|
|
|
cycleCode: '', // 自动折返关联code
|
|
|
|
stationCode: '', // 所属设备集中站
|
2020-03-05 16:39:49 +08:00
|
|
|
position: {
|
|
|
|
x: 0,
|
|
|
|
y: 0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
addModel: {
|
|
|
|
code: '',
|
2020-03-17 16:12:15 +08:00
|
|
|
type: '',
|
2020-03-05 16:39:49 +08:00
|
|
|
name: '',
|
2020-03-17 16:12:15 +08:00
|
|
|
subtitleName: '',
|
2020-03-05 16:39:49 +08:00
|
|
|
automaticRouteCode: '', // 关联自动进路code
|
2020-03-17 16:12:15 +08:00
|
|
|
cycleCode: '', // 自动折返关联code
|
|
|
|
stationCode: '', // 所属设备集中站
|
2020-03-05 16:39:49 +08:00
|
|
|
position: {
|
|
|
|
x: 0,
|
|
|
|
y: 0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
rules: {
|
|
|
|
code: [
|
|
|
|
{ required: true, message: this.$t('rules.pleaseSelectEncoding'), trigger: 'change' }
|
|
|
|
],
|
|
|
|
name: [
|
|
|
|
{ required: true, message: this.$t('rules.pleaseEnterStatusSignal'), trigger: 'blur' }
|
|
|
|
],
|
|
|
|
'position.x': [
|
|
|
|
{ required: true, message: this.$t('rules.trainPositionX'), trigger: 'blur' }
|
|
|
|
],
|
|
|
|
'position.y': [
|
|
|
|
{ required: true, message: this.$t('rules.trainPositionY'), trigger: 'blur' }
|
|
|
|
]
|
2020-06-04 17:29:18 +08:00
|
|
|
},
|
|
|
|
addBackRules: {
|
|
|
|
type: [
|
|
|
|
{ required: true, message: '请选择类型', trigger: 'change' }
|
|
|
|
],
|
|
|
|
label: [
|
|
|
|
{ required: true, message: '请填写描述', trigger: 'blur' }
|
|
|
|
],
|
|
|
|
sectionList: [
|
|
|
|
{ required: true, message: '请选择站台轨', trigger: 'change' }
|
|
|
|
]
|
2020-03-05 16:39:49 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
...mapGetters('map', [
|
2020-03-17 16:12:15 +08:00
|
|
|
'automaticRouteButtonList',
|
|
|
|
'cycleButtonList',
|
|
|
|
'tempSpeedLimitList',
|
|
|
|
'axleCounterResetButtonList',
|
|
|
|
'totalGuideLockButtonVOList',
|
2020-06-04 17:29:18 +08:00
|
|
|
'stationList',
|
|
|
|
'sectionList',
|
|
|
|
'tbStrategyList'
|
2020-03-05 16:39:49 +08:00
|
|
|
]),
|
2020-06-04 17:29:18 +08:00
|
|
|
cardTitle() {
|
|
|
|
if (this.cardMode === 'generate') {
|
|
|
|
return '生成数据';
|
|
|
|
} else if (this.cardMode === 'edit') {
|
|
|
|
return '编辑数据';
|
|
|
|
} else {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
},
|
2020-03-05 16:39:49 +08:00
|
|
|
form() {
|
|
|
|
const form = {
|
|
|
|
labelWidth: '150px',
|
|
|
|
items: {
|
|
|
|
code: {
|
|
|
|
name: '',
|
|
|
|
item: []
|
|
|
|
},
|
|
|
|
draw: {
|
|
|
|
name: this.$t('map.drawData'),
|
|
|
|
item: [
|
2020-07-27 16:11:29 +08:00
|
|
|
{ prop:'type', label: this.$t('map.functionButtonType'), type: 'select', optionLabel: 'name', optionValue: 'value', options: this.typeList, deviceChange: this.typeChange },
|
|
|
|
{ prop: 'code', label: `${this.$t('map.code')}`, type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.selectLists, deviceChange: this.deviceChange },
|
2020-03-24 18:42:18 +08:00
|
|
|
{ prop: 'name', label: this.$t('map.buttonMainName'), type: 'input' },
|
2020-06-04 17:29:18 +08:00
|
|
|
{ prop: 'show', label: '是否显示:', type: 'checkbox', isHidden: !this.isTurnBackShow },
|
|
|
|
{ prop: 'subtitleName', label: this.$t('map.buttonViceName'), type: 'input', isHidden: !this.isHiddensubtitleNameVO },
|
2020-03-24 18:42:18 +08:00
|
|
|
{ prop: 'position', label: this.$t('map.textPoints'), type: 'coordinate', width: '140px', children: [
|
2020-03-05 16:39:49 +08:00
|
|
|
{ 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' }
|
|
|
|
] },
|
2020-07-27 16:11:29 +08:00
|
|
|
{ prop:'automaticRouteCode', label: this.$t('map.automaticRouteCode'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.autoList, isHidden: !this.isHiddenAutomaticRoute, deviceChange: this.changeEditStation },
|
|
|
|
{ prop:'cycleCode', label: this.$t('map.cycleCode'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.autoList, isHidden: !this.isHiddenMapCycleButtonVO, deviceChange: this.changeEditStation },
|
2020-06-04 17:29:18 +08:00
|
|
|
{ prop:'stationCode', label: '所属车站', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.stationList, disabled: this.isDisabledStation, isHidden: !this.isHiddenStation }
|
2020-03-05 16:39:49 +08:00
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
return form;
|
|
|
|
},
|
|
|
|
formMake() {
|
|
|
|
const form = {
|
|
|
|
labelWidth: '150px',
|
2020-07-27 16:11:29 +08:00
|
|
|
items: {
|
|
|
|
all:{
|
|
|
|
name:'',
|
|
|
|
item: [
|
|
|
|
{ prop:'type', label: this.$t('map.functionButtonType'), type: 'select', optionLabel: 'name', optionValue: 'value', options: this.typeList, deviceChange: this.typeChange },
|
|
|
|
{ prop: 'name', label: this.$t('map.buttonMainName'), type: 'input' },
|
|
|
|
{ prop: 'position', label: this.$t('map.textPoints'), type: 'coordinate', width: '140px', 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:'automaticRouteCode', label: this.$t('map.automaticRouteCode'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.autoList, isHidden: !this.isHiddenCreateAutomaticRoute, deviceChange: this.changeStation },
|
|
|
|
{ prop:'cycleCode', label: this.$t('map.cycleCode'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.autoList, isHidden: !this.isHiddenCreateMapCycleButtonVO, deviceChange: this.changeStation },
|
|
|
|
{ prop:'stationCode', label: '所属车站', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.stationList, disabled: this.isDisabledCreateStation, isHidden: !this.isHiddenCreateStation }
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
2020-03-05 16:39:49 +08:00
|
|
|
};
|
|
|
|
return form;
|
|
|
|
},
|
|
|
|
createRules: function () {
|
|
|
|
return {
|
2020-03-17 16:12:15 +08:00
|
|
|
type: [
|
2020-03-24 18:42:18 +08:00
|
|
|
{ required: true, message: this.$t('rules.selectFunctionType'), trigger: 'change' }
|
2020-03-05 16:39:49 +08:00
|
|
|
],
|
|
|
|
name: [
|
2020-03-24 18:42:18 +08:00
|
|
|
{ required: true, message: this.$t('rules.pleaseInputName'), trigger: 'blur' }
|
2020-03-05 16:39:49 +08:00
|
|
|
],
|
|
|
|
'position.x': [
|
|
|
|
{ required: true, message: this.$t('rules.trainPositionX'), trigger: 'blur' }
|
|
|
|
],
|
|
|
|
'position.y': [
|
|
|
|
{ required: true, message: this.$t('rules.trainPositionY'), trigger: 'blur' }
|
|
|
|
]
|
|
|
|
};
|
2020-03-17 16:12:15 +08:00
|
|
|
},
|
|
|
|
isHiddenAutomaticRoute() {
|
2020-04-14 15:45:13 +08:00
|
|
|
return this.editModel.type === 'AutomaticRoute';
|
2020-03-17 16:12:15 +08:00
|
|
|
},
|
|
|
|
isHiddenMapCycleButtonVO() {
|
2020-03-18 09:10:57 +08:00
|
|
|
return this.editModel.type == 'AutoTurnBack';
|
2020-03-17 16:12:15 +08:00
|
|
|
},
|
2020-06-04 17:29:18 +08:00
|
|
|
isTurnBackShow() {
|
|
|
|
return this.editModel.type == 'StationTurnBack';
|
|
|
|
},
|
|
|
|
isHiddensubtitleNameVO() {
|
|
|
|
return this.editModel.type != 'StationTurnBack';
|
|
|
|
},
|
2020-03-17 16:12:15 +08:00
|
|
|
isDisabledStation() {
|
2020-03-18 09:10:57 +08:00
|
|
|
return this.editModel.type == 'AutoTurnBack' || this.editModel.type == 'AutomaticRoute';
|
2020-03-17 16:12:15 +08:00
|
|
|
},
|
|
|
|
isHiddenStation() {
|
2020-06-04 17:29:18 +08:00
|
|
|
return this.editModel.type == 'AutoTurnBack' || this.editModel.type == 'GuideLock' || this.editModel.type == 'AxleReset' || this.editModel.type == 'StationTurnBack';
|
2020-03-17 16:12:15 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
isHiddenCreateAutomaticRoute() {
|
|
|
|
return this.addModel.type == 'AutomaticRoute';
|
|
|
|
},
|
|
|
|
isHiddenCreateMapCycleButtonVO() {
|
2020-03-18 09:10:57 +08:00
|
|
|
return this.addModel.type == 'AutoTurnBack';
|
2020-03-17 16:12:15 +08:00
|
|
|
},
|
|
|
|
isDisabledCreateStation() {
|
2020-03-18 09:10:57 +08:00
|
|
|
return this.addModel.type == 'AutoTurnBack' || this.addModel.type == 'AutomaticRoute';
|
2020-03-17 16:12:15 +08:00
|
|
|
},
|
|
|
|
isHiddenCreateStation() {
|
2020-06-04 17:29:18 +08:00
|
|
|
return this.addModel.type == 'AutoTurnBack' || this.addModel.type == 'GuideLock' || this.addModel.type == 'AxleReset' || this.addModel.type == 'StationTurnBack';
|
2020-03-05 16:39:49 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
},
|
|
|
|
methods: {
|
2020-03-18 10:53:42 +08:00
|
|
|
setStation(data) {
|
|
|
|
if (data.automaticRouteCode) {
|
|
|
|
this.changeEditStation(data.automaticRouteCode);
|
|
|
|
}
|
|
|
|
if (data.cycleCode) {
|
|
|
|
this.changeEditStation(data.cycleCode);
|
|
|
|
}
|
|
|
|
},
|
2020-06-04 17:58:42 +08:00
|
|
|
clearInfo() {
|
2020-03-17 16:12:15 +08:00
|
|
|
this.addModel.automaticRouteCode = '';
|
|
|
|
this.addModel.cycleCode = '';
|
|
|
|
this.addModel.concentrateStationList = '';
|
2020-06-04 17:58:42 +08:00
|
|
|
this.editModel = {
|
|
|
|
code: '',
|
|
|
|
type: '',
|
|
|
|
name: '',
|
2020-08-28 14:43:30 +08:00
|
|
|
show: true, // 站后折返显示
|
|
|
|
initId: '',
|
2020-06-04 17:58:42 +08:00
|
|
|
subtitleName: '',
|
|
|
|
optionList: [], // 战后折返列表
|
|
|
|
automaticRouteCode: '', // 关联自动进路code
|
|
|
|
cycleCode: '', // 自动折返关联code
|
|
|
|
stationCode: '', // 所属设备集中站
|
|
|
|
position: {
|
|
|
|
x: 0,
|
|
|
|
y: 0
|
|
|
|
}
|
2020-06-05 10:14:12 +08:00
|
|
|
};
|
2020-06-04 17:58:42 +08:00
|
|
|
},
|
|
|
|
typeChange(type) { // 根据类型来选择功能按钮列表
|
|
|
|
this.$refs.dataform && this.$refs.dataform.resetFields();
|
2020-07-24 17:51:55 +08:00
|
|
|
this.$refs.createForm && this.$refs.createForm.resetFields();
|
2020-06-04 17:58:42 +08:00
|
|
|
this.clearInfo();
|
|
|
|
this.addModel.type = type;
|
|
|
|
this.editModel.type = type;
|
2020-03-17 16:12:15 +08:00
|
|
|
this.handleTypes(type);
|
|
|
|
},
|
|
|
|
handleTypes(type) {
|
|
|
|
switch (type) {
|
2020-03-18 09:10:57 +08:00
|
|
|
case 'AutoTurnBack':
|
2020-03-17 16:12:15 +08:00
|
|
|
this.selectLists = this.cycleButtonList;
|
|
|
|
this.getAutoTurnBackList();
|
|
|
|
break;
|
|
|
|
case 'AxleReset':
|
|
|
|
this.selectLists = this.axleCounterResetButtonList;
|
|
|
|
break;
|
|
|
|
case 'AutomaticRoute':
|
|
|
|
this.selectLists = this.automaticRouteButtonList;
|
|
|
|
this.getAutoMaticList();
|
|
|
|
break;
|
|
|
|
case 'LimitControl':
|
|
|
|
this.selectLists = this.tempSpeedLimitList;
|
|
|
|
break;
|
|
|
|
case 'GuideLock':
|
|
|
|
this.selectLists = this.totalGuideLockButtonVOList;
|
|
|
|
break;
|
2020-06-04 17:29:18 +08:00
|
|
|
case 'StationTurnBack':
|
|
|
|
this.selectLists = this.tbStrategyList;
|
|
|
|
break;
|
2020-03-17 16:12:15 +08:00
|
|
|
}
|
|
|
|
},
|
2020-03-18 10:53:42 +08:00
|
|
|
changeStation(code) { // 选择对应的所属设备集中站
|
2020-03-17 16:12:15 +08:00
|
|
|
this.autoList.forEach(elem => {
|
|
|
|
if (elem.code == code) {
|
|
|
|
this.addModel.stationCode = elem.stationCode;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
2020-03-18 10:53:42 +08:00
|
|
|
changeEditStation(code) { // 选择对应的所属设备集中站
|
2020-03-18 09:10:57 +08:00
|
|
|
this.autoList.forEach(elem => {
|
|
|
|
if (elem.code == code) {
|
|
|
|
this.editModel.stationCode = elem.stationCode;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
2020-03-05 16:39:49 +08:00
|
|
|
deviceChange(code) {
|
|
|
|
this.$emit('setCenter', code);
|
|
|
|
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
|
|
|
|
},
|
|
|
|
handleClick() {
|
|
|
|
this.getAutoMaticList();
|
|
|
|
},
|
|
|
|
deviceSelect(selected) {
|
2020-06-04 17:29:18 +08:00
|
|
|
if (selected && selected._type.toUpperCase() == 'AutomaticRoute'.toUpperCase() || selected._type.toUpperCase() == 'AutoTurnBack'.toUpperCase() || selected._type.toUpperCase() == 'AxleReset'.toUpperCase() || selected._type.toUpperCase() == 'LimitControl'.toUpperCase() || selected._type.toUpperCase() == 'GuideLock'.toUpperCase() || selected._type.toUpperCase() == 'StationTurnBack'.toUpperCase()) {
|
|
|
|
this.handleTypes(selected._type);
|
|
|
|
this.$refs.dataform && this.$refs.dataform.resetFields();
|
|
|
|
this.$refs.make && this.$refs.make.resetFields();
|
2020-08-28 14:43:30 +08:00
|
|
|
this.activeName = 'first';
|
|
|
|
if (selected.optionList) {
|
|
|
|
selected.optionList.forEach(item => {
|
|
|
|
item.checked = false;
|
|
|
|
if (item.id == selected.initId) {
|
|
|
|
item.checked = true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2020-03-05 16:39:49 +08:00
|
|
|
this.editModel = deepAssign(this.editModel, selected);
|
2020-03-17 16:12:15 +08:00
|
|
|
this.editModel.type = selected._type;
|
2020-03-18 10:53:42 +08:00
|
|
|
this.$nextTick(() => {
|
|
|
|
this.setStation(selected);
|
|
|
|
});
|
2020-06-04 17:29:18 +08:00
|
|
|
} else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'sectionCode1'.toUpperCase()) {
|
|
|
|
if (!this.addBackModel.sectionList.includes(selected.code)) {
|
|
|
|
this.addBackModel.sectionList.push(selected.code);
|
|
|
|
}
|
2020-03-05 16:39:49 +08:00
|
|
|
}
|
|
|
|
},
|
2020-03-17 16:12:15 +08:00
|
|
|
async getAutoMaticList() { // 获取自动信号列表
|
2020-03-05 16:39:49 +08:00
|
|
|
const params = {
|
|
|
|
pageSize: 9999,
|
|
|
|
pageNum: 1
|
|
|
|
};
|
|
|
|
const resp = await getRouteNewList(this.$route.params.mapId, params);
|
|
|
|
this.autoList = [];
|
|
|
|
resp.data && resp.data.list && resp.data.list.forEach(elem => {
|
|
|
|
if (elem.flt) {
|
|
|
|
this.autoList.push(elem);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
2020-03-17 16:12:15 +08:00
|
|
|
async getAutoTurnBackList() { // 获取自动折返列表
|
|
|
|
const params = {
|
|
|
|
pageSize: 9999,
|
|
|
|
pageNum: 1
|
|
|
|
};
|
|
|
|
const resp = await getAutoReentryList(this.$route.params.mapId, params);
|
|
|
|
this.autoList = [];
|
|
|
|
resp.data && resp.data.list && resp.data.list.forEach(elem => {
|
|
|
|
this.autoList.push(elem);
|
|
|
|
});
|
|
|
|
},
|
2020-03-05 16:39:49 +08:00
|
|
|
// 创建对象
|
|
|
|
create() {
|
2020-07-24 17:51:55 +08:00
|
|
|
const uid = getUID(this.addModel.type, this.selectLists); // 根据类型写 uid 前缀命名
|
|
|
|
const model = {
|
|
|
|
_type: this.addModel.type,
|
|
|
|
code: uid,
|
|
|
|
name: this.addModel.name,
|
|
|
|
subtitleName: this.addModel.subtitleName,
|
|
|
|
show: true,
|
|
|
|
position: {
|
|
|
|
x: this.addModel.position.x,
|
|
|
|
y: this.addModel.position.y
|
|
|
|
},
|
|
|
|
optionList: [],
|
|
|
|
automaticRouteCode: this.addModel.automaticRouteCode, // 关联自动进路code
|
|
|
|
cycleCode: this.addModel.cycleCode, // 自动折返关联code
|
|
|
|
stationCode: this.addModel.stationCode // 所属设备集中站
|
|
|
|
};
|
|
|
|
this.$emit('updateMapModel', model);
|
|
|
|
this.$refs.createForm.resetForm();
|
2020-03-05 16:39:49 +08:00
|
|
|
},
|
|
|
|
// 修改对象
|
|
|
|
edit() {
|
|
|
|
this.$refs['dataform'].validate((valid) => {
|
|
|
|
if (valid) {
|
2020-08-28 14:43:30 +08:00
|
|
|
const data = Object.assign({_type: this.editModel.type}, this.editModel);
|
|
|
|
console.log(data, '=====');
|
2020-05-18 17:08:21 +08:00
|
|
|
this.$emit('updateMapModel', data);
|
2020-03-05 16:39:49 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
// 删除对象
|
|
|
|
deleteObj() {
|
|
|
|
const selected = this.$store.getters['map/getDeviceByCode'](this.editModel.code);
|
2020-07-27 16:11:29 +08:00
|
|
|
if (selected && selected._type.toUpperCase() === 'AutomaticRoute'.toUpperCase() || selected._type.toUpperCase() === 'AutoTurnBack'.toUpperCase() || selected._type.toUpperCase() === 'AxleReset'.toUpperCase() || selected._type.toUpperCase() == 'LimitControl'.toUpperCase() || selected._type.toUpperCase() == 'GuideLock'.toUpperCase() || selected._type.toUpperCase() == 'StationTurnBack'.toUpperCase()) {
|
2020-03-05 16:39:49 +08:00
|
|
|
this.$confirm(this.$t('tip.confirmDeletion'), this.$t('tip.hint'), {
|
|
|
|
confirmButtonText: this.$t('tip.confirm'),
|
|
|
|
cancelButtonText: this.$t('tip.cancel'),
|
|
|
|
type: 'warning'
|
|
|
|
}).then(() => {
|
2020-03-17 16:12:15 +08:00
|
|
|
this.$emit('updateMapModel', {...selected, _dispose: true});
|
2020-05-08 18:52:46 +08:00
|
|
|
this.$refs.dataform && this.$refs.dataform.resetFields();
|
2020-03-05 16:39:49 +08:00
|
|
|
}).catch(() => {
|
2020-03-17 16:12:15 +08:00
|
|
|
this.$message.info(this.$t('tip.cancelledDelete'));
|
2020-03-05 16:39:49 +08:00
|
|
|
});
|
|
|
|
}
|
2020-06-04 17:29:18 +08:00
|
|
|
},
|
|
|
|
hover(field) {
|
|
|
|
this.field = field === this.field ? '' : field;
|
2020-07-14 14:27:35 +08:00
|
|
|
if (this.field) {
|
|
|
|
this.$emit('deviceSelect', 'ControlDraft');
|
|
|
|
} else {
|
|
|
|
this.$emit('deviceSelect', '');
|
|
|
|
}
|
2020-08-28 14:43:30 +08:00
|
|
|
},
|
|
|
|
checkOverlab(list, index) {
|
|
|
|
list.forEach((item, i) => {
|
|
|
|
if (i != index) {
|
|
|
|
item.checked = false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
list[index].checked = !list[index].checked;
|
|
|
|
if (list[index].checked) {
|
|
|
|
this.editModel.initId = list[index].id;
|
|
|
|
}
|
|
|
|
},
|
2020-06-04 17:29:18 +08:00
|
|
|
deleteOverlab(list, index) {
|
|
|
|
list.splice(index, 1);
|
|
|
|
this.cardMode = 'generate';
|
|
|
|
},
|
|
|
|
editOverlab(list, index) {
|
|
|
|
this.addBackModel = deepAssign({}, list[index]);
|
|
|
|
this.addBackModel.parentIndex = index;
|
|
|
|
this.cardMode = 'edit';
|
|
|
|
},
|
|
|
|
updateOverlab() { // 修改数据
|
|
|
|
this.$refs.hostileForm.validate((valid) => {
|
|
|
|
if (valid) {
|
|
|
|
const data = {
|
|
|
|
id: this.addBackModel.id,
|
|
|
|
type: this.addBackModel.type,
|
2020-08-28 14:43:30 +08:00
|
|
|
label: this.addBackModel.label,
|
|
|
|
checked: false,
|
2020-06-05 10:14:12 +08:00
|
|
|
sectionList: this.addBackModel.type == 'NONE' ? [] : this.addBackModel.sectionList
|
2020-06-04 17:29:18 +08:00
|
|
|
};
|
|
|
|
this.editModel.optionList.splice(this.addBackModel.parentIndex, 1, data);
|
|
|
|
this.$refs.hostileForm.resetFields();
|
|
|
|
this.cardMode = 'generate';
|
2020-06-04 17:58:42 +08:00
|
|
|
this.addBackModel.sectionList = [];
|
2020-06-04 17:29:18 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
generateOverlab() { // 生成数据
|
|
|
|
this.$refs.hostileForm.validate((valid) => {
|
|
|
|
if (valid) {
|
|
|
|
const id = this.createUid(this.editModel.optionList); // 根据类型写 uid 前缀命名
|
|
|
|
this.editModel.optionList.push({
|
|
|
|
id: id,
|
|
|
|
type: this.addBackModel.type,
|
2020-08-28 14:43:30 +08:00
|
|
|
label: this.addBackModel.label,
|
|
|
|
checked: false,
|
2020-06-05 10:14:12 +08:00
|
|
|
sectionList: this.addBackModel.type == 'NONE' ? [] : this.addBackModel.sectionList
|
2020-06-04 17:29:18 +08:00
|
|
|
});
|
|
|
|
this.$refs.hostileForm.resetFields();
|
2020-06-04 17:58:42 +08:00
|
|
|
this.addBackModel.sectionList = [];
|
2020-06-04 17:29:18 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
cancelOverlab() {
|
|
|
|
this.$refs.hostileForm.resetFields();
|
|
|
|
this.cardMode = 'generate';
|
|
|
|
},
|
|
|
|
createUid(list) {
|
|
|
|
if (list.length) {
|
|
|
|
let num = Number(list[list.length - 1].id);
|
2020-06-05 10:14:12 +08:00
|
|
|
return ++num;
|
2020-06-04 17:29:18 +08:00
|
|
|
} else {
|
2020-06-05 10:14:12 +08:00
|
|
|
return 1;
|
2020-06-04 17:29:18 +08:00
|
|
|
}
|
2020-03-05 16:39:49 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
|
|
@import "src/styles/mixin.scss";
|
|
|
|
.card {
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
.coordinate {
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
|
|
.title {
|
|
|
|
text-align: right;
|
|
|
|
font-size: 14px;
|
|
|
|
color: #606266;
|
|
|
|
line-height: 40px;
|
|
|
|
padding: 0 12px 0 0;
|
|
|
|
-webkit-box-sizing: border-box;
|
|
|
|
box-sizing: border-box;
|
|
|
|
line-height: 28px;
|
|
|
|
width: 160px;
|
|
|
|
font-weight: bold;
|
|
|
|
display: block;
|
|
|
|
float: left;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.map-draft-group {
|
|
|
|
color: #3E44BE;
|
|
|
|
}
|
2020-06-04 17:29:18 +08:00
|
|
|
.card-box{
|
|
|
|
border: 1px solid #ccc;
|
|
|
|
padding: 10px;
|
|
|
|
padding-top: 18px;
|
|
|
|
box-sizing: border-box;
|
|
|
|
position: relative;
|
|
|
|
margin-bottom: 15px;
|
2020-08-24 11:30:57 +08:00
|
|
|
margin-top: 15px;
|
2020-06-04 17:29:18 +08:00
|
|
|
|
|
|
|
&:last-child{
|
|
|
|
margin-bottom: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.card_title {
|
|
|
|
position: absolute;
|
|
|
|
left: 10px;
|
|
|
|
top: -8px;
|
|
|
|
background: #fff;
|
|
|
|
padding: 0px 5px;
|
|
|
|
}
|
|
|
|
}
|
2020-03-05 16:39:49 +08:00
|
|
|
</style>
|