From df2cae5c2bce701d9491f40e38e883955490f21d Mon Sep 17 00:00:00 2001
From: dong <58670809@qq.com>
Date: Thu, 20 Apr 2023 10:57:56 +0800
Subject: [PATCH] Squashed commit of the following:
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
commit d0722f229c376afa241441bc91d085f6c6f68d4e
Author: dong <58670809@qq.com>
Date: Thu Apr 20 10:51:28 2023 +0800
新会话群
---
src/api/newChat.js | 125 +++++++
src/store/modules/map.js | 13 +
src/store/modules/socket.js | 9 +-
src/utils/baseUrl.js | 2 +-
src/utils/subscribeCallback.js | 3 +
src/views/newMap/display/index.vue | 2 +-
.../newMap/display/newChat/chatDialog.vue | 328 ++++++++++++++++++
src/views/newMap/display/newChat/index.vue | 64 ++++
.../mapoperate/simulationMember/index.vue | 288 ++++++++++++++-
9 files changed, 829 insertions(+), 5 deletions(-)
create mode 100644 src/api/newChat.js
create mode 100644 src/views/newMap/display/newChat/chatDialog.vue
create mode 100644 src/views/newMap/display/newChat/index.vue
diff --git a/src/api/newChat.js b/src/api/newChat.js
new file mode 100644
index 000000000..7c73725b9
--- /dev/null
+++ b/src/api/newChat.js
@@ -0,0 +1,125 @@
+
+import request from '@/utils/request';
+
+/**
+ * 获取群列表
+ * @param {String} groupId
+ * @returns
+ */
+export function getGroupList(groupId) {
+ return request({
+ url: `/api/simulation/${groupId}/conversation/group/list`,
+ method: 'get'
+ });
+}
+
+/**
+ * 创建群
+ * @param {String} groupId
+ * @param {String} data
+ * @param {String} data.name
+ * @param {String} data.imageUrl
+ * @param {Array} data.memberIds
+ * @returns
+ */
+export function createGroup(groupId, data) {
+ return request({
+ url: `/simulation/${groupId}/operate/Conversation_Group_Create`,
+ method: 'post',
+ data
+ });
+}
+
+/**
+ * 修改群组名称
+ * @param {String} groupId
+ * @param {Object} data
+ * @param {String} data.id
+ * @param {String} data.name
+ * @returns
+ */
+export function updateGroupName(groupId, data) {
+ return request({
+ url: `/simulation/${groupId}/operate/Conversation_Group_Update_Name`,
+ method: 'post',
+ data
+ });
+}
+
+/**
+ * 修改群组群主
+ * @param {String} groupId
+ * @param {Object} data
+ * @param {Number} data.id
+ * @param {String} data.memberId
+ * @returns
+ */
+export function updateGroupLeader(groupId, data) {
+ return request({
+ url: `/simulation/${groupId}/operate/Conversation_Group_Update_Leader`,
+ method: 'post',
+ data
+ });
+}
+
+/**
+ * 邀请人员入群
+ * @param {String} groupId
+ * @param {Object} data
+ * @param {Number} data.id
+ * @param {Array} data.memberIds
+ * @returns
+ */
+export function inviteMemberToGroup(groupId, data) {
+ return request({
+ url: `/simulation/${groupId}/operate/Conversation_Group_Invite_Member`,
+ method: 'post',
+ data
+ });
+}
+
+/**
+ * 移除群内人员
+ * @param {String} groupId
+ * @param {Object} data
+ * @param {Number} data.id
+ * @param {Array} data.memberIds
+ * @returns
+ */
+export function removeMemberFromGroup(groupId, data) {
+ return request({
+ url: `/simulation/${groupId}/operate/Conversation_Group_Remove_Member`,
+ method: 'post',
+ data
+ });
+}
+
+/**
+ * 退出群组
+ * @param {String} groupId
+ * @param {Object} data
+ * @param {Number} data.id
+ * @returns
+ */
+export function exitGroup(groupId, data) {
+ return request({
+ url: `/simulation/${groupId}/operate/Conversation_Group_Exit`,
+ method: 'post',
+ data
+ });
+}
+
+/**
+ * 解散群组
+ * @param {String} groupId
+ * @param {Object} data
+ * @param {Number} data.id
+ * @returns
+ */
+export function dissolveGroup(groupId, data) {
+ return request({
+ url: `/simulation/${groupId}/operate/Conversation_Group_Dissolve`,
+ method: 'post',
+ data
+ });
+}
diff --git a/src/store/modules/map.js b/src/store/modules/map.js
index 4c20295aa..b98539b20 100644
--- a/src/store/modules/map.js
+++ b/src/store/modules/map.js
@@ -806,6 +806,19 @@ const map = {
map.memberMap.EMERGENCY = [];
}
}
+ if (!map.conversationGroupMap) {
+ map.conversationGroupMap = { METRO: [], RAILWAY: [], EMERGENCY: [] };
+ } else {
+ if (!map.conversationGroupMap.METRO) {
+ map.conversationGroupMap.METRO = [];
+ }
+ if (!map.conversationGroupMap.RAILWAY) {
+ map.conversationGroupMap.RAILWAY = [];
+ }
+ if (!map.conversationGroupMap.EMERGENCY) {
+ map.conversationGroupMap.EMERGENCY = [];
+ }
+ }
state.map = map;
let showConfig = {};
if (Vue.prototype.$jlmap && typeof Vue.prototype.$jlmap.getShowConfig === 'function') {
diff --git a/src/store/modules/socket.js b/src/store/modules/socket.js
index 4b56cba08..56145740d 100644
--- a/src/store/modules/socket.js
+++ b/src/store/modules/socket.js
@@ -119,7 +119,8 @@ const socket = {
simulationWorkParam: {},
conversationMessage: {},
controlTransfer: {},
- operationModeApplyList: [] // 模式转换消息列表
+ operationModeApplyList: [], // 模式转换消息列表
+ conversationGroup: {} // 群组消息
},
getters: {
},
@@ -406,6 +407,9 @@ const socket = {
state.operationModeApplyList.splice(index, 1);
}
});
+ },
+ setConversationGroup: (state, message) => {
+ state.conversationGroup = message;
}
},
@@ -644,6 +648,9 @@ const socket = {
},
operationModeApply: ({ commit }, message) => {
commit('operationModeApply', message);
+ },
+ setConversationGroup: ({ commit }, message) => {
+ commit('setConversationGroup', message);
}
}
};
diff --git a/src/utils/baseUrl.js b/src/utils/baseUrl.js
index 6151b9016..88ca6c631 100644
--- a/src/utils/baseUrl.js
+++ b/src/utils/baseUrl.js
@@ -31,7 +31,7 @@ export function handlerUrl() {
// BASE_API = 'http://192.168.3.94:9000'; // 旭强
// BASE_API = 'http://192.168.3.15:9000'; // 张赛
// BASE_API = 'http://192.168.3.5:9000'; // 夏增彬
- // BASE_API = 'http://192.168.3.37:9000'; // 卫志宏
+ BASE_API = 'http://192.168.3.37:9000'; // 卫志宏
// BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康
// BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛
diff --git a/src/utils/subscribeCallback.js b/src/utils/subscribeCallback.js
index 30a61a8ac..0e85449a2 100644
--- a/src/utils/subscribeCallback.js
+++ b/src/utils/subscribeCallback.js
@@ -99,6 +99,9 @@ function handle(data) {
case 'Simulation_Member':
store.dispatch('socket/memberChangeCountIncrease');
break;
+ case 'Simulation_Conversation_Group':
+ store.dispatch('socket/setConversationGroup', msg);
+ break;
case 'Simulation_Time_Sync':
store.dispatch('socket/setSimulationTimeSync', msg);
break;
diff --git a/src/views/newMap/display/index.vue b/src/views/newMap/display/index.vue
index 03ce0b51f..1f807ceda 100644
--- a/src/views/newMap/display/index.vue
+++ b/src/views/newMap/display/index.vue
@@ -29,7 +29,7 @@ import TrainingTip from './trainingList/trainingTip';
import TrainingPositionTip from './trainingList/trainingPositionTip.vue';
import TrainingMenu from './trainingList/trainingMenu';
import TrainingDesign from './trainingDesign/designPane.vue';
-import ChatBox from './chatBox';
+import ChatBox from './newChat/index.vue';
import TrainingLeftSlider from './trainingList/trainingLeftSlider';
import LineBoard from './lineBoard';
import BottomTable from './bottomTable';
diff --git a/src/views/newMap/display/newChat/chatDialog.vue b/src/views/newMap/display/newChat/chatDialog.vue
new file mode 100644
index 000000000..345c28778
--- /dev/null
+++ b/src/views/newMap/display/newChat/chatDialog.vue
@@ -0,0 +1,328 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{ item.name }}
+
{{ item.message }}
+
+
+
+
+
+
消息
+
+
文档
+
工作台
+
通讯录
+
+
+
+
+
+
+
+
+
diff --git a/src/views/newMap/display/newChat/index.vue b/src/views/newMap/display/newChat/index.vue
new file mode 100644
index 000000000..5f8c99c71
--- /dev/null
+++ b/src/views/newMap/display/newChat/index.vue
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
diff --git a/src/views/newMap/newMapdraft/mapoperate/simulationMember/index.vue b/src/views/newMap/newMapdraft/mapoperate/simulationMember/index.vue
index 2d101f2c8..845142563 100644
--- a/src/views/newMap/newMapdraft/mapoperate/simulationMember/index.vue
+++ b/src/views/newMap/newMapdraft/mapoperate/simulationMember/index.vue
@@ -303,6 +303,123 @@
一键清空
+
+
+
+
+
+ 群名称
+ 群头像
+ 群主
+ 成员
+ 操作
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 删除
+
+
+
+
+
+
+
+ 群名称
+ 群头像
+ 群主
+ 成员
+ 操作
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 删除
+
+
+
+
+
+
+
+ 群名称
+ 群头像
+ 群主
+ 成员
+ 操作
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 删除
+
+
+
+
+
+
+
+ 新建会话群
+
+
+
@@ -310,6 +427,7 @@
import {mapGetters} from 'vuex';
import { getDisStationList } from '@/api/disStation';
import ConstConfig from '@/scripts/ConstConfig';
+import { getUploadUrl } from '@/api/projectConfig';
export default {
name: 'SimulationMember',
data() {
@@ -317,6 +435,7 @@ export default {
lazy: true,
activeName: 'first',
memberActive: 'METRO',
+ conversationActive: 'METRO',
roleList: ConstConfig.ConstSelect.roleTypeList,
systemList: [
{ label: '地铁CBTC', value: 'METRO' },
@@ -377,6 +496,15 @@ export default {
},
memberEmergencyList() {
return this.$store.state.map.map.memberMap.EMERGENCY;
+ },
+ conversationMetroList() {
+ return this.$store.state.map.map.conversationGroupMap.METRO;
+ },
+ conversationRailwayList() {
+ return this.$store.state.map.map.conversationGroupMap.RAILWAY;
+ },
+ conversationEmergencyList() {
+ return this.$store.state.map.map.conversationGroupMap.EMERGENCY;
}
},
watch: {
@@ -386,6 +514,79 @@ export default {
this.initDisStationList();
},
methods: {
+ getImgUrl(url) {
+ return url ? this.$store.state.user.ossUrl + '/conversationGroup/' + url : '';
+ },
+ getLabel(obj) {
+ let name = '';
+ const findType = this.roleList.find(item => {
+ return item.value == obj.type;
+ });
+ if (findType) {
+ name += findType.label;
+ }
+ name += '-';
+ if (obj.type == 'DISPATCHER') {
+ const findDeviceCode = this.disStationList.find(item => {
+ return item.code == obj.deviceCode;
+ });
+ if (findDeviceCode) {
+ name += findDeviceCode.name;
+ }
+ } else if (obj.type == 'DRIVER') {
+ const findDeviceCode = this.trainList.find(item => {
+ return item.groupNumber == obj.deviceCode;
+ });
+ if (findDeviceCode) {
+ name += findDeviceCode.groupNumber;
+ }
+ } else {
+ const findDeviceCode = this.stationList.find(item => {
+ return item.code == obj.deviceCode;
+ });
+ if (findDeviceCode) {
+ name += findDeviceCode.name;
+ }
+ }
+ return name;
+ },
+ deleteConversation(index, type) {
+ const conversationMap = { METRO: this.conversationMetroList, RAILWAY: this.conversationRailwayList, EMERGENCY: this.conversationEmergencyList };
+ if (conversationMap[this.conversationActive]) {
+ conversationMap[this.conversationActive].splice(index, 1);
+ }
+ },
+ createConversation() {
+ const list = [];
+ this.conversationMetroList.forEach(item => {
+ if (item.id) {
+ list.push(item.id);
+ }
+ });
+ this.conversationRailwayList.forEach(item => {
+ if (item.id) {
+ list.push(item.id);
+ }
+ });
+ this.conversationEmergencyList.forEach(item => {
+ if (item.id) {
+ list.push(item.id);
+ }
+ });
+ const maxNum = list.length ? Math.max(...list) : 0;
+ const obj = {
+ id: maxNum + 1,
+ name: '',
+ imageUrl: '',
+ leaderId: '',
+ memberIds: []
+ };
+ console.log('🚀 ~ file: index.vue:584 ~ createConversation ~ obj:', obj);
+ const conversationMap = { METRO: this.conversationMetroList, RAILWAY: this.conversationRailwayList, EMERGENCY: this.conversationEmergencyList };
+ if (conversationMap[this.conversationActive]) {
+ conversationMap[this.conversationActive].push(obj);
+ }
+ },
initDisStationList() {
getDisStationList(this.$route.params.mapId).then(resp => {
this.disStationList = resp.data || [];
@@ -836,11 +1037,94 @@ export default {
keyClear() {
const memberMap = { METRO: this.memberMetroList, RAILWAY: this.memberRailwayList, EMERGENCY: this.memberEmergencyList };
memberMap[this.clearForm.systemType].splice(0, memberMap[this.clearForm.systemType].length);
+ },
+ uploadLogo(type, index) {
+ const pic = document.getElementById('upload_file_' + type + index);
+ if (!pic.files || !pic.files[0]) {
+ return;
+ }
+ const file = pic.files[0];
+ const mineType = file.type;
+ const fileSize = file.size;
+ if (mineType != 'image/png' && mineType != 'image/jpeg') {
+ this.$message.error('仅支持png和jpeg格式的图片');
+ return;
+ }
+ if (fileSize / (1024 * 1024) > 1) {
+ this.$message.error('图片应该小于1M');
+ return;
+ }
+ const fileArray = file.name.split('.');
+ const fileType = fileArray[fileArray.length - 1] || '';
+ if (!fileType) {
+ return;
+ }
+ const params = {
+ directory:'conversationGroup',
+ fileName:'group_' + Math.floor(Math.random() * 1000000) + '.' + fileType,
+ method:'PUT'
+ };
+ const conversationMap = { METRO: this.conversationMetroList, RAILWAY: this.conversationRailwayList, EMERGENCY: this.conversationEmergencyList };
+ const that = this;
+ getUploadUrl(params).then((response) => {
+ const url = response.data;
+ if (url) {
+ const xhr = new XMLHttpRequest();
+ xhr.open('PUT', url);
+ xhr.setRequestHeader('Content-Type', 'multipart/form-data');
+ xhr.send(file);
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState === 4 && xhr.status == 200) {
+ if (conversationMap[type] && conversationMap[type][index]) {
+ conversationMap[type][index].imageUrl = params.fileName;
+ }
+ } else if (xhr.status != 200) {
+ that.$message.error('上传失败,请稍后再试');
+ }
+ };
+ }
+ });
+
+ // 参数:directory:MINIO文件夹
+ // fileName:存储文件名
+ // method:生成链接的请求方式
}
}
};
-