|
@@ -1,36 +1,85 @@
|
|
|
|
+
|
|
<template>
|
|
<template>
|
|
- <Dialog :title="dialogTitle" v-model="dialogVisible">
|
|
|
|
|
|
+ <Dialog v-model="dialogVisible" :title="dialogTitle">
|
|
<el-form
|
|
<el-form
|
|
ref="formRef"
|
|
ref="formRef"
|
|
|
|
+ v-loading="formLoading"
|
|
:model="formData"
|
|
:model="formData"
|
|
:rules="formRules"
|
|
:rules="formRules"
|
|
- label-width="100px"
|
|
|
|
- v-loading="formLoading"
|
|
|
|
|
|
+ label-width="120px"
|
|
|
|
+ class="custom-form"
|
|
>
|
|
>
|
|
-<!-- <el-form-item label="项目id" prop="projectId">-->
|
|
|
|
-<!-- <el-input v-model="formData.projectId" placeholder="请输入项目id" />-->
|
|
|
|
-<!-- </el-form-item>-->
|
|
|
|
-<!-- <el-form-item label="导师id" prop="supervisorId">-->
|
|
|
|
-<!-- <el-input v-model="formData.supervisorId" placeholder="请输入导师id" />-->
|
|
|
|
-<!-- </el-form-item>-->
|
|
|
|
- <el-form-item label="学硕名额" prop="academicSlots">
|
|
|
|
- <el-input v-model="formData.academicSlots" placeholder="请输入学硕名额" />
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="专硕名额" prop="professionalSlots">
|
|
|
|
- <el-input v-model="formData.professionalSlots" placeholder="请输入专硕名额" />
|
|
|
|
- </el-form-item>
|
|
|
|
|
|
+ <el-row>
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item label="姓名" prop="nickname" >
|
|
|
|
+ <el-input v-model="formData.nickname" placeholder="自动链接" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item label="职称" prop="title">
|
|
|
|
+ <el-input v-model="formData.title" placeholder="" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+ <el-row v-if="TUsertype === '5'">
|
|
|
|
+ <el-col :span="24" >
|
|
|
|
+ <el-form-item label="外聘导师" style="font-weight: 550;">
|
|
|
|
+ <p></p>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="24" >
|
|
|
|
+ <el-form-item label="工作单位" prop="externalSupervisorWorkPlace">
|
|
|
|
+ <el-input v-model="formData.externalSupervisorWorkPlace" placeholder="请输入工作单位"/>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+ <el-row v-if="TUsertype ==='5'">
|
|
|
|
+ <el-col :span="24">
|
|
|
|
+ <el-form-item label="合作的校内导师" prop="workSupervisor">
|
|
|
|
+ <el-input v-model="formData.workSupervisor" placeholder="自动链接"/>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+ <el-row>
|
|
|
|
+ <el-col :span="24">
|
|
|
|
+ <el-form-item label="研究方向" prop="major">
|
|
|
|
+ <el-input v-model="formData.major" placeholder="请输入研究方向" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+ <el-row >
|
|
|
|
+ <el-col :span="24">
|
|
|
|
+ <el-form-item label="导师简历上传" prop="introduction">
|
|
|
|
+ <el-input type="textarea" v-model="formData.introduction" placeholder="暂无简介" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+ <el-col :span="24">
|
|
|
|
+ <el-form-item label="对研究生毕业时学术成果的要求" prop="studentAchievementRequirement">
|
|
|
|
+ <el-input type="textarea" v-model="formData.studentAchievementRequirement" placeholder="未填写时,默认为按学校及学院发表学术成果的要求执行" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
</el-form>
|
|
</el-form>
|
|
<template #footer>
|
|
<template #footer>
|
|
- <el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
|
|
|
- <el-button @click="dialogVisible = false">取 消</el-button>
|
|
|
|
|
|
+ <div style="display: flex; justify-content: center;">
|
|
|
|
+ <el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
|
|
|
|
+ <el-button @click="dialogVisible = false">取 消</el-button>
|
|
|
|
+ </div>
|
|
</template>
|
|
</template>
|
|
</Dialog>
|
|
</Dialog>
|
|
</template>
|
|
</template>
|
|
-<script setup lang="ts">
|
|
|
|
-import { supervisorSelectionSettingApi, supervisorSelectionSettingVO } from '@/api/system/supervisorSelectionSetting'
|
|
|
|
|
|
|
|
-/** 导师学硕专硕名额设置 表单 */
|
|
|
|
-defineOptions({ name: 'SupervisorSelectionSettingForm' })
|
|
|
|
|
|
+<script lang="ts" setup>
|
|
|
|
+import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
|
|
|
+import { CommonStatusEnum } from '@/utils/constants'
|
|
|
|
+import * as UserApi from '@/api/system/user'
|
|
|
|
+import { FormRules } from 'element-plus'
|
|
|
|
+import { getUserProfile, ProfileVO } from '@/api/system/user/profile'
|
|
|
|
+import {selectionBookVO,selectionBookApi} from '@/api/system/studentSelectSupervisorRecord/selectionBook'
|
|
|
|
+import download from '@/utils/download'
|
|
|
|
+// import { supervisorSelectionSettingApi, supervisorSelectionSettingVO } from '@/api/system/supervisorSelectionSetting'
|
|
|
|
+
|
|
|
|
+defineOptions({ name: 'TeacherRequireForm' })
|
|
|
|
|
|
const { t } = useI18n() // 国际化
|
|
const { t } = useI18n() // 国际化
|
|
const message = useMessage() // 消息弹窗
|
|
const message = useMessage() // 消息弹窗
|
|
@@ -40,50 +89,67 @@ const dialogTitle = ref('') // 弹窗的标题
|
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
|
const formData = ref({
|
|
const formData = ref({
|
|
- id: undefined,
|
|
|
|
- projectId: undefined,
|
|
|
|
- supervisorId: undefined,
|
|
|
|
- academicSlots: undefined,
|
|
|
|
- professionalSlots: undefined,
|
|
|
|
|
|
+ id: null,
|
|
|
|
+ sex: null,
|
|
|
|
+ supervisorId: null,
|
|
|
|
+ nickname: '',
|
|
|
|
+ title: '',//职称
|
|
|
|
+ status: CommonStatusEnum.ENABLE,
|
|
|
|
+ userNumber: '',//工号
|
|
|
|
+ major:'',//研究方向
|
|
|
|
+ studentAchievementRequirement:"",
|
|
|
|
+ introduction:"",//简介
|
|
|
|
+ externalSupervisorWorkPlace:"",
|
|
|
|
+ workSupervisor:"",//合作校内导师
|
|
})
|
|
})
|
|
-const formRules = reactive({
|
|
|
|
- // projectId: [{ required: true, message: '项目id不能为空', trigger: 'blur' }],
|
|
|
|
- // supervisorId: [{ required: true, message: '导师id不能为空', trigger: 'blur' }],
|
|
|
|
|
|
+const formRules = reactive<FormRules>({
|
|
})
|
|
})
|
|
const formRef = ref() // 表单 Ref
|
|
const formRef = ref() // 表单 Ref
|
|
|
|
|
|
-/** 打开弹窗 */
|
|
|
|
-const open = async (type: string, id?: number) => {
|
|
|
|
|
|
+
|
|
|
|
+//获取登录人员信息
|
|
|
|
+const userInfo = ref({} as ProfileVO)
|
|
|
|
+const getUserInfo = async () => {
|
|
|
|
+ const users = await getUserProfile()
|
|
|
|
+ userInfo.value = users
|
|
|
|
+ console.log(userInfo.value);
|
|
|
|
+}
|
|
|
|
+const TUsertype = ref<string | undefined>(undefined);
|
|
|
|
+const open = async (type: string, supervisorId: number, userType?: string) => {
|
|
dialogVisible.value = true
|
|
dialogVisible.value = true
|
|
- dialogTitle.value = t('action.' + type)
|
|
|
|
- formType.value = type
|
|
|
|
- resetForm()
|
|
|
|
- // 修改时,设置数据
|
|
|
|
- if (id) {
|
|
|
|
- formLoading.value = true
|
|
|
|
- try {
|
|
|
|
- formData.value = await supervisorSelectionSettingApi.getSupervisorSelectionSetting(id)
|
|
|
|
- } finally {
|
|
|
|
- formLoading.value = false
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ formType.value=type
|
|
|
|
+ TUsertype.value = userType;
|
|
|
|
+ if (formType.value == 'update'){
|
|
|
|
+ dialogTitle.value = '编辑'
|
|
|
|
+ resetForm()
|
|
|
|
+ // 获取导师信息
|
|
|
|
+ formLoading.value = true
|
|
|
|
+ try {
|
|
|
|
+ const user = await UserApi.getUser(supervisorId)
|
|
|
|
+ // console.log(user,'11');
|
|
|
|
+ formData.value = user
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.error('请求失败:', error); // 捕获并打印错误信息
|
|
|
|
+ } finally {
|
|
|
|
+ formLoading.value = false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
|
|
|
|
|
+ defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
|
|
|
|
|
/** 提交表单 */
|
|
/** 提交表单 */
|
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
|
const submitForm = async () => {
|
|
const submitForm = async () => {
|
|
- // 校验表单
|
|
|
|
- await formRef.value.validate()
|
|
|
|
// 提交请求
|
|
// 提交请求
|
|
formLoading.value = true
|
|
formLoading.value = true
|
|
try {
|
|
try {
|
|
- const data = formData.value as unknown as supervisorSelectionSettingVO
|
|
|
|
- if (formType.value === 'create') {
|
|
|
|
- await supervisorSelectionSettingApi.createSupervisorSelectionSetting(data)
|
|
|
|
- message.success(t('common.createSuccess'))
|
|
|
|
- } else {
|
|
|
|
- await supervisorSelectionSettingApi.updateSupervisorSelectionSetting(data)
|
|
|
|
|
|
+ const data = formData.value as unknown as selectionBookVO
|
|
|
|
+ if (Array.isArray(data.introduction) && data.introduction.length > 0) {
|
|
|
|
+ data.introduction = data.introduction[0]; // 只取数组的第一个元素
|
|
|
|
+ }
|
|
|
|
+ if (formType.value === 'update') {
|
|
|
|
+ await selectionBookApi.updateSelectionBook(data)
|
|
|
|
+ console.log(data)
|
|
message.success(t('common.updateSuccess'))
|
|
message.success(t('common.updateSuccess'))
|
|
}
|
|
}
|
|
dialogVisible.value = false
|
|
dialogVisible.value = false
|
|
@@ -97,12 +163,56 @@ const submitForm = async () => {
|
|
/** 重置表单 */
|
|
/** 重置表单 */
|
|
const resetForm = () => {
|
|
const resetForm = () => {
|
|
formData.value = {
|
|
formData.value = {
|
|
|
|
+ supervisorId:undefined,
|
|
|
|
+ nickname: '',
|
|
id: undefined,
|
|
id: undefined,
|
|
- projectId: undefined,
|
|
|
|
- supervisorId: undefined,
|
|
|
|
- academicSlots: undefined,
|
|
|
|
- professionalSlots: undefined,
|
|
|
|
|
|
+ sex: undefined,
|
|
|
|
+ title: '',//职称
|
|
|
|
+ status: CommonStatusEnum.ENABLE,
|
|
|
|
+ userNumber: '',//工号
|
|
|
|
+ major:'',//研究方向
|
|
|
|
+ studentAchievementRequirement:"",
|
|
|
|
+ introduction:"",//简介
|
|
|
|
+ externalSupervisorWorkPlace:"",
|
|
}
|
|
}
|
|
formRef.value?.resetFields()
|
|
formRef.value?.resetFields()
|
|
}
|
|
}
|
|
|
|
+onMounted(() => {
|
|
|
|
+ getUserInfo()
|
|
|
|
+})
|
|
|
|
+
|
|
</script>
|
|
</script>
|
|
|
|
+
|
|
|
|
+<style scoped>
|
|
|
|
+.custom-form {
|
|
|
|
+ background-color: #f0f4f8; /* 浅灰色背景 */
|
|
|
|
+ padding: 20px;
|
|
|
|
+ border-radius: 8px;
|
|
|
|
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* 轻微阴影 */
|
|
|
|
+}
|
|
|
|
+.custom-form .custom-download-button {
|
|
|
|
+ color: #4b7bec; /* 灰蓝色字体颜色 */
|
|
|
|
+ border: 1px solid #4b7bec; /* 灰蓝色边框 */
|
|
|
|
+ background-color: transparent; /* 透明背景 */
|
|
|
|
+ padding: 10px 20px; /* 按钮内边距 */
|
|
|
|
+ border-radius: 4px; /* 圆角边框 */
|
|
|
|
+ font-size: 16px; /* 字体大小 */
|
|
|
|
+ transition: all 0.3s ease; /* 平滑过渡效果 */
|
|
|
|
+ outline: none; /* 去除点击时的轮廓 */
|
|
|
|
+}
|
|
|
|
+.custom-form .custom-download-button:hover,
|
|
|
|
+.custom-form .custom-download-button:focus {
|
|
|
|
+ color: #fff; /* 悬浮时字体颜色 */
|
|
|
|
+ background-color: #4b7bec; /* 悬浮时背景颜色 */
|
|
|
|
+ border-color: #4b7bec; /* 悬浮时边框颜色 */
|
|
|
|
+}
|
|
|
|
+.custom-form .custom-download-button:active {
|
|
|
|
+ background-color: skyblue; /* 点击时背景颜色 */
|
|
|
|
+ border-color: #3a66b1; /* 点击时边框颜色 */
|
|
|
|
+}
|
|
|
|
+.full-width-editor {
|
|
|
|
+ width: 100%;
|
|
|
|
+ border: #e5e7ec;
|
|
|
|
+ border-radius: 4px;
|
|
|
|
+}
|
|
|
|
+</style>
|