47 4 月之前
父節點
當前提交
cf054e4d61

+ 44 - 29
src/views/system/studentSelection/studentSelectSupervisorRecord/studentSelectSupervisorRecordForm.vue

@@ -84,7 +84,7 @@
                   <el-button  @click="ClearStudentSignature" size="small">清空</el-button>
                 </div>
               </div>
-              <div>
+              <div v-if="formType !== 'create'">
                 <p v-if="userInfo.userType==='3' || formType === 'end'">★ 本人签字</p>
                 <div>
                   <img v-if="(userInfo.userType==='3' || formType === 'end') && formData.studentSignature" :src="formData.studentSignature" alt="学生签名" style="width: 300px; height: 100px; margin-right: 10px; background-color: white;"/>
@@ -152,8 +152,6 @@
           <el-select
             v-model="formData.supervisorId"
             placeholder="请选择参与导师"
-            clearable
-            filterable
             class="!w"
             @change="handleSupervisorChange"
           >
@@ -252,6 +250,8 @@ const studentData = ref({
 const formRules = reactive({
   // projectId: [{ required: true, message: '项目id不能为空', trigger: 'blur' }],
   // studentId: [{ required: true, message: '学生id不能为空', trigger: 'blur' }],
+  studentSignature: [{ required: true, message: '签名不能为空', trigger: 'blur' }],
+  supervisorSignature: [{ required: true, message: '签名不能为空', trigger: 'blur' }],
 })
 const supervisorSignaturePad = ref(null);
 const formRef = ref() // 表单 Ref
@@ -406,14 +406,14 @@ const open = async (type: string, projectId?: number, supervisorId?:number, id?:
         studentData.value.major=result.major
         studentData.value.mobile=result.mobile
 
-        const supervisor = await supervisorSelectionSettingApi.getSupervisorInfo(supervisorId,projectId);
-        //显示的
-        supervisorData.value.nickname = supervisor.supervisorName;
-        supervisorData.value.title =supervisor.title;
-        supervisorData.value.studentAchievementRequirement = supervisor.studentAchievementRequirement;
-        supervisorData.value.major = supervisor.major;
-        supervisorData.value.workSupervisor = supervisor.workSupervisor;
-        formData.value = await studentSelectSupervisorRecordApi.getStudentSelectSupervisorRecord(id)
+        // const supervisor = await supervisorSelectionSettingApi.getSupervisorInfo(supervisorId,projectId);
+        // //显示的
+        // supervisorData.value.nickname = supervisor.supervisorName;
+        // supervisorData.value.title =supervisor.title;
+        // supervisorData.value.studentAchievementRequirement = supervisor.studentAchievementRequirement;
+        // supervisorData.value.major = supervisor.major;
+        // supervisorData.value.workSupervisor = supervisor.workSupervisor;
+        // formData.value = await studentSelectSupervisorRecordApi.getStudentSelectSupervisorRecord(id)
       } finally {
         formLoading.value = false
       }
@@ -429,18 +429,24 @@ const open = async (type: string, projectId?: number, supervisorId?:number, id?:
       formLoading.value = true
       try {
         const result =await UserApi.getUser(studentId)
+        console.log(result);
         studentData.value.nickname=result.nickname
         studentData.value.userNumber=result.userNumber
         studentData.value.major=result.major
         studentData.value.mobile=result.mobile
+        // formData.value.supervisorId = result.supervisorId
       } finally {
         formLoading.value = false
       }
     }
-    if (id){
-      formData.value.id = id
-      formData.value = await studentSelectSupervisorRecordApi.getStudentSelectSupervisorRecord(id)
-      // console.log(formData.value,'formData.value');
+    if(id) {
+      formLoading.value = true
+      try {
+        formData.value.id = id
+        formData.value = await studentSelectSupervisorRecordApi.getStudentSelectSupervisorRecord(id)
+      } finally {
+        formLoading.value = false
+      }
     }
     await getProjectSupervisors()
   }
@@ -454,6 +460,7 @@ const open = async (type: string, projectId?: number, supervisorId?:number, id?:
       try {
         const result =await UserApi.getUser(studentId)
         formData.value.supervisorId = supervisorId
+        formData.value.studentId = studentId
         studentData.value.nickname=result.nickname
         studentData.value.userNumber=result.userNumber
         studentData.value.major=result.major
@@ -462,6 +469,14 @@ const open = async (type: string, projectId?: number, supervisorId?:number, id?:
         formLoading.value = false
       }
     }
+    if(id) {
+      formLoading.value = true
+      try {
+        formData.value = await studentSelectSupervisorRecordApi.getStudentSelectSupervisorRecord(id)
+      } finally {
+        formLoading.value = false
+      }
+    }
     await getProjectSupervisors()
   }
   if (type === 'end'){
@@ -506,8 +521,8 @@ const supervisorsin = ref()
 const getProjectSupervisors = async () => {
   // console.log('请求的项目ID:', projectId);
   const result = await studentSelectionProjectApi.getProjectSupervisors();
-  console.log(result,'获取到的导师信息');
   supervisorsin.value = result
+  console.log(supervisorsin.value,'获取到的导师信息');
 }
 
 const handleExport = (row) => {
@@ -644,24 +659,24 @@ const submitForm = async () => {
     const data = formData.value as unknown as studentSelectSupervisorRecordVO;
     console.log(data)
     if (formType.value === 'create') {
-      const isStudentSignatureSaved = formData.value.studentSignature.startsWith('data:image/png;base64,');
-      if (!isStudentSignatureSaved && (userInfo.value.userType === '1')) {
-        message.error('请先保存签名');
-        formLoading.value = false;
-        return;
-      }
+      // const isStudentSignatureSaved = formData.value.studentSignature.startsWith('data:image/png;base64,');
+      // if (!isStudentSignatureSaved && (userInfo.value.userType === '1')) {
+      //   message.error('请先保存签名');
+      //   formLoading.value = false;
+      //   return;
+      // }
       await studentSelectSupervisorRecordApi.createStudentSelectSupervisorRecord(data);
       message.success(t('common.createSuccess'));
     } else if (formType.value === 'update') {
       await studentSelectSupervisorRecordApi.updateStudentSelectSupervisorRecord(data);
       message.success(t('common.updateSuccess'));
     } else if (formType.value === 'agree') {
-      const isSupervisorSignatureSaved = formData.value.supervisorSignature.startsWith('data:image/png;base64,');
-      if (!isSupervisorSignatureSaved && (userInfo.value.userType === '3'|| userInfo.value.userType === '5')) {
-        message.error('请先保存签名');
-        formLoading.value = false;
-        return;
-      }
+      // const isSupervisorSignatureSaved = formData.value.supervisorSignature.startsWith('data:image/png;base64,');
+      // if (!isSupervisorSignatureSaved && (userInfo.value.userType === '3'|| userInfo.value.userType === '5')) {
+      //   message.error('请先保存签名');
+      //   formLoading.value = false;
+      //   return;
+      // }
       await studentSelectSupervisorRecordApi.agreeStudentSelectSupervisorRecord(data);
       message.success("已经同意申请");
     }else if (formType.value === 'updateone') {
@@ -687,7 +702,7 @@ const isSupervisor = computed(() => userInfo.value.userType === '3');
 
 // 直接改导师(志愿编辑)
 const handleSupervisorChange = (supervisorId?:number) => {
-  supervisorId = supervisors.value.id;
+  supervisorId = supervisorsin.value.id;
 }
 defineExpose({ open, handleExport });
 

+ 1 - 1
src/views/system/studentSelection/studentSelectionYes/index.vue

@@ -104,7 +104,7 @@
         <template #default="scope">
           <el-button
             type="text"
-            @click="openForm('updateone',  scope.row.projectId,scope.row.supervisorId,scope.row.recordId,scope.row.id)"
+            @click="openForm('updateone',scope.row.projectId,scope.row.selectSupervisorId,scope.row.recordId,scope.row.id)"
             v-hasPermi="['system:student-select-supervisor-record:update']"
           >
             志愿编辑