应征入伍保留学籍申请表附件删除
This commit is contained in:
@@ -51,3 +51,12 @@ export function delEnlistmentReserveAttach(id) {
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
||||
// 删除保留学籍申请附件(入伍通知书等)
|
||||
export function deleteRtEnlistmentReserveAttachByFileNameAndStuName(query) {
|
||||
return request({
|
||||
url: '/routine/enlistmentReserveAttach/deleteRtEnlistmentReserve',
|
||||
method: 'post',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
@@ -251,6 +251,10 @@ export default {
|
||||
if(this.fileList.length == 0){
|
||||
this.affixId = ''
|
||||
}
|
||||
|
||||
// 关键:触发自定义事件,传递被删除的文件名
|
||||
// 事件名建议:delete-file,参数:file.name(文件名)
|
||||
this.$emit('delete-file', file.name);
|
||||
} else {
|
||||
this.$message.error(res.message)
|
||||
}
|
||||
|
||||
@@ -728,7 +728,8 @@ export default {
|
||||
variables: {
|
||||
variables: {},
|
||||
approvalOpinion: '', // 必须初始化,避免 null 报错
|
||||
approvalResult: ''
|
||||
approvalResult: '',
|
||||
targetNodeName: ''
|
||||
},
|
||||
penaltyNumber: '',
|
||||
letterServiceContent: '',
|
||||
@@ -1014,26 +1015,9 @@ export default {
|
||||
this.taskForm.variables = res.data.formData
|
||||
|
||||
|
||||
// 初始化或完善 variables 对象,确保 approvalOpinion(入伍保留学籍申请审核意见) 存在
|
||||
if (this.taskForm.variables == null) {
|
||||
// 情况1:variables 为 null → 初始化完整结构(包含原有 variables 嵌套和 approvalOpinion)
|
||||
this.taskForm.variables = {
|
||||
variables: {}, // 保留原有的嵌套 variables 结构(后端可能依赖)
|
||||
approvalOpinion: '', // 初始化审批意见为空白
|
||||
approvalResult: ''
|
||||
}
|
||||
} else {
|
||||
// 情况2:variables 已存在 → 保留原有字段,补充 approvalOpinion(无则添加,有则保留原值)
|
||||
this.taskForm.variables = {
|
||||
...this.taskForm.variables, // 展开原有所有字段(如 variables、其他自定义字段)
|
||||
approvalOpinion: this.taskForm.variables.approvalOpinion || '', // 兜底:若原有未定义则设为空白
|
||||
approvalResult: this.taskForm.variables.approvalOpinion || ''
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 初始化或完善 variables 对象,确保 approvalOpinion(入伍保留学籍申请审核意见) 存在
|
||||
this.initApproval()
|
||||
|
||||
this.formKeyExist = res.data.formKeyExist
|
||||
})
|
||||
}
|
||||
@@ -1172,10 +1156,33 @@ export default {
|
||||
returnList(this.taskForm).then((res) => {
|
||||
this.returnTaskList = res.data
|
||||
this.taskForm.variables = null
|
||||
|
||||
|
||||
if (this.category == 'enlistmentReserve') {
|
||||
// 过滤returnTaskList,保留documentation在flowRecordList的taskName中存在的项
|
||||
this.returnTaskList = this.returnTaskList.filter(returnTask => {
|
||||
// 检查flowRecordList中是否有项的taskName等于当前returnTask的documentation
|
||||
return this.flowRecordList.some(record => record.taskName === returnTask.documentation)
|
||||
})
|
||||
console.log(this.flowRecordList);
|
||||
|
||||
}
|
||||
this.initApproval()
|
||||
})
|
||||
},
|
||||
/** 提交退回任务 */
|
||||
taskReturn() {
|
||||
// 入伍保留学籍审核状态和意见
|
||||
if (this.category == 'enlistmentReserve') {
|
||||
this.taskForm.variables.approvalResult = 3
|
||||
this.taskForm.variables.approvalOpinion = this.taskForm.comment
|
||||
this.returnTaskList.forEach(element => {
|
||||
if (element.id == this.taskForm.targetKey) {
|
||||
this.taskForm.variables.targetNodeName = element.documentation
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.$refs['taskForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
returnTask(this.taskForm).then((res) => {
|
||||
@@ -1240,6 +1247,27 @@ export default {
|
||||
fileUpload() {
|
||||
download.resource(this.pdfURL)
|
||||
},
|
||||
// 初始化入伍保留学籍申请审核意见参数
|
||||
initApproval() {
|
||||
// 初始化或完善 variables 对象,确保 approvalOpinion(入伍保留学籍申请审核意见) 存在
|
||||
if (this.taskForm.variables == null) {
|
||||
// 情况1:variables 为 null → 初始化完整结构(包含原有 variables 嵌套和 approvalOpinion)
|
||||
this.taskForm.variables = {
|
||||
variables: {}, // 保留原有的嵌套 variables 结构(后端可能依赖)
|
||||
approvalOpinion: '', // 初始化审批意见为空白
|
||||
approvalResult: '', // 审批状态
|
||||
targetNodeName: '' // 审批节点
|
||||
}
|
||||
} else {
|
||||
// 情况2:variables 已存在 → 保留原有字段,补充 approvalOpinion(无则添加,有则保留原值)
|
||||
this.taskForm.variables = {
|
||||
...this.taskForm.variables, // 展开原有所有字段(如 variables、其他自定义字段)
|
||||
approvalOpinion: this.taskForm.variables.approvalOpinion || '', // 兜底:若原有未定义则设为空白
|
||||
approvalResult: this.taskForm.variables.approvalResult || '',
|
||||
targetNodeName: this.taskForm.variables.targetNodeName || ''
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -248,7 +248,7 @@
|
||||
<el-form-item prop="affixId">
|
||||
<p class="attachment-tip">
|
||||
<span style="color: red">请上传:入伍通知书等佐证材料.</span>
|
||||
<Affix v-model="formData.affixId" @input="handleAffix" @fileUploaded="handleAffix" />
|
||||
<Affix v-model="formData.affixId" @input="handleAffix" @fileUploaded="handleAffix" @delete-file="handleDeleteFile"/>
|
||||
</p>
|
||||
</el-form-item>
|
||||
|
||||
@@ -425,9 +425,9 @@
|
||||
<!-- 操作按钮 -->
|
||||
<div class="form-btn-group">
|
||||
<el-button type="primary" @click="submitForm(0)">保存</el-button>
|
||||
<el-button type="primary" @click="submitForm(1)">提交申请</el-button>
|
||||
<el-button @click="resetForm">重置表单</el-button>
|
||||
<el-button type="text" @click="printForm">打印表单</el-button>
|
||||
<el-button type="primary" @click="submitForm(1)" v-if="formData.applyStatus == 0">提交申请</el-button>
|
||||
<!-- <el-button @click="resetForm">重置表单</el-button> -->
|
||||
<!-- <el-button type="text" @click="printForm">打印表单</el-button> -->
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
@@ -435,7 +435,7 @@
|
||||
|
||||
<script>
|
||||
import { getOwnInfo, getEnlistmentReserve, delEnlistmentReserve, addEnlistmentReserve, updateEnlistmentReserve } from "@/api/routine/enlistmentReserve/enlistmentReserve";
|
||||
import { batchAddEnlistmentReserveAttach } from "@/api/routine/enlistmentReserve/enlistmentReserveAttach";
|
||||
import { batchAddEnlistmentReserveAttach, deleteRtEnlistmentReserveAttachByFileNameAndStuName } from "@/api/routine/enlistmentReserve/enlistmentReserveAttach";
|
||||
import { getUserProfile } from '@/api/system/user' // 获取当前登录用户
|
||||
import { flowRecord } from '@/api/flowable/finished'
|
||||
export default {
|
||||
@@ -603,6 +603,7 @@ export default {
|
||||
this.getFlowRecordList()
|
||||
} else {
|
||||
this.deployId = null
|
||||
this.loading = false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -678,10 +679,9 @@ export default {
|
||||
if (!this.formData.applyNo) {
|
||||
const year = new Date().getFullYear();
|
||||
const randomNo = Math.floor(Math.random() * 1000000).toString().padStart(6, '0');
|
||||
this.formData.applyNo = `RY${year}${randomNo}`;
|
||||
this.formData.reserveNo = `RN${year}${randomNo}`;
|
||||
this.formData.applyNo = `RY${year}${randomNo}`; // 获取申请编号
|
||||
this.formData.reserveNo = `RN${year}${randomNo}`; // 获取保留学籍编号
|
||||
}
|
||||
this.formData.applyStatus = applyStatus;
|
||||
this.formData.updateTime = new Date().toISOString().split('T')[0];
|
||||
this.formData.applyReason = "本人应征入伍,申请保留学籍从 " + this.formData.reserveStartDate + " 至退役后两年。"
|
||||
|
||||
@@ -695,6 +695,8 @@ export default {
|
||||
this.loading = false;
|
||||
});
|
||||
} else {
|
||||
// 新增的时候根据点击的按钮确定状态,点击保存按钮申请状态是草稿,点击提交按钮申请状态就是待审核
|
||||
this.formData.applyStatus = applyStatus;
|
||||
addEnlistmentReserve(submitData.formData).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
// 申请表新增成功之后,进行附件的添加
|
||||
@@ -704,11 +706,13 @@ export default {
|
||||
element.applyNo = this.formData.applyNo
|
||||
element.applyId = response.data.id
|
||||
})
|
||||
batchAddEnlistmentReserveAttach(this.enlistmentReserveAttachList)
|
||||
this.loading = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
// 批量新增材料附件
|
||||
batchAddEnlistmentReserveAttach(this.enlistmentReserveAttachList)
|
||||
this.goBack()
|
||||
// this.$message.success('提交成功!');
|
||||
} else {
|
||||
this.$message.error('表单填写不完整,请检查!');
|
||||
@@ -779,7 +783,16 @@ export default {
|
||||
}
|
||||
console.log(this.enlistmentReserveAttachList);
|
||||
|
||||
}
|
||||
},
|
||||
// 处理子组件传递的删除文件事件
|
||||
handleDeleteFile(fileName) {
|
||||
// 接收文件名后,可执行后续逻辑,删除在数据库的数据
|
||||
if (fileName) {
|
||||
deleteRtEnlistmentReserveAttachByFileNameAndStuName({fileName:fileName, studentName: this.formData.studentName}).then(res => {
|
||||
this.$message.success(`成功删除文件:${fileName}`);
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['routine:enlistmentReserve:edit']" v-if="scope.row.applyStatus == 0">修改</el-button>
|
||||
v-hasPermi="['routine:enlistmentReserve:edit']" v-if="scope.row.applyStatus == 0">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['routine:enlistmentReserve:remove']" v-if="scope.row.applyStatus == 0">删除</el-button>
|
||||
<el-button v-if="scope.row.applyStatus == 1" size="mini" type="text" icon="el-icon-info"
|
||||
@@ -454,7 +454,16 @@ export default {
|
||||
},
|
||||
// 跳转申请表
|
||||
openForm() {
|
||||
this.$router.push("/routine/enlistmentReserve/applicationForm")
|
||||
// 利用some方法快速判断是否存在重复申请(找到匹配项后立即终止遍历)
|
||||
const isDuplicate = this.enlistmentReserveList?.some(element =>
|
||||
element.studentName === this.user?.nickName && element.studentNo === this.user?.userName
|
||||
) || false;
|
||||
|
||||
if (isDuplicate) {
|
||||
this.$message.error('您已经申请过了,请勿重新申请!');
|
||||
} else {
|
||||
this.$router.push("/routine/enlistmentReserve/applicationForm");
|
||||
}
|
||||
},
|
||||
detail(row) {
|
||||
this.$router.push({
|
||||
|
||||
Reference in New Issue
Block a user