入伍和外宿申请-已办任务的详情表单数据哦

This commit is contained in:
2025-12-16 10:49:40 +08:00
parent 0ffbd2d804
commit 6ee21d3d98
4 changed files with 235 additions and 46 deletions

View File

@@ -112,7 +112,7 @@
<!-- 佐证附件 --> <!-- 佐证附件 -->
<el-descriptions-item label="佐证附件" required> <el-descriptions-item label="佐证附件" required>
<el-form-item prop="affixId" class="no-label-form-item"> <el-form-item prop="affixId" class="no-label-form-item">
<AffixIndex ref="affixComponent" v-model="form.affixId" @input="handleAffix" @fileUploaded="handleAffix" <AffixIndex ref="affixComponent" v-model="form.affixId" @input="getffix" @fileUploaded="handleAffix"
@delete-file="handleDeleteFile" /> @delete-file="handleDeleteFile" />
<div class="el-upload__tip"> <div class="el-upload__tip">
支持上传jpg/png/pdf格式文件单个文件不超过10MB如病例住房证明等 支持上传jpg/png/pdf格式文件单个文件不超过10MB如病例住房证明等
@@ -408,7 +408,7 @@ export default {
promiseDate: [{ required: true, message: '请选择签署日期', trigger: 'change' }], promiseDate: [{ required: true, message: '请选择签署日期', trigger: 'change' }],
studentSignature: [{ required: true, message: '请完成电子签名', trigger: 'change' }], studentSignature: [{ required: true, message: '请完成电子签名', trigger: 'change' }],
studentPromiseSign: [{ required: true, message: '请完成承诺签名', trigger: 'change' }], studentPromiseSign: [{ required: true, message: '请完成承诺签名', trigger: 'change' }],
// affixId: [{ required: true, message: '请上传佐证材料', trigger: 'change' }], affixId: [{ required: true, message: '请上传佐证材料', trigger: 'change' }],
parentSignAttachment: [ parentSignAttachment: [
{ {
required: true, required: true,
@@ -771,28 +771,35 @@ export default {
this.clearStudentCanvas() this.clearStudentCanvas()
this.clearPromiseCanvas() this.clearPromiseCanvas()
}, },
// 处理 AffixIndex 组件回传:既支持 v-model 返回的 affixId也支持文件信息对象 getffix(affixId) {
this.form.affixId = affixId
},
// 处理 AffixIndex 组件回传:支持文件信息对象
handleAffix(payload) { handleAffix(payload) {
if (typeof payload === 'string' || typeof payload === 'number') { // if (typeof payload === 'string' || typeof payload === 'number') {
this.form.affixId = payload // this.form.affixId = payload
return // return
} // }
const fileInfo = payload const fileInfo = payload
if (!fileInfo || !fileInfo.fileName || !fileInfo.filePath) { if (!fileInfo || !fileInfo.fileName || !fileInfo.filePath) {
this.$message.warning('附件标识异常或文件信息缺失,请重新上传') this.$message.warning('附件标识异常或文件信息缺失,请重新上传')
return return
} }
// 构建与后端实体匹配的data对象
const data = { const data = {
applyId: this.form.id || null, // id: null, // 主键(后端自增)
attachmentName: fileInfo.fileName, applyId: this.form.id || null, // 关联申请表ID从主表单获取
attachmentUrl: fileInfo.filePath, attachmentName: fileInfo.fileName, // 文件名(从组件传递的信息中获取)
filePath: fileInfo.filePath, attachmentUrl: fileInfo.filePath, // 文件路径相对路径关联sys_file表
fileSize: fileInfo.originalFile?.size || 0, filePath: fileInfo.filePath, // 文件路径相对路径关联sys_file表
fileSuffix: fileInfo.fileType, fileSize: fileInfo.originalFile?.size || 0, // 若需要可从fileInfo.originalFile.size获取单位字节
processInstanceId: this.form.processInstanceId || '', fileSuffix: fileInfo.fileType, // 文件类型如docx、pdf
studentName: this.form.studentName || '', processInstanceId: this.form.processInstanceId || '', // 申请编号(从主表单获取)
studentNo: this.form.studentNo || '' studentName: this.form.studentName || '', // 学生姓名(从主表单获取)
} studentNo: this.form.studentNo || '' // 学号(从主表单获取)
}
// 避免重复添加根据filePath去重
const isDuplicate = this.reasonFileList.some((item) => item.filePath === data.filePath) const isDuplicate = this.reasonFileList.some((item) => item.filePath === data.filePath)
if (isDuplicate) { if (isDuplicate) {
this.$message.warning('该文件已添加,请勿重复上传') this.$message.warning('该文件已添加,请勿重复上传')

View File

@@ -104,6 +104,22 @@ export default {
this.loadData(newVal) 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() { beforeUnmount() {
@@ -119,22 +135,29 @@ export default {
}, },
isImageURL(url) { isImageURL(url) {
// 修复正则:原正则会匹配以这些字符结尾,但写法有问题(少了\. // 正则:原正则会匹配以这些字符结尾
const regex = /(\.jpg|\.jpeg|\.png|\.gif|\.webp)$/i const regex = /(\.jpg|\.jpeg|\.png|\.gif|\.webp)$/i
return regex.test(url) return regex.test(url)
}, },
// 处理上传请求(改为加入队列 // 处理上传请求(修复队列立即执行逻辑
handleUpload(file) { handleUpload(file) {
// 生成统一的UID确保和beforeUpload中的UID一致
const fileUid = file.file.uid || Date.now() + Math.random()
file.file.uid = fileUid
// 将文件加入上传队列 // 将文件加入上传队列
this.uploadQueue.push(file) this.uploadQueue.push(file)
// 若未在上传,则执行队列
if (!this.isUploading) { // 立即执行队列(修复第一次上传不触发的问题)
this.processUploadQueue() this.$nextTick(() => {
} if (!this.isUploading) {
this.processUploadQueue()
}
})
}, },
// 串行处理上传队列(核心修复并发问题) // 串行处理上传队列(核心修复第一次上传问题)
async processUploadQueue() { async processUploadQueue() {
// 队列为空则结束 // 队列为空则结束
if (this.uploadQueue.length === 0) { if (this.uploadQueue.length === 0) {
@@ -146,17 +169,12 @@ export default {
this.isUploading = true this.isUploading = true
// 取出队列第一个文件 // 取出队列第一个文件
const file = this.uploadQueue.shift() const file = this.uploadQueue.shift()
const currentFileUid = file.file.uid || Date.now() + Math.random() // 使用文件自带的UID和beforeUpload中保持一致
const currentFileUid = file.file.uid
// 确保affixId存在 // 确保affixId存在
if (!this.affixId) { if (!this.affixId) {
this.affixId = this.$tool.uuid() this.affixId = this.$tool.uuid()
// 若后端需要先创建affix主记录取消注释并调整根据实际情况
// await this.createAffixRecord(this.affixId)
this.$nextTick(() => {
this.$emit('input', this.affixId)
this.$emit('change', this.affixId)
})
} }
try { try {
@@ -165,7 +183,7 @@ export default {
this.uploadCnt-- this.uploadCnt--
if (res.code === 200) { if (res.code === 200) {
// 通过uid匹配文件解决同名文件问题) // 通过uid匹配文件修复匹配不到的问题)
const fileIndex = this.fileList.findIndex(item => const fileIndex = this.fileList.findIndex(item =>
item.uid === currentFileUid && item.status === 1 item.uid === currentFileUid && item.status === 1
) )
@@ -173,13 +191,13 @@ export default {
if (fileIndex > -1) { if (fileIndex > -1) {
const savePath = this.baseurl + res.savePath const savePath = this.baseurl + res.savePath
// 更新文件信息 // 更新文件信息
this.fileList[fileIndex] = { this.fileList.splice(fileIndex, 1, {
...this.fileList[fileIndex], ...this.fileList[fileIndex],
id: res.id, id: res.id,
status: 2, status: 2,
savePath: savePath, savePath: savePath,
trueName: res.trueName trueName: res.trueName
} })
// 预览列表去重添加 // 预览列表去重添加
if (this.isImageURL(savePath) && !this.previewList.includes(savePath)) { if (this.isImageURL(savePath) && !this.previewList.includes(savePath)) {
@@ -201,6 +219,9 @@ export default {
fileList: JSON.parse(JSON.stringify(this.fileList)), fileList: JSON.parse(JSON.stringify(this.fileList)),
previewList: JSON.parse(JSON.stringify(this.previewList)) previewList: JSON.parse(JSON.stringify(this.previewList))
} }
// 强制更新视图
this.$forceUpdate()
} }
} else { } else {
this.$message.error(res.message || '上传失败') this.$message.error(res.message || '上传失败')
@@ -236,7 +257,7 @@ export default {
} }
} }
// 处理下一个文件 // 立即处理下一个文件(移除异步延迟)
this.processUploadQueue() this.processUploadQueue()
}, },
@@ -247,6 +268,7 @@ export default {
) )
if (fileIndex > -1) { if (fileIndex > -1) {
this.fileList.splice(fileIndex, 1) this.fileList.splice(fileIndex, 1)
this.$forceUpdate() // 确保视图更新
} }
}, },
@@ -254,6 +276,7 @@ export default {
async createAffixRecord(affixId) { async createAffixRecord(affixId) {
try { try {
// await createAffix({ affixId: affixId }) // await createAffix({ affixId: affixId })
// 创建成功后自动触发watch
} catch (err) { } catch (err) {
this.$message.error('创建附件记录失败:' + err.message) this.$message.error('创建附件记录失败:' + err.message)
} }
@@ -269,10 +292,6 @@ export default {
// 生成affixId若不存在 // 生成affixId若不存在
if (!this.affixId) { if (!this.affixId) {
this.affixId = this.$tool.uuid() 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!`) this.$message.error(`上传大小不能超过 ${this.maxSize}MB!`)
return false // 显式阻止上传 return false // 显式阻止上传
} else { } else {
// 为文件添加唯一标识uid解决同名文件匹配问题 // 生成统一的UID确保和handleUpload中一致
const fileUid = file.uid || Date.now() + Math.random() const fileUid = file.uid || Date.now() + Math.random()
this.fileList.push({ file.uid = fileUid
// 立即添加文件到列表(确保视图能及时显示)
const newFile = {
name: file.name, name: file.name,
status: 1, status: 1,
uid: fileUid, uid: fileUid,
rawFile: file rawFile: file
}) }
// 先清空同名未上传文件(避免重复)
this.fileList = this.fileList.filter(item => !(item.name === file.name && item.status === 1))
this.fileList.push(newFile)
// 立即更新视图
this.$forceUpdate()
this.uploadCnt++ this.uploadCnt++
return true return true
} }
}, },
@@ -355,7 +385,6 @@ export default {
if (this.fileList.length === 0) { if (this.fileList.length === 0) {
delete this.cacheData[this.affixId] delete this.cacheData[this.affixId]
this.affixId = '' this.affixId = ''
this.$emit('input', '')
} else { } else {
// 更新缓存(深拷贝) // 更新缓存(深拷贝)
this.cacheData[this.affixId] = { this.cacheData[this.affixId] = {
@@ -365,6 +394,7 @@ export default {
} }
// 触发删除事件 // 触发删除事件
this.$emit('delete-file', file.name) this.$emit('delete-file', file.name)
this.$forceUpdate()
} else { } else {
this.$message.error(res.message || '删除失败') this.$message.error(res.message || '删除失败')
} }
@@ -455,7 +485,23 @@ export default {
this.isUploading = false this.isUploading = false
// 清空缓存 // 清空缓存
delete this.cacheData[this.affixId] 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 })
}
})
} }
} }
} }

View File

@@ -313,6 +313,98 @@
{{ form.instructionSchoolHours }} {{ form.instructionSchoolHours }}
</el-descriptions-item> </el-descriptions-item>
</el-descriptions> </el-descriptions>
<!-- 入伍保留学籍表单 -->
<el-descriptions v-if="enlistmentReserveForm" class="margin-top" title="" :column="4" size="medium" border style="width: 100%">
<el-descriptions-item>
<template slot="label"> 姓名 </template>
{{ form.studentName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label"> 性别 </template>
<span v-if="form.gender == 1"></span>
<span v-else></span>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label"> 民族 </template>
<!-- {{ form.nation }} -->
<dict-tag :options="dict.type.rt_nation" :value="form.nation" />
</el-descriptions-item>
<el-descriptions-item>
<template slot="label"> 年级 </template>
{{ form.grade }}
</el-descriptions-item>
<el-descriptions-item span="2">
<template slot="label"> 专业名称 </template>
{{ form.major }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label"> 学号 </template>
{{ form.studentNo }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label"> 班级 </template>
{{ form.className }}
</el-descriptions-item>
<el-descriptions-item span="2">
<template slot="label"> 家庭地址 </template>
{{ form.familyAddress }}
</el-descriptions-item>
<el-descriptions-item span="2">
<template slot="label"> 家长电话 </template>
{{ form.parentPhone }}
</el-descriptions-item>
<el-descriptions-item span="4">
<template slot="label"> 附件材料 </template>
<Affix v-model="form.affixId" :disabled="true" />
</el-descriptions-item>
<el-descriptions-item span="4">
<template slot="label"> 申请原因 </template>
<div style="padding-top: 10px;">
{{ form.applyReason }}
</div>
<div style="padding: 20px;">
<div style="display: flex;justify-content: flex-end;align-items: center;">
<div style="padding: 0 10px;">申请人 {{ form.studentName }}</div>
<div style="padding: 0 10px;">日期 {{ form.createTime }}</div>
</div>
</div>
</el-descriptions-item>
<el-descriptions-item span="4" v-for="item in form.enlistmentReserveApprovalList" >
<template slot="label"> {{ item.opinionType }} </template>
<div style="padding-top: 10px;">
{{ item.approvalOpinion || "暂无意见" }}
</div>
<div style="padding: 20px;">
<div style="display: flex;justify-content: flex-end;align-items: center;">
<div style="padding: 0 10px;">
审批结果
<el-tag v-if="item.approvalResult == 1" type="success">通过</el-tag>
<el-tag v-else type="danger">驳回</el-tag>
</div>
<div style="padding: 0 10px;">签名 {{ item.approverName }}</div>
<div style="padding: 0 10px;">日期 {{ item.approvalTime }}</div>
</div>
</div>
</el-descriptions-item>
<!-- <el-descriptions-item span="3">
<template slot="label"> 辅导员联系情况 </template>
{{ form.ideologicalEducation }}
</el-descriptions-item> -->
<el-descriptions-item span="4">
<template slot="label"> 保留学籍时间和编号 </template>
{{ form.reserveNo }}
</el-descriptions-item>
</el-descriptions>
<!-- 外宿申请表单 -->
<div v-if="outsideAccommodationForm"><detailApply :formData="form" :isShwo="false"></detailApply></div>
</div> </div>
</el-col> </el-col>
</el-tab-pane> </el-tab-pane>
@@ -375,7 +467,9 @@ import { getRtStuQuitSchoolByProcInsId } from '@/api/routine/rtStuQuitSchool'
import Parser from '@/components/parser/Parser' import Parser from '@/components/parser/Parser'
import flow from '@/views/flowable/task/finished/detail/flow' import flow from '@/views/flowable/task/finished/detail/flow'
import '@riophae/vue-treeselect/dist/vue-treeselect.css' 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 { export default {
name: 'Record', name: 'Record',
@@ -383,6 +477,7 @@ export default {
components: { components: {
Parser, Parser,
flow, flow,
detailApply
}, },
props: {}, props: {},
data () { data () {
@@ -424,6 +519,8 @@ export default {
disposalForm: false, // 处分表单 disposalForm: false, // 处分表单
relieveForm: false, // 解除处分表单 relieveForm: false, // 解除处分表单
quitSchoolForm: false, // 休学申请表单 quitSchoolForm: false, // 休学申请表单
enlistmentReserveForm: false, // 入伍保留学籍表单
outsideAccommodationForm: false, // 外宿申请表单
form: {}, form: {},
// 学生基础信息 // 学生基础信息
stuInfo: {}, stuInfo: {},
@@ -448,6 +545,12 @@ export default {
} else if (this.category == 'quitSchool') { } else if (this.category == 'quitSchool') {
this.quitSchoolForm = true this.quitSchoolForm = true
this.getRtStuQuitSchoolByProcInsId(this.taskForm.procInsId) 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) 先注释,因为已从后台返回给数据,如果没有在放开注释 // 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) {
getStuInfo(stuNo).then((res) => { getStuInfo(stuNo).then((res) => {
if (res.code == 200) { if (res.code == 200) {

View File

@@ -1361,7 +1361,7 @@ export default {
this.updateRtStuQuitSchool() this.updateRtStuQuitSchool()
} else if (this.category == 'enlistmentReserve') { // 是应征入伍保留学籍申请,才执行 } else if (this.category == 'enlistmentReserve') { // 是应征入伍保留学籍申请,才执行
if (this.taskName == '教务处主管领导审批') { // (最后一个领导审核完成之后,修改学生学籍状态, status07是入伍保留学籍) if (this.taskName == '教务处主管领导审批') { // (最后一个领导审核完成之后,修改学生学籍状态, status07是入伍保留学籍)
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) this.$modal.msgSuccess(response.msg)
} else if (this.category == "退伍复学") { } else if (this.category == "退伍复学") {