xiaochan 6 місяців тому
батько
коміт
937ef9e107
20 змінених файлів з 1850 додано та 1970 видалено
  1. 18 4
      src/components/cy/CyDialog/CyDialogContainer.vue
  2. 89 91
      src/components/cy/CyDialog/index.ts
  3. 50 37
      src/components/cy/CyDialog/index.vue
  4. 58 53
      src/components/cy/cy-monaco-editor/CyMonacoEditor.tsx
  5. 51 80
      src/components/cy/dialog/src/CyDialog.vue
  6. 0 5
      src/components/cy/message-box/index.ts
  7. 0 129
      src/components/cy/message-box/src/cy-message-box.ts
  8. 0 474
      src/components/cy/message-box/src/index.vue
  9. 0 44
      src/components/cy/message-box/src/message-box.type.ts
  10. 59 62
      src/components/inpatient/frontsheet-printpage/ExportDclExcel.vue
  11. 76 71
      src/components/zhu-yuan-yi-sheng/emr/auxiliary-tools/EmrInspect.vue
  12. 116 91
      src/components/zhu-yuan-yi-sheng/emr/auxiliary-tools/EmrTestV2/BacterialCultureTable.vue
  13. 62 64
      src/components/zhu-yuan-yi-sheng/emr/auxiliary-tools/NreTable.vue
  14. 60 53
      src/views/data-base/page-editor-help-v2/components/PageHelpTable.vue
  15. 231 167
      src/views/data-base/page-editor-help-v2/components/page-editor-v2/PageFormBind.vue
  16. 24 22
      src/views/data-base/page-editor-help-v2/components/page-editor-v2/PageHelpOtherConfigurations.vue
  17. 302 228
      src/views/data-base/page-editor-help-v2/components/page-editor-v2/PageHelpV2.vue
  18. 6 1
      src/views/data-base/page-editor-help-v2/page-help-v2.ts
  19. 592 268
      src/views/hospitalization/case-front-sheet/AllCaseFrontSheet.vue
  20. 56 26
      src/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/plugins/opinion/AuditRecord.vue

+ 18 - 4
src/components/cy/CyDialog/CyDialogContainer.vue

@@ -1,12 +1,26 @@
 <script setup lang="tsx">
-import { dialogKeyType } from "@/components/cy/CyDialog/index";
+import { dialogKeyType, DialogState } from "@/components/cy/CyDialog/index";
 import { useSlots } from "vue";
 import { ElButton } from "element-plus";
 
-const root = inject(dialogKeyType);
+const root = inject(dialogKeyType) as DialogState;
 const hasFooter = useSlots().footer;
 const emits = defineEmits(["cancel", "confirm"]);
 
+function onCancel() {
+  emits("cancel", data => {
+    root.reject({ value: "cancel", data });
+    root.visible = false;
+  });
+}
+
+function onConfirm() {
+  emits("confirm", data => {
+    root.resolve(data);
+    root.visible = false;
+  });
+}
+
 onMounted(() => {
   root.showFooter = false;
 });
