From 7af24e2656ddae37f03f1ae62b439f1bbf6a9dc4 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期五, 06 六月 2025 18:28:57 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/2.0.1' into 2.0.1

---
 company/src/components/business/OpearaCaseEntryWindow.vue |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/company/src/components/business/OpearaCaseEntryWindow.vue b/company/src/components/business/OpearaCaseEntryWindow.vue
index 785aabb..dab49d4 100644
--- a/company/src/components/business/OpearaCaseEntryWindow.vue
+++ b/company/src/components/business/OpearaCaseEntryWindow.vue
@@ -51,6 +51,7 @@
                                 <el-date-picker
                                     v-model="ruleForm.extData.memberBirthday"
                                     type="date"
+                                    @change="changeMemberBirthday"
                                     placeholder="閫夋嫨鏃ユ湡"
                                     format="yyyy 骞� MM 鏈� dd 鏃�"
                                     value-format="yyyy-MM-dd">
@@ -982,6 +983,26 @@
       }
       this.getCompensations()
     },
+      changeMemberBirthday(e) {
+          if (!e) {
+              this.ruleForm.extData.memberAge = ''
+          } else {
+              this.ruleForm.extData.memberAge = this.calculateAge(e)
+          }
+      },
+      calculateAge(birthDate) {
+          const today = new Date();
+          const birthDateObject = new Date(birthDate);
+
+          let age = today.getFullYear() - birthDateObject.getFullYear();
+          const monthDiff = today.getMonth() - birthDateObject.getMonth();
+
+          if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDateObject.getDate())) {
+              age--;
+          }
+
+          return age;
+      },
     confirm () {
       this.$refs.ruleForm.validate((valid) => {
         if (!valid) return

--
Gitblit v1.9.3