添加调度命令无线受令功能

This commit is contained in:
dong 2023-02-02 18:09:54 +08:00
parent 2aae79d71e
commit 0b9b2a14e1
2 changed files with 347 additions and 25 deletions

View File

@ -4578,6 +4578,22 @@ export const OperationEvent = {
signCmdFalse: {
operation: '1708',
domId: '_Tips-DispatchCmd-menuButton-signCmdFalse{BOTTOM}'
},
findTrain: {
operation: '1709',
domId: '_Tips-DispatchCmd-menuButton-findTrain{BOTTOM}'
},
permissionAddWireless: {
operation: '1710',
domId: '_Tips-DispatchCmd-menuButton-permissionAddWireless{BOTTOM}'
},
trainAllographCmd: {
operation: '1711',
domId: '_Tips-DispatchCmd-menuButton-trainAllographCmd{BOTTOM}'
},
deleteTrainTable: {
operation: '1712',
domId: '_Tips-DispatchCmd-menuButton-deleteTrainTable{BOTTOM}'
}
}
}

View File

@ -381,7 +381,7 @@
</div>
<div class="table">
<el-table ref="table" :data="getTableData" border style="width: 100%" :header-cell-class-name="cellClass" :height="tableHeight" highlight-current-row @select="selectionChange" @select-all="selectionChange" @row-click="tableRowChange">
<el-table-column type="selection" :selectable="selectableFn" width="50" />
<el-table-column type="selection" :selectable="selectableFn" width="40" />
<el-table-column prop="name" label="受令单位" width="160" />
<el-table-column prop="copyers" label="抄送" width="120" show-overflow-tooltip />
<el-table-column label="签收状态">
@ -409,9 +409,88 @@
</div>
</div>
</el-col>
<el-col :span="4">
<el-col :span="4" style="height: 100%;">
<div class="right">
常用词汇
<div class="right-top">
<el-tabs v-model="wordTab" type="border-card">
<el-tab-pane label="常用词汇" name="word">
<div class="word-box">
<div v-for="(item, index) in getTableData" :key="index">{{ item.name }}</div>
</div>
</el-tab-pane>
</el-tabs>
</div>
<div class="right-middle">
<el-tabs v-model="wirelessTab" type="border-card">
<el-tab-pane label="无线受令列表" name="wireless">
<el-form ref="form" :model="wirelessObj" label-width="80px" :disabled="!permissionWireless">
<el-form-item label="命令类型">
<el-select v-model="wirelessObj.type" placeholder="请选择" style="width: 100%;">
<el-option label="调度命令" value="dispatchCmd" />
</el-select>
</el-form-item>
<el-form-item label="中转车站">
<el-select v-model="wirelessObj.transStationCode" placeholder="请选择" style="width: 100%;">
<el-option
v-for="item in transStationOption"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item label="车次">
<el-input v-model="wirelessObj.trainNum" />
</el-form-item>
<el-col :span="16">
<el-form-item label="机车">
<el-input v-model="wirelessObj.code" onkeyup="value=value.replace(/[^\d]/g,'')" />
</el-form-item>
</el-col>
<el-col :span="8">
<div class="midle-bottom">
<el-button :id="getDomObj('findTrain').domId" type="primary" :disabled="disabledSent || !permissionWireless" @click="findTrainToTable">查找机车</el-button>
</div>
</el-col>
</el-form>
</el-tab-pane>
<div class="table">
<el-table ref="table6" :data="trainTableData" border style="width: 100%" :header-cell-class-name="cellClass" :height="trainTableHeight" highlight-current-row @current-change="trainTableRowChange">
<el-table-column prop="trainNum" label="车次号" width="100" />
<el-table-column prop="code" label="机车号">
<template slot-scope="scope">
<span>{{ scope.row.code || 'XXXXXX' }}</span>
</template>
</el-table-column>
<el-table-column label="签收状态">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ getSignedStatus(getCurrentState(scope.row)) }}</span>
</template>
</el-table-column>
<el-table-column label="签收人">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ getSignedBy(getCurrentState(scope.row)) || '' }}</span>
</template>
</el-table-column>
<el-table-column label="签收时间" width="160">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ getCurrentState(scope.row).time || '' }}</span>
</template>
</el-table-column>
<el-table-column prop="transStationCode" label="中转车站">
<template slot-scope="scope">
<span>{{ getTransStationName(scope.row.transStationCode) }}</span>
</template>
</el-table-column>
</el-table>
</div>
<div class="midle-bottom">
<el-button :id="getDomObj('permissionAddWireless').domId" type="primary" :disabled="disabledSent" @click="permissionAdd">增加</el-button>
<el-button :id="getDomObj('trainAllographCmd').domId" type="primary" :disabled="disabledTrainAllograph" @click="trainAllographCmd">代签</el-button>
<el-button :id="getDomObj('deleteTrainTable').domId" type="primary" :disabled="disabledSent || !trainRow" @click="deleteTrainTable">删除</el-button>
</div>
</el-tabs>
</div>
</div>
</el-col>
</el-row>
@ -430,8 +509,11 @@ export default {
operateTableHeight: 100,
searchTableHeight: 260,
tableHeight: 200,
trainTableHeight: 200,
activeTab: 'operate',
cmdTab: 'cmd',
wordTab: 'word',
wirelessTab: 'wireless',
textTab: 'text',
typeObj: {
Normal: '普通调度命令',
@ -527,7 +609,16 @@ export default {
{ value: '', label: '全部'},
{ value: true, label: '只显示签收完成的'},
{ value: false, label: '只显示未签收完成的'}
]
],
wirelessObj: {
type: 'dispatchCmd',
transStationCode: '',
trainNum: '',
code: ''
},
trainRow: null,
trainTableData: [],
permissionWireless: false
};
},
computed: {
@ -559,6 +650,14 @@ export default {
}
return s;
},
disabledTrainAllograph() {
let s = false;
const sArr = ['Sent', 'Received', 'SrmReceived'];
if (!this.trainRow || !sArr.includes(this.getCurrentState(this.trainRow).state)) {
s = true;
}
return s;
},
typeOptions() {
const list = [];
Object.keys(this.typeObj).forEach(item => {
@ -613,6 +712,11 @@ export default {
},
DisStationId() {
return this.getActiveSender.deviceCode ? this.getActiveSender.deviceCode : '';
},
transStationOption() {
// const list = [...this.getTableData, {code:'', name: 'GSM-R'}];
const list = [...this.getTableData];
return list;
}
},
watch: {
@ -633,6 +737,7 @@ export default {
this.getOperateTableHeight();
this.getSearchTableHeight();
this.getTableHeight();
this.getTrainTableHeight();
},
'$store.state.socket.simulationReset': function (val) {
this.queryResData = {};
@ -649,8 +754,180 @@ export default {
this.getOperateTableHeight();
this.getSearchTableHeight();
this.getTableHeight();
this.getTrainTableHeight();
},
methods:{
trainAllographCmd() {
if (!this.trainRow) { return; }
const test = `将为【${this.trainRow.trainNum}】次列车,代签 无线调度命令`;
const messageData = [test];
const h = this.$createElement;
messageData.push(h('p', null, '代签之前,请务必与本次列车司机联系确认!'));
messageData.push(h('p', null, '您确定要进行【无线调度命令 代签】操作吗?'));
this.$confirm('提示', {
title: '无线代签操作提示',
message: h('div', null, messageData),
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
console.log('无线受令代签');
const rcId = this.getRcId(this.trainRow.code);
const params = {cmdId: this.command.cmdId, rcId: rcId, proxySign: true};
const operate = {
operation: this.getDomObj('trainAllographCmd').operation,
param: params,
userOperationType: UserOperationType.LEFTCLICK
};
this.$store.dispatch('trainingNew/next', operate).then(({ valid }) => {
if (valid) {
sendCommandNew(this.group, 'CTC_SIGN_DIS_COMMAND', params).then((res) => {
console.log(res, '---res');
this.$message.success('无线受令代签成功!');
this.searchCmd();
this.initData();
}).catch(error => {
this.$messageBox('无线受令代签令失败:' + error.message);
});
}
});
}).catch((err) => {
console.log('取消无线受令代签', err);
});
},
getRcId(val) {
let id = '';
const find = this.command.rcvCompanies.find(item => {
return item.code == val;
});
if (find && find.id) {
id = find.id;
}
return id;
},
getTransStationName(code) {
let name = '';
const find = this.transStationOption.find(item => {
return item.code == code;
});
if (find) {
name = find.name;
}
return name;
},
permissionAdd() {
if (this.permissionWireless) { return; }
const operate = {
operation: this.getDomObj('permissionAddWireless').operation,
userOperationType: UserOperationType.LEFTCLICK
};
this.$store.dispatch('trainingNew/next', operate).then(({valid}) => {
if (valid) {
this.permissionWireless = true;
this.initWirelessData();
}
});
},
initWirelessData() {
this.wirelessObj = {
...this.resetWirelessData()
};
this.trainRow = null;
this.trainTableData = [];
},
resetWirelessData() {
return {
type: 'dispatchCmd',
transStationCode: '',
trainNum: '',
code: ''
};
},
findTrainToTable() {
if (!this.wirelessObj.trainNum) {
this.$messageBox('请选择车次号');
return;
}
const operate = {
operation: this.getDomObj('findTrain').operation,
param: {...this.wirelessObj},
userOperationType: UserOperationType.LEFTCLICK
};
this.$store.dispatch('trainingNew/next', operate).then(({valid}) => {
if (valid) {
sendCommandNew(this.group, 'Train_Query_Trip_Number_Online_Train', {tripNumber: this.wirelessObj.trainNum}).then((res) => {
const code = res.data;
this.wirelessObj.code = code;
const obj = {
name: '',
code: code,
cpType: 'Train',
rsCompany: true,
trainViaGsmR: !this.wirelessObj.transStationCode,
trainNum: this.wirelessObj.trainNum,
transStationCode: this.wirelessObj.transStationCode
};
const index = this.trainTableData.findIndex(item => {
return item.code == code;
});
if (index >= 0) {
this.trainTableData.splice(index, 1, obj);
} else {
this.trainTableData.push(obj);
}
const rcIndex = this.command.rcvCompanies.findIndex(item => {
return item.code == code;
});
if (rcIndex >= 0) {
this.command.rcvCompanies.splice(rcIndex, 1, obj);
} else {
this.command.rcvCompanies.push(obj);
}
}).catch(error => {
this.$messageBox('查找机车失败:' + error.message);
});
}
});
},
deleteTrainTable() {
const operate = {
operation: this.getDomObj('deleteTrainTable').operation,
param: this.trainRow,
userOperationType: UserOperationType.LEFTCLICK
};
this.$store.dispatch('trainingNew/next', operate).then(({valid}) => {
if (valid) {
const index = this.trainTableData.findIndex(item => {
return item == this.trainRow;
});
if (index >= 0) {
this.trainTableData.splice(index, 1);
}
const rcIndex = this.command.rcvCompanies.findIndex(item => {
return item == this.trainRow;
});
if (index >= 0) {
this.command.rcvCompanies.splice(rcIndex, 1);
}
this.trainRow = null;
}
});
},
trainTableRowChange(row) {
this.trainRow = row;
this.setCurrentRow(row, 'table6');
},
getTrainTableHeight() {
const allH = this.$store.state.app.height;
const rightTopH = 241;
const fH = 160;
const tabHeardH = 29;
const paddingH = 10;
const btnH = 40;
let h = allH - rightTopH - fH - tabHeardH - paddingH - btnH;
h = h > 0 ? h : 0;
this.trainTableHeight = h;
},
getDomObj(key) {
return OperationEvent.DispatchCmd.menuButton[key];
},
@ -750,9 +1027,9 @@ export default {
}
});
}
if (state == 'Signed') {
console.log(list, 'list');
}
// if (state == 'Signed') {
// console.log(list, 'list');
// }
return list.reverse();
},
findDisCmdObj(obj, val) {
@ -834,7 +1111,7 @@ export default {
return status;
},
setCurrentRow(obj, refName) {
const tableArr = ['table', 'table1', 'table2', 'table3', 'table4', 'table5'];
const tableArr = ['table', 'table1', 'table2', 'table3', 'table4', 'table5', 'table6'];
tableArr.forEach(key => {
if (key != refName) {
this.$refs[key] && this.$refs[key].setCurrentRow();
@ -853,12 +1130,20 @@ export default {
});
this.setCurrentRow(obj, refName);
this.$refs.table.clearSelection();
this.initWirelessData();
const infoList = this.command.rcvCompanies || [];
infoList.forEach(item => {
const findObj = this.getTableData.find(ii => {
return ii.code == item.code;
});
findObj && this.$refs.table.toggleRowSelection(findObj, true);
if (item.cpType == 'Train') {
this.trainTableData.push(item);
if (refName == 'table1') {
this.permissionWireless = true;
}
} else {
const findObj = this.getTableData.find(ii => {
return ii.code == item.code;
});
findObj && this.$refs.table.toggleRowSelection(findObj, true);
}
});
},
getSignedBy(info) {
@ -994,6 +1279,8 @@ export default {
this.command = {
...this.resetData()
};
this.initWirelessData();
this.permissionWireless = false;
// this.currentInfo = {};
this.$refs.table && this.$refs.table.clearSelection();
this.$refs.form && this.$refs.form.resetFields();
@ -1036,17 +1323,21 @@ export default {
console.log('tabClick');
},
selectionChange(selection) {
const arr = [];
selection.forEach(item => {
arr.push({
name: item.name,
rsCompany: true,
cpType: item.cpType,
code: item.code,
...item
const find = this.command.rcvCompanies.find(every => {
return item.code == every.code;
});
if (!find) {
const obj = {
name: item.name,
rsCompany: true,
cpType: item.cpType,
code: item.code,
...item
};
this.command.rcvCompanies.push(obj);
}
});
this.command.rcvCompanies = arr;
},
getCompanyIdList(sum) {
return new Promise((resolve, reject) => {
@ -1129,7 +1420,8 @@ export default {
type: 'warning'
}).then(() => {
console.log('代签');
const params = {cmdId: this.command.cmdId, rcId: this.allographRow.cpId, proxySign: true};
const rcId = this.getRcId(this.allographRow.code);
const params = {cmdId: this.command.cmdId, rcId: rcId, proxySign: true};
const operate = {
operation: this.getDomObj('allographCmd').operation,
param: params,
@ -1147,8 +1439,8 @@ export default {
});
}
});
}).catch(() => {
console.log('取消代签');
}).catch((err) => {
console.log('取消代签', err);
});
},
sendCmd() {
@ -1156,7 +1448,8 @@ export default {
const messageData = [test];
const h = this.$createElement;
this.command.rcvCompanies.forEach((item, index) => {
const msg = `${index + 1}. ${item.name || ''}`;
const txtTrainNum = item.trainNum ? item.trainNum + '车次' : '';
const msg = `${index + 1}. ${item.name || ''} ${txtTrainNum}`;
messageData.push(h('p', null, msg));
});
this.$confirm('提示', {
@ -1306,7 +1599,7 @@ export default {
content: "";
position: absolute;
}
.middle, .left {
.middle, .left, .right {
.middle-padding {
padding-right: 5px;
}
@ -1328,6 +1621,19 @@ export default {
align-items: center;
}
}
.right {
height: 100%;
.right-top {
.word-box {
padding: 5px;
height: 200px;
overflow: auto;
}
}
.wirelessTab-footer {
height: 40px;
}
}
}
</style>
<style lang="scss">