Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c9d5ec26
authored
Feb 28, 2024
by
puhui999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 主子表 demo03 List props
parent
1694827c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
90 additions
and
74 deletions
+90
-74
src/views/infra/demo/demo03/erp/components/Demo03CourseList.vue
+23
-19
src/views/infra/demo/demo03/erp/components/Demo03GradeList.vue
+23
-19
src/views/infra/demo/demo03/erp/index.vue
+44
-36
No files found.
src/views/infra/demo/demo03/erp/components/Demo03CourseList.vue
View file @
c9d5ec26
...
...
@@ -2,39 +2,40 @@
<!-- 列表 -->
<ContentWrap>
<el-button
type=
"primary
"
v-hasPermi=
"['infra:demo03-student:create']
"
plain
type=
"primary"
@
click=
"openForm('create')"
v-hasPermi=
"['infra:demo03-student:create']"
>
<Icon
icon=
"ep:plus"
class=
"mr-5px"
/>
新增
<Icon
class=
"mr-5px"
icon=
"ep:plus"
/>
新增
</el-button>
<el-table
v-loading=
"loading"
:data=
"list"
:s
tripe=
"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=
"score"
/>
<el-table
v-loading=
"loading"
:data=
"list"
:s
how-overflow-tooltip=
"true"
:stripe
=
"true"
>
<el-table-column
align=
"center"
label=
"编号
"
prop=
"id"
/>
<el-table-column
align=
"center"
label=
"名字
"
prop=
"name"
/>
<el-table-column
align=
"center"
label=
"分数
"
prop=
"score"
/>
<el-table-column
label=
"创建时间
"
:formatter=
"dateFormatter
"
align=
"center"
label=
"创建时间"
prop=
"createTime"
:formatter=
"dateFormatter"
width=
"180px"
/>
<el-table-column
label=
"操作"
align=
"center
"
>
<el-table-column
align=
"center"
label=
"操作
"
>
<template
#
default=
"scope"
>
<el-button
v-hasPermi=
"['infra:demo03-student:update']"
link
type=
"primary"
@
click=
"openForm('update', scope.row.id)"
v-hasPermi=
"['infra:demo03-student:update']"
>
编辑
</el-button>
<el-button
v-hasPermi=
"['infra:demo03-student:delete']"
link
type=
"danger"
@
click=
"handleDelete(scope.row.id)"
v-hasPermi=
"['infra:demo03-student:delete']"
>
删除
</el-button>
...
...
@@ -43,9 +44,9 @@
</el-table>
<!-- 分页 -->
<Pagination
:total=
"total"
v-model:page=
"queryParams.pageNo"
v-model:limit=
"queryParams.pageSize"
v-model:page=
"queryParams.pageNo"
:total=
"total"
@
pagination=
"getList"
/>
</ContentWrap>
...
...
@@ -53,7 +54,7 @@
<Demo03CourseForm
ref=
"formRef"
@
success=
"getList"
/>
</template>
<
script
setup
lang=
"ts"
>
<
script
lang=
"ts"
setup
>
import
{
dateFormatter
}
from
'@/utils/formatTime'
import
*
as
Demo03StudentApi
from
'@/api/infra/demo/demo03/erp'
import
Demo03CourseForm
from
'./Demo03CourseForm.vue'
...
...
@@ -62,7 +63,7 @@ const { t } = useI18n() // 国际化
const
message
=
useMessage
()
// 消息弹窗
const
props
=
defineProps
<
{
studentId
:
undefined
// 学生编号(主表的关联字段)
studentId
?:
number
// 学生编号(主表的关联字段)
}
>
()
const
loading
=
ref
(
false
)
// 列表的加载中
const
list
=
ref
([])
// 列表的数据
...
...
@@ -70,17 +71,20 @@ const total = ref(0) // 列表的总页数
const
queryParams
=
reactive
({
pageNo
:
1
,
pageSize
:
10
,
studentId
:
undefined
studentId
:
undefined
as
unknown
})
/** 监听主表的关联字段的变化,加载对应的子表数据 */
watch
(
()
=>
props
.
studentId
,
(
val
)
=>
{
(
val
:
number
)
=>
{
if
(
!
val
)
{
return
}
queryParams
.
studentId
=
val
handleQuery
()
},
{
immediate
:
fals
e
}
{
immediate
:
true
,
deep
:
tru
e
}
)
/** 查询列表 */
...
...
src/views/infra/demo/demo03/erp/components/Demo03GradeList.vue
View file @
c9d5ec26
...
...
@@ -2,39 +2,40 @@
<!-- 列表 -->
<ContentWrap>
<el-button
type=
"primary
"
v-hasPermi=
"['infra:demo03-student:create']
"
plain
type=
"primary"
@
click=
"openForm('create')"
v-hasPermi=
"['infra:demo03-student:create']"
>
<Icon
icon=
"ep:plus"
class=
"mr-5px"
/>
新增
<Icon
class=
"mr-5px"
icon=
"ep:plus"
/>
新增
</el-button>
<el-table
v-loading=
"loading"
:data=
"list"
:s
tripe=
"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=
"teacher"
/>
<el-table
v-loading=
"loading"
:data=
"list"
:s
how-overflow-tooltip=
"true"
:stripe
=
"true"
>
<el-table-column
align=
"center"
label=
"编号
"
prop=
"id"
/>
<el-table-column
align=
"center"
label=
"名字
"
prop=
"name"
/>
<el-table-column
align=
"center"
label=
"班主任
"
prop=
"teacher"
/>
<el-table-column
label=
"创建时间
"
:formatter=
"dateFormatter
"
align=
"center"
label=
"创建时间"
prop=
"createTime"
:formatter=
"dateFormatter"
width=
"180px"
/>
<el-table-column
label=
"操作"
align=
"center
"
>
<el-table-column
align=
"center"
label=
"操作
"
>
<template
#
default=
"scope"
>
<el-button
v-hasPermi=
"['infra:demo03-student:update']"
link
type=
"primary"
@
click=
"openForm('update', scope.row.id)"
v-hasPermi=
"['infra:demo03-student:update']"
>
编辑
</el-button>
<el-button
v-hasPermi=
"['infra:demo03-student:delete']"
link
type=
"danger"
@
click=
"handleDelete(scope.row.id)"
v-hasPermi=
"['infra:demo03-student:delete']"
>
删除
</el-button>
...
...
@@ -43,9 +44,9 @@
</el-table>
<!-- 分页 -->
<Pagination
:total=
"total"
v-model:page=
"queryParams.pageNo"
v-model:limit=
"queryParams.pageSize"
v-model:page=
"queryParams.pageNo"
:total=
"total"
@
pagination=
"getList"
/>
</ContentWrap>
...
...
@@ -53,7 +54,7 @@
<Demo03GradeForm
ref=
"formRef"
@
success=
"getList"
/>
</template>
<
script
setup
lang=
"ts"
>
<
script
lang=
"ts"
setup
>
import
{
dateFormatter
}
from
'@/utils/formatTime'
import
*
as
Demo03StudentApi
from
'@/api/infra/demo/demo03/erp'
import
Demo03GradeForm
from
'./Demo03GradeForm.vue'
...
...
@@ -62,7 +63,7 @@ const { t } = useI18n() // 国际化
const
message
=
useMessage
()
// 消息弹窗
const
props
=
defineProps
<
{
studentId
:
undefined
// 学生编号(主表的关联字段)
studentId
?:
number
// 学生编号(主表的关联字段)
}
>
()
const
loading
=
ref
(
false
)
// 列表的加载中
const
list
=
ref
([])
// 列表的数据
...
...
@@ -70,17 +71,20 @@ const total = ref(0) // 列表的总页数
const
queryParams
=
reactive
({
pageNo
:
1
,
pageSize
:
10
,
studentId
:
undefined
studentId
:
undefined
as
unknown
})
/** 监听主表的关联字段的变化,加载对应的子表数据 */
watch
(
()
=>
props
.
studentId
,
(
val
)
=>
{
(
val
:
number
)
=>
{
if
(
!
val
)
{
return
}
queryParams
.
studentId
=
val
handleQuery
()
},
{
immediate
:
fals
e
}
{
immediate
:
true
,
deep
:
tru
e
}
)
/** 查询列表 */
...
...
src/views/infra/demo/demo03/erp/index.vue
View file @
c9d5ec26
...
...
@@ -4,23 +4,23 @@
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class=
"-mb-15px"
:model=
"queryParams"
ref=
"queryFormRef"
:inline=
"true"
:model=
"queryParams"
class=
"-mb-15px"
label-width=
"68px"
>
<el-form-item
label=
"名字"
prop=
"name"
>
<el-input
v-model=
"queryParams.name"
placeholder=
"请输入名字
"
class=
"!w-240px
"
clearable
placeholder=
"请输入名字"
@
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-select
v-model=
"queryParams.sex"
class=
"!w-240px"
clearable
placeholder=
"请选择性别
"
>
<el-option
v-for=
"dict in getIntDictOptions(DICT_TYPE.SYSTEM_USER_SEX)"
:key=
"dict.value"
...
...
@@ -32,33 +32,41 @@
<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"
end-placeholder=
"结束日期"
start-placeholder=
"开始日期"
type=
"daterange"
value-format=
"YYYY-MM-DD HH:mm:ss"
/>
</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
@
click=
"handleQuery"
>
<Icon
class=
"mr-5px"
icon=
"ep:search"
/>
搜索
</el-button>
<el-button
@
click=
"resetQuery"
>
<Icon
class=
"mr-5px"
icon=
"ep:refresh"
/>
重置
</el-button>
<el-button
type=
"primary
"
v-hasPermi=
"['infra:demo03-student:create']
"
plain
type=
"primary"
@
click=
"openForm('create')"
v-hasPermi=
"['infra:demo03-student:create']"
>
<Icon
icon=
"ep:plus"
class=
"mr-5px"
/>
新增
<Icon
class=
"mr-5px"
icon=
"ep:plus"
/>
新增
</el-button>
<el-button
type=
"success"
v-hasPermi=
"['infra:demo03-student:export']"
:loading=
"exportLoading"
plain
type=
"success"
@
click=
"handleExport"
:loading=
"exportLoading"
v-hasPermi=
"['infra:demo03-student:export']"
>
<Icon
icon=
"ep:download"
class=
"mr-5px"
/>
导出
<Icon
class=
"mr-5px"
icon=
"ep:download"
/>
导出
</el-button>
</el-form-item>
</el-form>
...
...
@@ -69,48 +77,48 @@
<el-table
v-loading=
"loading"
:data=
"list"
:stripe=
"true"
:show-overflow-tooltip=
"true"
:stripe=
"true"
highlight-current-row
@
current-change=
"handleCurrentChange"
>
<el-table-column
label=
"编号"
align=
"center
"
prop=
"id"
/>
<el-table-column
label=
"名字"
align=
"center
"
prop=
"name"
/>
<el-table-column
label=
"性别"
align=
"center
"
prop=
"sex"
>
<el-table-column
align=
"center"
label=
"编号
"
prop=
"id"
/>
<el-table-column
align=
"center"
label=
"名字
"
prop=
"name"
/>
<el-table-column
align=
"center"
label=
"性别
"
prop=
"sex"
>
<template
#
default=
"scope"
>
<dict-tag
:type=
"DICT_TYPE.SYSTEM_USER_SEX"
:value=
"scope.row.sex"
/>
</
template
>
</el-table-column>
<el-table-column
label=
"出生日期
"
:formatter=
"dateFormatter
"
align=
"center"
label=
"出生日期"
prop=
"birthday"
:formatter=
"dateFormatter"
width=
"180px"
/>
<el-table-column
label=
"简介"
align=
"center
"
prop=
"description"
/>
<el-table-column
align=
"center"
label=
"简介
"
prop=
"description"
/>
<el-table-column
label=
"创建时间
"
:formatter=
"dateFormatter
"
align=
"center"
label=
"创建时间"
prop=
"createTime"
:formatter=
"dateFormatter"
width=
"180px"
/>
<el-table-column
label=
"操作"
align=
"center
"
>
<el-table-column
align=
"center"
label=
"操作
"
>
<
template
#
default=
"scope"
>
<el-button
v-hasPermi=
"['infra:demo03-student:update']"
link
type=
"primary"
@
click=
"openForm('update', scope.row.id)"
v-hasPermi=
"['infra:demo03-student:update']"
>
编辑
</el-button>
<el-button
v-hasPermi=
"['infra:demo03-student:delete']"
link
type=
"danger"
@
click=
"handleDelete(scope.row.id)"
v-hasPermi=
"['infra:demo03-student:delete']"
>
删除
</el-button>
...
...
@@ -119,9 +127,9 @@
</el-table>
<!-- 分页 -->
<Pagination
:total=
"total"
v-model:page=
"queryParams.pageNo"
v-model:limit=
"queryParams.pageSize"
v-model:page=
"queryParams.pageNo"
:total=
"total"
@
pagination=
"getList"
/>
</ContentWrap>
...
...
@@ -132,17 +140,17 @@
<ContentWrap>
<el-tabs
model-value=
"demo03Course"
>
<el-tab-pane
label=
"学生课程"
name=
"demo03Course"
>
<Demo03CourseList
:student-id=
"currentRow.id"
/>
<Demo03CourseList
:student-id=
"currentRow
?
.id"
/>
</el-tab-pane>
<el-tab-pane
label=
"学生班级"
name=
"demo03Grade"
>
<Demo03GradeList
:student-id=
"currentRow.id"
/>
<Demo03GradeList
:student-id=
"currentRow
?
.id"
/>
</el-tab-pane>
</el-tabs>
</ContentWrap>
</template>
<
script
setup
lang=
"ts"
>
import
{
getIntDictOptions
,
DICT_TYPE
}
from
'@/utils/dict'
<
script
lang=
"ts"
setup
>
import
{
DICT_TYPE
,
getIntDictOptions
}
from
'@/utils/dict'
import
{
dateFormatter
}
from
'@/utils/formatTime'
import
download
from
'@/utils/download'
import
*
as
Demo03StudentApi
from
'@/api/infra/demo/demo03/erp'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment