|
@@ -1,8 +1,15 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="page-content course-form">
|
|
<div class="page-content course-form">
|
|
|
- <h2 class="title">课程详情</h2>
|
|
|
|
|
- <BasicForm style="margin-top: 12px" @change="handleChange">
|
|
|
|
|
- <template #courseFlow>
|
|
|
|
|
|
|
+ <div class="header flex flex-row items-center justify-between">
|
|
|
|
|
+ <h2 class="title" v-if="courseNew">新增课程</h2>
|
|
|
|
|
+ <h2 class="title" v-else-if="courseEdit">编辑课程</h2>
|
|
|
|
|
+ <h2 class="title" v-else>课程详情</h2>
|
|
|
|
|
+ <el-space wrap>
|
|
|
|
|
+ <el-button v-if="!courseQuery" v-ripple type="primary" @click="addCourse"> 保存课程 </el-button>
|
|
|
|
|
+ </el-space>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <BasicForm style="margin-top: 12px" :model="courseDetail">
|
|
|
|
|
+ <template #courseDataStream>
|
|
|
<courseFlow />
|
|
<courseFlow />
|
|
|
</template>
|
|
</template>
|
|
|
<template #evaluate>
|
|
<template #evaluate>
|
|
@@ -12,39 +19,53 @@
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
- import { FormItemSchema, useForm } from '@/components/form'
|
|
|
|
|
import courseFlow from './course-flow.vue'
|
|
import courseFlow from './course-flow.vue'
|
|
|
import courseEvaluate from './course-evaluate.vue'
|
|
import courseEvaluate from './course-evaluate.vue'
|
|
|
- const options = ref([
|
|
|
|
|
- { label: '选项一', value: '1' },
|
|
|
|
|
- { label: '选项二', value: '2' },
|
|
|
|
|
- { label: '选项三', value: '3' }
|
|
|
|
|
- ])
|
|
|
|
|
- const formState = ref({})
|
|
|
|
|
- const handleChange = (val: any) => {
|
|
|
|
|
- formState.value = val
|
|
|
|
|
- detailData.value = val
|
|
|
|
|
|
|
+ import { BasicForm } from './course.schem'
|
|
|
|
|
+ import { Course, CourseServer } from '@/api/course.api'
|
|
|
|
|
+
|
|
|
|
|
+ // 路由参数
|
|
|
|
|
+ const route = useRoute()
|
|
|
|
|
+ const courseId = computed<number>(() => Number(route.params.id))
|
|
|
|
|
+ const query = computed(() => route.query)
|
|
|
|
|
+
|
|
|
|
|
+ const courseNew = computed(() => courseId.value === 0)
|
|
|
|
|
+ const courseEdit = computed(() => !courseNew.value && query.value.edit === 'true')
|
|
|
|
|
+ const courseQuery = computed(() => !courseNew.value && !courseEdit.value)
|
|
|
|
|
+ const courseDetail = ref<Course>({
|
|
|
|
|
+ courseID: 0,
|
|
|
|
|
+ courseName: '',
|
|
|
|
|
+ courseDesc: '',
|
|
|
|
|
+ totalDuration: 30,
|
|
|
|
|
+ typeID: 0,
|
|
|
|
|
+ courseDataStream: '',
|
|
|
|
|
+ externalTypeID: 0,
|
|
|
|
|
+ courseGUID: '',
|
|
|
|
|
+ guideDesc: '',
|
|
|
|
|
+ guideFilePath: '',
|
|
|
|
|
+ lineNo: 0,
|
|
|
|
|
+ runningMap: 0,
|
|
|
|
|
+ virtualRole: '',
|
|
|
|
|
+ virtualStartTime: 0,
|
|
|
|
|
+ creator: '',
|
|
|
|
|
+ createTime: '',
|
|
|
|
|
+ modifyTime: ''
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ const addCourse = () => {
|
|
|
|
|
+ console.log('addCourse', courseDetail.value)
|
|
|
}
|
|
}
|
|
|
- const schema: FormItemSchema[] = [
|
|
|
|
|
- // 课程基本信息
|
|
|
|
|
- { prop: '', label: '', labelWidth: '0px', component: 'Divider', colSpan: 24, componentProps: { title: '课程基本信息' } },
|
|
|
|
|
- { prop: 'courseName', label: '课程名称', component: 'Input', colSpan: 8 },
|
|
|
|
|
- { prop: 'courseCode', label: '课程编码', component: 'Input', colSpan: 8 },
|
|
|
|
|
- { prop: 'InputNumber', label: '课程时长', component: 'InputNumber', colSpan: 8, componentProps: { style: { width: '100%' } } },
|
|
|
|
|
- { prop: 'courseDesc', label: '课程描述', component: 'Input', colSpan: 24 },
|
|
|
|
|
- { prop: 'Select', label: '下拉选择(单选)', component: 'Select', colSpan: 6, defaultValue: '1', componentProps: { options: options.value, clearable: true } },
|
|
|
|
|
- { prop: 'Select-multiple', label: '下拉选择(多选)', component: 'Select', colSpan: 6, defaultValue: ['1', '2'], componentProps: { options: options.value, clearable: true, multiple: true } },
|
|
|
|
|
- { prop: 'RadioGroup', label: '单选框', component: 'RadioGroup', colSpan: 6, defaultValue: '1', componentProps: { options: options.value } },
|
|
|
|
|
- { prop: 'CheckboxGroup', label: '多选框', component: 'CheckboxGroup', colSpan: 6, defaultValue: ['1'], componentProps: { options: options.value } },
|
|
|
|
|
- // 课程运行流程
|
|
|
|
|
- { prop: '', label: '', labelWidth: '0px', component: 'Divider', colSpan: 24, componentProps: { title: '课程运行流程' } },
|
|
|
|
|
- { prop: 'courseFlow', labelWidth: '0px', label: '', component: 'Input', colSpan: 24 },
|
|
|
|
|
- // 电子考评
|
|
|
|
|
- { prop: '', label: '', labelWidth: '0px', component: 'Divider', colSpan: 24, componentProps: { title: '电子考评' } },
|
|
|
|
|
- { prop: 'evaluate', label: '电子考评', component: 'Input', colSpan: 24 }
|
|
|
|
|
- ]
|
|
|
|
|
- const [BasicForm] = useForm({ labelPosition: 'right', labelWidth: '150px', schema: schema })
|
|
|
|
|
- const detailData = ref({})
|
|
|
|
|
|
|
+
|
|
|
|
|
+ onMounted(() => {
|
|
|
|
|
+ console.log(courseId.value)
|
|
|
|
|
+ if (!courseNew.value) {
|
|
|
|
|
+ CourseServer.detail(courseId.value)
|
|
|
|
|
+ .then(({ data }) => {
|
|
|
|
|
+ courseDetail.value = data
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(() => ElMessage.error('获取课程数据失败'))
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
</script>
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
|
.course-form {
|
|
.course-form {
|