fixbug: 🐛 修改邮件模板是否默认问题

This commit is contained in:
bunny 2024-12-18 22:31:36 +08:00
parent c40b65cf66
commit b799e097c2
8 changed files with 62 additions and 26 deletions

View File

@ -5,9 +5,7 @@ import { rules } from '@/views/configuration/emailTemplate/utils/columns';
import { FormProps } from '@/views/configuration/emailTemplate/utils/types';
import { $t } from '@/plugins/i18n';
import { useEmailTemplateStore } from '@/store/configuration/emailTemplate';
import { useRenderIcon } from '@/components/CommonIcon/src/hooks';
import View from '@iconify-icons/ep/view';
import { viewTemplate } from '@/views/configuration/emailTemplate/utils/hooks';
import { usePublicHooks } from '@/views/hooks';
const props = withDefaults(defineProps<FormProps>(), {
formInline: () => ({
@ -17,6 +15,8 @@ const props = withDefaults(defineProps<FormProps>(), {
emailUser: undefined,
//
subject: undefined,
//
isDefault: false,
//
body: undefined,
//
@ -24,6 +24,8 @@ const props = withDefaults(defineProps<FormProps>(), {
}),
});
//
const { switchStyle } = usePublicHooks();
const formRef = ref<FormInstance>();
const form = ref(props.formInline);
const emailTemplateStore = useEmailTemplateStore();
@ -54,12 +56,14 @@ defineExpose({ formRef });
<el-input v-model="form.subject" autocomplete="off" type="text" />
</el-form-item>
<!-- 用户状态 -->
<el-form-item :label="$t('isDefault')" prop="isDefault">
<el-switch v-model="form.isDefault" :active-text="$t('enable')" :active-value="true" :inactive-text="$t('disable')" :inactive-value="false" :style="switchStyle" inline-prompt />
</el-form-item>
<!-- 配置邮件发送体 -->
<el-form-item :label="$t('emailTemplate_body')" prop="body">
<el-input v-model="form.body" :autosize="{ minRows: 2, maxRows: 26 }" autocomplete="off" type="textarea" />
<el-button :icon="useRenderIcon(View)" class="reset-margin" link type="primary" @click="viewTemplate(form.body)">
{{ $t('viewTemplate') }}
</el-button>
</el-form-item>
<!--配置邮件类型-->

View File

@ -7,7 +7,6 @@ import PureTable from '@pureadmin/table';
import { onAdd, onDelete, onDeleteBatch, onSearch, onUpdate, selectRows, viewTemplate } from '@/views/configuration/emailTemplate/utils/hooks';
import Delete from '@iconify-icons/ep/delete';
import EditPen from '@iconify-icons/ep/edit-pen';
import View from '@iconify-icons/ep/view';
import Refresh from '@iconify-icons/ep/refresh';
import { selectUserinfo } from '@/components/Table/Userinfo/columns';
import { $t } from '@/plugins/i18n';
@ -15,6 +14,7 @@ import { useEmailTemplateStore } from '@/store/configuration/emailTemplate.ts';
import { useRenderIcon } from '@/components/CommonIcon/src/hooks';
import { auth } from '@/views/configuration/emailTemplate/utils/auth';
import { hasAuth } from '@/router/utils';
import View from '@iconify-icons/ep/view';
const tableRef = ref();
const formRef = ref();
@ -67,7 +67,9 @@ onMounted(() => {
<el-input v-model="emailTemplateStore.form.type" :placeholder="`${$t('input')}${$t('emailTemplate_type')}`" class="!w-[180px]" clearable />
</el-form-item>
<el-form-item>
<el-button :icon="useRenderIcon('ri:search-line')" :loading="emailTemplateStore.loading" type="primary" @click="onSearch"> {{ $t('search') }} </el-button>
<el-button :icon="useRenderIcon('ri:search-line')" :loading="emailTemplateStore.loading" type="primary" @click="onSearch">
{{ $t('search') }}
</el-button>
<el-button :icon="useRenderIcon(Refresh)" @click="resetForm(formRef)"> {{ $t('buttons.reset') }}</el-button>
</el-form-item>
</el-form>
@ -123,8 +125,12 @@ onMounted(() => {
</template>
<template #operation="{ row }">
<el-button :icon="useRenderIcon(View)" :size="size" class="reset-margin" link type="primary" @click="viewTemplate(row.body)"> {{ $t('viewTemplate') }} </el-button>
<el-button v-if="hasAuth(auth.update)" :icon="useRenderIcon(EditPen)" :size="size" class="reset-margin" link type="primary" @click="onUpdate(row)"> {{ $t('modify') }} </el-button>
<el-button :icon="useRenderIcon(View)" :size="size" class="reset-margin" link type="primary" @click="viewTemplate(row.body)">
{{ $t('view') }}
</el-button>
<el-button v-if="hasAuth(auth.update)" :icon="useRenderIcon(EditPen)" :size="size" class="reset-margin" link type="primary" @click="onUpdate(row)">
{{ $t('modify') }}
</el-button>
<el-popconfirm v-if="hasAuth(auth.deleted)" :title="`${$t('delete')} ${row.templateName}?`" @confirm="onDelete(row)">
<template #reference>
<el-button :icon="useRenderIcon(Delete)" :size="size" class="reset-margin" link type="primary">

View File

@ -1,5 +1,6 @@
import { reactive } from 'vue';
import { $t } from '@/plugins/i18n';
import { ElTag } from 'element-plus';
// 表格列
export const columns: TableColumnList = [
@ -14,12 +15,26 @@ export const columns: TableColumnList = [
// 邮件内容
{ label: $t('emailTemplate_body'), prop: 'body' },
// 邮件类型
{ label: $t('emailTemplate_type'), prop: 'type' },
{ label: $t('emailTemplate_type'), prop: 'summary' },
// 是否默认
{
label: $t('isDefault'),
prop: 'isDefault',
formatter({ isDefault }) {
return isDefault ? (
<ElTag type={'success'}>{$t('default')}</ElTag>
) : (
<ElTag size={'large'} type={'danger'}>
{$t('no_default')}
</ElTag>
);
},
},
{ label: $t('table.updateTime'), prop: 'updateTime', sortable: true, width: 160 },
{ label: $t('table.createTime'), prop: 'createTime', sortable: true, width: 160 },
{ label: $t('table.createUser'), prop: 'createUser', slot: 'createUser', width: 130 },
{ label: $t('table.updateUser'), prop: 'updateUser', slot: 'updateUser', width: 130 },
{ label: $t('table.operation'), fixed: 'right', width: 230, slot: 'operation' },
{ label: $t('table.operation'), fixed: 'right', width: 210, slot: 'operation' },
];
// 添加规则

View File

@ -29,6 +29,7 @@ export function onAdd() {
templateName: undefined,
emailUser: undefined,
subject: undefined,
isDefault: undefined,
body: undefined,
type: undefined,
},
@ -64,6 +65,7 @@ export function onUpdate(row: any) {
templateName: row.templateName,
emailUser: row.emailUser,
subject: row.subject,
isDefault: row.isDefault,
body: row.body,
type: row.type,
},
@ -137,7 +139,7 @@ export const onDeleteBatch = async () => {
/** 查看模板 */
export const viewTemplate = (template: string) => {
addDialog({
title: $t('viewTemplate'),
title: $t('view'),
draggable: true,
fullscreenIcon: true,
closeOnClickModal: false,

View File

@ -6,6 +6,8 @@ export interface FormItemProps {
emailUser: string;
// 主题
subject: string;
// 是否默认
isDefault: boolean;
// 邮件内容
body: string;
// 邮件类型

View File

@ -1,5 +1,5 @@
import { $t } from '@/plugins/i18n';
import { ElTag } from 'element-plus';
import { ElTag, ElText } from 'element-plus';
// 表格列
export const columns: TableColumnList = [
@ -10,13 +10,20 @@ export const columns: TableColumnList = [
// 消息简介
{ label: $t('summary'), prop: 'summary' },
// 发送人昵称
{ label: $t('sendNickname'), prop: 'sendNickname', slot: 'sendNickname' },
{ label: $t('sendNickname'), prop: 'sendNickname', slot: 'sendNickname', width: 130 },
// 接受人昵称
{ label: $t('receivedUserNickname'), prop: 'receivedUserNickname', slot: 'receivedUserNickname' },
{ label: $t('receivedUserNickname'), prop: 'receivedUserNickname', slot: 'receivedUserNickname', width: 130 },
// 消息类型
{ label: $t('messageType'), prop: 'messageType', slot: 'messageType' },
{ label: $t('messageType'), prop: 'messageType', slot: 'messageType', width: 130 },
// 编辑器类型
{ label: $t('editorType'), prop: 'editorType' },
{
label: $t('editorType'),
prop: 'editorType',
width: 130,
formatter({ editorType }) {
return editorType === 'rich' ? <ElText type={'info'}>{editorType}</ElText> : <ElText type={'warning'}>{editorType}</ElText>;
},
},
// 封面
{ label: $t('cover'), prop: 'cover', slot: 'cover', width: 80 },
// 消息等级
@ -33,7 +40,7 @@ export const columns: TableColumnList = [
width: 100,
},
// 消息等级详情
{ label: $t('extra'), prop: 'extra', slot: 'extra' },
{ label: $t('extra'), prop: 'extra', slot: 'extra', width: 130 },
// 0:未读 1:已读
{
label: $t('status'),

View File

@ -6,19 +6,19 @@ export const columns: TableColumnList = [
{ type: 'selection', align: 'left' },
{ type: 'index', index: (index: number) => index + 1, label: '序号', width: 60 },
// 任务名称
{ label: $t('quartzExecuteLog_jobName'), prop: 'jobName' },
{ label: $t('quartzExecuteLog_jobName'), prop: 'jobName', width: 100 },
// 任务分组
{ label: $t('quartzExecuteLog_jobGroup'), prop: 'jobGroup' },
{ label: $t('quartzExecuteLog_jobGroup'), prop: 'jobGroup', width: 100 },
// 执行任务类名
{ label: $t('quartzExecuteLog_jobClassName'), prop: 'jobClassName' },
{ label: $t('quartzExecuteLog_jobClassName'), prop: 'jobClassName', width: 100 },
// 执行任务core表达式
{ label: $t('quartzExecuteLog_cronExpression'), prop: 'cronExpression' },
{ label: $t('quartzExecuteLog_cronExpression'), prop: 'cronExpression', width: 100 },
// 触发器名称
{ label: $t('quartzExecuteLog_triggerName'), prop: 'triggerName' },
{ label: $t('quartzExecuteLog_triggerName'), prop: 'triggerName', width: 100 },
// 执行结果
{ label: $t('quartzExecuteLog_executeResult'), prop: 'executeResult', width: 410, slot: 'executeResult' },
// 执行时间
{ label: $t('quartzExecuteLog_duration'), prop: 'duration' },
{ label: $t('quartzExecuteLog_duration'), prop: 'duration', width: 100 },
{ label: $t('table.updateTime'), prop: 'updateTime', sortable: true, width: 160 },
{ label: $t('table.createTime'), prop: 'createTime', sortable: true, width: 160 },
{ label: $t('table.createUser'), prop: 'createUser', slot: 'createUser', width: 130 },

View File

@ -12,7 +12,7 @@ export const columns: TableColumnList = [
// 登录Ip归属地
{ label: $t('userLoginLog_ipRegion'), prop: 'ipRegion', width: 160 },
// 登录时代理
{ label: $t('userLoginLog_userAgent'), prop: 'userAgent' },
{ label: $t('userLoginLog_userAgent'), prop: 'userAgent', width: 130 },
// 操作类型
{ label: $t('userLoginLog_type'), prop: 'type', width: 130 },
// 标识客户端是否是通过Ajax发送请求的