Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
saas-lab
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
saas-lab
Commits
1d3fcaaa
提交
1d3fcaaa
authored
9月 05, 2022
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bug fixes
上级
84bb9138
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
24 行增加
和
20 行删除
+24
-20
FormDialog.vue
...modules/admin/system/experiment/components/FormDialog.vue
+16
-5
useGetCourseList.ts
...s/admin/system/experiment/composables/useGetCourseList.ts
+4
-7
useGetTeacherList.ts
.../admin/system/experiment/composables/useGetTeacherList.ts
+4
-8
没有找到文件。
src/modules/admin/system/experiment/components/FormDialog.vue
浏览文件 @
1d3fcaaa
...
...
@@ -22,10 +22,6 @@ const emit = defineEmits<{
// 机构列表
const
{
organizations
}
=
useGetProjectList
()
// 课程列表
const
{
courses
}
=
useGetCourseList
()
// 指导教师列表
const
{
teachers
}
=
useGetTeacherList
()
// 实验类型
const
types
=
useMapStore
().
getMapValuesByKey
(
'experiment_type'
)
// 数据状态
...
...
@@ -51,6 +47,17 @@ watchEffect(() => {
Object
.
assign
(
form
,
props
.
data
,
{
score
,
length
,
teachers_ids
})
})
// 课程列表
const
{
courses
,
updateCourses
}
=
useGetCourseList
()
watchEffect
(()
=>
{
updateCourses
(
form
.
organ_id
)
})
// 指导教师列表
const
{
teachers
,
updateTeachers
}
=
useGetTeacherList
()
watchEffect
(()
=>
{
updateTeachers
(
form
.
organ_id
)
})
const
rules
=
ref
<
FormRules
>
({
organ_id
:
[{
required
:
true
,
message
:
'请选择实验所属部门/学校'
}],
course_id
:
[{
required
:
true
,
message
:
'请选择实验课程'
}],
...
...
@@ -66,6 +73,10 @@ const isUpdate = $computed(() => {
const
title
=
$computed
(()
=>
{
return
isUpdate
?
'编辑实验'
:
'新增实验'
})
function
handleOrgChange
()
{
form
.
course_id
=
''
form
.
teachers_ids
=
[]
}
// 提交
function
handleSubmit
()
{
...
...
@@ -99,7 +110,7 @@ function handleUpdate(params: ExperimentCreateItem) {
<el-dialog
:title=
"title"
:close-on-click-modal=
"false"
width=
"600px"
@
update:modelValue=
"$emit('update:modelValue')"
>
<el-form
ref=
"formRef"
:model=
"form"
:rules=
"rules"
label-width=
"150px"
>
<el-form-item
label=
"实验所属部门/学校"
prop=
"organ_id"
>
<el-select
v-model=
"form.organ_id"
style=
"width: 100%"
:disabled=
"isUpdate"
>
<el-select
v-model=
"form.organ_id"
style=
"width: 100%"
:disabled=
"isUpdate"
@
change=
"handleOrgChange"
>
<el-option
v-for=
"item in organizations"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
></el-option>
</el-select>
</el-form-item>
...
...
src/modules/admin/system/experiment/composables/useGetCourseList.ts
浏览文件 @
1d3fcaaa
import
{
getExperimentCourseList
}
from
'../api'
import
{
useUserStore
}
from
'@/stores/user'
interface
CourseType
{
id
:
string
name
:
string
}
const
store
=
useUserStore
()
const
courses
=
ref
<
CourseType
[]
>
([])
export
function
useGetCourseList
()
{
if
(
!
courses
.
value
.
length
&&
store
.
organization
?.
id
)
{
getExperimentCourseList
({
organ_id
:
store
.
organization
.
id
}).
then
((
res
:
any
)
=>
{
const
courses
=
ref
<
CourseType
[]
>
([])
function
updateCourses
(
organId
:
string
)
{
getExperimentCourseList
({
organ_id
:
organId
}).
then
((
res
:
any
)
=>
{
courses
.
value
=
res
.
data
})
}
return
{
courses
}
return
{
courses
,
updateCourses
}
}
src/modules/admin/system/experiment/composables/useGetTeacherList.ts
浏览文件 @
1d3fcaaa
import
{
getExperimentTeacherList
}
from
'../api'
import
{
useUserStore
}
from
'@/stores/user'
interface
TeacherType
{
id
:
string
name
:
string
}
const
store
=
useUserStore
()
const
teachers
=
ref
<
TeacherType
[]
>
([])
export
function
useGetTeacherList
()
{
if
(
!
teachers
.
value
.
length
&&
store
.
organization
?.
id
)
{
getExperimentTeacherList
({
organ_id
:
store
.
organization
.
id
}).
then
((
res
:
any
)
=>
{
const
teachers
=
ref
<
TeacherType
[]
>
([])
function
updateTeachers
(
organId
:
string
)
{
getExperimentTeacherList
({
organ_id
:
organId
}).
then
((
res
:
any
)
=>
{
teachers
.
value
=
res
.
data
})
}
return
{
teachers
}
return
{
teachers
,
updateTeachers
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论