@@ -21,7 +35,7 @@ onMounted(() => {
       <el-config-provider size="default">
         <slot name="footer" v-if="hasFooter" />
         <template v-else>
-          <el-button v-if="root.showCancel" @click="emits('cancel')">
+          <el-button v-if="root.showCancel" @click="onCancel">
             {{ root.cancelText || "取消" }}
           </el-button>
 
@@ -29,7 +43,7 @@ onMounted(() => {
             v-if="root.showConfirm"
             type="primary"
             color="hsl(240 5.9% 10%)"
-            @click="emits('confirm')"
+            @click="onConfirm"
           >
             {{ root.confirmText || "确认" }}
           </el-button>

+ 89 - 91
src/components/cy/CyDialog/index.ts

@@ -1,123 +1,121 @@
-import {Component, ref, shallowRef} from "vue";
+import { Component, ref, shallowRef } from "vue";
 import XEUtils from "xe-utils";
 
 interface DialogProps {
-    title: string;
-    fullscreen?: boolean;
-    width?: number | string;
-    top?: string | number;
-    showClose?: boolean;
-    alignCenter?: boolean;
-    closeOnClickModal?: boolean;
-    closeOnPressEscape?: boolean;
+  title: string;
+  fullscreen?: boolean;
+  width?: number | string;
+  top?: string | number;
+  showClose?: boolean;
+  alignCenter?: boolean;
+  closeOnClickModal?: boolean;
+  closeOnPressEscape?: boolean;
 }
 
 export type CloseValue = "close" | "confirm" | "cancel";
 
 export interface DialogExpose {
-    // 如果报错了会阻止关闭弹窗
-    confirm: () => any | Promise<any>;
-    // 如果报错了会阻止关闭弹窗
-    cancel: () => any | Promise<any>;
+  // 如果报错了会阻止关闭弹窗
+  confirm: () => any | Promise<any>;
+  // 如果报错了会阻止关闭弹窗
+  cancel: () => any | Promise<any>;
 }
 
 export namespace UseDialogType {
-    export interface Expose extends DialogExpose {
-    }
+  export interface Expose extends DialogExpose {}
 
-    export interface Emits {
-        (e: "cyDialogConfirm" | "cyDialogCancel", value?: any): void;
-    }
+  export interface Emits {
+    (e: "cyDialogConfirm" | "cyDialogCancel", value?: any): void;
+  }
 }
 
 type FirstParam<T> =
-    T extends Component<infer P, any, any, any, any, any>
-        ? P extends Record<string, any>
-            ? P
-            : {}
-        : never;
+  T extends Component<infer P, any, any, any, any, any>
+    ? P extends Record<string, any>
+      ? P
+      : {}
+    : never;
 
 export interface DialogOptions<P = Component> {
-    dialogProps: DialogProps;
-    params?: any;
-    showCancel?: boolean;
-    hideHeader?: boolean,
-    showConfirm?: boolean;
-    showFooter?: boolean;
-    cancelText?: string;
-    confirmText?: string;
-    visible?: boolean;
-    component?: any;
-    componentRef?: DialogExpose;
-    manuallyClose?: (
-        cb: (value: CloseValue, data: any) => void,
-        currentItem: DialogState
-    ) => void;
+  dialogProps: DialogProps;
+  params?: any;
+  showCancel?: boolean;
+  hideHeader?: boolean;
+  showConfirm?: boolean;
+  showFooter?: boolean;
+  cancelText?: string;
+  confirmText?: string;
+  visible?: boolean;
+  component?: any;
+  componentRef?: DialogExpose;
+  manuallyClose?: (
+    cb: (value: CloseValue, data: any) => void,
+    currentItem: DialogState
+  ) => void;
 }
 
 export interface DialogState extends DialogOptions {
-    resolve: (val: { value: CloseValue; data: any }) => void;
-    reject: (val: { value: CloseValue; data: any }) => void;
+  resolve: (val: { value: CloseValue; data: any }) => void;
+  reject: (val: { value: CloseValue; data: any }) => void;
 
-    dialogKey?: number;
-    closeValue?: CloseValue;
+  dialogKey?: number;
+  closeValue?: CloseValue;
 }
 
 export const dialogStore = ref<DialogState[]>([]);
 export const dialogKey = ref(1);
 
 export function useDialog<R = any, C = Component>(
-    component: C,
-    props: DialogOptions<C>
+  component: C,
+  props: DialogOptions<C>
 ) {
-    return new Promise<R>((resolve, reject) => {
-        props = {
-            visible: true,
-            component: shallowRef(component),
-            showCancel: true,
-            showConfirm: true,
-            showFooter: true,
-            hideHeader: false,
-            ...props,
-        };
-
-        dialogKey.value++;
-        const pushIndex = dialogStore.value.push({
-            ...props,
-            resolve: XEUtils.once(value => {
-                resolve(value);
-            }),
-            reject: XEUtils.once(value => {
-                reject(value);
-            }),
-            dialogKey: dialogKey.value,
-            closeValue: "close",
-        });
-
-        if (props.manuallyClose) {
-            const currentItem = dialogStore.value[pushIndex - 1];
-            currentItem.dialogProps.showClose = false;
-            currentItem.dialogProps.alignCenter =
-                currentItem.dialogProps.alignCenter ?? true;
-            currentItem.dialogProps.closeOnClickModal = false;
-            currentItem.dialogProps.closeOnPressEscape = false;
-
-            currentItem.showFooter = false;
-
-            props.manuallyClose(
-                (value: CloseValue, data: any) => {
-                    const item = dialogStore.value[pushIndex - 1];
-                    if (value === "confirm") {
-                        item.resolve(data);
-                    } else {
-                        item.reject({value: item.closeValue, data});
-                    }
-                    item.visible = false;
-                },
-                dialogStore.value[pushIndex - 1]
-            );
-        }
+  return new Promise<R>((resolve, reject) => {
+    props = {
+      visible: true,
+      component: shallowRef(component),
+      showCancel: true,
+      showConfirm: true,
+      showFooter: true,
+      hideHeader: false,
+      ...props,
+    };
+
+    dialogKey.value++;
+    const pushIndex = dialogStore.value.push({
+      ...props,
+      resolve: XEUtils.once(value => {
+        resolve(value);
+      }),
+      reject: XEUtils.once(value => {
+        reject(value);
+      }),
+      dialogKey: dialogKey.value,
+      closeValue: "close",
     });
+
+    if (props.manuallyClose) {
+      const currentItem = dialogStore.value[pushIndex - 1];
+      currentItem.dialogProps.showClose = false;
+      currentItem.dialogProps.alignCenter =
+        currentItem.dialogProps.alignCenter ?? true;
+      currentItem.dialogProps.closeOnClickModal = false;
+      currentItem.dialogProps.closeOnPressEscape = false;
+      currentItem.showFooter = false;
+
+      props.manuallyClose(
+        (value: CloseValue, data: any) => {
+          const item = dialogStore.value[pushIndex - 1];
+          if (value === "confirm") {
+            item.resolve(data);
+          } else {
+            item.reject({ value: item.closeValue, data });
+          }
+          item.visible = false;
+        },
+        dialogStore.value[pushIndex - 1]
+      );
+    }
+  });
 }
 
 export const dialogKeyType: InjectionKey<DialogState> = Symbol("cyDialog");

+ 50 - 37
src/components/cy/CyDialog/index.vue

@@ -1,16 +1,16 @@
 <script setup lang="tsx">
-import {dialogKeyType, DialogState, dialogStore} from "./index";
-import {ElButton} from "element-plus";
+import { dialogKeyType, DialogState, dialogStore } from "./index";
+import { ElButton } from "element-plus";
 import XEUtils from "xe-utils";
 import sleep from "@/utils/sleep";
-import {nextTick, renderSlot} from "vue";
-import {CircleCloseFilled} from '@element-plus/icons-vue'
+import { nextTick, renderSlot } from "vue";
+import { CircleCloseFilled } from "@element-plus/icons-vue";
 
 function next(item: DialogState, data: any) {
   if (item.closeValue === "confirm") {
     item.resolve(data);
   } else {
-    item.reject({value: item.closeValue, data});
+    item.reject({ value: item.closeValue, data });
   }
   item.visible = false;
 }
@@ -27,7 +27,7 @@ async function handleCancel(item: DialogState, emits = false, value = null) {
     item.closeValue = "cancel";
     next(item, data);
   } catch (e) {
-    console.error(e)
+    console.error(e);
   }
 }
 
@@ -43,12 +43,12 @@ async function handleConfirm(item: DialogState, emits = false, value = null) {
     item.closeValue = "confirm";
     next(item, data);
   } catch (e) {
-    console.error(e)
+    console.error(e);
   }
 }
 
 async function closed(item: DialogState, index: number) {
-  item.reject({value: item.closeValue, data: null});
+  item.reject({ value: item.closeValue, data: null });
   await nextTick();
   await sleep();
   dialogStore.value.splice(index, 1);
@@ -62,7 +62,7 @@ const ConfigProvider = defineComponent({
   props: {
     item: Object,
   },
-  setup(props, {slots}) {
+  setup(props, { slots }) {
     provide(dialogKeyType, props.item as DialogState);
     return () => renderSlot(slots, "default");
   },
@@ -70,7 +70,7 @@ const ConfigProvider = defineComponent({
 
 const getClass = (item: DialogState) => {
   return item.hideHeader ? "cy-dialog_hideHeader" : "";
-}
+};
 
 const style = (item: DialogState) => {
   if (item.dialogProps.fullscreen) {
@@ -84,51 +84,61 @@ const style = (item: DialogState) => {
 
 <template>
   <el-dialog
-      v-for="(item, index) in dialogStore"
-      :key="`cy-dialog_${item.dialogKey}`"
-      :style="style(item)"
-      class="cy_dialog-v2"
-      :class="getClass(item)"
-      v-model="item.visible"
-      draggable
-      v-bind="item.dialogProps"
-      :show-close="false"
-      @closed="closed(item, index)"
+    v-for="(item, index) in dialogStore"
+    :key="`cy-dialog_${item.dialogKey}`"
+    :style="style(item)"
+    class="cy_dialog-v2"
+    modal-class="cy_dialog-v2-modal_class"
+    :class="getClass(item)"
+    v-model="item.visible"
+    draggable
+    v-bind="item.dialogProps"
+    :show-close="false"
+    @closed="closed(item, index)"
   >
     <template #header="{ close, titleId, titleClass }">
-      <div style=" display: flex;  flex-direction: row;  justify-content: space-between;  gap: 16px;">
-        <h4 :id="titleId" :class="titleClass" style="margin: 0">{{ item.dialogProps.title }}</h4>
-        <el-button circle @click="close" icon="Close"/>
+      <div
+        style="
+          display: flex;
+          flex-direction: row;
+          justify-content: space-between;
+          gap: 16px;
+        "
+      >
+        <h4 :id="titleId" :class="titleClass" style="margin: 0">
+          {{ item.dialogProps.title }}
+        </h4>
+        <el-button circle @click="close" icon="Close" />
       </div>
     </template>
     <ConfigProvider :item="item">
       <component
-          :is="item.component"
-          :ref="el => setRef(el, item)"
-          v-bind="item.params"
-          @cyDialogCancel="
+        :is="item.component"
+        :ref="el => setRef(el, item)"
+        v-bind="item.params"
+        @cyDialogCancel="
           (value: any, isEmits = true) => handleCancel(item, isEmits, value)
         "
-          @cyDialogConfirm="
+        @cyDialogConfirm="
           (value: any, isEmits = true) => handleConfirm(item, isEmits, value)
         "
       />
     </ConfigProvider>
     <template #footer v-if="item.showFooter">
       <el-button
-          size="default"
-          v-if="item.showCancel"
-          @click="handleCancel(item)"
+        size="default"
+        v-if="item.showCancel"
+        @click="handleCancel(item)"
       >
         {{ item.cancelText || "取消" }}
       </el-button>
 
       <el-button
-          v-if="item.showConfirm"
-          type="primary"
-          size="default"
-          color="hsl(240 5.9% 10%)"
-          @click="handleConfirm(item)"
+        v-if="item.showConfirm"
+        type="primary"
+        size="default"
+        color="hsl(240 5.9% 10%)"
+        @click="handleConfirm(item)"
       >
         {{ item.confirmText || "确认" }}
       </el-button>
@@ -143,7 +153,6 @@ const style = (item: DialogState) => {
   .el-dialog__title {
     font-weight: 600;
   }
-
 }
 
 .cy-dialog_hideHeader {
@@ -152,6 +161,10 @@ const style = (item: DialogState) => {
   }
 }
 
+.cy_dialog-v2-modal_class {
+  background-color: rgba(0, 0, 0, 0.8);
+}
+
 .cy_dialog-v2.el-dialog.is-fullscreen {
   display: flex;
   flex-direction: column;

+ 58 - 53
src/components/cy/cy-monaco-editor/CyMonacoEditor.tsx

@@ -3,8 +3,6 @@ import useCreateMonaco, {
   XcIStandaloneCodeEditor,
 } from "@/utils/monaco-utlis/useCreateMonaco";
 import sleep from "@/utils/sleep";
-import setDialogToJs from "@/components/js-dialog-comp/useDialogToJs";
-import CyDialog from "@/components/cy/dialog/src/CyDialog.vue";
 import XEUtils from "xe-utils";
 import { BizException, ExceptionEnum } from "@/utils/BizException";
 import CyFlex from "@/components/cy/flex/src/CyFlex.vue";
@@ -12,6 +10,7 @@ import { ElButton } from "element-plus";
 import * as monaco from "monaco-editor";
 import { IsCyDialog } from "@/components/cy/dialog/src/useCyDialog";
 import { tryOnBeforeUnmount } from "@vueuse/core";
+import { DialogOptions, useDialog } from "@/components/cy/CyDialog/index";
 
 export const JsonEditor = defineComponent({
   name: "JsonEditor",
@@ -180,78 +179,84 @@ interface CodeProps {
   code: string | object;
   type?: string;
   prompt?: string;
-  testClick: (value: any, code: string) => boolean;
+  testClick: (value: any, code: string) => void;
 }
 
 export function CyCodeEditorDialog(
   props: CodeProps,
-  dialogProps?: Partial<IsCyDialog>
+  dialogProps: DialogOptions = {
+    dialogProps: {
+      title: "代码编辑",
+      width: "90%",
+    },
+  }
 ): Promise<string> {
   const codeRef = ref();
 
-  function confirmClick(next: (arg0: any) => void) {
-    if (codeRef.value.clickText()) {
-      next(codeRef.value.getData());
+  function confirmClick() {
+    try {
+      codeRef.value.clickText();
+      return codeRef.value.getData();
+    } catch (e) {
+      BizException(ExceptionEnum.MESSAGE_ERROR, "校验未通过" + e.message);
     }
   }
 
-  const Dialog = (
-    <CyDialog
-      bodyWidth="90%"
-      bodyHeight="calc(100vh - 300px)"
-      title="代码编辑"
-      {...dialogProps}
-      confirmClick={confirmClick}
-    >
-      {{
-        default: () => <CodeEditor ref={codeRef} {...props} />,
-      }}
-    </CyDialog>
-  );
+  const Dialog = defineComponent({
+    setup(p, { expose }) {
+      expose({
+        confirm: confirmClick,
+      });
 
-  return new Promise<string>(resolve => {
-    setDialogToJs(Dialog, {})
-      .then(res => {
-        resolve(res);
-      })
-      .catch(() => {});
+      return () => (
+        <CodeEditor
+          ref={codeRef}
+          {...props}
+          style={{ height: "calc(100vh - 300px)" }}
+        />
+      );
+    },
+  });
+
+  return useDialog(Dialog, {
+    ...dialogProps,
   });
 }
 
 export function CyJsonEditorDialog<T extends object>(
   json: T | string,
-  dialogProps: IsCyDialog
+  dialogProps: DialogOptions = {
+    dialogProps: {
+      title: "json编辑",
+      width: "60%",
+    },
+  }
 ): Promise<{ jsonStr: string; json: T }> {
-  const defaultProps = {
-    bodyWidth: "60%",
-    ...dialogProps,
-  };
-
   const cyJsonEditorRef = ref();
 
-  function confirmClick(next: (data: any) => void) {
-    const data = cyJsonEditorRef.value.getData(false);
-    next(data);
+  function confirmClick() {
+    return cyJsonEditorRef.value.getData(false);
   }
 
-  const Dialog = (
-    <CyDialog
-      title="json编辑"
-      bodyHeight="50vh"
-      {...defaultProps}
-      confirmClick={confirmClick}
-    >
-      {{
-        default: () => <JsonEditor ref={cyJsonEditorRef} data={json} />,
-      }}
-    </CyDialog>
-  );
+  const Dialog = defineComponent({
+    setup(p, { expose }) {
+      expose({
+        confirm: confirmClick,
+      });
 
-  return new Promise(resolve => {
-    setDialogToJs(Dialog, { data: json })
-      .then(res => {
-        resolve(res);
-      })
-      .catch(() => {});
+      return () => (
+        <JsonEditor
+          style={{
+            height: dialogProps.dialogProps?.fullscreen ? "100%" : "50vh",
+          }}
+          ref={cyJsonEditorRef}
+          data={json}
+        />
+      );
+    },
+  });
+
+  return useDialog(Dialog, {
+    ...dialogProps,
   });
 }

+ 51 - 80
src/components/cy/dialog/src/CyDialog.vue

@@ -1,107 +1,78 @@
 <script lang="ts">
-import {
-  ElButton,
-  useZIndex,
-  ElFocusTrap
-} from 'element-plus'
+import { ElButton, useZIndex } from "element-plus";
 import {
   CyDialogProps,
   useCyDialog,
 } from "@/components/cy/dialog/src/useCyDialog";
-import './cy-dialog.scss'
+import "./cy-dialog.scss";
 
-const COMPONENT_NAME = 'CyDialog'
+const COMPONENT_NAME = "CyDialog";
 
 export default defineComponent({
   name: COMPONENT_NAME,
   components: {
     ElButton,
-    ElFocusTrap
   },
-  props: {...CyDialogProps},
-  emits: ['closed'],
-  setup(props, {emit, expose}) {
-    const API = useCyDialog(props, emit)
-    const zIndex = ref(useZIndex().nextZIndex())
+  props: { ...CyDialogProps },
+  emits: ["closed"],
+  setup(props, { emit, expose }) {
+    const API = useCyDialog(props, emit);
+    const zIndex = ref(useZIndex().nextZIndex());
 
     expose({
-      closed: API.closed
-    })
+      closed: API.closed,
+    });
 
     return {
       ...API,
       zIndex,
-      props
-    }
-  }
-})
+      props,
+    };
+  },
+});
 </script>
 
-
 <template>
-  <div
-      ref="containerRef"
-      :style="{ zIndex  }"
-      :class="[ns.b('container')]">
-    <div :class="[ ns.e('dialog')]">
-      <ElFocusTrap
-          loop
-          focus-start-el="container"
-          :trapped="true"
-          :focus-trap-el="containerRef"
-          @focusout-prevented="onFocusoutPrevented"
-          @release-requested="onCloseRequested"
+  <div ref="containerRef" :style="{ zIndex }" :class="[ns.b('container')]">
+    <div :class="[ns.e('dialog')]">
+      <div
+        ref="boxRef"
+        :style="boxStyle"
+        :class="[ns.e('box'), ns.is('fullScreen', fullScreen)]"
       >
-        <div
-            ref="boxRef"
-            :style="boxStyle"
-            :class="[ns.e('box'),ns.is('fullScreen' , fullScreen)]"
-        >
-          <header
-              ref="headerRef"
-              :class="[ns.e('header')]"
-          >
-            <span>{{ title }}</span>
-            <el-button icon="Close"
-                       v-if="showCancelButton"
-                       size="small"
-                       circle
-                       @click="handleCancel"/>
-          </header>
-          <div
-              ref="bodyRef"
-              :style="bodyStyle"
-              :class="[ns.e('body')]"
+        <header ref="headerRef" :class="[ns.e('header')]">
+          <span>{{ title }}</span>
+          <el-button
+            icon="Close"
+            v-if="showCancelButton"
+            size="small"
+            circle
+            @click="handleCancel"
+          />
+        </header>
+        <div ref="bodyRef" :style="bodyStyle" :class="[ns.e('body')]">
+          <slot :width="state.bodySize.width" :height="state.bodySize.height" />
+        </div>
+        <footer ref="footerRef" :class="[ns.e('footer')]">
+          <el-button
+            v-if="showCancelButton"
+            @click="handleCancel"
+            size="default"
           >
-            <slot
-                :width="state.bodySize.width"
-                :height="state.bodySize.height"
-            />
-          </div>
-          <footer
-              ref="footerRef"
-              :class="[ns.e('footer')]"
+            {{ cancelText ?? "取消" }}
+          </el-button>
+          <el-button
+            color="hsl(240 5.9% 10%)"
+            style="margin-right: 15px"
+            @click="handleConfirm"
+            size="default"
+            :loading="state.confirmLoading"
+            type="primary"
           >
-            <el-button
-                v-if="showCancelButton"
-                @click="handleCancel"
-                size="default"
-            >
-              {{ cancelText ?? '取消' }}
-            </el-button>
-            <el-button
-                color="hsl(240 5.9% 10%)"
-                style="margin-right: 15px"
-                @click="handleConfirm"
-                size="default"
-                :loading="state.confirmLoading"
-                type="primary"
-            >
-              {{ confirmText ?? '确认' }}
-            </el-button>
-          </footer>
-        </div>
-      </ElFocusTrap>
+            {{ confirmText ?? "确认" }}
+          </el-button>
+        </footer>
+      </div>
     </div>
   </div>
 </template>

+ 0 - 5
src/components/cy/message-box/index.ts

@@ -1,5 +0,0 @@
-import MessageBox from './src/cy-message-box'
-import {IElMessageBox} from "./src/message-box.type";
-
-export default MessageBox
-export const CyMessageBox: IElMessageBox = MessageBox as IElMessageBox

+ 0 - 129
src/components/cy/message-box/src/cy-message-box.ts

@@ -1,129 +0,0 @@
-//@ts-nocheck
-import MessageBoxConstructor from './index.vue';
-import {createVNode, render} from "vue";
-import {
-    Warning,
-    SuccessFilled,
-    InfoFilled,
-    CircleCloseFilled,
-    DeleteFilled
-} from '@element-plus/icons-vue'
-import {IElMessageBox, MessageBoxType} from "./message-box.type";
-import {uuid} from '@/utils/getUuid'
-
-const iconData = {
-    success: {
-        icon: SuccessFilled,
-        title: '成功',
-        iconColor: '#67c23a'
-    },
-    warning: {
-        icon: Warning,
-        title: '警告',
-        iconColor: '#e6a23c'
-    },
-    info: {
-        icon: InfoFilled,
-        title: '提示',
-        iconColor: '#909399'
-    },
-    error: {
-        icon: CircleCloseFilled,
-        title: '错误',
-        iconColor: '#f56c6c'
-    },
-    delete: {
-        icon: DeleteFilled,
-        title: '删除',
-        iconColor: '#f56c6c'
-    }
-}
-
-declare type MapClose = {
-    close: () => void
-}
-
-const messageInstance = new Map<string, MapClose>();
-
-const MESSAGE_BOX_VARIANTS = ['alert', 'confirm', 'prompt'] as const
-const MESSAGE_BOX_DEFAULT_OPTS: {
-    [key in typeof MESSAGE_BOX_VARIANTS[number]]?: MessageBoxType
-} = {
-    alert: {closeOnPressEscape: false, closeOnClickModal: false, showCancelButton: false},
-    confirm: {showCancelButton: true},
-    prompt: {showInput: true},
-}
-
-MESSAGE_BOX_VARIANTS.forEach(item => {
-    // @ts-ignore
-    MessageBox[item] = messageBoxFactory(item)
-})
-
-function messageBoxFactory(boxType: typeof MESSAGE_BOX_VARIANTS[number]) {
-    return (options: MessageBoxType) => {
-        return MessageBox(
-            Object.assign(
-                options,
-                {
-                    ...MESSAGE_BOX_DEFAULT_OPTS[boxType]
-                }
-            )
-        )
-    }
-}
-
-function getIcon(options: MessageBoxType) {
-    const data = iconData[options.type || 'info'];
-    data.title = options.title || data.title;
-    return data
-}
-
-function MessageBox(options: MessageBoxType) {
-    const div = document.createElement('div');
-    document.body.appendChild(div);
-    const icon = getIcon(options)
-    const id = options.boxId || 'cy' + uuid(5);
-
-    function clearDiv() {
-        render(null, div);
-        div.remove();
-        messageInstance.delete(id);
-    }
-
-    return new Promise((resolve, reject) => {
-
-        const data = {
-            onCancel: (val: string) => {
-                reject(val)
-            },
-            onConfirm: (val: string) => {
-                resolve(val);
-            },
-            onVanish: () => {
-                clearDiv();
-            },
-            setClose: (close: () => void) => {
-                if (messageInstance.has(id)) {
-                    messageInstance.get(id)?.close()
-                }
-                messageInstance.set(id, {close})
-            }
-        }
-
-        Object.assign(data, options, {...icon});
-        const vNode = createVNode(MessageBoxConstructor, data, null);
-        render(vNode, div);
-    });
-}
-
-MessageBox.close = (id: string) => {
-    if (id) {
-        messageInstance.get(id)?.close()
-    } else {
-        messageInstance.forEach((value, key) => {
-            messageInstance.get(key)?.close()
-        })
-    }
-}
-
-export default MessageBox as IElMessageBox;

+ 0 - 474
src/components/cy/message-box/src/index.vue

@@ -1,474 +0,0 @@
-<script setup lang="ts">
-import {
-  ElOverlay,
-  ElFocusTrap,
-  useZIndex,
-  ElInput,
-  ElSelect,
-  ElOption,
-  ElIcon,
-  useDraggable,
-  ElButton,
-} from "element-plus";
-import {nextTick, onMounted, ref, computed, watch, isVNode, PropType} from "vue";
-import sleep from "@/utils/sleep";
-import {Close} from '@element-plus/icons-vue';
-import {useCompRef} from "@/utils/useCompRef";
-import {uuid} from '@/utils/getUuid';
-
-const props = defineProps({
-  title: {
-    type: String,
-    default: '提示'
-  },
-  draggable: {
-    type: Boolean,
-    default: true
-  },
-  message: {
-    type: [String, Object],
-    default: ''
-  },
-  showInput: {
-    type: Boolean,
-    default: false
-  },
-  icon: {
-    type: Object,
-    default: null
-  },
-  iconColor: {
-    type: String,
-    default: '',
-  },
-  closeOnClickModal: {
-    type: Boolean,
-    default: true
-  },
-  closeOnPressEscape: {
-    type: Boolean,
-    default: true
-  },
-  inputErrorMessage: {
-    type: String,
-    default: '检验未通过'
-  },
-  inputMaxLength: {
-    type: Number,
-    default: null
-  },
-  inputAllowEmpty: {
-    type: Boolean,
-    default: false
-  },
-  inputValidator: {
-    type: Function,
-    default: null
-  },
-  selectOption: {
-    type: Array as PropType<{ code: string | number, name: string }[]>,
-    default: null
-  },
-  dangerouslyUseHTMLString: {
-    type: Boolean,
-    default: false
-  },
-  inputDefaultValue: {
-    type: String,
-    default: ''
-  },
-  inputRows: {
-    type: Number,
-    default: null
-  },
-  showCancelButton: {
-    type: Boolean,
-    default: true
-  },
-  setClose: {
-    type: Function,
-    default: () => {
-    }
-  },
-  cancelButtonText: {
-    type: String,
-    default: '取消'
-  },
-  confirmButtonText: {
-    type: String,
-    default: '确认'
-  },
-  showIcon: {
-    type: Boolean,
-    default: true
-  },
-  beforeClose: {
-    type: Function,
-    default: () => true
-  },
-  placeholder: {
-    type: String,
-    default: ''
-  }
-})
-
-const emits = defineEmits(['cancel', 'confirm', 'vanish'])
-const visible = ref(false)
-const zIndex = ref(0)
-const rootRef = ref<HTMLDivElement>()
-const focusStartRef = ref<HTMLElement>()
-const inputRef = ref()
-const headerRef = ref<HTMLElement>()
-const draggable = computed(() => props.draggable)
-const confirmRef = useCompRef(ElButton)
-const dithering = ref(false)
-const inputValue = ref(props.inputDefaultValue)
-const errorMsg = ref('')
-const inputId = 'cy-message' + uuid(5, 62)
-
-const reboundClick = async () => {
-  dithering.value = true
-  await sleep(300)
-  dithering.value = false
-}
-
-const overlayClick = () => {
-  if (props.closeOnClickModal) {
-    handelClose('close');
-  } else {
-    reboundClick();
-  }
-}
-
-const outputErrorMessage = (value) => {
-  errorMsg.value = value
-  console.warn(value)
-}
-
-const submitVerification = (val): boolean => {
-  if (val === 'confirm' && props.showInput) {
-    if (!props.inputAllowEmpty) {
-      if (inputValue.value === '') {
-        outputErrorMessage('不允许为空。')
-        return false
-      }
-    }
-    if (props.inputMaxLength && inputValue.value.length > props.inputMaxLength) {
-      outputErrorMessage(`输入内容长度不能超过${props.inputMaxLength}`)
-      return false
-    }
-    if (props.inputValidator) {
-      const res = props.inputValidator(inputValue.value)
-      if (typeof res === 'string' && res.length > 0) {
-        outputErrorMessage(res)
-        return false
-      }
-      if (typeof res === 'boolean' && !res) {
-        outputErrorMessage(props.inputErrorMessage)
-        return false
-      }
-
-    }
-  }
-  return true
-}
-
-const handelClose = (val: 'cancel' | 'confirm' | 'close') => {
-  if (!submitVerification(val)) return
-  if (val === "cancel" && !props.beforeClose(inputValue.value)) {
-    reboundClick();
-    return;
-  }
-  visible.value = false
-  if (val === 'confirm') {
-    emits('confirm', {action: val, value: inputValue.value})
-  } else {
-    emits('cancel', {action: val, value: inputValue.value})
-  }
-}
-
-const onCloseRequested = () => {
-  if (props.closeOnPressEscape) {
-    handelClose('close')
-  } else {
-    reboundClick()
-  }
-}
-
-watch(() => visible.value, (val) => {
-  if (val) {
-    nextTick(() => {
-      if (props.showInput) {
-        focusStartRef.value = inputRef.value?.$el ?? rootRef.value
-        sleep(200).then(() => {
-          inputRef.value?.focus()
-        })
-      } else {
-        focusStartRef.value = confirmRef.value?.$el ?? rootRef.value
-      }
-    })
-  }
-})
-
-useDraggable(rootRef, headerRef, draggable)
-
-onMounted(async () => {
-  props.setClose(() => {
-    handelClose('close')
-  })
-  zIndex.value = useZIndex().nextZIndex()
-  await nextTick()
-  await sleep(100);
-  visible.value = true
-})
-
-</script>
-
-<template>
-  <transition name="overlay_background">
-    <ElOverlay
-        v-show="visible"
-        overlay-class="cy-message_overlay"
-        :z-index="zIndex"
-    >
-      <transition name="cy-enlarge" @after-leave="emits('vanish')">
-        <div
-            role="dialog"
-            v-show="visible"
-            aria-modal="true"
-            class="cy-overlay-message-box"
-            @click="overlayClick"
-        >
-          <ElFocusTrap
-              loop
-              :trapped="visible"
-              :focus-trap-el="rootRef"
-              :focus-start-el="focusStartRef"
-              @release-requested="onCloseRequested"
-          >
-            <div :class="dithering ? 'cy-message-box_dithering' : ''">
-              <div ref="rootRef" tabindex="-1" class="cy-message-box" @click.stop>
-                <header ref="headerRef">
-                  <div class="cy-message-box_title">
-                    <el-icon
-                        v-if="props.icon"
-                        :size="24"
-                        :style="{color: props.iconColor}"
-                    >
-                      <component :is="props.icon"/>
-                    </el-icon>
-                    {{ props.title }}
-                  </div>
-
-                  <button
-                      @click.stop="handelClose('close')"
-                      v-if="props.showIcon"
-                      @keydown.prevent.enter="handelClose('close')">
-                    <el-icon>
-                      <Close/>
-                    </el-icon>
-                  </button>
-
-                </header>
-                <div class="cy-message-box_body">
-                  <div class="cy-message-box_message" v-if="props.message">
-                    <component :is="props.showInput ? 'label' : 'p'"
-                               v-if="props.dangerouslyUseHTMLString"
-                               v-html="props.message"
-                               :for="inputId"></component>
-                    <component :is="props.showInput ? 'label' : 'p'"
-                               v-else
-                               :for="inputId">
-                      <template v-if="isVNode(props.message)">
-                        <component :is="props.message"/>
-                      </template>
-                      <template v-else>
-                        {{ props.message }}
-                      </template>
-                    </component>
-                  </div>
-                  <div v-if="props.showInput" style="padding-top: 15px">
-                    <el-select v-model="inputValue"
-                               v-if="props.selectOption"
-                               size="small"
-                               filterable
-                               :placeholder
-                               style="width: 100%"
-                               allow-create
-                               :reserve-keyword="true"
-                               default-first-option
-                               :id="inputId"
-                               ref="inputRef">
-                      <el-option v-for="item in props.selectOption"
-                                 :label="item.name"
-                                 :value="item.code"
-                                 :key="item.code"/>
-                    </el-select>
-                    <el-input v-model="inputValue"
-                              :placeholder
-                              size="small"
-                              v-else
-                              @keydown.prevent.enter="handelClose('confirm')"
-                              :type="props.inputRows ? 'textarea' : 'text'"
-                              :rows="props.inputRows"
-                              :id="inputId"
-                              ref="inputRef"
-                              :maxlength="props.inputMaxLength"
-                              show-word-limit/>
-                    <div class="cy-message-box_error-msg"
-                         :style="{visibility: errorMsg ? 'visible' : 'hidden'}">
-                      {{ errorMsg }}
-                    </div>
-                  </div>
-                </div>
-                <footer>
-                  <el-button text
-                             v-if="props.showCancelButton"
-                             @click.stop="handelClose('cancel')"
-                             type="danger"
-                             @keydown.prevent.enter="handelClose('cancel')"
-                             class="cancel">
-                    {{ props.cancelButtonText }}
-                  </el-button>
-                  <el-button type="primary"
-                             class="confirm"
-                             @keydown.prevent.enter="handelClose('confirm')"
-                             ref="confirmRef"
-                             @click.stop="handelClose('confirm')">
-                    {{ props.confirmButtonText }}
-                  </el-button>
-                </footer>
-              </div>
-            </div>
-          </ElFocusTrap>
-        </div>
-      </transition>
-    </ElOverlay>
-  </transition>
-</template>
-
-<style lang="scss">
-@import "@/assets/cy/cy-dialog";
-
-$cy-message-box-radius: 13px;
-
-.cy-overlay-message-box {
-  position: fixed;
-  top: 0;
-  right: 0;
-  bottom: 0;
-  left: 0;
-  padding: 16px;
-  overflow: auto;
-  display: flex;
-  justify-content: center;
-  align-items: center;
-
-  .cy-message-box_dithering {
-    animation: reboundClick .3s ease;
-  }
-
-  .cy-message-box {
-    display: inline-block;
-    border-radius: $cy-message-box-radius;
-    background: #fff;
-
-    header {
-      padding: 15px 17px 9px 17px;
-      text-align: left;
-      position: relative;
-      cursor: move;
-      user-select: none;
-
-      .cy-message-box_title {
-        font-size: 18px;
-        display: flex;
-        align-items: center;
-
-        .el-icon {
-          margin-right: 10px;
-        }
-      }
-
-      button {
-        position: absolute;
-        top: -6px;
-        right: -6px;
-        border: 0;
-        height: 34px;
-        width: 34px;
-        box-sizing: border-box;
-        background: white;
-        border-radius: 12px;
-        box-shadow: 0 5px 20px 0 rgba(0, 0, 0, .05);
-        display: flex;
-        align-items: center;
-        justify-content: center;
-        font-size: 20px;
-        color: black;
-        cursor: pointer;
-        transition: all .25s ease;
-
-        &:hover {
-          -webkit-box-shadow: 0 0 4px 0 rgba(0, 0, 0, .05);
-          box-shadow: 0 0 4px 0 rgba(0, 0, 0, .05);
-          transform: translate(-2px, 2px);
-        }
-      }
-    }
-
-    .cy-message-box_body {
-      padding: 10px 16px;
-      min-width: 420px;
-      max-width: 420px;
-
-      p {
-        margin: 0;
-        line-height: 24px;
-      }
-
-      .cy-message-box_message {
-        max-height: 200px;
-        overflow: auto;
-        min-height: 19px;
-        box-sizing: border-box;
-
-        label {
-          touch-action: manipulation;
-        }
-
-        &::-webkit-scrollbar {
-          width: 10px;
-          height: 10px;
-          display: block;
-          background: white;
-          cursor: pointer;
-        }
-
-        &::-webkit-scrollbar-thumb {
-          cursor: pointer;
-          border-radius: 5px;
-          background: #2C3E50;
-        }
-      }
-
-      .cy-message-box_error-msg {
-        height: 10px;
-        font-size: 12px;
-        color: var(--el-color-error);
-        min-height: 18px;
-      }
-
-    }
-
-    footer {
-      padding: 0 16px 10px 16px;
-      display: flex;
-      justify-content: end;
-    }
-
-  }
-
-}
-
-</style>

+ 0 - 44
src/components/cy/message-box/src/message-box.type.ts

@@ -1,44 +0,0 @@
-export interface MessageBoxType {
-    message: string | any;
-    title?: string;
-    showInput?: boolean;
-    type?: 'success' | 'warning' | 'info' | 'error' | 'delete';
-    closeOnClickModal?: boolean;
-    closeOnPressEscape?: boolean
-    inputMaxLength?: number,
-    inputAllowEmpty?: boolean,
-    inputValidator?: (inputValue: string) => boolean | string,
-    inputErrorMessage?: string;
-    dangerouslyUseHTMLString?: boolean
-    selectOption?: { code: string | number, name: string }[],
-    inputRows?: number;
-    showCancelButton?: boolean,
-    inputDefaultValue?: string,
-    boxId?: string,
-    cancelButtonText?: string;
-    confirmButtonText?: string,
-    showIcon?: boolean,
-    beforeClose?: (inputValue: string) => boolean,
-    placeholder?: string
-}
-
-type CyMessageClose = { action: 'cancel' | 'confirm' | 'close', value: string }
-
-export type CyMessageBoxShortcutMethod = ((
-    options: MessageBoxType
-) => Promise<CyMessageClose>)
-
-export interface IElMessageBox {
-    (options: MessageBoxType): Promise<CyMessageClose>
-
-    /** Show an alert message box */
-    alert: CyMessageBoxShortcutMethod
-
-    /** Show a confirm message box */
-    confirm: CyMessageBoxShortcutMethod
-
-    /** Show a prompt message box */
-    prompt: CyMessageBoxShortcutMethod
-
-    close: (id?: string) => void;
-}

+ 59 - 62
src/components/inpatient/frontsheet-printpage/ExportDclExcel.vue

@@ -1,94 +1,91 @@
 <template>
-  <CyDialog title="复印/封存/借阅导出" body-width="300px"
-            body-height="max-content" ignore-error
-            confirm-text="导出"
-            cancel-text="关闭"
-            :confirm-click="executeExport">
-    <div>请选择要导出的数据:</div>
-    <div class="input_area">
-      <el-select v-model="exportRequest.type" style="width: 220px">
-        <el-option label="复印" value="DUPLICATE"></el-option>
-        <el-option label="封存" value="CLOSEDOWN"></el-option>
-        <el-option label="借阅" value="LENDOUT"></el-option>
-      </el-select>
-    </div>
+  <div>请选择要导出的数据:</div>
+  <div class="input_area">
+    <el-select v-model="exportRequest.type" style="width: 220px">
+      <el-option label="复印" value="DUPLICATE"></el-option>
+      <el-option label="封存" value="CLOSEDOWN"></el-option>
+      <el-option label="借阅" value="LENDOUT"></el-option>
+    </el-select>
+  </div>
 
-    <div style="margin-top: 24px">请选择数据时间范围:</div>
-    <div class="input_area mg-btm">
-      <CyDateRange />
-    </div>
-  </CyDialog>
+  <div style="margin-top: 24px">请选择数据时间范围:</div>
+  <div class="input_area mg-btm">
+    <CyDateRange />
+  </div>
 </template>
 
-<script setup>
-
+<script setup lang="ts">
 import useDateRange from "@/utils/cy-use/useDateRange";
-import CyDialog from "@/components/cy/dialog/src/CyDialog.vue";
-import {Export} from "@/utils/ExportExcel";
-import {getExportableDclData} from "@/api/case-front-sheet";
+import { Export } from "@/utils/ExportExcel";
+import { getExportableDclData } from "@/api/case-front-sheet";
+import { UseDialogType } from "@/components/cy/CyDialog/index.js";
 
 const exportRequest = reactive({
-  type: 'DUPLICATE',
-  begin: '',
-  end: ''
-})
+  type: "DUPLICATE",
+  begin: "",
+  end: "",
+});
 
-const {CyDateRange, dateRange} = useDateRange({shortcutsIndex: 5, clearable: false})
+const { CyDateRange, dateRange } = useDateRange({
+  shortcutsIndex: 5,
+  clearable: false,
+});
 
-function executeExport(next) {
+function executeExport() {
   exportRequest.begin = dateRange.value.start;
-  exportRequest.end = dateRange.value.end
-  let label = getLabel()
+  exportRequest.end = dateRange.value.end;
+  let label = getLabel();
   getExportableDclData(exportRequest).then(res => {
-    Export(res, generateField(label), label + '记录')
-    // 关闭组件对话框
-    // next()
-  })
+    Export(res, generateField(label), label + "记录");
+  });
 }
 
 function generateField(label) {
   const field = {
-    bah: '住院号',
-    times: '住院次数',
-    patName: '患者姓名',
-    admissDate: '入院时间',
-    disDate: '出院时间',
-    disDept: '出院科室',
-    doctor: '管床医生',
-    visitStaff: label + '人员',
-    opTime: label + '时间',
-    remark: '备注',
-    opStaff: '病案管理员',
-  }
-  if (exportRequest.type === 'LENDOUT') {
-    field.lendStaffPhone = '借阅人员电话'
-    field.state = '状态'
-    field.returnTime = '归还时间'
+    bah: "住院号",
+    times: "住院次数",
+    patName: "患者姓名",
+    admissDate: "入院时间",
+    disDate: "出院时间",
+    disDept: "出院科室",
+    doctor: "管床医生",
+    visitStaff: label + "人员",
+    opTime: label + "时间",
+    remark: "备注",
+    opStaff: "病案管理员",
+  };
+  if (exportRequest.type === "LENDOUT") {
+    field.lendStaffPhone = "借阅人员电话";
+    field.state = "状态";
+    field.returnTime = "归还时间";
   }
-  return field
+  return field;
 }
 
 function getLabel() {
   switch (exportRequest.type) {
-    case 'DUPLICATE':
-      return '复印'
-    case 'CLOSEDOWN':
-      return '封存'
-    case 'LENDOUT':
-      return '借阅'
-    default :
-      return ''
+    case "DUPLICATE":
+      return "复印";
+    case "CLOSEDOWN":
+      return "封存";
+    case "LENDOUT":
+      return "借阅";
+    default:
+      return "";
   }
 }
 
-
+defineExpose<UseDialogType.Expose>({
+  confirm: executeExport,
+});
 </script>
 
 <style scoped>
 .input_area {
   padding: 8px 24px 0 24px;
 }
+
 .mg-btm {
   margin-bottom: 16px;
 }
-</style>
+</style>

+ 76 - 71
src/components/zhu-yuan-yi-sheng/emr/auxiliary-tools/EmrInspect.vue

@@ -3,19 +3,17 @@
     <template #header>
       <CyFlex>
         <template #header>
-          <div style="padding: 5px ">
-            <ElInputNumber
-                @change="querySearch"
-                v-model="admissTimes"/>
-            <el-divider direction="vertical"/>
+          <div style="padding: 5px">
+            <ElInputNumber @change="querySearch" v-model="admissTimes" />
+            <el-divider direction="vertical" />
             <el-button type="primary" @click="openPatientImage(patNo)">
               影像
             </el-button>
           </div>
         </template>
         <CyVxeTable>
-          <vxe-column title="日期" field="checkTime" width="135"/>
-          <vxe-column title="名称" field="orderName" width="220"/>
+          <vxe-column title="日期" field="checkTime" width="135" />
+          <vxe-column title="名称" field="orderName" width="220" />
         </CyVxeTable>
       </CyFlex>
     </template>
@@ -24,10 +22,20 @@
         {{ rowData.orderName }}
       </el-form-item>
       <el-form-item label="检查所见:">
-        <el-input type="textarea" rows="15" readonly v-model="rowData.examinationSee"/>
+        <el-input
+          type="textarea"
+          rows="15"
+          readonly
+          v-model="rowData.examinationSee"
+        />
       </el-form-item>
       <el-form-item label="诊断意见:">
-        <el-input type="textarea" rows="5" readonly v-model="rowData.examinationreSult"/>
+        <el-input
+          type="textarea"
+          rows="5"
+          readonly
+          v-model="rowData.examinationreSult"
+        />
       </el-form-item>
       <el-form-item label="报告医生:">
         {{ rowData?.doctorName }}
@@ -42,13 +50,9 @@
         {{ rowData?.checkTime }}
       </el-form-item>
       <el-form-item label="">
-        <div style="text-align: right;width: 100%">
-          <el-button type="primary"
-                     @click="copyClick">
-            复制
-          </el-button>
-          <el-button type="warning"
-                     @click="copyAndPasteClick">
+        <div style="text-align: right; width: 100%">
+          <el-button type="primary" @click="copyClick"> 复制 </el-button>
+          <el-button type="warning" @click="copyAndPasteClick">
             复制并粘贴
           </el-button>
         </div>
@@ -58,37 +62,37 @@
 </template>
 
 <script setup lang="ts">
-import {ref} from "vue";
+import { ref } from "vue";
 import {
   copyAsDataSource,
-  emrMitt
+  emrMitt,
 } from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/emr-init";
 import CyFlex from "@/components/cy/flex/src/CyFlex.vue";
 import useVxeTable from "@/utils/cy-use/useVxeTable";
-import {magicApi} from "@/utils/database/magic-api-request";
-import {ElInputNumber} from "element-plus";
-import {openPatientImage} from "@/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng";
+import { magicApi } from "@/utils/database/magic-api-request";
+import { ElInputNumber } from "element-plus";
+import { openPatientImage } from "@/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng";
 
 const props = defineProps({
   patNo: String,
-  times: Number
-})
+  times: Number,
+});
 
-const emits = defineEmits(['close'])
+const emits = defineEmits(["close"]);
 
 type JcType = {
-  orderName: string,
-  examinationSee: string,
-  examinationreSult: string,
-  checkTime: string,
-  reportTime: string,
-  doctorCode: string,
-  doctorName: string,
-  checkDoctorCode: string,
-  checkDoctorName: string
-  patientUid: string
-  orderType: string
-}
+  orderName: string;
+  examinationSee: string;
+  examinationreSult: string;
+  checkTime: string;
+  reportTime: string;
+  doctorCode: string;
+  doctorName: string;
+  checkDoctorCode: string;
+  checkDoctorName: string;
+  patientUid: string;
+  orderType: string;
+};
 
 const rowData = ref<JcType>({
   checkDoctorCode: "",
@@ -101,59 +105,60 @@ const rowData = ref<JcType>({
   orderName: "",
   orderType: "",
   patientUid: "",
-  reportTime: ""
-})
+  reportTime: "",
+});
 
-const admissTimes = ref<number>(props.times ?? 0)
+const admissTimes = ref<number>(props.times ?? 0);
 
-const {CyVxeTable, querySearch} = useVxeTable<JcType>({
-  keyField: 'patientUid',
+const { CyVxeTable, querySearch } = useVxeTable<JcType>({
+  keyField: "patientUid",
   mountedQuery: true,
-  remoteSearch: () => magicApi({
-    method: 'get',
-    url: '/intergration/jyjc/checkTheCallbacks',
-    params: {patNo: props.patNo, times: admissTimes.value}
-  }),
+  remoteSearch: () =>
+    magicApi({
+      method: "get",
+      url: "/intergration/jyjc/checkTheCallbacks",
+      params: { patNo: props.patNo, times: admissTimes.value },
+    }),
   tableProps: {
-    onCellClick: ({row}) => rowData.value = row
-  }
-})
+    onCellClick: ({ row }) => (rowData.value = row),
+  },
+});
 
 const orderType = {
-  'type_08': 'CT检查结果',
-  'type_26': '磁共振检查结果'
-}
+  type_08: "CT检查结果",
+  type_26: "磁共振检查结果",
+};
 
 function assemblyData() {
-  let data: {}
-  const key = 'type_' + rowData.value.orderType
+  let data: {};
+  const key = "type_" + rowData.value.orderType;
   if (orderType[key]) {
-    data = copyAsDataSource(rowData.value.examinationSee, orderType[key])
+    data = copyAsDataSource(rowData.value.examinationSee, orderType[key]);
   } else {
     data = {
-      type: 'text',
-      data: rowData.value.examinationSee
-    }
+      type: "text",
+      data: rowData.value.examinationSee,
+    };
   }
-  return data
+  return data;
 }
 
 function copyClick() {
   window.localStorage.setItem(
-      "clipBoardData",
-      JSON.stringify({
-        content: [assemblyData()],
-        plainText: "带有数据源,请不要使用(文本)粘贴。"
-      })
-  )
+    "clipBoardData",
+    JSON.stringify({
+      content: [assemblyData()],
+      plainText: "带有数据源,请不要使用(文本)粘贴。",
+    })
+  );
 }
 
 function copyAndPasteClick() {
-  copyClick()
-  const edit = emrMitt.emit('editor')
-  edit?.execute('insertContents', {
-    value: [assemblyData()]
-  })
-  emits('close')
+  copyClick();
+  const edit = emrMitt.emit("editor");
+  edit?.execute("insertContents", {
+    value: [assemblyData()],
+  });
+  emits("close");
 }
 </script>

+ 116 - 91
src/components/zhu-yuan-yi-sheng/emr/auxiliary-tools/EmrTestV2/BacterialCultureTable.vue

@@ -1,143 +1,167 @@
 <script setup lang="ts">
-import {useCompRef} from "@/utils/useCompRef";
-import {ElTable} from "element-plus";
-import {computed, ref} from "vue";
-import {
-  copyAsDataSource
-} from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/emr-init";
-
-const tableRef = useCompRef(ElTable)
+import { useCompRef } from "@/utils/useCompRef";
+import { ElTable } from "element-plus";
+import { computed, ref } from "vue";
+import { copyAsDataSource } from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/emr-init";
+import { isArray } from "xe-utils";
+
+const tableRef = useCompRef(ElTable);
 const data = ref<{
-  bacterias?: any[]
-  items?: []
-}>({})
+  bacterias?: any[];
+  items?: [];
+}>({});
 
 const selectedData = () => {
   const temp = tableRef.value.getSelectionRows() as any[];
-  let data = []
+  let data = [];
 
   if (temp) {
     temp.forEach(item => {
-      data.push(copyAsDataSource(`${item.itm_name}:${item.rslt_strs}${item.bac_name_cn}`, '细菌培养结果'))
-    })
+      data.push(
+        copyAsDataSource(
+          `${item.itm_name}:${item.rslt_strs}${item.bac_name_cn}`,
+          "细菌培养结果"
+        )
+      );
+    });
   }
 
   if (withResults.value) {
     antiMap.forEach((value, key, map) => {
       data.push({
-        type: 'text',
-        data: getSubtableSelectData(key)
-      })
-    })
+        type: "text",
+        data: getSubtableSelectData(key),
+      });
+    });
   }
 
-  return data
-}
+  return data;
+};
 
 declare type antiList = {
-  anti_name_cn: string
-  anti_abb: string
-  anti_mic: string
-  anti_str: string
-}
+  anti_name_cn: string;
+  anti_abb: string;
+  anti_mic: string;
+  anti_str: string;
+};
 
