Commit e5ef8cd9 by unknown

Merge branch 'front_end_dev' of https://gitee.com/LinkWeChat/link-wechat into front_end_dev

2 parents 183be53b 1920600b
......@@ -8,7 +8,7 @@
<div align="center">
![GVP Stars](http://img.shields.io/badge/GPV%20Stars-600+-yellow)
![GVP Stars](http://img.shields.io/badge/GPV%20Stars-700+-yellow)
![GVP Forks](http://img.shields.io/badge/GPV%20Forks-200+-yellow)
![license](http://img.shields.io/badge/license-GPL%203.0-green)
......
......@@ -8,6 +8,7 @@
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
<script src="./jweixin-1.2.0.js"></script>
<script src="https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js"></script>
</head>
<body>
......
......@@ -4,26 +4,82 @@ export default {
name: 'App',
data() {
return {
timestamp: '',
nonceStr: '',
signature: '',
appId: 'appId',
agentId: '1000005',
}
},
created() {
// 调取服务端signature
// this.wxConfig()
},
watch: {
// 通过config接口注入权限验证配置
// 所有需要使用JS-SDK的页面必须先注入配置信息,否则将无法调用(同一个url仅需调用一次,对于变化url的SPA(single-page application)的web app可在每次url变化时进行调用)
$router() {
wx.config({
beta: true, // 必须这么写,否则wx.invoke调用形式的jsapi会有问题
debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId: '123456', // 必填,企业微信的corpID
timestamp: this.timestamp, // 必填,生成签名的时间戳
nonceStr: this.nonceStr, // 必填,生成签名的随机串
signature: this.signature, // 必填,签名,见 附录-JS-SDK使用权限签名算法
jsApiList: [], // 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
$route() {
this.wxConfig()
},
},
methods: {
wxConfig() {
getAgentTicket(window.location.href.split('#')[0]).then(({ data }) => {
let { timestamp, nonceStr, signature } = data
wx.agentConfig({
corpid: this.appId, // 必填,企业微信的corpid,必须与当前登录的企业一致
agentid: this.agentId, // 必填,企业微信的应用id (e.g. 1000247)
timestamp, // 必填,生成签名的时间戳
nonceStr, // 必填,生成签名的随机串
signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
jsApiList: ['sendChatMessage'], //必填
success: (res) => {
// 回调
},
fail: (res) => {
if (res.errMsg.indexOf('function not exist') > -1) {
alert('版本过低请升级')
}
},
})
})
},
_wxConfig() {
// 获取企业的jsapi_ticket
getAppTicket(window.location.href).then(({ data }) => {
let { timestamp, nonceStr, signature } = data
wx.config({
beta: true, // 必须这么写,否则wx.invoke调用形式的jsapi会有问题
debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId: this.appId, // 必填,企业微信的corpID
timestamp, // 必填,生成签名的时间戳
nonceStr, // 必填,生成签名的随机串
signature, // 必填,签名,见 附录-JS-SDK使用权限签名算法
jsApiList: ['getContext', 'sendChatMessage'], // 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
})
wx.ready(() => {
// config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。
getAgentTicket(window.location.href).then(({ data }) => {
let { timestamp, nonceStr, signature } = data
wx.agentConfig({
corpid: this.appId, // 必填,企业微信的corpid,必须与当前登录的企业一致
agentid: this.agentId, // 必填,企业微信的应用id (e.g. 1000247)
timestamp, // 必填,生成签名的时间戳
nonceStr, // 必填,生成签名的随机串
signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
jsApiList: ['sendChatMessage'], //必填
success: (res) => {
// 回调
},
fail: (res) => {
if (res.errMsg.indexOf('function not exist') > -1) {
alert('版本过低请升级')
}
},
})
})
})
wx.error(function(res) {
console.error(res)
// config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
})
})
},
},
......
......@@ -5,12 +5,9 @@ const service = window.CONFIG.services.wecom + '/chat'
* 侧边栏列表
* @param {*} params
*/
export function getTypeList(params) {
export function getTypeList() {
return request({
url: service + '/side/list',
params: {
h5: 1,
},
url: service + '/side/h5List',
})
}
......@@ -18,12 +15,10 @@ export function getTypeList(params) {
* 素材列表
* @param {*} sideId
*/
export function getMaterialList(sideId) {
export function getMaterialList(params) {
return request({
url: service + '/item/list',
params: {
sideId,
},
params,
})
}
......@@ -31,12 +26,10 @@ export function getMaterialList(sideId) {
* 收藏列表(h5我的)
* @param {*} userId
*/
export function getCollectionList(userId) {
export function getCollectionList(params) {
return request({
url: service + '/collection/list',
params: {
userId,
},
params,
})
}
......@@ -57,7 +50,7 @@ export function addCollection(data) {
}
/**
* 侧边栏抓取素材
* 取消收藏
* @param {*} data
* {
materialId:素材id
......@@ -67,7 +60,7 @@ userId:用户id
export function cancleCollection(data) {
return request({
url: service + '/collection/cancleCollection',
method: 'put',
method: 'post',
data,
})
}
import request from '@/utils/request'
const service = window.CONFIG.services.wecom + '/ticket'
import config from '@/config'
const service = config.services.wecom
/**
* 获取应用的jsapi_ticket
......@@ -7,7 +8,7 @@ const service = window.CONFIG.services.wecom + '/ticket'
*/
export function getAgentTicket(url) {
return request({
url: service + '/getAgentTicket',
url: service + '/ticket/getAgentTicket',
params: {
url,
},
......@@ -20,7 +21,7 @@ export function getAgentTicket(url) {
*/
export function getAppTicket(url) {
return request({
url: service + '/getAppTicket',
url: service + '/ticket/getAppTicket',
params: {
url,
},
......@@ -28,46 +29,14 @@ export function getAppTicket(url) {
}
/**
* 收藏列表(h5我的)
* @param {*} userId
* 获取企业的jsapi_ticket
* @param {*} url 页面url
*/
export function getCollectionList(userId) {
export function getUserInfo(code) {
return request({
url: service + '/collection/list',
url: service + '/user/getUserInfo',
params: {
userId,
code,
},
})
}
/**
* 添加收藏
* @param {*} data
* {
materialId:素材id
userId:用户id
}
*/
export function addCollection(data) {
return request({
url: service + '/collection/addCollection',
method: 'post',
data,
})
}
/**
* 侧边栏抓取素材
* @param {*} data
* {
materialId:素材id
userId:用户id
}
*/
export function cancleCollection(data) {
return request({
url: service + '/collection/cancleCollection',
method: 'put',
data,
})
}
import axios from 'axios'
import { Toast } from 'vant'
function createAxios(baseURL) {
const instance = axios.create({
......@@ -24,8 +25,8 @@ function createAxios(baseURL) {
// console.log('res: ' + res)
const { data, status } = res
// code 0:成功,-1/其它:错误
if (status === 200 && data.code === 0) {
return JSON.stringify(data.result) ? data.result : data.data
if (status === 200 && data.code === 200) {
return data
} else if (data.code === 201) {
// Message.error({
// content: `产品已存在`,
......@@ -44,10 +45,7 @@ function createAxios(baseURL) {
if (error.response) {
addErrorLog(error.response)
} else {
// Message.error({
// content: `服务器未启动或连接超时`,
// duration: 3
// })
Toast.fail('服务器未启动或连接超时')
console.error('服务器未启动或连接超时')
}
return Promise.reject(error)
......@@ -71,6 +69,7 @@ function createAxios(baseURL) {
process.env.NODE_ENV === 'development'
? console.error(`错误: 路径: ${responseURL}, 返回值 : ${responseText}`)
: console.error(`${JSON.parse(responseText).message}`)
Toast.fail(`${responseText}`)
}
return instance
......
......@@ -16,48 +16,130 @@ export default {
type: String,
default: '',
},
keyword: {
type: String,
default: '',
},
},
data() {
return {
list: [{}],
loading: false,
finished: false,
error: false,
pageSize: 1,
pageNum: 10,
list: [],
collectList: [],
}
},
watch: {},
computed: {},
created() {},
created() {
this.getList()
this.userId && this.getCollectionList()
},
mounted() {},
methods: {
getList() {
getList(page) {
let pageSize = page || this.pageSize++
let pageNum = this.pageNum
let keyword = this.keyword
page == 1 && (this.list = [])
this.loading = true
;(this.userId ? getCollectionList : getMaterialList)()
;(this.sideId
? getMaterialList({ sideId: this.sideId, pageSize, pageNum, keyword })
: getCollectionList({ userId: this.userId, pageSize, pageNum, keyword })
)
.then(({ rows, total }) => {
this.list = rows
this.list.push(...rows)
this.loading = false
this.finished = true
// 数据全部加载完成
if (this.list.length >= total) {
this.finished = true
}
})
.catch(() => {
this.loading = false
this.finished = true
this.error = true
})
},
getCollectionList() {
getCollectionList().then(({ rows, total }) => {
let data = { userId: this.userId, pageSize: 1, pageNum: 1000 }
getCollectionList(data).then(({ rows, total }) => {
this.collectList = rows.map((d) => d.id)
})
},
isCollected(id) {
return this.collectList.includes(id)
},
send() {},
send(data) {
let entry = undefined
wx.invoke('getContext', {}, function(res) {
if (res.err_msg == 'getContext:ok') {
entry = res.entry //返回进入H5页面的入口类型,目前有normal、contact_profile、single_chat_tools、group_chat_tools
if (!['single_chat_tools', 'group_chat_tools'].includes(entry)) {
return
}
// mediaType 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file) 4 文本 5 海报
// msgtype 文本(“text”),图片(“image”),视频(“video”),文件(“file”),H5(“news”)和小程序(“miniprogram”)
let mes = {}
let msgtype = {
0: 'image',
2: 'video',
3: 'file',
4: 'text',
5: 'news',
}
switch (data.mediaType) {
case '4':
default:
mes.text = {
content: data.content, //文本内容
}
break
case '0':
case '2':
case '3':
mes[msgtype[data.mediaType]] = {
mediaid: data.materialId, //
}
break
case '5':
mes.news = {
link: '', //H5消息页面url 必填
title: '', //H5消息标题
desc: '', //H5消息摘要
imgUrl: '', //H5消息封面图片URL
}
break
// case '6':
// mes.miniprogram = {
// appid: 'wx8bd80126147df384', //小程序的appid
// title: 'this is title', //小程序消息的title
// imgUrl:
// 'https://search-operate.cdn.bcebos.com/d054b8892a7ab572cb296d62ec7f97b6.png', //小程序消息的封面图。必须带http或者https协议头,否则报错 $apiName$:fail invalid imgUrl
// page: '/index/page.html', //小程序消息打开后的路径,注意要以.html作为后缀,否则在微信端打开会提示找不到页面
// }
// break
}
mes.msgtype = msgtype[data.mediaType]
wx.invoke('sendChatMessage', mes, function(res) {
if (res.err_msg == 'sendChatMessage:ok') {
//发送成功
}
})
} else {
//错误处理
}
})
},
collect(materialId) {
;(this.isCollected(materialId) ? cancleCollection : addCollection)({
userId,
userId: this.userId,
materialId,
}).then(({ data }) => {
this.isCollected.splice(this.isCollected.indexOf(materialId), 1)
this.isCollected(materialId)
? this.isCollected.splice(this.isCollected.indexOf(materialId), 1)
: this.isCollected.push(materialId)
})
},
},
......@@ -70,17 +152,19 @@ export default {
v-model="loading"
:finished="finished"
finished-text="没有更多了"
@load="getList"
:error.sync="error"
error-text="请求失败,点击重新加载"
@load="getList()"
>
<div v-for="(item, index) in list" class="list" :key="index">
<div class="title">dsdsds</div>
<div class="title">{{ item.content }}</div>
<div class="info">
素材库
{{ item.content }}
<span>2020/2/4</span>
<div class="fr flex">
<div class="action" @click="send">发送</div>
<div class="action" @click="collect(item.id)">
<div class="action" @click="send(item)">发送</div>
<div v-if="!!userId" class="action" @click="collect(item.id)">
{{ isCollected(item.id) ? '已' : '' }}收藏
</div>
</div>
......
2
<script>
import { getUserInfo } from '@/api/common'
import { getTypeList } from '@/api/chat'
import List from './List'
export default {
......@@ -6,18 +8,60 @@ export default {
props: {},
data() {
return {
keywords: '',
active: 2,
keyword: '',
active: 0,
list: [],
loading: false,
finished: false,
show: false,
userId: '',
auth_code: '',
auth_code1: '',
}
},
watch: {},
computed: {},
beforeCreate() {
// http://106.13.201.219/?auth_code=xxx#/authWehatCallback
// console.log('routerbeforeCreate', this.$route);
// let auth_code = location.search
// .slice(1)
// .split('&')[0]
// .split('=')[1]
// this.auth_code1 = auth_code
// if (!auth_code) {
// this.$toast('未获得授权')
// return
// }
// getUserInfo(auth_code)
// .then(({ data }) => {
// this.userId = data.userId
// this.$toast('userId:' + this.userId)
// })
// .catch((err) => {
// this.$toast('err:' + err)
// })
},
created() {
let auth_code = location.search
.slice(1)
.split('&')[0]
.split('=')[1]
this.auth_code1 = auth_code
if (!auth_code) {
this.$toast('未获得授权')
return
}
getUserInfo(auth_code)
.then(({ data }) => {
this.userId = data.userId
this.$toast('userId:' + this.userId)
})
.catch((err) => {
this.$toast('err:' + err)
})
this.getList()
this.auth_code = location
},
mounted() {},
methods: {
......@@ -26,7 +70,9 @@ export default {
this.list = rows
})
},
search() {},
search() {
this.$refs['list' + this.active].getList(1)
},
add() {},
},
}
......@@ -35,7 +81,7 @@ export default {
<template>
<div>
<van-search
v-model="keywords"
v-model="keyword"
show-action
placeholder="请输入搜索关键词"
@search="search"
......@@ -44,11 +90,26 @@ export default {
<van-icon name="plus" @click="add" />
</template> -->
</van-search>
<span>{{ auth_code }}</span>
<br />
<span>auth_code:{{ auth_code1 }}</span>
<van-tabs v-model="active">
<van-tab title="标签 1">
<List></List>
<van-tab v-if="!!userId" title="我的">
<List ref="list0" :userId="userId" :keyword="keyword"></List>
</van-tab>
<van-tab
:title="item.sideName"
v-for="(item, index) in list"
:key="index"
>
<List
:ref="'list' + (index + 1)"
:sideId="item.sideId"
:userId="userId"
:keyword="keyword"
></List>
</van-tab>
<van-tab title="标签 2"><List></List></van-tab>
</van-tabs>
<!-- <van-dialog
......
......@@ -2,7 +2,7 @@
ENV = 'development'
# 塬微管理系统/开发环境
VUE_APP_BASE_API = 'http://106.13.201.219'
VUE_APP_BASE_API = 'http://146.56.222.200/api/'
# VUE_APP_BASE_API = 'http://n3rpzt.natappfree.cc'
# 开发环境IP
......
......@@ -2,15 +2,12 @@ import request from '@/utils/request'
const service = window.CONFIG.services.wecom + '/chat'
/**
*
* 侧边栏列表
* @param {*} params
*/
export function getList(params) {
export function getList() {
return request({
url: service + '/side/list',
params: {
h5: 0,
},
})
}
......
......@@ -14,9 +14,16 @@ const getTree=(params)=>{
params,
})
}
const chatGrounpList=(params)=>{
return request({
url:'/wecom/finance/getChatRoomContactList',
method: 'get',
params,
})
}
const listByCustomer=(params)=>{
return request({
url:'/chat/mapping/listByCustomer',
url:'/wecom/customer/list',
method: 'get',
params,
})
......@@ -33,5 +40,6 @@ const getTree=(params)=>{
getTree,
chatList,
listByCustomer,
getChatAllList
getChatAllList,
chatGrounpList
}
\ No newline at end of file
import request from '@/utils/request'
const service = window.CONFIG.services.wecom + '/sensitive'
/**
* 获取敏感词触发列表
* @param {*} params
*
*/
export function getSecurityList(params) {
return request({
url: service + '/hit/list',
method: 'get',
params,
})
}
/**
* 获取敏感词设置列表
* @param {*} params
*
*/
export function getSettingSensitiveList(params) {
return request({
url: service + '/list',
method: 'get',
params,
})
}
/**
* 添加敏感词设置
* @param {*} params
*
*/
export function addSettingSensitive(data) {
return request({
url: service,
method: 'post',
data: data
})
}
/**
* 修改敏感词设置
* @param {*} params
*
*/
export function modifySettingSensitive(data) {
return request({
url: service,
method: 'put',
data: data
})
}
/**
* 获取敏感词详情
* @param {*} params
*
*/
export function getSensitiveDetails(tableId) {
return request({
url: service + '/' + tableId,
method: 'get'
})
}
/**
* 删除敏感词
* @param {*} params
*
*/
export function deleteSensitive(tableId) {
return request({
url: service + '/' + tableId,
method: 'delete'
})
}
/**
* 获取敏感行为警告敏感记录列表
* @param {*} params
*
*/
export function getSensitiveRecord(params) {
return request({
url: service + '/act/hit/list',
method: 'get',
params,
})
}
/**
* 获取敏感行为管理列表
* @param {*} params
*
*/
export function getSensitiveManagement(params) {
return request({
url: service + '/act/list',
method: 'get',
params,
})
}
import request from "@/utils/request";
const service = window.CONFIG.services.wecom + "/customerMessagePush";
import request from '@/utils/request'
const service = window.CONFIG.services.wecom + '/customerMessagePush'
/**
* 新增企业id
......@@ -35,10 +35,10 @@ const service = window.CONFIG.services.wecom + "/customerMessagePush";
*/
export function add(data) {
return request({
url: service + "/add",
method: "post",
data
});
url: service + '/add',
method: 'post',
data,
})
}
/**
......@@ -53,9 +53,9 @@ endTime:结束时间}
*/
export function getList(params) {
return request({
url: service + "/list",
params
});
url: service + '/list',
params,
})
}
/**
......@@ -64,9 +64,9 @@ export function getList(params) {
*/
export function getDetail(messageId) {
return request({
url: service + "/getInfo",
params: { messageId }
});
url: service + '/getInfo',
params: { messageId },
})
}
/**
......@@ -77,7 +77,21 @@ status:发送状态 0-未发送 1-已发送 2-因客户不是好友导致发送
*/
export function getPushResult(params) {
return request({
url: service + "/pushResults",
params
});
url: service + '/pushResults',
params,
})
}
/**
* 同步消息发送结果
* @param {*} data
* msgid:列表msgid
messageId:消息id
*/
export function syncMsg(data) {
return request({
url: service + '/asyncResult',
method: 'post',
data,
})
}
<script>
import { getTree, getList } from '@/api/material'
import { getTree, getList } from "@/api/material";
export default {
components: {},
props: {
type: {
type: String,
default: '4',
default: "4",
},
multiple: {
type: Boolean,
......@@ -23,82 +23,83 @@ export default {
query: {
pageNum: 1,
pageSize: 10,
categoryId: '',
search: '',
mediaType: '4',
categoryId: "",
search: "",
mediaType: "4",
},
list: [], // 列表
total: 0, // 总条数
treeData: [], // 树
// 树props
treeProps: {
children: 'children',
label: 'name',
children: "children",
label: "name",
},
// 分组props
groupProps: {
// expandTrigger: 'hover',
checkStrictly: true,
children: 'children',
label: 'name',
value: 'id',
children: "children",
label: "name",
value: "id",
emitPath: false,
},
radio: '',
radio: "",
// 树props
treeProps: {
children: 'children',
label: 'name',
children: "children",
label: "name",
},
}
selectedx: []
};
},
watch: {
radio(val) {
this.$emit('change', val)
this.$emit("change", val);
},
},
computed: {},
created() {
this.query.mediaType = this.type
this.getTree()
this.getList()
this.query.mediaType = this.type;
this.getTree();
this.getList();
},
mounted() {},
methods: {
// 获取类目树
getTree() {
getTree(this.type).then(({ data }) => {
this.treeData = data
})
this.treeData = data;
});
},
// 获取素材列表
getList(page) {
page && (this.query.pageNum = page)
this.loading = true
page && (this.query.pageNum = page);
this.loading = true;
getList(this.query)
.then(({ rows, total }) => {
this.list = rows
this.total = +total
this.loading = false
this.$emit('listChange', this.list)
this.list = rows;
this.total = +total;
this.loading = false;
this.$emit("listChange", this.list);
})
.catch(() => {
this.loading = false
})
this.loading = false;
});
},
// 节点单击事件
handleNodeClick(data) {
this.query.categoryId = data.id
this.getList(1)
this.query.categoryId = data.id;
this.getList(1);
},
// 多选框选中数据
handleSelectionChange(selection) {
this.$emit('update:selected', selection)
this.$emit("update:selected", selection);
},
},
}
};
</script>
<template>
......@@ -114,7 +115,7 @@ export default {
<el-input
v-model="query.search"
class="ml10 mr10"
style="width: 150px;"
style="width: 150px"
@keydown.enter="getList(1)"
></el-input>
<el-button
......@@ -200,23 +201,25 @@ export default {
</el-table>
<el-row v-else :gutter="20">
<el-col
:span="6"
style="margin-bottom: 24px;min-width: 220px;"
v-for="(item, index) in list"
:key="index"
>
<el-card shadow="hover" body-style="padding: 0px;">
<div class="img-wrap">
<el-image :src="item.materialUrl" fit="contain"></el-image>
</div>
<div style="padding: 14px;">
<el-checkbox v-model="ids" :label="item.id">{{
item.materialName
}}</el-checkbox>
</div>
</el-card>
</el-col>
<el-checkbox-group v-model="selectedx" @change="handleSelectionChange">
<el-col
:span="6"
style="margin-bottom: 24px; min-width: 220px"
v-for="(item, index) in list"
:key="index"
>
<el-card shadow="hover" body-style="padding: 0px;">
<div class="img-wrap">
<el-image :src="item.materialUrl" fit="contain"></el-image>
</div>
<div style="padding: 14px">
<el-checkbox :label="item">{{
item.materialName
}}</el-checkbox>
</div>
</el-card>
</el-col>
</el-checkbox-group>
</el-row>
</el-col>
</el-row>
......
......@@ -33,6 +33,7 @@ export default {
window.CONFIG.services.wecom +
'/material/upload',
headers: window.CONFIG.headers,
domain: process.env.VUE_APP_BASE_API
}
},
watch: {},
......@@ -131,7 +132,7 @@ export default {
>
<slot>
<template v-if="fileUrl">
<img v-if="type === '0'" :src="fileUrl" class="upload-img" />
<img v-if="type === '0'" :src="domain + fileUrl" class="upload-img" />
<div v-else-if="type === '2'">
<video
id="myVideo"
......@@ -144,7 +145,7 @@ export default {
:autoplay="false"
preload="auto"
>
<source :src="fileUrl" type="video/mp4" />
<source :src="domain + fileUrl" type="video/mp4" />
</video>
</div>
<div v-else>{{ fileName }}</div>
......
......@@ -60,7 +60,7 @@ export default {
background: 'rgba(0, 0, 0, 0.7)',
})
this.metarialParams.materialIds = this.selectedMaterial.map((d) => d.id)
if (metarialParams.checkAll == 0) {
if (this.metarialParams.checkAll == 0) {
this.metarialParams.materialIds = []
}
getMaterial(this.metarialParams)
......@@ -80,6 +80,7 @@ export default {
update(data)
.then(() => {
this.msgSuccess('操作成功')
this.$set(data, 'isEdit', false)
this.loading = false
})
.catch(() => {
......@@ -110,11 +111,31 @@ export default {
{{ mediaType[scope.row.mediaType] }}
</template>
</el-table-column>
<el-table-column
label="聊天工具栏名称"
align="center"
prop="sideName"
/>
<el-table-column label="聊天工具栏名称" align="center" prop="sideName">
<template slot-scope="{ row }">
<el-input
class="bfc-d"
style="width: 100px;"
v-if="row.isEdit"
v-model="row.sideName"
placeholder="请输入"
></el-input>
<span v-else>
{{ row.sideName }}
</span>
<i
v-if="!row.isEdit"
class="row-icon el-icon-edit"
@click="$set(row, 'isEdit', true)"
></i>
<i
v-else
class="row-icon el-icon-circle-check"
@click="update(row)"
></i>
</template>
</el-table-column>
<el-table-column label="已抓取素材数量" align="center" prop="total" />
<el-table-column
label="是否启用"
......@@ -241,4 +262,22 @@ export default {
width: 100%;
}
}
.el-table__row {
.el-icon-edit {
visibility: hidden;
}
&:hover {
.el-icon-edit {
visibility: visible;
}
}
}
.row-icon {
font-size: 14px;
// vertical-align: middle;
margin-left: 5px;
}
.el-icon-circle-check {
margin-top: 10px;
}
</style>
......@@ -8,14 +8,13 @@
{{item.text.content}}
</div>
<div v-else-if="item.msgtype=='image'" class="msgtypeimg">
<img :src="item.image.attachment">
<img src="http://146.56.222.200/api/profile/upload/2021/01/14/544c8259-b3b6-4a49-8a53-b5eeac476384.png">
</div>
<div v-else-if="item.msgtype=='file'" class="msgtypefile" @click="down(item.file)">
{{item.file.filename}}
</div>
<!-- <div v-else-if="item.msgtype=='link'&&item.text" class="msgtypelink">
{{item.text.content}}
</div>-->
<div v-else-if="item.msgtype=='voice'" class="msgtypevoice">
<i class="el-icon-video-play" @click="play(item,'voice')"></i>
</div>
......@@ -124,8 +123,10 @@
width: 100px;
height: 80px;
margin: 10px;
img{width: 100px;
height: 80px;}
}
.msgtypecard {
width: 300px;
height: 140px;
......
<template>
<div class="list" v-loading="loading">
<div v-if="personList.length>=1">
<ul>
<li v-for="(item,index) in personList" :key="index" @click="liClick(item)">
<el-row style="padding:10px">
<el-col :span="3"><img :src="item.receiveWeUser.avatarMediaid" ></el-col>
<el-col :span="21">
<p>{{item.receiveWeUser.name}} <span class="fr gray">{{parseTime(item.finalChatContext.msgtime)}}</span></p>
<p class="gray padt10" v-if="item.finalChatContext.text">{{item.finalChatContext.text.content}}</p>
</el-col>
</el-row>
</li>
</ul>
</div>
<div v-else></div>
</div>
</template>
<script>
import {parseTime} from '@/utils/common.js'
export default {
props: {
personList: {
type: Array,
defluat: () => []
},
loading: {
type: Boolean,
defluat: false
},
},
data() {
return{
loadings:true
}
},
methods:{
liClick(e){
this.$emit('chatFn',e)
}
}
}
</script>
<style lang="scss" scoped>
*{ padding: 0;
margin: 0;}
.list {
overflow-y:scroll;
height: 651px;
::-webkit-scrollbar {
display: none;
}
/deep/ .el-loading-spinner{margin-top: 20px;}
.fr{float:right;}
.gray{color: #999;}
.padt10{padding-top: 10px;}
ul li {
padding: 10px;
overflow: hidden;
border-bottom: 1px solid #efefef;
cursor: pointer;
p{white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;}
:hover{ background: #efefef;}
img {
width: 40px;
height: 40px;
float: left
}
}
}
</style>
\ No newline at end of file
<template>
<div class="list" v-loading="loading">
<div v-if="personList.length>=1">
<ul>
<li v-for="(item,index) in personList" :key="index" @click="liClick(item)">
<el-row style="padding:10px" v-if="item.finalChatContext.msgtype=='text'">
<el-col :span="3"> <img v-if="item.finalChatContext.fromInfo" :src="item.finalChatContext.fromInfo.avatar"></el-col>
<el-col :span="21">
<p>{{item.finalChatContext.roomInfo.name}} <span class="fr gray">{{parseTime(item.finalChatContext.fromInfo.updateTime)}}</span></p>
<p class="gray padt10" v-if="item.finalChatContext.fromInfo">{{item.finalChatContext.fromInfo.name}}:{{item.finalChatContext.text.content}}</p>
</el-col>
</el-row>
<el-row style="padding:10px" v-if="item.finalChatContext.msgtype=='file'">
<el-col :span="3">&nbsp; `</el-col>
<el-col :span="21">
<p><span class="fr gray">{{parseTime(item.finalChatContext.msgtime)}}</span></p>
<p class="gray padt10" >{{item.finalChatContext.from}}:
<span v-if="item.finalChatContext.file.fileext=='mp4'">[视频]</span>
</p>
</el-col>
</el-row>
</li>
</ul>
</div>
<div v-else></div>
</div>
</template>
<script>
import {parseTime} from '@/utils/common.js'
export default {
props: {
personList: {
type: Array,
defluat: () => []
},
loading: {
type: Boolean,
defluat: false
},
},
data() {
return{
loadings:true
}
},
methods:{
liClick(e){
this.$emit('groupFn',e)
}
}
}
</script>
<style lang="scss" scoped>
*{ padding: 0;
margin: 0;}
.list {
overflow-y:scroll;
height: 708px;
::-webkit-scrollbar {
display: none;
}
/deep/ .el-loading-spinner{margin-top: 20px;}
.fr{float:right;}
.gray{color: #999;}
.padt10{padding-top: 10px;}
ul li {
padding: 10px;
overflow: hidden;
border-bottom: 1px solid #efefef;
cursor: pointer;
p{white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;}
:hover{ background: #efefef;}
img {
width: 40px;
height: 40px;
float: left
}
}
}
</style>
\ No newline at end of file
......@@ -4,10 +4,10 @@
<ul>
<li v-for="(item,index) in personList" :key="index" @click="liClick(item)">
<el-row style="padding:10px">
<el-col :span="4"> <img :src="item.receiveWeCustomer.avatar"></el-col>
<el-col :span="20">
<el-col :span="3"> <img :src="item.receiveWeCustomer.avatar"></el-col>
<el-col :span="21">
<p>{{item.receiveWeCustomer.name}} <span class="fr gray">{{parseTime(item.finalChatContext.msgtime)}}</span></p>
<p class="gray padt10" v-if="item.finalChatContext.text">{{item.finalChatContext.text.content}}</p>
<p class="gray padt10" v-if="item.finalChatContext.text">{{item.finalChatContext.text.content}}</p>
</el-col>
</el-row>
</li>
......
<template>
<div class="employ">
<el-row>
<el-col :span="6" class="borderR">
<div class="hd_box">
<div class="hd_name">成员({{employAmount}})</div>
<div class="paddingT10">
<el-input placeholder="请输入内容" prefix-icon="el-icon-search" v-model="employName">
</el-input>
</div>
</div>
<div class="ct_box ct_boxFirst">
<el-tree class="filter-tree" :data="treeData" :props="defaultProps" :filter-node-method="filterNode"
ref="tree" @node-click="handleNodeClick" :default-expand-all="true">
</el-tree>
<div class="employ">
<el-row>
<el-col :span="6" class="borderR">
<div class="hd_box">
<div class="hd_name">成员({{employAmount}})</div>
<div class="paddingT10">
<el-input placeholder="请输入内容" prefix-icon="el-icon-search" v-model="employName">
</el-input>
</div>
</div>
<div class="ct_box ct_boxFirst">
<el-tree class="filter-tree" :data="treeData" :props="defaultProps" :filter-node-method="filterNode"
ref="tree" @node-click="handleNodeClick" :default-expand-all="true">
</el-tree>
</div>
</el-col>
<el-col :span="6" class="borderR">
<div class="hd_box">
<div class="hd_name">{{talkName}}</div>
</div>
<div class="hd_tabs">
<el-tabs v-model="activeName" @tab-click="tabClick(true)">
<el-tab-pane label="内部联系人" name="0">
<div class="ct_box">
<list v-if="activeName==0" :personList="personList" :loading="loading" @chatFn='chatFn'>
</list>
</div>
</el-tab-pane>
<el-tab-pane label="外部联系人" name="1">
<list v-if="activeName==1" :personList="personList" :loading="loading" @chatFn='chatFn'>
</list>
</el-tab-pane>
<el-tab-pane label="群聊" name="2">
<grouplist v-if="activeName==2" :personList="personList" :loading="loading" @groupFn='groupFn'>
</grouplist>
</el-tab-pane>
</el-tabs>
</div>
</el-col>
<el-col :span="12">
<div class="hd_box">
<div class="hd_name"><span v-if="chat.receiveWeCustomer"> 与{{chat.receiveWeCustomer.name}}的聊天</span>
<span class="fr hd_nameRi">下载会话</span></div>
</div>
<div class=" hd_tabthree">
<el-tabs v-model="activeNameThree" @tab-click="activeNameThreeClick()">
<el-tab-pane label="全部" name="0">
<div class="ct_box">
<div class="hds_time">
<el-date-picker v-model="takeTime" type="datetimerange" format='yyyy-MM-dd' range-separator="至"
start-placeholder="开始日期" end-placeholder="结束日期" align="right" @change="activeNameThreeClick">
</el-date-picker>
</div>
</el-col>
<el-col :span="6" class="borderR">
<div class="hd_box">
<div class="hd_name">{{talkName}}</div>
<chat :allChat="allChat" v-if="allChat.length>=1"></chat>
<el-pagination background v-if="allChat.length>=1" layout="prev, pager, next" class="pagination"
:current-page="currentPage" @current-change="currentChange" :total="total">
</el-pagination>
</div>
</el-tab-pane>
<el-tab-pane label="图片及视频" name="1">
<div class="ct_box">
<div class="hds_time">
<el-date-picker v-model="takeTime" type="datetimerange" format='yyyy-MM-dd' range-separator="至"
start-placeholder="开始日期" end-placeholder="结束日期" align="right" @change="activeNameThreeClick">
</el-date-picker>
</div>
<div class="hd_tabs">
<el-tabs v-model="activeName" @tab-click="tabClick(true)">
<el-tab-pane label="内部联系人" name="0">
<div class="ct_box">
<list v-if="activeName==0" :personList="personList" :loading="loading" @chatFn='chatFn'>
</list>
</div>
</el-tab-pane>
<el-tab-pane label="外部联系人" name="1">
<list v-if="activeName==1" :personList="personList" :loading="loading" @chatFn='chatFn'>
</list>
</el-tab-pane>
<el-tab-pane label="群聊" name="2">
</el-tab-pane>
</el-tabs>
<chat :allChat="allChatImg" v-if="allChatImg.length>=1"></chat>
<el-pagination background v-if="allChatImg.length>=1" class="pagination" layout="prev, pager, next"
:total="total" @current-change="currentChange" :current-page="currentPage">
</el-pagination>
</div>
</el-tab-pane>
<el-tab-pane label="文件" name="2">
<div class="ct_box">
<div class="hds_time">
<el-date-picker v-model="takeTime" type="datetimerange" format='yyyy-MM-dd' range-separator="至"
start-placeholder="开始日期" end-placeholder="结束日期" align="right" @change="activeNameThreeClick">
</el-date-picker>
</div>
</el-col>
<el-col :span="12">
<div class="hd_box">
<div class="hd_name"><span v-if="chat.receiveWeCustomer"> 与{{chat.receiveWeCustomer.name}}的聊天</span>
<span class="fr hd_nameRi">下载会话</span></div>
<el-table :data="allFile" stripe style="width: 100%" :header-cell-style="{background:'#fff'}">
<el-table-column prop="msgtype" label="类型">
</el-table-column>
<el-table-column label="名称">
<template slot-scope="scope">
{{scope.row.file.filename}}
</template>
</el-table-column>
<el-table-column label="大小">
<template slot-scope="scope">
{{filterSize(scope.row.file.filesize)}}
</template>
</el-table-column>
<el-table-column prop="action" label="来源">
<template slot-scope="scope">
{{scope.row.tolist[0]}}
</template>
</el-table-column>
<el-table-column prop="action" label="操作">
<template slot-scope="scope">
<el-button type="text" size="small">下载</el-button>
<el-button type="text" size="small">查看</el-button>
</template>
</el-table-column>
</el-table>
</div>
</el-tab-pane>
<el-tab-pane label="链接" name="3">
<div class="ct_box">
<div class="hds_time">
<el-date-picker v-model="takeTime" type="datetimerange" format='yyyy-MM-dd' range-separator="至"
start-placeholder="开始日期" end-placeholder="结束日期" align="right" @change="activeNameThreeClick">
</el-date-picker>
</div>
<div class=" hd_tabthree">
<el-tabs v-model="activeNameThree" @tab-click="activeNameThreeClick()">
<el-tab-pane label="全部" name="0">
<div class="ct_box">
<div class="hds_time">
<el-date-picker v-model="takeTime" type="datetimerange" format='yyyy-MM-dd'
range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"
align="right" @change="activeNameThreeClick">
</el-date-picker>
</div>
<chat :allChat="allChat" v-if="allChat.length>=1"></chat>
<el-pagination background v-if="allChat.length>=1" layout="prev, pager, next"
class="pagination" :current-page="currentPage" @current-change="currentChange"
:total="total">
</el-pagination>
</div>
</el-tab-pane>
<el-tab-pane label="图片及视频" name="1">
<div class="ct_box">
<div class="hds_time">
<el-date-picker v-model="takeTime" type="datetimerange" format='yyyy-MM-dd'
range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"
align="right" @change="activeNameThreeClick">
</el-date-picker>
</div>
<chat :allChat="allChatImg" v-if="allChatImg.length>=1"></chat>
<el-pagination background v-if="allChatImg.length>=1" class="pagination"
layout="prev, pager, next" :total="total" @current-change="currentChange"
:current-page="currentPage">
</el-pagination>
</div>
</el-tab-pane>
<el-tab-pane label="文件" name="2">
<div class="ct_box">
<div class="hds_time">
<el-date-picker v-model="takeTime" type="datetimerange" format='yyyy-MM-dd'
range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"
align="right" @change="activeNameThreeClick">
</el-date-picker>
</div>
<el-table :data="allFile" stripe style="width: 100%"
:header-cell-style="{background:'#fff'}">
<el-table-column prop="msgtype" label="类型">
</el-table-column>
<el-table-column label="名称">
<template slot-scope="scope">
{{scope.row.file.filename}}
</template>
</el-table-column>
<el-table-column label="大小">
<template slot-scope="scope">
{{filterSize(scope.row.file.filesize)}}
</template>
</el-table-column>
<el-table-column prop="action" label="来源">
<template slot-scope="scope">
{{scope.row.tolist[0]}}
</template>
</el-table-column>
<el-table-column prop="action" label="操作">
<template slot-scope="scope">
<el-button type="text" size="small">下载</el-button>
<el-button type="text" size="small">查看</el-button>
</template>
</el-table-column>
</el-table>
</div>
</el-tab-pane>
<el-tab-pane label="链接" name="3">
<div class="ct_box">
<div class="hds_time">
<el-date-picker v-model="takeTime" type="datetimerange" format='yyyy-MM-dd'
range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"
align="right" @change="activeNameThreeClick">
</el-date-picker>
</div>
</div>
</el-tab-pane>
<el-tab-pane label="语音通话" name="4">
<div class="ct_box">
<div class="hds_time">
<el-date-picker v-model="takeTime" type="datetimerange" format='yyyy-MM-dd'
range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"
align="right" @change="activeNameThreeClick">
</el-date-picker>
</div>
<el-table :data="fileData" stripe style="width: 100%"
:header-cell-style="{background:'#fff'}">
<el-table-column prop="date" label="发起人">
</el-table-column>
<el-table-column prop="name" label="通话时间">
</el-table-column>
<el-table-column prop="address" label="时长">
</el-table-column>
<el-table-column prop="address" label="操作">
</el-table-column>
</el-table>
</div>
</el-tab-pane>
</el-tabs>
</div>
</el-tab-pane>
<el-tab-pane label="语音通话" name="4">
<div class="ct_box">
<div class="hds_time">
<el-date-picker v-model="takeTime" type="datetimerange" format='yyyy-MM-dd' range-separator="至"
start-placeholder="开始日期" end-placeholder="结束日期" align="right" @change="activeNameThreeClick">
</el-date-picker>
</div>
</el-col>
</el-row>
</div>
<el-table :data="fileData" stripe style="width: 100%" :header-cell-style="{background:'#fff'}">
<el-table-column prop="date" label="发起人">
</el-table-column>
<el-table-column prop="name" label="通话时间">
</el-table-column>
<el-table-column prop="address" label="时长">
</el-table-column>
<el-table-column prop="address" label="操作">
</el-table-column>
</el-table>
</div>
</el-tab-pane>
</el-tabs>
</div>
</el-col>
</el-row>
</div>
</template>
<script>
import list from '../component/list.vue'
import chat from '../component/chat.vue'
import * as api from '@/api/organization'
import {
content
} from '@/api/content.js'
import {
yearMouthDay
} from '@/utils/common.js'
export default {
components: {
list,
chat
import list from '../component/list.vue'
import chat from '../component/chat.vue'
import grouplist from '../component/groupList.vue'
import * as api from '@/api/organization'
import {
content
} from '@/api/content.js'
import {
yearMouthDay
} from '@/utils/common.js'
export default {
components: {
list,
grouplist,
chat
},
data() {
return {
employAmount: 1,
employId: '',
employName: '',
talkName: '',
treeData: [],
defaultProps: {
label: 'name',
children: 'children',
},
data() {
return {
employAmount: 1,
employId: '',
employName: '',
talkName: '',
treeData: [],
defaultProps: {
label: 'name',
children: 'children',
},
activeName: "1",
activeNameThree: '0',
takeTime: '',
fileData: [],
chat: {},
activeName: "1",
activeNameThree: '0',
takeTime: '',
fileData: [],
chat: {},
personList: [],
loading: false,
allChat: [], //全部聊天记录
allChatImg: [], //图片,
allVoice: [],
allFile: [],
allLInk: [],
//分页
total: '',
currentPage: ''
};
},
watch: {
employName(val) {
this.$refs.tree.filter(val);
}
},
mounted() {
this.getTree()
},
methods: {
filterSize(size) {
if (!size) return '';
if (size < this.pow1024(1)) return size + ' B';
if (size < this.pow1024(2)) return (size / this.pow1024(1)).toFixed(2) + ' KB';
if (size < this.pow1024(3)) return (size / this.pow1024(2)).toFixed(2) + ' MB';
if (size < this.pow1024(4)) return (size / this.pow1024(3)).toFixed(2) + ' GB';
return (size / pow1024(4)).toFixed(2) + ' TB'
},
pow1024(num) {
return Math.pow(1024, num)
},
currentChange(e) {
this.currentPage = e
this.activeNameThreeClick(true)
},
activeNameThreeClick(page) {
if (!!!page) {
this.currentPage = 1
}
if (this.chat && this.chat.receiveWeCustomer) {
let msgType = ''
if (this.activeNameThree == 0) {
msgType = ''
} else if (this.activeNameThree == 1) {
msgType = 'image'
} else if (this.activeNameThree == 2) {
msgType = 'file'
} else if (this.activeNameThree == 3) {
msgType = 'link'
} else if (this.activeNameThree == 4) {
msgType = 'voice'
}
personList: [],
loading: false,
allChat: [], //全部聊天记录
allChatImg: [], //图片,
allVoice: [],
allFile: [],
allLInk: [],
//分页
total: '',
currentPage: ''
};
},
watch: {
employName(val) {
this.$refs.tree.filter(val);
}
},
mounted() {
this.getTree()
},
methods: {
filterSize(size) {
if (!size) return '';
if (size < this.pow1024(1)) return size + ' B';
if (size < this.pow1024(2)) return (size / this.pow1024(1)).toFixed(2) + ' KB';
if (size < this.pow1024(3)) return (size / this.pow1024(2)).toFixed(2) + ' MB';
if (size < this.pow1024(4)) return (size / this.pow1024(3)).toFixed(2) + ' GB';
return (size / pow1024(4)).toFixed(2) + ' TB'
},
pow1024(num) {
return Math.pow(1024, num)
},
currentChange(e) {
this.currentPage = e
if (this.activeName == '2') {
return this.activeNameThreeClick(true, true)
}
this.activeNameThreeClick(true)
},
activeNameThreeClick(page, group) {
if (!!!page) {
this.currentPage = 1
}
if (this.chat && this.chat.receiveWeCustomer) {
let msgType = ''
if (this.activeNameThree == 0) {
msgType = ''
} else if (this.activeNameThree == 1) {
msgType = 'image'
} else if (this.activeNameThree == 2) {
msgType = 'file'
} else if (this.activeNameThree == 3) {
msgType = 'link'
} else if (this.activeNameThree == 4) {
msgType = 'voice'
}
let query = {
fromId: this.employId,
msgType,
pageSize: '10',
pageNum: this.currentPage,
beginTime: this.takeTime ? yearMouthDay(this.takeTime[0]) : "",
endTime: this.takeTime ? yearMouthDay(this.takeTime[1]) : '',
}
if (group) {
query.roomId = this.chat.roomId
} else {
query.receiveId = this.chat.receiveId
}
let query = {
fromId: this.employId,
receiveId: this.chat.receiveId,
msgType,
pageSize: '10',
pageNum: this.currentPage,
beginTime: this.takeTime ? yearMouthDay(this.takeTime[0]) : "",
endTime: this.takeTime ? yearMouthDay(this.takeTime[1]) : '',
}
content.chatList(query).then(res => {
this.total = Number(res.total)
if (this.activeNameThree == 0) {
return this.allChat = res.rows
}
if (this.activeNameThree == 1) {
return this.allChatImg = res.rows
}
if (this.activeNameThree == 2) {
return this.allFile = res.rows
}
if (this.activeNameThree == 3) {
return this.allLInk = res.rows
}
if (this.activeNameThree == 4) {
return this.allVoice = res.rows
}
})
}
},
chatFn(data) {
this.chat = data;
if (data.receiveWeCustomer) {
this.activeNameThreeClick()
}
},
getTree() {
api.getTree().then(({
data
}) => {
this.treeData = this.handleTree(data)
this.handleNodeClick(this.treeData[0], true)
})
},
tabClick(flag) {
this.personList = []
if (!this.employId) {
return
}
if (flag) {
this.loading = true
}
content.getTree({
fromId: this.employId,
searchType: this.activeName
}).then(({
rows
}) => {
this.loading = false
this.personList = rows
}).catch(err => {
this.loading = false
})
},
filterNode(value, data) {
console.log(value, data)
if (!value) return true;
return data.name.indexOf(value) !== -1;
},
handleNodeClick(data, add) {
if (!data.gender) {
let querys = {
pageNum: '1',
pageSize: '999',
isActivate: '4',
department: data.id
}
api.getList(querys).then(({
rows
}) => {
if (add == true) {
console.log(this.treeData, data, rows)
this.treeData[0].children = data.children.concat(rows)
return
} else {
const newChild = rows;
this.$set(data, 'children', []);
data.children = rows
}
})
} else {
this.talkName = data.name;
this.employId = data.userId;
this.tabClick()
}
if (group) {
content.chatGrounpList(query).then(res => {
this.total = Number(res.total)
this.resortData(res)
})
} else {
content.chatList(query).then(res => {
this.total = Number(res.total)
this.resortData(res)
})
}
}
},
resortData(res){
if (this.activeNameThree == 0) {
return this.allChat = res.rows
}
if (this.activeNameThree == 1) {
return this.allChatImg = res.rows
}
if (this.activeNameThree == 2) {
return this.allFile = res.rows
}
if (this.activeNameThree == 3) {
return this.allLInk = res.rows
}
if (this.activeNameThree == 4) {
return this.allVoice = res.rows
}
},
chatFn(data) {
this.chat = data;
if (data.receiveWeCustomer) {
this.activeNameThreeClick()
}
},
groupFn(data) {
this.chat = data;
this.chat.receiveWeCustomer = 'a'
this.activeNameThreeClick('', true)
},
getTree() {
api.getTree().then(({
data
}) => {
this.treeData = this.handleTree(data)
this.handleNodeClick(this.treeData[0], true)
})
},
tabClick(flag) {
this.personList = []
if (!this.employId) {
return
}
if (flag) {
this.loading = true
}
content.getTree({
fromId: this.employId,
searchType: this.activeName
}).then(({
rows
}) => {
this.loading = false
this.personList = rows
}).catch(err => {
this.loading = false
})
},
filterNode(value, data) {
console.log(value, data)
if (!value) return true;
return data.name.indexOf(value) !== -1;
},
handleNodeClick(data, add) {
if (!data.gender) {
let querys = {
pageNum: '1',
pageSize: '999',
isActivate: '4',
department: data.id
}
api.getList(querys).then(({
rows
}) => {
if (add == true) {
console.log(this.treeData, data, rows)
this.treeData[0].children = data.children.concat(rows)
return
} else {
const newChild = rows;
this.$set(data, 'children', []);
data.children = rows
}
})
} else {
this.talkName = data.name;
this.employId = data.userId;
this.tabClick()
}
}
}
}
</script>
<style lang="scss" scoped>
* {
margin: 0;
padding: 0;
}
* {
margin: 0;
padding: 0;
}
/deep/.el-tabs__nav-scroll {
padding-left: 15px;
}
/deep/.el-tabs__nav-scroll {
padding-left: 15px;
}
.fr {
float: right;
}
.fr {
float: right;
}
.borderR {
border-right: 2px solid #ccc;
}
.borderR {
border-right: 2px solid #ccc;
}
.paddingT10 {
padding-top: 10px
}
.paddingT10 {
padding-top: 10px
}
.employ {
background: #f6f6f9;
min-height: 800px;
.employ {
background: #f6f6f9;
min-height: 800px;
.hd_tabs {
background: #fff;
.hd_tabs {
background: #fff;
/deep/ .el-tabs__header {
margin: 0;
}
}
/deep/ .el-tabs__header {
margin: 0;
}
}
.hd_tabthree {
/deep/ .el-tabs__header {
margin: 0;
}
}
.hd_tabthree {
/deep/ .el-tabs__header {
margin: 0;
}
}
.hd_box {
padding: 15px;
}
.hd_box {
padding: 15px;
}
.hd_name {
font-size: 18px;
min-height: 20px;
}
.hd_name {
font-size: 18px;
min-height: 20px;
}
.hd_nameRi {
color: #199ed8;
text-align: right;
font-size: 16px;
cursor: pointer;
}
.hd_nameRi {
color: #199ed8;
text-align: right;
font-size: 16px;
cursor: pointer;
}
.ct_boxFirst {
height: 707px !important;
}
.ct_boxFirst {
height: 707px !important;
}
.ct_box {
background: white;
height: 710px;
padding: 10px;
overflow-y: scroll;
border-bottom: 1px solid #efefef;
color: #999;
text-align: center;
::-webkit-scrollbar {
display: none;
}
.ct_box {
background: white;
height: 710px;
padding: 10px;
overflow-y: scroll;
border-bottom: 1px solid #efefef;
color: #999;
text-align: center;
.hds_time {
text-align: left;
width: 100%;
padding: 10px 0;
}
::-webkit-scrollbar {
display: none;
}
}
}
.pagination {
.hds_time {
text-align: left;
width: 100%;
padding: 10px 0;
height: 30px;
}
float: left;
}
</style>
\ No newline at end of file
}
.pagination {
padding: 10px 0;
height: 30px;
float: left;
}
</style>
<template>
<div class="employ">
<el-row>
<el-col :span="6" class="borderR">
<div class="hd_box">
<div class="hd_name">客户列表({{employAmount}})</div>
<div class="paddingT10">
<el-input placeholder="搜索客户" prefix-icon="el-icon-search" v-model="employName">
</el-input>
</div>
<div class="employ">
<el-row>
<el-col :span="6" class="borderR">
<div class="hd_box">
<div class="hd_name">客户列表({{employAmount}})</div>
<div class="paddingT10">
<el-input placeholder="搜索客户" prefix-icon="el-icon-search" v-model="employName">
</el-input>
</div>
</div>
<div class="ct_box ct_boxFirst">
<ul>
<li v-for="(i,t) in CList" :key="t" @click="personCheck(i,t)" :class="{'liActive':t==personIndex}">
<el-row :gutter="20" style=" padding: 10px 0;margin:0">
<el-col :span="4">
<img v-if="i.avatar" :src="i.avatar" alt="头像">
</el-col>
<el-col :span="16" v-if="i"><span style="line-height:40px">{{i.name}}</span></el-col>
</el-row>
</li>
</ul>
</div>
</el-col>
<el-col :span="6" class="borderR">
<div class="hd_box">
<div class="hd_name">{{talkName}}</div>
<div class="paddingT10">
<el-input placeholder="搜索聊天记录" prefix-icon="el-icon-search" v-model="employName">
</el-input>
</div>
</div>
<div class="hd_tabs">
<el-tabs v-model="activeName" @tab-click="getChatList()">
<el-tab-pane label="单聊" name="0">
<div class="hd_tabs_content">
<list v-if="activeName==0" :personList="personList" :loading="loading" @chatFn="chatFn">
</list>
</div>
</el-tab-pane>
<el-tab-pane label="群聊" name="2">
<grouplist v-if="activeName==2" :personList="personList" :loading="loading" @groupFn='groupFn'>
</grouplist>
</el-tab-pane>
</el-tabs>
</div>
</el-col>
<el-col :span="12">
<div class="hd_box">
<div class="hd_name">
<!-- <span
v-if="chatData&&chatData.finalChatContext">与{{chatData.finalChatContext.fromInfo.name}} 的聊天</span> -->
<span class="fr hd_nameRi">下载会话</span></div>
</div>
<div class=" hd_tabthree">
<el-tabs v-model="activeNameThree" @tab-click="activeNameThreeClick()">
<el-tab-pane label="全部" name="0">
<div class="ct_box">
<div class="hds_time">
<el-date-picker v-model="takeTime" type="datetimerange" format='yyyy-MM-dd' range-separator="至"
start-placeholder="开始日期" end-placeholder="结束日期" align="right" @change="activeNameThreeClick">
</el-date-picker>
</div>~
<chats :allChat="allChat" v-if="allChat.length>=1"></chats>
<el-pagination background v-if="allChat.length>=1" layout="prev, pager, next" class="pagination"
:current-page="currentPage" @current-change="currentChange" :total="total">
</el-pagination>
</div>
</el-tab-pane>
<el-tab-pane label="图片及视频" name="1">
<div class="ct_box">
<div class="hds_time">
<el-date-picker v-model="takeTime" type="datetimerange" format='yyyy-MM-dd' range-separator="至"
start-placeholder="开始日期" end-placeholder="结束日期" align="right" @change="activeNameThreeClick">
</el-date-picker>
</div>
<div class="ct_box ct_boxFirst">
<ul>
<!-- -->
<li v-for="(i,t) in CList" :key="t" @click="personCheck(i,t)" :class="{'liActive':t==personIndex}">
<el-row :gutter="20" style=" padding: 10px 0;margin:0">
<el-col :span="4">
<img
v-if="i.avatar"
:src="i.avatar"
alt="头像">
</el-col>
<el-col :span="16" v-if="i"><span style="line-height:40px">{{i.name}}</span></el-col>
</el-row>
</li>
</ul>
<!-- <chat :allChat="allChatImg" v-if="allChatImg.length>=1"></chat> -->
<el-pagination background v-if="allChatImg.length>=1" class="pagination" layout="prev, pager, next"
:total="total" @current-change="currentChange" :current-page="currentPage">
</el-pagination>
</div>
</el-tab-pane>
<el-tab-pane label="文件" name="2">
<div class="ct_box">
<div class="hds_time">
<el-date-picker v-model="takeTime" type="datetimerange" format='yyyy-MM-dd' range-separator="至"
start-placeholder="开始日期" end-placeholder="结束日期" align="right" @change="activeNameThreeClick">
</el-date-picker>
</div>
</el-col>
<el-col :span="6" class="borderR">
<div class="hd_box">
<div class="hd_name">{{talkName}}</div>
<div class="paddingT10">
<el-input placeholder="搜索聊天记录" prefix-icon="el-icon-search" v-model="employName">
</el-input>
</div>
<el-table :data="allFile" stripe style="width: 100%" :header-cell-style="{background:'#fff'}">
<el-table-column prop="msgtype" label="类型">
</el-table-column>
<el-table-column label="名称">
<template slot-scope="scope">
{{scope.row.file.filename}}
</template>
</el-table-column>
<el-table-column label="大小">
<template slot-scope="scope">
{{filterSize(scope.row.file.filesize)}}
</template>
</el-table-column>
<el-table-column prop="action" label="来源">
<template slot-scope="scope">
{{scope.row.tolist[0]}}
</template>
</el-table-column>
<el-table-column prop="action" label="操作">
<template slot-scope="scope">
<el-button type="text" size="small">下载</el-button>
<el-button type="text" size="small">查看</el-button>
</template>
</el-table-column>
</el-table>
</div>
</el-tab-pane>
<el-tab-pane label="链接" name="3">
<div class="ct_box">
<div class="hds_time">
<el-date-picker v-model="takeTime" type="datetimerange" format='yyyy-MM-dd' range-separator="至"
start-placeholder="开始日期" end-placeholder="结束日期" align="right" @change="activeNameThreeClick">
</el-date-picker>
</div>
<div class="hd_tabs">
<el-tabs v-model="activeName">
<el-tab-pane label="单聊" name="0">
<div class="hd_tabs_content">
<!-- <list v-if="activeName==0" :personList="personList" :loading="loading" >
</list> -->
</div>
</el-tab-pane>
<el-tab-pane label="群聊" name="2">
<list v-if="activeName==2" :personList="personList" :loading="loading" @chatFn="chatFn">
</list>
</el-tab-pane>
</el-tabs>
</div>
</el-tab-pane>
<el-tab-pane label="语音通话" name="4">
<div class="ct_box">
<div class="hds_time">
<el-date-picker v-model="takeTime" type="datetimerange" format='yyyy-MM-dd' range-separator="至"
start-placeholder="开始日期" end-placeholder="结束日期" align="right" @change="activeNameThreeClick">
</el-date-picker>
</div>
</el-col>
<el-col :span="12">
<div class="hd_box">
<div class="hd_name"><span v-if="chatData&&chatData.finalChatContext">与{{chatData.finalChatContext.roomInfo.name}} 的聊天</span>
<span class="fr hd_nameRi">下载会话</span></div>
</div>
<div class=" hd_tabthree">
<el-tabs v-model="activeNameThree" @tab-click="activeNameThreeClick()">
<el-tab-pane label="全部" name="0">
<div class="ct_box">
<div class="hds_time">
<el-date-picker v-model="takeTime" type="datetimerange" format='yyyy-MM-dd'
range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"
align="right" @change="activeNameThreeClick">
</el-date-picker>
</div>
<chat :allChat="allChat" v-if="allChat.length>=1"></chat>
<el-pagination background v-if="allChat.length>=1" layout="prev, pager, next"
class="pagination" :current-page="currentPage" @current-change="currentChange"
:total="total">
</el-pagination>
</div>
</el-tab-pane>
<el-tab-pane label="图片及视频" name="1">
<div class="ct_box">
<div class="hds_time">
<el-date-picker v-model="takeTime" type="datetimerange" format='yyyy-MM-dd'
range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"
align="right" @change="activeNameThreeClick">
</el-date-picker>
</div>
<chat :allChat="allChatImg" v-if="allChatImg.length>=1"></chat>
<el-pagination background v-if="allChatImg.length>=1" class="pagination"
layout="prev, pager, next" :total="total" @current-change="currentChange"
:current-page="currentPage">
</el-pagination>
</div>
</el-tab-pane>
<el-tab-pane label="文件" name="2">
<div class="ct_box">
<div class="hds_time">
<el-date-picker v-model="takeTime" type="datetimerange" format='yyyy-MM-dd'
range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"
align="right" @change="activeNameThreeClick">
</el-date-picker>
</div>
<el-table :data="allFile" stripe style="width: 100%"
:header-cell-style="{background:'#fff'}">
<el-table-column prop="msgtype" label="类型">
</el-table-column>
<el-table-column label="名称">
<template slot-scope="scope">
{{scope.row.file.filename}}
</template>
</el-table-column>
<el-table-column label="大小">
<template slot-scope="scope">
{{filterSize(scope.row.file.filesize)}}
</template>
</el-table-column>
<el-table-column prop="action" label="来源">
<template slot-scope="scope">
{{scope.row.tolist[0]}}
</template>
</el-table-column>
<el-table-column prop="action" label="操作">
<template slot-scope="scope">
<el-button type="text" size="small">下载</el-button>
<el-button type="text" size="small">查看</el-button>
</template>
</el-table-column>
</el-table>
</div>
</el-tab-pane>
<el-tab-pane label="链接" name="3">
<div class="ct_box">
<div class="hds_time">
<el-date-picker v-model="takeTime" type="datetimerange" format='yyyy-MM-dd'
range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"
align="right" @change="activeNameThreeClick">
</el-date-picker>
</div>
</div>
</el-tab-pane>
<el-tab-pane label="语音通话" name="4">
<div class="ct_box">
<div class="hds_time">
<el-date-picker v-model="takeTime" type="datetimerange" format='yyyy-MM-dd'
range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"
align="right" @change="activeNameThreeClick">
</el-date-picker>
</div>
<el-table :data="fileData" stripe style="width: 100%"
:header-cell-style="{background:'#fff'}">
<el-table-column prop="date" label="发起人">
</el-table-column>
<el-table-column prop="name" label="通话时间">
</el-table-column>
<el-table-column prop="address" label="时长">
</el-table-column>
<el-table-column prop="address" label="操作">
</el-table-column>
</el-table>
</div>
</el-tab-pane>
</el-tabs>
</div>
</el-col>
</el-row>
<el-table :data="fileData" stripe style="width: 100%" :header-cell-style="{background:'#fff'}">
<el-table-column prop="date" label="发起人">
</el-table-column>
<el-table-column prop="name" label="通话时间">
</el-table-column>
<el-table-column prop="address" label="时长">
</el-table-column>
<el-table-column prop="address" label="操作">
</el-table-column>
</el-table>
</div>
</el-tab-pane>
</el-tabs>
</div>
</el-col>
</el-row>
</div>
</div>
</template>
<script>
import list from '../component/curList.vue'
import chat from '../component/chat.vue'
import {
content
} from '@/api/content.js'
import {
yearMouthDay
} from '@/utils/common.js'
export default {
components:{
list,chat
},
data() {
return {
employAmount: 1,
employName: '',
talkName: '',
personIndex: '-1',
activeName: "2",
activeNameThree: '0',
takeTime: '',
fileData: [],
CList:[],
personList:[],
loading:false,
employId:'',
chatData:{},
allChat:[],
allChatImg:[],
allFile:[],
allLInk:[],
allVoice:[],
//分页
currentPage:1,
total:0
};
},
methods: {
chatFn(data){
this.chatData=data
if (data.fromId) {
this.activeNameThreeClick()
}
},
currentChange(){
this.currentPage = e
this.activeNameThreeClick(true)
},
personCheck(data, e) {
this.personIndex = e
this.talkName = data.name;
this.employId=data.externalUserid
this.getChatList()
},
getChatList(flag){
if (!this.employId) {
return
}
if (flag) {
this.loading = true
}
content.getTree({
fromId: this.employId,
searchType: this.activeName
}).then(({
rows
}) => {
console.log(rows)
this.loading = false
this.personList = rows
}).catch(err => {
this.loading = false
})
},
activeNameThreeClick(page){
if (!!!page) {
this.currentPage = 1
}
let msgType = ''
if (this.activeNameThree == 0) {
msgType = ''
} else if (this.activeNameThree == 1) {
msgType = 'image'
} else if (this.activeNameThree == 2) {
msgType = 'file'
} else if (this.activeNameThree == 3) {
msgType = 'link'
} else if (this.activeNameThree == 4) {
msgType = 'voice'
}
let query = {
fromId: this.chatData.fromId,
receiveId: this.chatData.roomId,
msgType,
pageSize: '10',
pageNum: this.currentPage,
beginTime: this.takeTime ? yearMouthDay(this.takeTime[0]) : "",
endTime: this.takeTime ? yearMouthDay(this.takeTime[1]) : '',
}
content.chatList(query).then(res => {
this.total = Number(res.total)
console.log(res,'chatData')
if (this.activeNameThree == 0) {
return this.allChat = res.rows
}
if (this.activeNameThree == 1) {
return this.allChatImg = res.rows
}
if (this.activeNameThree == 2) {
return this.allFile = res.rows
}
if (this.activeNameThree == 3) {
return this.allLInk = res.rows
}
if (this.activeNameThree == 4) {
return this.allVoice = res.rows
}
})
},
customerList(){
content.listByCustomer().then(res=>{
res.rows= res.rows.filter((a,b)=>{ return a&&a.name})
this.CList=res.rows
this.employAmount=res.total;
})
}
},
mounted(){
this.customerList()
import list from '../component/customerList.vue'
import chats from '../component/chat.vue'
import grouplist from '../component/groupList.vue'
import {
content
} from '@/api/content.js'
import {
yearMouthDay
} from '@/utils/common.js'
export default {
components: {
list,
chats,
grouplist
},
data() {
return {
employAmount: 1,
employName: '',
talkName: '',
personIndex: '-1',
activeName: "0",
activeNameThree: '0',
takeTime: '',
fileData: [],
CList: [],
personList: [],
loading: false,
employId: '',
chatData: {},
allChat: [],
allChatImg: [],
allFile: [],
allLInk: [],
allVoice: [],
//分页
currentPage: 1,
total: 0
};
},
methods: {
chatFn(data) {
this.chatData = data
console.log(data)
this.activeNameThreeClick()
},
groupFn(data){
this.chatData = data;
this.activeNameThreeClick('', true)
},
currentChange() {
this.currentPage = e
if (this.activeName == '2') {
return this.activeNameThreeClick(true, true)
}
this.activeNameThreeClick(true)
},
personCheck(data, e) {
this.personIndex = e
this.talkName = data.name;
this.employId = data.externalUserid
this.getChatList()
},
getChatList(flag) {
if (!this.employId) {
return
}
if (flag) {
this.loading = true
}
this.personList = []
content.getTree({
fromId: this.employId,
searchType: this.activeName
}).then(({
rows
}) => {
this.loading = false
this.personList = rows
}).catch(err => {
this.loading = false
})
},
activeNameThreeClick(page,group) {
if (!!!page) {
this.currentPage = 1
}
let msgType = ''
if (this.activeNameThree == 0) {
msgType = ''
} else if (this.activeNameThree == 1) {
msgType = 'image'
} else if (this.activeNameThree == 2) {
msgType = 'file'
} else if (this.activeNameThree == 3) {
msgType = 'link'
} else if (this.activeNameThree == 4) {
msgType = 'voice'
}
let query = {
fromId: this.chatData.fromId,
msgType,
pageSize: '10',
pageNum: this.currentPage,
beginTime: this.takeTime ? yearMouthDay(this.takeTime[0]) : "",
endTime: this.takeTime ? yearMouthDay(this.takeTime[1]) : '',
}
if (group) {
query.roomId = this.chatData.roomId
} else {
query.receiveId = this.chatData.receiveId
}
if (group) {
content.chatGrounpList(query).then(res => {
this.total = Number(res.total)
this.resortData(res)
})
} else {
content.chatList(query).then(res => {
this.total = Number(res.total)
this.resortData(res)
})
}
},
resortData(res){
if (this.activeNameThree == 0) {
return this.allChat = res.rows
}
if (this.activeNameThree == 1) {
return this.allChatImg = res.rows
}
if (this.activeNameThree == 2) {
return this.allFile = res.rows
}
if (this.activeNameThree == 3) {
return this.allLInk = res.rows
}
if (this.activeNameThree == 4) {
return this.allVoice = res.rows
}
},
customerList() {
let querys = {
pageNum: 1,
pageSize: 999,
name: this.employName,
userId: '',
tagIds: '',
beginTime: '',
endTime: '',
status: '',
isOpenChat: '1'
}
content.listByCustomer(querys).then(res => {
console.log(res)
res.rows = res.rows.filter((a, b) => {
return a && a.name
})
this.CList = res.rows
this.employAmount = res.total;
})
}
},
mounted() {
this.customerList()
}
}
</script>
<style lang="scss" scoped>
/deep/.el-tabs__nav-scroll {
padding-left: 15px;
/deep/.el-tabs__nav-scroll {
padding-left: 15px;
}
.fr {
float: right;
}
.borderR {
border-right: 2px solid #ccc;
}
.paddingT10 {
padding-top: 10px
}
.employ {
background: #f6f6f9;
min-height: 800px;
.hd_tabs {
background: #fff;
}
.fr{float:right;}
.borderR {
border-right: 2px solid #ccc;
.hd_tabthree {
/deep/ .el-tabs__header {
margin: 0;
}
}
.paddingT10 {
padding-top: 10px
.hd_box {
padding: 15px;
}
.employ {
background: #f6f6f9;
min-height: 800px;
.hd_name {
font-size: 18px;
min-height: 20px;
}
.hd_tabs {
background: #fff;
}
.hd_tabs_content {
width: 100%;
min-height: 653px;
border-bottom: 1px solid #efefef;
}
.hd_tabthree {
/deep/ .el-tabs__header {
margin: 0;
}
}
.hd_nameRi {
color: #199ed8;
text-align: right;
font-size: 16px;
cursor: pointer;
}
.hd_box {
padding: 15px;
}
.ct_boxFirst {
height: 700px;
}
.hd_name {
font-size: 18px;
min-height: 20px;
}
.hd_tabs_content{ width: 100%;min-height: 653px;border-bottom: 1px solid #efefef; }
.hd_nameRi {
color: #199ed8;
text-align: right;
font-size: 16px;
cursor: pointer;
}
.ct_box {
background: white;
border-bottom: 1px solid #efefef;
min-height: 709px;
padding: 10px;
overflow-y: scroll;
color: #999;
text-align: center;
::-webkit-scrollbar {
display: none;
}
.ct_boxFirst {
height: 700px;
ul {
margin: 0;
padding: 0;
}
ul li {
text-align: left;
cursor: pointer;
border-bottom: 1px solid #efefef;
:hover {
background: #efefef;
}
.ct_box {
background: white;
border-bottom: 1px solid #efefef;
min-height: 709px;
padding: 10px;
overflow-y: scroll;
color: #999;
text-align: center;
::-webkit-scrollbar {
display: none;
}
ul {
margin: 0;
padding: 0;
}
ul li {
text-align: left;
cursor: pointer;
border-bottom: 1px solid #efefef;
:hover{ background: #efefef;}
img {
width: 40px;
}
;
}
.liActive {
background: lightblue !important;
color: #199ed8;
}
.hds_time {
text-align: left;
width: 100%;
padding: 10px 0;
}
img {
width: 40px;
}
}
.pagination {
;
}
.liActive {
background: lightblue !important;
color: #199ed8;
}
.hds_time {
text-align: left;
width: 100%;
padding: 10px 0;
height: 30px;
float: left;
}
}
</style>
\ No newline at end of file
}
.pagination {
padding: 10px 0;
height: 30px;
float: left;
}
</style>
<template>
<div class="security">
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="敏感词触发" name="1">
<sensitive-list />
</el-tab-pane>
<el-tab-pane label="敏感词设置" name="2">
<set-sensitive-word />
</el-tab-pane>
<el-tab-pane label="敏感行为警告" name="3">
<alarming-sensitive />
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import alarmingSensitive from './securityPage/alarmingSensitive.vue'
import sensitiveList from './securityPage/sensitiveList.vue'
import setSensitiveWord from './securityPage/setSensitiveWord'
export default {
components:{
sensitiveList,
setSensitiveWord,
alarmingSensitive
},
data() {
return {
activeName: '1',
}
},
methods: {
handleClick(tab, event) {
console.log(tab, event);
}
}
}
</script>
<!-- 敏感行为警告页面 -->
<template>
<div class="alarming">
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="敏感记录" name="1">
<el-table :data="recordSensitive" stripe style="width: 100%"
:header-cell-style="{background:'#fff'}">
<el-table-column prop="operator" label="操作员工">
</el-table-column>
<el-table-column prop="operateTarget" label="操作对象">
</el-table-column>
<el-table-column prop="sensitiveAct" label="敏感行为">
</el-table-column>
<el-table-column prop="updateTime" label="操作时间">
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="recordPageTotal"
:page.sync="recordPageConfig.pageNum"
:limit.sync="recordPageConfig.pageSize"
@pagination="getSensiveRecordList()"
/>
</el-tab-pane>
<el-tab-pane label="敏感行为管理" name="2">
<el-table :data="tabData" stripe style="width: 100%"
:header-cell-style="{background:'#fff'}">
<el-table-column prop="actName" label="敏感操作">
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-switch v-model="scope.row.enableFlag" :active-value="1" :inactive-value="2" @change="handleStatusChange(scope.row)"></el-switch>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="query.pageNum"
:limit.sync="query.pageSize"
@pagination="getSensitiveManagementList()"
/>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import * as sensitiveApis from '@/api/conversation/security'
export default {
data() {
return {
activeName: '1',
recordSensitive: [],
tabData: [],
total: 0,
query: {
pageNum: 1,
pageSize: 10
},
recordPageTotal: 0,
recordPageConfig: {
pageNum: 1,
pageSize: 10
}
}
},
mounted() {
this.getSensiveRecordList()
this.getSensitiveManagementList()
},
methods: {
getSensiveRecordList() {
sensitiveApis.getSensitiveRecord(this.recordPageConfig).then(res => {
if (res.code === 200) {
this.recordSensitive = res.rows
this.recordPageTotal = Number(res.total)
}
})
},
getSensitiveManagementList() {
sensitiveApis.getSensitiveManagement(this.query).then(res => {
if (res.code === 200) {
this.tabData = res.rows
this.total = Number(res.total)
}
})
},
handleStatusChange(e) {
console.log(e)
},
handleClick(tab, event) {
console.log(tab, event)
}
}
}
</script>
\ No newline at end of file
<!-- 敏感词触发页面 -->
<template>
<div>
<el-form :inline="true" :model="form" class="demo-form-inline">
<el-form-item label="添加人">
<div class="tag-input" @click="dialogVisibleSelectUser = true">
<span class="tag-place" v-if="!queryUser.length">请选择</span>
<template v-else>
<el-tag
type="info"
v-for="(unit, unique) in queryUser"
:key="unique"
>{{ unit.name }}</el-tag
>
</template>
</div>
</el-form-item>
<el-form-item>
<el-input v-model="form.keyword" placeholder="搜索关键词" style="width:300px">
<el-button slot="prepend" icon="el-icon-search"></el-button>
</el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="getSensitiveList">查询</el-button>
</el-form-item>
</el-form>
<div class="search-content">
<el-row>
<el-col :span="8">
<div class="left-title">触发记录</div>
</el-col>
<el-col :span="16" style="text-align: right;">
<el-radio-group v-model="selectDate" size="small">
<el-radio-button label="昨日"></el-radio-button>
<el-radio-button label="7日"></el-radio-button>
<el-radio-button label="30日"></el-radio-button>
</el-radio-group>
<el-date-picker
v-model="dateRangeValue"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
class="date-range">
</el-date-picker>
</el-col>
</el-row>
</div>
<el-table :data="tableData" stripe style="width: 100%"
:header-cell-style="{background:'#fff'}">
<el-table-column prop="pattern_words" label="敏感词">
</el-table-column>
<el-table-column prop="content" label="内容">
</el-table-column>
<el-table-column prop="from" label="触发者">
</el-table-column>
<el-table-column prop="status" label="消息状态">
<template slot="header" >
{{floorRange}}
<el-select size="mini" v-model="floorRange" class="noborder" @change="chechName(floorRange)">
<el-option v-for="item in displayOptions" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="msgtime" label="发送时间">
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="query.pageNum"
:limit.sync="query.pageSize"
@pagination="getSensitiveList()"
/>
<!-- 选择添加人弹窗 -->
<SelectUser
:visible.sync="dialogVisibleSelectUser"
title="选择添加人"
:isSigleSelect="true"
@success="selectedUser"
></SelectUser>
</div>
</template>
<script>
import * as sensitiveApis from '@/api/conversation/security'
import SelectUser from "@/components/SelectUser"
export default {
components: {
SelectUser
},
data() {
return {
form: {
pageSize: 10,
pageNum: 1,
scopeType: '',
auditScopeId: '',
keyword: '' // 关键词
},
selectDate: '',
dateRangeValue: '', // 时间选择
tableData: [],
queryUser: [], // 搜索框选择的添加人
query: {
pageNum: 1,
pageSize: 10
},
total: 0,
dialogVisibleSelectUser: false, // 选择添加人弹窗显隐
floorRange:'全部',
displayOptions: [{
value: "0",
label: "全部"
},
{
value: "1",
label: "已发送"
},
{
value: "2",
label: "已撤回"
},
{
value: "3",
label: "已删除"
}
]
}
},
methods: {
getSensitiveList() {
if (this.queryUser.length > 0) {
this.form.pageSize = this.query.pageSize
this.form.pageNum = this.query.pageNum
sensitiveApis.getSecurityList(this.form).then(res => {
if (res.code === 200) {
this.tableData = res.rows
this.total = Number(res.total)
}
})
} else {
this.$message.warning('请选择人员!')
}
},
chechName(e) {
if (e == 0) {
this.floorRange = '全部'
} else if (e == 1) {
this.floorRange = '已发送'
} else if (e == 2) {
this.floorRange = '已撤回'
} else {
this.floorRange = '切回企业日志'
}
},
selectedUser(list) {
// console.log(list)
this.queryUser = list
this.form.scopeType = list.map(d => d.department) + ""
this.form.auditScopeId = list.map(d => d.userId) + ""
this.getSensitiveList()
}
}
}
</script>
<style lang="scss" scoped>
.demo-form-inline {
background: #efefef;
padding: 18px 10px 0 10px;
}
.tag-input {
width: 240px;
display: flex;
border-radius: 4px;
border: 1px solid #dcdfe6;
align-items: center;
padding: 0 15px;
overflow: hidden;
height: 32px;
background: #fff;
.tag-place {
color: #bbb;
font-size: 14px;
}
}
.search-content {
height: 40px;
margin-top: 15px;
padding: 10px;
.left-title {
height: 40px;
line-height: 40px;
}
.date-range {
margin-left: 10px;
width: 300px;
}
}
.noborder {
/deep/ .el-input--mini .el-input__inner{
width: 2px;
border: none;
}
}
.content {
margin-top: 15px;
padding: 10px;
}
</style>
\ No newline at end of file
<!-- 敏感词设置页面 -->
<template>
<div class="add-sensitive-word">
<el-form :inline="true" :model="form" class="demo-form-inline">
<el-button type="primary" class="add-btn" icon="el-icon-plus" @click="addSensitive">添加敏感词</el-button>
<el-form-item>
<el-input v-model="form.patternWords" placeholder="搜索关键词" style="width:300px">
<el-button slot="prepend" icon="el-icon-search" @click="getSettingList"></el-button>
</el-input>
</el-form-item>
</el-form>
<el-table :data="tableData" stripe style="width: 100%" :header-cell-style="{background:'#fff'}">
<el-table-column prop="strategyName" label="策略名称">
</el-table-column>
<el-table-column prop="patternWords" label="匹配词">
</el-table-column>
<el-table-column prop="auditScopeName" label="审计范围">
<template slot-scope="scope">
<el-tag size="medium">{{ scope.row.auditUserScope[0].auditScopeName }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="auditUserName" label="审计人">
</el-table-column>
<el-table-column label="消息通知">
<template slot-scope="scope">
<el-switch v-model="scope.row.alertFlag" :active-value="1" :inactive-value="0" @change="handleStatusChange(scope.row)"></el-switch>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="query.pageNum"
:limit.sync="query.pageSize"
@pagination="getSettingList()"
/>
<!-- 添加敏感词 -->
<el-dialog title="添加敏感词" :visible.sync="open" width="600px" append-to-body>
<el-form ref="addForm" :model="addForm" :rules="rules" label-width="130px">
<el-form-item label="敏感词策略名称" prop="strategyName">
<el-input v-model="addForm.strategyName" placeholder="例:红包" />
</el-form-item>
<el-form-item label="匹配词" prop="patternWords">
<el-input v-model="addForm.patternWords" placeholder="例:红包,hongbao,hb" />
<div class="sub-title">匹配词间用逗号隔开</div>
</el-form-item>
<el-form-item label="审计范围" :required="true" :error="rangeErrorMsg">
<div class="tag-input" @click="openAuditUserRange">
<span class="tag-place" v-if="!auditUserRange.length">请选择<span class="prompt-title">若不选择,则默认全体成员</span></span>
<template v-else>
<el-tag
type="info"
v-for="(unit, unique) in auditUserRange"
:key="unique"
>{{ unit.name }}</el-tag
>
</template>
</div>
</el-form-item>
<el-form-item label="审计人" :required="true" :error="errorMsg">
<div class="tag-input" @click="openAuditUser">
<span class="tag-place" v-if="!auditUser.length">请选择<span class="prompt-title">请选择部门负责人</span></span>
<template v-else>
<el-tag
type="info"
v-for="(unit, unique) in auditUser"
:key="unique"
>{{ unit.name }}</el-tag
>
</template>
</div>
</el-form-item>
<el-form-item label="消息通知">
<el-switch v-model="alertFlag" :active-value="1" :inactive-value="0"></el-switch>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="addSensitiveForm">确 定</el-button>
<el-button @click="open=false">取 消</el-button>
</div>
</el-dialog>
<!-- 选择审计范围弹窗 -->
<SelectUser
:visible.sync="dialogVisibleSelectUser"
title="选择添加人"
:isSigleSelect="true"
@success="selectedUser"
></SelectUser>
<!-- 选择审计人弹窗 -->
<SelectUser
:visible.sync="dialogVisibleSelectAuditUser"
title="选择添加人"
:isSigleSelect="true"
@success="selectedAuditUser"
></SelectUser>
</div>
</template>
<script>
import * as sensitiveApis from '@/api/conversation/security'
import SelectUser from "@/components/SelectUser"
export default {
components: {
SelectUser
},
data() {
return {
form: {
pageSize: 10,
pageNum: 1,
patternWords: '' // 关键词
},
addForm: {
strategyName: '', // 策略名称
patternWords: '' // 匹配词
},
alertFlag: 0, // 消息通知
tableData: [], // 敏感词列表
errorMsg: '', // 审计人错误提示
rangeErrorMsg: '', // 审计范围错误提示
query: {
pageNum: 1,
pageSize: 10
},
auditUserRange: [], // 审计范围
auditUser: [], // 审计人
total: 0,
dialogVisibleSelectUser: false, // 是否显示审计范围
dialogVisibleSelectAuditUser: false, // 是否显示审计人
open: false, // 是否显示添加敏感词弹框
submitFlag: '', // 添加或者修改
rowId: '', // 修改的数据id
rules: {
strategyName: [
{ required: true, message: "敏感词策略不能为空", trigger: "blur" }
],
patternWords: [
{ required: true, message: "匹配词不能为空", trigger: "blur" }
]
}
}
},
mounted() {
this.getSettingList()
},
methods: {
// 获取敏感词设置列表
getSettingList() {
this.form.pageSize = this.query.pageSize
this.form.pageNum = this.query.pageNum
sensitiveApis.getSettingSensitiveList(this.form).then(res => {
if (res.code === 200) {
this.tableData = res.rows
this.total = Number(res.total)
}
})
},
// 提交敏感词表单
addSensitiveForm() {
// console.log(this.auditUser)
this.$refs.addForm.validate(valid => {
if (valid) {
if (this.auditUserRange.length === 0) {
this.rangeErrorMsg = '请选择审计范围'
return
} else {
this.rangeErrorMsg = ''
}
if (this.auditUser.length === 0) {
this.errorMsg = '请选择审计人'
return
} else {
this.rangeErrorMsg = ''
}
const params = this.addForm
let auditUserScope = []
const obj = {
scopeType: this.auditUserRange.map(d => d.department) + "",
auditScopeId: this.auditUserRange.map(d => d.userId) + "",
auditScopeName: this.auditUserRange.map(d => d.name) + ""
}
auditUserScope.push(obj)
params.auditUserScope = auditUserScope
params.auditUserId = this.auditUser.map(d => d.userId) + ""
params.auditUserName = this.auditUser.map(d => d.name) + ""
params.alertFlag = this.alertFlag
if (this.submitFlag === 'add') {
sensitiveApis.addSettingSensitive(params).then(res => {
if (res.code === 200) {
this.open = false
this.getSettingList()
}
})
}
if (this.submitFlag === 'modify') {
params.id = this.rowId
sensitiveApis.modifySettingSensitive(params).then(res => {
if (res.code === 200) {
this.open = false
this.getSettingList()
}
})
}
}
})
},
// 打开审计范围
openAuditUserRange() {
this.dialogVisibleSelectUser = true
},
// 打开审计人
openAuditUser() {
this.dialogVisibleSelectAuditUser = true
},
resetForm() {
this.addForm = {
strategyName: '',
patternWords: ''
}
this.auditUserRange = [] // 审计范围
this.auditUser = []
this.alertFlag = 0
this.errorMsg = ''
},
// 添加敏感词
addSensitive() {
this.submitFlag = 'add'
this.resetForm()
this.open = true
},
selectedUser(list) {
// console.log(list)
this.auditUserRange = list
// this.form.scopeType = list.map(d => d.department) + ""
// this.form.auditScopeId = list.map(d => d.userId) + ""
},
selectedAuditUser(list) {
this.auditUser = list
},
// 修改敏感词
handleUpdate(row) {
// console.log(row)
this.submitFlag = 'modify'
this.errorMsg = ''
this.rowId = row.id
sensitiveApis.getSensitiveDetails(this.rowId).then(res => {
if (res.code === 200) {
this.addForm.strategyName = res.data.strategyName
this.addForm.patternWords = res.data.patternWords
this.auditUser = [{
name: res.data.auditUserName,
userId: res.data.auditUserId
}]
this.auditUserRange = [{
name: res.data.auditUserScope[0].auditScopeName,
userId: res.data.auditUserScope[0].auditScopeId,
department: res.data.auditUserScope[0].scopeType
}]
this.alertFlag = res.data.alertFlag
}
})
this.open = true
},
// 删除敏感词
handleDelete(row) {
sensitiveApis.deleteSensitive(row.id).then(res => {
if (res.code === 200) {
this.$message.success(res.msg)
this.getSettingList()
}
})
},
handleStatusChange(row) {
}
}
}
</script>
<style lang="scss" scoped>
.demo-form-inline {
background: #efefef;
padding: 18px 10px 0 10px;
}
/deep/ .add-btn {
margin-right: 10px;
}
.content {
margin-top: 15px;
padding: 10px;
}
.prompt-title {
margin-left: 10px;
color: #999;
}
.tag-place {
color: #1890ff;
}
.sub-title {
font-size: 13px;
color: #999;
}
</style>
\ No newline at end of file
<script>
import { getList } from "@/api/groupMessage";
import { getList, syncMsg } from '@/api/groupMessage'
export default {
name: "Operlog",
name: 'Operlog',
filters: {
sendInfo(data) {
if (data.timedTask == 1) {
return "定时任务 发送时间:" + data.settingTime;
return '定时任务 发送时间:' + data.settingTime
} else {
let unit = data.expectSend == 1 ? "个群" : "人";
return `预计发送${data.expectSend}${unit},已成功发送${data.actualSend}${unit}`;
let unit = data.expectSend == 1 ? '个群' : '人'
return `预计发送${data.expectSend}${unit},已成功发送${data.actualSend}${unit}`
}
}
},
},
data() {
return {
......@@ -32,78 +32,91 @@ export default {
content: undefined,
pushType: undefined,
beginTime: undefined,
endTime: undefined
endTime: undefined,
},
pushType: {
0: "发给客户",
1: "发给客户群"
0: '发给客户',
1: '发给客户群',
},
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now(); // 选当前时间之前的时间
}
}
};
return time.getTime() > Date.now() // 选当前时间之前的时间
},
},
}
},
created() {
this.getList();
this.getList()
},
methods: {
getList(page) {
if (this.dateRange[0]) {
this.query.beginTime = this.dateRange[0];
this.query.endTime = this.dateRange[1];
this.query.beginTime = this.dateRange[0]
this.query.endTime = this.dateRange[1]
} else {
this.query.beginTime = "";
this.query.endTime = "";
this.query.beginTime = ''
this.query.endTime = ''
}
page && (this.query.pageNum = page);
this.loading = true;
page && (this.query.pageNum = page)
this.loading = true
getList(this.query)
.then(({ rows, total }) => {
this.list = rows;
this.total = +total;
this.loading = false;
this.ids = [];
this.list = rows
this.total = +total
this.loading = false
this.ids = []
})
.catch(() => {
this.loading = false;
});
this.loading = false
})
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = [];
this.$refs["queryForm"].resetFields();
this.getList(1);
this.dateRange = []
this.$refs['queryForm'].resetFields()
this.getList(1)
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id);
this.ids = selection.map((item) => item.id)
},
/** 删除按钮操作 */
handleDelete(row) {
const operIds = row.operId || this.ids;
const operIds = row.operId || this.ids
this.$confirm(
'是否确认删除日志编号为"' + operIds + '"的数据项?',
"警告",
'警告',
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(function() {})
.then(() => {
this.getList();
this.msgSuccess("删除成功");
this.getList()
this.msgSuccess('删除成功')
})
.catch(function() {});
.catch(function() {})
},
goRoute(id, path) {
this.$router.push({ path: "/groupMessage/" + path, query: { id } });
}
}
};
this.$router.push({ path: '/groupMessage/' + path, query: { id } })
},
syncMsg(data) {
let { msgid, messageId } = data
syncMsg({ msgid, messageId })
.then(({ data }) => {
// this.list = rows
// this.total = +total
// this.loading = false
// this.ids = []
})
.catch(() => {
this.loading = false
})
},
},
}
</script>
<template>
<div>
......@@ -188,7 +201,6 @@ export default {
v-hasPermi="['enterpriseWechat:view']"
size="mini"
type="text"
icon="el-icon-view"
@click="goRoute(scope.row.messageId, 'detail')"
>查看</el-button
>
......@@ -196,11 +208,17 @@ export default {
v-hasPermi="['enterpriseWechat:edit']"
size="mini"
type="text"
icon="el-icon-edit"
disabled=""
@click="goRoute(scope.row, 1)"
>编辑</el-button
>
<el-button
v-hasPermi="['enterpriseWechat:edit']"
size="mini"
type="text"
@click="syncMsg(scope.row)"
>同步</el-button
>
</template>
</el-table-column>
</el-table>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!