diff --git a/src/api/dormitory/outsideAccommodation/outsideAccommodationAttachment.js b/src/api/dormitory/outsideAccommodation/outsideAccommodationAttachment.js index 89d8c15..c54027a 100644 --- a/src/api/dormitory/outsideAccommodation/outsideAccommodationAttachment.js +++ b/src/api/dormitory/outsideAccommodation/outsideAccommodationAttachment.js @@ -26,6 +26,15 @@ export function addOutsideAccommodationAttachment(data) { }) } +// 批量外宿申请附件 +export function batchAddOutsideAccommodationAttachment(data) { + return request({ + url: '/dormitory/outsideAccommodationAttachment/batchAdd', + method: 'post', + data: data + }) +} + // 修改外宿申请附件 export function updateOutsideAccommodationAttachment(data) { return request({ diff --git a/src/views/dormitory/outsideAccommodation/outsideAccommodationApply/applicationForm.vue b/src/views/dormitory/outsideAccommodation/outsideAccommodationApply/applicationForm.vue index 739b88b..b09c97f 100644 --- a/src/views/dormitory/outsideAccommodation/outsideAccommodationApply/applicationForm.vue +++ b/src/views/dormitory/outsideAccommodation/outsideAccommodationApply/applicationForm.vue @@ -85,10 +85,15 @@ - - 已交当前学年住宿费 - 未交当前学年住宿费 - +
+ +
{{ form.accommodationFee }}
+
@@ -227,15 +232,16 @@ - +

1. 自觉遵守国家法律、法规;

2. 自觉遵守学生行为规范和学校的规章制度,遵守社会公德;

3. 自觉遵守外宿住址所在社区的有关管理规定;

- 4. - 本人申请外宿,属个人自愿行为,外宿期间发生的一切事故,造成本人、他人或集体的人身、财产损害的,学校不负责任。 + 4. 本人申请外宿,属个人自愿行为,外宿期间发生的一切事故,造成本人、他人或集体的人身、财产损害的,学校不负责任。

+ +
@@ -324,7 +330,9 @@ import { updateOutsideAccommodationApply, addOutsideAccommodationApply } from '@/api/dormitory/outsideAccommodation/outsideAccommodationApply' +import { batchAddOutsideAccommodationAttachment } from "@/api/dormitory/outsideAccommodation/outsideAccommodationAttachment"; import { getUserProfile } from '@/api/system/user' // 获取当前登录用户 +import { getOwnLog } from '@/api/dormitory/new/stuDom' import { pcaTextArr // 省市区联动数据,纯汉字 } from 'element-china-area-data' @@ -360,7 +368,9 @@ export default { studentSignature: '', studentPromiseSign: '', promiseDate: '', - parentSignAttachment: '' + parentSignAttachment: '', + promiseContent: '', + accommodationFee: '' }, formRules: { originalDormitory: [{ required: true, message: '原宿舍号不能为空', trigger: 'blur' }], @@ -448,7 +458,6 @@ export default { address: res.data.address ? res.data.address.split('/') : [], parentAddress: res.data.parentAddress ? res.data.parentAddress.split('/') : [] }; - this.reasonFileList = this.form.affixId const fileName = this.form.parentSignAttachment.split('/').pop() // 回显家长签字附件 this.fileList = [{ name: fileName, url: this.baseUrl + this.form.parentSignAttachment }] @@ -478,6 +487,7 @@ export default { } else { // 若 id 为空,可做清空处理 this.currentId = null; + this.resetForm() this.getUser() } } @@ -510,7 +520,41 @@ export default { this.form.teacherName = res.data.teacherName this.form.studentPhone = res.data.stuPhone this.form.birthDate = res.data.birthday - this.form.accommodationFee = "wu" + // 获取学生宿舍缴费记录 + getOwnLog().then(response => { + // 1. 提取当前学生的宿舍ID + const currentDormId = response.data.dormStu.dormitoryId + // 2. 从record中找到roomId匹配的第一条数据(提取基准学年) + const matchedRecord = response.data.record.find(item => item.roomId === currentDormId) + // 3. 核心逻辑:判断全量record是否同年度 + 汇总费用 + if (matchedRecord) { + // 提取匹配记录的基准学年 + const baseStuYearName = matchedRecord.stuYearName || '' + if (baseStuYearName) { + // 检查整个record数组中所有数据的学年是否和基准学年一致 + const isAllSameYear = response.data.record.every(item => { + return (item.stuYearName || '') === baseStuYearName + }) + if (isAllSameYear) { + // 所有记录同年度,汇总全部费用 + const totalMoney = response.data.record.reduce((sum, item) => { + return sum + Number(item.needMoney || 0) // 确保金额为数字,避免NaN + }, 0) + this.form.accommodationFee = `已交${baseStuYearName}年度住宿费${totalMoney || 0}人民币` + } else { + // 存在不同年度的记录,仅展示基准年度+提示 + this.form.accommodationFee = `已交${baseStuYearName}年度住宿费 存在不同年度费用数据,暂无法汇总` + } + } else { + // 匹配记录无学年名称 + this.form.accommodationFee = `已交未知年度住宿费 暂无有效学年信息` + } + } else { + // 无匹配roomId的记录,兜底处理 + const firstStuYearName = response.data.record[0]?.stuYearName || '' + this.form.accommodationFee = `已交${firstStuYearName || '未知'}年度住宿费 暂无匹配宿舍费用数据` + } + }) this.getStuDom() } this.loading = false @@ -524,9 +568,9 @@ export default { (response) => { this.form.originalDormitory = response.rows[0].campusName + - '-' + + ' ' + response.rows[0].parkName + - '-' + + ' ' + response.rows[0].buildingName + response.rows[0].roomNo this.loading = false @@ -692,13 +736,10 @@ export default { this.form.endDate = this.getOutsideDefaultEndTime() // 生成本人承诺内容 this.form.promiseContent = ` - 1. 自觉遵守国家法律、法规; - - 2. 自觉遵守学生行为规范和学校的规章制度,遵守社会公德; - - 3. 自觉遵守外宿住址所在社区的有关管理规定; - - 4. 本人申请外宿,属个人自愿行为,外宿期间发生的一切事故,造成本人、他人或集体的人身、财产损害的,学校不负责任。 +

