Explorar o código

输入身份证后,自动更新用户的性别,生日,年龄,选择亲属的时候,自动选择性别

vothin %!s(int64=2) %!d(string=hai) anos
pai
achega
36edbd619e

+ 2 - 0
languages/en.js

@@ -948,6 +948,8 @@ module.exports = {
   },
   relativeNameType: {
     CHILDREN: 'Child',
+    BOY: 'Boy',
+    GIRL: 'Girl',
     HUSBAND: 'Husband',
     WIFE: 'Wife',
     FATHER: 'Father',

+ 2 - 0
languages/zh-CN.js

@@ -949,6 +949,8 @@ module.exports = {
   },
   relativeNameType: {
     CHILDREN: '孩子',
+    BOY: '男孩',
+    GIRL: '女孩',
     HUSBAND: '丈夫',
     WIFE: '妻子',
     FATHER: '父亲',

+ 2 - 0
src/utils/enum/RelativeNameTypeEnum

@@ -4,6 +4,8 @@ import i18n from '@/utils/i18n'
 export const RELATIVE_NAME_TYPE = createEnum(
     {
         CHILDREN: [ '孩子', i18n.t('relativeNameType.CHILDREN') ],
+        BOY: [ '男孩', i18n.t('relativeNameType.BOY') ],
+        GIRL: [ '女孩', i18n.t('relativeNameType.GIRL') ],
         HUSBAND: [ '丈夫', i18n.t('relativeNameType.HUSBAND') ],
         WIFE: [ '妻子', i18n.t('relativeNameType.WIFE') ],
         FATHER: [ '父亲', i18n.t('relativeNameType.FATHER') ],

+ 19 - 2
src/views/customer/components/customerManager.vue

@@ -1471,11 +1471,28 @@ export default {
       return RELATIVE_NAME_TYPE.getDescFromValue(row.relative_name) ? RELATIVE_NAME_TYPE.getDescFromValue(row.relative_name) : row.relative_name
     },
     relativeNameChange(val) {
-      if (val === RELATIVE_NAME_TYPE.CHILDREN) {
+
+      if (val === RELATIVE_NAME_TYPE.CHILDREN || val === RELATIVE_NAME_TYPE.BOY || val === RELATIVE_NAME_TYPE.GIRL) {
         this.relativeRules.mobile[0].required = false
         this.relativeRules.mobile[0].validator = (rule, value, callback) => { callback() }
         this.isChild = true
-      } else {
+        if (val === RELATIVE_NAME_TYPE.BOY) {
+          this.relativeFormModel.sex = 1
+        } else if (val === RELATIVE_NAME_TYPE.GIRL) {
+          this.relativeFormModel.sex = 0
+        }
+      }
+      else if (val === RELATIVE_NAME_TYPE.HUSBAND || val === RELATIVE_NAME_TYPE.FATHER) {
+        this.relativeRules.mobile[0].required = true
+        this.isChild = false
+        this.relativeFormModel.sex = 1
+      }
+      else if (val === RELATIVE_NAME_TYPE.WIFE || val === RELATIVE_NAME_TYPE.MOTHER) {
+        this.relativeRules.mobile[0].required = true
+        this.isChild = false
+        this.relativeFormModel.sex = 0
+      }
+      else {
         this.relativeRules.mobile[0].required = true
         this.isChild = false
       }

+ 79 - 4
src/views/customer/components/elderlyCareManager.vue

@@ -132,7 +132,9 @@
                                 <el-col :span="12">
                                     <el-form-item :label="this.$t('customerManage.idNo')">
                                         <el-input v-model="formmodel.id_no" clearable :placeholder="this.$t('customerManage.inputIdNo')"
-                                                  :maxlength="20"/>
+                                                  :maxlength="20"
+                                                  @blur="onBlurCard"
+                                        />
                                     </el-form-item>
                                 </el-col>
                             </el-row>
@@ -265,6 +267,7 @@
                                     prop="relative_name"
                                     :label="this.$t('customerManage.relativeName')"
                                     width="180"
+                                    :formatter="formatterRelativeName"
                             />
                             <el-table-column
                                     prop="mobile"
@@ -293,8 +296,11 @@
                                 </el-col>
                                 <el-col :span="12">
                                     <el-form-item :label="this.$t('customerManage.relativeName')" prop="relative_name">
-                                        <el-input v-model="relativeFormModel.relative_name" clearable
-                                                  :placeholder="this.$t('customerManage.inputRelativeName')" :maxlength="20"/>
+<!--                                        <el-input v-model="relativeFormModel.relative_name" clearable-->
+<!--                                                  :placeholder="this.$t('customerManage.inputRelativeName')" :maxlength="20"/>-->
+                                      <el-select v-model="relativeFormModel.relative_name" :placeholder="this.$t('customerManage.choiceRelativeName')" clearable  @change="relativeNameChange">
+                                        <el-option v-for="(item, index) in Object.keys(relativeNameTypeEnum)" :key="index" :label="relativeNameTypeEnum[item]" :value="item" />
+                                      </el-select>
                                     </el-form-item>
                                 </el-col>
                             </el-row>
@@ -312,6 +318,19 @@
                                                   :maxlength="20"/>
                                     </el-form-item>
                                 </el-col>
+                              <el-col :span="12">
+                                <el-form-item v-if="isChild"
+                                              :label="this.$t('member.birthday2')" prop="birthday">
+                                  <el-date-picker
+                                      v-model="relativeFormModel.birthday"
+                                      type="date"
+                                      :editable="false"
+                                      value-format="timestamp"
+                                      :placeholder="this.$t('member.choiceBirthday2')"
+                                      :picker-options="{ disabledDate(time) { return time.getTime() > Date.now() }}"
+                                  />
+                                </el-form-item>
+                              </el-col>
                             </el-row>
                             <el-form-item>
                                 <el-button type="primary" @click="addRelative">{{ this.$t('action.add') }}</el-button>
@@ -498,6 +517,7 @@
     import myMap from '@/views/customer/myMap'
     import * as API_SystemConfig from '@/api/ncs_systemconfig'
     import { getDevicesByUuid } from '@/api/initialize'
+    import {RELATIVE_NAME_TYPE} from "@/utils/enum/RelativeNameTypeEnum";
     const serverUrl = domain.serverUrl
     export default {
         name: 'ElderlyCareManager',
@@ -653,7 +673,9 @@
               locationShow: false,
               isCloud: false,
               boolDevice: false,
-              mapUrl: null
+              mapUrl: null,
+              relativeNameTypeEnum: RELATIVE_NAME_TYPE.getValueList(),
+              isChild: false,
             }
         },
         computed: {
@@ -1423,6 +1445,35 @@
                     return this.$t('member.unknown')
                 }
             },
+          formatterRelativeName(row) {
+            return RELATIVE_NAME_TYPE.getDescFromValue(row.relative_name) ? RELATIVE_NAME_TYPE.getDescFromValue(row.relative_name) : row.relative_name
+          },
+          relativeNameChange(val) {
+            if (val === RELATIVE_NAME_TYPE.CHILDREN || val === RELATIVE_NAME_TYPE.BOY || val === RELATIVE_NAME_TYPE.GIRL) {
+              this.relativeRules.mobile[0].required = false
+              this.relativeRules.mobile[0].validator = (rule, value, callback) => { callback() }
+              this.isChild = true
+              if (val === RELATIVE_NAME_TYPE.BOY) {
+                this.relativeFormModel.sex = 1
+              } else if (val === RELATIVE_NAME_TYPE.GIRL) {
+                this.relativeFormModel.sex = 0
+              }
+            }
+            else if (val === RELATIVE_NAME_TYPE.HUSBAND || val === RELATIVE_NAME_TYPE.FATHER) {
+              this.relativeRules.mobile[0].required = true
+              this.isChild = false
+              this.relativeFormModel.sex = 1
+            }
+            else if (val === RELATIVE_NAME_TYPE.WIFE || val === RELATIVE_NAME_TYPE.MOTHER) {
+              this.relativeRules.mobile[0].required = true
+              this.isChild = false
+              this.relativeFormModel.sex = 0
+            }
+            else {
+              this.relativeRules.mobile[0].required = true
+              this.isChild = false
+            }
+          },
             /** 信息变化后操作,如床位状态改变,传入的空间结构变化了 **/
             infoChanged() {
                 this.getEmptyBeds().then(() => {
@@ -1551,6 +1602,30 @@
             API_SystemConfig.cloud().then(r => {
               this.isCloud = r
             })
+          },
+          onBlurCard() {
+            if (this.formmodel.id_type === "身份证") {
+              const val = this.formmodel.id_no.length
+              const idNo = this.formmodel.id_no
+              let sex = null
+
+              if (val === 18) {
+                this.formmodel.birthday = new Date(idNo.substring(6, 10) + '-' + idNo.substring(10, 12) + '-' + idNo.substring(12, 14)).getTime()
+                this.birthdayChange(this.formmodel.birthday)
+                sex = idNo.substring(16, 17)
+              }
+              if (val === 15) {
+                this.formmodel.birthday = new Date( '19' + idNo.substring(6, 8) + '-' + idNo.substring(8, 10) + '-' + idNo.substring(10, 12)).getTime()
+                this.birthdayChange(this.formmodel.birthday)
+                sex = idNo.substring(13, 14)
+              }
+
+              if (sex % 2 === 0) {
+                this.formmodel.sex = 0
+              } else {
+                this.formmodel.sex = 1
+              }
+            }
           }
         }
     }

+ 78 - 4
src/views/customer/components/patientManager.vue

@@ -131,7 +131,9 @@
                                 <el-col :span="12">
                                     <el-form-item :label="this.$t('customerManage.idNo')">
                                         <el-input v-model="formmodel.id_no" clearable :placeholder="this.$t('customerManage.inputIdNo')"
-                                                  :maxlength="20"/>
+                                                  :maxlength="20"
+                                                  @blur="onBlurCard"
+                                        />
                                     </el-form-item>
                                 </el-col>
                             </el-row>
@@ -285,6 +287,7 @@
                                     prop="relative_name"
                                     :label="this.$t('customerManage.relativeName')"
                                     width="180"
+                                    :formatter="formatterRelativeName"
                             />
                             <el-table-column
                                     prop="mobile"
@@ -313,8 +316,9 @@
                                 </el-col>
                                 <el-col :span="12">
                                     <el-form-item :label="this.$t('customerManage.relativeName')" prop="relative_name">
-                                        <el-input v-model="relativeFormModel.relative_name" clearable
-                                                  :placeholder="this.$t('customerManage.inputRelativeName')" :maxlength="20"/>
+                                      <el-select v-model="relativeFormModel.relative_name" :placeholder="this.$t('customerManage.choiceRelativeName')" clearable  @change="relativeNameChange">
+                                        <el-option v-for="(item, index) in Object.keys(relativeNameTypeEnum)" :key="index" :label="relativeNameTypeEnum[item]" :value="item" />
+                                      </el-select>
                                     </el-form-item>
                                 </el-col>
                             </el-row>
@@ -332,6 +336,19 @@
                                                   :maxlength="20"/>
                                     </el-form-item>
                                 </el-col>
+                              <el-col :span="12">
+                                <el-form-item v-if="isChild"
+                                              :label="this.$t('member.birthday2')" prop="birthday">
+                                  <el-date-picker
+                                      v-model="relativeFormModel.birthday"
+                                      type="date"
+                                      :editable="false"
+                                      value-format="timestamp"
+                                      :placeholder="this.$t('member.choiceBirthday2')"
+                                      :picker-options="{ disabledDate(time) { return time.getTime() > Date.now() }}"
+                                  />
+                                </el-form-item>
+                              </el-col>
                             </el-row>
                             <el-form-item>
                                 <el-button type="primary" @click="addRelative">{{ this.$t('action.add') }}</el-button>
@@ -516,6 +533,8 @@
     import * as shop_API from "@/api/ncs_shop";
     import myMapHtml from '@/views/customer/myMapHtml'
     import {getDevicesByUuid} from "@/api/initialize";
+    import {RELATIVE_NAME_TYPE} from "@/utils/enum/RelativeNameTypeEnum";
+    import {CHILDBIRTH_TYPE} from "@/utils/enum/ChildbirthTypeEnum";
     const serverUrl = domain.serverUrl
     export default {
         name: 'PatientManager',
@@ -676,7 +695,9 @@
                 deleted: this.$t('action.delete'),
                 qrCode: null,
                 boolDevice: false,
-                mapUrl: null
+                mapUrl: null,
+              relativeNameTypeEnum: RELATIVE_NAME_TYPE.getValueList(),
+              isChild: false,
             }
         },
         computed: {
@@ -1486,6 +1507,35 @@
                     return this.$t('member.unknown')
                 }
             },
+          formatterRelativeName(row) {
+            return RELATIVE_NAME_TYPE.getDescFromValue(row.relative_name) ? RELATIVE_NAME_TYPE.getDescFromValue(row.relative_name) : row.relative_name
+          },
+          relativeNameChange(val) {
+            if (val === RELATIVE_NAME_TYPE.CHILDREN || val === RELATIVE_NAME_TYPE.BOY || val === RELATIVE_NAME_TYPE.GIRL) {
+              this.relativeRules.mobile[0].required = false
+              this.relativeRules.mobile[0].validator = (rule, value, callback) => { callback() }
+              this.isChild = true
+              if (val === RELATIVE_NAME_TYPE.BOY) {
+                this.relativeFormModel.sex = 1
+              } else if (val === RELATIVE_NAME_TYPE.GIRL) {
+                this.relativeFormModel.sex = 0
+              }
+            }
+            else if (val === RELATIVE_NAME_TYPE.HUSBAND || val === RELATIVE_NAME_TYPE.FATHER) {
+              this.relativeRules.mobile[0].required = true
+              this.isChild = false
+              this.relativeFormModel.sex = 1
+            }
+            else if (val === RELATIVE_NAME_TYPE.WIFE || val === RELATIVE_NAME_TYPE.MOTHER) {
+              this.relativeRules.mobile[0].required = true
+              this.isChild = false
+              this.relativeFormModel.sex = 0
+            }
+            else {
+              this.relativeRules.mobile[0].required = true
+              this.isChild = false
+            }
+          },
             /** 信息变化后操作,如床位状态改变,传入的空间结构变化了 **/
             infoChanged() {
                 this.getEmptyBeds().then(() => {
@@ -1630,6 +1680,30 @@
                 this.partFrames = [...res]
               })
             }
+          },
+          onBlurCard() {
+            if (this.formmodel.id_type === "身份证") {
+              const val = this.formmodel.id_no.length
+              const idNo = this.formmodel.id_no
+              let sex = null
+
+              if (val === 18) {
+                this.formmodel.birthday = new Date(idNo.substring(6, 10) + '-' + idNo.substring(10, 12) + '-' + idNo.substring(12, 14)).getTime()
+                this.birthdayChange(this.formmodel.birthday)
+                sex = idNo.substring(16, 17)
+              }
+              if (val === 15) {
+                this.formmodel.birthday = new Date( '19' + idNo.substring(6, 8) + '-' + idNo.substring(8, 10) + '-' + idNo.substring(10, 12)).getTime()
+                this.birthdayChange(this.formmodel.birthday)
+                sex = idNo.substring(13, 14)
+              }
+
+              if (sex % 2 === 0) {
+                this.formmodel.sex = 0
+              } else {
+                this.formmodel.sex = 1
+              }
+            }
           }
         }
     }