2019-12-19 18:04:28 +08:00
|
|
|
|
<template>
|
|
|
|
|
<div v-show="dialogVisible">
|
2020-04-28 16:59:47 +08:00
|
|
|
|
<el-dialog v-dialogDrag title="配置项" :visible.sync="dialogVisible" fullscreen :before-close="handleClose" center :close-on-click-modal="false" :z-index="2000">
|
|
|
|
|
<div style="overflow-y: scroll;" :style="{height: height+ 'px'}">
|
|
|
|
|
<el-card>
|
|
|
|
|
<div slot="header" style="font-weight: bold;text-align: center;">
|
|
|
|
|
<span>通用配置项</span>
|
|
|
|
|
</div>
|
|
|
|
|
<el-table :data="generalData" style="width: 100%;">
|
|
|
|
|
<el-table-column prop="configKey" label="key" />
|
|
|
|
|
<el-table-column prop="configValue" label="value">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<div v-if="scope.row.type === 'input'">
|
|
|
|
|
<div v-if="!scope.row.focus" style="width: 100%;cursor: pointer;" @click="changeFocus(scope.row, '1')">{{ scope.row.configValue }}</div>
|
|
|
|
|
<el-input v-if="scope.row.focus" v-model="scope.row.configValue" size="mini" style="width: 100%" @blur="changeFocus(scope.row, '0')" />
|
|
|
|
|
</div>
|
|
|
|
|
<div v-else-if="scope.row.type === 'number'">
|
|
|
|
|
<div v-if="!scope.row.focus" style="width: 100%;cursor: pointer" @click="changeFocus(scope.row, '1')">{{ scope.row.configValue }}</div>
|
|
|
|
|
<el-input-number v-if="scope.row.focus" v-model="scope.row.configValue" size="mini" style="width: 100px;" :min="0" controls-position="right" @blur="changeFocus(scope.row, '0')" />
|
|
|
|
|
</div>
|
|
|
|
|
<div v-else-if="scope.row.type === 'boolean'">
|
|
|
|
|
<el-checkbox v-model="scope.row.configValue">{{ scope.row.configValue }}</el-checkbox>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-else-if="scope.row.type === 'select'">
|
|
|
|
|
<el-select v-model="scope.row.configValue" size="mini" style="width: 80px;">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in scope.row.options"
|
|
|
|
|
:key="item.value"
|
|
|
|
|
:label="item.label"
|
|
|
|
|
:value="item.value"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="remark" label="描述" />
|
|
|
|
|
</el-table>
|
|
|
|
|
</el-card>
|
|
|
|
|
<el-card style="margin-top: 10px">
|
|
|
|
|
<div slot="header" style="font-weight: bold;text-align: center;">
|
|
|
|
|
<span>联锁配置项</span>
|
|
|
|
|
</div>
|
|
|
|
|
<el-table :data="roadData" style="width: 100%;">
|
|
|
|
|
<el-table-column prop="configKey" label="key" />
|
|
|
|
|
<el-table-column prop="configValue" label="value">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<div v-if="scope.row.type === 'input'">
|
|
|
|
|
<div v-if="!scope.row.focus" style="width: 100%;cursor: pointer;" @click="changeFocus(scope.row, '1')">{{ scope.row.configValue }}</div>
|
|
|
|
|
<el-input v-if="scope.row.focus" v-model="scope.row.configValue" size="mini" style="width: 100%" @blur="changeFocus(scope.row, '0')" />
|
|
|
|
|
</div>
|
|
|
|
|
<div v-else-if="scope.row.type === 'number'">
|
|
|
|
|
<div v-if="!scope.row.focus" style="width: 100%;cursor: pointer" @click="changeFocus(scope.row, '1')">{{ scope.row.configValue }}</div>
|
|
|
|
|
<el-input-number v-if="scope.row.focus" v-model="scope.row.configValue" size="mini" style="width: 100px;" :min="0" controls-position="right" @blur="changeFocus(scope.row, '0')" />
|
|
|
|
|
</div>
|
|
|
|
|
<div v-else-if="scope.row.type === 'boolean'">
|
|
|
|
|
<el-checkbox v-model="scope.row.configValue">{{ scope.row.configValue }}</el-checkbox>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-else-if="scope.row.type === 'select'">
|
|
|
|
|
<el-select v-model="scope.row.configValue" size="mini" style="width: 80px;">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in scope.row.options"
|
|
|
|
|
:key="item.value"
|
|
|
|
|
:label="item.label"
|
|
|
|
|
:value="item.value"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="remark" label="描述" />
|
|
|
|
|
</el-table>
|
|
|
|
|
</el-card>
|
|
|
|
|
</div>
|
2019-12-19 18:04:28 +08:00
|
|
|
|
<span slot="footer" class="dialog-footer">
|
2019-12-20 14:02:11 +08:00
|
|
|
|
<el-button type="primary" @click="save">{{ $t('global.confirm') }}</el-button>
|
2019-12-19 18:04:28 +08:00
|
|
|
|
<el-button @click="dialogVisible = false">{{ $t('global.cancel') }}</el-button>
|
|
|
|
|
</span>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2019-12-20 14:02:11 +08:00
|
|
|
|
import { getRealLineConfigList, putRealLineConfig } from '@/api/management/mapline';
|
2020-01-16 18:02:57 +08:00
|
|
|
|
// import EditConfig from './editConfig';
|
2019-12-19 18:04:28 +08:00
|
|
|
|
export default {
|
|
|
|
|
name: 'Config',
|
|
|
|
|
components: {
|
2020-01-16 18:02:57 +08:00
|
|
|
|
// EditConfig
|
2019-12-19 18:04:28 +08:00
|
|
|
|
},
|
|
|
|
|
props: {
|
|
|
|
|
type: {
|
|
|
|
|
type: String,
|
2020-04-23 18:35:27 +08:00
|
|
|
|
default() {
|
|
|
|
|
return '';
|
|
|
|
|
}
|
2019-12-19 18:04:28 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
dialogVisible: false,
|
|
|
|
|
index: 0,
|
|
|
|
|
id: '',
|
2020-04-28 09:56:03 +08:00
|
|
|
|
generalData: [],
|
2020-04-28 17:03:23 +08:00
|
|
|
|
height: 800,
|
2020-04-28 09:56:03 +08:00
|
|
|
|
roadData: [],
|
2020-01-16 18:02:57 +08:00
|
|
|
|
focus: false,
|
2020-04-28 09:56:03 +08:00
|
|
|
|
booleanList: ['lockFirst', 'switchSingleHandle', 'signalApproachOnlyOne', 'signalApproachOnlyNpSwitch',
|
|
|
|
|
'routeNameUseEndOppositeSignalName', 'generateTbRoute', 'tbRouteNameUseEndOppositeSignalName', 'routeSignalAlwaysGreen',
|
2020-04-30 16:19:33 +08:00
|
|
|
|
'routeApartByOverlap', 'overlapOnlySwitch', 'overlapSwitchNpOnly', 'overlapSignalOppositeSwitchNpOnly', 'overlapOnlyOneSwitch', 'generateCycle', 'overlapSettingByTrigger'],
|
2020-04-15 14:13:08 +08:00
|
|
|
|
selectList: ['upDirection'],
|
2020-04-28 09:56:03 +08:00
|
|
|
|
generalConfig: ['lockFirst', 'switchSingleHandle', 'upDirection'],
|
|
|
|
|
numberList: ['overlapReleaseTime', 'routeReleaseTime'],
|
2020-04-15 14:13:08 +08:00
|
|
|
|
optionsMap: {
|
|
|
|
|
upDirection: [{label: 'right', value: 'right'}, {label: 'left', value: 'left'}]
|
2020-04-28 16:59:47 +08:00
|
|
|
|
},
|
|
|
|
|
remarkMap: {
|
|
|
|
|
lockFirst: '是否先锁闭——办理过程直接先锁闭区段',
|
|
|
|
|
upDirection: '上行方向',
|
|
|
|
|
switchSingleHandle: '道岔区段状态改变按单个道岔处理',
|
|
|
|
|
signalApproachOnlyOne: '信号机接近区段是否只取最近的一个',
|
|
|
|
|
signalApproachOnlyNpSwitch: ' 信号机接近区段是否仅考虑定位道岔',
|
|
|
|
|
routeNameUseEndOppositeSignalName: '进路名称是否使用终端信号机同区段反向信号机名称命名,否则使用终端信号机命名',
|
|
|
|
|
generateTbRoute: '是否生成折返进路',
|
|
|
|
|
tbRouteNameUseEndOppositeSignalName: '折返进路名称是否使用终端信号机反向信号机名称',
|
|
|
|
|
routeSignalAlwaysGreen: '进路始端防护信号机是否总是绿灯,否则根据进路中有无反位道岔生成绿灯或黄灯',
|
|
|
|
|
routeApartByOverlap: '多个延续保护路径生成多条进路,否则生成一条进路',
|
|
|
|
|
overlapOnlySwitch:'延续保护是否只构建道岔',
|
|
|
|
|
overlapOnlyOneSwitch: '延续保护构建是否只考虑一个道岔计轴',
|
|
|
|
|
overlapSwitchNpOnly: '延续保护道岔是否只构建定位道岔',
|
|
|
|
|
overlapSignalOppositeSwitchNpOnly: '延续保护道岔在防护信号机与所属区段方向相反时,是否只构建定位道岔',
|
|
|
|
|
overlapReleaseTime: '默认延续保护解锁时间',
|
2020-04-29 17:25:30 +08:00
|
|
|
|
routeReleaseTime: '默认进路解锁时间',
|
2020-04-30 16:19:33 +08:00
|
|
|
|
generateCycle: '是否生成自动折返',
|
|
|
|
|
overlapSettingByTrigger: '延续保护的建立方式:true-通过触发建立,false-随进路建立'
|
2020-04-15 14:13:08 +08:00
|
|
|
|
}
|
2019-12-19 18:04:28 +08:00
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
async show(row) {
|
|
|
|
|
this.dialogVisible = true;
|
2020-04-28 17:03:23 +08:00
|
|
|
|
this.height = document.documentElement.clientHeight - 180;
|
2019-12-19 18:04:28 +08:00
|
|
|
|
if (row && row.id) {
|
|
|
|
|
this.id = row.id;
|
|
|
|
|
this.getList();
|
|
|
|
|
}
|
|
|
|
|
},
|
2020-04-15 14:13:08 +08:00
|
|
|
|
changeFocus(row, flag) {
|
|
|
|
|
if (flag === '0') {
|
|
|
|
|
this.$set(row, 'focus', false);
|
|
|
|
|
} else {
|
|
|
|
|
this.$set(row, 'focus', true);
|
|
|
|
|
}
|
|
|
|
|
},
|
2019-12-19 18:04:28 +08:00
|
|
|
|
async getList() {
|
|
|
|
|
try {
|
2019-12-20 14:02:11 +08:00
|
|
|
|
const res = await getRealLineConfigList(this.id);
|
2019-12-19 18:04:28 +08:00
|
|
|
|
if (res.data) {
|
2020-01-16 18:02:57 +08:00
|
|
|
|
const keys = Object.keys(res.data);
|
2020-04-28 09:56:03 +08:00
|
|
|
|
this.generalData = [];
|
|
|
|
|
this.roadData = [];
|
2020-01-16 18:02:57 +08:00
|
|
|
|
keys.forEach(key => {
|
|
|
|
|
// let value = '';
|
2020-04-15 14:13:08 +08:00
|
|
|
|
let type = 'input';
|
|
|
|
|
let options = [];
|
|
|
|
|
if (this.booleanList.indexOf(key) >= 0) {
|
|
|
|
|
type = 'boolean';
|
|
|
|
|
} else if (this.selectList.indexOf(key) >= 0) {
|
|
|
|
|
type = 'select';
|
|
|
|
|
options = this.optionsMap[key];
|
2020-04-28 09:56:03 +08:00
|
|
|
|
} else if (this.numberList.indexOf(key) >= 0) {
|
|
|
|
|
type = 'number';
|
2020-01-16 18:02:57 +08:00
|
|
|
|
} else {
|
2020-04-15 14:13:08 +08:00
|
|
|
|
type = 'input';
|
2020-01-16 18:02:57 +08:00
|
|
|
|
}
|
|
|
|
|
const param = {
|
|
|
|
|
configKey: key,
|
|
|
|
|
configValue: res.data[key],
|
2020-04-15 14:13:08 +08:00
|
|
|
|
type: type,
|
2020-04-28 16:59:47 +08:00
|
|
|
|
options: options,
|
|
|
|
|
remark: this.remarkMap[key]
|
2020-01-16 18:02:57 +08:00
|
|
|
|
};
|
2020-04-28 09:56:03 +08:00
|
|
|
|
if (this.generalConfig.includes(key)) {
|
|
|
|
|
this.generalData.push(param);
|
|
|
|
|
} else {
|
|
|
|
|
this.roadData.push(param);
|
|
|
|
|
}
|
2020-01-16 18:02:57 +08:00
|
|
|
|
});
|
2019-12-20 14:02:11 +08:00
|
|
|
|
} else {
|
2020-04-28 09:56:03 +08:00
|
|
|
|
this.generalData = [];
|
|
|
|
|
this.roadData = [];
|
2019-12-19 18:04:28 +08:00
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.log(error);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
handleClose(done) {
|
|
|
|
|
if (done) {
|
|
|
|
|
done();
|
|
|
|
|
} else {
|
|
|
|
|
this.dialogVisible = false;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
addModel() {
|
|
|
|
|
this.$refs.addConfig.show();
|
|
|
|
|
},
|
|
|
|
|
editModel(item, index) {
|
|
|
|
|
this.$refs.editConfig.show(item);
|
|
|
|
|
this.index = index;
|
|
|
|
|
},
|
2019-12-20 14:02:11 +08:00
|
|
|
|
save() {
|
2020-01-16 18:02:57 +08:00
|
|
|
|
const param = {};
|
2020-04-28 09:56:03 +08:00
|
|
|
|
this.generalData.forEach(item => {
|
2020-01-16 18:02:57 +08:00
|
|
|
|
param[item.configKey] = item.configValue;
|
|
|
|
|
// if (item.boolean) {
|
|
|
|
|
// const value = item.configValue == 'true';
|
|
|
|
|
// param[item.configKey] = value;
|
|
|
|
|
// }
|
|
|
|
|
});
|
2020-04-28 09:56:03 +08:00
|
|
|
|
this.roadData.forEach(item => {
|
|
|
|
|
param[item.configKey] = item.configValue;
|
|
|
|
|
});
|
2020-01-16 18:02:57 +08:00
|
|
|
|
putRealLineConfig(this.id, param).then(res => {
|
2019-12-20 14:02:11 +08:00
|
|
|
|
this.$message.success(`保存配置项成功!`);
|
|
|
|
|
this.dialogVisible = false;
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
this.$messageBox(`保存配置项失败.`);
|
|
|
|
|
});
|
|
|
|
|
|
2019-12-19 18:04:28 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
|
|
|
.icon_font{
|
|
|
|
|
font-size: 18px;
|
|
|
|
|
margin-left: 15px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
.flex_box{
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: flex-start;
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</style>
|
|
|
|
|
|