调度命令调整

This commit is contained in:
强 董 2022-07-07 15:03:41 +08:00
parent cf7915cef3
commit 9f425fad49
3 changed files with 416 additions and 86 deletions

View File

@ -26,14 +26,18 @@
<div class="top-title">收令箱</div>
<div class="top-table">
<el-table :data="cmdTableData" style="width: 100%" height="160" highlight-current-row :row-class-name="tableRowClassName" @current-change="handleCurrentChange">
<el-table-column prop="title" label="标题" />
<el-table-column prop="title" label="标题" show-overflow-tooltip />
<el-table-column prop="number" label="号码" width="80" />
<el-table-column label="命令类型" width="100">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ typeObj[scope.row.type] || '' }}</span>
</template>
</el-table-column>
<el-table-column prop="sendTime" label="收令日期" width="160" />
<el-table-column prop="sendTime" label="收令日期" width="160">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ getSignInfo(scope.row.receiverInfos).receivedTime || '' }}</span>
</template>
</el-table-column>
<el-table-column prop="companyOfSender" label="发令单位" />
<el-table-column prop="senderName" label="发令人" />
<el-table-column label="签否">
@ -153,22 +157,9 @@ export default {
},
getTableData() {
const receiverList = Object.values(this.currentInfo.receiverInfos || {});
const mList = [];
receiverList.forEach(ii => {
const obj = this.memberList.find(item => {
return item.id == ii.receiverId;
});
if (obj) {
mList.push({
commandId: this.commandId,
...ii,
...obj
});
}
});
const list = [];
mList.forEach(item => {
const device = this.$store.getters['map/getDeviceByCode'](item.deviceCode);
receiverList.forEach(item => {
const device = this.$store.getters['map/getDeviceByCode'](item.receiverId);
const obj = {
...this.currentInfo,
...item,
@ -201,6 +192,7 @@ export default {
return 'unsigned-row';
},
doShow() {
this.searchCmd();
this.dialogShow = true;
this.$store.commit('socket/clearDispatchCommandMsg');
},
@ -209,9 +201,30 @@ export default {
},
handleCurrentChange(obj) {
this.currentInfo = obj;
if (!this.getSignInfo(obj.receiverInfos).receivedTime) {
const data = {
commandId: obj.id
};
sendCommandNew(this.group, 'CTC_READ_DISPATCH_COMMAND', data).then((res) => {
console.log(res, '---res');
const index = this.cmdTableData.findIndex(item => {
return item.id == obj.id;
});
if (index >= 0) {
const obj = this.cmdTableData[index];
const devCode = this.getActiveUser.deviceCode || '';
if (obj.receiverInfos[devCode]) {
obj.receiverInfos[devCode].receivedTime = parseTime(this.initTime);
this.cmdTableData.splice(index, 1, obj);
}
}
}).catch(error => {
console.log(error, '---已读命令error');
});
}
},
getSignInfo(info) {
const obj = info[this.getActiveUser.memberId] || {};
const obj = info[this.getActiveUser.deviceCode] || {};
return obj;
},
getSignedBy(info) {
@ -241,20 +254,40 @@ export default {
this.$messageBox(`${this.signedStatusObj[status]}调度命令失败:${error.message}`);
});
},
changeReadStatus(signInfo) {
const index = this.cmdTableData.findIndex(item => {
return item.id == signInfo.commandId;
});
if (index >= 0) {
const obj = this.cmdTableData[index];
const devCode = this.getActiveUser.deviceCode || '';
if (obj.receiverInfos[devCode]) {
const mId = signInfo.signedBy;
obj.receiverInfos[devCode].signedBy = mId;
obj.receiverInfos[devCode].signedStatus = signInfo.signedStatus;
obj.receiverInfos[devCode].time = parseTime(this.initTime);
this.cmdTableData.splice(index, 1, obj);
}
}
},
changeSignedStatus(signInfo) {
const index = this.cmdTableData.findIndex(item => {
return item.id == signInfo.commandId;
});
if (index >= 0) {
const obj = this.cmdTableData[index];
const mId = signInfo.signedBy;
obj.receiverInfos[mId].signedBy = mId;
obj.receiverInfos[mId].signedStatus = signInfo.signedStatus;
obj.receiverInfos[mId].time = parseTime(this.initTime);
this.cmdTableData.splice(index, 1, obj);
const devCode = this.getActiveUser.deviceCode || '';
if (obj.receiverInfos[devCode]) {
const mId = signInfo.signedBy;
obj.receiverInfos[devCode].signedBy = mId;
obj.receiverInfos[devCode].signedStatus = signInfo.signedStatus;
obj.receiverInfos[devCode].time = parseTime(this.initTime);
this.cmdTableData.splice(index, 1, obj);
}
}
},
searchCmd() {
this.cmdTableData = [];
sendCommandNew(this.group, 'CTC_QUERY_DISPATCH_COMMAND').then((res) => {
console.log(res, '---res');
if (res.code == 200) {

View File

@ -19,7 +19,132 @@
<el-tab-pane label="操作" name="operate">
<div class="operate-box">
<div class="create-cmd">
<el-button type="primary" @click="createCmd">新建调度命令</el-button>
<span>数据库正常</span>
<div>
<!-- <el-input-number v-model="numTime" controls-position="right" :min="1" :max="24" size="mini" style="width: 83px" /> -->
<el-select v-model="numTime" placeholder="请选择" style="width: 66px;">
<el-option label="24" value="24" />
<el-option label="12" value="12" />
</el-select>
<span>小时</span>
</div>
<span style="width: 85px; font-weight: bold; text-align: end;">{{ getSimulationTime }}</span>
</div>
<div class="create-cmd">
<span>通信正常</span>
<el-button type="primary" @click="refreshSearch">刷新</el-button>
<el-button type="primary" style="width: 100px" @click="createCmd">新建调度命令</el-button>
</div>
<div class="box-title">
<div class="contant-null" />
<div class="contant-text">缓存命令</div>
<div class="contant-icon" @click="active1=!active1">
<i v-if="active1" class="el-icon-arrow-down" />
<i v-else class="el-icon-arrow-up" />
</div>
</div>
<div v-show="active1" class="left-table1">
<el-table ref="table1" :data="cacheTableData" border style="width: 100%" height="100" highlight-current-row @current-change="handleCurrentChange($event, 'table1')">
<el-table-column prop="number" label="命令号" width="80" />
<el-table-column prop="deviceName" label="识别号" width="80" />
<el-table-column prop="title" label="命令标题" show-overflow-tooltip />
<el-table-column prop="sendTime" label="接收单位" show-overflow-tooltip width="160">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ JoinDeviceNameStr(scope.row.receiverInfos) || '' }}</span>
</template>
</el-table-column>
<el-table-column prop="senderName" label="发令人" />
<el-table-column prop="companyOfSender" label="发令单位" />
<el-table-column label="命令类型" width="100">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ typeObj[scope.row.type] || '' }}</span>
</template>
</el-table-column>
<el-table-column prop="content" label="命令正文" show-overflow-tooltip />
</el-table>
</div>
<div class="box-title">
<div class="contant-null" />
<div class="contant-text">接受命令</div>
<div class="contant-icon" @click="active2=!active2">
<i v-if="active2" class="el-icon-arrow-down" />
<i v-else class="el-icon-arrow-up" />
</div>
</div>
<div v-show="active2" class="left-table1">
<el-table ref="table2" :data="receivedTableData" border style="width: 100%" height="100" highlight-current-row @current-change="handleCurrentChange($event, 'table2')">
<el-table-column prop="number" label="命令号" width="80" />
<el-table-column prop="title" label="命令标题" show-overflow-tooltip />
<el-table-column prop="sendTime" label="接收单位" show-overflow-tooltip width="160">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ JoinDeviceNameStr(scope.row.receiverInfos) || '' }}</span>
</template>
</el-table-column>
<el-table-column prop="senderName" label="发令人" />
<el-table-column prop="companyOfSender" label="发令单位" />
<el-table-column label="命令类型" width="100">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ typeObj[scope.row.type] || '' }}</span>
</template>
</el-table-column>
<el-table-column prop="content" label="命令正文" show-overflow-tooltip />
</el-table>
</div>
<div class="box-title">
<div class="contant-null" />
<div class="contant-text">发送命令</div>
<div class="contant-icon" @click="active3=!active3">
<i v-if="active3" class="el-icon-arrow-down" />
<i v-else class="el-icon-arrow-up" />
</div>
</div>
<div v-show="active3" class="left-table1">
<el-table ref="table3" :data="sendTableData" border style="width: 100%" height="150" highlight-current-row @current-change="handleCurrentChange($event, 'table3')">
<el-table-column prop="number" label="命令号" width="80" />
<el-table-column prop="title" label="命令标题" show-overflow-tooltip />
<el-table-column prop="sendTime" label="接收单位" width="160">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ JoinDeviceNameStr(scope.row.receiverInfos) || '' }}</span>
</template>
</el-table-column>
<el-table-column prop="sendTime" label="发令时间" width="160" />
<el-table-column prop="senderName" label="发令人" />
<el-table-column prop="companyOfSender" label="发令单位" />
<el-table-column label="命令类型" width="100">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ typeObj[scope.row.type] || '' }}</span>
</template>
</el-table-column>
<el-table-column prop="content" label="命令正文" show-overflow-tooltip />
</el-table>
</div>
<div class="box-title">
<div class="contant-null" />
<div class="contant-text">签收完成</div>
<div class="contant-icon" @click="active4=!active4">
<i v-if="active4" class="el-icon-arrow-down" />
<i v-else class="el-icon-arrow-up" />
</div>
</div>
<div v-show="active4" class="left-table1">
<el-table ref="table4" :data="allSignedTableData" border style="width: 100%" height="170" highlight-current-row @current-change="handleCurrentChange($event, 'table4')">
<el-table-column prop="number" label="命令号" width="80" />
<el-table-column prop="title" label="命令标题" show-overflow-tooltip />
<el-table-column prop="sendTime" label="接收单位" width="160">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ JoinDeviceNameStr(scope.row.receiverInfos) || '' }}</span>
</template>
</el-table-column>
<el-table-column prop="sendTime" label="发令时间" width="160" />
<el-table-column prop="senderName" label="发令人" />
<el-table-column prop="companyOfSender" label="发令单位" />
<el-table-column label="命令类型" width="100">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ typeObj[scope.row.type] || '' }}</span>
</template>
</el-table-column>
<el-table-column prop="content" label="命令正文" show-overflow-tooltip />
</el-table>
</div>
</div>
</el-tab-pane>
@ -126,7 +251,7 @@
<el-tab-pane label="命令正文" name="text">
<div class="cmd-box">
<div>
<el-input v-model="cmdTextarea" type="textarea" :rows="6" placeholder="请输入内容" />
<el-input v-model="command.content" type="textarea" :rows="6" placeholder="请输入内容" />
</div>
</div>
</el-tab-pane>
@ -139,15 +264,23 @@
<div class="table">
<el-table ref="table" :data="getTableData" border style="width: 100%" height="200" @selection-change="selectionChange">
<el-table-column type="selection" width="50" />
<el-table-column prop="deviceName" label="受令单位" width="180" />
<el-table-column prop="copyers" label="抄送" width="180" />
<el-table-column label="签收状态">
<el-table-column label="受令单位" width="160">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.nickName ? signedStatusObj[scope.row.signedStatus] : '' }}</span>
<span style="margin-left: 10px">{{ getDeviceName(scope.row.receiverId) }}</span>
</template>
</el-table-column>
<el-table-column prop="nickName" label="签收人" />
<el-table-column prop="signTime" label="签收时间" />
<el-table-column prop="copyers" label="抄送" width="120" show-overflow-tooltip />
<el-table-column label="签收状态">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ signedStatusObj[scope.row.signedStatus] || '' }}</span>
</template>
</el-table-column>
<el-table-column label="签收人">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ getSignedBy(scope.row) || '' }}</span>
</template>
</el-table-column>
<el-table-column prop="time" label="签收时间" width="160" />
</el-table>
</div>
</div>
@ -169,6 +302,7 @@
<script>
import { sendCommandNew } from '@/api/jmap/training';
import { mapState } from 'vuex';
import { parseTime } from '@/utils/index';
export default {
name:'DispatcherCmd',
data() {
@ -177,9 +311,9 @@ export default {
activeTab: 'operate',
cmdTab: 'cmd',
textTab: 'text',
typeOptions: [
{label: '正常调度命令', value: 'NORMAL'}
],
typeObj: {
NORMAL: '正常调度命令'
},
signedStatusObj: {
UNSIGNED: '未签收',
SIGNED: '签收',
@ -202,15 +336,46 @@ export default {
content: '',
allSigned: ''
},
cmdTextarea: '',
tableChecked: false,
memberDataList: []
memberDataList: [],
active1: true,
active2: true,
active3: true,
active4: true,
numTime: 24,
seachData: [],
cacheTableData: [],
currentInfo: {}
};
},
computed: {
...mapState('training', [
'memberList', 'memberData', 'simulationUserList'
'memberList', 'memberData', 'simulationUserList', 'initTime'
]),
typeOptions() {
const list = [];
Object.keys(this.typeObj).forEach(item => {
list.push({
label: this.typeObj[item],
value: item
});
});
return list;
},
getSimulationTime() {
const t = parseTime(this.initTime, '{h}:{i}:{s}');
const tArr = t.split(':');
let s = ' ';
let h = tArr[0];
if (this.numTime != 24) {
s = '上午';
if (h > 12) {
s = '下午';
h = h - 12;
}
}
return `${s} ${h}:${tArr[1]}:${tArr[2]}`;
},
show() {
return this.dialogShow;
},
@ -228,23 +393,48 @@ export default {
return obj;
},
getTableData() {
const mList = this.memberList.filter(item => {
const mList = [];
const filterArr = this.memberList.filter(item => {
return item.type == 'STATION_SUPERVISOR';
});
const list = [];
mList.forEach(item => {
const device = this.$store.getters['map/getDeviceByCode'](item.deviceCode);
const useInfo = this.mapSimulationUserList[item.userId];
const obj = {
...item,
userId: item.userId + '',
deviceName: device ? device.name : '',
nickName: useInfo ? useInfo.nickName : '',
copyers: '',
signedStatus: 'UNSIGNED',
signTime: ''
};
list.push(obj);
filterArr.forEach(item => {
let cInfo = {};
if (this.currentInfo.receiverInfos && this.currentInfo.receiverInfos[item.deviceCode]) {
cInfo = this.currentInfo.receiverInfos[item.deviceCode];
}
mList.push({
receiverId: item.deviceCode || '',
signedBy: '',
receivedTime: '',
signedStatus: '',
time: '',
...cInfo
});
});
return mList;
},
getActiveSender() {
const userInfo = this.memberDataList.find(item => {
return item.userId == this.$store.state.user.id;
});
const activeUser = userInfo || {};
return activeUser;
},
receivedTableData() {
const list = this.seachData.filter(item => {
return item.receiverInfos[this.getActiveSender.deviceCode];
});
return list;
},
sendTableData() {
const list = this.seachData.filter(item => {
return item.senderName == this.getActiveSender.labelName;
});
return list;
},
allSignedTableData() {
const list = this.seachData.filter(item => {
return item.allSigned;
});
return list;
}
@ -253,6 +443,69 @@ export default {
beforeDestroy() {},
mounted() {},
methods:{
setCurrentRow(obj, refName) {
const tableArr = ['table1', 'table2', 'table3', 'table4'];
tableArr.forEach(key => {
if (key != refName) {
this.$refs[key].setCurrentRow();
} else {
this.$refs[key].setCurrentRow(obj);
}
});
},
handleCurrentChange(obj, refName) {
if (!obj) { return; }
this.currentInfo = obj;
this.command = {...obj};
this.setCurrentRow(obj, refName);
const infoList = Object.keys(this.currentInfo.receiverInfos || {});
if (infoList.length) {
this.command.receiverIds = infoList;
setTimeout(() => {
infoList.forEach(item => {
const findObj = this.getTableData.find(ii => {
return ii.receiverId == item;
});
findObj && this.$refs.table.toggleRowSelection(findObj, true);
});
}, 200);
} else {
this.$refs.table.clearSelection();
}
},
getSignedBy(info) {
const signedInfo = this.simulationUserList.find(item => {
return item.memberId == info.signedBy;
});
let name = '';
if (signedInfo) {
name = signedInfo.nickName;
}
return name;
},
getDeviceName(receiverId) {
let name = '';
if (receiverId) {
const device = this.$store.getters['map/getDeviceByCode'](receiverId);
name = device ? device.name : '';
}
return name;
},
JoinDeviceNameStr(info) {
let name = '';
const devCodeArr = Object.keys(info);
const nameArr = [];
devCodeArr.forEach(ii => {
const device = this.$store.getters['map/getDeviceByCode'](ii);
nameArr.push(device ? device.name : '');
});
name = nameArr.join(',');
return name;
},
refreshSearch() {
console.log('刷新');
this.searchCmd();
},
createCmd() {
this.$confirm('当前调度命令已经被编辑修改过了,你要放弃所有的修改吗?', '操作提示', {
confirmButtonText: '是',
@ -281,8 +534,9 @@ export default {
content: '',
allSigned: ''
};
this.cmdTextarea = '';
this.currentInfo = {};
this.$refs.table.clearSelection();
this.setCurrentRow();
},
senderChange(memberId) {
const obj = this.mapSimulationUserList.find(item => {
@ -304,8 +558,10 @@ export default {
}
},
doShow() {
this.searchCmd();
this.getSenderName();
this.dialogShow = true;
this.initData();
},
doClose() {
this.dialogShow = false;
@ -316,27 +572,32 @@ export default {
selectionChange(selection) {
const arr = [];
selection.forEach(item => {
arr.push(item.id);
arr.push(item.receiverId);
});
this.command.receiverIds = arr;
console.log(this.simulationUserList, '----simulationUserList----');
},
sendCmd() {
this.command.content = this.cmdTextarea;
const data = {
command: this.command
};
sendCommandNew(this.group, 'CTC_SEND_DISPATCH_COMMAND', data).then((res) => {
console.log(res, '---res');
this.$message.success('发送调度命令成功!');
this.initData();
}).catch(error => {
this.$messageBox('发送调度命令失败:' + error.message);
this.$confirm('你是要下达调度命令吗?', '确认提示', {
confirmButtonText: '是',
cancelButtonText: '否'
}).then(() => {
const data = {
command: this.command
};
sendCommandNew(this.group, 'CTC_SEND_DISPATCH_COMMAND', data).then((res) => {
console.log(res, '---res');
this.$message.success('发送调度命令成功!');
this.searchCmd();
this.initData();
}).catch(error => {
this.$messageBox('发送调度命令失败:' + error.message);
});
});
},
searchCmd() {
sendCommandNew(this.group, 'CTC_QUERY_DISPATCH_COMMAND').then((res) => {
console.log(res, '---res----');
this.seachData = res.data;
}).catch(error => {
this.$messageBox('查询调度命令失败:' + error.message);
});
@ -352,8 +613,35 @@ export default {
height: 100%;
.left {
height: 100%;
.operate-box {
overflow-y: auto;
}
.create-cmd {
text-align: end;
height: 30px;
display: flex;
justify-content: space-between;
align-items: center;
}
.box-title {
height: 28px;
display: flex;
justify-content: center;
align-items: center;
background: #B3B2C2;
.contant-null, .contant-icon {
width: 20px;
display: flex;
justify-content: center;
}
.contant-icon:hover {
cursor: pointer;
}
.contant-text {
display: flex;
justify-content: center;
flex: 1;
color: blue;
}
}
}
/deep/ .el-tabs__item {

View File

@ -64,7 +64,11 @@
<div class="box-table">
<el-table :data="getTableData" style="width: 100%" height="200">
<el-table-column type="index" label="序" width="50" />
<el-table-column prop="deviceName" label="受令单位" />
<el-table-column prop="deviceName" label="受令单位">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ getDeviceName(scope.row.receiverId) }}</span>
</template>
</el-table-column>
<el-table-column prop="copyers" label="抄知处所" />
</el-table>
</div>
@ -149,26 +153,11 @@ export default {
},
getTableData() {
const receiverList = Object.values(this.signedData.receiverInfos || {});
const mList = [];
receiverList.forEach(ii => {
const obj = this.memberList.find(item => {
return item.id == ii.receiverId;
});
if (obj) {
mList.push({
commandId: this.commandId,
...ii,
...obj
});
}
});
const list = [];
mList.forEach(item => {
const device = this.$store.getters['map/getDeviceByCode'](item.deviceCode);
receiverList.forEach(item => {
const obj = {
...this.signedData,
...item,
deviceName: device ? device.name : ''
...item
};
list.push(obj);
});
@ -179,6 +168,14 @@ export default {
beforeDestroy() {},
mounted() {},
methods:{
getDeviceName(receiverId) {
let name = '';
if (receiverId) {
const device = this.$store.getters['map/getDeviceByCode'](receiverId);
name = device ? device.name : '';
}
return name;
},
getParseTime(val, f) {
return val ? parseTime(val, f) : '';
},
@ -197,6 +194,7 @@ export default {
this.getSenderName();
this.getSignedData();
this.dialogShow = true;
this.hasReadCmd();
},
doClose() {
this.dialogShow = false;
@ -209,7 +207,7 @@ export default {
}
},
getSignInfo(info) {
const obj = info[this.getActiveUser.memberId] || {};
const obj = info[this.getActiveUser.deviceCode] || {};
return obj;
},
getSignedBy(info) {
@ -222,6 +220,17 @@ export default {
}
return name;
},
hasReadCmd() {
if (!this.commandId) { return; }
const data = {
commandId: this.commandId
};
sendCommandNew(this.group, 'CTC_READ_DISPATCH_COMMAND', data).then((res) => {
console.log(res, '---res');
}).catch(error => {
console.log(error, '---已读命令error');
});
},
signCmd(status) {
if (!this.commandId) { return; }
const signInfo = { commandId: this.commandId, signedBy: this.signedId, signedStatus: status };
@ -230,7 +239,7 @@ export default {
};
sendCommandNew(this.group, 'CTC_SIGN_DISPATCH_COMMAND', data).then((res) => {
console.log(res, '---res');
this.$emit('changeSignedStatus', signInfo);
// this.$emit('changeSignedStatus', signInfo);
this.doClose();
}).catch(error => {
this.$messageBox('查询调度命令失败:' + error.message);