-const antiMap = new Map<string, antiList[]>()
+const antiMap = new Map<string, antiList[]>();
 
 const antiSelectChange = (row, index) => {
-  antiMap.set('table' + index, row)
-}
+  antiMap.set("table" + index, row);
+};
 
-const getSubtableSelectData = (key) => {
-  let data = ''
-  const t = table[key]
+const getSubtableSelectData = key => {
+  let data = "";
+  const t = table[key];
   const temp = t.getSelectionRows() as any[];
-  if (!temp) return data
+  if (!temp) return data;
 
   temp.forEach(item => {
-    const {anti_name_cn, anti_abb, anti_mic, anti_str} = item
-    data += `${anti_name_cn}${anti_abb}${anti_mic}${anti_str},`
-  })
-
-  return data
-}
-
-const withResults = ref<boolean>(false)
-const title = ref('')
-
-const setData = (val) => {
-  antiMap.clear()
-  table = {}
-  data.value = val
-  withResults.value = val.bacterias.length > 0
-  title.value = withResults.value ? '有培养结果,又有细菌鉴定结果' : '有培养结果,但无细菌鉴定结果'
-}
+    const { anti_name_cn, anti_abb, anti_mic, anti_str } = item;
+    data += `${anti_name_cn}${anti_abb}${anti_mic}${anti_str},`;
+  });
+
+  return data;
+};
+
+const withResults = ref<boolean>(false);
+const title = ref("");
+
+const setData = val => {
+  antiMap.clear();
+  table = {};
+  data.value = val;
+  withResults.value = val.bacterias.length > 0;
+  title.value = withResults.value
+    ? "有培养结果,又有细菌鉴定结果"
+    : "有培养结果,但无细菌鉴定结果";
+};
 
 const tempData = computed(() => {
-  return withResults.value ? data.value.bacterias : data.value.items
-})
+  if (isArray(data.value.items) && data.value.items.length > 0) {
+    const tmp =
+      isArray(data.value.bacterias) && data.value.bacterias.length > 0
+        ? data.value.bacterias
+        : [];
+
+    const items = data.value.items.map((item, index) => {
+      return {
+        itm_name: item.itm_name,
+        bac_name_cn: item.rslt_strs || item.itm_str_value,
+      };
+    });
+
+    return [...items, ...tmp];
+  }
+
+  return withResults.value ? data.value.bacterias : data.value.items;
+});
 
