佛山控制模式转换调整

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

View File

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

View File

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