公众号回复调整
This commit is contained in:
parent
8052475e40
commit
e191fc8d26
|
|
@ -1,4 +1,5 @@
|
|||
import request from '@/utils/request'
|
||||
import { firstToUpperCase } from '@/utils/util'
|
||||
|
||||
// 微信公众号配置保存
|
||||
export function setOaConfig(params: any) {
|
||||
|
|
@ -47,12 +48,11 @@ export function setOaMenuPublish(params: Menu | any) {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return { Promise }
|
||||
* @param { string } type
|
||||
* @description 获取回复列表
|
||||
* @description 默认回复列表
|
||||
*/
|
||||
export function getOaReplyList(params: { type: string }) {
|
||||
return request.get({ url: '/channel/oaReply/list', params })
|
||||
export function getOaReplyList(params: any) {
|
||||
const type = firstToUpperCase(params.type)
|
||||
return request.get({ url: `/channel/oaReply${type}/list`, params })
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -60,8 +60,9 @@ export function getOaReplyList(params: { type: string }) {
|
|||
* @param { number } id
|
||||
* @description 回复列表删除
|
||||
*/
|
||||
export function oaReplyDel(params: { id: number }) {
|
||||
return request.post({ url: '/channel/oaReply/del', params })
|
||||
export function oaReplyDel(params: any) {
|
||||
const type = firstToUpperCase(params.type)
|
||||
return request.post({ url: `/channel/oaReply${type}/del`, params })
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -69,8 +70,9 @@ export function oaReplyDel(params: { id: number }) {
|
|||
* @param { number } id
|
||||
* @description 回复状态修改
|
||||
*/
|
||||
export function changeOaReplyStatus(params: { id: number }) {
|
||||
return request.post({ url: '/channel/oaReply/status', params })
|
||||
export function changeOaReplyStatus(params: any) {
|
||||
const type = firstToUpperCase(params.type)
|
||||
return request.post({ url: `/channel/oaReply${type}/status`, params })
|
||||
}
|
||||
|
||||
export interface Reply {
|
||||
|
|
@ -85,25 +87,26 @@ export interface Reply {
|
|||
}
|
||||
/**
|
||||
* @return { Promise }
|
||||
* @description 回复添加
|
||||
* @description 默认回复编辑
|
||||
*/
|
||||
export function oaReplyAdd(params: Reply) {
|
||||
return request.post({ url: '/channel/oaReply/add', params })
|
||||
const type = firstToUpperCase(params.type)
|
||||
return request.post({ url: `/channel/oaReply${type}/add`, params })
|
||||
}
|
||||
|
||||
/**
|
||||
* @return { Promise }
|
||||
* @description 回复编辑
|
||||
* @description 默认回复编辑
|
||||
*/
|
||||
export function oaReplyEdit(params: Reply) {
|
||||
return request.post({ url: '/channel/oaReply/edit', params })
|
||||
const type = firstToUpperCase(params.type)
|
||||
return request.post({ url: `/channel/oaReply${type}/edit`, params })
|
||||
}
|
||||
|
||||
/**
|
||||
* @return { Promise }
|
||||
* @param { string } type
|
||||
* @description 获取回复详情
|
||||
* @description 默认回复详情
|
||||
*/
|
||||
export function getOaReplyDetail(params: { id: number }) {
|
||||
return request.get({ url: '/channel/oaReply/detail', params })
|
||||
export function getOaReplyDetail(params: any) {
|
||||
const type = firstToUpperCase(params.type)
|
||||
return request.get({ url: `/channel/oaReply${type}/detail`, params })
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ const config = {
|
|||
terminal: 1, //终端
|
||||
title: '后台管理系统', //网站默认标题
|
||||
version: '1.2.0', //版本号
|
||||
baseUrl: `${import.meta.env.VITE_APP_BASE_URL}/`, //请求接口域名
|
||||
baseUrl: `${import.meta.env.VITE_APP_BASE_URL || ''}/`, //请求接口域名
|
||||
urlPrefix: 'api', //请求默认前缀
|
||||
timeout: 10 * 1000 //请求超时时长
|
||||
}
|
||||
|
|
|
|||
|
|
@ -160,3 +160,12 @@ export const getNonDuplicateID = (length = 8) => {
|
|||
idStr += Math.random().toString(36).substring(3, length)
|
||||
return idStr
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 单词首字母大写
|
||||
* @param { String } str
|
||||
* @return { String } id
|
||||
*/
|
||||
export const firstToUpperCase = (str = '') => {
|
||||
return str.toLowerCase().replace(/( |^)[a-z]/g, ($1) => $1.toUpperCase())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,9 +37,9 @@
|
|||
<el-card class="!border-none mt-4" shadow="never">
|
||||
<div>
|
||||
<router-link
|
||||
v-perms="['article:add']"
|
||||
v-perms="['article:add', 'article:add/edit']"
|
||||
:to="{
|
||||
path: getRoutePath('article:edit')
|
||||
path: getRoutePath('article:add/edit')
|
||||
}"
|
||||
>
|
||||
<el-button type="primary" class="mb-4">
|
||||
|
|
@ -89,10 +89,10 @@
|
|||
<el-table-column label="发布时间" prop="createTime" min-width="120" />
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button v-perms="['article:edit']" type="primary" link>
|
||||
<el-button v-perms="['article:edit','article:add/edit']" type="primary" link>
|
||||
<router-link
|
||||
:to="{
|
||||
path: getRoutePath('article:edit'),
|
||||
path: getRoutePath('article:add/edit'),
|
||||
query: {
|
||||
id: row.id
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,24 +10,30 @@
|
|||
</el-card>
|
||||
<el-card class="!border-none mt-4" shadow="never">
|
||||
<div>
|
||||
<el-button class="mb-4" type="primary" @click="handleAdd()">
|
||||
<el-button
|
||||
v-perms="['channel:oaReplyDefault:add']"
|
||||
class="mb-4"
|
||||
type="primary"
|
||||
@click="handleAdd()"
|
||||
>
|
||||
<template #icon>
|
||||
<icon name="el-icon-Plus" />
|
||||
</template>
|
||||
新增
|
||||
</el-button>
|
||||
</div>
|
||||
<el-table size="large" :data="lists">
|
||||
<el-table size="large" :data="pager.lists" v-loading="pager.loading">
|
||||
<el-table-column label="规则名称" prop="name" min-width="120" />
|
||||
<el-table-column label="回复类型" min-width="120">
|
||||
<template #default="{ row }">
|
||||
{{ getContentType(1) }}
|
||||
{{ getContentType(row.contentType) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="回复内容" prop="content" min-width="120" />
|
||||
<el-table-column label="状态" min-width="120">
|
||||
<template #default="{ row }">
|
||||
<el-switch
|
||||
v-perms="['channel:oaReplyDefault:status']"
|
||||
v-model="row.status"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
|
|
@ -38,25 +44,40 @@
|
|||
<el-table-column label="排序" prop="sort" min-width="120" />
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button type="primary" link @click="handleEdit(row)"> 编辑 </el-button>
|
||||
<el-button type="danger" link @click="handleDelete(row.id)">
|
||||
<el-button
|
||||
v-perms="['channel:oaReplyDefault:edit']"
|
||||
type="primary"
|
||||
link
|
||||
@click="handleEdit(row)"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-perms="['channel:oaReplyDefault:del']"
|
||||
type="danger"
|
||||
link
|
||||
@click="handleDelete(row.id)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="flex justify-end mt-4">
|
||||
<pagination v-model="pager" @change="getLists" />
|
||||
</div>
|
||||
</el-card>
|
||||
<edit-popup v-if="showEdit" ref="editRef" @success="getLists" @close="showEdit = false" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { oaReplyDel, getOaReplyList, changeOaReplyStatus } from '@/api/channel/wx_oa'
|
||||
import { usePaging } from '@/hooks/usePaging'
|
||||
import feedback from '@/utils/feedback'
|
||||
import EditPopup from './edit.vue'
|
||||
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
||||
const showEdit = ref(false)
|
||||
const lists = ref()
|
||||
|
||||
const type = 'default'
|
||||
const getContentType = computed(() => {
|
||||
return (val: number) => {
|
||||
switch (val) {
|
||||
|
|
@ -66,33 +87,36 @@ const getContentType = computed(() => {
|
|||
}
|
||||
})
|
||||
|
||||
const getLists = async () => {
|
||||
lists.value = await getOaReplyList({ type: 'default' })
|
||||
}
|
||||
const { pager, getLists } = usePaging({
|
||||
fetchFun: getOaReplyList,
|
||||
params: {
|
||||
type
|
||||
}
|
||||
})
|
||||
|
||||
const handleAdd = async () => {
|
||||
showEdit.value = true
|
||||
await nextTick()
|
||||
editRef.value?.open('add', 'default')
|
||||
editRef.value?.open('add', type)
|
||||
}
|
||||
|
||||
const handleEdit = async (data: any) => {
|
||||
showEdit.value = true
|
||||
await nextTick()
|
||||
editRef.value?.open('edit', 'default')
|
||||
editRef.value?.open('edit', type)
|
||||
editRef.value?.getDetail(data)
|
||||
}
|
||||
|
||||
const handleDelete = async (id: number) => {
|
||||
await feedback.confirm('确定要删除?')
|
||||
await oaReplyDel({ id })
|
||||
await oaReplyDel({ id, type })
|
||||
feedback.msgSuccess('删除成功')
|
||||
getLists()
|
||||
}
|
||||
|
||||
const changeStatus = async (id: number) => {
|
||||
try {
|
||||
await changeOaReplyStatus({ id })
|
||||
await changeOaReplyStatus({ id, type })
|
||||
feedback.msgSuccess('修改成功')
|
||||
getLists()
|
||||
} catch (error) {
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@
|
|||
</el-form-item> -->
|
||||
<el-form-item label="排序">
|
||||
<div class="flex-1">
|
||||
<el-input v-model="formData.sort" placeholder="请输入" />
|
||||
<el-input-number v-model="formData.sort" :min="0"/>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="启用状态">
|
||||
|
|
@ -172,7 +172,8 @@ const setFormData = (data: Record<any, any>) => {
|
|||
|
||||
const getDetail = async (row: Record<string, any>) => {
|
||||
const data = await getOaReplyDetail({
|
||||
id: row.id
|
||||
id: row.id,
|
||||
type: formData.type
|
||||
})
|
||||
setFormData(data)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,14 +10,19 @@
|
|||
</el-card>
|
||||
<el-card class="!border-none mt-4" shadow="never">
|
||||
<div>
|
||||
<el-button class="mb-4" type="primary" @click="handleAdd()">
|
||||
<el-button
|
||||
v-perms="['channel:oaReplyFollow:add']"
|
||||
class="mb-4"
|
||||
type="primary"
|
||||
@click="handleAdd()"
|
||||
>
|
||||
<template #icon>
|
||||
<icon name="el-icon-Plus" />
|
||||
</template>
|
||||
新增
|
||||
</el-button>
|
||||
</div>
|
||||
<el-table size="large" :data="lists">
|
||||
<el-table size="large" :data="pager.lists" v-loading="pager.loading">
|
||||
<el-table-column label="规则名称" prop="name" min-width="120" />
|
||||
<el-table-column label="回复类型" min-width="120">
|
||||
<template #default="{ row }">
|
||||
|
|
@ -28,6 +33,7 @@
|
|||
<el-table-column label="状态" min-width="120">
|
||||
<template #default="{ row }">
|
||||
<el-switch
|
||||
v-perms="['channel:oaReplyFollow:status']"
|
||||
v-model="row.status"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
|
|
@ -38,25 +44,41 @@
|
|||
<el-table-column label="排序" prop="sort" min-width="120" />
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button type="primary" link @click="handleEdit(row)"> 编辑 </el-button>
|
||||
<el-button type="danger" link @click="handleDelete(row.id)">
|
||||
<el-button
|
||||
v-perms="['channel:oaReplyFollow:edit']"
|
||||
type="primary"
|
||||
link
|
||||
@click="handleEdit(row)"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-perms="['channel:oaReplyFollow:del']"
|
||||
type="danger"
|
||||
link
|
||||
@click="handleDelete(row.id)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="flex justify-end mt-4">
|
||||
<pagination v-model="pager" @change="getLists" />
|
||||
</div>
|
||||
</el-card>
|
||||
<edit-popup v-if="showEdit" ref="editRef" @success="getLists" @close="showEdit = false" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { oaReplyDel, getOaReplyList, changeOaReplyStatus } from '@/api/channel/wx_oa'
|
||||
import { usePaging } from '@/hooks/usePaging'
|
||||
import feedback from '@/utils/feedback'
|
||||
import EditPopup from './edit.vue'
|
||||
|
||||
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
||||
const showEdit = ref(false)
|
||||
const lists = ref()
|
||||
|
||||
const type = 'follow'
|
||||
const getContentType = computed(() => {
|
||||
return (val: number) => {
|
||||
switch (val) {
|
||||
|
|
@ -66,33 +88,36 @@ const getContentType = computed(() => {
|
|||
}
|
||||
})
|
||||
|
||||
const getLists = async () => {
|
||||
lists.value = await getOaReplyList({ type: 'follow' })
|
||||
}
|
||||
const { pager, getLists } = usePaging({
|
||||
fetchFun: getOaReplyList,
|
||||
params: {
|
||||
type
|
||||
}
|
||||
})
|
||||
|
||||
const handleAdd = async () => {
|
||||
showEdit.value = true
|
||||
await nextTick()
|
||||
editRef.value?.open('add', 'follow')
|
||||
editRef.value?.open('add', type)
|
||||
}
|
||||
|
||||
const handleEdit = async (data: any) => {
|
||||
showEdit.value = true
|
||||
await nextTick()
|
||||
editRef.value?.open('edit', 'follow')
|
||||
editRef.value?.open('edit', type)
|
||||
editRef.value?.getDetail(data)
|
||||
}
|
||||
|
||||
const handleDelete = async (id: number) => {
|
||||
await feedback.confirm('确定要删除?')
|
||||
await oaReplyDel({ id })
|
||||
await oaReplyDel({ id, type })
|
||||
feedback.msgSuccess('删除成功')
|
||||
getLists()
|
||||
}
|
||||
|
||||
const changeStatus = async (id: number) => {
|
||||
try {
|
||||
await changeOaReplyStatus({ id })
|
||||
await changeOaReplyStatus({ id, type })
|
||||
feedback.msgSuccess('修改成功')
|
||||
getLists()
|
||||
} catch (error) {
|
||||
|
|
|
|||
|
|
@ -10,14 +10,19 @@
|
|||
</el-card>
|
||||
<el-card class="!border-none mt-4" shadow="never">
|
||||
<div>
|
||||
<el-button class="mb-4" type="primary" @click="handleAdd()">
|
||||
<el-button
|
||||
v-perms="['channel:oaReplyKeyword:add']"
|
||||
class="mb-4"
|
||||
type="primary"
|
||||
@click="handleAdd()"
|
||||
>
|
||||
<template #icon>
|
||||
<icon name="el-icon-Plus" />
|
||||
</template>
|
||||
新增
|
||||
</el-button>
|
||||
</div>
|
||||
<el-table size="large" :data="lists">
|
||||
<el-table size="large" :data="pager.lists" v-loading="pager.loading">
|
||||
<el-table-column label="规则名称" prop="name" min-width="120" />
|
||||
|
||||
<el-table-column label="关键词" prop="keyword" min-width="120" />
|
||||
|
|
@ -34,6 +39,7 @@
|
|||
<el-table-column label="状态" min-width="120">
|
||||
<template #default="{ row }">
|
||||
<el-switch
|
||||
v-perms="['channel:oaReplyKeyword:status']"
|
||||
v-model="row.status"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
|
|
@ -44,24 +50,39 @@
|
|||
<el-table-column label="排序" prop="sort" min-width="120" />
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button type="primary" link @click="handleEdit(row)"> 编辑 </el-button>
|
||||
<el-button type="danger" link @click="handleDelete(row.id)">
|
||||
<el-button
|
||||
v-perms="['channel:oaReplyKeyword:edit']"
|
||||
type="primary"
|
||||
link
|
||||
@click="handleEdit(row)"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-perms="['channel:oaReplyKeyword:del']"
|
||||
type="danger"
|
||||
link
|
||||
@click="handleDelete(row.id)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="flex justify-end mt-4">
|
||||
<pagination v-model="pager" @change="getLists" />
|
||||
</div>
|
||||
</el-card>
|
||||
<edit-popup v-if="showEdit" ref="editRef" @success="getLists" @close="showEdit = false" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { oaReplyDel, getOaReplyList, changeOaReplyStatus } from '@/api/channel/wx_oa'
|
||||
import { usePaging } from '@/hooks/usePaging'
|
||||
import feedback from '@/utils/feedback'
|
||||
import EditPopup from './edit.vue'
|
||||
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
||||
const showEdit = ref(false)
|
||||
const lists = ref()
|
||||
|
||||
const getMatchingType = computed(() => {
|
||||
return (val: number) => {
|
||||
|
|
@ -82,34 +103,37 @@ const getContentType = computed(() => {
|
|||
}
|
||||
}
|
||||
})
|
||||
|
||||
const getLists = async () => {
|
||||
lists.value = await getOaReplyList({ type: 'keyword' })
|
||||
}
|
||||
const type = 'keyword'
|
||||
const { pager, getLists } = usePaging({
|
||||
fetchFun: getOaReplyList,
|
||||
params: {
|
||||
type
|
||||
}
|
||||
})
|
||||
|
||||
const handleAdd = async () => {
|
||||
showEdit.value = true
|
||||
await nextTick()
|
||||
editRef.value?.open('add', 'keyword')
|
||||
editRef.value?.open('add', type)
|
||||
}
|
||||
|
||||
const handleEdit = async (data: any) => {
|
||||
showEdit.value = true
|
||||
await nextTick()
|
||||
editRef.value?.open('edit', 'keyword')
|
||||
editRef.value?.open('edit', type)
|
||||
editRef.value?.getDetail(data)
|
||||
}
|
||||
|
||||
const handleDelete = async (id: number) => {
|
||||
await feedback.confirm('确定要删除?')
|
||||
await oaReplyDel({ id })
|
||||
await oaReplyDel({ id, type })
|
||||
feedback.msgSuccess('删除成功')
|
||||
getLists()
|
||||
}
|
||||
|
||||
const changeStatus = async (id: number) => {
|
||||
try {
|
||||
await changeOaReplyStatus({ id })
|
||||
await changeOaReplyStatus({ id, type })
|
||||
feedback.msgSuccess('修改成功')
|
||||
getLists()
|
||||
} catch (error) {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
<el-radio :label="0">关闭</el-radio>
|
||||
</el-radio-group>
|
||||
|
||||
<div class="form-tips">默认开始,关闭则前端不显示该功能</div>
|
||||
<div class="form-tips">默认开启,关闭则前端不显示该功能</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
|
|
|||
Loading…
Reference in New Issue