佛山控制模式转换调整

This commit is contained in:
fan 2020-06-04 16:44:04 +08:00
parent a0822cf68e
commit 90d80897c6
3 changed files with 130 additions and 107 deletions

View File

@ -12,8 +12,9 @@
:close-on-click-modal="false" :close-on-click-modal="false"
> >
<el-row> 集中站 </el-row> <el-row> 集中站 </el-row>
<el-row style="margin-bottom: 20px"> <el-form ref="form" :model="formModel" :rules="rules">
<el-form ref="form" :model="formModel" :rules="rules">
<el-row style="margin-bottom: 20px">
<el-form-item prop="stationCode"> <el-form-item prop="stationCode">
<el-select <el-select
:id="domIdChooseStation" :id="domIdChooseStation"
@ -26,14 +27,16 @@
<el-option v-for="item in centralizedStationList" :key="item.code" :label="item.name" :value="item.code" /> <el-option v-for="item in centralizedStationList" :key="item.code" :label="item.name" :value="item.code" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-form>
</el-row>
<el-radio-group :id="domIdChooseControl" v-model="stationType">
<el-row v-for="item in Object.keys(controlProps)" :key="item" style="padding-bottom: 10px">
<el-radio :label="item" :disabled="!controlModeList.includes(item)" @change="handleChooseChangeControl">
{{ controlProps[item] }}</el-radio>
</el-row> </el-row>
</el-radio-group> <el-form-item prop="stationType">
<el-radio-group :id="domIdChooseControl" v-model="formModel.stationType">
<el-row v-for="item in Object.keys(controlProps)" :key="item" style="padding-bottom: 10px">
<el-radio :label="item" :disabled="!controlModeList.includes(item)" @change="handleChooseChangeControl">
{{ controlProps[item] }}</el-radio>
</el-row>
</el-radio-group>
</el-form-item>
</el-form>
<el-row type="flex" justify="center" class="button-group"> <el-row type="flex" justify="center" class="button-group">
<el-button :id="domIdCommit" :disabled="disabledCommit" @click="handleCommit">设置</el-button> <el-button :id="domIdCommit" :disabled="disabledCommit" @click="handleCommit">设置</el-button>
<el-button :id="domIdCancel" :disabled="disabledClose" style="margin-left: 200px" @click="cancel">退出 <el-button :id="domIdCancel" :disabled="disabledClose" style="margin-left: 200px" @click="cancel">退出
@ -68,9 +71,9 @@ export default {
disabledClose: false, disabledClose: false,
disabledCommit: false, disabledCommit: false,
controlModeList: [], controlModeList: [],
stationType: 'Center',
formModel: { formModel: {
stationCode: '' stationCode: '',
stationType: ''
}, },
controlProps: { controlProps: {
'Emergency': '紧急站控', 'Emergency': '紧急站控',
@ -81,6 +84,9 @@ export default {
stationCode: [ stationCode: [
{ required: true, message: '请选择集中站', trigger: 'change' }, { required: true, message: '请选择集中站', trigger: 'change' },
{ validator: validatePass, trigger: 'change' } { validator: validatePass, trigger: 'change' }
],
stationType: [
{required: true, message: '请选择控制模式', trigger: 'change'}
] ]
}, },
centralizedStationList: [] centralizedStationList: []
@ -105,11 +111,11 @@ export default {
}, },
domIdCommit() { domIdCommit() {
if (this.dialogShow) { if (this.dialogShow) {
if (this.stationType === 'Center') { if (this.formModel.stationType === 'Center') {
return OperationEvent.StationControl.requestCentralControl.menu.domId; return OperationEvent.StationControl.requestCentralControl.menu.domId;
} else if (this.stationType === 'Local') { } else if (this.formModel.stationType === 'Local') {
return OperationEvent.StationControl.requestStationControl.menu.domId; return OperationEvent.StationControl.requestStationControl.menu.domId;
} else if (this.stationType === 'Emergency') { } else if (this.formModel.stationType === 'Emergency') {
return OperationEvent.StationControl.emergencyStationControl.menu.domId; return OperationEvent.StationControl.emergencyStationControl.menu.domId;
} }
} else { } else {
@ -207,13 +213,13 @@ export default {
handleCommit() { handleCommit() {
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
if (valid) { if (valid) {
if (this.stationType === 'Center') { if (this.formModel.stationType === 'Center') {
// //
this.conterCommit(); this.conterCommit();
} else if (this.stationType === 'Local') { } else if (this.formModel.stationType === 'Local') {
// //
this.requestCommit(); this.requestCommit();
} else if (this.stationType === 'Emergency') { } else if (this.formModel.stationType === 'Emergency') {
// //
this.emergencyCommit(); this.emergencyCommit();
} }
@ -231,6 +237,7 @@ export default {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.twoConfirmation.doShow(operate); this.$refs.twoConfirmation.doShow(operate);
this.doClose();
} else { } else {
this.disabledSure = false; this.disabledSure = false;
} }
@ -247,6 +254,7 @@ export default {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.twoConfirmation.doShow(operate); this.$refs.twoConfirmation.doShow(operate);
this.doClose();
} else { } else {
this.disabledSure = false; this.disabledSure = false;
} }
@ -263,6 +271,7 @@ export default {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.twoConfirmation.doShow(operate); this.$refs.twoConfirmation.doShow(operate);
this.doClose();
} else { } else {
this.disabledSure = false; this.disabledSure = false;
} }

View File

@ -125,19 +125,19 @@ export default {
}, },
watch: { watch: {
'$store.state.socket.msgHead': function (elem) { '$store.state.socket.msgHead': function (elem) {
if (elem && elem.hasOwnProperty('success')) { // if (elem && elem.hasOwnProperty('success')) {
if (elem.success) { // if (elem.success) {
const operate = this.$store.state.training.operate; // const operate = this.$store.state.training.operate;
const control = this.$store.getters['map/getDeviceByCode'](elem.stationControlCode); // const control = this.$store.getters['map/getDeviceByCode'](elem.stationControlCode);
const station = this.$store.getters['map/getDeviceByCode'](control.stationCode); // const station = this.$store.getters['map/getDeviceByCode'](control.stationCode);
const newOperate = { // const newOperate = {
type: operate.type, // type: operate.type,
name: station.name // name: station.name
}; // };
//
this.doShow(newOperate); // this.doShow(newOperate);
} // }
} // }
} }
}, },
mounted() { mounted() {

View File

@ -2,7 +2,7 @@
<el-dialog <el-dialog
v-dialogDrag v-dialogDrag
class="foshan-01__systerm passive-control" class="foshan-01__systerm passive-control"
title="控制模式请求" :title="$t('menu.passiveDialog.controlModeRequest')"
:visible.sync="show" :visible.sync="show"
width="700px" width="700px"
:before-close="doClose" :before-close="doClose"
@ -11,7 +11,7 @@
:modal="false" :modal="false"
:close-on-click-modal="false" :close-on-click-modal="false"
> >
<span class="control-label">{{ `${requestInfo}请求如下区域的控制模式` }}</span> <span class="control-label">{{ `${requestInfo}${$t('menu.passiveDialog.requestAreaControlMode')}` }}</span>
<el-table <el-table
ref="multipleTable" ref="multipleTable"
:data="tableData" :data="tableData"
@ -23,35 +23,35 @@
size="mini" size="mini"
highlight-current-row highlight-current-row
> >
<el-table-column prop="operate" label="操作区域"> <el-table-column prop="operate" :label="$t('menu.passiveDialog.operatingArea')">
<template slot-scope="scope"> <template slot-scope="scope">
<span :style="{color: scope.row.disabled ? '#CBCBCB':'unset'}">{{ scope.row.operate }}</span> <span :style="{color: scope.row.disabled ? '#CBCBCB':'unset'}">{{ scope.row.operate }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="control" label="当前控制模式" width="120"> <el-table-column prop="control" :label="$t('menu.passiveDialog.currentControlMode')" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<span :style="{color: scope.row.disabled ? '#CBCBCB':'unset'}">{{ scope.row.control.name }}</span> <span :style="{color: scope.row.disabled ? '#CBCBCB':'unset'}">{{ scope.row.control.name }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="target" label="请求控制模式" width="120"> <el-table-column prop="target" :label="$t('menu.passiveDialog.requestControlMode')" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<span :style="{color: scope.row.disabled ? '#CBCBCB':'unset'}">{{ scope.row.target.name }}</span> <span :style="{color: scope.row.disabled ? '#CBCBCB':'unset'}">{{ scope.row.target.name }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="agree" label="是否同意" width="140"> <el-table-column prop="agree" :label="$t('menu.passiveDialog.isAgree')" width="140">
<template slot-scope="scope"> <template slot-scope="scope">
<el-checkbox ref="agree" v-model="scope.row.agree" :disabled="scope.row.disabled" /> <el-checkbox ref="agree" v-model="scope.row.agree" :disabled="scope.row.disabled" />
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<span class="control-label">距离对话还有{{ count }}请应答</span> <span class="control-label">{{ $t('menu.passiveDialog.messageOne') }} {{ count }} {{ $t('menu.passiveDialog.messageTwo') }}</span>
<el-row class="button-group"> <el-row class="button-group">
<el-col :span="10" :offset="3"> <el-col :span="10" :offset="3">
<el-button :id="domAgree" :disabled="disabledAgree" @click="agree">同意 <el-button :id="domAgree" :disabled="disabledAgree" @click="agree">{{ $t('menu.passiveDialog.agree') }}
</el-button> </el-button>
</el-col> </el-col>
<el-col :span="6" :offset="4"> <el-col :span="6" :offset="4">
<el-button :id="domIdRefuse" :disabled="disabledRefuse" @click="refuse">拒绝</el-button> <el-button :id="domIdRefuse" :disabled="disabledRefuse" @click="refuse">{{ $t('menu.passiveDialog.refuse') }}</el-button>
</el-col> </el-col>
</el-row> </el-row>
<notice-info ref="noticeInfo" /> <notice-info ref="noticeInfo" />
@ -59,8 +59,10 @@
</template> </template>
<script> <script>
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic'; import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import NoticeInfo from '../dialog/childDialog/childDialog/noticeInfo'; import NoticeInfo from '../dialog/childDialog/childDialog/noticeInfo';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import {getMemberInfo} from '@/api/simulation';
export default { export default {
name: 'RequestControl', name: 'RequestControl',
@ -72,26 +74,28 @@ export default {
dialogShow: false, dialogShow: false,
disabledAgree: false, disabledAgree: false,
disabledRefuse: false, disabledRefuse: false,
requestInfo: '调度员1工作站', requestInfo: this.$t('menu.passiveDialog.dispatcherWorkstation'),
controlProps: { controlProps: {
'01': '中控', 'Center': this.$t('menu.passiveDialog.inTheControl'),
'02': '站控' 'Local': this.$t('menu.passiveDialog.stationControl')
}, },
selection: [], selection: [],
tableData: [], tableData: [],
timer: null, timer: null,
timeout: 61, timeout: 55,
count: 0 count: 0,
sourceMemberId: ''
}; };
}, },
computed: { computed: {
targetStatus() { targetStatus() {
if (this.$store.state.training.prdType == '01') { if (this.$store.state.training.prdType == '01') {
return '01'; return 'Center';
} }
if (this.$store.state.training.prdType == '02') { if (this.$store.state.training.prdType == '02') {
return '02'; return 'Local';
} }
return '';
}, },
show() { show() {
return this.dialogShow && !this.$store.state.menuOperation.break; return this.dialogShow && !this.$store.state.menuOperation.break;
@ -114,9 +118,10 @@ export default {
deep: true deep: true
}, },
'$store.state.socket.msgHead': function (elem) { '$store.state.socket.msgHead': function (elem) {
if (elem && !elem.hasOwnProperty('success') && !elem.hasOwnProperty('timeout')) { if (elem && (elem.operateType == 'CM_Apply_For_Station_Control' || elem.operateType == 'CM_Apply_For_Center_Control' || elem.operateType == 'CM_Force_Station_Control')) {
if (elem.stationControlCode) { if (elem.params.stationCodes && elem.params.stationCodes.length) {
this.doShow(elem); this.doShow(elem);
this.sourceMemberId = elem.sourceMemberId;
} }
} }
} }
@ -160,43 +165,43 @@ export default {
this.disabledAgree = this.selection.length <= 0; this.disabledAgree = this.selection.length <= 0;
} }
}, },
updateTableData(code) { updateTableData(codes) {
this.tableData = []; this.tableData = [];
(codes || []).forEach(code=> {
const model = {
code: code,
operate: '',
control: { code: '', name: '' },
target: { code: '', name: '' },
agree: false,
disabled: false
};
const model = { const device = this.$store.getters['map/getDeviceByCode'](code);
code: code, if (device) {
operate: '', const control = (device || {}).controlMode;
control: { code: '', name: '' }, if (control) {
target: { code: '', name: '' }, model.control = { status: control, name: this.controlProps[control] };
agree: false, model.target = { status: this.targetStatus, name: this.controlProps[this.targetStatus] };
disabled: false }
}; model.operate = device.name || '';
const device = this.$store.getters['map/getDeviceByCode'](code);
if (device) {
const control = (device || {}).state;
if (control) {
model.control = { status: control.status, name: this.controlProps[control.status] };
model.target = { status: this.targetStatus, name: this.controlProps[this.targetStatus] };
} }
this.tableData.push(model);
const station = this.$store.getters['map/getDeviceByCode'](device.stationCode); });
if (station) {
model.operate = station.name || '';
}
}
this.tableData.push(model);
}, },
doShow(msgHead) { doShow(msgHead) {
getMemberInfo(this.$route.query.group, msgHead.sourceMemberId).then(resp => {
if (resp.data && resp.data.deviceName && resp.data.name) {
this.requestInfo = `${ resp.data.deviceName}(${resp.data.name})`;
}
});
this.dialogShow = true; this.dialogShow = true;
this.disabledAgree = true; this.disabledAgree = true;
this.createTimer(); this.createTimer();
this.updateTableData(msgHead.stationControlCode); this.updateTableData(msgHead.params.stationCodes);
const operate = { const operate = {
start: true, start: true,
type: MapDeviceType.StationControl.type,
operation: OperationEvent.StationControl.controlResponse.menu.operation operation: OperationEvent.StationControl.controlResponse.menu.operation
}; };
@ -213,29 +218,19 @@ export default {
if (this.dialogShow) { if (this.dialogShow) {
this.$store.dispatch('socket/shiftMsgQueue'); this.$store.dispatch('socket/shiftMsgQueue');
} }
this.count = 0; this.count = 0;
this.dialogShow = false; this.dialogShow = false;
this.clearTimer(); this.clearTimer();
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
this.$refs.multipleTable.setCurrentRow(); this.$refs.multipleTable.setCurrentRow();
}, },
serializeCodeListWithSeparator(sep) {
const codeList = [];
if (this.selection && this.selection.length) {
this.selection.forEach(elem => {
codeList.push(elem.code);
});
}
return codeList.join(sep);
},
handleChooseChange(selection) { handleChooseChange(selection) {
this.selection = selection; this.selection = selection;
if (selection && selection.length) { if (selection && selection.length) {
const codeList = selection.map(elem => { return elem.code; });
const operate = { const operate = {
type: MapDeviceType.StationControl.type,
operation: OperationEvent.StationControl.controlResponse.choose.operation, operation: OperationEvent.StationControl.controlResponse.choose.operation,
val: this.serializeCodeListWithSeparator('::') val: codeList.join('::')
}; };
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
@ -244,48 +239,67 @@ export default {
} }
}); });
} else if (!selection) { } else if (!selection) {
this.$messageBox('请选择一条数据'); this.$messageBox(this.$t('menu.passiveDialog.selectData'));
} }
}, },
agree() { agree() {
const stationCodes = [];
this.tableData.forEach(item => {
if (item.agree) {
stationCodes.push(item.code);
}
});
const operate = { const operate = {
send: true, start: true,
over: true,
type: MapDeviceType.StationControl.type,
operation: OperationEvent.StationControl.controlResponse.agree.operation, operation: OperationEvent.StationControl.controlResponse.agree.operation,
val: this.selection[0].code, send: true,
prdType: this.$store.state.training.prdType cmdType: this.$store.state.training.prdType == '01' ? CMD.ControlConvertMenu.CMD_CM_REPLY_CENTER_CONTROL : CMD.ControlConvertMenu.CMD_CM_REPLY_STATION_CONTROL,
param: {
sourceMemberId: this.sourceMemberId,
stationCodes: stationCodes,
agree: true
}
}; };
this.clearTimer(); this.clearTimer();
this.disabledAgree = true; this.disabledAgree = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.doClose(); this.doClose();
} }
}).catch(() => { }).catch(() => {
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow();
}); });
}, },
refuse() { refuse() {
const stationCodes = [];
this.tableData.forEach(item => {
if (item.agree) {
stationCodes.push(item.code);
}
});
const operate = { const operate = {
send: true, start: true,
over: true,
type: MapDeviceType.StationControl.type,
operation: OperationEvent.StationControl.controlResponse.refuse.operation, operation: OperationEvent.StationControl.controlResponse.refuse.operation,
val: this.tableData[0].code, send: true,
prdType: this.$store.state.training.prdType cmdType: this.$store.state.training.prdType == '01' ? CMD.ControlConvertMenu.CMD_CM_REPLY_CENTER_CONTROL : CMD.ControlConvertMenu.CMD_CM_REPLY_STATION_CONTROL,
param: {
sourceMemberId: this.sourceMemberId,
stationCodes: stationCodes,
agree: false
}
}; };
this.clearTimer(); this.clearTimer();
this.disabledAgree = true; this.disabledAgree = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.doClose(); this.doClose();
} }
}).catch(() => { }).catch(() => {
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow();
}); });
} }
} }
@ -293,10 +307,10 @@ export default {
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss"; @import "src/styles/mixin.scss";
.control-label { .control-label {
line-height: 30px; line-height: 30px;
font-size: 18px; font-size: 18px;
} }
</style> </style>