|
@@ -81,8 +81,8 @@
|
|
|
style="border:1px solid #e0e0e0; border-radius: 4px; background-color: white;"
|
|
|
></canvas>
|
|
|
<div style="display: flex; justify-content: flex-end;">
|
|
|
- <button type="button" @click="handleStudentSignatureSave" style="padding: 2px 5px; margin-right: 10px;">保存</button>
|
|
|
- <button type="button" @click="ClearStudentSignature" style="padding: 2px 5px;">清空</button>
|
|
|
+ <el-button type="primary" @click="handleStudentSignatureSave" size="small">保存</el-button>
|
|
|
+ <el-button @click="ClearStudentSignature" size="small">清空</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<p v-if="userInfo.userType==='3' || formType === 'end'">★ 本人签字</p>
|
|
@@ -96,20 +96,33 @@
|
|
|
<div class="section" v-if="userInfo.userType==='3'">
|
|
|
<p style="margin-bottom: 10px;">导师意见:同意</p>
|
|
|
<p style="margin-bottom: 10px;">导师签字</p>
|
|
|
- <div>
|
|
|
+ <div v-show="lastSupervisorSignature">
|
|
|
+ <img :src="formData.supervisorSignature" alt="导师签名" style="width: 300px; height: 100px; margin-right: 10px; background-color: white;"/>
|
|
|
+ <div style="margin-top: 10px;">
|
|
|
+ <el-button
|
|
|
+ plain
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ @click="handleResign"
|
|
|
+ >
|
|
|
+ 重签
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div v-show="!lastSupervisorSignature">
|
|
|
<canvas
|
|
|
id="canvas"
|
|
|
ref="canvas"
|
|
|
- width="400px"
|
|
|
- height="100px"
|
|
|
+ width="400"
|
|
|
+ height="100"
|
|
|
@mousedown="handleMouseDown"
|
|
|
@mousemove="handleMouseMove"
|
|
|
@mouseup="handleMouseUp"
|
|
|
style="border:1px solid #e0e0e0; border-radius: 4px; background-color: white;"
|
|
|
></canvas>
|
|
|
<div style="display: flex; justify-content: flex-start; margin-top: 10px;">
|
|
|
- <button type="button" @click="handleSupervisorSignatureSave" style="padding: 2px 5px; margin-right: 10px;">保存</button>
|
|
|
- <button type="button" @click="ClearSupervisorSignature" style="padding: 2px 5px;">清空</button>
|
|
|
+ <el-button type="primary" @click="handleSupervisorSignatureSave" size="small">保存</el-button>
|
|
|
+ <el-button @click="ClearStudentSignature" size="small">清空</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- <p v-if="userInfo.userType==='4'">日期:{{formData.supervisorSignDate}}</p> -->
|
|
@@ -119,7 +132,7 @@
|
|
|
<img :src="formData.supervisorSignature" alt="导师签名" style="width: 300px; height: 100px; margin-right: 10px; background-color: white;"/>
|
|
|
<p>日期:{{formattedSupervisorSignDate}}</p>
|
|
|
</div>
|
|
|
- <div class="section" v-if="userInfo.userType==='4' && formType === 'update'">
|
|
|
+ <div class="section" v-if="userInfo.userType==='4' && formType === 'update' || userInfo.userType==='4' && formType === 'updatetwo' || userInfo.userType==='4' && formType === 'updateone'">
|
|
|
<el-form-item label="参与导师" prop="supervisorId">
|
|
|
<el-select
|
|
|
v-model="formData.supervisorId"
|
|
@@ -157,9 +170,9 @@ import {supervisorSelectionSettingApi} from '@/api/system/supervisorSelectionSet
|
|
|
import { htmlPdf } from "@/utils/htmlToPDF.js"
|
|
|
import { studentSelectionProjectApi, studentSelectionProjectVO } from '@/api/system/studentSelectionProject'
|
|
|
|
|
|
-
|
|
|
/** 师生互选记录 表单 */
|
|
|
defineOptions({ name: 'StudentSelectSupervisorRecordForm' })
|
|
|
+const canvas = ref();
|
|
|
|
|
|
const { t } = useI18n() // 国际化
|
|
|
const message = useMessage() // 消息弹窗
|
|
@@ -232,6 +245,7 @@ const userInfo = ref({} as ProfileVO)
|
|
|
const getUserInfo = async () => {
|
|
|
const users = await getUserProfile()
|
|
|
userInfo.value = users
|
|
|
+ // console.log('userInfo', userInfo.value);
|
|
|
}
|
|
|
|
|
|
// 获取所有导师
|
|
@@ -246,10 +260,29 @@ const getSupervisor= async () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+const lastSupervisorSignature = ref();
|
|
|
+// 获取上一次的签名
|
|
|
+const getSupervisorSignature = async() => {
|
|
|
+ const res = await studentSelectSupervisorRecordApi.getSupervisorSignature()
|
|
|
+ // console.log(res,'r4es');
|
|
|
+ lastSupervisorSignature.value = res
|
|
|
+ // console.log(lastSupervisorSignature.value,'lastSupervisorSignature.value');
|
|
|
+}
|
|
|
+
|
|
|
const showPrintButton = ref(false); // 控制打印按钮的显示
|
|
|
/** 打开弹窗 */
|
|
|
const open = async (type: string, projectId?: number, supervisorId?:number, id?:number, studentId?:number) => {
|
|
|
dialogVisible.value = true;
|
|
|
+ await nextTick(() => {
|
|
|
+ if (canvas.value) {
|
|
|
+ context.value = canvas.value.getContext('2d');
|
|
|
+ context.value.lineWidth = 2; // 设置线条宽度
|
|
|
+ context.value.lineCap = 'round'; // 设置线条末端样式
|
|
|
+ context.value.strokeStyle = 'black'; // 设置线条颜色
|
|
|
+ } else {
|
|
|
+ console.error('Canvas element is not found');
|
|
|
+ }
|
|
|
+ })
|
|
|
if (type === 'create'){
|
|
|
dialogTitle.value = '志愿填报'
|
|
|
submitFormText.value = '选择'
|
|
@@ -288,7 +321,6 @@ const open = async (type: string, projectId?: number, supervisorId?:number, id?:
|
|
|
studentData.value.userNumber=result.userNumber
|
|
|
studentData.value.major=result.major
|
|
|
studentData.value.mobile=result.mobile
|
|
|
-
|
|
|
const supervisor = await supervisorSelectionSettingApi.getSupervisorInfo(supervisorId,projectId);
|
|
|
//显示的
|
|
|
supervisorData.value.nickname = supervisor.supervisorName;
|
|
@@ -298,6 +330,9 @@ const open = async (type: string, projectId?: number, supervisorId?:number, id?:
|
|
|
supervisorData.value.workSupervisor = supervisor.workSupervisor;
|
|
|
|
|
|
formData.value = await studentSelectSupervisorRecordApi.getStudentSelectSupervisorRecord(id)
|
|
|
+ await getSupervisorSignature();
|
|
|
+ formData.value.supervisorSignature = lastSupervisorSignature.value
|
|
|
+ // console.log(formData.value.supervisorSignature,'formData.value.supervisorSignature');
|
|
|
} finally {
|
|
|
formLoading.value = false
|
|
|
}
|
|
@@ -358,7 +393,30 @@ const open = async (type: string, projectId?: number, supervisorId?:number, id?:
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- await getProjectSupervisors(projectId)
|
|
|
+ await getProjectSupervisors()
|
|
|
+
|
|
|
+ }
|
|
|
+ if (type === 'updateone'){
|
|
|
+ dialogTitle.value = '志愿编辑'
|
|
|
+ submitFormText.value = '编辑'
|
|
|
+ formType.value = type
|
|
|
+ resetForm()
|
|
|
+ if (id) {
|
|
|
+ formLoading.value = true
|
|
|
+ try {
|
|
|
+ const result =await UserApi.getUser(id)
|
|
|
+ studentData.value.nickname=result.nickname
|
|
|
+ studentData.value.userNumber=result.userNumber
|
|
|
+ studentData.value.major=result.major
|
|
|
+ studentData.value.mobile=result.mobile
|
|
|
+ const supervisor = await supervisorSelectionSettingApi.getSupervisorInfo(supervisorId,projectId);
|
|
|
+ formData.value = await studentSelectSupervisorRecordApi.getStudentSelectSupervisorRecord(id)
|
|
|
+ } finally {
|
|
|
+ formLoading.value = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ await getProjectSupervisors()
|
|
|
|
|
|
}
|
|
|
if (type === 'updatetwo'){
|
|
@@ -375,15 +433,14 @@ const open = async (type: string, projectId?: number, supervisorId?:number, id?:
|
|
|
formLoading.value = false
|
|
|
}
|
|
|
}
|
|
|
- if (studentId) {
|
|
|
+ if (id) {
|
|
|
formLoading.value = true
|
|
|
try {
|
|
|
- const result =await UserApi.getUser(studentId)
|
|
|
+ const result =await UserApi.getUser(id)
|
|
|
studentData.value.nickname=result.nickname
|
|
|
studentData.value.userNumber=result.userNumber
|
|
|
studentData.value.major=result.major
|
|
|
studentData.value.mobile=result.mobile
|
|
|
-
|
|
|
const supervisor = await supervisorSelectionSettingApi.getSupervisorInfo(supervisorId,projectId);
|
|
|
//显示的
|
|
|
supervisorData.value.nickname = supervisor.supervisorName;
|
|
@@ -397,7 +454,7 @@ const open = async (type: string, projectId?: number, supervisorId?:number, id?:
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- await getProjectSupervisors(projectId)
|
|
|
+ await getProjectSupervisors()
|
|
|
}
|
|
|
if (type === 'end'){
|
|
|
dialogTitle.value = '详情'
|
|
@@ -433,23 +490,15 @@ const open = async (type: string, projectId?: number, supervisorId?:number, id?:
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- await nextTick();
|
|
|
- if (canvas.value) {
|
|
|
- context.value = canvas.value.getContext('2d');
|
|
|
- context.value.lineWidth = 2; // 设置线条宽度
|
|
|
- context.value.lineCap = 'round'; // 设置线条末端样式
|
|
|
- context.value.strokeStyle = 'black'; // 设置线条颜色
|
|
|
- } else {
|
|
|
- console.error('Canvas element is not found');
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// 获取当前项目的导师
|
|
|
const supervisorsin = ref()
|
|
|
-const getProjectSupervisors = async (projectId: number) => {
|
|
|
- console.log('请求的项目ID:', projectId);
|
|
|
- const result = await studentSelectionProjectApi.getProjectSupervisors(projectId);
|
|
|
- console.log(result,'获取到的导师信息');
|
|
|
+const getProjectSupervisors = async () => {
|
|
|
+ // console.log('请求的项目ID:', projectId);
|
|
|
+ const result = await studentSelectionProjectApi.getProjectSupervisors();
|
|
|
+ // console.log(result,'获取到的导师信息');
|
|
|
supervisorsin.value = result
|
|
|
}
|
|
|
|
|
@@ -459,9 +508,7 @@ const handleExport = (row) => {
|
|
|
htmlPdf(fileName, formElement, row);
|
|
|
dialogVisible.value = false;
|
|
|
};
|
|
|
-defineExpose({ open, handleExport });
|
|
|
-
|
|
|
-const canvas = ref() // 签名画布
|
|
|
+
|
|
|
const isDrawing = ref(false) // 是否正在画
|
|
|
const context = ref() // 签名画布的上下文
|
|
|
|
|
@@ -498,6 +545,24 @@ const handleMouseUp = () => {
|
|
|
isDrawing.value = false
|
|
|
}
|
|
|
|
|
|
+// 重签
|
|
|
+const handleResign = async () => {
|
|
|
+ formData.value.supervisorSignature = ''; // 清空当前签名
|
|
|
+ lastSupervisorSignature.value = ''; // 清空历史签名
|
|
|
+ ClearSupervisorSignature(); // 清空签名画布
|
|
|
+ console.log(canvas.value,'canvas.value')
|
|
|
+ if (canvas.value) {
|
|
|
+ context.value = canvas.value.getContext('2d'); // 获取上下文
|
|
|
+ context.value.clearRect(0, 0, canvas.value.width, canvas.value.height); // 清空画布
|
|
|
+ context.value.lineWidth = 2; // 设置线条宽度
|
|
|
+ context.value.lineCap = 'round'; // 设置线条末端样式
|
|
|
+ context.value.strokeStyle = 'black'; // 设置线条颜色
|
|
|
+ message.success('导师签名已重置');
|
|
|
+ } else {
|
|
|
+ console.error('Canvas element is not found');
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
const ClearStudentSignature = () => {
|
|
|
if (context.value) {
|
|
|
formData.value.studentSignature = "";
|
|
@@ -520,7 +585,7 @@ const handleStudentSignatureSave = () => {
|
|
|
};
|
|
|
|
|
|
const ClearSupervisorSignature = () => {
|
|
|
- if (context.value) {
|
|
|
+ if (canvas.value && context.value) {
|
|
|
formData.value.supervisorSignature = "";
|
|
|
context.value.clearRect(0, 0, canvas.value.width, canvas.value.height);
|
|
|
message.success('签名已清空');
|
|
@@ -591,6 +656,7 @@ const isSupervisor = computed(() => userInfo.value.userType === '3');
|
|
|
const handleSupervisorChange = (supervisorId?:number) => {
|
|
|
supervisorId = supervisors.value.id;
|
|
|
}
|
|
|
+defineExpose({ open, handleExport });
|
|
|
|
|
|
/** 重置表单 */
|
|
|
const resetForm = () => {
|
|
@@ -609,9 +675,12 @@ const resetForm = () => {
|
|
|
}
|
|
|
|
|
|
/** 初始化 **/
|
|
|
-onMounted(() => {
|
|
|
+onMounted( async () => {
|
|
|
getSupervisor()
|
|
|
getUserInfo()
|
|
|
+ if (userInfo.value.userType === '3'){
|
|
|
+ await getSupervisorSignature()
|
|
|
+ }
|
|
|
})
|
|
|
</script>
|
|
|
|