-const rowClick = (row) => {
-  const temp = tableRef.value.getSelectionRows()
-  tableRef.value.toggleRowSelection(row, !temp.includes(row))
-}
+const rowClick = row => {
+  const temp = tableRef.value.getSelectionRows();
+  tableRef.value.toggleRowSelection(row, !temp.includes(row));
+};
 
 const subtableClick = (row, index) => {
-  const t = table['table' + index]
-  const temp = t.getSelectionRows()
-  t.toggleRowSelection(row, !temp.includes(row))
-}
+  const t = table["table" + index];
+  const temp = t.getSelectionRows();
+  t.toggleRowSelection(row, !temp.includes(row));
+};
 
-let table = {}
+let table = {};
 const setTableRef = (el, index) => {
-  table['table' + index] = el
-}
+  table["table" + index] = el;
+};
 
 const getSelectedStr = (): string => {
-  let data = ''
+  let data = "";
   const temp = tableRef.value.getSelectionRows() as any[];
   if (temp) {
     temp.forEach(item => {
-      data += `${item.itm_name}:${item.rslt_strs}${item.bac_name_cn || ''}`
-    })
+      data += `${item.itm_name}:${item.rslt_strs}${item.bac_name_cn || ""}`;
+    });
   }
 
   if (withResults.value) {
     antiMap.forEach((value, key) => {
       data += getSubtableSelectData(key);
-    })
+    });
   }
-  return data
-}
-
+  return data;
+};
 
 defineExpose({
   selectedData,
   setData,
-  getSelectedStr
-})
+  getSelectedStr,
+});
 </script>
 
 <template>
-  <el-alert :title="title" show-icon type="info" effect="dark"/>
+  <el-alert :title="title" show-icon type="info" effect="dark" />
   <el-table
-      ref="tableRef"
-      row-key="itm_id"
-      @row-click="rowClick"
-      default-expand-all
-      :data="tempData">
+    ref="tableRef"
+    row-key="itm_id"
+    @row-click="rowClick"
+    default-expand-all
+    :data="tempData"
+  >
     <template v-if="withResults">
       <el-table-column type="selection" width="35"></el-table-column>
       <el-table-column type="expand">
-        <template #default="{row,$index}">
-          <el-table :data="row.anti_list"
-                    @selectionChange="(value) => antiSelectChange( value, $index)"
-                    @row-click="(subtableRow) => subtableClick(subtableRow , $index)"
-                    :ref="(el) => setTableRef(el,$index)">
+        <template #default="{ row, $index }">
+          <el-table
+            :data="row.anti_list"
+            @selectionChange="value => antiSelectChange(value, $index)"
+            @row-click="subtableRow => subtableClick(subtableRow, $index)"
+            :ref="el => setTableRef(el, $index)"
+          >
             <el-table-column type="selection" width="35"></el-table-column>
-            <el-table-column label="抗菌药物" prop="anti_name_cn"/>
-            <el-table-column label="抗菌药物编码" prop="anti_abb"/>
-            <el-table-column label="MIC值" prop="anti_mic"/>
-            <el-table-column label="敏感性" prop="anti_str"/>
+            <el-table-column label="抗菌药物" prop="anti_name_cn" />
+            <el-table-column label="抗菌药物编码" prop="anti_abb" />
+            <el-table-column label="MIC值" prop="anti_mic" />
+            <el-table-column label="敏感性" prop="anti_str" />
           </el-table>
         </template>
       </el-table-column>
