Skip to content

Commit 06e1e27

Browse files
committed
邮箱账号,增加详情弹窗
1 parent 37ffc2b commit 06e1e27

File tree

3 files changed

+49
-2
lines changed

3 files changed

+49
-2
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<template>
2+
<Dialog title="详情" v-model="dialogVisible">
3+
<Descriptions :schema="allSchemas.detailSchema" :data="detailData" />
4+
</Dialog>
5+
</template>
6+
<script setup lang="ts">
7+
import * as MailAccountApi from '@/api/system/mail/account'
8+
import { allSchemas } from './account.data'
9+
10+
const dialogVisible = ref(false) // 弹窗的是否展示
11+
const detailLoading = ref(false) // 表单的加载中
12+
const detailData = ref() // 详情数据
13+
14+
/** 打开弹窗 */
15+
const open = async (id: number) => {
16+
dialogVisible.value = true
17+
// 设置数据
18+
detailLoading.value = true
19+
try {
20+
detailData.value = await MailAccountApi.getMailAccount(id)
21+
} finally {
22+
detailLoading.value = false
23+
}
24+
}
25+
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
26+
</script>

src/views/system/mail/account/account.data.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,16 @@ const crudSchemas = reactive<CrudSchema[]>([
6161
label: '创建时间',
6262
field: 'createTime',
6363
isForm: false,
64-
formatter: dateFormatter
64+
formatter: dateFormatter,
65+
detail: {
66+
dateFormat: 'YYYY-MM-DD HH:mm:ss'
67+
}
6568
},
6669
{
6770
label: '操作',
6871
field: 'action',
69-
isForm: false
72+
isForm: false,
73+
isDetail: false
7074
}
7175
])
7276
export const { allSchemas } = useCrudSchemas(crudSchemas)

src/views/system/mail/account/index.vue

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@
3939
>
4040
编辑
4141
</el-button>
42+
<el-button
43+
link
44+
type="primary"
45+
@click="openDetail(row.id)"
46+
v-hasPermi="['system:mail-account:query']"
47+
>
48+
详情
49+
</el-button>
4250
<el-button
4351
link
4452
type="danger"
@@ -53,11 +61,14 @@
5361

5462
<!-- 表单弹窗:添加/修改 -->
5563
<MailAccountForm ref="formRef" @success="getList" />
64+
<!-- 详情弹窗 -->
65+
<MailAccountDetail ref="detailRef" />
5666
</template>
5767
<script setup lang="ts" name="MailAccount">
5868
import { allSchemas } from './account.data'
5969
import * as MailAccountApi from '@/api/system/mail/account'
6070
import MailAccountForm from './MailAccountForm.vue'
71+
import MailAccountDetail from './MailAccountDetail.vue'
6172
6273
// tableObject:表格的属性对象,可获得分页大小、条数等属性
6374
// tableMethods:表格的操作对象,可进行获得分页、删除记录等操作
@@ -75,6 +86,12 @@ const openForm = (type: string, id?: number) => {
7586
formRef.value.open(type, id)
7687
}
7788
89+
/** 详情操作 */
90+
const detailRef = ref()
91+
const openDetail = (id: number) => {
92+
detailRef.value.open(id)
93+
}
94+
7895
/** 删除按钮操作 */
7996
const handleDelete = (id: number) => {
8097
tableMethods.delList(id, false)

0 commit comments

Comments
 (0)