From 648f0d116f0896951ce267ace69e2e343ff1ad5f Mon Sep 17 00:00:00 2001 From: = <=> Date: Sat, 8 Nov 2025 17:43:19 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E8=82=B2=E4=BC=91=E5=81=87=E6=89=8B?= =?UTF-8?q?=E6=9C=BA=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../maternityLeave/apply/index.html | 22 +- .../maternityLeave/apply/index.html | 264 +++++------------- .../maternityLeave/common/info.js | 34 +-- .../familyPlanningOffice/index.html | 254 ++++++++++++++++- .../maternityLeave/schoolAudit/index.html | 2 +- .../maternityLeave/unionAudit/index.html | 2 +- 6 files changed, 362 insertions(+), 216 deletions(-) diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/maternityLeave/apply/index.html b/src/main/resources/views/platform/zhgh/staffbenefit/maternityLeave/apply/index.html index 061c944..40e12ca 100644 --- a/src/main/resources/views/platform/zhgh/staffbenefit/maternityLeave/apply/index.html +++ b/src/main/resources/views/platform/zhgh/staffbenefit/maternityLeave/apply/index.html @@ -209,13 +209,33 @@ layout("/layouts/platform.html"){ } }, computed: { + // 是否为男性 + isMale() { + return this.formData.sex === '男性' || this.formData.sex === '男'; + }, + // 是否为女性 + isFemale() { + return this.formData.sex === '女性' || this.formData.sex === '女'; + }, }, watch: { + // 监听性别变化,设置默认值 + isMale(newVal) { + if (newVal) { + // 男性默认设置 + this.$set(this.formData, 'loverSex', '女'); + } + }, + isFemale(newVal) { + if (newVal) { + // 女性默认设置 + this.$set(this.formData, 'loverSex', '男'); + } + } }, methods: { - // 保存 onSave() { console.log(this.formData); diff --git a/src/main/resources/views/platform/zhghh5/staffbenefit/maternityLeave/apply/index.html b/src/main/resources/views/platform/zhghh5/staffbenefit/maternityLeave/apply/index.html index 0e65348..9d8fc06 100644 --- a/src/main/resources/views/platform/zhghh5/staffbenefit/maternityLeave/apply/index.html +++ b/src/main/resources/views/platform/zhghh5/staffbenefit/maternityLeave/apply/index.html @@ -17,7 +17,7 @@ layout("/layouts/platform_h5.html"){ readonly> - @@ -54,7 +54,7 @@ layout("/layouts/platform_h5.html"){ + + + + + + + + + + +
-
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { + const value = this.formData[field]; + if (value && !isNaN(value)) { + total += parseFloat(value); + } + }); + + // 更新 formData.leaveDays + this.$set(this.formData, 'leaveDays', total); + return total; + }, + // 是否为男性 + isMale() { + return this.formData.sex === '男性' || this.formData.sex === '男'; + }, + // 是否为女性 + isFemale() { + return this.formData.sex === '女性' || this.formData.sex === '女'; + }, + }, + watch: { + totalLeaveDays(newVal) { + this.$set(this.formData, 'leaveDays', newVal); + // 当合计天数变化时,自动计算结束时间 + this.calculateEndTime(); + }, + 'formData.startTime'() { + // 当开始时间变化时,自动计算结束时间 + this.calculateEndTime(); + }, + }, methods: { onRevoke(row) { this.$dialog.confirm({ @@ -130,9 +269,52 @@ layout("/layouts/platform_h5.html"){ // on cancel }); }, + async validateApprovalForm() { + try { + // 验证审批意见 + if (!this.formData.tf_opinion || this.formData.tf_opinion.trim() === '') { + this.$toast.fail('请填写审批意见'); + return false; + } + + // 验证电子签名 + if (!this.formData.tf_userSign) { + this.$toast.fail('请进行电子签名'); + return false; + } + + // 验证休假开始时间 + if (!this.formData.startTime) { + this.$toast.fail('请选择休假开始时间'); + return false; + } + + // 验证休假结束时间 + if (!this.formData.endTime) { + this.$toast.fail('请选择休假结束时间'); + return false; + } + + // 验证时间顺序 + if (this.formData.startTime && this.formData.endTime) { + const startDate = new Date(this.formData.startTime); + const endDate = new Date(this.formData.endTime); + if (endDate < startDate) { + this.$toast.fail('休假结束时间不能早于开始时间'); + return false; + } + } + + return true; + } catch (error) { + console.error('表单验证出错:', error); + this.$toast.fail('表单验证失败,请检查输入'); + return false; + } + }, async handleTaskAction(val) { if (val === 1) { - const isValid = await this.$refs.formRef.validate() + const isValid = await this.validateApprovalForm(); if (!isValid) return; } this.$dialog.confirm({ @@ -166,7 +348,17 @@ layout("/layouts/platform_h5.html"){ processTaskId: row.taskId, id: row.id, sex: row.sex, - taskName: row.curTaskName + taskName: row.curTaskName, + isMultipleBirths: row.isMultipleBirths || false, + isDystocia: row.isDystocia || false + } + // 根据性别初始化默认假期天数 + if (["男", "男性"].includes(row.sex)) { + this.$set(this.formData, 'withLeave', 15); + this.$set(this.formData, 'parentalLeave', 10); + } else { + this.$set(this.formData, 'maternityLeave', 98); + this.$set(this.formData, 'extendLeave', 60); } this.$refs.maternityLeaveInfoRef.onOpen(row) }, @@ -179,6 +371,60 @@ layout("/layouts/platform_h5.html"){ }) }, + // 日期选择确认方法 + onStartTimeConfirm(value) { + this.$set(this.formData, "startTime", this.formatDate(value)); + this.showStartTimePicker = false; + // 当开始时间变化时,自动计算结束时间 + this.calculateEndTime(); + }, + + onEndTimeConfirm(value) { + this.$set(this.formData, "endTime", this.formatDate(value)); + this.showEndTimePicker = false; + }, + + onBirthsLeaveConfirm(value) { + this.$set(this.formData, "birthsLeave", value.value); + this.showBirthsLeavePicker = false; + }, + + onDifficultLeaveConfirm(value) { + this.$set(this.formData, "difficultLeave", value.value); + this.showDifficultLeavePicker = false; + }, + + // 格式化日期为 yyyy-MM-dd 格式 + formatDate(date) { + if (!date) return ''; + const d = new Date(date); + if (isNaN(d.getTime())) { + return date; + } + const year = d.getFullYear(); + const month = String(d.getMonth() + 1).padStart(2, '0'); + const day = String(d.getDate()).padStart(2, '0'); + return year + '-' + month + '-' + day; + }, + + // 计算休假时间止 + calculateEndTime() { + // 如果开始时间和天数都存在,则自动计算结束时间 + if (this.formData.startTime && this.formData.leaveDays) { + const startDate = new Date(this.formData.startTime); + if (!isNaN(startDate.getTime())) { + // 创建新的日期对象,避免修改原始日期 + const endDate = new Date(startDate); + // 添加天数(leaveDays - 1,因为包含开始日期) + endDate.setDate(endDate.getDate() + this.formData.leaveDays - 1); + // 格式化为 yyyy-MM-dd + const year = endDate.getFullYear(); + const month = String(endDate.getMonth() + 1).padStart(2, '0'); + const day = String(endDate.getDate()).padStart(2, '0'); + this.$set(this.formData, 'endTime', year + '-' + month + '-' + day); + } + } + }, }, created() { diff --git a/src/main/resources/views/platform/zhghh5/staffbenefit/maternityLeave/schoolAudit/index.html b/src/main/resources/views/platform/zhghh5/staffbenefit/maternityLeave/schoolAudit/index.html index 89a7396..154b175 100644 --- a/src/main/resources/views/platform/zhghh5/staffbenefit/maternityLeave/schoolAudit/index.html +++ b/src/main/resources/views/platform/zhghh5/staffbenefit/maternityLeave/schoolAudit/index.html @@ -3,7 +3,7 @@ layout("/layouts/platform_h5.html"){ #-->
- +
- +