|
@@ -8,10 +8,50 @@
|
|
|
:inline="true"
|
|
|
label-width="68px"
|
|
|
>
|
|
|
+ <el-form-item label="名字" prop="name">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.name"
|
|
|
+ placeholder="请输入名字"
|
|
|
+ clearable
|
|
|
+ @keyup.enter="handleQuery"
|
|
|
+ class="!w-240px"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="性别" prop="sex">
|
|
|
+ <el-select
|
|
|
+ v-model="queryParams.sex"
|
|
|
+ placeholder="请选择性别"
|
|
|
+ clearable
|
|
|
+ class="!w-240px"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="dict in getIntDictOptions(DICT_TYPE.SYSTEM_USER_SEX)"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+ :value="dict.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="创建时间" prop="createTime">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="queryParams.createTime"
|
|
|
+ value-format="YYYY-MM-DD HH:mm:ss"
|
|
|
+ type="daterange"
|
|
|
+ start-placeholder="开始日期"
|
|
|
+ end-placeholder="结束日期"
|
|
|
+ :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
|
|
+ class="!w-240px"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
|
|
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
|
|
- <el-button type="primary" plain @click="openForm('create')">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ plain
|
|
|
+ @click="openForm('create')"
|
|
|
+ v-hasPermi="['infra:demo03-student:create']"
|
|
|
+ >
|
|
|
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
|
|
</el-button>
|
|
|
<el-button
|
|
@@ -19,7 +59,7 @@
|
|
|
plain
|
|
|
@click="handleExport"
|
|
|
:loading="exportLoading"
|
|
|
- v-hasPermi="['infra:demo-student:export']"
|
|
|
+ v-hasPermi="['infra:demo03-student:export']"
|
|
|
>
|
|
|
<Icon icon="ep:download" class="mr-5px" /> 导出
|
|
|
</el-button>
|
|
@@ -29,37 +69,44 @@
|
|
|
|
|
|
<!-- 列表 -->
|
|
|
<ContentWrap>
|
|
|
- <el-table
|
|
|
- v-loading="loading"
|
|
|
- :data="list"
|
|
|
- :stripe="true"
|
|
|
- :show-overflow-tooltip="true"
|
|
|
- row-key="id"
|
|
|
- >
|
|
|
- <el-table-column type="expand">
|
|
|
+ <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
|
|
+ <el-table-column label="编号" align="center" prop="id" />
|
|
|
+ <el-table-column label="名字" align="center" prop="name" />
|
|
|
+ <el-table-column label="性别" align="center" prop="sex">
|
|
|
<template #default="scope">
|
|
|
- <!-- 子表的表单 -->
|
|
|
- <el-tabs model-value="DemoStudentContact">
|
|
|
- <el-tab-pane label="联系人信息" name="DemoStudentContact">
|
|
|
- <DemoStudentContactList :student-id="scope.row.id" />
|
|
|
- </el-tab-pane>
|
|
|
- <el-tab-pane label="地址信息" name="DemoStudentAddress">
|
|
|
- <DemoStudentAddressList :student-id="scope.row.id" />
|
|
|
- </el-tab-pane>
|
|
|
- </el-tabs>
|
|
|
+ <dict-tag :type="DICT_TYPE.SYSTEM_USER_SEX" :value="scope.row.sex" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="编号" align="center" prop="id" />
|
|
|
+ <el-table-column
|
|
|
+ label="出生日期"
|
|
|
+ align="center"
|
|
|
+ prop="birthday"
|
|
|
+ :formatter="dateFormatter"
|
|
|
+ width="180px"
|
|
|
+ />
|
|
|
+ <el-table-column label="简介" align="center" prop="description" />
|
|
|
+ <el-table-column
|
|
|
+ label="创建时间"
|
|
|
+ align="center"
|
|
|
+ prop="createTime"
|
|
|
+ :formatter="dateFormatter"
|
|
|
+ width="180px"
|
|
|
+ />
|
|
|
<el-table-column label="操作" align="center">
|
|
|
<template #default="scope">
|
|
|
- <el-button link type="primary" @click="openForm('update', scope.row.id)">
|
|
|
+ <el-button
|
|
|
+ link
|
|
|
+ type="primary"
|
|
|
+ @click="openForm('update', scope.row.id)"
|
|
|
+ v-hasPermi="['infra:demo03-student:update']"
|
|
|
+ >
|
|
|
编辑
|
|
|
</el-button>
|
|
|
<el-button
|
|
|
link
|
|
|
type="danger"
|
|
|
@click="handleDelete(scope.row.id)"
|
|
|
- v-hasPermi="['infra:demo-student:delete']"
|
|
|
+ v-hasPermi="['infra:demo03-student:delete']"
|
|
|
>
|
|
|
删除
|
|
|
</el-button>
|
|
@@ -76,27 +123,31 @@
|
|
|
</ContentWrap>
|
|
|
|
|
|
<!-- 表单弹窗:添加/修改 -->
|
|
|
- <DemoStudentForm ref="formRef" @success="getList" />
|
|
|
+ <Demo03StudentForm ref="formRef" @success="getList" />
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
+import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
|
|
+import { dateFormatter } from '@/utils/formatTime'
|
|
|
import download from '@/utils/download'
|
|
|
-import * as DemoStudentApi from '@/api/infra/demo02'
|
|
|
-import DemoStudentForm from './DemoStudentForm.vue'
|
|
|
-import DemoStudentContactList from './DemoStudentContactList.vue'
|
|
|
-import DemoStudentAddressList from './DemoStudentAddressList.vue'
|
|
|
+import * as Demo03StudentApi from '@/api/infra/demo/demo03/normal'
|
|
|
+import Demo03StudentForm from './Demo03StudentForm.vue'
|
|
|
|
|
|
-defineOptions({ name: 'InfraDemoStudent' })
|
|
|
+defineOptions({ name: 'Demo03Student' })
|
|
|
|
|
|
const message = useMessage() // 消息弹窗
|
|
|
const { t } = useI18n() // 国际化
|
|
|
|
|
|
const loading = ref(true) // 列表的加载中
|
|
|
-const total = ref(0) // 列表的总页数
|
|
|
const list = ref([]) // 列表的数据
|
|
|
+const total = ref(0) // 列表的总页数
|
|
|
const queryParams = reactive({
|
|
|
pageNo: 1,
|
|
|
- pageSize: 10
|
|
|
+ pageSize: 10,
|
|
|
+ name: null,
|
|
|
+ sex: null,
|
|
|
+ description: null,
|
|
|
+ createTime: []
|
|
|
})
|
|
|
const queryFormRef = ref() // 搜索的表单
|
|
|
const exportLoading = ref(false) // 导出的加载中
|
|
@@ -105,16 +156,9 @@ const exportLoading = ref(false) // 导出的加载中
|
|
|
const getList = async () => {
|
|
|
loading.value = true
|
|
|
try {
|
|
|
- // const data = await DemoStudentApi.getDemoStudentPage(queryParams)
|
|
|
- list.value = [
|
|
|
- {
|
|
|
- id: 1
|
|
|
- },
|
|
|
- {
|
|
|
- id: 10
|
|
|
- }
|
|
|
- ]
|
|
|
- total.value = 10
|
|
|
+ const data = await Demo03StudentApi.getDemo03StudentPage(queryParams)
|
|
|
+ list.value = data.list
|
|
|
+ total.value = data.total
|
|
|
} finally {
|
|
|
loading.value = false
|
|
|
}
|
|
@@ -134,10 +178,7 @@ const resetQuery = () => {
|
|
|
|
|
|
/** 添加/修改操作 */
|
|
|
const formRef = ref()
|
|
|
-// const demoStudentContactFormRef = ref()
|
|
|
const openForm = (type: string, id?: number) => {
|
|
|
- // console.log(demoStudentContactFormRef, 'xx demoStudentContactFormRef xx')
|
|
|
- // demoStudentContactFormRef.value.validate()
|
|
|
formRef.value.open(type, id)
|
|
|
}
|
|
|
|
|
@@ -147,7 +188,7 @@ const handleDelete = async (id: number) => {
|
|
|
// 删除的二次确认
|
|
|
await message.delConfirm()
|
|
|
// 发起删除
|
|
|
- await DemoStudentApi.deleteDemoStudent(id)
|
|
|
+ await Demo03StudentApi.deleteDemo03Student(id)
|
|
|
message.success(t('common.delSuccess'))
|
|
|
// 刷新列表
|
|
|
await getList()
|
|
@@ -161,7 +202,7 @@ const handleExport = async () => {
|
|
|
await message.exportConfirm()
|
|
|
// 发起导出
|
|
|
exportLoading.value = true
|
|
|
- const data = await DemoStudentApi.exportDemoStudent(queryParams)
|
|
|
+ const data = await Demo03StudentApi.exportDemo03Student(queryParams)
|
|
|
download.excel(data, '学生.xls')
|
|
|
} catch {
|
|
|
} finally {
|
|
@@ -173,4 +214,4 @@ const handleExport = async () => {
|
|
|
onMounted(() => {
|
|
|
getList()
|
|
|
})
|
|
|
-</script>
|
|
|
+</script>
|