|
|
|
@ -5,15 +5,21 @@ |
|
|
|
|
<el-table-column label="发送方式" min-width="150"> |
|
|
|
|
<template #default="{ row }"> |
|
|
|
|
<el-checkbox-group v-model="row.sendType" size="small" @change="rowChange(row)"> |
|
|
|
|
<el-checkbox :label="1"> 微信 </el-checkbox> |
|
|
|
|
<el-checkbox :label="2"> 微信群 </el-checkbox> |
|
|
|
|
<el-checkbox label="微信"> 微信 </el-checkbox> |
|
|
|
|
<el-checkbox label="微信群"> 微信群 </el-checkbox> |
|
|
|
|
</el-checkbox-group> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="微信群名称" min-width="150"> |
|
|
|
|
<template #default="{ row }"> |
|
|
|
|
<span v-if="!row.edit">{{ row.wxGroup }}</span> |
|
|
|
|
<el-input v-else v-model="row.wxGroup" size="small" clearable @blur="rowChange(row)" /> |
|
|
|
|
<el-input |
|
|
|
|
v-if="row.sendType.includes('微信群')" |
|
|
|
|
v-model="row.wxGroup" |
|
|
|
|
size="small" |
|
|
|
|
clearable |
|
|
|
|
@input="rowChange(row)" |
|
|
|
|
/> |
|
|
|
|
<span v-else>{{ row.wxGroup }}</span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="群二维码" width="90"> |
|
|
|
@ -23,11 +29,17 @@ |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="操作" width="100"> |
|
|
|
|
<template #default="{ row }"> |
|
|
|
|
<div> |
|
|
|
|
<el-button type="primary" style="padding: 5px 0" text @click="row.edit = true"> |
|
|
|
|
<!-- <div> |
|
|
|
|
<el-button |
|
|
|
|
v-if="row.sendType.includes('微信群')" |
|
|
|
|
type="primary" |
|
|
|
|
style="padding: 5px 0" |
|
|
|
|
text |
|
|
|
|
@click="row.edit = true" |
|
|
|
|
> |
|
|
|
|
修改群名称 |
|
|
|
|
</el-button> |
|
|
|
|
</div> |
|
|
|
|
</div> --> |
|
|
|
|
<div v-if="['每日', '每月'].includes(row.sendFrequency)"> |
|
|
|
|
<el-button type="primary" style="padding: 5px 0" text @click="changeSendTime(row)"> |
|
|
|
|
修改发送时间 |
|
|
|
@ -37,7 +49,11 @@ |
|
|
|
|
</el-table-column> |
|
|
|
|
</el-table> |
|
|
|
|
|
|
|
|
|
<Dialog :title="`修改【${sendTimeInfo.name}】发送时间`" v-model="showSendTime" width="500px"> |
|
|
|
|
<Dialog |
|
|
|
|
:title="`修改【${sendTimeInfo.messageName}】发送时间`" |
|
|
|
|
v-model="showSendTime" |
|
|
|
|
width="500px" |
|
|
|
|
> |
|
|
|
|
<el-text type="danger"> |
|
|
|
|
<span v-if="sendTimeInfo.sendFrequency == '每日'"> |
|
|
|
|
请按照时间格式输入,多个时间以“、”分割,如09:00、15:00、18:00 |
|
|
|
@ -63,68 +79,20 @@ |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script setup name="WXSetting"> |
|
|
|
|
import * as WechatApi from '@/api/system/wechat' |
|
|
|
|
|
|
|
|
|
const message = useMessage() // 消息弹窗 |
|
|
|
|
|
|
|
|
|
const loading = ref(false) |
|
|
|
|
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 tableList = ref([]) |
|
|
|
|
const columns = [ |
|
|
|
|
{ |
|
|
|
|
label: '消息名称', |
|
|
|
|
prop: 'name' |
|
|
|
|
prop: 'messageName' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: '解释说明', |
|
|
|
|
prop: 'remark' |
|
|
|
|
prop: 'description' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: '发送频率', |
|
|
|
@ -136,11 +104,35 @@ const columns = [ |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
async function rowChange(row) { |
|
|
|
|
onMounted(() => { |
|
|
|
|
getTableList() |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
async function getTableList() { |
|
|
|
|
try { |
|
|
|
|
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 { |
|
|
|
|
console.log(row) |
|
|
|
|
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 { |
|
|
|
|
row.edit = false |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -148,28 +140,53 @@ const showSendTime = ref(false) |
|
|
|
|
const sendTimeInfo = ref({}) |
|
|
|
|
function changeSendTime(row) { |
|
|
|
|
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 == '每日') { |
|
|
|
|
// 正则校验是否HH:MM |
|
|
|
|
if (arr.some((it) => !/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/.test(it))) { |
|
|
|
|
message.error('请检查输入格式是否正确!!!') |
|
|
|
|
return |
|
|
|
|
} 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 == '每月') { |
|
|
|
|
// 正则校验是否【1-31】-HH:MM |
|
|
|
|
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('请检查输入格式是否正确!!!') |
|
|
|
|
return |
|
|
|
|
} 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 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|