Merge branch 'master' of http://124.222.105.7:3000/dianliang/dl_site_system
This commit is contained in:
commit
b1866a8cdd
@ -95,7 +95,7 @@ public class WebSocketServer {
|
|||||||
public void CountPerson(String count){
|
public void CountPerson(String count){
|
||||||
for (String name : webSocketSet.keySet()){
|
for (String name : webSocketSet.keySet()){
|
||||||
try {
|
try {
|
||||||
webSocketSet.get(name).session.getBasicRemote().sendText(count);
|
webSocketSet.get(name).session.getBasicRemote().sendText("close,"+name+"退出聊天");
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
<result property="prodName" column="prod_name"/>
|
<result property="prodName" column="prod_name"/>
|
||||||
<result property="userName" column="user_name"/>
|
<result property="userName" column="user_name"/>
|
||||||
<result property="siteName" column="site_name"/>
|
<result property="siteName" column="site_name"/>
|
||||||
|
<result property="itemJson" column="item_json"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectBusiChatMainVo">
|
<sql id="selectBusiChatMainVo">
|
||||||
|
@ -28,6 +28,7 @@ export default {
|
|||||||
this.$store.dispatch('websocket_init', process.env.VUE_APP_WEBSOCKET+username)
|
this.$store.dispatch('websocket_init', process.env.VUE_APP_WEBSOCKET+username)
|
||||||
},
|
},
|
||||||
mounted(){
|
mounted(){
|
||||||
|
//事件总线调起聊天记录弹窗
|
||||||
EventBus.$on('newMessage', (message) => {
|
EventBus.$on('newMessage', (message) => {
|
||||||
this.$refs.chatFrom.openForm()
|
this.$refs.chatFrom.openForm()
|
||||||
});
|
});
|
||||||
|
@ -26,6 +26,14 @@ export function addChatMain(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function saveMessage(data) {
|
||||||
|
return request({
|
||||||
|
url: '/web/saveMessage',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 修改在线聊天
|
// 修改在线聊天
|
||||||
export function updateChatMain(data) {
|
export function updateChatMain(data) {
|
||||||
return request({
|
return request({
|
||||||
|
@ -19,7 +19,9 @@ const websocket = {
|
|||||||
} else if (e.data.startsWith("系统通知")){
|
} else if (e.data.startsWith("系统通知")){
|
||||||
state.notice.push(e.data);
|
state.notice.push(e.data);
|
||||||
console.log(state.notice);
|
console.log(state.notice);
|
||||||
} else {
|
} else if (e.data.startsWith("close")){
|
||||||
|
console.log(e.data)
|
||||||
|
}else {
|
||||||
console.log(e.data,'消息内容')
|
console.log(e.data,'消息内容')
|
||||||
//这里捕获消息
|
//这里捕获消息
|
||||||
const messageData = JSON.parse(e.data)
|
const messageData = JSON.parse(e.data)
|
||||||
@ -42,6 +44,9 @@ const websocket = {
|
|||||||
},
|
},
|
||||||
WEBSOCKET_CLOSE(state){
|
WEBSOCKET_CLOSE(state){
|
||||||
state.socket.close();
|
state.socket.close();
|
||||||
|
},
|
||||||
|
SET_MESSAGE(state,msg){
|
||||||
|
state.message = msg
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -54,6 +59,9 @@ const websocket = {
|
|||||||
},
|
},
|
||||||
websocket_close({commit}){
|
websocket_close({commit}){
|
||||||
commit('WEBSOCKET_CLOSE')
|
commit('WEBSOCKET_CLOSE')
|
||||||
|
},
|
||||||
|
set_message({commit},msg){
|
||||||
|
commit('SET_MESSAGE',msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- 选择产品对话框 -->
|
<!-- 选择产品对话框 -->
|
||||||
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
|
<el-dialog @close="close" :title="title" :visible.sync="open" width="800px" append-to-body>
|
||||||
<div class="dl-chat-box" >
|
<div class="dl-chat-box" >
|
||||||
<template v-for="(item,index) in messages">
|
<template v-for="(item,index) in messages">
|
||||||
<div v-if="item.dataFrom=='customer'" class="dl-customer-dom">
|
<div v-if="item.dataFrom=='customer'" class="dl-customer-dom">
|
||||||
@ -13,12 +13,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="item.dataFrom=='platform'" class="dl-platform-dom">
|
<div v-if="item.dataFrom=='platform'" class="dl-platform-dom">
|
||||||
|
|
||||||
<div class="dl-platform-right">
|
<div class="dl-platform-right">
|
||||||
<div class="dl-platform-time">{{item.createTime}}</div>
|
<div class="dl-platform-time">{{item.createTime}}</div>
|
||||||
<div class="dl-platform-content">{{ item.content }}</div>
|
<div class="dl-platform-content">{{ item.content }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="dl-platform-photo">
|
<div class="dl-platform-photo">
|
||||||
<img :src="picPrex+item.userImg" >
|
<img src="@/assets/images/customer.jpg" >
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -36,7 +37,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listChatItem, getChatItem, delChatItem, addChatItem, updateChatItem } from "@/api/busi/chatItem";
|
import { saveMessage } from "@/api/busi/chatMain";
|
||||||
export default {
|
export default {
|
||||||
name: 'chatForm',
|
name: 'chatForm',
|
||||||
data() {
|
data() {
|
||||||
@ -52,6 +53,8 @@ export default {
|
|||||||
pages:0,
|
pages:0,
|
||||||
//发送的消息
|
//发送的消息
|
||||||
text:'',
|
text:'',
|
||||||
|
//消息id
|
||||||
|
chatId:'',
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
mainId: null,
|
mainId: null,
|
||||||
@ -62,40 +65,46 @@ export default {
|
|||||||
/**
|
/**
|
||||||
* 组件显示
|
* 组件显示
|
||||||
*/
|
*/
|
||||||
show(id,title) {
|
show(row) {
|
||||||
this.reset()
|
this.reset()
|
||||||
this.title = title?title:"聊天记录"
|
|
||||||
this.open = true
|
this.open = true
|
||||||
this.queryParams.mainId = id
|
console.log(row)
|
||||||
this.getList()
|
this.chatId = row.id
|
||||||
|
if (row.itemJson!=null) {
|
||||||
|
this.messages = JSON.parse(row.itemJson)
|
||||||
|
this.$store.dispatch('set_message',this.messages);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
openForm(){
|
openForm(){
|
||||||
this.open = true
|
if (!this.open) {
|
||||||
this.messages = this.$store._modules.root.state.websocket.message
|
this.open = true
|
||||||
|
this.messages = this.$store._modules.root.state.websocket.message
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
reset(){
|
reset(){
|
||||||
this.chatItemList=[]
|
this.chatItemList=[]
|
||||||
},
|
},
|
||||||
|
|
||||||
// 取消按钮--新增随机产品
|
|
||||||
cancelSelect() {
|
|
||||||
this.open = false;
|
|
||||||
},
|
|
||||||
/** 查询在线聊天记录列表 */
|
|
||||||
getList() {
|
|
||||||
listChatItem(this.queryParams).then(response => {
|
|
||||||
this.chatItemList = response.data;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
/**发送消息*/
|
/**发送消息*/
|
||||||
sendToServer() {
|
sendToServer() {
|
||||||
this.$store.dispatch('websocket_send',"platform," + this.text);
|
this.$store.dispatch('websocket_send',"platform," + this.text);
|
||||||
this.messages = this.$store._modules.root.state.websocket.message
|
this.messages = this.$store._modules.root.state.websocket.message
|
||||||
this.text=''
|
this.text=''
|
||||||
|
},
|
||||||
|
|
||||||
|
close(){
|
||||||
|
this.open = false;
|
||||||
|
let data = {
|
||||||
|
id:this.chatId,
|
||||||
|
jsonArray:this.messages
|
||||||
|
}
|
||||||
|
saveMessage(data).then(res=>{
|
||||||
|
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -96,7 +96,7 @@
|
|||||||
<el-table v-loading="loading" :data="chatMainList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="chatMainList" @selection-change="handleSelectionChange">
|
||||||
<!-- <el-table-column type="selection" width="55" align="center" />-->
|
<!-- <el-table-column type="selection" width="55" align="center" />-->
|
||||||
<el-table-column type="index" width="60" label="序号" align="center"/>
|
<el-table-column type="index" width="60" label="序号" align="center"/>
|
||||||
<el-table-column label="客户唯一编码" align="center" prop="cusCode" />
|
<!-- <el-table-column label="客户唯一编码" align="center" prop="cusCode" />-->
|
||||||
<el-table-column align="center" prop="prodName" :min-width="120">
|
<el-table-column align="center" prop="prodName" :min-width="120">
|
||||||
<template slot="header" slot-scope="scope">
|
<template slot="header" slot-scope="scope">
|
||||||
<span>产品名称</span>
|
<span>产品名称</span>
|
||||||
@ -116,29 +116,39 @@
|
|||||||
<el-table-column label="洲" align="center" prop="oceania" />
|
<el-table-column label="洲" align="center" prop="oceania" />
|
||||||
<el-table-column label="设备类型" align="center" prop="equipment"/>
|
<el-table-column label="设备类型" align="center" prop="equipment"/>
|
||||||
<el-table-column label="负责员工" align="center" prop="userName" />
|
<el-table-column label="负责员工" align="center" prop="userName" />
|
||||||
<el-table-column align="center" prop="nums" >
|
<!-- <el-table-column align="center" prop="nums" >-->
|
||||||
<template slot="header" slot-scope="scope">
|
<!-- <template slot="header" slot-scope="scope">-->
|
||||||
<span>聊天记录数</span>
|
<!-- <span>聊天记录数</span>-->
|
||||||
<el-tooltip class="item" effect="dark" content="鼠标单机数据可查看聊天记录"
|
<!-- <el-tooltip class="item" effect="dark" content="鼠标单机数据可查看聊天记录"-->
|
||||||
placement="bottom"
|
<!-- placement="bottom"-->
|
||||||
>
|
<!-- >-->
|
||||||
<i class="el-icon-question"></i>
|
<!-- <i class="el-icon-question"></i>-->
|
||||||
</el-tooltip>
|
<!-- </el-tooltip>-->
|
||||||
</template>
|
<!-- </template>-->
|
||||||
<template slot-scope="scope">
|
<!-- <template slot-scope="scope">-->
|
||||||
<el-tag style="cursor: pointer" @click="handleDetail(scope.row)">{{scope.row.nums}}</el-tag>
|
<!-- <el-tag style="cursor: pointer" @click="handleDetail(scope.row)">{{scope.row.nums}}</el-tag>-->
|
||||||
</template>
|
<!-- </template>-->
|
||||||
</el-table-column>
|
<!-- </el-table-column>-->
|
||||||
<el-table-column label="最早聊天时间" align="center" prop="createTime" >
|
<el-table-column label="最早聊天时间" width="180" align="center" prop="createTime" >
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{scope.row.createTime | formatDate}}
|
{{scope.row.createTime | formatDate}}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="最近聊天时间" align="center" prop="updateTime" >
|
<el-table-column label="最近聊天时间" width="180" align="center" prop="updateTime" >
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{scope.row.updateTime | formatDate}}
|
{{scope.row.updateTime | formatDate}}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-s-comment"
|
||||||
|
@click="handleDetail(scope.row)"
|
||||||
|
>聊天</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<pagination
|
<pagination
|
||||||
@ -265,7 +275,8 @@ export default {
|
|||||||
* @param row
|
* @param row
|
||||||
*/
|
*/
|
||||||
handleDetail(row){
|
handleDetail(row){
|
||||||
this.$refs.chatFrom.show(row.id,"来自"+row.national+"-"+row.cusCode+"("+row.ip+")聊天记录")
|
console.log(row,'sdfadsafadsf')
|
||||||
|
this.$refs.chatFrom.show(row)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user