应征入伍保留学籍申请表附件删除

This commit is contained in:
2025-11-21 17:27:49 +08:00
parent a5c6980bdd
commit a880bf7717
5 changed files with 96 additions and 33 deletions

View File

@@ -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>

View File

@@ -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({