修改代码

This commit is contained in:
ival 2019-09-23 09:12:36 +08:00
parent 7be7e3eac3
commit 39d3ee757a

View File

@ -1,441 +1,463 @@
<template>
<el-dialog class="fuzhou-01__systerm station-control-convert" :title="$t('menu.menuDialog.controlModeConversion')" :visible.sync="show" width="700px"
:before-close="doClose" :showClose="true" :zIndex="2000" :modal="false" :close-on-click-modal="false"
v-dialogDrag>
<el-table ref="multipleTable" :data="tableData" border row-key="code" style="width: 100%" height="250" center
size="mini" highlight-current-row>
<el-table-column prop="check" :label="$t('menu.menuDialog.select')" width="60" :id="domIdChoose" style="margin-left:30px">
<template slot-scope="scope">
<el-checkbox ref="check" v-model="scope.row.check" :disabled="scope.row.disabled"></el-checkbox>
</template>
</el-table-column>
<el-table-column prop="operate" :label="$t('menu.menuDialog.operatingArea')" width="140">
<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="$t('menu.menuDialog.controlMode')" width="80">
<template slot-scope="scope">
<span :style="{color: scope.row.disabled ? '#CBCBCB':'unset'}">{{scope.row.control}}</span>
</template>
</el-table-column>
<el-table-column prop="status" :label="$t('menu.menuDialog.centerStationCommunicationStatus')" width="140">
<template slot-scope="scope">
<span :style="{color: scope.row.disabled ? '#CBCBCB':'unset'}">{{scope.row.status}}</span>
</template>
</el-table-column>
<el-table-column prop="result" :label="$t('menu.menuDialog.transferExecutionStatus')">
<template slot-scope="scope">
<span :style="{color: scope.row.disabled ? '#CBCBCB':'unset'}">{{scope.row.result}}</span>
</template>
</el-table-column>
</el-table>
<el-row class="button-group">
<el-col :span="10" :offset="3">
<el-button v-if="isFork" :id="domIdFork" :disabled="disabledCommit" @click="forkCommit">{{$t('menu.menuDialog.forcedStationControl')}}</el-button>
<el-button v-if="isRequest" :id="domIdRequest" :disabled="disabledCommit" @click="requestCommit">{{$t('menu.menuDialog.requestStationControl')}}
</el-button>
<el-button v-if="isConter" :id="domIdConter" :disabled="disabledCommit" @click="conterCommit">{{$t('menu.menuDialog.requestInTheControl')}}
</el-button>
</el-col>
<el-col :span="6" :offset="4">
<el-button :id="domIdCancel" :disabled="disabledClose" @click="cancel">{{$t('menu.menuDialog.close')}}
</el-button>
</el-col>
</el-row>
<two-confirmation ref="twoConfirmation" @setOperate="getOperate"></two-confirmation>
</el-dialog>
<el-dialog
v-dialogDrag
class="fuzhou-01__systerm station-control-convert"
:title="$t('menu.menuDialog.controlModeConversion')"
:visible.sync="show"
width="700px"
:before-close="doClose"
:show-close="true"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<el-table
ref="multipleTable"
:data="tableData"
border
row-key="code"
style="width: 100%"
height="250"
center
size="mini"
highlight-current-row
>
<el-table-column :id="domIdChoose" prop="check" :label="$t('menu.menuDialog.select')" width="60" style="margin-left:30px">
<template slot-scope="scope">
<el-checkbox ref="check" v-model="scope.row.check" :disabled="scope.row.disabled" />
</template>
</el-table-column>
<el-table-column prop="operate" :label="$t('menu.menuDialog.operatingArea')" width="140">
<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="$t('menu.menuDialog.controlMode')" width="80">
<template slot-scope="scope">
<span :style="{color: scope.row.disabled ? '#CBCBCB':'unset'}">{{ scope.row.control }}</span>
</template>
</el-table-column>
<el-table-column prop="status" :label="$t('menu.menuDialog.centerStationCommunicationStatus')" width="140">
<template slot-scope="scope">
<span :style="{color: scope.row.disabled ? '#CBCBCB':'unset'}">{{ scope.row.status }}</span>
</template>
</el-table-column>
<el-table-column prop="result" :label="$t('menu.menuDialog.transferExecutionStatus')">
<template slot-scope="scope">
<span :style="{color: scope.row.disabled ? '#CBCBCB':'unset'}">{{ scope.row.result }}</span>
</template>
</el-table-column>
</el-table>
<el-row class="button-group">
<el-col :span="10" :offset="3">
<el-button v-if="isFork" :id="domIdFork" :disabled="disabledCommit" @click="forkCommit">{{ $t('menu.menuDialog.forcedStationControl') }}</el-button>
<el-button v-if="isRequest" :id="domIdRequest" :disabled="disabledCommit" @click="requestCommit">{{ $t('menu.menuDialog.requestStationControl') }}
</el-button>
<el-button v-if="isConter" :id="domIdConter" :disabled="disabledCommit" @click="conterCommit">{{ $t('menu.menuDialog.requestInTheControl') }}
</el-button>
</el-col>
<el-col :span="6" :offset="4">
<el-button :id="domIdCancel" :disabled="disabledClose" @click="cancel">{{ $t('menu.menuDialog.close') }}
</el-button>
</el-col>
</el-row>
<two-confirmation ref="twoConfirmation" @setOperate="getOperate" />
</el-dialog>
</template>
<script>
import { mapGetters } from 'vuex';
import { MapDeviceType, TrainingMode, OperationEvent, getDomIdByOperation, checkOperationIsCurrentOperate } from '@/scripts/ConstDic';
import TwoConfirmation from './childDialog/twoConfirmation';
export default {
name: 'StationControlConvert',
data() {
return {
operate: null,
dialogShow: false,
disabledSend: false,
disabledSure: false,
disabledClose: false,
operation: '',
controlProps: {
'01': this.$t('menu.menuDialog.inTheControl'),
'02': this.$t('menu.menuDialog.stationControl')
},
selection: [],
tableData: [],
timer: null,
count: 0,
flagListBit: [],
backOperate: '',
timeout: 61,
counts: 0,
}
},
components: {
TwoConfirmation
},
computed: {
...mapGetters('map', [
'stationList',
'stationControlList',
]),
...mapGetters('training', [
'mode',
'started'
]),
disabledCommit() {
return this.disabledSend || this.disabledSure;
},
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
isFork() {
if (this.dialogShow) {
return checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.forcedStationControl)
}
},
isRequest() {
if (this.dialogShow) {
return checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.requestStationControl)
}
},
isConter() {
if (this.dialogShow) {
return checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.requestCentralControl)
}
},
domIdChoose() {
if (this.dialogShow) {
if (checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.forcedStationControl)) {
return OperationEvent.StationControl.forcedStationControl.choose.domId
} else if (checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.requestStationControl)) {
return OperationEvent.StationControl.requestStationControl.choose.domId
} else if (checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.requestCentralControl)) {
return OperationEvent.StationControl.requestCentralControl.choose.domId
}
}
},
domIdConter() {
return this.dialogShow ? OperationEvent.StationControl.requestCentralControl.menu.domId : '';
},
domIdFork() {
return this.dialogShow ? OperationEvent.StationControl.forcedStationControl.menu.domId : '';
},
domIdRequest() {
return this.dialogShow ? OperationEvent.StationControl.requestStationControl.menu.domId : '';
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
}
},
watch: {
'$store.state.socket.msgHead': function (elem) {
if (elem) {
this.flagListBit[this.selection.forEach(elem => { return elem.stationControlCode == elem.code })] = false;
if (elem.hasOwnProperty('timeout')) {
this.updateTableValue(elem.stationControlCode, { result: this.$t('menu.menuDialog.acceptConversionResponseTimeout') }, false);
} else if (elem.hasOwnProperty('agree')) {
if (elem.agree) {
this.updateTableValue(elem.stationControlCode, { result: this.$t('menu.menuDialog.controlModeTransfersuccees') }, true);
} else {
this.updateTableValue(elem.stationControlCode, { result: this.$t('menu.menuDialog.controlModeTransferFailed') }, false);
}
}
this.disabledClose = false;
this.disabledSure = false;
}
},
backOperate: function (operate) {
if (this.dialogShow && operate) {
if (operate.selection && operate.selection.length) {
operate.selection.forEach(elem => {
if (operate.commit) {
this.updateTableValue(elem.code, { result: `${$t('menu.menuDialog.senedMessageOne')} ,${this.timeout} ${$t('menu.menuDialog.senedMessageTwo')}` }, false);
} else if (operate.cancel) {
this.updateTableValue(elem.code, { result: '' }, false);
}
})
}
}
},
//
tableData: {
handler(val, oldVal) {
this.checkTableDataSelction(val);
},
deep: true
}
},
mounted() {
this.loadTableData();
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
})
},
methods: {
updateTableValue(code, result, success) {
this.tableData.forEach((row, index) => {
if (row.code == code) {
for (let prop in result) {
row[prop] = result[prop];
}
if (success) {
if (checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.forcedStationControl) || checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.requestStationControl)) {
row.control = this.controlProps['02']; //01: 02:
} else if (checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.requestCentralControl)) {
row.control = this.controlProps['01']; //01: 02:
}
row.disabled = true;
row.check = false;
}
}
});
},
checkTableDataSelction(data) {
let selection = [];
if (data && data.length > 0) {
data.forEach(row => {
if (row.check && !row.disabled) {
selection.push(row);
}
})
}
import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent, checkOperationIsCurrentOperate } from '@/scripts/ConstDic';
import TwoConfirmation from './childDialog/twoConfirmation';
this.disabledSend = selection.length ? false : true;
if (JSON.stringify(selection) !== JSON.stringify(this.selection)) {
this.handleChooseChange(selection);
this.selection = selection;
}
},
checkBoxDisabled(row) {
let control = (this.$store.getters['map/getDeviceByCode'](row.code) || {});
if (checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.forcedStationControl) || checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.requestStationControl)) {
if (control && control.status == '02') { //01: 02:
return true;
}
} else if (checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.requestCentralControl)) {
if (control && control.status == '01') { //01: 02:
return true;
}
}
export default {
name: 'StationControlConvert',
components: {
TwoConfirmation
},
data() {
return {
operate: null,
dialogShow: false,
disabledSend: false,
disabledSure: false,
disabledClose: false,
operation: '',
controlProps: {
'01': this.$t('menu.menuDialog.inTheControl'),
'02': this.$t('menu.menuDialog.stationControl')
},
selection: [],
tableData: [],
timer: null,
count: 0,
flagListBit: [],
backOperate: '',
timeout: 61,
counts: 0
};
},
computed: {
...mapGetters('map', [
'stationList',
'stationControlList'
]),
...mapGetters('training', [
'mode',
'started'
]),
disabledCommit() {
return this.disabledSend || this.disabledSure;
},
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
isFork() {
if (this.dialogShow) {
return checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.forcedStationControl);
}
return false;
},
isRequest() {
if (this.dialogShow) {
return checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.requestStationControl);
}
return false;
},
isConter() {
if (this.dialogShow) {
return checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.requestCentralControl);
}
return false;
},
domIdChoose() {
if (this.dialogShow) {
if (checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.forcedStationControl)) {
return OperationEvent.StationControl.forcedStationControl.choose.domId;
} else if (checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.requestStationControl)) {
return OperationEvent.StationControl.requestStationControl.choose.domId;
} else if (checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.requestCentralControl)) {
return OperationEvent.StationControl.requestCentralControl.choose.domId;
}
}
return false;
},
domIdConter() {
return this.dialogShow ? OperationEvent.StationControl.requestCentralControl.menu.domId : '';
},
domIdFork() {
return this.dialogShow ? OperationEvent.StationControl.forcedStationControl.menu.domId : '';
},
domIdRequest() {
return this.dialogShow ? OperationEvent.StationControl.requestStationControl.menu.domId : '';
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
}
},
watch: {
'$store.state.socket.msgHead': function (elem) {
if (elem) {
this.flagListBit[this.selection.forEach(elem => { return elem.stationControlCode == elem.code; })] = false;
if (elem.hasOwnProperty('timeout')) {
this.updateTableValue(elem.stationControlCode, { result: this.$t('menu.menuDialog.acceptConversionResponseTimeout') }, false);
} else if (elem.hasOwnProperty('agree')) {
if (elem.agree) {
this.updateTableValue(elem.stationControlCode, { result: this.$t('menu.menuDialog.controlModeTransfersuccees') }, true);
} else {
this.updateTableValue(elem.stationControlCode, { result: this.$t('menu.menuDialog.controlModeTransferFailed') }, false);
}
}
this.disabledClose = false;
this.disabledSure = false;
}
},
backOperate: function (operate) {
if (this.dialogShow && operate) {
if (operate.selection && operate.selection.length) {
operate.selection.forEach(elem => {
if (operate.commit) {
this.updateTableValue(elem.code, { result: `${this.$t('menu.menuDialog.senedMessageOne')} ,${this.timeout} ${this.$t('menu.menuDialog.senedMessageTwo')}` }, false);
} else if (operate.cancel) {
this.updateTableValue(elem.code, { result: '' }, false);
}
});
}
}
},
//
tableData: {
handler(val, oldVal) {
this.checkTableDataSelction(val);
},
deep: true
}
},
mounted() {
this.loadTableData();
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
});
},
methods: {
updateTableValue(code, result, success) {
this.tableData.forEach((row, index) => {
if (row.code == code) {
for (const prop in result) {
row[prop] = result[prop];
}
if (success) {
if (checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.forcedStationControl) || checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.requestStationControl)) {
row.control = this.controlProps['02']; // 01: 02:
} else if (checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.requestCentralControl)) {
row.control = this.controlProps['01']; // 01: 02:
}
row.disabled = true;
row.check = false;
}
}
});
},
checkTableDataSelction(data) {
const selection = [];
if (data && data.length > 0) {
data.forEach(row => {
if (row.check && !row.disabled) {
selection.push(row);
}
});
}
},
loadTableData() {
this.tableData = [];
this.stationControlList.forEach(control => {
let station = this.$store.getters['map/getDeviceByCode'](control.stationCode);
this.tableData.push({
code: control.code,
operate: station.name || '',
control: '',
check: false,
disabled: false,
status: this.$t('menu.menuDialog.normal'),
result: '',
});
})
},
initTableDataStatus() {
this.tableData.forEach(row => {
row.disabled = this.checkBoxDisabled(row);
row.check = false;
row.result = '';
let control = this.$store.getters['map/getDeviceByCode'](row.code);
if (control) {
row.control = this.controlProps[control.status];
}
})
},
doShow(operate) {
if (!this.dialogShow) {
this.operate = operate || {};
this.operation = operate.operation;
this.disabledSure = false;
this.initTableDataStatus();
}
this.dialogShow = true;
this.$store.dispatch('training/emitTipFresh');
},
doClose() {
if (this.dialogShow) {
this.$store.dispatch('socket/shiftMsgQueue');
}
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
this.$refs.multipleTable.setCurrentRow();
},
cancel() {
let operate = {
type: 'bar',
operation: OperationEvent.Command.cancel.menu.operation,
}
this.disabledSend = !selection.length;
if (JSON.stringify(selection) !== JSON.stringify(this.selection)) {
this.handleChooseChange(selection);
this.selection = selection;
}
},
checkBoxDisabled(row) {
const control = (this.$store.getters['map/getDeviceByCode'](row.code) || {});
if (checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.forcedStationControl) || checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.requestStationControl)) {
if (control && control.status == '02') { // 01: 02:
return true;
}
} else if (checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.requestCentralControl)) {
if (control && control.status == '01') { // 01: 02:
return true;
}
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
})
},
setTimer() {
this.clearTimer();
this.flagListBit = new Array(this.selection.length).fill(true);
this.timer = setInterval(() => {
(this.selection || []).forEach((elem, index) => {
if (this.flagListBit[index]) {
elem['count'] = (elem['count'] || 0) + 1;
elem['count'] > this.timeout && (
this.flagListBit[index] = false,
this.setRequestTimeout(elem)
)
}
})
},
loadTableData() {
this.tableData = [];
this.stationControlList.forEach(control => {
const station = this.$store.getters['map/getDeviceByCode'](control.stationCode);
this.tableData.push({
code: control.code,
operate: station.name || '',
control: '',
check: false,
disabled: false,
status: this.$t('menu.menuDialog.normal'),
result: ''
});
});
},
initTableDataStatus() {
this.tableData.forEach(row => {
row.disabled = this.checkBoxDisabled(row);
row.check = false;
row.result = '';
const control = this.$store.getters['map/getDeviceByCode'](row.code);
if (control) {
row.control = this.controlProps[control.status];
}
});
},
doShow(operate) {
if (!this.dialogShow) {
this.operate = operate || {};
this.operation = operate.operation;
this.disabledSure = false;
this.initTableDataStatus();
}
this.dialogShow = true;
this.$store.dispatch('training/emitTipFresh');
},
doClose() {
if (this.dialogShow) {
this.$store.dispatch('socket/shiftMsgQueue');
}
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
this.$refs.multipleTable.setCurrentRow();
},
cancel() {
const operate = {
type: 'bar',
operation: OperationEvent.Command.cancel.menu.operation
};
this.flagListBit.findIndex(elem => { return elem; }) < 0 && this.clearTimer();
}, 1000);
},
clearTimer() {
this.count = 0;
if (this.timer) {
clearInterval(this.timer);
this.timer = null;
}
},
setRequestTimeout(elem) {
elem['count'] = 0;
this.$store.dispatch('socket/pushMsgQueue',
{ type: "resp", timeout: "true", stationControlCode: elem.code }
);
},
serializeCodeListWithSeparator(sep) {
let 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) {
let operate = {
type: MapDeviceType.StationControl.type,
operation: '',
val: this.serializeCodeListWithSeparator('::'),
selection: selection
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
});
},
setTimer() {
this.clearTimer();
this.flagListBit = new Array(this.selection.length).fill(true);
this.timer = setInterval(() => {
(this.selection || []).forEach((elem, index) => {
if (this.flagListBit[index]) {
elem['count'] = (elem['count'] || 0) + 1;
elem['count'] > this.timeout && (
this.flagListBit[index] = false,
this.setRequestTimeout(elem)
);
}
});
if (checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.forcedStationControl)) {
operate.operation = OperationEvent.StationControl.forcedStationControl.choose.operation
} else if (checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.requestStationControl)) {
operate.operation = OperationEvent.StationControl.requestStationControl.choose.operation
} else if (checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.requestCentralControl)) {
operate.operation = OperationEvent.StationControl.requestCentralControl.choose.operation
}
this.flagListBit.findIndex(elem => { return elem; }) < 0 && this.clearTimer();
}, 1000);
},
clearTimer() {
this.count = 0;
if (this.timer) {
clearInterval(this.timer);
this.timer = null;
}
},
setRequestTimeout(elem) {
elem['count'] = 0;
this.$store.dispatch('socket/pushMsgQueue',
{ type: 'resp', timeout: 'true', stationControlCode: elem.code }
);
},
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 operate = {
type: MapDeviceType.StationControl.type,
operation: '',
val: this.serializeCodeListWithSeparator('::'),
selection: selection
};
this.disabledSure = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.disabledSure = false;
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
})
} else if (!selection) {
this.$messageBox(this.$t('menu.menuDialog.selectData'));
}
},
requestCommit() {
let operate = {
type: MapDeviceType.StationControl.type,
messages: [this.$t('menu.menuDialog.confirmStationControlTip')],
operation: OperationEvent.StationControl.requestStationControl.menu.operation,
val: this.serializeCodeListWithSeparator('::'),
selection: this.selection
}
if (checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.forcedStationControl)) {
operate.operation = OperationEvent.StationControl.forcedStationControl.choose.operation;
} else if (checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.requestStationControl)) {
operate.operation = OperationEvent.StationControl.requestStationControl.choose.operation;
} else if (checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.requestCentralControl)) {
operate.operation = OperationEvent.StationControl.requestCentralControl.choose.operation;
}
this.selection.forEach((elem, index) => {
operate.messages.push(`${$t('menu.menuDialog.operatingArea')} ${index + 1}:${elem.operate}`);
});
this.disabledSure = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.disabledSure = false;
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
});
} else if (!selection) {
this.$messageBox(this.$t('menu.menuDialog.selectData'));
}
},
requestCommit() {
const operate = {
type: MapDeviceType.StationControl.type,
messages: [this.$t('menu.menuDialog.confirmStationControlTip')],
operation: OperationEvent.StationControl.requestStationControl.menu.operation,
val: this.serializeCodeListWithSeparator('::'),
selection: this.selection
};
this.disabledSure = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.twoConfirmation.doShow(operate);
} else {
this.disabledSure = false;
}
}).catch((error) => {
this.disabledSure = false;
})
},
forkCommit() {
let operate = {
type: MapDeviceType.StationControl.type,
messages: [this.$t('menu.menuDialog.confirmInTheControlTip')],
operation: OperationEvent.StationControl.forcedStationControl.menu.operation,
val: this.serializeCodeListWithSeparator('::'),
selection: this.selection
}
this.selection.forEach((elem, index) => {
operate.messages.push(`${this.$t('menu.menuDialog.operatingArea')} ${index + 1}:${elem.operate}`);
});
this.selection.forEach((elem, index) => {
operate.messages.push(`${$t('menu.menuDialog.operatingArea')} ${index + 1}:${elem.operate}`);
});
this.disabledSure = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.twoConfirmation.doShow(operate);
} else {
this.disabledSure = false;
}
}).catch(() => {
this.disabledSure = false;
});
},
forkCommit() {
const operate = {
type: MapDeviceType.StationControl.type,
messages: [this.$t('menu.menuDialog.confirmInTheControlTip')],
operation: OperationEvent.StationControl.forcedStationControl.menu.operation,
val: this.serializeCodeListWithSeparator('::'),
selection: this.selection
};
this.disabledSure = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.twoConfirmation.doShow(operate);
} else {
this.disabledSure = false;
}
}).catch(() => {
this.disabledSure = false;
})
},
conterCommit() { //
let operate = {
type: MapDeviceType.StationControl.type,
messages: [this.$t('menu.menuDialog.confirmInTheControlTip')],
operation: OperationEvent.StationControl.requestCentralControl.menu.operation,
val: this.serializeCodeListWithSeparator('::'),
selection: this.selection
}
this.selection.forEach((elem, index) => {
operate.messages.push(`${this.$t('menu.menuDialog.operatingArea')} ${index + 1}:${elem.operate}`);
});
this.selection.forEach((elem, index) => {
operate.messages.push(`${$t('menu.menuDialog.operatingArea')} ${index + 1}:${elem.operate}`);
});
this.disabledSure = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.twoConfirmation.doShow(operate);
} else {
this.disabledSure = false;
}
}).catch(() => {
this.disabledSure = false;
});
},
conterCommit() { //
const operate = {
type: MapDeviceType.StationControl.type,
messages: [this.$t('menu.menuDialog.confirmInTheControlTip')],
operation: OperationEvent.StationControl.requestCentralControl.menu.operation,
val: this.serializeCodeListWithSeparator('::'),
selection: this.selection
};
this.disabledSure = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.twoConfirmation.doShow(operate);
} else {
this.disabledSure = false;
}
}).catch(() => {
this.disabledSure = false;
})
},
getOperate(operate) {
this.backOperate = operate;
if (operate.cancel) {
this.disabledSure = this.disabledSend = false;
}
if (operate.commit || operate.timeout) {
this.disabledSend = this.disabledSure = true;
}
this.setTimer();
this.disabledClose = true;
this.counts = 1;
}
}
}
this.selection.forEach((elem, index) => {
operate.messages.push(`${this.$t('menu.menuDialog.operatingArea')} ${index + 1}:${elem.operate}`);
});
this.disabledSure = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.twoConfirmation.doShow(operate);
} else {
this.disabledSure = false;
}
}).catch(() => {
this.disabledSure = false;
});
},
getOperate(operate) {
this.backOperate = operate;
if (operate.cancel) {
this.disabledSure = this.disabledSend = false;
}
if (operate.commit || operate.timeout) {
this.disabledSend = this.disabledSure = true;
}
this.setTimer();
this.disabledClose = true;
this.counts = 1;
}
}
};
</script>