Crazy 1 month ago
parent
commit
03d8a0c390

+ 4 - 0
src/api/system/supervisorSelectionSetting/index.ts

@@ -44,4 +44,8 @@ export const supervisorSelectionSettingApi = {
   exportSupervisorSelectionSetting: async (params) => {
     return await request.download({ url: `/system/supervisor-selection-setting/export-excel`, params })
   },
+
+  getSupervisorInfo: async (supervisorId: number, projectId: number) => {
+    return await request.get({url: `/system/supervisor-selection-setting/getSupervisorInfo?supervisorId=${supervisorId}&projectId=${projectId}`});
+  }
 }

+ 34 - 21
src/views/system/studentSelectSupervisorRecord/studentSelectSupervisorRecordForm.vue

@@ -7,31 +7,31 @@
       label-width="100px"
       v-loading="formLoading"
     >
-      <el-row v-if="formType === 'create'">
+      <el-row v-if="formType === 'create'" :disabled=!isSupervisor>
         <el-col :span="12" >
           <el-form-item label="导师姓名" prop="nickname">
-            <el-input v-model="formData.nickname" placeholder="请输入姓名" />
+            <el-input v-model="formData.nickname" placeholder="请输入姓名" :disabled=!isSupervisor />
           </el-form-item>
         </el-col>
         <el-col :span="12" v-if="formType === 'create'">
-          <el-form-item label="职称" prop="">
-            <el-input model-value="导师"  />
+          <el-form-item label="职称" prop="title">
+            <el-input v-model="formData.title"  :disabled=!isSupervisor />
           </el-form-item>
         </el-col>
       </el-row>
 
       <el-row  v-if="formType === 'create'" >
         <el-col :span="12">
-          <el-form-item label="" prop="major">
-            <el-input v-model="formData.major" placeholder="导师暂未填写" />
+          <el-form-item label="研究方向" prop="major">
+            <el-input v-model="formData.major" placeholder="导师暂未填写" :disabled=!isSupervisor />
           </el-form-item>
         </el-col>
       </el-row>
 
-      <el-row v-if="formType === 'create'">
+      <el-row v-if="formType === 'create'" :disabled=false>
         <el-col :span="24">
           <el-form-item label="对研究生毕业的成果要求" prop="studentAchievementRequirement" type="create">
-            <Editor v-model="formData.studentAchievementRequirement" ref="editorRef"/>
+            <el-input v-model="formData.studentAchievementRequirement" placeholder="导师暂未填写" class="!h-200px" :disabled=!isSupervisor />
           </el-form-item>
         </el-col>
       </el-row>
@@ -54,8 +54,8 @@
         </el-select>
       </el-form-item>
 
-<!--      &lt;!&ndash; 学生电子签名 &ndash;&gt;-->
-<!--      <el-form-item label="学生电子签名" prop="studentSignature">-->
+      <!-- 学生电子签名 -->
+<!--      <el-form-item label="学生电子签名" prop="studentSignature" v-if="">-->
 <!--        <vue-esign ref="studentSignaturePad" :width="400" :height="200" @save="handleStudentSignatureSave" />-->
 <!--      </el-form-item>-->
 
@@ -66,7 +66,7 @@
 
     </el-form>
     <template #footer>
-      <el-button @click="submitForm" type="primary" :disabled="formLoading">确</el-button>
+      <el-button @click="submitForm" type="primary" :disabled="formLoading">确认填报</el-button>
       <el-button @click="dialogVisible = false">取 消</el-button>
 <!--      <button @click="saveSupervisorSignature">保存签名</button>-->
     </template>
@@ -79,6 +79,8 @@ import { CommonStatusEnum } from '@/utils/constants'
 import * as UserApi from '@/api/system/user'
 import { defineOptions, defineExpose, ref, reactive } from 'vue'
 import {data} from "autoprefixer";
+import { getUserProfile, ProfileVO } from '@/api/system/user/profile'
+import {supervisorSelectionSettingApi} from '@/api/system/supervisorSelectionSetting'
 
 /** 师生互选记录 表单 */
 defineOptions({ name: 'studentSelectSupervisorRecordForm' })
