This commit is contained in:
ival 2019-08-08 14:32:47 +08:00
commit 842c7f9df2

View File

@ -1,185 +1,194 @@
<template> <template>
<el-dialog class="fuzhou-01__systerm view-train-id" title="列车识别号显示设置" :visible.sync="show" width="420px" <el-dialog
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag> v-dialogDrag
<div style="padding: 10px 20px; border: 1px double lightgray;"> class="fuzhou-01__systerm view-train-id"
<span class="base-label">计划车显示模式</span> title="列车识别号显示设置"
<el-radio-group v-model="planMode"> :visible.sync="show"
<el-row> width="420px"
<el-col :span="10"> :before-close="doClose"
<el-radio :label="1">表号+车次号</el-radio> :z-index="2000"
</el-col> :modal="false"
<el-col :span="10" :offset="4"> :close-on-click-modal="false"
<el-radio :label="2">表号+车组号</el-radio> >
</el-col> <div style="padding: 10px 20px; border: 1px double lightgray;">
</el-row> <span class="base-label">计划车显示模式</span>
<el-row> <el-radio-group v-model="planMode">
<el-col :span="10"> <el-row>
<el-radio :label="3">目的地号+车次号</el-radio> <el-col :span="10">
</el-col> <el-radio :label="1">表号+车次号</el-radio>
<el-col :span="10" :offset="4"> </el-col>
<el-radio :label="4">目的地号+车组号</el-radio> <el-col :span="10" :offset="4">
</el-col> <el-radio :label="2">表号+车组号</el-radio>
</el-row> </el-col>
<el-row>
<el-col :span="10">
<el-radio :label="5">目的地号+表号+车次号</el-radio>
</el-col>
<el-col :span="10" :offset="4">
<el-radio :label="6">目的地号+表号+车组号</el-radio>
</el-col>
</el-row>
</el-radio-group>
</div>
<div style="padding: 10px 20px; border: 1px double lightgray; margin: 20px 0px;">
<span class="base-label">头码车显示模式</span>
<el-radio-group v-model="headMode">
<el-row>
<el-col :span="10">
<el-radio :label="3">目的地号+车次号</el-radio>
</el-col>
<el-col :span="6" :offset="8">
<el-radio :label="4">目的地号+车组号</el-radio>
</el-col>
</el-row>
</el-radio-group>
</div>
<div style="padding: 10px 20px; border: 1px double lightgray;">
<span class="base-label">字体大小</span>
<el-row>
<el-col :span="10">
<el-input v-model="fontSize" size="small" min="16" max="99"></el-input>
</el-col>
<el-col :span="10" :offset="1">
<span style="height:32px; line-height:32px;">范围16-99</span>
</el-col>
</el-row>
</div>
<el-row class="button-group">
<el-col :span="6" :offset="2">
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button>
</el-col>
<el-col :span="4" :offset="8">
<el-button :id="domIdCancel" @click="cancel"> </el-button>
</el-col>
</el-row> </el-row>
<notice-info ref="noticeInfo"></notice-info> <el-row>
</el-dialog> <el-col :span="10">
<el-radio :label="3">目的地号+车次号</el-radio>
</el-col>
<el-col :span="10" :offset="4">
<el-radio :label="4">目的地号+车组号</el-radio>
</el-col>
</el-row>
<el-row>
<el-col :span="10">
<el-radio :label="5">目的地号+表号+车次号</el-radio>
</el-col>
<el-col :span="10" :offset="4">
<el-radio :label="6">目的地号+表号+车组号</el-radio>
</el-col>
</el-row>
</el-radio-group>
</div>
<div style="padding: 10px 20px; border: 1px double lightgray; margin: 20px 0px;">
<span class="base-label">头码车显示模式</span>
<el-radio-group v-model="headMode">
<el-row>
<el-col :span="10">
<el-radio :label="3">目的地号+车次号</el-radio>
</el-col>
<el-col :span="6" :offset="8">
<el-radio :label="4">目的地号+车组号</el-radio>
</el-col>
</el-row>
</el-radio-group>
</div>
<div style="padding: 10px 20px; border: 1px double lightgray;">
<span class="base-label">字体大小</span>
<el-row>
<el-col :span="10">
<el-input v-model="fontSize" size="small" min="16" max="99" />
</el-col>
<el-col :span="10" :offset="1">
<span style="height:32px; line-height:32px;">范围16-99</span>
</el-col>
</el-row>
</div>
<el-row class="button-group">
<el-col :span="6" :offset="2">
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button>
</el-col>
<el-col :span="4" :offset="8">
<el-button :id="domIdCancel" @click="cancel"> </el-button>
</el-col>
</el-row>
<notice-info ref="noticeInfo" />
</el-dialog>
</template> </template>
<script> <script>
import { OperationEvent, checkOperationIsCurrentOperate } from '@/scripts/ConstDic'; import { OperationEvent } from '@/scripts/ConstDic';
import deviceType from '@/jmap/constant/deviceType'; // import deviceType from '@/jmap/constant/deviceType';
import NoticeInfo from '../dialog/childDialog/childDialog/noticeInfo'; import NoticeInfo from '../dialog/childDialog/childDialog/noticeInfo';
export default { export default {
name: 'ViewTrainId', name: 'ViewTrainId',
data() { components: {
return { NoticeInfo
dialogShow: false, },
loading: false, data() {
operate: null, return {
operation: '', dialogShow: false,
planMode: 5, loading: false,
headMode: 5, operate: null,
fontSize: 16, operation: '',
} planMode: 5,
}, headMode: 5,
components: { fontSize: 16
NoticeInfo };
}, },
computed: { computed: {
show() { show() {
return this.dialogShow && !this.$store.state.menuOperation.break; return this.dialogShow && !this.$store.state.menuOperation.break;
}, },
domIdCancel() { domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : ''; return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
}, },
domIdConfirm() { domIdConfirm() {
return this.dialogShow ? OperationEvent.Command.close.confirm.domId : ''; return this.dialogShow ? OperationEvent.Command.close.confirm.domId : '';
} }
}, },
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
this.setTrainDispaly(); this.setTrainDispaly();
this.$store.dispatch('training/tipReload'); this.$store.dispatch('training/tipReload');
}) });
}, },
methods: { methods: {
doShow(operate) { doShow(operate) {
this.operate = operate || {}; this.operate = operate || {};
this.operation = operate.operation; this.operation = operate.operation;
// //
if (!this.dialogShow) { if (!this.dialogShow) {
this.loading = false; this.loading = false;
} }
this.dialogShow = true; this.dialogShow = true;
this.$nextTick(function () { this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
}); });
}, },
doClose() { doClose() {
this.loading = false; this.loading = false;
this.dialogShow = false; this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
}, },
cancel() { cancel() {
let operate = { const operate = {
type: this.operate.type, type: this.operate.type,
operation: OperationEvent.Command.cancel.menu.operation, operation: OperationEvent.Command.cancel.menu.operation
} };
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.doClose(); this.doClose();
} }
}) });
}, },
commit() { commit() {
let operate = { const operate = {
over: true, over: true,
type: this.operate.type, type: this.operate.type,
operation: OperationEvent.Command.close.confirm.operation, operation: OperationEvent.Command.close.confirm.operation,
val: [this.planMode, this.headMode, this.fontSize].join('::') val: [this.planMode, this.headMode, this.fontSize].join('::')
} };
this.loading = true this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false this.loading = false;
if (valid) { if (valid) {
this.setTrainDispaly(); this.setTrainDispaly();
this.doClose(); this.doClose();
} }
}).catch(error => { }).catch(() => {
this.loading = false; this.loading = false;
}) });
}, },
setTrainDispaly() { setTrainDispaly() {
let updatlist = []; const updatlist = [];
let trainList = this.$store.getters['training/viewTrainList']; const trainList = this.$store.getters['training/viewTrainList'];
if (trainList && trainList.length > 0) { if (trainList && trainList.length > 0) {
let nameFormat = this.trainNameFormatBy(this.planMode); const nameFormat = this.trainNameFormatBy(this.planMode);
let nameFontSize = this.fontSize; const nameFontSize = this.fontSize;
trainList.forEach(elem => { trainList.forEach(elem => {
updatlist.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), {nameFormat, nameFontSize })); updatlist.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), {nameFormat, nameFontSize }));
}); });
this.$store.dispatch('map/updateMapDevices', updatlist); this.$store.dispatch('map/updateMapDevices', updatlist);
} }
}, },
trainNameFormatBy(mode) { trainNameFormatBy(mode) {
switch (mode.toString()) { switch (mode.toString()) {
case '1': return 'serviceNumber:tripNumber'; //+ case '1': return 'serviceNumber:tripNumber'; // +
case '2': return 'serviceNumber:groupNumber'; //+ case '2': return 'serviceNumber:groupNumber'; // +
case '3': return 'targetCode:tripNumber'; //+ case '3': return 'targetCode:tripNumber'; // +
case '4': return 'targetCode:groupNumber'; //+ case '4': return 'targetCode:groupNumber'; // +
case '5': return 'targetCode:serviceNumber:tripNumber'; //++ case '5': return 'targetCode:serviceNumber:tripNumber'; // ++
case '6': return 'targetCode:serviceNumber:groupNumber'; //++ case '6': return 'targetCode:serviceNumber:groupNumber'; // ++
} }
return ''; // return ''; //
} }
} }
} };
</script> </script>