1. 统一化代码

2. 增加 DocAlert 关联文档
This commit is contained in:
YunaiV
2023-04-05 20:13:35 +08:00
parent bb88e3d77c
commit 4404554cfc
111 changed files with 640 additions and 567 deletions

View File

@ -10,7 +10,6 @@
<script setup lang="ts">
import * as MailAccountApi from '@/api/system/mail/account'
import { rules, allSchemas } from './account.data'
const { t } = useI18n() //
const message = useMessage() //
@ -21,7 +20,7 @@ const formType = ref('') // 表单的类型create - 新增update - 修改
const formRef = ref() // Ref
/** 打开弹窗 */
const openModal = async (type: string, id?: number) => {
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
@ -36,7 +35,7 @@ const openModal = async (type: string, id?: number) => {
}
}
}
defineExpose({ openModal }) // openModal
defineExpose({ open }) // open
/** 提交表单 */
const emit = defineEmits(['success']) // success

View File

@ -1,6 +1,5 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
const { t } = useI18n() // 国际化
// 表单校验

View File

@ -1,23 +1,25 @@
<template>
<doc-alert title="邮件配置" url="https://doc.iocoder.cn/mail" />
<!-- 搜索工作栏 -->
<content-wrap>
<ContentWrap>
<Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams">
<!-- 新增等操作按钮 -->
<template #actionMore>
<el-button
type="primary"
plain
@click="openModal('create')"
@click="openForm('create')"
v-hasPermi="['system:mail-account:create']"
>
<Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button>
</template>
</Search>
</content-wrap>
</ContentWrap>
<!-- 列表 -->
<content-wrap>
<ContentWrap>
<Table
:columns="allSchemas.tableColumns"
:data="tableObject.tableList"
@ -32,7 +34,7 @@
<el-button
link
type="primary"
@click="openModal('update', row.id)"
@click="openForm('update', row.id)"
v-hasPermi="['system:mail-account:update']"
>
编辑
@ -47,15 +49,15 @@
</el-button>
</template>
</Table>
</content-wrap>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<mail-account-form ref="modalRef" @success="getList" />
<MailAccountForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts" name="MailAccount">
import { allSchemas } from './account.data'
import * as MailAccountApi from '@/api/system/mail/account'
import MailAccountForm from './form.vue'
import MailAccountForm from './MailAccountForm.vue'
// tableObject表格的属性对象可获得分页大小、条数等属性
// tableMethods表格的操作对象可进行获得分页、删除记录等操作
@ -68,9 +70,9 @@ const { tableObject, tableMethods } = useTable({
const { getList, setSearchParams } = tableMethods
/** 添加/修改操作 */
const modalRef = ref()
const openModal = (type: string, id?: number) => {
modalRef.value.openModal(type, id)
const formRef = ref()
const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
}
/** 删除按钮操作 */

View File

@ -17,7 +17,7 @@ const detailLoading = ref(false) // 表单的加载中
const detailData = ref() //
/** 打开弹窗 */
const openModal = async (id: number) => {
const open = async (id: number) => {
dialogVisible.value = true
//
detailLoading.value = true
@ -27,5 +27,5 @@ const openModal = async (id: number) => {
detailLoading.value = false
}
}
defineExpose({ openModal }) // openModal
defineExpose({ open }) // open
</script>

View File

@ -1,11 +1,13 @@
<template>
<doc-alert title="邮件配置" url="https://doc.iocoder.cn/mail" />
<!-- 搜索工作栏 -->
<content-wrap>
<ContentWrap>
<Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</content-wrap>
</ContentWrap>
<!-- 列表 -->
<content-wrap>
<ContentWrap>
<Table
:columns="allSchemas.tableColumns"
:data="tableObject.tableList"
@ -20,22 +22,22 @@
<el-button
link
type="primary"
@click="openModal(row.id)"
@click="openDetail(row.id)"
v-hasPermi="['system:mail-log:query']"
>
详情
</el-button>
</template>
</Table>
</content-wrap>
</ContentWrap>
<!-- 表单弹窗详情 -->
<mail-log-detail ref="modalRef" />
<mail-log-detail ref="detailRef" />
</template>
<script setup lang="ts" name="MailLog">
import { allSchemas } from './log.data'
import * as MailLogApi from '@/api/system/mail/log'
import MailLogDetail from './detail.vue'
import MailLogDetail from './MailLogDetail.vue'
// tableObject表格的属性对象可获得分页大小、条数等属性
// tableMethods表格的操作对象可进行获得分页、删除记录等操作
@ -47,9 +49,9 @@ const { tableObject, tableMethods } = useTable({
const { getList, setSearchParams } = tableMethods
/** 详情操作 */
const modalRef = ref()
const openModal = (id: number) => {
modalRef.value.openModal(id)
const detailRef = ref()
const openDetail = (id: number) => {
detailRef.value.open(id)
}
/** 初始化 **/

View File

@ -3,7 +3,7 @@ import { dateFormatter } from '@/utils/formatTime'
import * as MailAccountApi from '@/api/system/mail/account'
// 邮箱账号的列表
const accounts = await MailAccountApi.getSimpleMailAccountList()
const accountList = await MailAccountApi.getSimpleMailAccountList()
// CrudSchemahttps://kailong110120130.gitee.io/vue-element-plus-admin-doc/hooks/useCrudSchemas.html
const crudSchemas = reactive<CrudSchema[]>([
@ -74,7 +74,7 @@ const crudSchemas = reactive<CrudSchema[]>([
search: {
show: true,
component: 'Select',
api: () => accounts,
api: () => accountList,
componentProps: {
optionsAlias: {
labelField: 'mail',

View File

@ -16,7 +16,6 @@
<script setup lang="ts">
import * as MailTemplateApi from '@/api/system/mail/template'
import { allSchemas, rules } from './template.data'
const { t } = useI18n() //
const message = useMessage() //
@ -27,7 +26,7 @@ const formType = ref('') // 表单的类型create - 新增update - 修改
const formRef = ref() // Ref
/** 打开弹窗 */
const openModal = async (type: string, id?: number) => {
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
@ -42,7 +41,7 @@ const openModal = async (type: string, id?: number) => {
}
}
}
defineExpose({ openModal }) // openModal
defineExpose({ open }) // open
/** 提交表单 */
const emit = defineEmits(['success']) // success

View File

@ -33,7 +33,6 @@
</template>
<script setup lang="ts">
import * as MailTemplateApi from '@/api/system/mail/template'
const message = useMessage() //
const dialogVisible = ref(false) //
@ -53,7 +52,7 @@ const formRules = reactive({
const formRef = ref() // Ref
/** 打开弹窗 */
const openModal = async (id: number) => {
const open = async (id: number) => {
dialogVisible.value = true
resetForm()
//
@ -76,7 +75,7 @@ const openModal = async (id: number) => {
formLoading.value = false
}
}
defineExpose({ openModal }) // openModal
defineExpose({ open }) // open
/** 提交表单 */
const submitForm = async () => {

View File

@ -1,23 +1,25 @@
<template>
<doc-alert title="邮件配置" url="https://doc.iocoder.cn/mail" />
<!-- 搜索工作栏 -->
<content-wrap>
<ContentWrap>
<Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams">
<!-- 新增等操作按钮 -->
<template #actionMore>
<el-button
type="primary"
plain
@click="openModal('create')"
@click="openForm('create')"
v-hasPermi="['system:mail-account:create']"
>
<Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button>
</template>
</Search>
</content-wrap>
</ContentWrap>
<!-- 列表 -->
<content-wrap>
<ContentWrap>
<Table
:columns="allSchemas.tableColumns"
:data="tableObject.tableList"
@ -32,7 +34,7 @@
<el-button
link
type="primary"
@click="openSend(row.id)"
@click="openSendForm(row.id)"
v-hasPermi="['system:mail-template:send-mail']"
>
测试
@ -40,7 +42,7 @@
<el-button
link
type="primary"
@click="openModal('update', row.id)"
@click="openForm('update', row.id)"
v-hasPermi="['system:mail-template:update']"
>
编辑
@ -55,19 +57,19 @@
</el-button>
</template>
</Table>
</content-wrap>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<mail-template-form ref="modalRef" @success="getList" />
<MailTemplateForm ref="formRef" @success="getList" />
<!-- 表单弹窗发送测试 -->
<mail-template-send ref="sendRef" />
<MailTemplateSendForm ref="sendFormRef" />
</template>
<script setup lang="ts" name="MailTemplate">
import { allSchemas } from './template.data'
import * as MailTemplateApi from '@/api/system/mail/template'
import MailTemplateForm from './form.vue'
import MailTemplateSend from './send.vue'
import MailTemplateForm from './MailTemplateForm.vue'
import MailTemplateSendForm from './MailTemplateSendForm.vue'
// tableObject表格的属性对象可获得分页大小、条数等属性
// tableMethods表格的操作对象可进行获得分页、删除记录等操作
@ -80,9 +82,9 @@ const { tableObject, tableMethods } = useTable({
const { getList, setSearchParams } = tableMethods
/** 添加/修改操作 */
const modalRef = ref()
const openModal = (type: string, id?: number) => {
modalRef.value.openModal(type, id)
const formRef = ref()
const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
}
/** 删除按钮操作 */
@ -91,9 +93,9 @@ const handleDelete = (id: number) => {
}
/** 发送测试操作 */
const sendRef = ref()
const openSend = (id: number) => {
sendRef.value.openModal(id)
const sendFormRef = ref()
const openSendForm = (id: number) => {
sendFormRef.value.open(id)
}
/** 初始化 **/

View File

@ -4,7 +4,7 @@ import { TableColumn } from '@/types/table'
import * as MailAccountApi from '@/api/system/mail/account'
// 邮箱账号的列表
const accounts = await MailAccountApi.getSimpleMailAccountList()
const accountList = await MailAccountApi.getSimpleMailAccountList()
// 表单校验
export const rules = reactive({
@ -49,12 +49,12 @@ const crudSchemas = reactive<CrudSchema[]>([
field: 'accountId',
width: '200px',
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return accounts.find((account) => account.id === cellValue)?.mail
return accountList.find((account) => account.id === cellValue)?.mail
},
search: {
show: true,
component: 'Select',
api: () => accounts,
api: () => accountList,
componentProps: {
optionsAlias: {
labelField: 'mail',
@ -64,7 +64,7 @@ const crudSchemas = reactive<CrudSchema[]>([
},
form: {
component: 'Select',
api: () => accounts,
api: () => accountList,
componentProps: {
optionsAlias: {
labelField: 'mail',