Commit 71dbc23b by xinla

Merge branch 'vue3-master' into xxj-23.10.16-新老客拉群优化-open

2 parents 35a2c0d5 30406aac
......@@ -7,8 +7,7 @@
width="60%"
append-to-body
:close-on-click-modal="false"
@close="dialogClose"
>
@close="dialogClose">
<el-table :data="tableData" ref="singleTable" v-loading="loading">
<!-- <el-table-column type="index" width="50" label="序号" align="center"></el-table-column> -->
<el-table-column prop="name" align="center" label="素材" width="260">
......@@ -23,32 +22,17 @@
</div>
</template>
</el-table-column>
<el-table-column
label="发送总次数"
align="center"
prop="sendTotalNum"
:show-overflow-tooltip="true"
>
<el-table-column label="发送总次数" align="center" prop="sendTotalNum" :show-overflow-tooltip="true">
<template #default="scope">
{{ scope.row.sendTotalNum || '-' }}
</template>
</el-table-column>
<el-table-column
label="查看总次数"
align="center"
prop="viewTotalNum"
:show-overflow-tooltip="true"
>
<el-table-column label="查看总次数" align="center" prop="viewTotalNum" :show-overflow-tooltip="true">
<template #default="scope">
{{ scope.row.viewTotalNum || '-' }}
</template>
</el-table-column>
<el-table-column
label="查看总人数"
align="center"
prop="viewByTotalNum"
:show-overflow-tooltip="true"
>
<el-table-column label="查看总人数" align="center" prop="viewByTotalNum" :show-overflow-tooltip="true">
<template #default="scope">
{{ scope.row.viewByTotalNum || '-' }}
</template>
......@@ -62,7 +46,7 @@
</el-button>
<!-- 文件 -->
<el-button text v-if="scope.row.mediaType == '3'">
<a :href="dealUrl(scope.row.materialUrl)" target="_blank">预览</a>
<a :href="$previewFile(scope.row.materialUrl)" target="_blank">预览</a>
</el-button>
<!-- 文章 -->
<el-button text v-if="scope.row.mediaType == '12'" @click="preview(scope.row)">
......@@ -137,19 +121,6 @@ export default {
// return ''
// }
// },
dealUrl(url) {
return window.lwConfig.PRIVIEW_URL + encodeURIComponent(this.base64Encode(url))
},
base64Encode(str) {
if (str === undefined || str === '' || str === null) {
return str
}
return btoa(
encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function toSolidBytes(match, p1) {
return String.fromCharCode('0x' + p1)
})
)
},
preview(row) {
// let routeData = this.$router.resolve({
// path: '/preview',
......
<template>
<div>
<!-- 表格拖拽组件 -->
<el-table
:data="tableData"
ref="singleTable"
highlight-current-row
row-key="id"
class="load_table"
>
<el-table :data="tableData" ref="singleTable" highlight-current-row row-key="id" class="load_table">
<!-- <el-table-column type="index" width="50" label="序号" align="center"></el-table-column> -->
<el-table-column label="" width="50" align="left" v-if="dargAble">
<svg-icon icon="dragIcon" />
......@@ -18,16 +12,13 @@
<el-tooltip
:content="row.materialName"
placement="top"
:disabled="row.materialName ? row.materialName.length < 12 : true"
>
:disabled="row.materialName ? row.materialName.length < 12 : true">
<span class="title">{{ coverContent(row.materialName, 12) }}</span>
</el-tooltip>
<!-- 文本 -->
<div v-if="row.mediaType === '4'">
<el-tooltip placement="top" :disabled="row.content ? row.content.length < 50 : true">
<template #content
><p style="white-space: pre-line" v-html="row.content"></p
></template>
<template #content><p style="white-space: pre-line" v-html="row.content"></p></template>
<span class="twosplice">{{ coverContent(row.content, 50) }}</span>
</el-tooltip>
</div>
......@@ -37,20 +28,11 @@
</div>
<!-- 图文 -->
<div v-if="row.mediaType === '9'" style="display: flex">
<el-image
:src="row.coverUrl"
fit="contain"
class="imgsize"
v-if="row.coverUrl"
></el-image>
<el-image :src="row.coverUrl" fit="contain" class="imgsize" v-if="row.coverUrl"></el-image>
<div class="icon-style" v-else>
<svg-icon class="icon-style" icon="imgText"></svg-icon>
</div>
<el-tooltip
:content="row.content"
placement="top"
:disabled="row.content ? row.content.length < 50 : true"
>
<el-tooltip :content="row.content" placement="top" :disabled="row.content ? row.content.length < 50 : true">
<span class="twosplice distStyle">{{ coverContent(row.content, 50) }}</span>
</el-tooltip>
</div>
......@@ -60,31 +42,18 @@
</div>
<!-- 文章 -->
<div v-if="row.mediaType === '12'" style="display: flex">
<el-image
:src="row.coverUrl"
fit="contain"
class="imgsize"
v-if="row.coverUrl"
></el-image>
<el-image :src="row.coverUrl" fit="contain" class="imgsize" v-if="row.coverUrl"></el-image>
<div class="icon-style" v-else>
<svg-icon class="icon-style" icon="article"></svg-icon>
</div>
<el-tooltip
:content="row.digest"
placement="top"
:disabled="row.digest ? row.digest.length < 50 : true"
>
<el-tooltip :content="row.digest" placement="top" :disabled="row.digest ? row.digest.length < 50 : true">
<span class="twosplice distStyle">{{ coverContent(row.digest, 50) }}</span>
</el-tooltip>
</div>
<!-- 视频 -->
<div v-if="row.mediaType === '2'" style="display: flex">
<el-image :src="row.coverUrl" fit="contain" class="imgsize"></el-image>
<el-tooltip
:content="row.digest"
placement="top"
:disabled="row.digest ? row.digest.length < 50 : true"
>
<el-tooltip :content="row.digest" placement="top" :disabled="row.digest ? row.digest.length < 50 : true">
<span class="twosplice distStyle">{{ coverContent(row.digest, 50) }}</span>
</el-tooltip>
</div>
......@@ -92,27 +61,16 @@
<div v-if="row.mediaType === '3'" style="display: flex">
<!-- <el-image :src="row.coverUrl" fit="contain" class="imgsize"></el-image> -->
<div class="icon-style" v-if="row.materialUrl">
<svg-icon
class="icon-style"
:icon="row.materialUrl ? filType(row.materialUrl) : ''"
></svg-icon>
<svg-icon class="icon-style" :icon="row.materialUrl ? filType(row.materialUrl) : ''"></svg-icon>
</div>
<el-tooltip
:content="row.digest"
placement="top"
:disabled="row.digest ? row.digest.length < 50 : true"
>
<el-tooltip :content="row.digest" placement="top" :disabled="row.digest ? row.digest.length < 50 : true">
<span class="twosplice distStyle">{{ coverContent(row.digest, 50) }}</span>
</el-tooltip>
</div>
<!-- 海报 -->
<div v-if="row.mediaType === '5'" style="display: flex">
<el-image :src="row.materialUrl" fit="contain" class="imgsize"></el-image>
<el-tooltip
:content="row.digest"
placement="top"
:disabled="row.digest ? row.digest.length < 50 : true"
>
<el-tooltip :content="row.digest" placement="top" :disabled="row.digest ? row.digest.length < 50 : true">
<span class="twosplice distStyle">{{ coverContent(row.digest, 50) }}</span>
</el-tooltip>
</div>
......@@ -129,19 +87,17 @@
<el-table-column prop="height" label="操作" align="center">
<template #default="scope">
<el-button text>
<el-button text v-if="['2', '5', '9'].includes(scope.row.mediaType)">
<!-- 视频,海报,图文 -->
<a :href="scope.row.materialUrl" target="_blank">预览</a>
</el-button>
<!-- 文件 -->
<el-button text v-if="scope.row.mediaType == '3'">
<a :href="dealUrl(scope.row.materialUrl)" target="_blank">预览</a>
</el-button>
<!-- 文章 -->
<el-button text v-if="scope.row.mediaType == '12'" @click="preview(scope.row)">
<span>预览</span>
</el-button>
<el-button text v-if="['2', '5', '9'].includes(scope.row.mediaType)">
<!-- 视频,海报,图文 -->
<a :href="scope.row.materialUrl" target="_blank">预览</a>
</el-button>
<!-- 文件 -->
<el-button text v-if="scope.row.mediaType == '3'">
<a :href="$previewFile(scope.row.materialUrl)" target="_blank">预览</a>
</el-button>
<!-- 文章 -->
<el-button text v-if="scope.row.mediaType == '12'" @click="preview(scope.row)">
<span>预览</span>
</el-button>
<!-- <el-button
text
......@@ -203,19 +159,6 @@ export default {
},
methods: {
dealUrl(url) {
return window.lwConfig.PRIVIEW_URL + encodeURIComponent(this.base64Encode(url))
},
base64Encode(str) {
if (str === undefined || str === '' || str === null) {
return str
}
return btoa(
encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function toSolidBytes(match, p1) {
return String.fromCharCode('0x' + p1)
})
)
},
preview(row) {
// let routeData = this.$router.resolve({
// path: '/preview',
......@@ -296,9 +239,7 @@ export default {
},
//表格拖动排序
dragSort() {
const el = this.$refs.singleTable.$el.querySelectorAll(
'.el-table__body-wrapper table > tbody'
)[0]
const el = this.$refs.singleTable.$el.querySelectorAll('.el-table__body-wrapper table > tbody')[0]
this.sortable = Sortable.create(el, {
ghostClass: 'sortable-ghost',
......
......@@ -27,7 +27,7 @@ export default {
},
limit: {
type: Number,
default: 20,
default: 10,
},
pageSizes: {
type: Array,
......
<script>
// import * as customerApi from '@/api/operateCenter/customerAnalysis'
// import * as groupApi from '@/api/operateCenter/groupAnalysis'
// import * as conversationApi from '@/api/operateCenter/conversationAnalysis'
import { getList as getGroupList } from '@/api/customer/group'
export default {
name: '',
components: {
ChartLine: defineAsyncComponent(() => import('@/components/ChartLine')),
ChartBar: defineAsyncComponent(() => import('@/components/ChartBar')),
},
props: {
// 图表类型
type: {
type: String, // lineChart, barChart, table
default: '',
},
// 图表图例; 单个图例可传字符串,多个图例传数组
legend: {
type: [Array, String],
default: null,
},
// 接口请求
request: {
type: Function,
default: () => {},
},
// 是否显示时间查询
isTimeQuery: {
type: Boolean,
default: false,
},
// 是否显示选择群主
isGroupOwnerQuery: {
type: Boolean,
default: false,
},
// 是否显示选择群聊
isGroupQuery: {
type: Boolean,
default: false,
},
// 是否显示选择部门或员工
isDepartOrStaff: {
type: Boolean,
default: false,
},
// 导出接口请求
requestExport: {
type: Function,
default: null,
},
// 自定义图表配置项,使用loadsh.merge(origin, option)和原有的配置进行覆盖合并
// loadsh.merge: https://www.html.cn/doc/lodash/#_mergeobject-sources
option: {
type: Object,
default: null,
},
// 导出接口请求
dealDataFun: {
type: Function,
default: null,
},
},
data() {
return {
loading: false,
timeRange: 7,
total: 0,
// 表格数据
data: [],
xData: [],
// 日期范围
dateRange: [],
// 查询参数
query: {
pageNum: undefined,
pageSize: undefined,
deptIds: [],
userIds: [],
chatIds: [],
ownerIds: [],
beginTime: undefined,
endTime: undefined,
},
// 群聊
groupChats: [],
tableProps: [],
userArray: [], // 选择人员
dialogVisible: false,
dialogType: '',
}
},
computed: {},
watch: {},
created() {
this.setTime(7)
},
mounted() {},
methods: {
getList(page) {
if (this.type == 'table') {
this.query.pageSize || (this.query.pageSize = 10)
}
if (this.dateRange) {
this.query.beginTime = this.dateRange[0]
this.query.endTime = this.dateRange[1]
} else {
this.query.beginTime = ''
this.query.endTime = ''
}
if (this.dialogType === '_users') {
if (Array.isArray(this.userArray)) {
this.query.deptIds = this.userArray
.filter((e) => e.isParty)
.map((e) => e.id)
.join(',')
this.query.userIds = this.userArray
.filter((e) => !e.isParty)
.map((e) => e.userId)
.join(',')
} else {
this.query.deptIds = this.query.userIds = ''
}
} else if (this.dialogType === '_groupOwners') {
if (Array.isArray(this.userArray)) {
this.query.ownerIds = this.userArray
.filter((e) => !e.isParty)
.map((e) => e.userId)
.join(',')
} else {
this.query.ownerIds = ''
}
}
this.loading = true
page && (this.query.pageNum = page)
this.request(this.query)
.then(({ rows, total, data }) => {
this.series = []
data = data || rows
if (!data || !data.length) {
return
}
if (this.type == 'table') {
// 表格
this.data = data
this.total = Number(total)
} else {
this.dealDataFun && this.dealDataFun(data, this.data, this.xData)
}
})
.catch((e) => {
console.error(e)
})
.finally(() => {
this.loading = false
})
},
getGroupList(params) {
getGroupList(params)
.then(({ rows }) => {
this.groupChats = rows
})
.catch(() => {})
},
getTime(datePar) {
const d = datePar ? new Date(datePar) : new Date()
d.setMinutes(d.getMinutes() - d.getTimezoneOffset())
return d.toJSON().substr(0, 10)
},
setTime(days) {
this.timeRange = days
if (days) {
let date = new Date()
date.setDate(date.getDate() - days)
this.dateRange = [this.getTime(date), this.getTime()]
this.getList()
} else {
this.dateRange = null
}
},
showDialog(type) {
this.dialogType = type
this.dialogVisible = true
},
getSelectUser(data) {
this.userArray = data
this.query[this.dialogType] = data.map((e) => e.userId).join(',')
if (['customerGroupMemberTotalChart', 'customerGroupMemberTotalTable'].includes(this.type)) {
this.query.chatIds = ''
this.getGroupList({
userIds: this.query[this.dialogType],
})
}
this.getList()
},
exprotTable() {
this.$confirm('是否确认导出吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
this.loading = true
let query = Object.assign({}, this.query, { pageNum: undefined, pageSize: undefined })
return this.requestExport(query)
})
.then((res) => {
this.download(res.data)
})
.catch((error) => {
console.error(error)
})
.finally(() => {
this.loading = false
})
},
},
}
</script>
<template>
<div>
<div class="operation">
<template v-if="isTimeQuery">
<el-button-group>
<el-button type="primary" :plain="timeRange != 7" @click="setTime(7)">近一周</el-button>
<el-button type="primary" :plain="timeRange != 30" @click="setTime(30)">近一月</el-button>
<el-button type="primary" :plain="!!timeRange" @click="setTime()">自定义</el-button>
</el-button-group>
<el-date-picker
v-if="!timeRange"
v-model="dateRange"
class="ml20"
style="width: 260px"
value-format="YYYY-MM-DD"
type="daterange"
:clearable="false"
v-bind="pickerOptions"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="getList(1)"
></el-date-picker>
</template>
<el-input
v-if="isGroupOwnerQuery"
style="width: 180px; margin-left: 20px"
:model-value="userArray.map((e) => e.name) + ''"
readonly
@click="showDialog('_groupOwners')"
placeholder="请选择群主"
></el-input>
<el-select
style="margin-left: 20px"
v-if="isGroupQuery"
v-model="query.chatIds"
placeholder="请选择群聊"
clearable
@change="getList()"
>
<el-option
v-for="item in groupChats"
:key="item.chatId"
:label="item.groupName"
:value="item.chatId"
></el-option>
</el-select>
<el-input
v-if="isDepartOrStaff"
style="width: 180px; margin-left: 20px"
:model-value="userArray.map((e) => e.name) + ''"
readonly
@click="showDialog('_users')"
placeholder="请选择部门或员工"
/>
<el-button v-if="requestExport" class="fr" type="primary" @click="exprotTable"
>导出 Excel</el-button
>
</div>
<div v-loading="loading">
<ChartLine
v-if="type == 'lineChart'"
:xData="xData"
:legend="legend"
:series="data"
></ChartLine>
<template v-else-if="type == 'table'">
<el-table :data="data" style="width: 100%">
<el-table-column
v-for="(item, index) in tableProps[type]"
:key="index"
:prop="item.prop"
:label="item.label"
align="center"
></el-table-column>
</el-table>
<pagination
:total="total"
v-model:page="query.pageNum"
v-model:limit="query.pageSize"
@pagination="getList()"
/>
</template>
<ChartBar v-else-if="'barChart'.includes(type)" :xData="xData" :series="data"></ChartBar>
<ChartLine
v-else-if="'rowEchart'.includes('vChart')"
:xData="xData"
:legend="legend"
:series="data"
:option="option"
></ChartLine>
</div>
<SelectUser
v-model:visible="dialogVisible"
title="组织架构"
:defaultValues="userArray"
@success="getSelectUser"
:isOnlyLeaf="dialogType === '_groupOwners'"
></SelectUser>
</div>
</template>
<style lang="scss" scoped></style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!