入伍保留学籍,增加材料补上传
This commit is contained in:
@@ -50,7 +50,8 @@
|
|||||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openForm">发起入伍保留学籍申请</el-button>
|
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openForm">发起入伍保留学籍申请</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="applicationDialogShow" v-if="this.roleGroup.includes('辅导员')">批量发起入伍保留学籍申请</el-button>
|
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="applicationDialogShow"
|
||||||
|
v-if="this.roleGroup.includes('辅导员')">批量发起入伍保留学籍申请</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<!-- <el-col :span="1.5">
|
<!-- <el-col :span="1.5">
|
||||||
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
|
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
|
||||||
@@ -136,11 +137,14 @@
|
|||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
<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 || getRejectInfo(scope.row.enlistmentReserveApprovalList).isReject">修改</el-button>
|
v-hasPermi="['routine:enlistmentReserve:edit']"
|
||||||
|
v-if="scope.row.applyStatus == 0 || getRejectInfo(scope.row.enlistmentReserveApprovalList).isReject">修改</el-button>
|
||||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
<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 || roleGroup.includes('管理员')">删除</el-button>
|
v-hasPermi="['routine:enlistmentReserve:remove']"
|
||||||
<el-button size="mini" type="text" icon="el-icon-info"
|
v-if="scope.row.applyStatus == 0 || roleGroup.includes('管理员')">删除</el-button>
|
||||||
@click="detail(scope.row)">详情</el-button>
|
<el-button size="mini" type="text" icon="el-icon-info" @click="detail(scope.row)">详情</el-button>
|
||||||
|
<el-button size="mini" type="text" icon="el-icon-edit"
|
||||||
|
@click="openUpFlie(scope.row.affixId, scope.row)">上传附件</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -227,11 +231,15 @@
|
|||||||
<el-dialog title="批量申请" :visible.sync="applicationDialogOpen" width="80%" append-to-body>
|
<el-dialog title="批量申请" :visible.sync="applicationDialogOpen" width="80%" append-to-body>
|
||||||
<applicationDialog></applicationDialog>
|
<applicationDialog></applicationDialog>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
<el-dialog title="上传附件" :visible.sync="isOpenUpFlie" width="30%" append-to-body>
|
||||||
|
<Affix v-model="affixIdFlie" @input="handleAffix" @fileUploaded="handleAffix" @delete-file="handleDeleteFile" />
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listEnlistmentReserve, getOwnInfo, delEnlistmentReserve, addEnlistmentReserve, updateEnlistmentReserve } from "@/api/routine/enlistmentReserve/enlistmentReserve";
|
import { listEnlistmentReserve, getOwnInfo, delEnlistmentReserve, addEnlistmentReserve, updateEnlistmentReserve } from "@/api/routine/enlistmentReserve/enlistmentReserve";
|
||||||
|
import { batchAddEnlistmentReserveAttach, deleteRtEnlistmentReserveAttachByFileNameAndStuName } from "@/api/routine/enlistmentReserve/enlistmentReserveAttach";
|
||||||
import { getUserProfile } from '@/api/system/user' // 获取当前登录用户
|
import { getUserProfile } from '@/api/system/user' // 获取当前登录用户
|
||||||
import applicationDialog from '@/views/routine/enlistmentReserve/components/applicationDialog'
|
import applicationDialog from '@/views/routine/enlistmentReserve/components/applicationDialog'
|
||||||
export default {
|
export default {
|
||||||
@@ -260,6 +268,8 @@ export default {
|
|||||||
open: false,
|
open: false,
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
applicationDialogOpen: false,
|
applicationDialogOpen: false,
|
||||||
|
// 上传附件弹出层
|
||||||
|
isOpenUpFlie: false,
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
@@ -332,7 +342,10 @@ export default {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
roleGroup: '',
|
roleGroup: '',
|
||||||
user: ''
|
user: '',
|
||||||
|
affixIdFlie: '',
|
||||||
|
selectEnlistmentReserve: {},
|
||||||
|
enlistmentReserveAttachList: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@@ -521,6 +534,66 @@ export default {
|
|||||||
},
|
},
|
||||||
applicationDialogShow() {
|
applicationDialogShow() {
|
||||||
this.applicationDialogOpen = true
|
this.applicationDialogOpen = true
|
||||||
|
},
|
||||||
|
openUpFlie(id, row) {
|
||||||
|
this.isOpenUpFlie = true
|
||||||
|
this.affixIdFlie = id
|
||||||
|
this.selectEnlistmentReserve = row
|
||||||
|
},
|
||||||
|
handleAffix(affixId) {
|
||||||
|
this.selectEnlistmentReserve.affixId = affixId
|
||||||
|
},
|
||||||
|
// 处理组件传递的文件信息
|
||||||
|
handleAffix(fileInfo) {
|
||||||
|
if (!fileInfo || !fileInfo.fileName || !fileInfo.filePath) {
|
||||||
|
console.warn("无效的文件信息,跳过添加");
|
||||||
|
return; // 不添加空数据
|
||||||
|
}
|
||||||
|
// 构建与后端实体匹配的data对象
|
||||||
|
let data = {
|
||||||
|
// id: null, // 主键(后端自增)
|
||||||
|
applyId: this.selectEnlistmentReserve.id || null, // 关联申请表ID(从主表单获取)
|
||||||
|
fileName: fileInfo.fileName, // 文件名(从组件传递的信息中获取)
|
||||||
|
filePath: fileInfo.filePath, // 文件路径(相对路径,关联sys_file表)
|
||||||
|
fileSize: fileInfo.originalFile?.size || 0, // 若需要,可从fileInfo.originalFile.size获取(单位:字节)
|
||||||
|
fileType: fileInfo.fileType, // 文件类型(如docx、pdf)
|
||||||
|
applyNo: this.selectEnlistmentReserve.applyNo || '', // 申请编号(从主表单获取)
|
||||||
|
studentName: this.selectEnlistmentReserve.studentName || '', // 学生姓名(从主表单获取)
|
||||||
|
studentNo: this.selectEnlistmentReserve.studentNo || '' // 学号(从主表单获取)
|
||||||
|
};
|
||||||
|
|
||||||
|
// 避免重复添加(根据filePath去重)
|
||||||
|
const isDuplicate = this.enlistmentReserveAttachList.some(
|
||||||
|
item => item.filePath === data.filePath
|
||||||
|
);
|
||||||
|
if (!isDuplicate) {
|
||||||
|
this.enlistmentReserveAttachList.push(data);
|
||||||
|
console.log('附件添加成功:', this.enlistmentReserveAttachList);
|
||||||
|
// 附件添加成功之后修改申请信息
|
||||||
|
updateEnlistmentReserve(this.selectEnlistmentReserve).then(response => {
|
||||||
|
// 填写附件里面的申请编号
|
||||||
|
this.enlistmentReserveAttachList.forEach(element => {
|
||||||
|
element.applyNo = this.selectEnlistmentReserve.applyNo
|
||||||
|
element.applyId = this.selectEnlistmentReserve.id
|
||||||
|
})
|
||||||
|
// 批量新增材料附件
|
||||||
|
if (this.enlistmentReserveAttachList && this.enlistmentReserveAttachList.length > 0) {
|
||||||
|
batchAddEnlistmentReserveAttach(this.enlistmentReserveAttachList)
|
||||||
|
}
|
||||||
|
this.$modal.msgSuccess("上传成功");
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.$message.warning('该文件已添加,请勿重复上传');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 处理子组件传递的删除文件事件
|
||||||
|
handleDeleteFile(fileName) {
|
||||||
|
// 接收文件名后,可执行后续逻辑,删除在数据库的数据
|
||||||
|
if (fileName) {
|
||||||
|
deleteRtEnlistmentReserveAttachByFileNameAndStuName({ fileName: fileName, studentName: this.selectEnlistmentReserve.studentName }).then(res => {
|
||||||
|
this.$message.success(`成功删除文件:${fileName}`);
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user