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

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: { signCmdFalse: {
operation: '1708', operation: '1708',
domId: '_Tips-DispatchCmd-menuButton-signCmdFalse{BOTTOM}' 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>
<div class="table"> <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 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="name" label="受令单位" width="160" />
<el-table-column prop="copyers" label="抄送" width="120" show-overflow-tooltip /> <el-table-column prop="copyers" label="抄送" width="120" show-overflow-tooltip />
<el-table-column label="签收状态"> <el-table-column label="签收状态">
@ -409,9 +409,88 @@
</div> </div>
</div> </div>
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4" style="height: 100%;">
<div class="right"> <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> </div>
</el-col> </el-col>
</el-row> </el-row>
@ -430,8 +509,11 @@ export default {
operateTableHeight: 100, operateTableHeight: 100,
searchTableHeight: 260, searchTableHeight: 260,
tableHeight: 200, tableHeight: 200,
trainTableHeight: 200,
activeTab: 'operate', activeTab: 'operate',
cmdTab: 'cmd', cmdTab: 'cmd',
wordTab: 'word',
wirelessTab: 'wireless',
textTab: 'text', textTab: 'text',
typeObj: { typeObj: {
Normal: '普通调度命令', Normal: '普通调度命令',
@ -527,7 +609,16 @@ export default {
{ value: '', label: '全部'}, { value: '', label: '全部'},
{ value: true, label: '只显示签收完成的'}, { value: true, label: '只显示签收完成的'},
{ value: false, label: '只显示未签收完成的'} { value: false, label: '只显示未签收完成的'}
] ],
wirelessObj: {
type: 'dispatchCmd',
transStationCode: '',
trainNum: '',
code: ''
},
trainRow: null,
trainTableData: [],
permissionWireless: false
}; };
}, },
computed: { computed: {
@ -559,6 +650,14 @@ export default {
} }
return s; 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() { typeOptions() {
const list = []; const list = [];
Object.keys(this.typeObj).forEach(item => { Object.keys(this.typeObj).forEach(item => {
@ -613,6 +712,11 @@ export default {
}, },
DisStationId() { DisStationId() {
return this.getActiveSender.deviceCode ? this.getActiveSender.deviceCode : ''; return this.getActiveSender.deviceCode ? this.getActiveSender.deviceCode : '';
},
transStationOption() {
// const list = [...this.getTableData, {code:'', name: 'GSM-R'}];
const list = [...this.getTableData];
return list;
} }
}, },
watch: { watch: {
@ -633,6 +737,7 @@ export default {
this.getOperateTableHeight(); this.getOperateTableHeight();
this.getSearchTableHeight(); this.getSearchTableHeight();
this.getTableHeight(); this.getTableHeight();
this.getTrainTableHeight();
}, },
'$store.state.socket.simulationReset': function (val) { '$store.state.socket.simulationReset': function (val) {
this.queryResData = {}; this.queryResData = {};
@ -649,8 +754,180 @@ export default {
this.getOperateTableHeight(); this.getOperateTableHeight();
this.getSearchTableHeight(); this.getSearchTableHeight();
this.getTableHeight(); this.getTableHeight();
this.getTrainTableHeight();
}, },
methods:{ 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) { getDomObj(key) {
return OperationEvent.DispatchCmd.menuButton[key]; return OperationEvent.DispatchCmd.menuButton[key];
}, },
@ -750,9 +1027,9 @@ export default {
} }
}); });
} }
if (state == 'Signed') { // if (state == 'Signed') {
console.log(list, 'list'); // console.log(list, 'list');
} // }
return list.reverse(); return list.reverse();
}, },
findDisCmdObj(obj, val) { findDisCmdObj(obj, val) {
@ -834,7 +1111,7 @@ export default {
return status; return status;
}, },
setCurrentRow(obj, refName) { setCurrentRow(obj, refName) {
const tableArr = ['table', 'table1', 'table2', 'table3', 'table4', 'table5']; const tableArr = ['table', 'table1', 'table2', 'table3', 'table4', 'table5', 'table6'];
tableArr.forEach(key => { tableArr.forEach(key => {
if (key != refName) { if (key != refName) {
this.$refs[key] && this.$refs[key].setCurrentRow(); this.$refs[key] && this.$refs[key].setCurrentRow();
@ -853,12 +1130,20 @@ export default {
}); });
this.setCurrentRow(obj, refName); this.setCurrentRow(obj, refName);
this.$refs.table.clearSelection(); this.$refs.table.clearSelection();
this.initWirelessData();
const infoList = this.command.rcvCompanies || []; const infoList = this.command.rcvCompanies || [];
infoList.forEach(item => { infoList.forEach(item => {
const findObj = this.getTableData.find(ii => { if (item.cpType == 'Train') {
return ii.code == item.code; this.trainTableData.push(item);
}); if (refName == 'table1') {
findObj && this.$refs.table.toggleRowSelection(findObj, true); this.permissionWireless = true;
}
} else {
const findObj = this.getTableData.find(ii => {
return ii.code == item.code;
});
findObj && this.$refs.table.toggleRowSelection(findObj, true);
}
}); });
}, },
getSignedBy(info) { getSignedBy(info) {
@ -994,6 +1279,8 @@ export default {
this.command = { this.command = {
...this.resetData() ...this.resetData()
}; };
this.initWirelessData();
this.permissionWireless = false;
// this.currentInfo = {}; // this.currentInfo = {};
this.$refs.table && this.$refs.table.clearSelection(); this.$refs.table && this.$refs.table.clearSelection();
this.$refs.form && this.$refs.form.resetFields(); this.$refs.form && this.$refs.form.resetFields();
@ -1036,17 +1323,21 @@ export default {
console.log('tabClick'); console.log('tabClick');
}, },
selectionChange(selection) { selectionChange(selection) {
const arr = [];
selection.forEach(item => { selection.forEach(item => {
arr.push({ const find = this.command.rcvCompanies.find(every => {
name: item.name, return item.code == every.code;
rsCompany: true,
cpType: item.cpType,
code: item.code,
...item
}); });
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) { getCompanyIdList(sum) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@ -1129,7 +1420,8 @@ export default {
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
console.log('代签'); 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 = { const operate = {
operation: this.getDomObj('allographCmd').operation, operation: this.getDomObj('allographCmd').operation,
param: params, param: params,
@ -1147,8 +1439,8 @@ export default {
}); });
} }
}); });
}).catch(() => { }).catch((err) => {
console.log('取消代签'); console.log('取消代签', err);
}); });
}, },
sendCmd() { sendCmd() {
@ -1156,7 +1448,8 @@ export default {
const messageData = [test]; const messageData = [test];
const h = this.$createElement; const h = this.$createElement;
this.command.rcvCompanies.forEach((item, index) => { 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)); messageData.push(h('p', null, msg));
}); });
this.$confirm('提示', { this.$confirm('提示', {
@ -1306,7 +1599,7 @@ export default {
content: ""; content: "";
position: absolute; position: absolute;
} }
.middle, .left { .middle, .left, .right {
.middle-padding { .middle-padding {
padding-right: 5px; padding-right: 5px;
} }
@ -1328,6 +1621,19 @@ export default {
align-items: center; align-items: center;
} }
} }
.right {
height: 100%;
.right-top {
.word-box {
padding: 5px;
height: 200px;
overflow: auto;
}
}
.wirelessTab-footer {
height: 40px;
}
}
} }
</style> </style>
<style lang="scss"> <style lang="scss">