From 024ada89d6e29db63ff3fb5ba3ea133021b8a35b Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期一, 16 六月 2025 11:47:31 +0800
Subject: [PATCH] 提交

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

diff --git a/company/src/components/business/OpearaCaseEntryWindow.vue b/company/src/components/business/OpearaCaseEntryWindow.vue
index 785aabb..58ad3a1 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">
@@ -185,7 +186,7 @@
                             <el-form-item label="鎶ユ鏃堕棿" prop="reportDate">
                                 <el-date-picker
                                     v-model="ruleForm.extData.reportDate"
-                                    type="date"
+                                    type="datetime"
                                     placeholder="閫夋嫨鏃ユ湡"
                                     format="yyyy-MM-dd HH:mm:ss"
                                     value-format="yyyy-MM-dd HH:mm:ss">
@@ -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