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