外宿申请-附件回显bug
This commit is contained in:
@@ -274,7 +274,7 @@
|
||||
<i class="el-icon-folder" />
|
||||
保存
|
||||
</el-button>
|
||||
<el-button type="primary" size="medium" @click="submitForm(1)">
|
||||
<el-button type="primary" size="medium" @click="submitForm(1)" v-if="form.id == ''">
|
||||
<i class="el-icon-check" />
|
||||
提交申请
|
||||
</el-button>
|
||||
@@ -703,63 +703,52 @@ export default {
|
||||
submitForm(status) {
|
||||
this.$refs.formRef.validate((valid) => {
|
||||
if (valid) {
|
||||
// 生成申请编号
|
||||
// 生成申请编号等逻辑不变
|
||||
if (!this.form.applyNo) {
|
||||
const year = new Date().getFullYear();
|
||||
const randomNo = Math.floor(Math.random() * 1000000).toString().padStart(6, '0');
|
||||
this.form.applyNo = `WS${year}${randomNo}`; // 获取申请编号
|
||||
this.form.applyNo = `WS${year}${randomNo}`;
|
||||
}
|
||||
// 生成外宿结束时间(默认次年8月31日)
|
||||
this.form.endDate = this.getOutsideDefaultEndTime()
|
||||
// 生成本人承诺内容
|
||||
this.form.promiseContent = `
|
||||
<p>1.自觉遵守国家法律、法规;</p>
|
||||
<p>2.自觉遵守学生行为规范和学校的规章制度,遵守社会公德;</p>
|
||||
<p>3.自觉遵守外宿住址所在社区的有关管理规定;</p>
|
||||
<p>4.本人申请外宿,属个人自愿行为,外宿期间发生的一切事故,造成本人、他人或集体的人身、财产损害的,学校不负责任。</p>
|
||||
`
|
||||
// 将地址数组转为字符串(用 / 拼接,后端可按此分隔解析)
|
||||
const submitForm = {
|
||||
...this.form,
|
||||
address: this.form.address ? this.form.address.join('/') : '', // 数组转字符串
|
||||
parentAddress: this.form.parentAddress ? this.form.parentAddress.join('/') : '', // 家长地址同理
|
||||
status: status
|
||||
address: this.form.address ? this.form.address.join('/') : '',
|
||||
parentAddress: this.form.parentAddress ? this.form.parentAddress.join('/') : '',
|
||||
status: this.form.status != 0 ? this.form.status : status
|
||||
};
|
||||
|
||||
this.loading = true;
|
||||
if (this.form.id != null) {
|
||||
updateOutsideAccommodationApply(submitForm).then((response) => {
|
||||
// 批量新增材料附件
|
||||
if (this.reasonFileList && this.reasonFileList.length > 0) {
|
||||
batchAddOutsideAccommodationAttachment(this.reasonFileList)
|
||||
this.resetForm()
|
||||
}
|
||||
this.loading = false;
|
||||
this.$modal.msgSuccess('修改成功')
|
||||
this.goBack()
|
||||
}).catch(error => {
|
||||
this.loading = false;
|
||||
this.goBack()
|
||||
})
|
||||
} else {
|
||||
addOutsideAccommodationApply(submitForm).then((response) => {
|
||||
// 填写附件里面的申请编号
|
||||
// 封装请求逻辑为Promise,确保完成后再操作
|
||||
const requestPromise = this.form.id != null
|
||||
? updateOutsideAccommodationApply(submitForm)
|
||||
: addOutsideAccommodationApply(submitForm);
|
||||
|
||||
requestPromise.then((response) => {
|
||||
// 附件处理逻辑不变
|
||||
if (this.reasonFileList && this.reasonFileList.length > 0) {
|
||||
this.reasonFileList.forEach(element => {
|
||||
element.applyId = response.data.id
|
||||
})
|
||||
// 批量新增材料附件
|
||||
if (this.reasonFileList && this.reasonFileList.length > 0) {
|
||||
batchAddOutsideAccommodationAttachment(this.reasonFileList)
|
||||
this.resetForm()
|
||||
}
|
||||
this.loading = false;
|
||||
this.$modal.msgSuccess('新增成功')
|
||||
this.goBack()
|
||||
}).catch(error => {
|
||||
this.loading = false;
|
||||
this.goBack()
|
||||
})
|
||||
}
|
||||
element.applyId = this.form.id || response.data.id;
|
||||
});
|
||||
batchAddOutsideAccommodationAttachment(this.reasonFileList);
|
||||
}
|
||||
this.loading = false;
|
||||
this.$modal.msgSuccess(this.form.id ? '修改成功' : '新增成功');
|
||||
// 延迟跳转:给后端数据落地留时间(关键!)
|
||||
setTimeout(() => {
|
||||
this.goBack();
|
||||
}, 800); // 800ms延迟,确保后端写入完成
|
||||
}).catch(error => {
|
||||
this.loading = false;
|
||||
this.$message.error('提交失败:' + (error.msg || '服务器处理异常'));
|
||||
// 失败时不跳转,避免用户重复操作
|
||||
// this.goBack();
|
||||
})
|
||||
} else {
|
||||
this.loading = false;
|
||||
this.$message.error('表单填写有误,请检查!')
|
||||
@@ -1143,4 +1132,4 @@ li {
|
||||
text-align: center !important;
|
||||
width: 120px;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -44,8 +44,8 @@
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item span="4">
|
||||
<template slot="label"> 宿费交纳情况(只填写当年度交费情况) </template>
|
||||
<!-- {{ renderData.familyAddress }} -->
|
||||
已交 绑定当前学年年度住宿费 人民币
|
||||
{{ renderData.accommodationFee }}
|
||||
<!-- 已交 绑定当前学年年度住宿费 人民币 -->
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item span="2">
|
||||
|
||||
@@ -150,7 +150,7 @@
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['dormitory:outsideAccommodationApply:edit']"
|
||||
v-if="scope.row.status == 0 || getRejectInfo(scope.row.outsideAccommodationApprovals).isReject">修改</el-button>
|
||||
>修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['dormitory:outsideAccommodationApply:remove']" v-if="scope.row.status == 0">删除</el-button>
|
||||
<el-button v-if="scope.row.applyStatus != 0" size="mini" type="text" icon="el-icon-info"
|
||||
|
||||
Reference in New Issue
Block a user