@@ -148,12 +172,13 @@ defineExpose({
     <template v-else>
       <el-table-column type="selection"></el-table-column>
       <el-table-column label="名称" prop="itm_name"></el-table-column>
-      <el-table-column label="结果" prop="rslt_strs"></el-table-column>
+      <el-table-column label="结果">
+        <template #default="{ row }">
+          {{ row.rslt_strs || row.itm_str_value }}
+        </template>
+      </el-table-column>
     </template>
-
   </el-table>
 </template>
 
-<style scoped lang="scss">
-
-</style>
+<style scoped lang="scss"></style>

+ 62 - 64
src/components/zhu-yuan-yi-sheng/emr/auxiliary-tools/NreTable.vue

@@ -1,83 +1,84 @@
 <template>
   <CyFlex>
     <template #header>
-      <ElInput v-model="patientIpid" placeholder="住院门诊号" style="width: 120px" clearable/>
+      <ElInput
+        v-model="patientIpid"
+        placeholder="住院门诊号"
+        style="width: 120px"
+        clearable
+      />
       评估日期:
-      <CyDateRange/>
+      <CyDateRange />
       评估类型:
-      <ElSelect v-model="type" style="margin:0  5px; width: 120px">
-        <xc-el-option :data="typeList"/>
+      <ElSelect v-model="type" style="margin: 0 5px; width: 120px">
+        <xc-el-option :data="typeList" />
       </ElSelect>
-      <ElButton type="primary" @click="querySearch">
-        查询
-      </ElButton>
+      <ElButton type="primary" @click="querySearch"> 查询 </ElButton>
     </template>
     <CyVxeTable>
-      <vxe-column
-          v-for="item in columns"
-          v-bind="item"
-      />
+      <vxe-column v-for="item in columns" v-bind="item" />
       <vxe-column fixed="right" title="操作" width="140">
-        <template #default="{row}">
+        <template #default="{ row }">
           <el-button @click="detailClick(row)">详情</el-button>
-          <el-button @click="quoteClick(row)" v-if="props.quote">引用</el-button>
+          <el-button @click="quoteClick(row)" v-if="props.quote"
+            >引用</el-button
+          >
         </template>
       </vxe-column>
     </CyVxeTable>
 
-    <CyDialog title="详情" body-width="60%" v-if="detail.dialog" @closed="closed">
+    <el-dialog v-model="detail.dialog" destroy-on-close width="60%">
       <div class="layout_h-w_max layout_overflow_auto">
         <el-form label-width="220px">
           <el-form-item
-              v-for="item in columns"
-              :label="item.title + ':'"
-              :prop="item.field"
+            v-for="item in columns"
+            :label="item.title + ':'"
+            :prop="item.field"
           >
             {{ detail.row[item.field] }}
           </el-form-item>
         </el-form>
       </div>
-    </CyDialog>
+    </el-dialog>
   </CyFlex>
 </template>
 <script setup lang="tsx">
 import CyFlex from "@/components/cy/flex/src/CyFlex.vue";
 import useDateRange from "@/utils/cy-use/useDateRange";
-import {ElButton, ElSelect, ElForm, ElFormItem, ElInput} from "element-plus";
-import {reactive, ref} from "vue";
+import { ElButton, ElSelect, ElForm, ElFormItem, ElInput } from "element-plus";
+import { reactive, ref } from "vue";
 import XcElOption from "@/components/xiao-chan/xc-el-option/XcElOption.vue";
-import UseVxeTable, {PageQuery} from "@/utils/cy-use/useVxeTable";
-import {magicApi} from "@/utils/database/magic-api-request";
-import CyDialog from "@/components/cy/dialog/src/CyDialog.vue";
+import UseVxeTable, { PageQuery } from "@/utils/cy-use/useVxeTable";
+import { magicApi } from "@/utils/database/magic-api-request";
 import XEUtils from "xe-utils";
 
 const props = defineProps({
   patNo: String,
   quote: Function,
-  defaultValue: Array
-})
+  defaultValue: Array,
+});
 
-const {CyDateRange, dateRange} = useDateRange({
-  modelDefaultValues: props.defaultValue
+const { CyDateRange, dateRange } = useDateRange({
+  modelDefaultValues: props.defaultValue,
 });
-const type = ref('screening')
-const patientIpid = ref(props.patNo)
+const type = ref("screening");
+const patientIpid = ref(props.patNo);
 const detail = reactive({
   dialog: false,
-  row: {}
-})
+  row: {},
+});
 const typeList = [
-  {code: 'screening', name: '筛查结果'},
-  {code: 'assessment', name: '评估结果'},
-  {code: 'diagnosis', name: '诊断结果'},
-  {code: 'consultation', name: '会诊结果'},
-]
+  { code: "screening", name: "筛查结果" },
+  { code: "assessment", name: "评估结果" },
+  { code: "diagnosis", name: "诊断结果" },
+  { code: "consultation", name: "会诊结果" },
+];
 
-const columns = ref([])
-let dataNameMapping = {}
+const columns = ref([]);
+let dataNameMapping = {};
 
-const {CyVxeTable, querySearch} = UseVxeTable({
-  keyField: 'id',
+const { CyVxeTable, querySearch } = UseVxeTable({
+  keyField: "id",
   showPage: true,
   mountedQuery: true,
   getQueryParams: () => {
@@ -86,45 +87,42 @@ const {CyVxeTable, querySearch} = UseVxeTable({
       endTime: dateRange.value.end,
       patientHospitalNumber: patientIpid.value,
       patientIpid: patientIpid.value,
-      type: type.value
-    }
+      type: type.value,
+    };
   },
-  remoteSearch: async ({currentPage, pageSize, ...val}: PageQuery) => {
+  remoteSearch: async ({ currentPage, pageSize, ...val }: PageQuery) => {
     return await magicApi({
-      method: 'post',
-      url: '/intergration/nrsApi',
+      method: "post",
+      url: "/intergration/nrsApi",
       data: {
         size: pageSize,
         curren: currentPage,
-        ...val
-      }
-    }).then(({total, result, ...res}) => {
-      columns.value = res.columns
-      dataNameMapping = res.dataNameMapping
-      return {total, result}
-    })
-  }
-})
+        ...val,
+      },
+    }).then(({ total, result, ...res }) => {
+      columns.value = res.columns;
+      dataNameMapping = res.dataNameMapping;
+      return { total, result };
+    });
+  },
+});
 
 function detailClick(row) {
-  detail.dialog = true
-  detail.row = row
+  detail.dialog = true;
+  detail.row = row;
 }
 
-
 function closed() {
-  detail.dialog = false
+  detail.dialog = false;
 }
 
 function quoteClick(row) {
-  const data = {}
+  const data = {};
 
   XEUtils.objectEach(dataNameMapping, (item, key, obj) => {
-    data[item] = row[key]
-  })
+    data[item] = row[key];
+  });
 
-  props?.quote(data)
+  props?.quote(data);
 }
-
-
 </script>

+ 60 - 53
src/views/data-base/page-editor-help-v2/components/PageHelpTable.vue

@@ -3,93 +3,100 @@
 </template>
 
 <script setup lang="tsx">
-import {ComputedRef} from "vue";
-import {PageHelpTableName, PageStore} from "@/views/data-base/page-editor-help-v2/page-help-v2";
+import { ComputedRef } from "vue";
+import {
+  PageHelpTableName,
+  PageStore,
+} from "@/views/data-base/page-editor-help-v2/page-help-v2";
 import XEUtils from "xe-utils";
-import {VxeGridProps} from 'vxe-table'
-import {VxeGridPropTypes, VxeGridSlots} from "vxe-pc-ui/types/components/grid";
-import {ElInput} from 'element-plus'
-import {VxeColumnProps} from "vxe-pc-ui/types/components/column";
+import { VxeGridProps } from "vxe-table";
+import {
+  VxeGridPropTypes,
+  VxeGridSlots,
+} from "vxe-pc-ui/types/components/grid";
+import { ElInput } from "element-plus";
+import { VxeColumnProps } from "vxe-pc-ui/types/components/column";
 
 type ColumnsType = {
   slots: {
-    [key: string]: string
-  }
-} & VxeColumnProps
+    [key: string]: string;
+  };
+} & VxeColumnProps;
 
 const props = defineProps<{
   data: any[];
   columns: ColumnsType[];
-  store: PageStore,
-  tableRefName: PageHelpTableName,
-  tableBind: any,
-  getSlotsData: (row: string, rowIndex: number, code: string) => any
-}>()
+  store: PageStore;
+  tableRefName: PageHelpTableName;
+  tableBind: any;
+  getSlotsData: (row: string, rowIndex: number, code: string) => any;
+}>();
 
-type VxeTableSlots = VxeGridSlots[string]
+type VxeTableSlots = VxeGridSlots[string];
 
 function handleSlots(slots: any, tmp: any) {
   for (let key in slots) {
-    (tmp.slots[key] as VxeTableSlots) = ({row, rowIndex}) => {
-      const code = slots[key]
-      return props.getSlotsData(row, rowIndex, code)
-    }
+    (tmp.slots[key] as VxeTableSlots) = ({ row, rowIndex }) => {
+      const code = slots[key];
+      return props.getSlotsData(row, rowIndex, code);
+    };
   }
 }
 
-const columnBindComputed: ComputedRef<VxeGridPropTypes.Columns> = computed(() => {
-  return XEUtils.eachAndReturnList(props!.columns, (item, index) => {
-    const {slots, ...temp} = item
+const columnBindComputed: ComputedRef<VxeGridPropTypes.Columns> = computed(
+  () => {
+    return XEUtils.eachAndReturnList(props!.columns, (item, index) => {
+      const { slots, ...temp } = item;
 
-    let tmp: any = {...temp, slots: {}}
-    if (props.store?.props.isEditor) {
-      tmp.slots.header = () => {
-        return <ElInput
-            modelValue={props?.columns[index]?.title}
-            onUpdate:modelValue={(value) => {
-              props.columns[index].title = value
-            }}
-            onFocus={() => handleFocus(props.columns[index]!.field)}
-        />
+      let tmp: any = { ...temp, slots: {} };
+      if (props.store?.props.isEditor) {
+        tmp.slots.header = () => {
+          return (
+            <ElInput
+              modelValue={props?.columns[index]?.title}
+              onUpdate:modelValue={value => {
+                props.columns[index].title = value;
+              }}
+              onFocus={() => handleFocus(props.columns[index]!.field)}
+            />
+          );
+        };
       }
-    }
-    handleSlots(slots, tmp)
-    return tmp
-  });
-
-})
+      handleSlots(slots, tmp);
+      return tmp;
+    });
+  }
+);
 
 const tableGridComputed = computed(() => {
   return {
     data: props.data,
     columns: columnBindComputed.value,
     exportConfig: {},
-    height: 'auto',
+    height: "auto",
     autoResize: true,
     syncResize: false,
-    columnConfig: {resizable: true},
+    columnConfig: { resizable: true },
     style: {
-      width: '100%',
+      width: "100%",
     },
-    rowConfig: {height: 48, isCurrent: true, isHover: true, useKey: true},
-    scrollX: {enabled: false},
-    scrollY: {gt: 0, enabled: true},
+    rowConfig: { height: 48, isCurrent: true, isHover: true, useKey: true },
+    scrollX: { enabled: false },
+    scrollY: { gt: 0, enabled: true },
     showOverflow: true,
-    ...props.tableBind
-  } as VxeGridProps
-})
+    ...props.tableBind,
+  } as VxeGridProps;
+});
 
 function setMainTableRef(el: any) {
-  if (typeof props.store !== 'undefined') {
-    props.store[props.tableRefName].value = el
+  if (typeof props.store !== "undefined") {
+    props.store[props.tableRefName].value = el;
   }
 }
 
 function handleFocus(field: string | undefined) {
-  if (typeof props.store !== 'undefined') {
-    props.store!.mainTableRef.value.scrollToColumn(field)
+  if (typeof props.store !== "undefined") {
+    props.store!.mainTableRef.value.scrollToColumn(field);
   }
 }
-
 </script>
-

+ 231 - 167
src/views/data-base/page-editor-help-v2/components/page-editor-v2/PageFormBind.vue

@@ -3,65 +3,75 @@ import {
   capitalizeFirstLetter,
   ComponentBind,
   ElAndXc,
-  PageStore
+  PageStore,
 } from "@/views/data-base/page-editor-help-v2/page-help-v2";
 import * as vue from "vue";
-import {h, nextTick, onMounted, ref, computed, Ref} from "vue";
-import {ElButton, ElDivider, ElInput, ElInputNumber, ElOption, ElSelect, ElSwitch} from "element-plus";
-import {PageHeader} from "@/api/reports/report-query-center";
-import {xcMessage} from "@/utils/xiaochan-element-plus";
+import { h, nextTick, onMounted, ref, computed, Ref } from "vue";
+import {
+  ElButton,
+  ElDivider,
+  ElInput,
+  ElInputNumber,
+  ElOption,
+  ElSelect,
+  ElSwitch,
+} from "element-plus";
+import { PageHeader } from "@/api/reports/report-query-center";
+import { xcMessage } from "@/utils/xiaochan-element-plus";
 import XEUtils from "xe-utils";
-import {copyStrFunc} from "@/utils/public";
-import {reportQueryCenterApi} from "@/api/base-data/report-center";
-import PageHelpOtherConfigurations
-  from "@/views/data-base/page-editor-help-v2/components/page-editor-v2/PageHelpOtherConfigurations.vue";
-import {CyCodeEditorDialog, CyJsonEditorDialog} from "@/components/cy/cy-monaco-editor/CyMonacoEditor";
-import {useUserStore} from "@/pinia/user-store";
+import { copyStrFunc } from "@/utils/public";
+import { reportQueryCenterApi } from "@/api/base-data/report-center";
+import PageHelpOtherConfigurations from "@/views/data-base/page-editor-help-v2/components/page-editor-v2/PageHelpOtherConfigurations.vue";
+import {
+  CyCodeEditorDialog,
+  CyJsonEditorDialog,
+} from "@/components/cy/cy-monaco-editor/CyMonacoEditor";
+import { useUserStore } from "@/pinia/user-store";
 
-const showDiv = ref(false)
-const componentBinds = ref<{ [key: string]: ComponentBind } | null>()
+const showDiv = ref(false);
+const componentBinds = ref<{ [key: string]: ComponentBind } | null>();
 
 const props = defineProps<{
   teleportDiv: any;
-  store: PageStore
-}>()
+  store: PageStore;
+}>();
 
-const userStore = useUserStore()
-const emits = defineEmits(['refresh', 'requiredChange'])
+const userStore = useUserStore();
+const emits = defineEmits(["refresh", "requiredChange"]);
 
-const tmpKey = ref('')
+const tmpKey = ref("");
 
 function handelKeyBlur() {
-  const {pageData} = props.store
+  const { pageData } = props.store;
 
-  pageData.value.params[tmpKey.value] = pageData.value.params[currentItem.value.key]
-  pageData.value.paramsDefaultValue[tmpKey.value] = pageData.value.paramsDefaultValue[currentItem.value.key]
-  currentItem.value.key = tmpKey.value
+  pageData.value.params[tmpKey.value] =
+    pageData.value.params[currentItem.value.key];
+  pageData.value.paramsDefaultValue[tmpKey.value] =
+    pageData.value.paramsDefaultValue[currentItem.value.key];
+  currentItem.value.key = tmpKey.value;
 
-  const keys = XEUtils.eachAndReturnList(pageData.value.header, (item) => {
-    return item.key
-  })
+  const keys = XEUtils.eachAndReturnList(pageData.value.header, item => {
+    return item.key;
+  });
 
-  clearOtherKeys(keys, pageData.value.params)
-  clearOtherKeys(keys, pageData.value.paramsDefaultValue)
+  clearOtherKeys(keys, pageData.value.params);
+  clearOtherKeys(keys, pageData.value.paramsDefaultValue);
 }
 
 function clearOtherKeys(keys: string[], params: {}) {
-
-  const tmp = Object.keys(params)
+  const tmp = Object.keys(params);
 
   const clearKey: string[] = [];
   tmp.forEach(item => {
     if (!keys.includes(item)) {
-      clearKey.push(item)
+      clearKey.push(item);
     }
-  })
+  });
 
   clearKey.forEach(item => {
     //@ts-ignore
-    delete params[item]
-  })
-
+    delete params[item];
+  });
 }
 
 const currentItem = ref<PageHeader>({
@@ -74,78 +84,100 @@ const currentItem = ref<PageHeader>({
   required: false,
   bind: {},
   on: {
-    mounted: ""
+    mounted: "",
   },
   func: {},
   selectOptions: [],
-  apiPath: ""
-})
+  apiPath: "",
+});
 