1.自觉遵守国家法律、法规;

+

2.自觉遵守学生行为规范和学校的规章制度,遵守社会公德;

+

3.自觉遵守外宿住址所在社区的有关管理规定;

+

4.本人申请外宿,属个人自愿行为,外宿期间发生的一切事故,造成本人、他人或集体的人身、财产损害的,学校不负责任。

` // 将地址数组转为字符串(用 / 拼接,后端可按此分隔解析) const submitForm = { @@ -711,6 +752,11 @@ export default { 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() @@ -720,6 +766,15 @@ export default { }) } else { addOutsideAccommodationApply(submitForm).then((response) => { + // 填写附件里面的申请编号 + 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() @@ -728,7 +783,6 @@ export default { this.goBack() }) } - this.resetForm() } else { this.loading = false; this.$message.error('表单填写有误,请检查!') @@ -740,6 +794,8 @@ export default { resetForm() { this.$refs.formRef.resetFields() this.reasonFileList = [] + this.fileList = [] + this.form.affixId = "" this.form.studentSignature = '' this.form.studentPromiseSign = '' this.clearStudentCanvas() @@ -775,7 +831,6 @@ export default { } else { this.$message.warning('该文件已添加,请勿重复上传') } - console.log(this.reasonFileList) }, // 处理子组件传递的删除文件事件 handleDeleteFile(fileName) { diff --git a/src/views/dormitory/outsideAccommodation/outsideAccommodationApply/components/detailApply.vue b/src/views/dormitory/outsideAccommodation/outsideAccommodationApply/components/detailApply.vue index af0bd83..f89c3ae 100644 --- a/src/views/dormitory/outsideAccommodation/outsideAccommodationApply/components/detailApply.vue +++ b/src/views/dormitory/outsideAccommodation/outsideAccommodationApply/components/detailApply.vue @@ -1,80 +1,91 @@ @@ -162,6 +203,24 @@ export default { // formData: {} // 注释/删除这一行 detailData: {}, // 用独立变量存储接口返回的详情数据 baseUrl: process.env.VUE_APP_BASE_API, + //打印 + printobj: { + id: 'outsideAccommodationApply', + popTitle: '打印', // 打印配置页上方标题 + extraHead: '', //最上方的头部文字,附加在head标签上的额外标签,使用逗号分隔 + preview: '', // 是否启动预览模式,默认是false(开启预览模式,可以先预览后打印) + previewTitle: '', // 打印预览的标题(开启预览模式后出现), + previewPrintBtnLabel: '', // 打印预览的标题的下方按钮文本,点击可进入打印(开启预览模式后出现) + zIndex: '', // 预览的窗口的z-index,默认是 20002(此值要高一些,这涉及到预览模式是否显示在最上面) + previewBeforeOpenCallback() { }, //预览窗口打开之前的callback(开启预览模式调用) + previewOpenCallback() { }, // 预览窗口打开之后的callback(开启预览模式调用) + beforeOpenCallback() { }, // 开启打印前的回调事件 + openCallback() { }, // 调用打印之后的回调事件 + closeCallback() { }, //关闭打印的回调事件(无法确定点击的是确认还是取消) + url: '', + standard: '', + extraCss: '', + }, } }, // 计算属性判断优先级 @@ -204,7 +263,16 @@ export default { } } }, - methods: {}, + methods: { + goBack() { + // 关闭当前标签页并返回上个页面 + // const obj = { path: 'disciplinaryApplication', query: { t: Date.now() } } + // this.$tab.closeOpenPage(obj) + this.$router.back() + // 关闭窗体 index 当前层索引 + this.$tab.closePage() + }, + }, created() { }, mounted() { }, destroyed() { } @@ -212,4 +280,26 @@ export default {