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){
|
||||
for (String name : webSocketSet.keySet()){
|
||||
try {
|
||||
webSocketSet.get(name).session.getBasicRemote().sendText(count);
|
||||
webSocketSet.get(name).session.getBasicRemote().sendText("close,"+name+"退出聊天");
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
<result property="prodName" column="prod_name"/>
|
||||
<result property="userName" column="user_name"/>
|
||||
<result property="siteName" column="site_name"/>
|
||||
<result property="itemJson" column="item_json"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBusiChatMainVo">
|
||||
|
@ -28,6 +28,7 @@ export default {
|
||||
this.$store.dispatch('websocket_init', process.env.VUE_APP_WEBSOCKET+username)
|
||||
},
|
||||
mounted(){
|
||||
//事件总线调起聊天记录弹窗
|
||||
EventBus.$on('newMessage', (message) => {
|
||||
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) {
|
||||
return request({
|
||||
|
@ -19,6 +19,8 @@ const websocket = {
|
||||
} else if (e.data.startsWith("系统通知")){
|
||||
state.notice.push(e.data);
|
||||
console.log(state.notice);
|
||||
} else if (e.data.startsWith("close")){
|
||||
console.log(e.data)
|
||||
}else {
|
||||
console.log(e.data,'消息内容')
|
||||
//这里捕获消息
|
||||
@ -42,6 +44,9 @@ const websocket = {
|
||||
},
|
||||
WEBSOCKET_CLOSE(state){
|
||||
state.socket.close();
|
||||
},
|
||||
SET_MESSAGE(state,msg){
|
||||
state.message = msg
|
||||
}
|
||||
},
|
||||
|
||||
@ -54,6 +59,9 @@ const websocket = {
|
||||
},
|
||||
websocket_close({commit}){
|
||||
commit('WEBSOCKET_CLOSE')
|
||||
},
|
||||
set_message({commit},msg){
|
||||
commit('SET_MESSAGE',msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<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" >
|
||||
<template v-for="(item,index) in messages">
|
||||
<div v-if="item.dataFrom=='customer'" class="dl-customer-dom">
|
||||
@ -13,12 +13,13 @@
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="item.dataFrom=='platform'" class="dl-platform-dom">
|
||||
|
||||
<div class="dl-platform-right">
|
||||
<div class="dl-platform-time">{{item.createTime}}</div>
|
||||
<div class="dl-platform-content">{{ item.content }}</div>
|
||||
</div>
|
||||
<div class="dl-platform-photo">
|
||||
<img :src="picPrex+item.userImg" >
|
||||
<img src="@/assets/images/customer.jpg" >
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -36,7 +37,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listChatItem, getChatItem, delChatItem, addChatItem, updateChatItem } from "@/api/busi/chatItem";
|
||||
import { saveMessage } from "@/api/busi/chatMain";
|
||||
export default {
|
||||
name: 'chatForm',
|
||||
data() {
|
||||
@ -52,6 +53,8 @@ export default {
|
||||
pages:0,
|
||||
//发送的消息
|
||||
text:'',
|
||||
//消息id
|
||||
chatId:'',
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
mainId: null,
|
||||
@ -62,40 +65,46 @@ export default {
|
||||
/**
|
||||
* 组件显示
|
||||
*/
|
||||
show(id,title) {
|
||||
show(row) {
|
||||
this.reset()
|
||||
this.title = title?title:"聊天记录"
|
||||
this.open = true
|
||||
this.queryParams.mainId = id
|
||||
this.getList()
|
||||
console.log(row)
|
||||
this.chatId = row.id
|
||||
if (row.itemJson!=null) {
|
||||
this.messages = JSON.parse(row.itemJson)
|
||||
this.$store.dispatch('set_message',this.messages);
|
||||
}
|
||||
},
|
||||
|
||||
openForm(){
|
||||
if (!this.open) {
|
||||
this.open = true
|
||||
this.messages = this.$store._modules.root.state.websocket.message
|
||||
}
|
||||
},
|
||||
|
||||
reset(){
|
||||
this.chatItemList=[]
|
||||
},
|
||||
|
||||
// 取消按钮--新增随机产品
|
||||
cancelSelect() {
|
||||
this.open = false;
|
||||
},
|
||||
/** 查询在线聊天记录列表 */
|
||||
getList() {
|
||||
listChatItem(this.queryParams).then(response => {
|
||||
this.chatItemList = response.data;
|
||||
});
|
||||
},
|
||||
|
||||
/**发送消息*/
|
||||
sendToServer() {
|
||||
this.$store.dispatch('websocket_send',"platform," + this.text);
|
||||
this.messages = this.$store._modules.root.state.websocket.message
|
||||
this.text=''
|
||||
},
|
||||
|
||||
close(){
|
||||
this.open = false;
|
||||
let data = {
|
||||
id:this.chatId,
|
||||
jsonArray:this.messages
|
||||
}
|
||||
saveMessage(data).then(res=>{
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -96,7 +96,7 @@
|
||||
<el-table v-loading="loading" :data="chatMainList" @selection-change="handleSelectionChange">
|
||||
<!-- <el-table-column type="selection" width="55" 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">
|
||||
<template slot="header" slot-scope="scope">
|
||||
<span>产品名称</span>
|
||||
@ -116,29 +116,39 @@
|
||||
<el-table-column label="洲" align="center" prop="oceania" />
|
||||
<el-table-column label="设备类型" align="center" prop="equipment"/>
|
||||
<el-table-column label="负责员工" align="center" prop="userName" />
|
||||
<el-table-column align="center" prop="nums" >
|
||||
<template slot="header" slot-scope="scope">
|
||||
<span>聊天记录数</span>
|
||||
<el-tooltip class="item" effect="dark" content="鼠标单机数据可查看聊天记录"
|
||||
placement="bottom"
|
||||
>
|
||||
<i class="el-icon-question"></i>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<el-tag style="cursor: pointer" @click="handleDetail(scope.row)">{{scope.row.nums}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="最早聊天时间" align="center" prop="createTime" >
|
||||
<!-- <el-table-column align="center" prop="nums" >-->
|
||||
<!-- <template slot="header" slot-scope="scope">-->
|
||||
<!-- <span>聊天记录数</span>-->
|
||||
<!-- <el-tooltip class="item" effect="dark" content="鼠标单机数据可查看聊天记录"-->
|
||||
<!-- placement="bottom"-->
|
||||
<!-- >-->
|
||||
<!-- <i class="el-icon-question"></i>-->
|
||||
<!-- </el-tooltip>-->
|
||||
<!-- </template>-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <el-tag style="cursor: pointer" @click="handleDetail(scope.row)">{{scope.row.nums}}</el-tag>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<el-table-column label="最早聊天时间" width="180" align="center" prop="createTime" >
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.createTime | formatDate}}
|
||||
</template>
|
||||
</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">
|
||||
{{scope.row.updateTime | formatDate}}
|
||||
</template>
|
||||
</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>
|
||||
|
||||
<pagination
|
||||
@ -265,7 +275,8 @@ export default {
|
||||
* @param 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