代码生成:增加 tree 树形的示例
parent
3d0c4f4422
commit
bbc37613b6
@ -0,0 +1,37 @@
|
|||||||
|
import request from '@/config/axios'
|
||||||
|
|
||||||
|
export interface Demo02CategoryVO {
|
||||||
|
id: number
|
||||||
|
name: string
|
||||||
|
parentId: number
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询示例分类列表
|
||||||
|
export const getDemo02CategoryList = async (params) => {
|
||||||
|
return await request.get({ url: `/infra/demo02-category/list`, params })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询示例分类详情
|
||||||
|
export const getDemo02Category = async (id: number) => {
|
||||||
|
return await request.get({ url: `/infra/demo02-category/get?id=` + id })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增示例分类
|
||||||
|
export const createDemo02Category = async (data: Demo02CategoryVO) => {
|
||||||
|
return await request.post({ url: `/infra/demo02-category/create`, data })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改示例分类
|
||||||
|
export const updateDemo02Category = async (data: Demo02CategoryVO) => {
|
||||||
|
return await request.put({ url: `/infra/demo02-category/update`, data })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除示例分类
|
||||||
|
export const deleteDemo02Category = async (id: number) => {
|
||||||
|
return await request.delete({ url: `/infra/demo02-category/delete?id=` + id })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出示例分类 Excel
|
||||||
|
export const exportDemo02Category = async (params) => {
|
||||||
|
return await request.download({ url: `/infra/demo02-category/export-excel`, params })
|
||||||
|
}
|
||||||
@ -1,49 +0,0 @@
|
|||||||
import request from '@/config/axios'
|
|
||||||
|
|
||||||
export interface DemoStudentVO {
|
|
||||||
id: number
|
|
||||||
}
|
|
||||||
|
|
||||||
// 查询学生列表
|
|
||||||
export const getDemoStudentPage = async (params) => {
|
|
||||||
return await request.get({ url: `/infra/demo-student/page`, params })
|
|
||||||
}
|
|
||||||
|
|
||||||
// 查询学生详情
|
|
||||||
export const getDemoStudent = async (id: number) => {
|
|
||||||
return await request.get({ url: `/infra/demo-student/get?id=` + id })
|
|
||||||
}
|
|
||||||
|
|
||||||
// 新增学生
|
|
||||||
export const createDemoStudent = async (data: DemoStudentVO) => {
|
|
||||||
return await request.post({ url: `/infra/demo-student/create`, data })
|
|
||||||
}
|
|
||||||
|
|
||||||
// 修改学生
|
|
||||||
export const updateDemoStudent = async (data: DemoStudentVO) => {
|
|
||||||
return await request.put({ url: `/infra/demo-student/update`, data })
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除学生
|
|
||||||
export const deleteDemoStudent = async (id: number) => {
|
|
||||||
return await request.delete({ url: `/infra/demo-student/delete?id=` + id })
|
|
||||||
}
|
|
||||||
|
|
||||||
// 导出学生 Excel
|
|
||||||
export const exportDemoStudent = async (params) => {
|
|
||||||
return await request.download({ url: `/infra/demo-student/export-excel`, params })
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获得学生联系人列表
|
|
||||||
export const getDemoStudentContactListByStudentId = async (studentId) => {
|
|
||||||
return await request.get({
|
|
||||||
url: `/infra/demo-student/demo-student/list-by-student-id?studentId=` + studentId
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获得学生地址
|
|
||||||
export const getDemoStudentAddressByStudentId = async (studentId) => {
|
|
||||||
return await request.get({
|
|
||||||
url: `/infra/demo-student/demo-student/get-by-student-id?studentId=` + studentId
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@ -1,58 +0,0 @@
|
|||||||
<template>
|
|
||||||
<el-form
|
|
||||||
ref="formRef"
|
|
||||||
:model="formData"
|
|
||||||
:rules="formRules"
|
|
||||||
label-width="100px"
|
|
||||||
v-loading="formLoading"
|
|
||||||
>
|
|
||||||
<el-form-item label="子字段 1" prop="field1">
|
|
||||||
<el-input v-model="formData.field1" placeholder="请输入字段 1" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="子字段 2" prop="field2">
|
|
||||||
<el-input v-model="formData.field2" placeholder="请输入字段 2" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="子字段 3" prop="field3">
|
|
||||||
<el-input v-model="formData.field3" placeholder="请输入字段 3" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
</template>
|
|
||||||
<script setup lang="ts">
|
|
||||||
const props = defineProps<{
|
|
||||||
studentId: undefined // 学生编号
|
|
||||||
}>()
|
|
||||||
const formLoading = ref(false) // 表单的加载中
|
|
||||||
const formData = ref({})
|
|
||||||
const formRules = reactive({
|
|
||||||
field1: [required]
|
|
||||||
})
|
|
||||||
const formRef = ref() // 表单 Ref
|
|
||||||
|
|
||||||
/** 监听主表的关联字段的变化,加载对应的子表数据 */
|
|
||||||
watch(
|
|
||||||
() => props.studentId,
|
|
||||||
(val) => {
|
|
||||||
if (val) {
|
|
||||||
formData.value = {
|
|
||||||
field2: '番茄',
|
|
||||||
field3: '西瓜'
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
formData.value = {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ immediate: true }
|
|
||||||
)
|
|
||||||
|
|
||||||
/** 表单校验 */
|
|
||||||
const validate = () => {
|
|
||||||
return formRef.value.validate()
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 表单值 **/
|
|
||||||
const getData = () => {
|
|
||||||
return formData.value
|
|
||||||
}
|
|
||||||
|
|
||||||
defineExpose({ validate, getData })
|
|
||||||
</script>
|
|
||||||
Loading…
Reference in New Issue