Browse Source

添加回车事件

xiaochan 5 months ago
parent
commit
41e030ad12

+ 3 - 3
src/api/inpatient/xiang-mu-lu-ru.js

@@ -219,9 +219,9 @@ export function getAPrescriptionByPageNo(pageNo) {
 
 /**
  *
- * @param patNo:string
- * @param times:number
- * @return {Promise<{any}>}
+ * @param patNo {string}
+ * @param times {number}
+ * @return {Promise<{admissDept: string;zkWard:string}>}
  */
 export function getPatientInfo(patNo, times) {
     return request({

+ 2 - 1
src/components/xmlr/components/HeaderInfo.vue

@@ -37,7 +37,8 @@ async function getDisList() {
 <template>
   <header>
     住院号:
-    <el-input v-model="store.searchPatNo" style="width: 120px;" clearable/>
+    <el-input v-model="store.searchPatNo" style="width: 120px;" clearable
+              @keydown.enter="() => mutation.getPatInfo(null)"/>
     <el-divider direction="vertical"/>
     <el-button icon="Search" type="primary" @click="() => mutation.getPatInfo(null)">查询</el-button>
     <el-button type="info" @click="getDisList">出院</el-button>

+ 2 - 2
src/components/xmlr/index.ts

@@ -83,8 +83,8 @@ export const useXmlr = (props: XmlrProps, emits: UseDialogType.Emits) => {
             await api.getPatientInfo(store.searchPatNo, times).then(res => {
                 store.patInfo = res
                 mutation.getFee();
-                store.queryWard = res.admissDept
-                store.queryDept = res.zkWard
+                store.queryWard = res?.admissDept
+                store.queryDept = res?.zkWard
                 return res
             }).catch(() => {
                 mutation.clearData();

+ 2 - 4
src/utils/cyRefList.ts

@@ -6,7 +6,7 @@ import {stringIsBlank} from "@/utils/blank-utils";
 declare type CodeType<T> = keyof T & string | ((item: T) => string);
 
 function cyRefList<T = any>(code: CodeType<T>, errMsg: (item: T) => string = () => '请勿重复添加') {
-    const list = ref<T[]>([])
+    const list = ref([]) as Ref<T[]>
     const watchFunc: Function[] = []
 
     const codeIsFunction = typeof code === 'function'
@@ -30,7 +30,6 @@ function cyRefList<T = any>(code: CodeType<T>, errMsg: (item: T) => string = ()
     const listProxy = {
         push: function (...items: T[]) {
             const msgList: string[] = []
-
             items.forEach((item: T) => {
                 let key: string;
                 if (codeIsFunction) {
@@ -53,7 +52,6 @@ function cyRefList<T = any>(code: CodeType<T>, errMsg: (item: T) => string = ()
             }
             sendListening(items).then(r => {
             });
-            // @ts-ignore
             return list.value.push(...items)
         },
         watchPush: function (cb: (value: T) => void) {
@@ -90,7 +88,7 @@ function cyRefList<T = any>(code: CodeType<T>, errMsg: (item: T) => string = ()
         },
     }
 
-    return [list as Ref<T[]>, listProxy]
+    return [list, listProxy]
 }
 
 export default cyRefList