@@ -106,6 +108,7 @@ const formData = ref({
   remark: ' ',
   major:'',
   studentAchievementRequirement:"",
+  title:""
 })
 const formRules = reactive({
   // projectId: [{ required: true, message: '项目id不能为空', trigger: 'blur' }],
@@ -114,10 +117,16 @@ const formRules = reactive({
 const supervisorSignaturePad = ref(null);
 const formRef = ref() // 表单 Ref
 
+//获取登录人员信息
+const userInfo = ref({} as ProfileVO)
+const getUserInfo = async () => {
+  const users = await getUserProfile()
+  userInfo.value = users
+}
+
 /** 打开弹窗 */
 
-const open = async (type: string, projectId?: number ,supervisorId?:number,id?:number) => {
-  console.log(id)
+const open = async (type: string, projectId?: number ,supervisorId?:number) => {
   dialogVisible.value = true
   if (type === 'create'){
     dialogTitle.value = '志愿填报'
@@ -127,12 +136,14 @@ const open = async (type: string, projectId?: number ,supervisorId?:number,id?:n
       formLoading.value = true
       try {
         console.log(supervisorId)
-        const user = await UserApi.getUser(supervisorId);
+        console.log(projectId)
+        const user = await supervisorSelectionSettingApi.getSupervisorInfo(supervisorId,projectId);
         // formData.value = await studentSelectSupervisorRecordApi.getstudentSelectSupervisorRecord(id)
         console.log(user)
         formData.value.supervisorId =supervisorId;
         formData.value.projectId = projectId;
-        formData.value.nickname = user.nickname;
+        formData.value.nickname = user.supervisorName;
+        formData.value.title =user.title;
         formData.value.studentAchievementRequirement = user.studentAchievementRequirement;
         formData.value.major = user.major;
       } finally {
@@ -147,14 +158,8 @@ const open = async (type: string, projectId?: number ,supervisorId?:number,id?:n
     if (id) {
       formLoading.value = true
       try {
-        // const user = await UserApi.getUser(supervisorId);
         formData.value = await studentSelectSupervisorRecordApi.getStudentSelectSupervisorRecord(id)
         console.log(formData.value)
-        // formData.value.supervisorId =supervisorId;
-        // formData.value.projectId = projectId;
-        // formData.value.nickname = user.nickname;
-        // formData.value.studentAchievementRequirement = user.studentAchievementRequirement;
-        // formData.value.major = user.major;
       } finally {
         formLoading.value = false
       }
@@ -201,6 +206,8 @@ const submitForm = async () => {
   }
 };
 
+const isSupervisor = computed(() => userInfo.value.userType === '3');
+
 //获取所有导师
 const supervisors = ref()
 const getSupervisor= async () => {
@@ -235,6 +242,12 @@ const resetForm = () => {
 /** 初始化 **/
 onMounted(() => {
   getSupervisor()
+  getUserInfo()
 })
 </script>
 
+<style scoped>
+
+
+</style>
+

+ 0 - 2
src/views/system/supervisorSelectionSetting/index.vue

@@ -405,7 +405,6 @@ const handleSupervisorChange = (value: number) => {
   }
 }
 
-
 const teacherRequireFormRef = ref()
 const openTeacherRequireForm = (supervisorId?: number) => {
   teacherRequireFormRef.value.open("detail",supervisorId)
@@ -414,7 +413,6 @@ const openTeacherRequireForm = (supervisorId?: number) => {
 //志愿填报弹窗
 const studentSelectSupervisorPop= ref()
 const openStudentSelectSupervisorPop =  (type: string, projectId?: number,supervisorId? :number) => {
-  console.log(supervisorId)
   studentSelectSupervisorPop.value.open(type, projectId ,supervisorId)
 }
 

+ 6 - 5
src/views/system/userDetail/student.vue

@@ -12,12 +12,12 @@
     <el-row >
       <el-col :span="12">
         <el-form-item label="姓名" prop="nickname" >
-          <el-input v-model="formData.nickname" placeholder="自动链接"  />
+          <el-input v-model="formData.nickname" placeholder="自动链接" :disabled=isStudent />
         </el-form-item>
       </el-col>
       <el-col :span="12">
         <el-form-item label="学号" prop="userNumber">
-          <el-input v-model="formData.userNumber" placeholder="" />
+          <el-input v-model="formData.userNumber" placeholder="" :disabled=isStudent />
         </el-form-item>
       </el-col>
     </el-row>
@@ -25,17 +25,17 @@
     <el-row >
       <el-col :span="12">
         <el-form-item label="专业" prop="major">
-          <el-input v-model="formData.major" placeholder="" />
+          <el-input v-model="formData.major" placeholder="" :disabled=isStudent />
         </el-form-item>
       </el-col>
       <el-col :span="12">
         <el-form-item label="联系电话" prop="mobile">
-          <el-input v-model="formData.mobile" placeholder="" />
+          <el-input v-model="formData.mobile" placeholder="" :disabled=isStudent />
         </el-form-item>
       </el-col>
     </el-row>
 
-    <el-row  v-if="isStudent">
+    <el-row>
       <el-col :span="24">
         <el-form-item label="个人简历上传(PDF)" prop="introduction">
           <upload-file v-model="formData.introduction" />
@@ -91,6 +91,7 @@ const getUserInfo = async () => {
   userInfo.value = users
 }
 const isStudent = computed(() => userInfo.value.userType === "1");
+
   const open = async () => {
   dialogVisible.value = true
   dialogTitle.value = '信息填写'

+ 55 - 37
src/views/system/userDetail/teacher.vue

@@ -12,47 +12,63 @@
     <el-row>
       <el-col :span="12">
         <el-form-item label="姓名" prop="nickname" >
-          <el-input v-model="formData.nickname" placeholder="自动链接" :disabled="isStudent" />
+          <el-input v-model="formData.nickname" placeholder="自动链接" :disabled="!isSupervisor" />
         </el-form-item>
       </el-col>
       <el-col :span="12">
         <el-form-item label="职称" prop="title">
-          <el-input v-model="formData.title" placeholder="" :disabled="isStudent"/>
+          <el-input v-model="formData.title" placeholder="" :disabled="!isSupervisor"/>
         </el-form-item>
       </el-col>
     </el-row>
     <el-row>
       <el-col :span="24" >
         <el-form-item label="外聘导师工作单位" prop="externalSupervisorWorkPlace">
-          <el-input v-model="formData.externalSupervisorWorkPlace" placeholder="填写区" :disabled="isStudent"/>
+          <el-input v-model="formData.externalSupervisorWorkPlace" placeholder="填写区" :disabled="!isSupervisor"/>
         </el-form-item>
       </el-col>
     </el-row>
     <el-row  >
       <el-col :span="24">
         <el-form-item label="合作的校内导师" prop="supervisor">
-          <el-input v-model="formData.supervisor" placeholder="自动链接" :disabled="isStudent"/>
+          <el-input v-model="formData.supervisor" placeholder="自动链接" :disabled="!isSupervisor"/>
         </el-form-item>
       </el-col>
     </el-row>
     <el-row  >
       <el-col :span="12">
         <el-form-item label="研究方向" prop="major">
-          <el-input v-model="formData.major" placeholder="" :disabled="isStudent" />
+          <el-input v-model="formData.major" placeholder="" :disabled="!isSupervisor" />
         </el-form-item>
       </el-col>
     </el-row>
       <el-row >
-        <el-col :span="24">
+<!--        导师上传-->
+        <el-col :span="24" v-if="userInfo.userType==='3'&&formType==='update'">
           <el-form-item label="个人简历上传(PDF)" prop="introduction">
             <upload-file v-model="formData.introduction" />
           </el-form-item>
         </el-col>
+        <!--        学院和学生下载-->
+        <el-col :span="24" v-if="userInfo.userType==='4'||userInfo.userType==='1'&&formType==='detail'">
+          <el-form-item label="导师简历下载(PDF)" prop="introduction">
+              <el-button
+                v-if="formData.introduction"
+                type="text"
+                icon="el-icon-download"
+                @click="handleDownload"
+                class="custom-download-button"
+              >
+                下载导师简历
+              </el-button>
+              <span v-else>暂无文件</span>
+          </el-form-item>
+        </el-col>
       </el-row>
     <el-row  >
       <el-col :span="24">
         <el-form-item label="对研究生毕业时学术成果的要求" prop="studentAchievementRequirement">
-          <el-input type="textarea" v-model="formData.studentAchievementRequirement" placeholder="未填写时,默认为按学校及学院发表学术成果的要求执行" :disabled="isStudent" />
+          <el-input type="textarea" v-model="formData.studentAchievementRequirement" placeholder="未填写时,默认为按学校及学院发表学术成果的要求执行" :disabled="!isSupervisor" />
         </el-form-item>
       </el-col>
     </el-row>
@@ -71,13 +87,12 @@ 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'
 
 defineOptions({ name: 'teacherRequireForm' })
 
 const { t } = useI18n() // 国际化
 const message = useMessage() // 消息弹窗
-const userTypeSt = ref('1')
-const userTypeT = ref('3')
 
 const dialogVisible = ref(false) // 弹窗的是否展示
 const dialogTitle = ref('') // 弹窗的标题
@@ -107,7 +122,7 @@ const getUserInfo = async () => {
   const users = await getUserProfile()
   userInfo.value = users
 }
-const isStudent = computed(() => userInfo.value.userType === "1");
+// const isStudent = computed(() => userInfo.value.userType === "1");
 
   const open = async (type:string,supervisorId: number) => {
   dialogVisible.value = true
@@ -123,6 +138,7 @@ const isStudent = computed(() => userInfo.value.userType === "1");
           ...user,
           supervisorId: supervisorId, // 确保 supervisorId 也被设置
         }
+        console.log(formData.value)
       } finally {
         formLoading.value = false
       }
@@ -163,6 +179,16 @@ const submitForm = async () => {
     formLoading.value = false
   }
 }
+
+const isSupervisor = computed(() => userInfo.value.userType === '3');
+
+//下载PDF
+const handleDownload = () => {
+  console.log(formData.value.introduction)
+  download.markdown(formData.value.introduction, '个人简历.pdf');
+};
+
+
 /** 重置表单 */
 const resetForm = () => {
   formData.value = {
@@ -193,34 +219,26 @@ onMounted(() => {
   border-radius: 8px;
   box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* 轻微阴影 */
 }
-.custom-form .el-form-item {
-  margin-bottom: 20px;
-}
-.custom-form .el-input,
-.custom-form .el-textarea {
-  width: 100%;
-  border-color: #d9d9d9; /* 输入框边框颜色 */
-}
-.custom-form .el-form-item__label {
-  color: #333; /* 标签文字颜色 */
-}
-.custom-form .el-input__inner,
-.custom-form .el-textarea__inner {
-  background-color: #fff; /* 输入框背景颜色 */
-  color: #333; /* 输入框文字颜色 */
-}
-.custom-form .el-button {
-  background-color: #6a1b9a; /* 按钮背景颜色 */
-  border-color: #6a1b9a;
-  color: #fff; /* 按钮文字颜色 */
+
+.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 .el-button--primary {
-  background-color: #4a148c; /* 主要按钮背景颜色 */
-  border-color: #4a148c;
+.custom-form .custom-download-button:hover,
+.custom-form .custom-download-button:focus {
+  color: #fff; /* 悬浮时字体颜色 */
+  background-color: #4b7bec; /* 悬浮时背景颜色 */
+  border-color: #4b7bec; /* 悬浮时边框颜色 */
 }
-.custom-form .el-button:hover,
-.custom-form .el-button--primary:hover {
-  background-color: #5a0073; /* 按钮悬浮背景颜色 */
-  border-color: #5a0073;
+.custom-form .custom-download-button:active {
+  background-color: skyblue; /* 点击时背景颜色 */
+  border-color: #3a66b1; /* 点击时边框颜色 */
 }
+
 </style>