-let onFunc = {}
-const renderRef = ref('')
-const formOnFunc = ref(null)
-const formFunc = ref(null)
+let onFunc = {};
+const renderRef = ref("");
+const formOnFunc = ref(null);
+const formFunc = ref(null);
 
 async function changeCurrentBind(item) {
-  const {bindData} = props.store
-  showDiv.value = false
-  onFunc = {}
-  renderRef.value = ''
-  formOnFunc.value = null
-  formFunc.value = null
+  const { bindData } = props.store;
+  showDiv.value = false;
+  onFunc = {};
+  renderRef.value = "";
+  formOnFunc.value = null;
+  formFunc.value = null;
   if (!item) {
-    componentBinds.value = null
-    return
+    componentBinds.value = null;
+    return;
   }
   if (!bindData.value[item.name]) {
-    componentBinds.value = null
+    componentBinds.value = null;
   }
-  currentItem.value = item
-  componentBinds.value = bindData.value[item.name].bind
+  currentItem.value = item;
+  componentBinds.value = bindData.value[item.name].bind;
   if (bindData.value[item.name].render) {
-    renderRef.value = bindData.value[item.name].render
+    renderRef.value = bindData.value[item.name].render;
   }
   if (bindData.value[item.name].on) {
-    formOnFunc.value = bindData.value[item.name].on
+    formOnFunc.value = bindData.value[item.name].on;
   }
   if (bindData.value[item.name].func) {
-    formFunc.value = bindData.value[item.name].func
+    formFunc.value = bindData.value[item.name].func;
   }
-  onFuncHelp()
-  tmpKey.value = currentItem.value.key
-  await nextTick()
-  showDiv.value = true
+  onFuncHelp();
+  tmpKey.value = currentItem.value.key;
+  await nextTick();
+  showDiv.value = true;
 }
 
 /**
  * 组件属性的额外配置
  */
 function renderHelp() {
-  const {currentClickIndex, pageData} = props.store
-  const func = new Function("pageJson", "currentBind", "el", "vue", 'xcMessage', renderRef.value)
-  return func(props.store.pageData.value, pageData.value.header[currentClickIndex.value], ElAndXc, vue, xcMessage)
+  const { currentClickIndex, pageData } = props.store;
+  const func = new Function(
+    "pageJson",
+    "currentBind",
+    "el",
+    "vue",
+    "xcMessage",
+    renderRef.value
+  );
+  return func(
+    props.store.pageData.value,
+    pageData.value.header[currentClickIndex.value],
+    ElAndXc,
+    vue,
+    xcMessage
+  );
 }
 
 /**
  * 绑定组件属性的 事件
  */
 function onFuncHelp() {
-  const {currentClickIndex, pageData} = props.store
+  const { currentClickIndex, pageData } = props.store;
   for (let key in componentBinds.value) {
-    const item = componentBinds.value[key]
-    const func = {}
+    const item = componentBinds.value[key];
+    const func = {};
     if (item.on) {
       for (let itemKey in item.on) {
-        func[capitalizeFirstLetter(itemKey, 'on')] = (val) => {
-          const func = new Function("pageJson", "currentBind", "val", item.on[itemKey])
+        func[capitalizeFirstLetter(itemKey, "on")] = val => {
+          const func = new Function(
+            "pageJson",
+            "currentBind",
+            "val",
+            item.on[itemKey]
+          );
           try {
-            func(pageData.value, pageData.value.header[currentClickIndex.value], val)
+            func(
+              pageData.value,
+              pageData.value.header[currentClickIndex.value],
+              val
+            );
           } catch (e) {
-            console.error(e)
+            console.error(e);
           }
-        }
+        };
       }
-      onFunc[key] = func
+      onFunc[key] = func;
     }
   }
 }
@@ -153,178 +185,195 @@ function onFuncHelp() {
 function render(key: string, item: ComponentBind) {
   function getFunc() {
     if (onFunc[key]) {
-      return onFunc[key]
+      return onFunc[key];
     }
-    return {}
+    return {};
   }
 
   const vModel = {
     modelValue: currentItem.value.bind[key],
     "onUpdate:modelValue": (value: any) => {
-      currentItem.value.bind[key] = value
+      currentItem.value.bind[key] = value;
     },
-    ...getFunc()
-  }
+    ...getFunc(),
+  };
 
   function selectRender() {
-    const child: any[] = []
+    const child: any[] = [];
     item.selectData?.forEach(value => {
       //@ts-ignore
-      child.push(h(ElOption, {label: value, value: value}, () => null))
-    })
-    return h(ElSelect, {...vModel}, () => child)
+      child.push(h(ElOption, { label: value, value: value }, () => null));
+    });
+    return h(ElSelect, { ...vModel }, () => child);
   }
 
   function booleanRender() {
     return h(ElSwitch, {
       activeValue: true,
       inactiveValue: false,
-      ...vModel
-    })
+      ...vModel,
+    });
   }
 
   function inputRender() {
     return h(ElInput, {
-      ...vModel
-    })
+      ...vModel,
+    });
   }
 
   function numberRender() {
-    return h(ElInputNumber, {...vModel})
+    return h(ElInputNumber, { ...vModel });
   }
 
-  if (item.renderName === 'json') {
-    return h(ElButton, {
-      type: 'info',
-      text: true,
-      icon: 'Edit',
-      onClick: () => {
-        CyJsonEditorDialog(currentItem.value?.bind[key], null).then(res => {
-          currentItem.value!.bind[key] = res.json
-        })
-      }
-    }, () => '编写JSON对象')
+  if (item.renderName === "json") {
+    return h(
+      ElButton,
+      {
+        type: "info",
+        text: true,
+        icon: "Edit",
+        onClick: () => {
+          CyJsonEditorDialog(currentItem.value?.bind[key]).then(res => {
+            currentItem.value!.bind[key] = res.json;
+          });
+        },
+      },
+      () => "编写JSON对象"
+    );
   }
 
-  if (item.renderName === 'select') {
-    return selectRender()
+  if (item.renderName === "select") {
+    return selectRender();
   }
-  if (item.renderName === 'boolean') {
-    return booleanRender()
+  if (item.renderName === "boolean") {
+    return booleanRender();
   }
-  if (item.renderName === 'input') {
-    return inputRender()
+  if (item.renderName === "input") {
+    return inputRender();
   }
 
-  if (item.renderName === 'number') {
-    return numberRender()
+  if (item.renderName === "number") {
+    return numberRender();
   }
 }
 
-const AsyncFunction = Object.getPrototypeOf(async function () {
-}).constructor;
+const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor;
 
-function handleClickEdit(key: string, value: any, name: 'on' | 'func') {
-  const {currentClickIndex, pageData} = props.store
-  currentItem.value = pageData.value.header[currentClickIndex.value]
+function handleClickEdit(key: string, value: any, name: "on" | "func") {
+  const { currentClickIndex, pageData } = props.store;
+  currentItem.value = pageData.value.header[currentClickIndex.value];
 
   if (!currentItem.value[name]) {
     // @ts-ignore
-    currentItem.value[name] = {}
+    currentItem.value[name] = {};
   }
   // @ts-ignore
   if (!currentItem.value[name][key]) {
     // @ts-ignore
-    currentItem.value[name][key] = ''
+    currentItem.value[name][key] = "";
   }
 
   CyCodeEditorDialog({
-        // @ts-ignore
-        code: currentItem.value[name][key],
-        testClick: (value, code) => {
-          const data = {
-            pageJson: pageData.value,
-            currentBind: currentItem.value,
-            userInfo: userStore.userInfo
-          }
-          const tempData = XEUtils.clone(data, true)
-          try {
-            const func = new AsyncFunction('pageJson', 'currentBind', 'apiFunc', 'val', 'userInfo', code)
-            func(tempData.pageJson, tempData.currentBind, reportQueryCenterApi, value, tempData.userInfo)
-          } catch (e) {
-            console.error(e)
-            xcMessage.error('执行失败,请检查代码')
-            return false
-          }
-          return true
-        },
-        prompt: value.prompt,
-        type: value.type
-      },
-      {
-        title: value.name
-      }
-  ).then((res: string) => {
     // @ts-ignore
-    currentItem.value[name][key] = res
-  })
+    code: currentItem.value[name][key],
+    testClick: (value, code) => {
+      const data = {
+        pageJson: pageData.value,
+        currentBind: currentItem.value,
+        userInfo: userStore.userInfo,
+      };
+      const tempData = XEUtils.clone(data, true);
+      const func = new AsyncFunction(
+        "pageJson",
+        "currentBind",
+        "apiFunc",
+        "val",
+        "userInfo",
+        code
+      );
+      func(
+        tempData.pageJson,
+        tempData.currentBind,
+        reportQueryCenterApi,
+        value,
+        tempData.userInfo
+      );
+    },
+    prompt: value.prompt,
+    type: value.type,
+  }).then((res: string) => {
+    // @ts-ignore
+    currentItem.value[name][key] = res;
+  });
 }
 
 function editStyleClick() {
   // @ts-ignore
   CyJsonEditorDialog(currentItem.value.bind.style).then(res => {
-    currentItem.value.bind.style = res.json
-  })
+    currentItem.value.bind.style = res.json;
+  });
 }
 
 function exportJSON() {
-  const temp = XEUtils.clone(currentItem.value)
-  const bind = temp.bind
+  const temp = XEUtils.clone(currentItem.value);
+  const bind = temp.bind;
   // @ts-ignore
-  delete temp.bind
+  delete temp.bind;
   const tempData = {
     bind: bind,
-    data: temp
-  }
-  copyStrFunc(JSON.stringify(tempData))
+    data: temp,
+  };
+  copyStrFunc(JSON.stringify(tempData));
 }
 
 async function refresh() {
-  props.store.bindData.value = await reportQueryCenterApi('/reportCenterOption/components/componentBind')
-  await nextTick()
+  props.store.bindData.value = await reportQueryCenterApi(
+    "/reportCenterOption/components/componentBind"
+  );
+  await nextTick();
   if (props.store.currentClickIndex.value > -1) {
-    await changeCurrentBind(props.store.pageData.value.header[props.store.currentClickIndex.value])
+    await changeCurrentBind(
+      props.store.pageData.value.header[props.store.currentClickIndex.value]
+    );
   }
 }
 
 onMounted(() => {
-  props.store.changeCurrentBind = changeCurrentBind
-  refresh()
-})
+  props.store.changeCurrentBind = changeCurrentBind;
+  refresh();
+});
 </script>
 
 <template>
   <teleport :to="props.teleportDiv">
-    <PageHelpOtherConfigurations :store="store"/>
+    <PageHelpOtherConfigurations :store="store" />
     <el-divider>组件属性</el-divider>
     <div style="text-align: left; padding: 0 15px">
-      <el-button @click="exportJSON" icon="RefreshLeft" type="primary" text>导出JSON</el-button>
-      <el-button @click="refresh" icon="RefreshLeft" type="primary" text>刷新</el-button>
+      <el-button @click="exportJSON" icon="RefreshLeft" type="primary" text
+        >导出JSON
+      </el-button>
+      <el-button @click="refresh" icon="RefreshLeft" type="primary" text
+        >刷新
+      </el-button>
     </div>
     <div v-if="componentBinds && showDiv" class="page_help-bind-container">
       <el-form label-width="120px">
         <el-divider>主要</el-divider>
         <el-form-item label="key:">
           <el-input
-              v-model="tmpKey"
-              @blur="handelKeyBlur"
-              style="width: 80px"/>
+            v-model="tmpKey"
+            @blur="handelKeyBlur"
+            style="width: 80px"
+          />
         </el-form-item>
         <el-form-item label="必填:">
-          <el-switch v-model="currentItem.required" @change="emits('requiredChange')"/>
+          <el-switch
+            v-model="currentItem.required"
+            @change="emits('requiredChange')"
+          />
         </el-form-item>
         <el-form-item label="标签:">
-          <el-input v-model="currentItem.label"/>
+          <el-input v-model="currentItem.label" />
         </el-form-item>
 
         <el-form-item label="样式">
@@ -332,23 +381,38 @@ onMounted(() => {
         </el-form-item>
 
         <el-divider>属性</el-divider>
-        <el-form-item :label="value.label + ':'" v-for="(value, key) in componentBinds">
-          <component :is="render(key, value)"/>
+        <el-form-item
+          :label="value.label + ':'"
+          v-for="(value, key) in componentBinds"
+        >
+          <component :is="render(key, value)" />
         </el-form-item>
         <template v-if="formOnFunc">
           <el-divider>事件</el-divider>
           <el-form-item v-for="(value, key) in formOnFunc" :label="value.name">
-            <el-button type="info" text icon="Edit" @click="handleClickEdit(key,value, 'on')">编写代码</el-button>
+            <el-button
+              type="info"
+              text
+              icon="Edit"
+              @click="handleClickEdit(key, value, 'on')"
+              >编写代码
+            </el-button>
           </el-form-item>
         </template>
         <template v-if="formFunc">
           <el-divider>属性函数</el-divider>
           <el-form-item v-for="(value, key) in formFunc" :label="value.name">
-            <el-button type="info" text icon="Edit" @click="handleClickEdit(key,value, 'func')">编写代码</el-button>
+            <el-button
+              type="info"
+              text
+              icon="Edit"
+              @click="handleClickEdit(key, value, 'func')"
+              >编写代码
+            </el-button>
           </el-form-item>
         </template>
       </el-form>
-      <component :is="renderHelp" v-if="renderRef"/>
+      <component :is="renderHelp" v-if="renderRef" />
     </div>
   </teleport>
 </template>
@@ -360,7 +424,7 @@ onMounted(() => {
 
   .page_help-bind-select_option {
     display: grid;
-    grid-template-columns: .4fr 1fr 1fr .3fr;
+    grid-template-columns: 0.4fr 1fr 1fr 0.3fr;
     grid-gap: 5px;
   }
 }

+ 24 - 22
src/views/data-base/page-editor-help-v2/components/page-editor-v2/PageHelpOtherConfigurations.vue

@@ -1,43 +1,47 @@
 <script setup lang="ts">
-import {copyStrFunc} from "@/utils/public";
-import {PageStore} from "@/views/data-base/page-editor-help-v2/page-help-v2";
-import {CyJsonEditorDialog} from "@/components/cy/cy-monaco-editor/CyMonacoEditor";
-import {ElButton} from "element-plus";
+import { copyStrFunc } from "@/utils/public";
+import { PageStore } from "@/views/data-base/page-editor-help-v2/page-help-v2";
+import { CyJsonEditorDialog } from "@/components/cy/cy-monaco-editor/CyMonacoEditor";
+import { ElButton } from "element-plus";
 
 const props = defineProps<{
-  store: PageStore
-}>()
+  store: PageStore;
+}>();
 
 function generateTableColumns() {
-  const {getColumns, tableBind} = props.store
-  getColumns(tableBind, 'mainTableRef');
+  const { getColumns, tableBind } = props.store;
+  getColumns(tableBind, "mainTableRef");
 }
 
 function generateQuery() {
   let str = "";
-  const length = props.store.pageData.value.header.length
+  const length = props.store.pageData.value.header.length;
   props.store.pageData.value.header.forEach((item, index) => {
-    str += `\t${item.key}${(index !== length - 1 ? "," : "")}\n`
-  })
-  str = `const {\n${str}} = body`
-  copyStrFunc(str)
+    str += `\t${item.key}${index !== length - 1 ? "," : ""}\n`;
+  });
+  str = `const {\n${str}} = body`;
+  copyStrFunc(str);
 }
 
 function saveData() {
-  props.store.handleSavaData()
+  props.store.handleSavaData();
 }
 
 function editorPageJson() {
-  CyJsonEditorDialog(props.store.pageData.value, {fullScreen: true}).then(res => {
-    props.store.mutation.setPageData(res.json)
-  })
+  CyJsonEditorDialog(props.store.pageData.value, {
+    dialogProps: {
+      title: "json编辑",
+      fullscreen: true,
+    },
+  }).then(res => {
+    props.store.mutation.setPageData(res.json);
+  });
 }
 </script>
 
 <template>
   提交地址:
