zhxy-jsd/src/pages/base/groupTeaching/zhujiaoDetails.vue

235 lines
6.2 KiB
Vue
Raw Normal View History

2025-05-21 02:44:13 +08:00
<template>
<BasicLayout>
<template #top>
<view class="flex-row items-center white-bg-color p-15 r-md">
2025-06-20 09:51:43 +08:00
<view class="flex-col ml-10 flex-1 course-info">
<view class="course-name">{{ xkkc.kcmc }}</view>
<view class="course-info-item">
<view class="info-label">上课周期类型</view>
<view class="info-data">{{ xkkc.skzqlx }}</view>
2025-05-21 02:44:13 +08:00
</view>
2025-06-20 09:51:43 +08:00
<view class="course-info-item">
<view class="info-label">上课周期</view>
<view class="info-data">{{ xkkc.skzqmc }}</view>
2025-05-21 02:44:13 +08:00
</view>
2025-06-20 09:51:43 +08:00
<view class="course-info-item">
<view class="info-label">上课开始时间</view>
<view class="info-data">{{ xkkc.skkstime }}</view>
</view>
<view class="course-info-item">
<view class="info-label">上课结束时间</view>
<view class="info-data">{{ xkkc.skjstime }}</view>
</view>
<view class="course-info-item">
<view class="info-label">开课老师</view>
<view class="info-data">{{ js.jsxm }}</view>
</view>
<view class="course-info-item">
<view class="info-label">开课地点</view>
<view class="info-data">{{ xkkc.kcdd }}</view>
</view>
<view class="course-info-item">
<view class="info-label">上课人数</view>
<view class="info-data">{{ xkkc.hasNum || 0 }} | {{ xkkc.maxNum || 0 }}</view>
</view>
<view class="course-info-item">
<view class="info-label">金额</view>
<view class="info-data cor-FF8D02">¥{{ xkkc.kcje }}</view>
2025-05-21 02:44:13 +08:00
</view>
</view>
</view>
</template>
<view class="p-15">
<BasicForm @register="register">
<template #jxjh>
<view class="back-f8f8f8">
<view class="flex-row items-center justify-between py-15 global-bg-color">
<view>
2025-06-20 09:51:43 +08:00
<BasicTitle line title="教学计划" :isBorder="false" />
2025-05-21 02:44:13 +08:00
</view>
<view @click="addEducation">
2025-06-20 09:51:43 +08:00
<BasicIcon type="icon-tianjia" size="25" />
2025-05-21 02:44:13 +08:00
</view>
</view>
2025-06-20 09:51:43 +08:00
<view v-if="education.xl.length > 0">
<template v-for="(item, index) in education.xl" :key="index">
2025-05-21 02:44:13 +08:00
<view class="po-re mb-15">
2025-06-20 09:51:43 +08:00
<BasicForm v-model="item.value" :schema="schema" :formsProps="{ labelWidth: 100 }" />
<view @click="deleteMemberFamily(index as number, item.value)" class="delete-icon">
<BasicIcon type="clear" size="30" />
2025-05-21 02:44:13 +08:00
</view>
</view>
</template>
</view>
<view v-else class="p-15 flex-row-center color-9 font-13 white-bg-color">教学计划暂无数据</view>
</view>
</template>
</BasicForm>
</view>
<template #bottom>
<view class="white-bg-color py-5">
<view class="flex-row items-center pb-10 pt-5">
2025-06-20 09:51:43 +08:00
<u-button text="返回" class="ml-15 mr-7" :plain="true" @click="navigateBack" />
<u-button text="提交" class="mr-15 mr-7" type="primary" @click="submit" />
2025-05-21 02:44:13 +08:00
</view>
</view>
</template>
</BasicLayout>
</template>
<script lang="ts" setup>
2025-06-20 09:51:43 +08:00
import { navigateBack } from "@/utils/uniapp";
import { useForm } from "@/components/BasicForm/hooks/useForm";
import { cloneDeep, get } from "lodash";
import { useUserStore } from "@/store/modules/user";
import { useDataStore } from "@/store/modules/data";
import { jsdXkkcSaveApi } from "@/api/base/server";
const { getJs } = useUserStore();
const { getData } = useDataStore();
2025-05-21 02:44:13 +08:00
2025-06-20 09:51:43 +08:00
const js = computed(() => getJs)
const xkkc = ref<any>({})
2025-05-21 02:44:13 +08:00
2025-06-20 09:51:43 +08:00
const [register, { getValue, setValue }] = useForm({
2025-05-21 02:44:13 +08:00
schema: [
{
2025-06-20 09:51:43 +08:00
field: "kcjsms",
2025-05-21 02:44:13 +08:00
label: "老师信息",
component: "BasicInput",
itemProps: {
labelPosition: "top",
},
componentProps: {
type: "textarea",
},
},
{
2025-06-20 09:51:43 +08:00
field: "jxll",
label: "教学理念",
2025-05-21 02:44:13 +08:00
component: "BasicInput",
itemProps: {
labelPosition: "top",
},
componentProps: {
type: "textarea",
},
},
2025-06-20 09:51:43 +08:00
{ colSlot: 'jxjh' },
2025-05-21 02:44:13 +08:00
],
});
const schema = reactive<FormsSchema[]>([
{
2025-06-20 09:51:43 +08:00
field: "jhjd",
2025-05-21 02:44:13 +08:00
label: "阶段",
component: "BasicInput",
componentProps: {},
},
{
2025-06-20 09:51:43 +08:00
field: "jhsj",
2025-05-21 02:44:13 +08:00
label: "计划时间",
component: "BasicDateTimes",
componentProps: {},
},
{
2025-06-20 09:51:43 +08:00
field: "jhdd",
2025-05-21 02:44:13 +08:00
label: "地址",
component: "BasicInput",
componentProps: {},
},
{
2025-06-20 09:51:43 +08:00
field: "jhnr",
2025-05-21 02:44:13 +08:00
label: "计划内容",
component: "BasicInput",
itemProps: {
labelPosition: "top",
},
componentProps: {
type: "textarea",
},
},
])
const education = reactive<any>(
2025-06-20 09:51:43 +08:00
{
xl: []
}
2025-05-21 02:44:13 +08:00
)
function addEducation() {
2025-06-20 09:51:43 +08:00
education.xl.push({ value: {
jhjd: '',
jhsj: '',
jhdd: '',
jhnr: ''
} })
2025-05-21 02:44:13 +08:00
}
function deleteMemberFamily(index: number, item: any) {
const list = cloneDeep(education.xl)
list.splice(index, 1)
education.xl = list
}
2025-06-20 09:51:43 +08:00
const submit = async () => {
const data = await getValue()
xkkc.value.kcjsms = data.kcjsms;
xkkc.value.jxll = data.jxll;
xkkc.value.jxjh = JSON.stringify(education.xl)
await jsdXkkcSaveApi(xkkc.value).then(res => {
uni.showToast({
title: '提交成功',
icon: 'success',
duration: 2000
})
}).catch(err => {
uni.showToast({
title: '提交失败',
icon: 'error',
duration: 2000
})
});
}
// 初始化
onMounted(() => {
xkkc.value = getData;
setValue(getData);
// 将xkkc中的jxjh从json字符串转换为数组
if (xkkc.value.jxjh && xkkc.value.jxjh.length > 0) {
education.xl = JSON.parse(xkkc.value.jxjh)
} else {
education.xl = [];
}
})
2025-05-21 02:44:13 +08:00
</script>
<style>
.delete-icon {
position: absolute;
right: 0;
top: 0;
z-index: 1;
}
2025-06-20 09:51:43 +08:00
.course-info {
.course-name {
font-size: 16px;
font-weight: 500;
color: #333;
margin-bottom: 10px;
}
.course-info-item {
display: flex;
margin-bottom: 12px;
font-size: 12px;
.info-label {
color: #949AA4;
flex: 0 0 100px;
}
.info-data {
flex: 1 0 1px;
}
}
}
2025-05-21 02:44:13 +08:00
</style>