控制权转移代码调整
This commit is contained in:
parent
ed6694a080
commit
c4c1f79258
@ -89,11 +89,7 @@ export default {
|
||||
selection: [],
|
||||
tableData: [],
|
||||
timer: null,
|
||||
count: 0,
|
||||
flagListBit: [],
|
||||
backOperate: '',
|
||||
timeout: 61,
|
||||
counts: 0
|
||||
count: 0
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -154,38 +150,10 @@ export default {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// '$store.state.socket.msgHead': function (elem) {
|
||||
// if (elem) {
|
||||
// this.flagListBit[this.selection.forEach(elem => { return elem.stationControlCode == elem.code; })] = false;
|
||||
// if (elem.hasOwnProperty('success')) {
|
||||
// if (elem.success) {
|
||||
// (elem.stationCodes || []).forEach(code => {
|
||||
// this.updateTableValue(code, { result: this.$t('menu.menuDialog.controlModeTransfersuccees') }, true);
|
||||
// this.removeSelection(code);
|
||||
// });
|
||||
// } else {
|
||||
// (elem.stationCodes || []).forEach(code => {
|
||||
// this.updateTableValue(code, { result: this.$t('menu.menuDialog.controlModeTransferFailed') }, false);
|
||||
// this.removeSelection(code);
|
||||
// });
|
||||
// }
|
||||
// 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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
'$store.state.map.controlTransfer':function (controlTransferList) {
|
||||
controlTransferList.forEach(controlTransfer=>{
|
||||
this.updateTableValue(controlTransfer);
|
||||
});
|
||||
},
|
||||
// 深度数据状态
|
||||
tableData: {
|
||||
@ -202,20 +170,25 @@ export default {
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
updateTableValue(code, result, success) {
|
||||
updateTableValue(controlTransfer) {
|
||||
this.tableData.forEach((row, index) => {
|
||||
if (row.code == code) {
|
||||
for (const prop in result) {
|
||||
row[prop] = result[prop];
|
||||
}
|
||||
if (success) {
|
||||
if (OperationHandler.checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.forcedStationControl) || OperationHandler.checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.requestStationControl)) {
|
||||
row.control = this.controlProps['Local']; // Center:中控, Local:站控
|
||||
} else if (OperationHandler.checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.requestCentralControl)) {
|
||||
row.control = this.controlProps['Center']; // Center:中控, Local:站控
|
||||
if (row.code == controlTransfer.code) {
|
||||
if (controlTransfer.applicantIdOfControlTransfer) {
|
||||
row.result = this.$t('menu.menuDialog.senedMessageOne') + controlTransfer.validDurationOfControlTransferApplication + this.$t('menu.menuDialog.senedMessageTwo');
|
||||
} else {
|
||||
if (row.control != this.controlProps[controlTransfer.controlMode]) {
|
||||
row.result = this.$t('menu.menuDialog.controlModeTransfersuccees');
|
||||
row.control = this.controlProps[controlTransfer.controlMode];
|
||||
this.removeSelection(controlTransfer.code);
|
||||
row.disabled = true;
|
||||
row.check = false;
|
||||
} else {
|
||||
row.result = this.$t('menu.menuDialog.controlModeTransferFailed');
|
||||
this.removeSelection(controlTransfer.code);
|
||||
row.check = false;
|
||||
}
|
||||
row.disabled = true;
|
||||
row.check = false;
|
||||
this.disabledClose = false;
|
||||
this.disabledSure = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -303,30 +276,6 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
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)
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
this.flagListBit.findIndex(elem => { return elem; }) < 0 && this.clearTimer();
|
||||
}, 1000);
|
||||
},
|
||||
clearTimer() {
|
||||
this.count = 0;
|
||||
if (this.timer) {
|
||||
clearInterval(this.timer);
|
||||
this.timer = null;
|
||||
}
|
||||
},
|
||||
removeSelection(code) {
|
||||
let selectionIndex = -1;
|
||||
this.selection.forEach((item, index) => {
|
||||
@ -338,10 +287,6 @@ export default {
|
||||
this.selection.splice(selectionIndex, 1);
|
||||
}
|
||||
},
|
||||
setRequestTimeout(elem) {
|
||||
this.updateTableValue(elem.code, { result: this.$t('menu.menuDialog.acceptConversionResponseTimeout') }, false);
|
||||
this.removeSelection(elem.code);
|
||||
},
|
||||
handleChooseChange(selection) {
|
||||
this.selection = selection;
|
||||
const stationCodeList = selection.map(elem => { return elem.code; });
|
||||
@ -456,7 +401,6 @@ export default {
|
||||
});
|
||||
},
|
||||
getOperate(operate) {
|
||||
this.backOperate = operate;
|
||||
if (operate.cancel) {
|
||||
this.disabledSure = this.disabledSend = false;
|
||||
this.disabledClose = false;
|
||||
@ -465,8 +409,6 @@ export default {
|
||||
this.disabledSend = this.disabledSure = true;
|
||||
this.disabledClose = true;
|
||||
}
|
||||
this.setTimer();
|
||||
this.counts = 1;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -90,7 +90,6 @@ export default {
|
||||
tableData: [],
|
||||
timer: null,
|
||||
count: 0
|
||||
// backOperate: ''
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -151,27 +150,6 @@ export default {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// '$store.state.socket.msgHead': function (elem) {
|
||||
// if (elem) {
|
||||
// this.flagListBit[this.selection.forEach(elem => { return elem.stationControlCode == elem.code; })] = false;
|
||||
// if (elem.hasOwnProperty('success')) {
|
||||
// if (elem.success) {
|
||||
// (elem.stationCodes || []).forEach(code => {
|
||||
// this.updateTableValue(code, { result: this.$t('menu.menuDialog.controlModeTransfersuccees') }, true);
|
||||
// this.removeSelection(code);
|
||||
// });
|
||||
// } else {
|
||||
// (elem.stationCodes || []).forEach(code => {
|
||||
// this.updateTableValue(code, { result: this.$t('menu.menuDialog.controlModeTransferFailed') }, false);
|
||||
// this.removeSelection(code);
|
||||
// });
|
||||
// }
|
||||
// this.$store.dispatch('socket/shiftMsgQueue');
|
||||
// this.disabledClose = false;
|
||||
// this.disabledSure = false;
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
'$store.state.map.controlTransfer':function (controlTransferList) {
|
||||
controlTransferList.forEach(controlTransfer=>{
|
||||
this.updateTableValue(controlTransfer);
|
||||
@ -214,22 +192,6 @@ export default {
|
||||
}
|
||||
}
|
||||
});
|
||||
// this.tableData.forEach((row, index) => {
|
||||
// if (row.code == code) {
|
||||
// for (const prop in result) {
|
||||
// row[prop] = result[prop];
|
||||
// }
|
||||
// if (success) {
|
||||
// if (OperationHandler.checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.forcedStationControl) || OperationHandler.checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.requestStationControl)) {
|
||||
// row.control = this.controlProps['Local']; // Center:中控, Local:站控
|
||||
// } else if (OperationHandler.checkOperationIsCurrentOperate(this.operation, OperationEvent.StationControl.requestCentralControl)) {
|
||||
// row.control = this.controlProps['Center']; // Center:中控, Local:站控
|
||||
// }
|
||||
// row.disabled = true;
|
||||
// row.check = false;
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
},
|
||||
checkTableDataSelction(data) {
|
||||
const selection = [];
|
||||
|
Loading…
Reference in New Issue
Block a user