From f1a80fe558ea459f37af552487e4c8cb40488e30 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Fri, 17 Mar 2023 00:02:45 +0800 Subject: [PATCH] =?UTF-8?q?vue3=20=E9=87=8D=E6=9E=84=EF=BC=9A=E9=82=AE?= =?UTF-8?q?=E4=BB=B6=E8=B4=A6=E5=8F=B7=E7=9A=84=E5=88=97=E8=A1=A8=20+=20?= =?UTF-8?q?=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/mail/account/account.data.ts | 102 +++++------ src/views/system/mail/account/index.vue | 167 +++--------------- 2 files changed, 77 insertions(+), 192 deletions(-) diff --git a/src/views/system/mail/account/account.data.ts b/src/views/system/mail/account/account.data.ts index bd05ce4f..8555a7e3 100644 --- a/src/views/system/mail/account/account.data.ts +++ b/src/views/system/mail/account/account.data.ts @@ -1,10 +1,12 @@ -import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas' +import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas' +import { DictTag } from '@/components/DictTag' +import { TableColumn } from '@/types/table' +import { dateFormatter } from '@/utils/formatTime' const { t } = useI18n() // 国际化 // 表单校验 export const rules = reactive({ - // mail: [required], mail: [ { required: true, message: t('profile.rules.mail'), trigger: 'blur' }, { @@ -21,55 +23,49 @@ export const rules = reactive({ }) // CrudSchema -const crudSchemas = reactive({ - primaryKey: 'id', // 默认的主键 ID - primaryTitle: '编号', - primaryType: 'id', - action: true, - actionWidth: '200', // 3 个按钮默认 200,如有删减对应增减即可 - columns: [ - { - title: '邮箱', - field: 'mail', - isSearch: true - }, - { - title: '用户名', - field: 'username', - isSearch: true - }, - { - title: '密码', - field: 'password', - isTable: false - }, - { - title: 'SMTP 服务器域名', - field: 'host' - }, - { - title: 'SMTP 服务器端口', - field: 'port', - form: { - component: 'InputNumber', - value: 465 - } - }, - { - title: '是否开启 SSL', - field: 'sslEnable', - dictType: DICT_TYPE.INFRA_BOOLEAN_STRING, - dictClass: 'boolean' - }, - { - title: '创建时间', - field: 'createTime', - isForm: false, - formatter: 'formatDate', - table: { - width: 180 - } +const crudSchemas = reactive([ + { + label: '邮箱', + field: 'mail', + isSearch: true + }, + { + label: '用户名', + field: 'username', + isSearch: true + }, + { + label: '密码', + field: 'password', + isTable: false + }, + { + label: 'SMTP 服务器域名', + field: 'host' + }, + { + label: 'SMTP 服务器端口', + field: 'port', + form: { + component: 'InputNumber', + value: 465 } - ] -}) -export const { allSchemas } = useVxeCrudSchemas(crudSchemas) + }, + { + label: '是否开启 SSL', + field: 'sslEnable', + formatter: (_: Recordable, __: TableColumn, cellValue: boolean) => { + return h(DictTag, { + type: DICT_TYPE.INFRA_BOOLEAN_STRING, + value: cellValue + }) + } + }, + { + label: '创建时间', + field: 'createTime', + isForm: false, + formatter: dateFormatter + } +]) +export const { allSchemas } = useCrudSchemas(crudSchemas) diff --git a/src/views/system/mail/account/index.vue b/src/views/system/mail/account/index.vue index 7c4ad0f9..821c7c73 100644 --- a/src/views/system/mail/account/index.vue +++ b/src/views/system/mail/account/index.vue @@ -1,151 +1,40 @@