提交 | 用户 | 时间
|
820397
|
1 |
<template> |
H |
2 |
<!-- 列表 --> |
|
3 |
<ContentWrap> |
|
4 |
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true"> |
|
5 |
<el-table-column label="编号" align="center" prop="id" /> |
|
6 |
<el-table-column label="名字" align="center" prop="name" /> |
|
7 |
<el-table-column label="班主任" align="center" prop="teacher" /> |
|
8 |
<el-table-column |
|
9 |
label="创建时间" |
|
10 |
align="center" |
|
11 |
prop="createTime" |
|
12 |
:formatter="dateFormatter" |
|
13 |
width="180px" |
|
14 |
/> |
|
15 |
</el-table> |
|
16 |
</ContentWrap> |
|
17 |
</template> |
|
18 |
<script setup lang="ts"> |
|
19 |
import { dateFormatter } from '@/utils/formatTime' |
|
20 |
import * as Demo03StudentApi from '@/api/infra/demo/demo03/inner' |
|
21 |
|
|
22 |
const { t } = useI18n() // 国际化 |
|
23 |
const message = useMessage() // 消息弹窗 |
|
24 |
|
|
25 |
const props = defineProps<{ |
|
26 |
studentId: undefined // 学生编号(主表的关联字段) |
|
27 |
}>() |
|
28 |
const loading = ref(false) // 列表的加载中 |
|
29 |
const list = ref([]) // 列表的数据 |
|
30 |
|
|
31 |
/** 查询列表 */ |
|
32 |
const getList = async () => { |
|
33 |
loading.value = true |
|
34 |
try { |
|
35 |
const data = await Demo03StudentApi.getDemo03GradeByStudentId(props.studentId) |
|
36 |
if (!data) { |
|
37 |
return |
|
38 |
} |
|
39 |
list.value.push(data) |
|
40 |
} finally { |
|
41 |
loading.value = false |
|
42 |
} |
|
43 |
} |
|
44 |
|
|
45 |
/** 搜索按钮操作 */ |
|
46 |
const handleQuery = () => { |
|
47 |
queryParams.pageNo = 1 |
|
48 |
getList() |
|
49 |
} |
|
50 |
|
|
51 |
/** 初始化 **/ |
|
52 |
onMounted(() => { |
|
53 |
getList() |
|
54 |
}) |
|
55 |
</script> |