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