pull/5/head
qsh 1 month ago
parent 1778ea9fb4
commit 21ff3718bd
  1. 23
      src/api/system/wechat/index.js
  2. 42
      src/router/modules/remaining.ts
  3. 157
      src/views/Basic/WxRobot/Setting.vue
  4. 3
      src/views/Kpi/Score/index.vue

@ -0,0 +1,23 @@
import request from '@/config/axios'
// 更新
export const updateWechatConfig = (data) => {
return request.post({ url: '/admin-api/system/wx-robot-message-setting/save', data })
}
// 更新发送时间
export const updateWechatSendTime = (data) => {
return request.put({ url: '/admin-api/system/wx-robot-message-setting/update-send-time', data })
}
// 更新微信群
export const updateWechatGroup = (data) => {
return request.put({ url: '/admin-api/system/wx-robot-message-setting/update-wx-group', data })
}
// 获得列表
export const getWechatConfigList = (params) => {
return request.get({
url: '/admin-api/system/wx-robot-message-setting/list',
params
})
}

@ -129,27 +129,27 @@ const remainingRouter: AppRouteRecordRaw[] = [
// } // }
// ] // ]
// }, // },
{ // {
path: '/Basic', // path: '/Basic',
component: Layout, // component: Layout,
name: 'Basic', // name: 'Basic',
meta: { title: '菜单管理' }, // meta: { title: '菜单管理' },
redirect: '/Basic/menu', // redirect: '/Basic/menu',
children: [ // children: [
{ // {
path: 'menu', // path: 'menu',
component: () => import('@/views/Basic/Menu/index.vue'), // component: () => import('@/views/Basic/Menu/index.vue'),
name: 'Menu', // name: 'Menu',
meta: { // meta: {
canTo: true, // canTo: true,
hidden: true, // hidden: true,
noTagsView: false, // noTagsView: false,
icon: 'ep:user', // icon: 'ep:user',
title: '菜单管理' // title: '菜单管理'
} // }
} // }
] // ]
}, // },
{ {
path: '/login', path: '/login',
component: () => import('@/views/Login/Login.vue'), component: () => import('@/views/Login/Login.vue'),

@ -5,15 +5,21 @@
<el-table-column label="发送方式" min-width="150"> <el-table-column label="发送方式" min-width="150">
<template #default="{ row }"> <template #default="{ row }">
<el-checkbox-group v-model="row.sendType" size="small" @change="rowChange(row)"> <el-checkbox-group v-model="row.sendType" size="small" @change="rowChange(row)">
<el-checkbox :label="1"> 微信 </el-checkbox> <el-checkbox label="微信"> 微信 </el-checkbox>
<el-checkbox :label="2"> 微信群 </el-checkbox> <el-checkbox label="微信群"> 微信群 </el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="微信群名称" min-width="150"> <el-table-column label="微信群名称" min-width="150">
<template #default="{ row }"> <template #default="{ row }">
<span v-if="!row.edit">{{ row.wxGroup }}</span> <el-input
<el-input v-else v-model="row.wxGroup" size="small" clearable @blur="rowChange(row)" /> v-if="row.sendType.includes('微信群')"
v-model="row.wxGroup"
size="small"
clearable
@input="rowChange(row)"
/>
<span v-else>{{ row.wxGroup }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="群二维码" width="90"> <el-table-column label="群二维码" width="90">
@ -23,11 +29,17 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" width="100"> <el-table-column label="操作" width="100">
<template #default="{ row }"> <template #default="{ row }">
<div> <!-- <div>
<el-button type="primary" style="padding: 5px 0" text @click="row.edit = true"> <el-button
v-if="row.sendType.includes('微信群')"
type="primary"
style="padding: 5px 0"
text
@click="row.edit = true"
>
修改群名称 修改群名称
</el-button> </el-button>
</div> </div> -->
<div v-if="['每日', '每月'].includes(row.sendFrequency)"> <div v-if="['每日', '每月'].includes(row.sendFrequency)">
<el-button type="primary" style="padding: 5px 0" text @click="changeSendTime(row)"> <el-button type="primary" style="padding: 5px 0" text @click="changeSendTime(row)">
修改发送时间 修改发送时间
@ -37,7 +49,11 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<Dialog :title="`修改【${sendTimeInfo.name}】发送时间`" v-model="showSendTime" width="500px"> <Dialog
:title="`修改【${sendTimeInfo.messageName}】发送时间`"
v-model="showSendTime"
width="500px"
>
<el-text type="danger"> <el-text type="danger">
<span v-if="sendTimeInfo.sendFrequency == '每日'"> <span v-if="sendTimeInfo.sendFrequency == '每日'">
请按照时间格式输入多个时间以分割如09:0015:0018:00 请按照时间格式输入多个时间以分割如09:0015:0018:00
@ -63,68 +79,20 @@
</template> </template>
<script setup name="WXSetting"> <script setup name="WXSetting">
import * as WechatApi from '@/api/system/wechat'
const message = useMessage() // const message = useMessage() //
const loading = ref(false) const loading = ref(false)
const tableList = ref([ const tableList = ref([])
{
name: '分配通知',
sendType: [],
sendFrequency: '每次',
sendTime: '触发时立刻发送',
remark: '线索分配给除本人之外的用户时,通知对方注意接收'
},
{
name: '发货通知',
sendType: [],
sendFrequency: '每次',
sendTime: '触发时立刻发送',
remark: '攀尼下单后,点击发货,发送发货模板到微信/群'
},
{
name: '审核失败通知',
sendType: [],
sendFrequency: '每次',
sendTime: '触发时立刻发送',
remark: 'crm中的回款、售后等审核失败,通知申请人'
},
{
name: '喜报',
sendType: [],
sendFrequency: '每次',
sendTime: '触发时立刻发送',
remark: '销售成交登记时,发送喜报到微信/群',
wxGroup: '寻驾'
},
{
name: '周业绩排名',
sendType: [],
sendFrequency: '每日',
sendTime: '10:00、15:00、18:00',
remark: '发送业绩排名到微信/群',
wxGroup: '爱顽熊'
},
{
name: '月业绩排名',
sendType: [],
sendFrequency: '每月',
sendTime: '26-18:00、28-14:00、30-15:00、30-18:00',
remark: '发送业绩排名到微信/群'
}
// {
// name: '',
// sendType: [],
// sendFrequency: ''
// }
])
const columns = [ const columns = [
{ {
label: '消息名称', label: '消息名称',
prop: 'name' prop: 'messageName'
}, },
{ {
label: '解释说明', label: '解释说明',
prop: 'remark' prop: 'description'
}, },
{ {
label: '发送频率', label: '发送频率',
@ -136,11 +104,35 @@ const columns = [
} }
] ]
async function rowChange(row) { onMounted(() => {
getTableList()
})
async function getTableList() {
try { try {
console.log(row) loading.value = true
const list = await WechatApi.getWechatConfigList()
tableList.value = list.map((it) => ({ ...it, sendType: it.sendType || [] }))
} finally {
loading.value = false
}
}
let timer = ref(null)
const lastId = ref('')
function rowChange(row) {
try {
lastId.value == row.id && clearTimeout(timer.value)
timer.value = setTimeout(async () => {
lastId.value = row.id
await WechatApi.updateWechatGroup({
id: row.id,
sendType: row.sendType,
wxGroup: row.wxGroup
})
// message.success('')
}, 1500)
} finally { } finally {
row.edit = false
} }
} }
@ -148,28 +140,53 @@ const showSendTime = ref(false)
const sendTimeInfo = ref({}) const sendTimeInfo = ref({})
function changeSendTime(row) { function changeSendTime(row) {
showSendTime.value = true showSendTime.value = true
sendTimeInfo.value = row sendTimeInfo.value = { ...row }
} }
function submitSendTime() { const formLoading = ref(false)
async function submitSendTime() {
// //
const arr = sendTimeInfo.value.sendTime.split('、') const arr = sendTimeInfo.value.sendTime ? sendTimeInfo.value.sendTime.split('、') : []
if (sendTimeInfo.value.sendFrequency == '每日') { if (sendTimeInfo.value.sendFrequency == '每日') {
// HH:MM // HH:MM
if (arr.some((it) => !/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/.test(it))) { if (arr.some((it) => !/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/.test(it))) {
message.error('请检查输入格式是否正确!!!') message.error('请检查输入格式是否正确!!!')
return return
} else { } else {
message.success('校验成功!') try {
formLoading.value = true
await WechatApi.updateWechatSendTime({
id: sendTimeInfo.value.id,
sendTime: arr.join('、')
})
message.success('修改成功!')
getTableList()
showSendTime.value = false
} finally {
formLoading.value = false
}
} }
} else if (sendTimeInfo.value.sendFrequency == '每月') { } else if (sendTimeInfo.value.sendFrequency == '每月') {
// 1-31-HH:MM // 1-31-HH:MM
const reg = /^([1-9]|[1-2]\d|3[01])-([01]?[0-9]|2[0-3]):[0-5][0-9]$/ const reg = /^([1-9]|[1-2]\d|3[01])-([01]?[0-9]|2[0-3]):[0-5][0-9]$/
if (arr.some((it) => !reg.test(it))) { if (arr.length > 0 && arr.some((it) => !reg.test(it))) {
message.error('请检查输入格式是否正确!!!') message.error('请检查输入格式是否正确!!!')
return return
} else { } else {
message.success('校验成功!') try {
formLoading.value = true
await WechatApi.updateWechatSendTime({
id: sendTimeInfo.value.id,
sendTime: arr.join('、')
})
message.success('修改成功!')
getTableList()
showSendTime.value = false
} finally {
formLoading.value = false
}
} }
} }
} }

@ -173,8 +173,9 @@ async function getList() {
} }
let timer = ref(null) let timer = ref(null)
const lastId = ref('')
function handleSave() { function handleSave() {
clearTimeout(timer.value) lastId.value == row.id && clearTimeout(timer.value)
timer.value = setTimeout(() => { timer.value = setTimeout(() => {
message.success('正在保存数据,请稍后') message.success('正在保存数据,请稍后')
}, 2000) }, 2000)

Loading…
Cancel
Save