|
|
@@ -10,7 +10,7 @@
|
|
|
</el-space>
|
|
|
</div>
|
|
|
<div v-loading="loading" class="mt-4">
|
|
|
- <BasicForm :formModelInit="courseDetail" @change="handleChange">
|
|
|
+ <BasicForm @change="handleChange">
|
|
|
<template #courseDataStream>
|
|
|
<EasyProcess ref="easyProcessRef" :data="courseDataStream" />
|
|
|
</template>
|
|
|
@@ -25,7 +25,7 @@
|
|
|
import EasyProcess from '@/components/business/EasyProcess/index.vue'
|
|
|
import courseEvaluate from './course-evaluate.vue'
|
|
|
import { schema, courseSchema, rules } from './course.schema'
|
|
|
- import { Course, CourseServer } from '@/api/course.api'
|
|
|
+ import { CourseServer } from '@/api/course.api'
|
|
|
import { useForm } from '@/components/form'
|
|
|
import { router } from '@/router'
|
|
|
import { ElMessageBox, ElMessage } from 'element-plus'
|
|
|
@@ -42,14 +42,13 @@
|
|
|
const courseEdit = computed(() => !courseNew.value && query.value.edit === 'true')
|
|
|
const courseQuery = computed(() => !courseNew.value && !courseEdit.value)
|
|
|
const loading = ref(true)
|
|
|
- const courseDetail = ref<Course | undefined>(undefined)
|
|
|
|
|
|
const [BasicForm, formApi] = useForm({ labelPosition: 'right', labelWidth: '150px', schema: courseNew.value ? schema : courseSchema, rules, showDefaultActions: false })
|
|
|
const formData = ref<any>({})
|
|
|
const handleChange = (val: any) => (formData.value = val)
|
|
|
|
|
|
const addCourse = async () => {
|
|
|
- const processData = easyProcessRef.value.getProcess()
|
|
|
+ const processData = await easyProcessRef.value.getProcess()
|
|
|
if (!processData) {
|
|
|
ElMessage.error('请设计课程流程')
|
|
|
return
|
|
|
@@ -85,25 +84,27 @@
|
|
|
}
|
|
|
|
|
|
onMounted(() => {
|
|
|
- loading.value = true
|
|
|
- if (!courseNew.value) {
|
|
|
- CourseServer.detail(courseId.value)
|
|
|
- .then(({ data }) => {
|
|
|
- courseDataStream.value = data?.courseDataStream || ''
|
|
|
- courseDetail.value = {
|
|
|
- ...data,
|
|
|
- totalDuration: String(data?.totalDuration || 0),
|
|
|
- typeID: String(data?.typeID || ''),
|
|
|
- externalTypeID: String(data?.externalTypeID || ''),
|
|
|
- lineNo: String(data?.lineNo || ''),
|
|
|
- runningMap: String(data?.runningMap || '')
|
|
|
- }
|
|
|
- loading.value = false
|
|
|
- })
|
|
|
- .catch(() => ElMessage.error('获取课程数据失败'))
|
|
|
- } else {
|
|
|
- loading.value = false
|
|
|
- }
|
|
|
+ nextTick(() => {
|
|
|
+ loading.value = true
|
|
|
+ if (!courseNew.value) {
|
|
|
+ CourseServer.detail(courseId.value)
|
|
|
+ .then(({ data }) => {
|
|
|
+ courseDataStream.value = data?.courseDataStream || ''
|
|
|
+ formApi.setValues({
|
|
|
+ ...data,
|
|
|
+ totalDuration: String(data?.totalDuration || 0),
|
|
|
+ typeID: String(data?.typeID || ''),
|
|
|
+ externalTypeID: String(data?.externalTypeID || ''),
|
|
|
+ lineNo: String(data?.lineNo || ''),
|
|
|
+ runningMap: String(data?.runningMap || '')
|
|
|
+ })
|
|
|
+ loading.value = false
|
|
|
+ })
|
|
|
+ .catch(() => ElMessage.error('获取课程数据失败'))
|
|
|
+ } else {
|
|
|
+ loading.value = false
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
|
|
|
const handleCancel = () => {
|