Commit 8a5e37ff by unknown

群活码页面

1 parent 609f4724
import request from '@/utils/request'
const service = window.CONFIG.services.wecom + '/actual'
/**
* 获取实际群码
* @param {*} params
{
"groupCodeId": "群活码ID",
"pageNum": "当前页",
"pageSize": "每页显示条数",
"state": "状态",
}
*/
export function getList(params) {
return request({
url: service + '/list',
params
})
}
/**
* 添加实际群码
* @param {*} data
{
"groupName": 群名称,
"actualGroupQrCode": 实际群码图片,
"effectTime": 有效期,
"scanCodeTimesLimit": 扫码次数限制,
"chatId": 客户群,
"chatGroupName": 客户群名称
}
*/
export function add(data) {
return request({
url: service + '/',
method: 'post',
data
})
}
/**
* 添加实际群码
* @param {*} data
{
"id": 实际群码ID,
"groupName": 群名称,
"actualGroupQrCode": 实际群码图片,
"effectTime": 有效期,
"scanCodeTimesLimit": 扫码次数限制,
"chatId": 客户群,
"chatGroupName": 客户群名称
}
*/
export function update(data) {
return request({
url: service + '/',
method: 'put',
data
})
}
/**
* 删除实际群码
* @param {*}
* "ids": 实际群活ID,多个ID以逗号分隔
*/
export function remove(ids) {
return request({
url: service + '/' + ids,
method: 'delete',
})
}
import request from '@/utils/request'
const service = window.CONFIG.services.wecom + '/groupCode'
/**
* 获取群活码列表
* @param {*} params
{
"pageNum": "当前页",
"pageSize": "每页显示条数",
"activityName": "活码名",
"createBy": "创建人",
"beginTime": "开始时间",
"endTime": "结束时间"
}
*/
export function getList(params) {
return request({
url: service + '/list',
params
})
}
/**
* 新增群活码
* @param {*} data
{
"file": 活码头像
"activityName": 活码名称
"activityDesc": 活码描述
"guide": 引导语
"joinGroupIsTip": 进群是否提示:1:是;0:否
"tipMsg": 进群提示语
"customerServerQrCode":客服二维码
}
*/
export function add(data) {
return request({
url: service + '/',
method: 'post',
data,
})
}
/**
* 更新群活码
* @param {*} id 群活码ID
* @param {*} data
{
"file": 活码头像
"activityName": 活码名称
"activityDesc": 活码描述
"guide": 引导语
"joinGroupIsTip": 进群是否提示:1:是;0:否
"tipMsg": 进群提示语
"customerServerQrCode":客服二维码
}
*/
export function update(id, data) {
return request({
url: service + '/' + id,
method: 'put',
data,
})
}
/**
* 根据ID获取群活码数据
* @param {*} params
*/
export function getDetail(id) {
return request({
url: service + '/' + id,
})
}
/**
* 删除群活码
* @param {*}
* "ids": 群活码ID,多个ID以逗号分隔
*/
export function remove(ids) {
return request({
url: service + '/' + ids,
method: 'delete',
})
}
/**
* 批量下载群活码
* @param {*}
* "ids": 群活码ID,多个ID以逗号分隔
*/
export function downloadBatch(ids) {
return request({
url: service + '/downloadBatch',
params: {
ids,
},
responseType: 'blob'
})
}
/**
* 下载群活码
* @param {*}
* "id": 群活码ID,多个ID以逗号分隔
*/
export function download(id) {
return request({
url: service + '/download',
params: {
id,
},
responseType: 'blob'
})
}
<style lang="scss" scoped>
.page {
display: flex;
justify-content: center;
margin: 24px;
border-radius: 4px;
border: 1px solid #e6ebf5;
background-color: #ffffff;
.el-form {
margin-right: 10%;
}
}
.preview {
width: 260px;
background: #eee;
border-radius: 8px;
padding: 10px;
height: 200px;
}
.tag-list-content {
max-height: 400px;
overflow: scroll;
}
.tag-list-content .list {
display: flex;
margin: 12px 0;
font-size: 14px;
font-weight: 400;
cursor: pointer;
color: #303133;
}
.tag-list-content .list .tag {
padding: 5px 6px;
margin-right: 8px;
margin-bottom: 9px;
font-size: 12px;
border: 1px solid #dcdfe6;
border-radius: 2px;
background-color: #f6f6f9;
color: #606266;
}
.tag-list-content .list .tag.select {
color: #4185f4;
border-color: rgba(65, 133, 244, 0.3);
background-color: rgba(65, 133, 244, 0.1);
}
.welcome-input {
display: table;
width: 80%;
margin: 0 auto 20px;
}
/deep/.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #409eff;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 178px;
height: 178px;
line-height: 178px;
text-align: center;
}
.avatar {
width: 178px;
height: 178px;
display: block;
}
</style>
<template>
<div class="app-container page">
<el-steps :active="active" finish-status="success">
<el-step title="使用须知"></el-step>
<el-step title="设置客户群活码基本信息"></el-step>
<el-step title="添加实际群活码"></el-step>
<el-step title="完成"></el-step>
<div class="page">
<el-steps
:active="active"
finish-status="success"
align-center
>
<el-step title="基本信息" description="设置群活码基本信息"></el-step>
<el-step title="实际群码" description="添加并管理微信实际群码"></el-step>
<el-step title="群活码" description="设置完成后生成群活码"></el-step>
</el-steps>
<div v-if="active === 1">
<el-form :model="queryParams" ref="queryForm" v-show="showSearch" label-width="100px">
<el-form-item label="活动头像" prop="title">
<el-upload
class="avatar-uploader"
action
:show-file-list="false"
:on-success="uploadSuccess"
:before-upload="beforeUpload"
>
<img v-if="imageUrl" :src="imageUrl" />
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>注:只能上传jpg/png格式图片,且不超过2M
</el-form-item>
<el-form-item label="活动名称" prop="operName">
<el-input
type="text"
v-model="queryParams.operName"
placeholder="请输入"
clearable
style="width: 240px;"
size="small"
maxlength="30"
show-word-limit
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="活动场景" prop="operName">
<el-input
type="textarea"
v-model="queryParams.operName"
placeholder="请输入"
clearable
style="width: 240px;"
size="small"
maxlength="30"
show-word-limit
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="引导语" prop="operName">
<el-input
type="textarea"
v-model="queryParams.operName"
placeholder="请输入"
clearable
style="width: 240px;"
size="small"
maxlength="30"
show-word-limit
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="无法进群提示" prop="operName">
<el-switch v-model="model" active-color="#13ce66" inactive-color="#ff4949"></el-switch>开启后,将在跳转页面底部显示无法进群的提示按钮
</el-form-item>
<template>
<el-form-item label="提示语" prop="operName">
<el-input
type="text"
v-model="queryParams.operName"
placeholder="请输入"
clearable
style="width: 240px;"
size="small"
maxlength="30"
show-word-limit
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="客服二维码" prop="title">
<el-upload
class="avatar-uploader"
action
:show-file-list="false"
:on-success="uploadSuccess"
:before-upload="beforeUpload"
>
<img v-if="imageUrl" :src="imageUrl" />
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>注:只能上传jpg/png格式图片,且不超过2M
</el-form-item>
</template>
<el-form-item label=" ">
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">上一步</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">下一步</el-button>
</el-form-item>
</el-form>
<div>
<div>
<div>活动名称</div>
<div>引导语</div>
<el-card shadow="never">
<el-avatar size="small" src="@/assets/image/profile.jpg"></el-avatar>实际群名称
<!-- <img :src="require('@/assets/image/profile.jpg')" alt=""> -->
<img src="@/assets/image/profile.jpg" alt />
</el-card>
</div>
<div>二维码预览</div>
<div class="page-content">
<div v-if="active === 0">
<BaseInfo ref="baseInfo" :groupCodeId="groupCodeId" @next="next"></BaseInfo>
</div>
</div>
<realCode v-if="active === 2"></realCode>
<div v-if="active === 2">
客户群活码创建成功!
<img src="@/assets/image/profile.jpg" alt />
<div v-if="active === 1">
<RealCode ref="realCode" :groupCodeId="groupCodeId" @next="next"></RealCode>
</div>
<div>
<el-button type="text">下载二维码</el-button>
<el-button type="text">复制链接</el-button>
<div v-if="active === 2">
<GroupCode :groupCodeId="groupCodeId"></GroupCode>
</div>
<el-button type="primary">完成</el-button>
</div>
<div class="fr">
<template v-if="active === 0">
<el-button @click="$router.back()"> 取消 </el-button>
<el-button type="primary" @click="handleGroupCode"> 下一步 </el-button>
</template>
<template v-else-if="active === 1">
<el-button @click="prev"> 上一步 </el-button>
<el-button type="primary" @click="handleRealCode"> 下一步 </el-button>
</template>
<template v-else>
<el-button @click="prev"> 上一步 </el-button>
<el-button type="primary" @click="finished"> 完成 </el-button>
</template>
</div>
</div>
</template>
<script>
import baseInfo from "./baseInfo";
import realCode from "./realCode";
import BaseInfo from './baseInfo'
import RealCode from './realCode'
import GroupCode from './groupCode'
export default {
name: "Operlog",
components: {
baseInfo,
realCode,
BaseInfo,
RealCode,
GroupCode
},
data() {
data () {
return {
active: 0,
treeData: [
{
label: "一级 1",
children: [
{
label: "二级 1-1",
children: [
{
label: "三级 1-1-1",
},
],
},
],
},
{
label: "一级 2",
children: [
{
label: "二级 2-1",
children: [
{
label: "三级 2-1-1",
},
],
},
{
label: "二级 2-2",
children: [
{
label: "三级 2-2-1",
},
],
},
],
},
{
label: "一级 3",
children: [
{
label: "二级 3-1",
children: [
{
label: "三级 3-1-1",
},
],
},
{
label: "二级 3-2",
children: [
{
label: "三级 3-2-1",
},
],
},
],
},
],
defaultProps: {
children: "children",
label: "label",
},
dialogVisible: false,
dialogVisible1: false,
dialogVisible2: false,
// 遮罩层
loading: false,
// 选中数组
ids: [],
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 表格数据
list: [],
// 是否显示弹出层
open: false,
// 类型数据字典
typeOptions: [],
// 类型数据字典
statusOptions: [],
// 日期范围
dateRange: [],
// 表单参数
form: {},
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
title: undefined,
operName: undefined,
businessType: undefined,
status: undefined,
},
tableData: [
{
date: "2016-05-02",
name: "王小虎",
address: "上海市普陀区金沙江路 1518 弄",
},
{
date: "2016-05-04",
name: "王小虎",
address: "上海市普陀区金沙江路 1517 弄",
},
{
date: "2016-05-01",
name: "王小虎",
address: "上海市普陀区金沙江路 1519 弄",
},
{
date: "2016-05-03",
name: "王小虎",
address: "上海市普陀区金沙江路 1516 弄",
},
],
};
},
created() {
this.getList();
this.getDicts("sys_oper_type").then((response) => {
this.typeOptions = response.data;
});
this.getDicts("sys_common_status").then((response) => {
this.statusOptions = response.data;
});
// 当前群活码ID
groupCodeId: null,
// 当前激活的步骤
active: 0
}
},
methods: {
setCurrent(row) {
this.$refs.singleTable.setCurrentRow(row);
},
handleCurrentChange(row, oldRow) {
row.checked = true;
this.currentRow = row;
console.log(row);
},
/** 查询登录日志 */
getList() {
this.loading = false;
list(this.addDateRange(this.queryParams, this.dateRange)).then(
(response) => {
this.list = response.rows;
this.total = response.total;
this.loading = false;
}
);
},
// 操作日志状态字典翻译
statusFormat(row, column) {
return this.selectDictLabel(this.statusOptions, row.status);
},
// 操作日志类型字典翻译
typeFormat(row, column) {
return this.selectDictLabel(this.typeOptions, row.businessType);
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = [];
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.operId);
this.multiple = !selection.length;
},
/** 详细按钮操作 */
handleView(row) {
this.open = true;
this.form = row;
// 下一步
next (groupCodeId) {
if (groupCodeId) this.groupCodeId = groupCodeId
this.active += 1
if (this.active > 3) this.active = 1
},
/** 删除按钮操作 */
handleDelete(row) {
const operIds = row.operId || this.ids;
this.$confirm(
'是否确认删除日志编号为"' + operIds + '"的数据项?',
"警告",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}
)
.then(function () {
return delOperlog(operIds);
})
.then(() => {
this.getList();
this.msgSuccess("删除成功");
})
.catch(function () {});
// 上一步
prev () {
this.active -= 1
if (this.active < 0) this.active = 0
},
/** 清空按钮操作 */
handleClean() {
this.$confirm("是否确认清空所有操作日志数据项?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return cleanOperlog();
})
.then(() => {
this.getList();
this.msgSuccess("清空成功");
})
.catch(function () {});
// 完成
finished () {
this.next()
this.$router.back()
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm("是否确认导出所有操作日志数据项?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return exportOperlog(queryParams);
})
.then((response) => {
this.download(response.msg);
})
.catch(function () {});
// 新增或更新群活码
handleGroupCode () {
this.$refs.baseInfo.submit()
},
},
};
</script>
\ No newline at end of file
// 管理实际群活码
handleRealCode() {
this.next()
}
}
}
</script>
<style scoped lang="scss">
.page-content {
padding-top: 50px;
padding-bottom: 20px;
}
</style>
<template>
<div>
<el-row>
<el-col
:sm="24"
:md="16"
:lg="14"
>
<el-form
:model="form"
:rules="rules"
ref="form"
label-width="100px"
>
<el-row>
<el-col
:sm="24"
:md="12"
>
<el-form-item
label="活码名称"
prop="activityName"
>
<el-input v-model="form.activityName" placeholder="请输入名称"></el-input>
</el-form-item>
</el-col>
<el-col
:sm="24"
:md="12"
>
<el-form-item
label="活码描述"
prop="activityDesc"
>
<el-input v-model="form.activityDesc" type="textarea" placeholder="请输入描述"></el-input>
</el-form-item>
</el-col>
<el-col
:sm="24"
:md="12"
>
<el-form-item
label="活码头像"
>
<upload
:fileUrl.sync="form.activityHeadUrl"
class="image-uploader"
>
<div slot="tip">
注: 只支持2M以内的jpg/png格式图片
</div>
</upload>
</el-form-item>
</el-col>
<el-col
:sm="24"
:md="12"
>
<el-form-item
label="加群引导语"
>
<el-input v-model="form.guide" type="textarea" placeholder="请输入加群引导语"></el-input>
</el-form-item>
</el-col>
<el-col
:span="24"
>
<el-divider></el-divider>
</el-col>
<el-col
:span="24"
>
<el-form-item
label="无法加群提示"
>
<el-switch
v-model="form.joinGroupIsTip"
:active-value="1"
:inactive-value="0"
>
</el-switch>
<div class="el-upload__tip">开启后, 页面底部显示无法进群按钮, 点击可查看提示内容</div>
</el-form-item>
</el-col>
<transition name="el-fade-in-linear">
<el-col
v-show="form.joinGroupIsTip === 1"
:sm="24"
:md="12"
>
<el-form-item
label="提示语"
>
<el-input v-model="form.tipMsg" placeholder="请输入提示语"></el-input>
</el-form-item>
</el-col>
</transition>
<transition name="el-fade-in-linear">
<el-col
v-show="form.joinGroupIsTip === 1"
:sm="24"
:md="12"
>
<el-form-item
label="客服二维码"
>
<upload
:fileUrl.sync="form.customerServerQrCode"
class="image-uploader"
>
<div slot="tip">
注: 只支持2M以内的jpg/png格式图片
</div>
</upload>
</el-form-item>
</el-col>
</transition>
</el-row>
</el-form>
</el-col>
<el-col
:sm="24"
:md="8"
:lg="10"
>
<div class="preview">
<div class="preview-content">
<div class="preview-header">
<i class="el-icon-close"></i>
<div> 群活码 </div>
<i class="el-icon-more"></i>
</div>
<el-divider></el-divider>
<div class="preview-name">
<template v-if="form.activityName">
{{ form.activityName }}
</template>
<template v-else>
活码名称
</template>
</div>
<div class="preview-guide">
<template v-if="form.guide">
{{ form.guide }}
</template>
<template v-else>
这是加群引导语
</template>
</div>
<div class="preview-code-box">
<div class="code-box-title">
<svg-icon icon-class="user" class="code-user"></svg-icon>
实际群名称
</div>
<div class="code-content">
<svg-icon icon-class="qrcode" class="code-svg"></svg-icon>
</div>
</div>
<transition name="el-fade-in-linear">
<div v-show="form.joinGroupIsTip" class="preview-customer-service">
<el-button type="danger"> 无法加群? </el-button>
</div>
</transition>
</div>
</div>
</el-col>
</el-row>
</div>
</template>
<script>
import { add, update, getDetail } from '@/api/drainageCode/group'
export default {
props: {
// 实际群活码
groupCodeId: {
type: String,
default: ''
}
},
data () {
return {
form: {
activityName: '',
activityDesc: '',
activityHeadUrl: '',
guide: '',
joinGroupIsTip: 0,
tipMsg: '',
customerServerQrCode: ''
},
rules: {
activityName: [
{ required: true, message: '请输入活码名称', trigger: 'blur' }
],
activityDesc: [
{ required: true, message: '请输入活码描述', trigger: 'blur' }
]
}
}
},
methods: {
// 新增群活码
add () {
this.$refs.form.validate((valid) => {
if (!valid) return
add(this.form).then((res) => {
this.$emit('next', res.id)
})
})
},
// 更新群活码
update () {
this.$refs.form.validate((valid) => {
if (!valid) return
update(this.groupCodeId, this.form).then((res) => {
this.$emit('next', this.groupCodeId)
})
})
},
// 获取群活码信息
getGroupDetail () {
if (!this.groupCodeId) return
getDetail(this.groupCodeId).then((res) => {
if (res.code === 200) {
this.form = {
activityName: res.data.activityName,
activityDesc: res.data.activityDesc,
activityHeadUrl: res.data.activityHeadUrl,
guide: res.data.guide,
joinGroupIsTip: parseInt(res.data.joinGroupIsTip),
tipMsg: res.data.tipMsg,
customerServerQrCode: res.data.customerServerQrCode
}
} else {
}
})
},
// 提交
submit () {
if (!this.groupCodeId) return this.add()
this.update()
// this.$emit('next')
}
},
created () {
if (this.groupCodeId) this.getGroupDetail()
}
}
</script>
<style scoped lang="scss">
/deep/ .image-uploader {
.uploader-icon {
width: 80px;
height: 80px;
line-height: 80px;
}
.upload-img {
width: 80px;
height: 80px;
}
}
.el-form-item {
margin-bottom: 30px;
}
.preview {
.preview-content {
width: 250px;
height: 480px;
background-color: #e9e9e9;
margin-left: 50px;
border-radius: 6px;
.preview-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 4px;
}
.el-divider {
margin: 3px 0;
}
.preview-name {
padding: 20px 6px;
text-align: center;
// line-height: 50px;
word-wrap: break-word;
word-break: normal;
line-height: 20px;
}
.preview-guide {
padding: 6px;
color: #888888;
margin: 0 15px 10px;
}
.preview-code-box {
height: 200px;
margin: 0 20px;
background-color: white;
padding: 10px;
font-weight: bold;
color: #666666;
.code-user {
font-size: 30px;
color: #4185f4;
}
.code-content {
text-align: center;
.code-svg {
font-size: 150px;
}
}
}
.preview-customer-service {
text-align: center;
padding: 20px 10px;
}
}
}
</style>
<template>
<div>
<el-form
:inline="true"
class="top-search"
>
<el-form-item>
<el-input v-model="query.groupName" placeholder="请输入群名"></el-input>
</el-form-item>
<el-form-item>
<el-input v-model="query.groupLeader" placeholder="请输入群主"></el-input>
</el-form-item>
<el-form-item>
<el-date-picker
v-model="searchDate"
format="yyyy-MM-dd"
value-format="yyyyMMdd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="getList">查询</el-button>
<el-button @click="handleClear">清空</el-button>
</el-form-item>
</el-form>
<el-table
:data="customerGroups"
v-loading="loading"
highlight-current-row
@current-change="handleSelectionChange"
>
<el-table-column
width="55"
align="center"
>
<template #default="{ row }">
<el-checkbox
:value="currentRow && row.chatId === currentRow.chatId"
>
</el-checkbox>
</template>
</el-table-column>
<el-table-column
prop="groupName"
label="群名"
align="center"
></el-table-column>
<el-table-column
prop="memberNum"
label="群人数"
align="center"
></el-table-column>
<el-table-column
prop="groupLeaderName"
label="群主"
align="center"
></el-table-column>
<el-table-column
prop="createTime"
label="创建时间"
align="center"
></el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="query.pageNum"
:limit.sync="query.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import { getList } from '@/api/customer/group'
export default {
props: {
customerGroupId: {
type: String,
default: ''
}
},
data () {
return {
// 查询参数
query: {
groupLeader: '',
groupName: '',
beginTime: '',
endTime: '',
pageNum: 1,
pageSize: 10
},
// 查询日期
searchDate: '',
// 加载状态
loading: false,
// 总数据量
total: 0,
// 日期范围
dateRange: [],
// 客户群数据
customerGroups: [],
// 当前选中行
currentRow: null
}
},
methods: {
// 获取客户群数据
getList () {
const params = Object.assign({}, this.query)
this.loading = true
getList(params).then((res) => {
this.customerGroups = res.rows
this.total = parseInt(res.total)
for (let group of this.customerGroups) {
if (group.chatId === this.customerGroupId) this.currentRow = group
}
this.loading = false
}).catch(() => {
this.loading = false
})
},
// 单选变更
handleSelectionChange (val) {
this.currentRow = val
},
handleClear () {
this.query.groupLeader = ''
this.query.groupName = ''
this.searchDate = ''
this.query.beginTime = ''
this.query.endTime = ''
this.getList()
},
submit () {
this.$emit('callback', this.currentRow)
}
},
watch: {
searchDate (dateRange) {
if (!dateRange || dateRange.length !== 2) {
this.query.beginTime = ''
this.query.endTime = ''
} else {
[ this.query.beginTime, this.query.endTime ] = dateRange
}
}
},
created () {
this.getList()
}
}
</script>
<style scoped lang="scss">
</style>
<style lang="scss" scoped>
.mid-action {
display: flex;
justify-content: space-between;
margin: 10px 0;
align-items: center;
.total {
background-color: rgba(65, 133, 244, 0.1);
border: 1px solid rgba(65, 133, 244, 0.2);
border-radius: 3px;
font-size: 14px;
min-height: 32px;
line-height: 32px;
padding: 0 12px;
color: #606266;
}
.num {
color: #00f;
}
}
</style>
<template>
<div class="app-container">
<el-card shadow="never" :body-style="{padding: '20px 0 0'}">
<el-form
:model="queryParams"
ref="queryForm"
:inline="true"
v-show="showSearch"
label-width="100px"
>
<el-form-item label="使用员工" prop="title">
<el-input
v-model="queryParams.title"
placeholder="请输入"
clearable
style="width: 240px;"
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="姓名" prop="operName">
<el-input
v-model="queryParams.operName"
placeholder="请输入"
clearable
style="width: 240px;"
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="手机号" prop="operName">
<el-input
v-model="queryParams.operName"
placeholder="请输入"
clearable
style="width: 240px;"
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="活动场景" prop="operName">
<el-input
v-model="queryParams.operName"
placeholder="请输入"
clearable
style="width: 240px;"
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="创建人" prop="operName">
<el-input
v-model="queryParams.operName"
placeholder="请输入"
clearable
style="width: 240px;"
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="创建日期">
<el-date-picker
v-model="dateRange"
size="small"
style="width: 240px"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item label=" ">
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">导出</el-button>
</el-form-item>
</el-form>
</el-card>
<div class="page">
<BaseInfo ref="baseInfo" :groupCodeId="groupCodeId"></BaseInfo>
<div class="mid-action">
<div class="total">
己选
<span class="num">{{total}}</span> 条,当前已经配置
<span class="num">{{total}}</span> 个 最多配置
<span class="num">{{total}}</span> 个
</div>
<div>
<el-button type="primary" size="mini" icon="el-icon-plus">新建员工活码</el-button>
<el-button type="primary" size="mini">批量新建</el-button>
<el-button type="primary" size="mini">删除</el-button>
<el-button type="primary" size="mini">下载</el-button>
</div>
<div class="fr">
<el-button @click="$router.back()"> 取消 </el-button>
<el-button type="primary" @click="save"> 保存 </el-button>
</div>
<el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="样式" align="center" prop="operId" />
<el-table-column label="使用员工" align="center" prop="title" />
<el-table-column label="姓名" align="center" prop="businessType" />
<el-table-column label="手机号" align="center" prop="businessType" />
<el-table-column label="活动场景" align="center" prop="businessType" />
<el-table-column label="创建人" align="center" prop="businessType" />
<el-table-column label="创建时间" align="center" prop="operTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.operTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleView(scope.row,scope.index)"
v-hasPermi="['monitor:operlog:query']"
>下载</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleView(scope.row,scope.index)"
v-hasPermi="['monitor:operlog:query']"
>复制链接</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleView(scope.row,scope.index)"
v-hasPermi="['monitor:operlog:query']"
>查看详情</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleView(scope.row,scope.index)"
v-hasPermi="['monitor:operlog:query']"
>编辑</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleView(scope.row,scope.index)"
v-hasPermi="['monitor:operlog:query']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import BaseInfo from './baseInfo'
export default {
name: "Operlog",
data() {
return {
// 遮罩层
loading: false,
// 选中数组
ids: [],
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 表格数据
list: [],
// 是否显示弹出层
open: false,
// 类型数据字典
typeOptions: [],
// 类型数据字典
statusOptions: [],
// 日期范围
dateRange: [],
// 表单参数
form: {},
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
title: undefined,
operName: undefined,
businessType: undefined,
status: undefined,
},
};
components: {
BaseInfo
},
created() {
this.getList();
this.getDicts("sys_oper_type").then((response) => {
this.typeOptions = response.data;
});
this.getDicts("sys_common_status").then((response) => {
this.statusOptions = response.data;
});
data () {
return {
groupCode: null,
groupCodeId: ''
}
},
methods: {
/** 查询登录日志 */
getList() {
this.loading = false;
list(this.addDateRange(this.queryParams, this.dateRange)).then(
(response) => {
this.list = response.rows;
this.total = response.total;
this.loading = false;
}
);
},
// 操作日志状态字典翻译
statusFormat(row, column) {
return this.selectDictLabel(this.statusOptions, row.status);
},
// 操作日志类型字典翻译
typeFormat(row, column) {
return this.selectDictLabel(this.typeOptions, row.businessType);
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = [];
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.operId);
this.multiple = !selection.length;
},
/** 详细按钮操作 */
handleView(row) {
this.open = true;
this.form = row;
},
/** 删除按钮操作 */
handleDelete(row) {
const operIds = row.operId || this.ids;
this.$confirm(
'是否确认删除日志编号为"' + operIds + '"的数据项?',
"警告",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}
)
.then(function () {
return delOperlog(operIds);
})
.then(() => {
this.getList();
this.msgSuccess("删除成功");
})
.catch(function () {});
},
/** 清空按钮操作 */
handleClean() {
this.$confirm("是否确认清空所有操作日志数据项?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return cleanOperlog();
})
.then(() => {
this.getList();
this.msgSuccess("清空成功");
})
.catch(function () {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm("是否确认导出所有操作日志数据项?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return exportOperlog(queryParams);
})
.then((response) => {
this.download(response.msg);
})
.catch(function () {});
},
save () {
this.$refs.baseInfo.submit()
this.$router.back()
}
},
};
</script>
\ No newline at end of file
created () {
this.groupCodeId = this.$route.query.groupCodeId
}
}
</script>
<style scoped lang="scss">
</style>
<template>
<div class="page">
<div class="code-wrapper">
<div class="code-success">
<el-button type="success" icon="el-icon-check" circle size="medium"></el-button>
</div>
<div class="code-text">
群活码创建成功,支持复制二维码链接或直接下载
</div>
<el-image
:src="codeUrl"
class="code-image"
>
</el-image>
<div class="code-actions">
<el-button
id="copyUrl"
type="text"
size="medium"
:data-clipboard-text="codeUrl"
>
复制链接
</el-button>
<el-button
type="text"
size="medium"
@click="handleDownload()"
>
下载二维码
</el-button>
</div>
</div>
</div>
</template>
<script>
import { getDetail, download } from '@/api/drainageCode/group'
import ClipboardJS from 'clipboard'
export default {
props: {
// 实际群活码
groupCodeId: {
type: String,
default: ''
}
},
data () {
return {
groupCode: null,
clipboard: null
}
},
methods: {
// 获取群活码信息
getGroupDetail () {
if (!this.groupCodeId) return
getDetail(this.groupCodeId).then((res) => {
if (res.code === 200) {
this.groupCode = res.data
} else {
}
})
},
// 下载
handleDownload () {
if (!this.groupCode) return
const name = this.groupCode.activityName + '.png'
download(this.groupCode.id).then((res) => {
if (res != null) {
let blob = new Blob([res], { type: 'application/zip' })
let url = window.URL.createObjectURL(blob)
const link = document.createElement('a') // 创建a标签
link.href = url
link.download = name // 重命名文件
link.click()
URL.revokeObjectURL(url) // 释放内存
}
})
},
},
computed: {
codeUrl () {
return this.groupCode ? this.groupCode.codeUrl : ''
}
},
mounted() {
this.clipboard = new ClipboardJS('#copyUrl')
this.clipboard.on('success', (e) => {
this.$notify({
title: '成功',
message: '链接已复制到剪切板,可粘贴。',
type: 'success',
})
})
this.clipboard.on('error', (e) => {
this.$message.error('链接复制失败')
})
},
created () {
this.getGroupDetail()
},
destroyed () {
this.clipboard.destroy()
}
}
</script>
<style scoped lang="scss">
.code-wrapper {
text-align: center;
.code-success, .code-text, .code-image, .code-actions {
padding: 20px 0;
}
}
</style>
<style lang="scss" scoped>
.mid-action {
display: flex;
justify-content: space-between;
margin: 10px 0;
align-items: center;
.total {
font-size: 14px;
min-height: 32px;
line-height: 32px;
padding: 0 12px;
color: #606266;
}
.num {
color: #00f;
}
}
</style>
<template>
<div class="app-container page">
<el-input placeholder="请输入关键字" style="width: 240px;" class="mr10" v-model="input3">
<el-button slot="append" icon="el-icon-search"></el-button>
</el-input>
<el-button type="primary" icon="el-icon-plus">新建客户群活码</el-button>
<el-button type="primary">批量下载</el-button>
<div class="page">
<el-form
:inline="true"
class="top-search"
>
<el-form-item>
<el-input
v-model="query.activityName"
placeholder="请输入活码名称"
></el-input>
</el-form-item>
<el-form-item>
<el-input
v-model="query.createBy"
placeholder="请输入创建人"
></el-input>
</el-form-item>
<el-form-item>
<el-date-picker
v-model="searchDate"
format="yyyy-MM-dd"
value-format="yyyyMMdd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item
class="search-button-area"
>
<el-button type="primary" @click="handleSearch">查询</el-button>
<el-button @click="handleClear">清空</el-button>
</el-form-item>
</el-form>
<div class="mid-action">
<div class="total">
客户群活码是一个可变化的群二维码,相当于一个跳转页面,当一个群快满时,会自动在跳转页面中显示另一个群的二维码,突破客户入群的限制。
<el-popover placement="right" width="400" trigger="hover">
<div class="notic-message">
<p>1. 群活码并未改变微信原有规则,只是提供了一个固定不变的入口二维码、根据人数自动换群及扫码数据统计分析等功能</p>
<p>2. 如果微信群7天没有加满200人,系统会提前一天通过服务号发送群二维码即将到期提醒,请及时更新群二维码,避免因群二维码过期无法进群</p>
<p>3. 微信群超过200人无法扫码只能邀请进群,想实现所有人都能扫码进群,需要拆分为多个200人群,准督多个空群,每扫码200人自动换过</p>
<p>4. 支持将活码二维码以图片方式分享朋友圈(活码以文字链接方式分享不影响),如有需要可以绑定自有域名,或开启防护加速仅支持企业版已认证用户功能</p>
<p>5. 根据《微信外链管理规范》,违规内容/用途、用户投诉等可能导致活码被封,且申诉有可能无法解封,具体以官方处理结果为准,无法更换活码的(例如用于印刷),建议绑定自有域名或开启防护加速功能</p>
<p>6. 禁止任何违法、违规用途,所有活码都有专人审核,一经发现即关闭访问、停止分配域名,情节严重将封停账户《微信外链管理规范》</p>
</div>
<span class="num" slot="reference">使用须知</span>
</el-popover>
<div>
<el-button
type="primary"
@click="$router.push('/drainageCode/groupAdd')"
>
新建群活码
</el-button>
</div>
<div>
<el-button
:disabled="multiGroupCode.length === 0"
@click="handleBulkDownload"
>
批量下载
</el-button>
<el-button
:disabled="multiGroupCode.length === 0"
@click="handleBulkRemove"
>
批量删除
</el-button>
</div>
</div>
<el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="样式" align="center" prop="operId" />
<el-table-column label="活动名称" align="center" prop="title" />
<el-table-column label="活动场景" align="center" prop="businessType" />
<el-table-column label="实际群码数" align="center" prop="businessType" />
<el-table-column label="扫码次数" align="center" prop="businessType" />
<el-table-column label="创建人" align="center" prop="businessType" />
<el-table-column label="创建时间" align="center" prop="operTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.operTime) }}</span>
<el-table
:data="groupCodes"
v-loading="loading"
@selection-change="handleSelectionChange"
>
<el-table-column
type="selection"
width="55"
align="center"
></el-table-column>
<el-table-column
prop="activityName"
label="活码名称"
align="center"
></el-table-column>
<el-table-column
prop="activityDesc"
label="活码描述"
align="center"
width="160"
>
<template #default="{ row }">
<el-popover
placement="bottom"
width="200"
trigger="hover"
:content="row.activityDesc"
>
<div slot="reference" class="table-desc overflow-ellipsis">{{ row.activityDesc }}</div>
</el-popover>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-table-column
prop="codeUrl"
label="活码样式"
align="center"
width="130"
>
<template #default="{ row }">
<el-popover
placement="bottom"
trigger="hover"
>
<el-image
slot="reference"
:src="row.codeUrl"
class="code-image--small"
></el-image>
<el-image
:src="row.codeUrl"
class="code-image"
>
</el-image>
</el-popover>
</template>
</el-table-column>
<el-table-column
label="实际群码总数"
align="center"
>
<template #default="{ row }">
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleView(scope.row,scope.index)"
v-hasPermi="['monitor:operlog:query']"
>下载</el-button>
@click="handleRealCodeDialogOpen(row.id, -1)"
>
{{ (row.actualList && row.actualList.length) || 0 }}
</el-button>
</template>
</el-table-column>
<el-table-column
prop="availableCodes"
label="可用实际群码数"
align="center"
>
<template #default="{ row }">
<el-popover
v-if="row.aboutToExpireCodes > 0"
placement="bottom"
width="200"
trigger="hover"
:content="'有' + row.aboutToExpireCodes + '个实际群码即将过期。'"
>
<i slot="reference" class="el-icon-warning expire-icon"></i>
</el-popover>
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleView(scope.row,scope.index)"
v-hasPermi="['monitor:operlog:query']"
>复制链接</el-button>
@click="handleRealCodeDialogOpen(row.id, 0)"
>
{{ row.availableCodes }}
</el-button>
</template>
</el-table-column>
<el-table-column
prop="totalScanTimes"
label="扫码总次数"
align="center"
></el-table-column>
<el-table-column
prop="createBy"
label="创建人"
align="center"
></el-table-column>
<el-table-column
prop="createTime"
label="创建时间"
align="center"
></el-table-column>
<el-table-column
label="操作"
align="center"
>
<template #default="{ row }">
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleView(scope.row,scope.index)"
v-hasPermi="['monitor:operlog:query']"
>查看详情</el-button>
<el-button
size="mini"
@click="$router.push({ path: '/drainageCode/customerGroupDetail', query: { groupCodeId: row.id } })"
>
编辑
</el-button>
<el-button
type="text"
icon="el-icon-view"
@click="handleView(scope.row,scope.index)"
v-hasPermi="['monitor:operlog:query']"
>编辑</el-button>
size="mini"
@click="handleDownload(row.id, row.activityName)"
>
下载
</el-button>
<el-button
type="text"
size="mini"
class="copy-btn"
:data-clipboard-text="row.codeUrl"
>
复制
</el-button>
<el-button
type="text"
icon="el-icon-view"
@click="handleView(scope.row,scope.index)"
v-hasPermi="['monitor:operlog:query']"
>删除</el-button>
size="mini"
@click="handleRemove(row.id)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
:page.sync="query.pageNum"
:limit.sync="query.pageSize"
@pagination="getGroupCodes"
/>
<el-dialog
v-if="realCodeDialog"
title="实际群码"
:visible.sync="realCodeDialog"
append-to-body
width="70%"
>
<RealCode ref="realCode" :groupCodeId="openGroupCodeId" :status="openGroupCodeStatus"></RealCode>
</el-dialog>
</div>
</template>
<script>
import RealCode from './realCode'
import { getList, remove, downloadBatch, download } from '@/api/drainageCode/group'
import ClipboardJS from 'clipboard'
export default {
name: "Operlog",
data() {
components: {
RealCode
},
data () {
return {
// 遮罩层
loading: false,
// 选中数组
ids: [],
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 表格数据
list: [],
// 是否显示弹出层
open: false,
// 类型数据字典
typeOptions: [],
// 类型数据字典
statusOptions: [],
// 日期范围
dateRange: [],
// 表单参数
form: {},
// 查询参数
queryParams: {
// 搜索数据
query: {
pageNum: 1,
pageSize: 10,
title: undefined,
operName: undefined,
businessType: undefined,
status: undefined,
activityName: '',
createBy: '',
beginTime: '',
endTime: ''
},
};
},
created() {
this.getList();
this.getDicts("sys_oper_type").then((response) => {
this.typeOptions = response.data;
});
this.getDicts("sys_common_status").then((response) => {
this.statusOptions = response.data;
});
// 加载状态
loading: false,
// 查询日期
searchDate: '',
// 多选数据
multiGroupCode: [],
// 群活码数据
groupCodes: [],
// 总数据量
total: 0,
// 实际群码总数dialog
realCodeDialog: false,
// 打开实际群码关联的群活码ID
openGroupCodeId: null,
// 打开实际群码的检索状态
openGroupCodeStatus: -1,
// 拷贝对象
clipboard: null
}
},
methods: {
/** 查询登录日志 */
getList() {
this.loading = false;
list(this.addDateRange(this.queryParams, this.dateRange)).then(
(response) => {
this.list = response.rows;
this.total = response.total;
this.loading = false;
// 获取活码数据
getGroupCodes () {
const params = Object.assign({}, this.query)
this.loading = true
getList(params).then((res) => {
if (res.code === 200) {
this.groupCodes = res.rows
this.total = parseInt(res.total)
}
);
},
// 操作日志状态字典翻译
statusFormat(row, column) {
return this.selectDictLabel(this.statusOptions, row.status);
},
// 操作日志类型字典翻译
typeFormat(row, column) {
return this.selectDictLabel(this.typeOptions, row.businessType);
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = [];
this.resetForm("queryForm");
this.handleQuery();
this.loading = false
}).catch(() => {
this.loading = false
})
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.operId);
this.multiple = !selection.length;
// 查询
handleSearch () {
this.getGroupCodes()
},
/** 详细按钮操作 */
handleView(row) {
this.open = true;
this.form = row;
// 搜索栏清空
handleClear () {
this.searchDate = ''
this.query = {
activityName: '',
createBy: '',
beginTime: '',
endTime: ''
}
this.getGroupCodes()
},
/** 删除按钮操作 */
handleDelete(row) {
const operIds = row.operId || this.ids;
this.$confirm(
'是否确认删除日志编号为"' + operIds + '"的数据项?',
"警告",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}
)
.then(function () {
return delOperlog(operIds);
})
// 批量下载
handleBulkDownload () {
const ids = this.multiGroupCode.map(group => group.id)
this.$confirm('是否确认下载所有图片吗?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
this.getList();
this.msgSuccess("删除成功");
return downloadBatch(ids + '')
})
.catch(function () {});
},
/** 清空按钮操作 */
handleClean() {
this.$confirm("是否确认清空所有操作日志数据项?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return cleanOperlog();
.then((res) => {
if (res != null) {
let blob = new Blob([res], { type: 'application/zip' })
let url = window.URL.createObjectURL(blob)
const link = document.createElement('a') // 创建a标签
link.href = url
link.download = '批量群活码.zip' // 重命名文件
link.click()
URL.revokeObjectURL(url) // 释放内存
}
})
.then(() => {
this.getList();
this.msgSuccess("清空成功");
.catch(function() {})
},
// 批量删除
handleBulkRemove () {
this.$confirm('确认删除当前群活码?删除操作无法撤销,请谨慎操作。', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
const ids = this.multiGroupCode.map(group => group.id)
remove(ids + '').then((res) => {
if (res.code === 200) {
this.getGroupCodes()
} else {}
})
.catch(function () {});
}).catch(() => {})
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm("是否确认导出所有操作日志数据项?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
// 下载
handleDownload (codeId, activityName) {
const name = activityName + '.png'
download(codeId).then((res) => {
if (res != null) {
let blob = new Blob([res], { type: 'application/zip' })
let url = window.URL.createObjectURL(blob)
const link = document.createElement('a') // 创建a标签
link.href = url
link.download = name // 重命名文件
link.click()
URL.revokeObjectURL(url) // 释放内存
}
})
.then(function () {
return exportOperlog(queryParams);
})
.then((response) => {
this.download(response.msg);
},
// 删除
handleRemove (codeId) {
this.$confirm('确认删除当前群活码?删除操作无法撤销,请谨慎操作。', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
remove(codeId).then((res) => {
if (res.code === 200) {
this.getGroupCodes()
} else {}
})
.catch(function () {});
}).catch(() => {})
},
// 处理多选
handleSelectionChange (val) {
this.multiGroupCode = val
},
// 打开实际群码窗口
handleRealCodeDialogOpen (groupCodeId, status) {
this.openGroupCodeId = groupCodeId
this.openGroupCodeStatus = status
this.realCodeDialog = true
}
},
watch: {
searchDate (dateRange) {
if (!dateRange || dateRange.length !== 2) {
this.query.beginTime = ''
this.query.endTime = ''
} else {
[ this.query.beginTime, this.query.endTime ] = dateRange
}
},
// 如果实际群码弹出框关闭,刷新数据
realCodeDialog (val) {
if (val === false) this.getGroupCodes()
}
},
};
</script>
\ No newline at end of file
mounted() {
this.clipboard = new ClipboardJS('.copy-btn')
this.clipboard.on('success', (e) => {
this.$notify({
title: '成功',
message: '链接已复制到剪切板,可粘贴。',
type: 'success',
})
})
this.clipboard.on('error', (e) => {
this.$message.error('链接复制失败')
})
},
created () {
this.getGroupCodes()
},
destroyed () {
this.clipboard.destroy()
},
}
</script>
<style scoped lang="scss">
.overflow-ellipsis {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.table-desc {
max-width: 150px;
}
.code-image {
width: 200px;
height: 200px;
}
.code-image--small {
width: 50px;
height: 50px;
}
.expire-icon {
color: red;
}
.mid-action {
display: flex;
justify-content: space-between;
align-items: center;
margin: 10px 0;
}
</style>
<style lang="scss" scoped>
</style>
<template>
<div>
<div class="mid-action">
<div class="total">实际群码</div>
<div>
<el-button type="primary" size="mini" icon="el-icon-plus" @click="dialogVisible = true">添加实际群码</el-button>
</div>
<div>
<el-button
type="primary"
@click="dialog = true"
>
新建实际群码
</el-button>
<el-select
v-model="query.status"
class="ml10"
>
<el-option
v-for="option in statusOptions"
:key="option.value"
:label="option.label"
:value="option.value"
></el-option>
</el-select>
</div>
<el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="实际群码" align="center" prop="operId" />
<el-table-column label="群名称" align="center" prop="title" />
<el-table-column label="有效期" align="center" prop="businessType" />
<el-table-column label="扫码次数" align="center" prop="businessType" />
<el-table-column label="扫码次数限制" align="center" prop="businessType" />
<el-table-column label="状态" align="center" prop="businessType" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<div>
<el-button
:disabled="multiRealCode.length === 0"
@click="handleBulkRemove"
>
批量删除
</el-button>
</div>
</div>
<el-table
:data="realCodes"
v-loading="loading"
@selection-change="handleSelectionChange"
>
<el-table-column
type="selection"
width="55"
align="center"
></el-table-column>
<el-table-column
prop="groupName"
label="群名称"
align="center"
></el-table-column>
<el-table-column
prop="actualGroupQrCode"
label="实际群码"
align="center"
width="80"
>
<template #default="{ row }">
<el-popover
placement="bottom"
trigger="hover"
>
<el-image
slot="reference"
:src="row.actualGroupQrCode"
class="code-image--small"
></el-image>
<el-image
:src="row.actualGroupQrCode"
class="code-image"
>
</el-image>
</el-popover>
</template>
</el-table-column>
<el-table-column
prop="chatGroupName"
label="客户群"
align="center"
></el-table-column>
<el-table-column
prop="effectTime"
label="有效期"
align="center"
></el-table-column>
<el-table-column
prop="scanCodeTimesLimit"
label="扫码次数限制"
align="center"
></el-table-column>
<el-table-column
prop="scanCodeTimes"
label="已扫码次数"
align="center"
></el-table-column>
<el-table-column
prop="status"
label="使用状态"
align="center"
>
<template #default="{ row }">
<div v-if="parseInt(row.status) === 0" class="green-text">使用中</div>
<div v-else class="red-text">已使用</div>
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
>
<template #default="{ row }">
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleView(scope.row,scope.index)"
v-hasPermi="['monitor:operlog:query']"
>编辑</el-button>
<el-button
size="mini"
@click="edit(row)"
>
编辑
</el-button>
<el-button
type="text"
icon="el-icon-view"
@click="handleView(scope.row,scope.index)"
v-hasPermi="['monitor:operlog:query']"
>删除</el-button>
size="mini"
@click="handleRemove(row.id)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<div>
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">上一步</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">下一步</el-button>
</div>
<el-dialog
title="添加实际群码"
:visible.sync="dialogVisible"
width="width"
:before-close="dialogBeforeClose">
<el-form :model="form" :label-width="100">
<el-form-item label="实际群码" prop="title">
<el-upload
class="avatar-uploader"
action
:show-file-list="false"
:on-success="uploadSuccess"
:before-upload="beforeUpload"
>
<img v-if="imageUrl" :src="imageUrl" />
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>注:只能上传jpg/png格式图片,且不超过2M
</el-form-item>
<el-form-item label="群名称">
<el-input v-model="a"></el-input>
title="实际群码"
:visible.sync="dialog"
append-to-body
>
<el-form
:model="form"
ref="form"
label-width="120px"
:rules="rules"
>
<el-form-item
label="群名称"
prop="groupName"
>
<el-input
v-model="form.groupName"
placeholder="请输入群名称"
></el-input>
</el-form-item>
<el-form-item label="有效期">
<el-date-picker v-model="time" type="date" placeholder="date"></el-date-picker>
<el-form-item
label="实际群码"
prop="actualGroupQrCode"
>
<upload
:fileUrl.sync="form.actualGroupQrCode"
class="image-uploader"
>
<div slot="tip">
注: 只支持2M以内的jpg/png格式图片
</div>
</upload>
<div>
<el-button type="text" @click="exampleDialog = true"> 查看示例 </el-button>
</div>
</el-form-item>
<el-form-item label="扫码次数限制">
<el-input type="number" v-model="a"></el-input>
<div>注:微信群建议设为300;企业微信群建议设为130</div>
<el-form-item
label="有效期"
prop="effectTime"
>
<el-date-picker
v-model="form.effectTime"
type="date"
placeholder="请选择有效期"
value-format="yyyy-MM-dd"
:picker-options="datePickerOptions"
>
</el-date-picker>
</el-form-item>
<el-form-item
label="扫码次数限制"
prop="scanCodeTimesLimit"
>
<el-input
v-model="form.scanCodeTimesLimit"
placeholder="请输入次数"
type="Number"
></el-input>
<div class="tip">
注: 不超过500, 建议400
</div>
</el-form-item>
<el-form-item
label="客户群"
>
<template v-if="form.chatId">
<el-button
@click="customerDialog = true"
type="primary"
>
{{ form.chatGroupName }}
</el-button>
</template>
<template v-else>
<el-button
icon="el-icon-plus"
@click="customerDialog = true"
>
选择客户群
</el-button>
</template>
<div class="tip">
注: 主要用于老客标签建群
</div>
</el-form-item>
</el-form>
<el-dialog
title="选择客户群"
append-to-body
:visible.sync="customerDialog"
>
<Customer v-if="customerDialog" ref="customer" :customerGroupId="form.chatId" @callback="getSelectCustomerGroup"></Customer>
<div slot="footer">
<el-button @click="customerDialog = false"> 取消 </el-button>
<el-button type="primary" @click="handleSelectCustomerGroup"> 确定 </el-button>
</div>
</el-dialog>
<el-dialog
:visible.sync="exampleDialog"
append-to-body
width="250px"
>
<div class="example-code-box">
<div class="example-text">
如图所示为标准的微信群二维码:
</div>
<div class="code-box-title">
<svg-icon icon-class="user" class="code-user"></svg-icon>
实际群名称
</div>
<div class="code-content">
<el-image
:src="require('@/assets/example/groupCode.png')"
>
</el-image>
</div>
</div>
</el-dialog>
<div slot="footer">
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" @click="dialogVisible = false">确 定</el-button>
<el-button @click="dialog = false"> 取消 </el-button>
<el-button type="primary" @click="handleSubmit"> 确定 </el-button>
</div>
</el-dialog>
<pagination
v-show="total > 0"
:total="total"
:page.sync="query.pageNum"
:limit.sync="query.pageSize"
@pagination="getRealCodes"
/>
</div>
</template>
<script>
import { getList, add, remove, update } from '@/api/drainageCode/actual'
import Customer from './customer'
export default {
components:{},
props:{},
data(){
components: {
Customer
},
props: {
// 实际群活码
groupCodeId: {
type: String,
default: ''
},
// 检索状态
status: {
type: Number,
default: -1
}
},
data () {
const checkScanTimes = (rule, value, callback) => {
if ( value < 1 || value > 500 ) {
callback(new Error('扫码次数必须在1-500之间'))
} else {
callback()
}
}
return {
dialogVisible: false
// 搜索数据
query: {
// 当前选择状态
status: -1,
// 当前页码
pageNum: 1,
// 每页数据量
pageSize: 10
},
// 可选状态
statusOptions: [
{ label: '全部状态', value: -1 },
{ label: '使用中', value: 0 },
{ label: '已使用', value: 1 }
],
// 加载状态
loading: false,
// 多选实际群码
multiRealCode: [],
// 实际群码数据
realCodes: [],
// 新建实际群码dialog
dialog: false,
// 选择客户群dialog
customerDialog: false,
// 示例dialog
exampleDialog: false,
// 实际群码表单
form: {
groupName: '',
actualGroupQrCode: '',
effectTime: '',
scanCodeTimesLimit: '',
chatId: '',
chatGroupName: ''
},
// 当前编辑的实际群码
editedRealCodeId: null,
// 客户群数据
customerGroup: [],
// 总数据量
total: 0,
// 表单验证
rules: {
groupName: [
{ required: true, message: '请输入群名称', trigger: 'blur' }
],
actualGroupQrCode: [
{ required: true, message: '请上传实际群码', trigger: 'blur' }
],
effectTime: [
{ required: true, message: '请选择有效期', trigger: 'blur' }
],
scanCodeTimesLimit: [
{ required: true, message: '请输入扫码次数', trigger: 'blur' },
{ pattern: /^[1-9][0-9]*$/, message: '扫码次数必须为正整数', trigger: 'blur' },
{ validator: checkScanTimes, trigger: 'blur' }
]
},
// 日期选择器选项
datePickerOptions: {
disabledDate (time) {
return time.getTime() <= Date.now() - 8.64e7
}
}
}
},
watch:{},
computed:{},
created(){},
mounted(){},
methods:{},
methods: {
// 获取所有实际群码
getRealCodes () {
let params = {
groupCodeId: this.groupCodeId
}
if (this.query.status !== -1) {
params = Object.assign(params, this.query)
} else {
params = Object.assign(params, {
pageNum: this.query.pageNum,
pageSize: this.query.pageSize
})
}
this.loading = true
getList(params).then((res) => {
if (res.code === 200) {
this.realCodes = res.rows
this.total = parseInt(res.total)
}
this.loading = false
}).catch(() => {
this.loading = false
})
},
// 新增实际群码
add () {
this.$refs.form.validate((valid) => {
if (!valid) return
const data = Object.assign({}, this.form, {
groupCodeId: this.groupCodeId
})
add(data).then((res) => {
this.dialog = false
this.getRealCodes()
})
})
},
// 编辑
edit (realCode) {
this.editedRealCodeId = realCode.id
this.form = {
groupName: realCode.groupName,
actualGroupQrCode: realCode.actualGroupQrCode,
effectTime: realCode.effectTime,
scanCodeTimesLimit: realCode.scanCodeTimesLimit,
chatId: realCode.chatId,
chatGroupName: realCode.chatGroupName
}
this.dialog = true
},
// 更新实际群码
update () {
this.$refs.form.validate((valid) => {
if (!valid) return
const data = Object.assign({
id: this.editedRealCodeId
}, this.form)
update(data).then((res) => {
this.dialog = false
this.getRealCodes()
})
})
},
handleSubmit () {
if (!this.editedRealCodeId) return this.add()
this.update()
},
// 批量删除
handleBulkRemove () {
this.$confirm('确认删除当前实际群码?删除操作无法撤销,请谨慎操作。', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
const ids = this.multiRealCode.map(code => code.id)
remove(ids + '').then((res) => {
if (res.code === 200) {
this.getRealCodes()
} else {}
})
}).catch(() => {})
},
// 删除
handleRemove (id) {
this.$confirm('确认删除当前实际群码?删除操作无法撤销,请谨慎操作。', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
remove(id).then((res) => {
if (res.code === 200) {
this.getRealCodes()
} else {}
})
}).catch(() => {})
},
// checkbox选择变更
handleSelectionChange (val) {
this.multiRealCode = val
},
// 客户群dialog选中数据
handleSelectCustomerGroup () {
this.$refs.customer.submit()
},
// 获取选中客户群
getSelectCustomerGroup (customerGroup) {
this.form.chatId = customerGroup ? customerGroup.chatId : ''
this.form.chatGroupName = customerGroup ? customerGroup.groupName : ''
this.customerDialog = false
},
},
watch: {
dialog (val) {
if (val === false) {
this.$refs.form.resetFields()
this.form.chatId = ''
this.form.chatGroupName = ''
this.editedRealCodeId = null
}
}
},
created () {
this.query.status = this.status
this.getRealCodes()
}
}
</script>
<style scoped lang="scss">
.mid-action {
display: flex;
justify-content: space-between;
align-items: center;
margin: 10px 0;
}
.code-image {
width: 200px;
height: 200px;
}
.code-image--small {
width: 50px;
height: 50px;
}
/deep/ .image-uploader {
.uploader-icon {
width: 80px;
height: 80px;
line-height: 80px;
}
.upload-img {
width: 80px;
height: 80px;
}
}
.tip {
color: #aaa;
font-size: 12px;
}
.green-text {
color: #19BE6B;
}
.red-text {
color: #ED4014;
}
.example-code-box {
margin: 0 5px;
background-color: white;
padding: 10px;
font-weight: bold;
color: #666666;
.example-text {
font-size: 12px;
padding: 10px 0;
}
.code-user {
font-size: 30px;
color: #4185f4;
}
.code-content {
text-align: center;
.el-image {
margin-top: 20px;
}
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!