# Conflicts:
#	src/views/system/commandDictionary/copyParam.vue
This commit is contained in:
zyy 2020-07-20 13:31:02 +08:00
commit b071b00d21
5 changed files with 238 additions and 119 deletions

View File

@ -3,7 +3,7 @@
<div class="chatBox" :style="{'bottom':bottom+'px'}">
<div v-show="!minimize" class="chat-box">
<div class="chat-box-main">
<div v-if="!conversitionId && userRole !== 'AUDIENCE'" class="chat-window">
<div v-if="!conversitionId && userRole !== 'AUDIENCE' && !commonConversation" class="chat-window">
<div class="chat-box-header">
<div class="chat-box-header-title">
<el-input v-model="queryMember" size="small" placeholder="请输入搜索人员">
@ -37,7 +37,7 @@
</div>
<div class="chat-box-footer">
<div style="width: 400px;font-size: 14px;">{{ userString }}</div>
<!--<el-button size="mini" type="primary" class="chat-box-footer-create" @click="goCommonConversation">公共会话</el-button>-->
<el-button size="mini" type="primary" class="chat-box-footer-create" style="right: 80px;" @click="goCommonConversation">公共会话</el-button>
<el-button size="mini" type="primary" class="chat-box-footer-create" :loading="createLoading" @click="createCoversition()">创建群聊</el-button>
</div>
</div>
@ -74,11 +74,11 @@
</div>
<div class="chat-box-footer">
<div class="chat-box-footer-tool" />
<el-button v-if="isConversitionCreator && isButtonShow" size="mini" type="danger" class="chat-box-footer-quit" :loading="quitLoading" @click="quitConversition()">退出群聊</el-button>
<!--<el-button v-if="!commonConversation" class="chat-box-footer-send" size="mini" type="primary" @click="goCommonConversation">公共会话</el-button>-->
<!--<el-button v-if="!conversitionId && userRole !== 'AUDIENCE'" class="chat-box-footer-send" size="mini" type="primary" @click="cancelCommonConversation">成员列表</el-button>-->
<!--<el-button v-if="conversitionId && commonConversation" class="chat-box-footer-send" size="mini" type="primary" @click="cancelCommonConversation">私有会话</el-button>-->
<el-button v-if="isButtonShow" class="chat-box-footer-send" size="mini" type="primary" :disabled="recordSending" @click="startRecording()">发送语音</el-button>
<el-button v-if="isConversitionCreator && isButtonShow && !commonConversation" size="mini" type="danger" class="chat-box-footer-quit" :loading="quitLoading" @click="quitConversition()">退出群聊</el-button>
<el-button v-if="!commonConversation" class="chat-box-footer-send" size="mini" type="primary" @click="goCommonConversation">公共会话</el-button>
<el-button v-if="!conversitionId && userRole !== 'AUDIENCE'" class="chat-box-footer-send" size="mini" type="primary" @click="cancelCommonConversation">成员列表</el-button>
<el-button v-if="conversitionId && commonConversation" class="chat-box-footer-send" size="mini" type="primary" @click="cancelCommonConversation">私有会话</el-button>
<el-button v-if="isButtonShow && !commonConversation" class="chat-box-footer-send" size="mini" type="primary" :disabled="recordSending" @click="startRecording()">发送语音</el-button>
</div>
</div>
</div>
@ -125,7 +125,7 @@ export default {
bottom:15,
recordSending:false,
conversitionId: '',
commonConversation: true,
commonConversation: false,
seconds:0,
inter:null,
recorders: null,
@ -149,8 +149,12 @@ export default {
memberIdList: [],
quitLoading: false,
conversitionMemberList: [],
commonMemberList: [],
privateMemberList: [],
isConversitionCreator: false,
messageList: []
messageList: [],
commonMessageList: [],
privateMessageList: []
};
},
computed:{
@ -172,7 +176,8 @@ export default {
},
userRole(val) {
if (val === 'AUDIENCE') {
this.isAudienceInitData();
// this.isAudienceInitData();
this.goCommonConversation();
}
},
'$store.state.map.mapViewLoadedCount':function(val) {
@ -202,8 +207,9 @@ export default {
memberList.push({memberId:id, connect:false});
}
});
console.log(memberList, val.memberIds);
this.conversitionMemberList = memberList;
this.privateMemberList = memberList;
this.commonConversation = false;
}
},
'$store.state.socket.scriptFinish':function(val, old) {
@ -236,7 +242,9 @@ export default {
if (val.id === this.conversitionId) {
this.conversitionId = '';
this.conversitionMemberList = [];
this.privateMemberList = [];
this.messageList = [];
this.privateMessageList = [];
}
},
'$store.state.training.memberList': function (val) {
@ -325,8 +333,8 @@ export default {
this.createLoading = true;
startConversition(this.group, this.memberIdList).then(resp => {
this.conversitionId = resp.data.id;
// this.conversitionMemberList = resp.data.memberList;
this.messageList = [];
this.privateMessageList = [];
this.userString = '';
this.isConversitionCreator = true;
this.$message.success('创建会话成功!');
@ -475,7 +483,9 @@ export default {
overSimulationConversition(this.group, this.conversitionId).then(resp => {
this.conversitionId = '';
this.conversitionMemberList = [];
this.privateMemberList = [];
this.messageList = [];
this.privateMessageList = [];
this.quitLoading = false;
}).catch(() => {
this.$message.error('退出会话失败!');
@ -486,8 +496,10 @@ export default {
this.userString = '';
this.conversitionId = data.id;
this.conversitionMemberList = data.memberList;
this.commonMemberList = data.memberList;
this.isConversitionCreator = false;
this.messageList = [];
this.privateMessageList = [];
if (data.messageList && data.messageList) {
data.messageList.forEach(message => {
const member = this.memberData[message.memberId];
@ -496,6 +508,7 @@ export default {
message.self = this.$store.state.userId == member.userId;
}
this.messageList.push(message);
this.privateMessageList.push(message);
});
}
},
@ -513,20 +526,19 @@ export default {
},
isAudienceInitData() {
getAllConversition(this.group).then(resp => {
const messages = [];
if (resp.data && resp.data.length) {
const messageList = [];
resp.data.forEach(conversation => {
if (this.userRole == 'AUDIENCE') {
(conversation.messageList || []).forEach(message => {
const member = this.memberData[message.memberId];
message.src = `/audio/${message.audioPath}`;
message.members = conversation.memberList;
if (member) {
message.self = this.$store.state.userId == member.userId;
}
messageList.push(message);
});
} else {
(conversation.messageList || []).forEach(message => {
const member = this.memberData[message.memberId];
message.src = `/audio/${message.audioPath}`;
message.members = conversation.memberList;
if (member) {
message.self = this.$store.state.userId == member.userId;
}
messages.push(message);
});
if (this.userRole !== 'AUDIENCE') {
const user = this.simulationUsers[this.$store.state.user.id];
this.isConversitionCreator = conversation.creatorId == user.memberId;
!conversation.over && conversation.memberList.forEach(member =>{
@ -540,40 +552,61 @@ export default {
if (member) {
message.self = this.$store.state.userId == member.userId;
}
this.privateMessageList.push(message);
this.messageList.push(message);
});
}
});
}
});
this.messageList = messageList.sort(this.sortByMessageTime);
}
this.commonMessageList = messages.sort(this.sortByMessageTime);
const temDispatcherList = [];
const temStationSupervisorList = [];
const temMaintainerList = [];
const temDriverList = [];
this.$store.state.training.memberList.forEach(item =>{
switch (item.type) {
case 'DISPATCHER':
temDispatcherList.push({memberId: item.id, connect:true });
break;
case 'STATION_SUPERVISOR':
temStationSupervisorList.push({memberId: item.id, connect:true });
break;
case 'MAINTAINER':
temMaintainerList.push({memberId: item.id, connect:true });
break;
case 'DRIVER':
temDriverList.push({memberId: item.id, connect:true });
break;
}
});
if (this.userRole === 'AUDIENCE' || this.commonConversation) {
this.conversitionMemberList = [];
this.messageList = this.commonMessageList;
this.commonMemberList = [...temDispatcherList, ...temStationSupervisorList, ...temMaintainerList, ...temDriverList];
this.conversitionMemberList = this.commonMemberList;
}
});
this.conversitionMemberList = [];
const temDispatcherList = [];
const temStationSupervisorList = [];
const temMaintainerList = [];
const temDriverList = [];
this.$store.state.training.memberList.forEach(item =>{
switch (item.type) {
case 'DISPATCHER':
temDispatcherList.push({memberId: item.id, connect:true });
break;
case 'STATION_SUPERVISOR':
temStationSupervisorList.push({memberId: item.id, connect:true });
break;
case 'MAINTAINER':
temMaintainerList.push({memberId: item.id, connect:true });
break;
case 'DRIVER':
temDriverList.push({memberId: item.id, connect:true });
break;
}
});
this.conversitionMemberList = [...temDispatcherList, ...temStationSupervisorList, ...temMaintainerList, ...temDriverList];
},
changeMessageList(data) {
this.messageList.push(data);
this.commonMessageList.push(data);
if (this.userRole !== 'AUDIENCE') {
this.privateMessageList.push(data);
}
},
goCommonConversation() {
!this.commonConversation && this.$refs.chatContent && this.$refs.chatContent.conversationChange();
this.commonConversation = true;
this.conversitionMemberList = this.commonMemberList;
this.messageList = this.commonMessageList;
},
cancelCommonConversation() {
this.commonConversation && this.$refs.chatContent && this.$refs.chatContent.conversationChange();
this.commonConversation = false;
this.conversitionMemberList = this.privateMemberList;
this.messageList = this.privateMessageList;
},
clearAllData() {
this.recordSending = false;
@ -585,12 +618,6 @@ export default {
this.conversitionMemberList = [];
this.messageList = [];
}
// goCommonConversation() {
// this.commonConversation = true;
// },
// cancelCommonConversation() {
// this.commonConversation = false;
// }
}
};
</script>

View File

@ -93,37 +93,13 @@ export default {
// this.inintData();
},
methods:{
inintData() {
// if (this.coversition.id) {
// getSimulationContextListNew(this.$route.query.group, this.coversition.id).then(res=>{
// const userId = this.$store.state.user.id;
// const coversitionList = res.data.map(coversition=>{
// coversition.self = false;
// if (coversition.member.userId == userId) {
// coversition.self = true;
// }
// coversition.src = coversition.isAudio ? `/audio/${coversition.audioPath}` : '';
// coversition.targetUser = coversition.targetMember ? coversition.targetMember : 'All';
// return coversition;
// });
// this.chatContentList = coversitionList;
// this.scrollTop();
// });
// }
// const coversitionListAll = Object.assign({}, this.$store.state.socket.coversitionList);
// const coversitionList = coversitionListAll[this.coversition.id] || [];
// // console.log('inintData---coversitionList' + JSON.stringify(this.$store.state.socket.coversitionList[this.coversition.id]));
// this.chatContentList = coversitionList;
},
scrollTop() {
this.$nextTick(function() {
const scrollTop = document.querySelector('.chatcontentInner').offsetHeight - document.querySelector('.chatcontentIn').offsetHeight + 30;
document.querySelector('.chatcontentIn').scrollTop = scrollTop;
});
},
// formatTime(time) {
// return /\d{2}:\d{2}:\d{2}/.exec(time)[0] || time;
// },
playAllAudio() {
this.playEachAudio(this.currentAudioList[this.currentAudioIndex]);
},
@ -171,6 +147,9 @@ export default {
playAudio(audioUrl) {
document.querySelector('#audioPlay').src = audioUrl;
document.querySelector('#audioPlay').play();
},
conversationChange() {
}
}
};

View File

@ -27,22 +27,12 @@ export default {
fromName: '',
targetIds: '',
deviceType: []
},
deviceTypeList: [],
targetList: [],
lineCode: ''
},
deviceTypeList: [],
targetList: [],
lineCode: ''
};
},
watch: {
taskStatusList(list) {
this.targetList = [];
list.forEach(item => {
if (item.value != this.lineCode) {
this.targetList.push(item);
}
})
}
},
},
computed: {
form() {
const form = {
@ -65,19 +55,29 @@ export default {
]
};
}
},
created() {
this.deviceTypeList = [];
this.$ConstSelect.deviceTypeList.forEach(item => {
this.deviceTypeList.push(item);
})
},
},
watch: {
taskStatusList(list) {
this.targetList = [];
list.forEach(item => {
if (item.value != this.lineCode) {
this.targetList.push(item);
}
});
}
},
created() {
this.deviceTypeList = [];
this.$ConstSelect.deviceTypeList.forEach(item => {
this.deviceTypeList.push(item);
});
},
methods: {
doShow(lineCode) {
this.dialogVisible = true;
if (lineCode) {
this.lineCode = lineCode;
this.targetList = [];
this.lineCode = lineCode;
this.targetList = [];
this.taskStatusList.forEach(item => {
item.value = item.code;
item.label = item.name;
@ -91,7 +91,6 @@ export default {
}
},
doSave() {
const self = this;
this.$refs.dataform.validateForm(() => {
const param = {
fromLineCode: this.formModel.fromCode,

View File

@ -2,7 +2,7 @@
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<show-condition ref="showCondition" />
<copy-param ref="copyParam" :taskStatusList="taskStatusList" />
<copy-param ref="copyParam" :task-status-list="taskStatusList" />
</div>
</template>
@ -16,8 +16,8 @@ import CopyParam from './copyParam';
export default {
name: 'CommandDictionary',
components: {
ShowCondition,
CopyParam
ShowCondition,
CopyParam
},
data() {
return {
@ -26,8 +26,8 @@ export default {
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
lineCode: '',
},
lineCode: '',
queryForm: {
labelWidth: '80px',
reset: true,
@ -122,8 +122,8 @@ export default {
}
],
actions: [
{ text: this.$t('global.add'), handler: this.handleAdd },
{ text: '复刻', handler: this.handleCopyAll }
{ text: this.$t('global.add'), handler: this.handleAdd },
{ text: '复刻', handler: this.handleCopyAll }
]
},
@ -155,8 +155,8 @@ export default {
queryFunction(params) {
if (!params['lineCode']) {
params['lineCode'] = '';
}
this.lineCode = params['lineCode'];
}
this.lineCode = params['lineCode'];
return getCommandList(params);
},
replace(fieldValue) {
@ -211,11 +211,11 @@ export default {
this.$message.error('复制指令失败!');
});
});
},
// 线线
handleCopyAll() {
this.$refs.copyParam.doShow(this.lineCode);
},
},
// 线线
handleCopyAll() {
this.$refs.copyParam.doShow(this.lineCode);
},
reloadTable() {
this.queryList.reload();
}

View File

@ -1,6 +1,48 @@
<template>
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="60%" :before-close="handleClose" center :close-on-click-modal="false">
<data-form ref="datatop" :form="formTop" :inline="inline" :form-model="formModel" :rules="topRules" />
<el-form ref="form" :model="formModel" label-width="220px" :rules="topRules" :inline="inline">
<el-form-item label="关联地图:" prop="mapId">
<el-select v-model="mapId" placeholder="请选择" size="small" style="width: 180px" @change="mapIdChange">
<el-option
v-for="item in mapList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="关联车站:" prop="stationCode">
<el-select v-model="stationCode" placeholder="请选择" size="small" style="width: 180px" @change="stationCodeChange">
<el-option
v-for="item in stationList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item label="关联站台:" prop="standCode">
<el-select v-model="standCode" placeholder="请选择" size="small" style="width: 180px" @change="standCodeChange">
<el-option
v-for="item in standList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item label="关联屏蔽门:" prop="psdCode">
<el-select v-model="formModel.psdCode" placeholder="请选择" style="width: 180px" size="small">
<el-option
v-for="item in psdList"
:key="item.code"
:label="item.code"
:value="item.code"
/>
</el-select>
</el-form-item>
</el-form>
<el-row :gutter="20">
<el-col :span="12">
<el-card class="box-card">
@ -32,6 +74,7 @@
<script>
import { getDeviceDetail, setPsdConfig, setSignalConfig, setSwitchConfig, setPslConfig } from '@/api/project';
import { getAllMapOnline, getStationListNeedAttendant, getPsdListByStandCode, getStandListByStationCode } from '@/api/jmap/map';
export default {
name: 'EditConfigGateway',
@ -103,7 +146,14 @@ export default {
{label: '写互锁解除指示灯位', value: 'wjcd'},
{label: '写IBP盘操作指示灯位', value: 'wibpczd'},
{label: '写PST操作指示灯位', value: 'wpstczd'}
]
],
mapId: '',
mapList: [],
stationCode: '',
stationList: [],
standList: [],
standCode: '',
psdList: []
};
},
computed: {
@ -123,6 +173,9 @@ export default {
],
quantity: [
{ required: true, message: '请填写位数量', trigger: 'blur'}
],
psdCode: [
{ required: true, message: '请选择关联屏蔽门', trigger: 'change'}
]
};
},
@ -451,6 +504,17 @@ export default {
}).catch(()=> {
this.$message.error('获取项目设备详情失败!');
});
if (row.type === 'PSL') {
getAllMapOnline().then(resp => {
if (resp.data && resp.data.length) {
this.mapList = resp.data;
this.mapId = this.mapList[0].id;
this.mapIdChange(this.mapList[0].id);
}
}).catch(() => {
this.$message.error('获取地图列表失败');
});
}
},
doShow(row) {
this.initData(row);
@ -460,10 +524,16 @@ export default {
},
doSave() {
const self = this;
let flag = true;
if (this.$refs.form) {
this.$refs.form.validate((valid) => {
flag = valid;
});
}
this.$refs.datatop.validateForm(() => {
self.$refs.dataleft.validateForm(()=> {
self.$refs.dataright.validateForm(()=> {
this.setDeviceConfigFunction(this.data.id, this.formModel).then(response => {
flag && self.setDeviceConfigFunction(this.data.id, this.formModel).then(response => {
self.$message.success('设置设备网关映射配置成功');
self.handleClose();
self.$emit('reloadTable');
@ -481,10 +551,54 @@ export default {
this.leftRules = {};
this.rightRules = {};
this.data = {};
this.mapList = [];
this.stationList = [];
this.standList = [];
this.psdList = [];
this.mapId = '';
this.stationCode = '';
this.standCode = '';
this.dialogVisible = false;
this.$refs.datatop.resetForm();
this.$refs.dataleft.resetForm();
this.$refs.dataright.resetForm();
this.$refs.form && this.$refs.form.resetFields();
},
mapIdChange(mapId) {
this.stationList = [];
if (mapId) {
getStationListNeedAttendant(mapId).then(resp => {
if (resp.data && resp.data.length) {
this.stationList = resp.data;
}
}).catch(() => {
this.$message.error('获取车站列表失败');
});
}
},
stationCodeChange(stationCode) {
this.standList = [];
if (stationCode) {
getStandListByStationCode(this.mapId, stationCode).then(resp => {
if (resp.data && resp.data.length) {
this.standList = resp.data;
}
}).catch(() => {
this.$message.error('获取站台列表失败');
});
}
},
standCodeChange(standCode) {
this.psdList = [];
if (standCode) {
getPsdListByStandCode(this.mapId, standCode).then(resp => {
if (resp.data && resp.data.length) {
this.psdList = resp.data;
}
}).catch(() => {
this.$message.error('获取屏蔽门列表失败');
});
}
}
}
};