فهرست منبع

建档添加年龄字段

kumu 6 ماه پیش
والد
کامیت
8cc88abddb
2فایلهای تغییر یافته به همراه27 افزوده شده و 3 حذف شده
  1. 22 1
      src/pages/register.page.vue
  2. 5 2
      src/request/api/account.api.ts

+ 22 - 1
src/pages/register.page.vue

@@ -38,6 +38,7 @@ const Fields: Record<FieldKey, Field> = {
     control: {
       label: '身高', placeholder: '请输入身高',
       type: 'number', min: 1, max: 300, clearable: true, readonly: true,
+      maxlength: 5,
     },
     keyboard: { show: false, title: '身高', extraKey:'.', closeButtonText: '完成' },
     suffix: 'cm',
@@ -46,10 +47,20 @@ const Fields: Record<FieldKey, Field> = {
     control: {
       label: '体重', placeholder: '请输入体重',
       type: 'number', min: 1, max: 300, clearable: true, readonly: true,
+      maxlength: 5,
     },
     keyboard: { show: false, title: '体重', extraKey:'.', closeButtonText: '完成' },
     suffix: 'kg',
   },
+  age: {
+    control: {
+      label: '年龄', placeholder: '请输入年龄',
+      type: 'digit', min: 0, max: 300, clearable: true, readonly: true,
+      maxlength: 3,
+    },
+    keyboard: { show: false, title: '年龄', closeButtonText: '完成' },
+    suffix: '岁',
+  },
   sex: {
     control: { label: '性别', border: false },
     component: {
@@ -205,6 +216,12 @@ const { send: handle } = useRequest(
       Notify.warning(`[路由] 配置异常无法解析正确路径,请联系管理员`);
     }
   });
+
+function fix(key: FieldKey) {
+  for ( const field of fields.value ) {
+    if (field.keyboard?.show && field.name !== key ) field.keyboard.show = false;
+  }
+}
 </script>
 <template>
   <div>
@@ -246,7 +263,7 @@ const { send: handle } = useRequest(
                 <van-password-input
                   style="width: 100%;"
                   v-model:value="modelRef[field.name]" v-bind="(field.component as any)!.props"
-                  :focused="field.keyboard?.show" @focus="field.keyboard && (field.keyboard.show = true)"
+                  :focused="field.keyboard?.show" @focus="field.keyboard && (field.keyboard.show = true);fix('code')"
                 />
               </template>
               <template #button>
@@ -342,6 +359,10 @@ const { send: handle } = useRequest(
     $size: 40px;
     height: $size + 2px;
 
+    &::after {
+      display: none;
+    }
+
     li {
       height: $size;
       width: $size;

+ 5 - 2
src/request/api/account.api.ts

@@ -3,7 +3,7 @@ import type { RegisterModel } from '@/request/model';
 import HTTP                   from '../alova';
 
 
-export type FieldKey = 'cardno' | 'phone' | 'code' | 'name' | 'sex' | 'height' | 'weight' | 'isEasyAllergy'
+export type FieldKey = 'cardno' | 'phone' | 'code' | 'name' | 'sex' | 'height' | 'weight' | 'age' | 'isEasyAllergy'
 
 
 export function getCaptchaMethod(mobile: string) {
@@ -25,11 +25,14 @@ export function registerFieldsMethod() {
 }
 
 export function registerAccountMethod(params: Partial<RegisterModel>) {
-  return HTTP.Post<string, string>(`/fdhb-tablet/patientInfoManage/savePatientInfo`, params, {});
+  return HTTP.Post<string, string>(`/fdhb-tablet/patientInfoManage/savePatientInfo`, params, {
+    name: 'register',
+  });
 }
 
 export function searchAccountMethod(params: Partial<RegisterModel>) {
   return HTTP.Get(`/fdhb-tablet/patientInfoManage/getPatientInfoDetail`, {
+    hitSource: 'register',
     params,
     transform(data: Record<string, any>, headers) {
       return Object.fromEntries(Object.entries(data).filter(([ item, value ]) => !!value)) as Partial<RegisterModel>;