diff --git a/src/jmapNew/theme/datie_02/menus/index.vue b/src/jmapNew/theme/datie_02/menus/index.vue index 6a56fe1d7..321a08f9a 100644 --- a/src/jmapNew/theme/datie_02/menus/index.vue +++ b/src/jmapNew/theme/datie_02/menus/index.vue @@ -57,7 +57,7 @@ - + diff --git a/src/views/dispatcherStationManage/cmdManage.vue b/src/views/dispatcherStationManage/cmdManage.vue index e9f79ff38..6d5b2aaba 100644 --- a/src/views/dispatcherStationManage/cmdManage.vue +++ b/src/views/dispatcherStationManage/cmdManage.vue @@ -28,17 +28,29 @@ - + - + - - - - + + + + + + + + + + @@ -51,7 +63,7 @@ - +
@@ -71,8 +83,8 @@
- 拒签 - 签收 + 拒签 + 签收 关闭
@@ -81,6 +93,7 @@ import { sendCommandNew } from '@/api/jmap/training'; import shouxinxiang from '@/assets/dispatcherStation/shouxinxiang.png'; import { mapState } from 'vuex'; +import { parseTime } from '@/utils/index'; export default { name:'CmdManage', data() { @@ -94,12 +107,17 @@ export default { currentInfo: {}, typeObj: { NORMAL: '正常调度命令' + }, + signedStatusObj: { + UNSIGNED: '未签收', + SIGNED: '签收', + REFUSE: '拒签' } }; }, computed: { ...mapState('training', [ - 'memberList', 'simulationUserList' + 'memberList', 'simulationUserList', 'initTime' ]), ...mapState('socket', [ 'dispatchCommandMsg' @@ -116,6 +134,23 @@ export default { commandId() { return this.currentInfo.id || ''; }, + currentHasSigned() { + let hasSigned = false; + if (this.currentInfo.receiverInfos) { + const obj = this.getSignInfo(this.currentInfo.receiverInfos); + if (obj && obj.signedStatus != 'UNSIGNED') { + hasSigned = true; + } + } + return hasSigned; + }, + getActiveUser() { + const userInfo = this.simulationUserList.find(item => { + return item.userId == this.$store.state.user.id; + }); + const activeUser = userInfo || {}; + return activeUser; + }, getTableData() { const receiverList = Object.values(this.currentInfo.receiverInfos || {}); const mList = []; @@ -135,6 +170,7 @@ export default { mList.forEach(item => { const device = this.$store.getters['map/getDeviceByCode'](item.deviceCode); const obj = { + ...this.currentInfo, ...item, deviceName: device ? device.name : '' }; @@ -144,9 +180,11 @@ export default { } }, watch: { - dispatchCommandMsg(val) { - if (val.type == 'ADD') { - this.cmdTableData.push(val.body); + dispatchCommandMsg(Obj) { + if (Obj.type == 'ADD') { + const list = Obj.body; + this.cmdTableData.push(list); + this.show && this.$store.commit('socket/clearDispatchCommandMsg'); } } }, @@ -165,20 +203,48 @@ export default { handleCurrentChange(obj) { this.currentInfo = obj; }, + getSignInfo(info) { + const obj = info[this.getActiveUser.memberId] || {}; + return obj; + }, + getSignedBy(info) { + const signedInfo = this.simulationUserList.find(item => { + return item.memberId == info.signedBy; + }); + let name = ''; + if (signedInfo) { + name = signedInfo.nickName; + } + return name; + }, signCmd(status) { if (!this.commandId) { return; } - const activeUser = this.$store.state.user.id; const data = { signInfo: { commandId: this.commandId, - signedBy: activeUser, - signedStatus: status ? 'SIGNED' : 'UNSIGNED' + signedBy: this.getActiveUser.memberId, + signedStatus: status } }; sendCommandNew(this.group, 'CTC_SIGN_DISPATCH_COMMAND', data).then((res) => { console.log(res, '---res'); + if (res.code == 200) { + const index = this.cmdTableData.findIndex(item => { + return item.id == this.commandId; + }); + if (index >= 0) { + const obj = this.cmdTableData[index]; + const mId = this.getActiveUser.memberId; + obj.receiverInfos[mId].signedBy = mId; + obj.receiverInfos[mId].signedStatus = status; + obj.receiverInfos[mId].time = parseTime(this.initTime); + this.cmdTableData.splice(index, 1, obj); + } + } else { + this.$messageBox(`${this.signedStatusObj[status]}调度命令失败:${res.message}`); + } }).catch(error => { - this.$messageBox('查询调度命令失败:' + error.message); + this.$messageBox(`${this.signedStatusObj[status]}调度命令失败:${error.message}`); }); }, searchCmd() { diff --git a/src/views/dispatcherStationManage/dispatchCmd.vue b/src/views/dispatcherStationManage/dispatchCmd.vue index 6451080ca..c03eb7dfb 100644 --- a/src/views/dispatcherStationManage/dispatchCmd.vue +++ b/src/views/dispatcherStationManage/dispatchCmd.vue @@ -53,12 +53,12 @@ - + @@ -141,8 +141,12 @@ - - + + + + @@ -176,11 +180,17 @@ export default { typeOptions: [ {label: '正常调度命令', value: 'NORMAL'} ], + signedStatusObj: { + UNSIGNED: '未签收', + SIGNED: '签收', + REFUSE: '拒签' + }, command: { title: '', number: '', sendTime: '', senderId: '', + senderName: '', companyOfSender: '', authorizationTime: '', authorizationStatus: '', @@ -193,12 +203,13 @@ export default { allSigned: '' }, cmdTextarea: '', - tableChecked: false + tableChecked: false, + memberDataList: [] }; }, computed: { ...mapState('training', [ - 'memberList', 'simulationUserList' + 'memberList', 'memberData', 'simulationUserList' ]), show() { return this.dialogShow; @@ -230,8 +241,7 @@ export default { deviceName: device ? device.name : '', nickName: useInfo ? useInfo.nickName : '', copyers: '', - signStatus: false, - signer: '', + signedStatus: 'UNSIGNED', signTime: '' }; list.push(obj); @@ -239,27 +249,17 @@ export default { return list; } }, - watch: { - simulationUserList(list) { - const activeUser = list.find(item => { - return item.userId == this.$store.state.user.id; - }); - if (activeUser) { - this.command.senderId = activeUser.memberId; - } - } - }, + watch: {}, beforeDestroy() {}, - mounted() { - this.searchCmd(); - }, + mounted() {}, methods:{ initData() { this.command = { title: '', number: '', sendTime: '', - senderId: this.command.senderId, + senderId: '', + senderName: this.command.senderName, companyOfSender: '', authorizationTime: '', authorizationStatus: '', @@ -283,7 +283,18 @@ export default { this.command.companyOfSender = device ? device.name : ''; } }, + getSenderName() { + const activeUser = this.memberDataList.find(item => { + return item.userId == this.$store.state.user.id; + }); + if (activeUser) { + // this.command.senderId = activeUser.id; + this.command.senderName = activeUser.labelName; + } + }, doShow() { + this.memberDataList = Object.values(this.memberData); + this.getSenderName(); this.dialogShow = true; }, doClose() { @@ -307,7 +318,7 @@ export default { }; sendCommandNew(this.group, 'CTC_SEND_DISPATCH_COMMAND', data).then((res) => { console.log(res, '---res'); - this.$messageBox('发送调度命令成功!'); + this.$message.success('发送调度命令成功!'); this.initData(); }).catch(error => { this.$messageBox('发送调度命令失败:' + error.message); @@ -315,9 +326,9 @@ export default { }, searchCmd() { sendCommandNew(this.group, 'CTC_QUERY_DISPATCH_COMMAND').then((res) => { - console.log(res, '---res'); + console.log(res, '---res----'); }).catch(error => { - this.$messageBox('查询调度命令失败:' + error.$message); + this.$messageBox('查询调度命令失败:' + error.message); }); } }