-  <el-input type="textarea"
-            v-model="props.store.pageData.value.submitUrl"/>
+  <el-input type="textarea" v-model="props.store.pageData.value.submitUrl" />
   <el-button @click="generateQuery">生成查询</el-button>
   <el-button @click="generateTableColumns">生成表格列</el-button>
   <el-button @click="saveData">保存</el-button>
@@ -45,6 +49,4 @@ function editorPageJson() {
   <el-button @click="editorPageJson">编辑页面JSON对象</el-button>
 </template>
 
-<style scoped lang="scss">
-
-</style>
+<style scoped lang="scss"></style>

+ 302 - 228
src/views/data-base/page-editor-help-v2/components/page-editor-v2/PageHelpV2.vue

@@ -1,29 +1,33 @@
 <script setup lang="tsx">
-import {h, ref, onActivated, watch, onUnmounted} from "vue";
-import * as vue from 'vue'
-import {PageHeader, PageJsonObject} from "@/api/reports/report-query-center";
-import {useCompRef} from "@/utils/useCompRef";
-import {ElButton, ElForm, ElOption} from "element-plus";
+import { h, ref, onActivated, watch, onUnmounted } from "vue";
+import * as vue from "vue";
+import { PageHeader, PageJsonObject } from "@/api/reports/report-query-center";
+import { useCompRef } from "@/utils/useCompRef";
+import { ElButton, ElForm, ElOption } from "element-plus";
 import PageFormBind from "@/views/data-base/page-editor-help-v2/components/page-editor-v2/PageFormBind.vue";
-import {ArrowLeft, ArrowRight, DeleteFilled} from "@element-plus/icons-vue";
-import {reportQueryCenterApi} from "@/api/base-data/report-center";
+import { ArrowLeft, ArrowRight, DeleteFilled } from "@element-plus/icons-vue";
+import { reportQueryCenterApi } from "@/api/base-data/report-center";
 import XEUtils from "xe-utils";
-import {xcMessage} from "@/utils/xiaochan-element-plus";
+import { xcMessage } from "@/utils/xiaochan-element-plus";
 import PageAddComponent from "@/views/data-base/page-editor-help-v2/components/page-editor-v2/PageAddComponent.vue";
-import {capitalizeFirstLetter, usePageStore, ElAndXc} from "@/views/data-base/page-editor-help-v2/page-help-v2";
-import {shortcutTrigger, xcEvent} from "@/utils/xckeydown";
+import {
+  capitalizeFirstLetter,
+  usePageStore,
+  ElAndXc,
+} from "@/views/data-base/page-editor-help-v2/page-help-v2";
+import { shortcutTrigger, xcEvent } from "@/utils/xckeydown";
 import CyFlex from "@/components/cy/flex/src/CyFlex.vue";
 import PageHelpTable from "@/views/data-base/page-editor-help-v2/components/PageHelpTable.vue";
-import {useUserStore} from "@/pinia/user-store";
-import {onDeactivated} from "@vue/runtime-core";
+import { useUserStore } from "@/pinia/user-store";
+import { onDeactivated } from "@vue/runtime-core";
 
 interface Columns {
-  title: string,
-  key: string,
-  dataKey: string,
+  title: string;
+  key: string;
+  dataKey: string;
   func?: {
-    cellRenderer: string
-  }
+    cellRenderer: string;
+  };
 }
 
 const props = defineProps({
@@ -38,16 +42,16 @@ const props = defineProps({
   },
   doTest: {
     type: Function,
-    default: null
+    default: null,
   },
   isEditor: {
     type: Boolean,
-    default: false
-  }
-})
+    default: false,
+  },
+});
 
-const userStore = useUserStore()
-const store = usePageStore(props)
+const userStore = useUserStore();
+const store = usePageStore(props);
 
 const {
   currentClickIndex,
@@ -56,159 +60,168 @@ const {
   tableBind,
   handleSavaData,
   bindData,
-  mutation
-} = store
+  mutation,
+} = store;
 
-const formRef = useCompRef(ElForm)
-const headerRef = ref<HTMLDivElement>()
-const emits = defineEmits(['changeTabs'])
-const userInfo = XEUtils.clone(userStore.userInfo, true)
+const formRef = useCompRef(ElForm);
+const headerRef = ref<HTMLDivElement>();
+const emits = defineEmits(["changeTabs"]);
+const userInfo = XEUtils.clone(userStore.userInfo, true);
 
 const render = (item: PageHeader) => {
-  const modelValue = typeof pageData.value.params[item.key] === 'undefined' ? "" : pageData.value.params[item.key];
+  const modelValue =
+    typeof pageData.value.params[item.key] === "undefined"
+      ? ""
+      : pageData.value.params[item.key];
   const tempProps: {
-    [key: string]: any
+    [key: string]: any;
   } = {
     modelValue: modelValue,
     "onUpdate:modelValue": (val: any) => {
-      pageData.value.params[item.key] = val
+      pageData.value.params[item.key] = val;
     },
-    ...item.bind
-  }
+    ...item.bind,
+  };
 
   if (item.on) {
     for (const onKey in item.on) {
-      const key = capitalizeFirstLetter(onKey, 'on')
-      tempProps[key] = (...val: any) => newFunc(item, val, item.on[onKey])
+      const key = capitalizeFirstLetter(onKey, "on");
+      tempProps[key] = (...val: any) => newFunc(item, val, item.on[onKey]);
     }
   }
 
   if (item.func) {
     for (let funcKey in item.func) {
-      tempProps[funcKey] = (...val: any) => newFunc(item, val, item.func[funcKey])
+      tempProps[funcKey] = (...val: any) =>
+        newFunc(item, val, item.func[funcKey]);
     }
   }
 
-  let child = null
+  let child = null;
 
   if (item.selectOptions) {
-    child = []
+    child = [];
     item.selectOptions.forEach(cItem => {
       // @ts-ignore
-      const tempH = h(ElOption, {label: cItem.name, value: cItem.code}, () => null)
-      child.push(tempH)
-    })
+      const tempH = h(
+        ElOption,
+        { label: cItem.name, value: cItem.code },
+        () => null
+      );
+      child.push(tempH);
+    });
   }
 
-  return h(ElAndXc[item.name], tempProps, () => child)
-}
+  return h(ElAndXc[item.name], tempProps, () => child);
+};
 
 const isActive = (index: number) => {
-  return index === currentClickIndex.value
-}
+  return index === currentClickIndex.value;
+};
 
 function formItemClick(item: PageHeader, index: number) {
-  emits('changeTabs', "属性配置")
+  emits("changeTabs", "属性配置");
   if (props.componentAttribute == null) {
-    return
+    return;
   }
-  currentClickIndex.value = index
-  store.changeCurrentBind(item)
+  currentClickIndex.value = index;
+  store.changeCurrentBind(item);
 }
 
 function upClick(index: number) {
-  if (index === 0) return
-  swapItems(pageData.value.header, index, index - 1)
-  currentClickIndex.value = index - 1
+  if (index === 0) return;
+  swapItems(pageData.value.header, index, index - 1);
+  currentClickIndex.value = index - 1;
 }
 
 function downClick(index: number) {
   if (index === pageData.value.header.length - 1) {
-    return
+    return;
   }
-  swapItems(pageData.value.header, index, index + 1)
-  currentClickIndex.value = index + 1
+  swapItems(pageData.value.header, index, index + 1);
+  currentClickIndex.value = index + 1;
 }
 
 function swapItems(arr: any[], currentClickIndex: number, newIndex: number) {
-  arr[currentClickIndex] = arr.splice(newIndex, 1, arr[currentClickIndex])[0]
-  return arr
+  arr[currentClickIndex] = arr.splice(newIndex, 1, arr[currentClickIndex])[0];
+  return arr;
 }
 
 function delClick(index: number) {
-  currentClickIndex.value = -1
-  store.changeCurrentBind(null)
-  pageData.value.header.splice(index, 1)
+  currentClickIndex.value = -1;
+  store.changeCurrentBind(null);
+  pageData.value.header.splice(index, 1);
 }
 
 async function queryClick() {
-  emits('changeTabs', "表格")
+  emits("changeTabs", "表格");
   const tempData = {
-    ...pageData.value.params
-  }
-  await formRef.value!.validate()
-  loading.value = true
+    ...pageData.value.params,
+  };
+  await formRef.value!.validate();
+  loading.value = true;
   await reportQueryCenterApi(pageData.value.submitUrl, tempData)
-      .then(res => {
-        setTableData(res)
-      })
-      .catch((e) => {
-        initTable()
-        console.error(e)
-        xcMessage.error(e.response.data.error)
-      })
-      .finally(() => {
-        loading.value = false
-      })
+    .then(res => {
+      setTableData(res);
+    })
+    .catch(e => {
+      initTable();
+      console.error(e);
+      xcMessage.error(e.response.data.error);
+    })
+    .finally(() => {
+      loading.value = false;
+    });
 }
 
 type TableBindTs = {
-  data: any[],
-  columns: any[],
-  tableBind: {}
-}
+  data: any[];
+  columns: any[];
+  tableBind: {};
+};
 
-const rules = ref({})
+const rules = ref({});
 
 const dialogTableData = ref<TableBindTs>({
   data: [],
   columns: [],
-  tableBind: {}
-})
+  tableBind: {},
+});
 
 function initTable() {
-  tableBind.value.data = []
+  tableBind.value.data = [];
   tableBind.value.columns = [];
-  tableBind.value.tableBind = {}
+  tableBind.value.tableBind = {};
 
-  dialogTableData.value.data = []
+  dialogTableData.value.data = [];
   dialogTableData.value.columns = [];
-  dialogTableData.value.tableBind = {}
+  dialogTableData.value.tableBind = {};
 }
 
-
-const showDialog = ref(false)
-const dialogTitle = ref('详情')
-const loading = ref(false)
+const showDialog = ref(false);
+const dialogTitle = ref("详情");
+const loading = ref(false);
 
 function requiredInit() {
-  formRef.value!.resetFields()
-  rules.value = []
+  formRef.value!.resetFields();
+  rules.value = [];
   pageData.value.header.forEach(item => {
     if (item.required) {
-      rules.value[item.key] = [{required: true, message: '必填', trigger: 'blur'}]
+      rules.value[item.key] = [
+        { required: true, message: "必填", trigger: "blur" },
+      ];
     }
-  })
+  });
 }
 
 async function handleOnAndFuncEvent(data: PageJsonObject) {
   for (let i = 0; i < data.header.length; i++) {
-    const item = data.header[i]
+    const item = data.header[i];
     if (item.on && item.on.mounted) {
       try {
-        await newFunc(item, '', item.on.mounted)
+        await newFunc(item, "", item.on.mounted);
       } catch (e) {
-        console.error("执行初始化函数错误", e)
+        console.error("执行初始化函数错误", e);
       }
     }
   }
@@ -216,97 +229,113 @@ async function handleOnAndFuncEvent(data: PageJsonObject) {
 
 async function refresh() {
   clearOnAndFunc();
-  await setPageData(pageData.value, currentClickIndex.value)
+  await setPageData(pageData.value, currentClickIndex.value);
 }
 
 async function setPageData(data: PageJsonObject, currentIndex = -1) {
   const temp: PageJsonObject = XEUtils.clone(data, true);
-  queryKey.value = {}
+  queryKey.value = {};
   temp.header.forEach((item, index) => {
-    queryKey.value[item.key] = index
-  })
+    queryKey.value[item.key] = index;
+  });
   if (!XEUtils.isEmpty(temp.paramsDefaultValue)) {
-    temp.params = XEUtils.clone(temp.paramsDefaultValue, true)
+    temp.params = XEUtils.clone(temp.paramsDefaultValue, true);
   }
-  await handleOnAndFuncEvent(temp)
-  pageData.value = temp
+  await handleOnAndFuncEvent(temp);
+  pageData.value = temp;
   if (currentIndex > 0) {
-    await store.changeCurrentBind(pageData.value.header[currentClickIndex.value])
+    await store.changeCurrentBind(
+      pageData.value.header[currentClickIndex.value]
+    );
   } else {
-    await store.changeCurrentBind(null)
+    await store.changeCurrentBind(null);
   }
-  currentClickIndex.value = currentIndex
-  initTable()
-  requiredInit()
+  currentClickIndex.value = currentIndex;
+  initTable();
+  requiredInit();
 }
 
-mutation.setPageData = setPageData
+mutation.setPageData = setPageData;
 
 function getBindDefaultValue(name: string) {
-  const res = {}
+  const res = {};
   if (XEUtils.has(bindData.value, name)) {
-    const a = bindData.value[name].bind
+    const a = bindData.value[name].bind;
     for (let key in a) {
-      res[key] = a[key].defaultValue
+      res[key] = a[key].defaultValue;
     }
   }
-  return res
+  return res;
 }
 
-const AsyncFunction = Object.getPrototypeOf(async function () {
-}).constructor;
-
+const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor;
 
 type QueryKeyTs = {
-  [K in PageHeader[][number]['key']]: any
-}
+  [K in PageHeader[][number]["key"]]: any;
+};
 
