From 6ee21d3d984447af90f8bf2481eaefb99373a07d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=81=92=E6=88=90?= <962704835@qq.com> Date: Tue, 16 Dec 2025 10:49:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A5=E4=BC=8D=E5=92=8C=E5=A4=96=E5=AE=BF?= =?UTF-8?q?=E7=94=B3=E8=AF=B7-=E5=B7=B2=E5=8A=9E=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E7=9A=84=E8=AF=A6=E6=83=85=E8=A1=A8=E5=8D=95=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=93=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../applicationForm.vue | 41 +++--- .../components/affix/index.vue | 100 +++++++++---- .../flowable/task/finished/detail/index.vue | 138 +++++++++++++++++- src/views/flowable/task/todo/detail/index.vue | 2 +- 4 files changed, 235 insertions(+), 46 deletions(-) diff --git a/src/views/dormitory/outsideAccommodation/outsideAccommodationApply/applicationForm.vue b/src/views/dormitory/outsideAccommodation/outsideAccommodationApply/applicationForm.vue index 713933e..50de120 100644 --- a/src/views/dormitory/outsideAccommodation/outsideAccommodationApply/applicationForm.vue +++ b/src/views/dormitory/outsideAccommodation/outsideAccommodationApply/applicationForm.vue @@ -112,7 +112,7 @@ -
支持上传jpg/png/pdf格式文件,单个文件不超过10MB(如病例、住房证明等) @@ -408,7 +408,7 @@ export default { promiseDate: [{ required: true, message: '请选择签署日期', trigger: 'change' }], studentSignature: [{ required: true, message: '请完成电子签名', trigger: 'change' }], studentPromiseSign: [{ required: true, message: '请完成承诺签名', trigger: 'change' }], - // affixId: [{ required: true, message: '请上传佐证材料', trigger: 'change' }], + affixId: [{ required: true, message: '请上传佐证材料', trigger: 'change' }], parentSignAttachment: [ { required: true, @@ -771,28 +771,35 @@ export default { this.clearStudentCanvas() this.clearPromiseCanvas() }, - // 处理 AffixIndex 组件回传:既支持 v-model 返回的 affixId,也支持文件信息对象 + getffix(affixId) { + this.form.affixId = affixId + }, + // 处理 AffixIndex 组件回传:支持文件信息对象 handleAffix(payload) { - if (typeof payload === 'string' || typeof payload === 'number') { - this.form.affixId = payload - return - } + // if (typeof payload === 'string' || typeof payload === 'number') { + // this.form.affixId = payload + // return + // } const fileInfo = payload if (!fileInfo || !fileInfo.fileName || !fileInfo.filePath) { this.$message.warning('附件标识异常或文件信息缺失,请重新上传') return } + // 构建与后端实体匹配的data对象 const data = { - applyId: this.form.id || null, - attachmentName: fileInfo.fileName, - attachmentUrl: fileInfo.filePath, - filePath: fileInfo.filePath, - fileSize: fileInfo.originalFile?.size || 0, - fileSuffix: fileInfo.fileType, - processInstanceId: this.form.processInstanceId || '', - studentName: this.form.studentName || '', - studentNo: this.form.studentNo || '' - } + // id: null, // 主键(后端自增) + applyId: this.form.id || null, // 关联申请表ID(从主表单获取) + attachmentName: fileInfo.fileName, // 文件名(从组件传递的信息中获取) + attachmentUrl: fileInfo.filePath, // 文件路径(相对路径,关联sys_file表) + filePath: fileInfo.filePath, // 文件路径(相对路径,关联sys_file表) + fileSize: fileInfo.originalFile?.size || 0, // 若需要,可从fileInfo.originalFile.size获取(单位:字节) + fileSuffix: fileInfo.fileType, // 文件类型(如docx、pdf) + processInstanceId: this.form.processInstanceId || '', // 申请编号(从主表单获取) + studentName: this.form.studentName || '', // 学生姓名(从主表单获取) + studentNo: this.form.studentNo || '' // 学号(从主表单获取) + } + + // 避免重复添加(根据filePath去重) const isDuplicate = this.reasonFileList.some((item) => item.filePath === data.filePath) if (isDuplicate) { this.$message.warning('该文件已添加,请勿重复上传') diff --git a/src/views/dormitory/outsideAccommodation/outsideAccommodationApply/components/affix/index.vue b/src/views/dormitory/outsideAccommodation/outsideAccommodationApply/components/affix/index.vue index bedd881..1039365 100644 --- a/src/views/dormitory/outsideAccommodation/outsideAccommodationApply/components/affix/index.vue +++ b/src/views/dormitory/outsideAccommodation/outsideAccommodationApply/components/affix/index.vue @@ -104,6 +104,22 @@ export default { this.loadData(newVal) } } + }, + // 关键:监听affixId变化,确保外部能捕获 + affixId: { + immediate: true, + handler(newVal, oldVal) { + if (newVal !== oldVal || newVal) { + // 使用$nextTick确保DOM更新后再emit + this.$nextTick(() => { + this.$emit('input', newVal) + // 额外触发change事件,方便外部监听 + this.$emit('affixId-change', newVal) + // 更新v-model绑定(兼容不同Vue版本) + this.$emit('update:value', newVal) + }) + } + } } }, beforeUnmount() { @@ -119,22 +135,29 @@ export default { }, isImageURL(url) { - // 修复正则:原正则会匹配以这些字符结尾,但写法有问题(少了\.) + // 正则:原正则会匹配以这些字符结尾 const regex = /(\.jpg|\.jpeg|\.png|\.gif|\.webp)$/i return regex.test(url) }, - // 处理上传请求(改为加入队列) + // 处理上传请求(修复队列立即执行逻辑) handleUpload(file) { + // 生成统一的UID(确保和beforeUpload中的UID一致) + const fileUid = file.file.uid || Date.now() + Math.random() + file.file.uid = fileUid + // 将文件加入上传队列 this.uploadQueue.push(file) - // 若未在上传,则执行队列 - if (!this.isUploading) { - this.processUploadQueue() - } + + // 立即执行队列(修复第一次上传不触发的问题) + this.$nextTick(() => { + if (!this.isUploading) { + this.processUploadQueue() + } + }) }, - // 串行处理上传队列(核心修复并发问题) + // 串行处理上传队列(核心修复第一次上传问题) async processUploadQueue() { // 队列为空则结束 if (this.uploadQueue.length === 0) { @@ -146,17 +169,12 @@ export default { this.isUploading = true // 取出队列第一个文件 const file = this.uploadQueue.shift() - const currentFileUid = file.file.uid || Date.now() + Math.random() + // 使用文件自带的UID(和beforeUpload中保持一致) + const currentFileUid = file.file.uid // 确保affixId存在 if (!this.affixId) { this.affixId = this.$tool.uuid() - // 若后端需要先创建affix主记录,取消注释并调整(根据实际情况) - // await this.createAffixRecord(this.affixId) - this.$nextTick(() => { - this.$emit('input', this.affixId) - this.$emit('change', this.affixId) - }) } try { @@ -165,7 +183,7 @@ export default { this.uploadCnt-- if (res.code === 200) { - // 通过uid匹配文件(解决同名文件问题) + // 通过uid匹配文件(修复匹配不到的问题) const fileIndex = this.fileList.findIndex(item => item.uid === currentFileUid && item.status === 1 ) @@ -173,13 +191,13 @@ export default { if (fileIndex > -1) { const savePath = this.baseurl + res.savePath // 更新文件信息 - this.fileList[fileIndex] = { + this.fileList.splice(fileIndex, 1, { ...this.fileList[fileIndex], id: res.id, status: 2, savePath: savePath, trueName: res.trueName - } + }) // 预览列表去重添加 if (this.isImageURL(savePath) && !this.previewList.includes(savePath)) { @@ -201,6 +219,9 @@ export default { fileList: JSON.parse(JSON.stringify(this.fileList)), previewList: JSON.parse(JSON.stringify(this.previewList)) } + + // 强制更新视图 + this.$forceUpdate() } } else { this.$message.error(res.message || '上传失败') @@ -236,7 +257,7 @@ export default { } } - // 处理下一个文件 + // 立即处理下一个文件(移除异步延迟) this.processUploadQueue() }, @@ -247,6 +268,7 @@ export default { ) if (fileIndex > -1) { this.fileList.splice(fileIndex, 1) + this.$forceUpdate() // 确保视图更新 } }, @@ -254,6 +276,7 @@ export default { async createAffixRecord(affixId) { try { // await createAffix({ affixId: affixId }) + // 创建成功后自动触发watch } catch (err) { this.$message.error('创建附件记录失败:' + err.message) } @@ -269,10 +292,6 @@ export default { // 生成affixId(若不存在) if (!this.affixId) { this.affixId = this.$tool.uuid() - // 若后端需要先创建affix主记录,取消注释 - // this.createAffixRecord(this.affixId).then(() => { - // this.$emit('input', this.affixId) - // }) } // 校验文件大小 @@ -281,15 +300,26 @@ export default { this.$message.error(`上传大小不能超过 ${this.maxSize}MB!`) return false // 显式阻止上传 } else { - // 为文件添加唯一标识(uid),解决同名文件匹配问题 + // 生成统一的UID(确保和handleUpload中一致) const fileUid = file.uid || Date.now() + Math.random() - this.fileList.push({ + file.uid = fileUid + + // 立即添加文件到列表(确保视图能及时显示) + const newFile = { name: file.name, status: 1, uid: fileUid, rawFile: file - }) + } + + // 先清空同名未上传文件(避免重复) + this.fileList = this.fileList.filter(item => !(item.name === file.name && item.status === 1)) + this.fileList.push(newFile) + + // 立即更新视图 + this.$forceUpdate() this.uploadCnt++ + return true } }, @@ -355,7 +385,6 @@ export default { if (this.fileList.length === 0) { delete this.cacheData[this.affixId] this.affixId = '' - this.$emit('input', '') } else { // 更新缓存(深拷贝) this.cacheData[this.affixId] = { @@ -365,6 +394,7 @@ export default { } // 触发删除事件 this.$emit('delete-file', file.name) + this.$forceUpdate() } else { this.$message.error(res.message || '删除失败') } @@ -455,7 +485,23 @@ export default { this.isUploading = false // 清空缓存 delete this.cacheData[this.affixId] - this.$emit('input', '') + }, + + // 手动获取affixId的方法(供外部调用) + getAffixId() { + return new Promise((resolve) => { + if (this.affixId) { + resolve(this.affixId) + } else { + // 监听affixId变化,直到有值 + const unwatch = this.$watch('affixId', (newVal) => { + if (newVal) { + resolve(newVal) + unwatch() // 取消监听 + } + }, { immediate: true }) + } + }) } } } diff --git a/src/views/flowable/task/finished/detail/index.vue b/src/views/flowable/task/finished/detail/index.vue index 1dc562b..922c383 100644 --- a/src/views/flowable/task/finished/detail/index.vue +++ b/src/views/flowable/task/finished/detail/index.vue @@ -313,6 +313,98 @@ {{ form.instructionSchoolHours }} + + + + + + {{ form.studentName }} + + + + + + + + + + + + + + {{ form.grade }} + + + + {{ form.major }} + + + + {{ form.studentNo }} + + + + {{ form.className }} + + + + {{ form.familyAddress }} + + + + + {{ form.parentPhone }} + + + + + + + + + + +
+ {{ form.applyReason }} +
+
+
+
申请人: {{ form.studentName }}
+
日期: {{ form.createTime }}
+
+
+
+ + + +
+ {{ item.approvalOpinion || "暂无意见" }} +
+
+
+
+ 审批结果: + 通过 + 驳回 +
+
签名: {{ item.approverName }}
+
日期: {{ item.approvalTime }}
+
+
+
+ + + + + + {{ form.reserveNo }} + +
+ +
@@ -375,7 +467,9 @@ import { getRtStuQuitSchoolByProcInsId } from '@/api/routine/rtStuQuitSchool' import Parser from '@/components/parser/Parser' import flow from '@/views/flowable/task/finished/detail/flow' import '@riophae/vue-treeselect/dist/vue-treeselect.css' - +import { getEnlistmentReserveByProcessInstanceId} from "@/api/routine/enlistmentReserve/enlistmentReserve"; +import { getOutsideAccommodationApplyByProcessInstanceId } from "@/api/dormitory/outsideAccommodation/outsideAccommodationApply"; +import detailApply from "@/views/dormitory/outsideAccommodation/outsideAccommodationApply/components/detailApply" // 外宿申请表详细 export default { name: 'Record', @@ -383,6 +477,7 @@ export default { components: { Parser, flow, + detailApply }, props: {}, data () { @@ -424,6 +519,8 @@ export default { disposalForm: false, // 处分表单 relieveForm: false, // 解除处分表单 quitSchoolForm: false, // 休学申请表单 + enlistmentReserveForm: false, // 入伍保留学籍表单 + outsideAccommodationForm: false, // 外宿申请表单 form: {}, // 学生基础信息 stuInfo: {}, @@ -448,6 +545,12 @@ export default { } else if (this.category == 'quitSchool') { this.quitSchoolForm = true this.getRtStuQuitSchoolByProcInsId(this.taskForm.procInsId) + } else if (this.category == 'enlistmentReserve') { // 应征入伍表单 + this.enlistmentReserveForm = true + this.getEnlistmentReserve(this.taskForm.procInsId) + } else if (this.category == 'outsideAccommodation') { + this.outsideAccommodationForm = true + this.getOutsideAccommodation(this.taskForm.procInsId) } // 回显流程记录 // 流程任务重获取变量表单 @@ -491,6 +594,39 @@ export default { // this.getStuInfo(this.form.stuNo) 先注释,因为已从后台返回给数据,如果没有在放开注释 }) }, + // 请求 入伍保留学籍表单数据 + getEnlistmentReserve(procInsId) { + getEnlistmentReserveByProcessInstanceId(procInsId.toString()).then((res) => { + this.form = res.data + // 处理审批意见列表,添加意见类型 + if (this.form?.enlistmentReserveApprovalList) { + // 定义意见类型数组(与索引对应:0=辅导员,1=学务,2=二级学院,3=学籍管理科,4=教务处主管领导) + const opinionTypes = [ + "辅导员意见", + "学务意见", + "二级学院意见", + "学籍管理科意见", + "教务处主管领导意见" + ]; + // 遍历审批列表,为每条数据添加 opinionType 字段 + this.form.enlistmentReserveApprovalList.forEach((item, index) => { + // 只处理前5条数据(超出部分不添加,或可根据实际需求调整) + if (index < opinionTypes.length) { + item.opinionType = opinionTypes[index]; + } else { + // 若超过5条,可设置默认值或不设置 + item.opinionType = "其他意见"; + } + }); + } + }) + }, + // 请求 外宿申请表单数据 + getOutsideAccommodation(procInsId) { + getOutsideAccommodationApplyByProcessInstanceId(procInsId.toString()).then((res) => { + this.form = res.data + }) + }, getStuInfo (stuNo) { getStuInfo(stuNo).then((res) => { if (res.code == 200) { diff --git a/src/views/flowable/task/todo/detail/index.vue b/src/views/flowable/task/todo/detail/index.vue index 6c9d184..9637332 100644 --- a/src/views/flowable/task/todo/detail/index.vue +++ b/src/views/flowable/task/todo/detail/index.vue @@ -1361,7 +1361,7 @@ export default { this.updateRtStuQuitSchool() } else if (this.category == 'enlistmentReserve') { // 是应征入伍保留学籍申请,才执行 if (this.taskName == '教务处主管领导审批') { // (最后一个领导审核完成之后,修改学生学籍状态, status:07是入伍保留学籍) - updateStudent({ stuId: this.form.studentId, status: '07' }).then(response => { }) + updateStudent({ stuId: this.form.studentId, status: '07', classId: 0 }).then(response => { }) } this.$modal.msgSuccess(response.msg) } else if (this.category == "退伍复学") {