提交 ae1a5049 authored 作者: 王鹏飞's avatar 王鹏飞

chore: 实验指导书可重复关联实验

上级 21af6eef
...@@ -3,7 +3,7 @@ import type { BookCreateItem } from './types' ...@@ -3,7 +3,7 @@ import type { BookCreateItem } from './types'
// 获取课程列表 // 获取课程列表
export function getCourseList() { export function getCourseList() {
return httpRequest.get('/api/lab/v1/teacher/book/courses') return httpRequest.get('/api/lab/v1/teacher/course/list')
} }
// 获取实验列表 // 获取实验列表
export function getExperimentList(params: { course_id?: string }) { export function getExperimentList(params: { course_id?: string }) {
......
...@@ -66,13 +66,6 @@ const isUpdate = $computed(() => { ...@@ -66,13 +66,6 @@ const isUpdate = $computed(() => {
const title = $computed(() => { const title = $computed(() => {
return isUpdate ? '编辑实验指导书' : '新增实验指导书' return isUpdate ? '编辑实验指导书' : '新增实验指导书'
}) })
// 实验列表
const experimentList = $computed(() => {
if (!props.data) return experiments.value
return isUpdate && props.data.course_id === form.course_id
? [{ id: props.data.experiment_id, name: props.data.experiment_id_name }, ...experiments.value]
: experiments.value
})
function handleBeforeUpload() { function handleBeforeUpload() {
if (form.files.length) { if (form.files.length) {
...@@ -120,8 +113,7 @@ function handleUpdate(params: BookCreateItem) { ...@@ -120,8 +113,7 @@ function handleUpdate(params: BookCreateItem) {
:limit="1" :limit="1"
:beforeUpload="handleBeforeUpload" :beforeUpload="handleBeforeUpload"
accept=".doc,.docx,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,.pdf,application/pdf,.ppt,.pptx,application/vnd.ms-powerpoint,.csv,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" accept=".doc,.docx,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,.pdf,application/pdf,.ppt,.pptx,application/vnd.ms-powerpoint,.csv,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
@success="handleUploadSuccess" @success="handleUploadSuccess">
>
<template #tip>实验指导书文件支持格式包含:doc docx xls xlsx pdf ppt pptx,大小不超过50M</template> <template #tip>实验指导书文件支持格式包含:doc docx xls xlsx pdf ppt pptx,大小不超过50M</template>
</AppUpload> </AppUpload>
</el-form-item> </el-form-item>
...@@ -136,7 +128,7 @@ function handleUpdate(params: BookCreateItem) { ...@@ -136,7 +128,7 @@ function handleUpdate(params: BookCreateItem) {
</el-form-item> </el-form-item>
<el-form-item label="关联实验" prop="experiment_id"> <el-form-item label="关联实验" prop="experiment_id">
<el-select v-model="form.experiment_id" filterable style="width: 100%"> <el-select v-model="form.experiment_id" filterable style="width: 100%">
<el-option v-for="item in experimentList" :key="item.id" :label="item.name" :value="item.id"></el-option> <el-option v-for="item in experiments" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="有效状态" prop="status"> <el-form-item label="有效状态" prop="status">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论