Jelajahi Sumber

禁用优化

xiaochan 1 tahun lalu
induk
melakukan
6cbaabf0e9

+ 13 - 7
src/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/EmrHeader.vue

@@ -6,10 +6,19 @@ import {
   useLiftingRestrictions,
   usePatientList
 } from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/emr-init";
+import {
+  FunctionList
+} from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/components/emr-function/useEmrFunction";
 
 const userInfo = useUserStore().userInfo
 
-const buttonList = ref<{ name: string, click: Function, disabled?: boolean }[]>([])
+const buttonList = ref<FunctionList[]>([])
+
+function handleClick(item: FunctionList) {
+  if (item.click && !(item.disabled ?? false)) {
+    item.click(item)
+  }
+}
 
 emrMitt.on('setHeaderFunction', (value) => {
   buttonList.value = value
@@ -21,8 +30,9 @@ emrMitt.on('setHeaderFunction', (value) => {
     <div class="mac_left">
       <div class="mac_item"
            v-for="item in buttonList">
-        <button @click="item.click"
-                :disabled="item.disabled ?? false">
+        <button
+            @click="handleClick(item)"
+            :disabled="item.disabled ?? false">
           {{ item.name }}
         </button>
       </div>
@@ -54,8 +64,6 @@ emrMitt.on('setHeaderFunction', (value) => {
 
 <style lang="scss">
 .mac_header {
-  --system-color-light-hsl: 240, 24%, 100%;
-  --system-color-dark-hsl: 240, 3%, 11%;
   display: flex;
   align-items: center;
   width: 100%;
@@ -112,11 +120,9 @@ emrMitt.on('setHeaderFunction', (value) => {
       position: relative;
       user-select: none;
       appearance: none;
-      cursor: var(--system-cursor-default), auto;
       background-color: transparent;
       -webkit-tap-highlight-color: transparent;
 
-
       &:hover {
         background: #4169E1;
         color: white;

+ 0 - 1
src/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/components/emr-function/EmrFunctionList.vue

@@ -9,7 +9,6 @@ import {
   SortDown,
   Avatar
 } from "@element-plus/icons-vue";
-
 import {
   emrConfig,
   emrMitt, query,

+ 8 - 3
src/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/components/emr-function/useEmrFunction.tsx

@@ -8,6 +8,7 @@ import useDialogToJs from "@/components/js-dialog-comp/useDialogToJs";
 import {getHistory} from "@/api/zhu-yuan-yi-sheng/emr-patient";
 
 export declare type FunctionList = {
+    name?: string;
     iconfontName?: string | any,
     title: string,
     contextmenu?: (value?: FunctionList) => void,
@@ -34,20 +35,24 @@ export const Button = defineComponent({
     },
     setup(props) {
         const {child, index} = props;
-
+        const disabled = child.disabled ?? false;
         return () => (
             <ElButton
                 class={{activation: child.activation ?? false}}
                 style={{borderTop: index !== 0 ? 'none' : ''}}
                 // @ts-ignore
                 onContextmenu={(el: Event) => {
-                    if (child.contextmenu) {
+                    if (child.contextmenu && !disabled) {
                         el.stopPropagation();
                         el.preventDefault();
                         child.contextmenu(child)
                     }
                 }}
-                onClick={() => child.click && child.click(child)}
+                onClick={() => {
+                    if (child.click && !disabled) {
+                        child.click(child);
+                    }
+                }}
                 disabled={child.disabled ?? false}
             >
                 {{