-const queryKey = ref<QueryKeyTs>({})
+const queryKey = ref<QueryKeyTs>({});
 
 function newFunc(currentBind: PageHeader, value: any, funcStr: string) {
   function updateView() {
-    queryKey.value[currentBind.key] += pageData.value.header.length + queryKey.value[currentBind.key]
+    queryKey.value[currentBind.key] +=
+      pageData.value.header.length + queryKey.value[currentBind.key];
   }
 
-  const func = new AsyncFunction('pageJson', 'currentBind', 'apiFunc', 'updateView', 'val', 'userInfo', funcStr)
+  const func = new AsyncFunction(
+    "pageJson",
+    "currentBind",
+    "apiFunc",
+    "updateView",
+    "val",
+    "userInfo",
+    funcStr
+  );
   try {
-    return func(pageData.value, currentBind, reportQueryCenterApi, updateView, value, userInfo)
+    return func(
+      pageData.value,
+      currentBind,
+      reportQueryCenterApi,
+      updateView,
+      value,
+      userInfo
+    );
   } catch (e) {
-    console.error('脚本错误', e)
+    console.error("脚本错误", e);
   }
 }
 
 async function addComponent(data: PageHeader) {
-  const temp = XEUtils.clone(data, true)
-  Object.assign(temp.bind, getBindDefaultValue(data.name))
-  queryKey.value[temp.key] = pageData.value.header.length
+  const temp = XEUtils.clone(data, true);
+  Object.assign(temp.bind, getBindDefaultValue(data.name));
+  queryKey.value[temp.key] = pageData.value.header.length;
   if (temp.on && temp.on.mounted) {
     try {
-      await newFunc(temp, '', temp.on.mounted)
+      await newFunc(temp, "", temp.on.mounted);
     } catch (e) {
-      console.error("执行初始化函数错误", e)
+      console.error("执行初始化函数错误", e);
     }
   }
-  pageData.value.header.push(temp)
+  pageData.value.header.push(temp);
 }
 
 async function testClick() {
-  await formRef.value!.validate()
-  const data: QueryKeyTs = {}
+  await formRef.value!.validate();
+  const data: QueryKeyTs = {};
   pageData.value.header.forEach(item => {
-    data[item.key] = pageData.value.params[item.key]
-  })
-  props?.doTest(data)
+    data[item.key] = pageData.value.params[item.key];
+  });
+  props?.doTest(data);
 }
 
-function openDialogAndSetData(data: TableBindTs, title: string = '详情') {
-  dialogTitle.value = title
-  showDialog.value = true
-  dialogTableData.value = data
+function openDialogAndSetData(data: TableBindTs, title: string = "详情") {
+  dialogTitle.value = title;
+  showDialog.value = true;
+  dialogTableData.value = data;
 }
 
 function dialogTableColumns() {
-  store.getColumns(dialogTableData, 'dialogTableRef')
+  store.getColumns(dialogTableData, "dialogTableRef");
 }
 
 function setTableData(res: any) {
@@ -314,19 +343,19 @@ function setTableData(res: any) {
     res = {
       columns: [],
       data: [],
-      tableBind: {}
-    }
+      tableBind: {},
+    };
   }
   tableBind.value = res;
-  store.getColumns(tableBind, 'mainTableRef', false)
+  store.getColumns(tableBind, "mainTableRef", false);
   if (res.details) {
     //@ts-ignore
     tableBind.value.columns.push({
-      field: 'operations',
-      title: '详情',
+      field: "operations",
+      title: "详情",
       width: 70,
-      align: 'center',
-      fixed: 'right',
+      align: "center",
+      fixed: "right",
       slots: {
         default: `
         const {h} = vue
@@ -345,104 +374,137 @@ function setTableData(res: any) {
                 })
           }
         }, () => "详情")
-        `
-      }
-    })
+        `,
+      },
+    });
   }
 }
 
 function getSlotsData(row: any, index: number, code: string) {
-  const newFunction = new Function("row", 'rowIndex', "pageData", "apiFunc", "el", "vue", "openDialogAndSetData", code)
-  return newFunction(row, index, pageData.value, reportQueryCenterApi, ElAndXc, vue, openDialogAndSetData)
+  const newFunction = new Function(
+    "row",
+    "rowIndex",
+    "pageData",
+    "apiFunc",
+    "el",
+    "vue",
+    "openDialogAndSetData",
+    code
+  );
+  return newFunction(
+    row,
+    index,
+    pageData.value,
+    reportQueryCenterApi,
+    ElAndXc,
+    vue,
+    openDialogAndSetData
+  );
 }
 
-function exportExcel(data: { data: any[], columns: Columns[], fileName?: string }, tableRef) {
+function exportExcel(
+  data: { data: any[]; columns: Columns[]; fileName?: string },
+  tableRef
+) {
   if (data.data.length === 0) {
-    xcMessage.warning("没有可以导出的数据。")
-    return
+    xcMessage.warning("没有可以导出的数据。");
+    return;
   }
   tableRef.value.openExport({
     filename: data.fileName,
-    types: ['csv', 'html', 'xml', 'txt', 'xlsx'],
-    type: 'csv',
+    types: ["csv", "html", "xml", "txt", "xlsx"],
+    type: "csv",
     useStyle: true,
-  })
+  });
 }
 
 let shortcutKeyRegistration = {
-  ctrl: {s: handleSavaData}
-}
+  ctrl: { s: handleSavaData },
+};
 
-let keyWatch = XEUtils.noop
+let keyWatch = XEUtils.noop;
 
 onMounted(() => {
-  if (!props.isEditor) return
-  keyWatch = watch(() => xcEvent.value, () => {
-    shortcutTrigger(xcEvent.value, shortcutKeyRegistration)
-  })
-})
+  if (!props.isEditor) return;
+  keyWatch = watch(
+    () => xcEvent.value,
+    () => {
+      shortcutTrigger(xcEvent.value, shortcutKeyRegistration);
+    }
+  );
+});
 
 onUnmounted(() => {
-  keyWatch()
-})
+  keyWatch();
+});
 
 defineExpose({
   setPageData,
   setTableData,
   setUrl: (val: string) => {
     if (pageData.value.submitUrl) {
-      return
+      return;
     }
-    pageData.value.submitUrl = val
-  }
-})
+    pageData.value.submitUrl = val;
+  },
+});
 </script>
 
 <template>
-
   <div class="layout_container">
     <header>
       <div class="cy-page_help_v2-header" ref="headerRef">
-        <el-form v-bind="pageData.fromConfig"
-                 :rules="rules"
-                 ref="formRef"
-                 :model="pageData.params">
-          <div v-for="(item, index) in pageData.header"
-               v-if="pageData.header.length > 0"
-               :key="queryKey[item.key]"
-               class="page-item_div"
-               :class="isActive(index) ? 'page-item_active': ''">
+        <el-form
+          v-bind="pageData.fromConfig"
+          :rules="rules"
+          ref="formRef"
+          :model="pageData.params"
+        >
+          <div
+            v-for="(item, index) in pageData.header"
+            v-if="pageData.header.length > 0"
+            :key="queryKey[item.key]"
+            class="page-item_div"
+            :class="isActive(index) ? 'page-item_active' : ''"
+          >
             <div v-if="currentClickIndex === index" class="tool">
               <div class="tool_item" @click.stop="upClick(index)">
                 <el-icon>
-                  <ArrowLeft/>
+                  <ArrowLeft />
                 </el-icon>
               </div>
               <div class="tool_item" @click.stop="downClick(index)">
                 <el-icon>
-                  <ArrowRight/>
+                  <ArrowRight />
                 </el-icon>
               </div>
               <div class="tool_item" @click.stop="delClick(index)">
                 <el-icon>
-                  <DeleteFilled/>
+                  <DeleteFilled />
                 </el-icon>
               </div>
             </div>
-            <el-form-item :prop="item.key"
-                          @click.stop.prevent="formItemClick(item, index)"
-                          :label="item.label">
-              <component :is="render(item)"/>
+            <el-form-item
+              :prop="item.key"
+              @click.stop.prevent="formItemClick(item, index)"
+              :label="item.label"
+            >
+              <component :is="render(item)" />
             </el-form-item>
           </div>
           <el-form-item>
             <el-button @click="refresh">刷新</el-button>
-            <el-button type="warning" v-if="props.doTest" @click="testClick">测试</el-button>
-            <el-button type="primary" @click="queryClick" icon="Search">查询</el-button>
+            <el-button type="warning" v-if="props.doTest" @click="testClick"
+              >测试</el-button
+            >
+            <el-button type="primary" @click="queryClick" icon="Search"
+              >查询</el-button
+            >
             <el-button
-                @click="exportExcel(tableBind,store.mainTableRef)"
-                type="primary"
-                icon="Download">
+              @click="exportExcel(tableBind, store.mainTableRef)"
+              type="primary"
+              icon="Download"
+            >
               导出Excel
             </el-button>
           </el-form-item>
@@ -450,52 +512,64 @@ defineExpose({
       </div>
     </header>
     <div class="layout_main">
-      <div class="cy-page_help_v2-main"
-           style="width: 100%; height: 100%"
-           v-loading="loading">
-        <PageHelpTable :data="tableBind.data"
-                       :table-bind="tableBind.tableBind"
-                       :store="store"
-                       :getSlotsData="getSlotsData"
-                       tableRefName="mainTableRef"
-                       :columns="tableBind.columns"
+      <div
+        class="cy-page_help_v2-main"
+        style="width: 100%; height: 100%"
+        v-loading="loading"
+      >
+        <PageHelpTable
+          :data="tableBind.data"
+          :table-bind="tableBind.tableBind"
+          :store="store"
+          :getSlotsData="getSlotsData"
+          tableRefName="mainTableRef"
+          :columns="tableBind.columns"
         />
       </div>
     </div>
   </div>
 
-  <el-dialog v-model="showDialog"
-             :title="dialogTitle"
-             width="90%"
-             class="page_help-dialog">
+  <el-dialog
+    v-model="showDialog"
+    :title="dialogTitle"
+    width="90%"
+    class="page_help-dialog"
+  >
     <div style="height: calc(100vh - 400px)">
       <PageHelpTable
-          :store="store"
-          :getSlotsData="getSlotsData"
-          :table-bind="dialogTableData.tableBind"
-          table-ref-name="dialogTableRef"
-          :data="dialogTableData.data"
-          :columns="dialogTableData.columns"
+        :store="store"
+        :getSlotsData="getSlotsData"
+        :table-bind="dialogTableData.tableBind"
+        table-ref-name="dialogTableRef"
+        :data="dialogTableData.data"
+        :columns="dialogTableData.columns"
       />
     </div>
     <template #footer>
-      <el-button v-if="props.isEditor" @click="dialogTableColumns">生成表格列</el-button>
-      <el-button @click="exportExcel(dialogTableData ,store.dialogTableRef)" type="primary">导出Excel</el-button>
+      <el-button v-if="props.isEditor" @click="dialogTableColumns"
+        >生成表格列</el-button
+      >
+      <el-button
+        @click="exportExcel(dialogTableData, store.dialogTableRef)"
+        type="primary"
+        >导出Excel</el-button
+      >
     </template>
   </el-dialog>
 
   <PageFormBind
-      :store="store"
-      @requiredChange="requiredInit"
-      :teleport-div="props.componentAttribute"
-      v-if="props.componentAttribute"/>
-
-  <PageAddComponent :teleportDiv="props.addComponent"
-                    @addComponent="addComponent"
-                    :store="store"
-                    v-if="props.addComponent"/>
-
-
+    :store="store"
+    @requiredChange="requiredInit"
+    :teleport-div="props.componentAttribute"
+    v-if="props.componentAttribute"
+  />
+
+  <PageAddComponent
+    :teleportDiv="props.addComponent"
+    @addComponent="addComponent"
+    :store="store"
+    v-if="props.addComponent"
+  />
 </template>
 
 <style lang="scss">

+ 6 - 1
src/views/data-base/page-editor-help-v2/page-help-v2.ts

@@ -215,7 +215,12 @@ export function usePageStore(props: any) {
       temp = { ...headerParams, ...pageData.value.paramsDefaultValue };
     }
     // @ts-ignore
-    CyJsonEditorDialog(temp, { bodyWidth: "60%" }).then(res => {
+    CyJsonEditorDialog(temp, {
+      dialogProps: {
+        title: "设置默认值",
+        width: "60%",
+      },
+    }).then(res => {
       pageData.value.paramsDefaultValue = res.json;
     });
   }

Різницю між файлами не показано, бо вона завелика
+ 592 - 268
src/views/hospitalization/case-front-sheet/AllCaseFrontSheet.vue


+ 56 - 26
src/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/plugins/opinion/AuditRecord.vue

@@ -10,22 +10,27 @@ import { formatDateToStr } from "@/utils/moment-utils";
 import AuditDisplayComponent from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/plugins/opinion/AuditDisplayComponent.vue";
 import { ElMessageBox } from "element-plus";
 import { needRule } from "@/utils/public";
+import XEUtils from "xe-utils";
+import XcElOption from "@/components/xiao-chan/xc-el-option/XcElOption.vue";
+import { CyMessageBox } from "@/utils/cy-message-box";
 
 const root = inject(emrAuditRootContextKey) as EmrAuditV2Store;
-
+const remediationStatus = ref(1);
 const userInfo = useUserStore().userInfo;
 
 function rectification(row: EmrAuditDetail, flag) {
   rectifyMedicalRecords(row.id, flag).then(() => {
     row.modificationTime = formatDateToStr(new Date());
-    row.modifyPersonName = useUserStore().userInfo.name;
+    row.modifyPersonName = userInfo.name;
+    row.remediationStatus = flag;
     row.remediationStatusName = flag === 1 ? "已整改" : "已知无需整改";
   });
 }
 
 async function delById(row: EmrAuditDetail, index: number) {
-  await ElMessageBox.confirm("是否删除该意见", "提示", {
-    type: "error",
+  await CyMessageBox.confirm({
+    message: "是否删除该意见",
+    type: "delete",
   });
   await deleteEmrAuditByEmrId(row.id);
   root!.state.currentAudit.splice(index, 1);
@@ -34,30 +39,55 @@ async function delById(row: EmrAuditDetail, index: number) {
 function showDel(item: EmrAuditDetail) {
   return needRule(78) || item.approver === userInfo.code;
 }
+
+const tmpData = computed(() => {
+  if (remediationStatus.value === 0) {
+    return root.state.currentAudit;
+  }
+  return XEUtils.filter(root.state.currentAudit, (audit: EmrAuditDetail) => {
+    return remediationStatus.value === 1
+      ? audit.remediationStatus === null
+      : audit.remediationStatus !== null;
+  });
+});
 </script>
 
 <template>
-  <div class="layout_h-w_max" style="overflow: auto">
-    <AuditDisplayComponent :data="root!.state.currentAudit">
-      <template #default="{ item, index }">
-        <el-col :span="12">
-          <el-button type="primary" @click="rectification(item, 1)">
-            已整改
-          </el-button>
-        </el-col>
-        <el-col :span="12">
-          <el-button @click="rectification(item, 2)"> 已知</el-button>
-        </el-col>
-        <el-col :span="24" v-if="showDel(item)">
-          <el-button
-            size="default"
-            style="width: 100%"
-            type="danger"
-            @click="() => delById(item, index)"
-            >删除
-          </el-button>
-        </el-col>
-      </template>
-    </AuditDisplayComponent>
+  <div class="layout_container" style="overflow: auto">
+    <header>
+      整改历史:
+      <el-select v-model="remediationStatus" style="width: 120px">
+        <xc-el-option
+          :data="[
+            { code: 0, name: '全部' },
+            { code: 1, name: '未整改' },
+            { code: 2, name: '已整改' },
+          ]"
+        />
+      </el-select>
+    </header>
+    <div class="layout_main">
+      <AuditDisplayComponent :data="tmpData">
+        <template #default="{ item, index }">
+          <el-col :span="12">
+            <el-button type="primary" @click="rectification(item, 1)">
+              已整改
+            </el-button>
+          </el-col>
+          <el-col :span="12">
+            <el-button @click="rectification(item, 2)"> 已知</el-button>
+          </el-col>
+          <el-col :span="24" v-if="showDel(item)">
+            <el-button
+              size="default"
+              style="width: 100%"
+              type="danger"
+              @click="() => delById(item, index)"
+              >删除
+            </el-button>
+          </el-col>
+        </template>
+      </AuditDisplayComponent>
+    </div>
   </div>
 </template>

Деякі файли не було показано, через те що забагато файлів було змінено