feat:【antd/ele】【mp】autoReply 迁移完成
This commit is contained in:
@@ -25,7 +25,6 @@ export function useGridColumns(
|
|||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关键词列(仅关键词回复显示)
|
// 关键词列(仅关键词回复显示)
|
||||||
if (msgType === AutoReplyMsgType.Keyword) {
|
if (msgType === AutoReplyMsgType.Keyword) {
|
||||||
columns.push({
|
columns.push({
|
||||||
@@ -34,7 +33,6 @@ export function useGridColumns(
|
|||||||
minWidth: 150,
|
minWidth: 150,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 匹配类型列(仅关键词回复显示)
|
// 匹配类型列(仅关键词回复显示)
|
||||||
if (msgType === AutoReplyMsgType.Keyword) {
|
if (msgType === AutoReplyMsgType.Keyword) {
|
||||||
columns.push({
|
columns.push({
|
||||||
@@ -47,7 +45,6 @@ export function useGridColumns(
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 回复消息类型列
|
// 回复消息类型列
|
||||||
columns.push(
|
columns.push(
|
||||||
{
|
{
|
||||||
@@ -84,7 +81,6 @@ export function useGridColumns(
|
|||||||
/** 新增/修改的表单 */
|
/** 新增/修改的表单 */
|
||||||
export function useFormSchema(msgType: AutoReplyMsgType): VbenFormSchema[] {
|
export function useFormSchema(msgType: AutoReplyMsgType): VbenFormSchema[] {
|
||||||
const schema: VbenFormSchema[] = [];
|
const schema: VbenFormSchema[] = [];
|
||||||
|
|
||||||
// 消息类型(仅消息回复显示)
|
// 消息类型(仅消息回复显示)
|
||||||
if (msgType === AutoReplyMsgType.Message) {
|
if (msgType === AutoReplyMsgType.Message) {
|
||||||
schema.push({
|
schema.push({
|
||||||
@@ -99,7 +95,6 @@ export function useFormSchema(msgType: AutoReplyMsgType): VbenFormSchema[] {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 匹配类型(仅关键词回复显示)
|
// 匹配类型(仅关键词回复显示)
|
||||||
if (msgType === AutoReplyMsgType.Keyword) {
|
if (msgType === AutoReplyMsgType.Keyword) {
|
||||||
schema.push({
|
schema.push({
|
||||||
@@ -117,7 +112,6 @@ export function useFormSchema(msgType: AutoReplyMsgType): VbenFormSchema[] {
|
|||||||
rules: 'required',
|
rules: 'required',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关键词(仅关键词回复显示)
|
// 关键词(仅关键词回复显示)
|
||||||
if (msgType === AutoReplyMsgType.Keyword) {
|
if (msgType === AutoReplyMsgType.Keyword) {
|
||||||
schema.push({
|
schema.push({
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import type { MpAutoReplyApi } from '#/api/mp/autoReply';
|
|||||||
|
|
||||||
import { computed, nextTick, ref } from 'vue';
|
import { computed, nextTick, ref } from 'vue';
|
||||||
|
|
||||||
import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||||
import { AutoReplyMsgType } from '@vben/constants';
|
import { AutoReplyMsgType } from '@vben/constants';
|
||||||
import { IconifyIcon } from '@vben/icons';
|
import { IconifyIcon } from '@vben/icons';
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ import { $t } from '#/locales';
|
|||||||
import { WxAccountSelect } from '#/views/mp/components';
|
import { WxAccountSelect } from '#/views/mp/components';
|
||||||
|
|
||||||
import { useGridColumns, useGridFormSchema } from './data';
|
import { useGridColumns, useGridFormSchema } from './data';
|
||||||
import ReplyContentCell from './modules/content.vue';
|
import ReplyContent from './modules/content.vue';
|
||||||
import Form from './modules/form.vue';
|
import Form from './modules/form.vue';
|
||||||
|
|
||||||
defineOptions({ name: 'MpAutoReply' });
|
defineOptions({ name: 'MpAutoReply' });
|
||||||
@@ -78,8 +78,8 @@ async function handleCreate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 修改自动回复 */
|
/** 修改自动回复 */
|
||||||
async function handleEdit(row: any) {
|
async function handleEdit(row: MpAutoReplyApi.AutoReply) {
|
||||||
const data = (await getAutoReply(row.id)) as any;
|
const data = await getAutoReply(row.id!);
|
||||||
formModalApi
|
formModalApi
|
||||||
.setData({
|
.setData({
|
||||||
msgType: Number(msgType.value) as AutoReplyMsgType,
|
msgType: Number(msgType.value) as AutoReplyMsgType,
|
||||||
@@ -90,15 +90,14 @@ async function handleEdit(row: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 删除自动回复 */
|
/** 删除自动回复 */
|
||||||
async function handleDelete(row: any) {
|
async function handleDelete(row: MpAutoReplyApi.AutoReply) {
|
||||||
await confirm('是否确认删除此数据?');
|
|
||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
content: $t('ui.actionMessage.deleting', ['自动回复']),
|
content: $t('ui.actionMessage.deleting', ['自动回复']),
|
||||||
duration: 0,
|
duration: 0,
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await deleteAutoReply(row.id);
|
await deleteAutoReply(row.id!);
|
||||||
message.success('删除成功');
|
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||||
handleRefresh();
|
handleRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
@@ -184,7 +183,6 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
</Tabs.TabPane>
|
</Tabs.TabPane>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</template>
|
</template>
|
||||||
<!-- 第三层:table -->
|
|
||||||
<template #toolbar-tools>
|
<template #toolbar-tools>
|
||||||
<TableAction
|
<TableAction
|
||||||
v-if="showCreateButton"
|
v-if="showCreateButton"
|
||||||
@@ -200,7 +198,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #replyContent="{ row }">
|
<template #replyContent="{ row }">
|
||||||
<ReplyContentCell :row="row" />
|
<ReplyContent :row="row" />
|
||||||
</template>
|
</template>
|
||||||
<template #actions="{ row }">
|
<template #actions="{ row }">
|
||||||
<TableAction
|
<TableAction
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ export function useGridColumns(
|
|||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关键词列(仅关键词回复显示)
|
// 关键词列(仅关键词回复显示)
|
||||||
if (msgType === AutoReplyMsgType.Keyword) {
|
if (msgType === AutoReplyMsgType.Keyword) {
|
||||||
columns.push({
|
columns.push({
|
||||||
@@ -34,7 +33,6 @@ export function useGridColumns(
|
|||||||
minWidth: 150,
|
minWidth: 150,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 匹配类型列(仅关键词回复显示)
|
// 匹配类型列(仅关键词回复显示)
|
||||||
if (msgType === AutoReplyMsgType.Keyword) {
|
if (msgType === AutoReplyMsgType.Keyword) {
|
||||||
columns.push({
|
columns.push({
|
||||||
@@ -47,7 +45,6 @@ export function useGridColumns(
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 回复消息类型列
|
// 回复消息类型列
|
||||||
columns.push(
|
columns.push(
|
||||||
{
|
{
|
||||||
@@ -84,7 +81,6 @@ export function useGridColumns(
|
|||||||
/** 新增/修改的表单 */
|
/** 新增/修改的表单 */
|
||||||
export function useFormSchema(msgType: AutoReplyMsgType): VbenFormSchema[] {
|
export function useFormSchema(msgType: AutoReplyMsgType): VbenFormSchema[] {
|
||||||
const schema: VbenFormSchema[] = [];
|
const schema: VbenFormSchema[] = [];
|
||||||
|
|
||||||
// 消息类型(仅消息回复显示)
|
// 消息类型(仅消息回复显示)
|
||||||
if (msgType === AutoReplyMsgType.Message) {
|
if (msgType === AutoReplyMsgType.Message) {
|
||||||
schema.push({
|
schema.push({
|
||||||
@@ -99,7 +95,6 @@ export function useFormSchema(msgType: AutoReplyMsgType): VbenFormSchema[] {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 匹配类型(仅关键词回复显示)
|
// 匹配类型(仅关键词回复显示)
|
||||||
if (msgType === AutoReplyMsgType.Keyword) {
|
if (msgType === AutoReplyMsgType.Keyword) {
|
||||||
schema.push({
|
schema.push({
|
||||||
@@ -117,7 +112,6 @@ export function useFormSchema(msgType: AutoReplyMsgType): VbenFormSchema[] {
|
|||||||
rules: 'required',
|
rules: 'required',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关键词(仅关键词回复显示)
|
// 关键词(仅关键词回复显示)
|
||||||
if (msgType === AutoReplyMsgType.Keyword) {
|
if (msgType === AutoReplyMsgType.Keyword) {
|
||||||
schema.push({
|
schema.push({
|
||||||
|
|||||||
@@ -8,13 +8,7 @@ import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
|||||||
import { AutoReplyMsgType } from '@vben/constants';
|
import { AutoReplyMsgType } from '@vben/constants';
|
||||||
import { IconifyIcon } from '@vben/icons';
|
import { IconifyIcon } from '@vben/icons';
|
||||||
|
|
||||||
import {
|
import { ElLoading, ElMessage, ElRow, ElTabPane, ElTabs } from 'element-plus';
|
||||||
ElMessage,
|
|
||||||
ElMessageBox,
|
|
||||||
ElRow,
|
|
||||||
ElTabPane,
|
|
||||||
ElTabs,
|
|
||||||
} from 'element-plus';
|
|
||||||
|
|
||||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
import {
|
import {
|
||||||
@@ -26,7 +20,7 @@ import { $t } from '#/locales';
|
|||||||
import { WxAccountSelect } from '#/views/mp/components';
|
import { WxAccountSelect } from '#/views/mp/components';
|
||||||
|
|
||||||
import { useGridColumns, useGridFormSchema } from './data';
|
import { useGridColumns, useGridFormSchema } from './data';
|
||||||
import Content from './modules/content.vue';
|
import ReplyContent from './modules/content.vue';
|
||||||
import Form from './modules/form.vue';
|
import Form from './modules/form.vue';
|
||||||
|
|
||||||
defineOptions({ name: 'MpAutoReply' });
|
defineOptions({ name: 'MpAutoReply' });
|
||||||
@@ -84,8 +78,8 @@ async function handleCreate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 修改自动回复 */
|
/** 修改自动回复 */
|
||||||
async function handleEdit(row: any) {
|
async function handleEdit(row: MpAutoReplyApi.AutoReply) {
|
||||||
const data = (await getAutoReply(row.id)) as any;
|
const data = await getAutoReply(row.id!);
|
||||||
formModalApi
|
formModalApi
|
||||||
.setData({
|
.setData({
|
||||||
msgType: Number(msgType.value) as AutoReplyMsgType,
|
msgType: Number(msgType.value) as AutoReplyMsgType,
|
||||||
@@ -96,12 +90,17 @@ async function handleEdit(row: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 删除自动回复 */
|
/** 删除自动回复 */
|
||||||
async function handleDelete(row: any) {
|
async function handleDelete(row: MpAutoReplyApi.AutoReply) {
|
||||||
await ElMessageBox.confirm('是否确认删除此数据?');
|
const loadingInstance = ElLoading.service({
|
||||||
|
text: $t('ui.actionMessage.deleting', ['自动回复']),
|
||||||
await deleteAutoReply(row.id);
|
});
|
||||||
ElMessage.success('删除成功');
|
try {
|
||||||
handleRefresh();
|
await deleteAutoReply(row.id!);
|
||||||
|
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
|
||||||
|
handleRefresh();
|
||||||
|
} finally {
|
||||||
|
loadingInstance.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const [FormModal, formModalApi] = useVbenModal({
|
const [FormModal, formModalApi] = useVbenModal({
|
||||||
@@ -184,7 +183,6 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
</ElTabPane>
|
</ElTabPane>
|
||||||
</ElTabs>
|
</ElTabs>
|
||||||
</template>
|
</template>
|
||||||
<!-- 工具栏按钮 -->
|
|
||||||
<template #toolbar-tools>
|
<template #toolbar-tools>
|
||||||
<TableAction
|
<TableAction
|
||||||
v-if="showCreateButton"
|
v-if="showCreateButton"
|
||||||
@@ -200,7 +198,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #replyContent="{ row }">
|
<template #replyContent="{ row }">
|
||||||
<Content :row="row" />
|
<ReplyContent :row="row" />
|
||||||
</template>
|
</template>
|
||||||
<template #actions="{ row }">
|
<template #actions="{ row }">
|
||||||
<TableAction
|
<TableAction
|
||||||
|
|||||||
Reference in New Issue
Block a user