浏览代码

环境变量替换

xiaochan 10 月之前
父节点
当前提交
30128f0bcb

+ 25 - 26
src/api/emr-control/pdf-api.ts

@@ -1,33 +1,32 @@
-import axios from 'axios'
-
+import axios from "axios";
+import env from "@/utils/setting";
 //@ts-ignore
-let api = "http://" + import.meta.env.VITE_EMR_CONTROL_URL;
-let iframe = null
-
+let api = "http://" + env.VITE_EMR_CONTROL_URL;
+let iframe = null;
 
 interface pdfParam {
-    url: string,
-    data: any,
-    method: 'post' | 'get';
+  url: string;
+  data: any;
+  method: "post" | "get";
 }
 
 export function pdfPreviewThePrint(data: pdfParam) {
-    axios({
-        url: api + '/pdf/' + data.url,
-        method: data.method,
-        data: data.data,
-        responseType: 'blob'
-    }).then((res) => {
-        if (iframe != null) {
-            document.body.removeChild(iframe)
-        }
-        iframe = document.createElement('iframe');
-        let blob = new Blob([res.data], {type: 'application/pdf'});
-        // 预览 blob 并打印
-        iframe.src = URL.createObjectURL(blob)
-        // 打印 iframe
-        iframe.style.display = 'none';
-        document.body.appendChild(iframe);
-        iframe.contentWindow.print();
-    })
+  axios({
+    url: api + "/pdf/" + data.url,
+    method: data.method,
+    data: data.data,
+    responseType: "blob",
+  }).then(res => {
+    if (iframe != null) {
+      document.body.removeChild(iframe);
+    }
+    iframe = document.createElement("iframe");
+    let blob = new Blob([res.data], { type: "application/pdf" });
+    // 预览 blob 并打印
+    iframe.src = URL.createObjectURL(blob);
+    // 打印 iframe
+    iframe.style.display = "none";
+    document.body.appendChild(iframe);
+    iframe.contentWindow.print();
+  });
 }

+ 61 - 57
src/api/emr-control/request.ts

@@ -1,81 +1,85 @@
-import axios, {AxiosRequestConfig} from 'axios'
-import {ElMessage, ElMessageBox} from "element-plus";
+import axios, { AxiosRequestConfig } from "axios";
+import { ElMessage, ElMessageBox } from "element-plus";
+import env from "@/utils/setting";
 
 const service = axios.create({
-    // @ts-ignore
-    baseURL: "http://" + import.meta.env.VITE_EMR_CONTROL_URL,
-    withCredentials: true,
-    timeout: 0,
-})
+  // @ts-ignore
+  baseURL: "http://" + env.VITE_EMR_CONTROL_URL,
+  withCredentials: true,
+  timeout: 0,
+});
 
 service.interceptors.request.use(
-    (config) => {
-        if (localStorage.token) {
-            config.headers['token'] = localStorage.token
-        }
-        return config
-    },
-    (error) => {
-        return Promise.reject(error)
+  config => {
+    if (localStorage.token) {
+      config.headers["token"] = localStorage.token;
     }
-)
+    return config;
+  },
+  error => {
+    return Promise.reject(error);
+  }
+);
 
-service.interceptors.response.use((response) => {
+service.interceptors.response.use(
+  response => {
     if (response.data.code === 200 || response.data.code === 0) {
-        return response.data.data
+      return response.data.data;
     }
     if (response.data.code === 201) {
-        ElMessage({
-            type: 'success',
-            duration: 2800,
-            dangerouslyUseHTMLString: true,
-            message: response.data.message,
-            showClose: true,
-        })
-        return response.data.data
+      ElMessage({
+        type: "success",
+        duration: 2800,
+        dangerouslyUseHTMLString: true,
+        message: response.data.message,
+        showClose: true,
+      });
+      return response.data.data;
     }
     if (response.data.code === 5000) {
-        ElMessage({
-            type: 'error',
-            duration: 2800,
-            message: response.data.message,
-            showClose: true,
-        })
+      ElMessage({
+        type: "error",
+        duration: 2800,
+        message: response.data.message,
+        showClose: true,
+      });
     }
 
     if (response.data.code === 5001) {
-        ElMessageBox.alert(response.data.message, '提示', {
-            type: 'warning',
-            confirmButtonText: '确定',
-            showClose: false,
-        }).then(() => {
-        }).catch(() => {
-        })
+      ElMessageBox.alert(response.data.message, "提示", {
+        type: "warning",
+        confirmButtonText: "确定",
+        showClose: false,
+      })
+        .then(() => {})
+        .catch(() => {});
     }
 
     if (response.data.code === 6001) {
-        ElMessage({
-            message: response.data.message,
-            type: 'error',
-            duration: 2500,
-            showClose: true,
-            grouping: true,
-        })
-        return {
-            error: true,
-            data: response.data.data
-        }
+      ElMessage({
+        message: response.data.message,
+        type: "error",
+        duration: 2500,
+        showClose: true,
+        grouping: true,
+      });
+      return {
+        error: true,
+        data: response.data.data,
+      };
     }
-    return Promise.reject(response.data.message || '服务器内部错误')
-}, (error) => {
+    return Promise.reject(response.data.message || "服务器内部错误");
+  },
+  error => {
     // 超出 2xx 范围的状态码都会触发该函数。
     // 对响应错误做点什么
     return Promise.reject(error);
-});
+  }
+);
 
 const request = <D = any>(params: AxiosRequestConfig): Promise<D> => {
-    // @ts-ignore
-    return service(params)
-}
+  // @ts-ignore
+  return service(params);
+};
 
-export default request
+export default request;

+ 45 - 34
src/components/medical-insurance/ybkf/YbImport.vue

@@ -23,9 +23,17 @@
         <template #trigger>
           <el-button type="primary" icon="Picture">选取文件</el-button>
         </template>
-        <el-button style="margin-left: 10px" type="success" icon="Upload" @click="submitUpload">上传</el-button>
+        <el-button
+          style="margin-left: 10px"
+          type="success"
+          icon="Upload"
+          @click="submitUpload"
+          >上传</el-button
+        >
         <template #tip>
-          <div class="el-upload__tip">只能上传 xls/xlsx 文件,建议上传一个月数据</div>
+          <div class="el-upload__tip">
+            只能上传 xls/xlsx 文件,建议上传一个月数据
+          </div>
         </template>
       </el-upload>
     </div>
@@ -33,53 +41,56 @@
 </template>
 
 <script>
-import { reactive, ref } from 'vue'
-import { onMounted } from 'vue'
-import { ElMessage } from 'element-plus'
-import { formatYear } from '@/utils/date'
-import {useUserStore} from "@/pinia/user-store";
+import { reactive, ref } from "vue";
+import { onMounted } from "vue";
+import { ElMessage } from "element-plus";
+import { formatYear } from "@/utils/date";
+import { useUserStore } from "@/pinia/user-store";
+import env from "@/utils/setting";
 
 export default {
   setup() {
-    const nf = ref(null)
-    const insurId = ref('1')
+    const nf = ref(null);
+    const insurId = ref("1");
 
     const queryData = reactive({
-      nf: '',
-      insurName: '',
-    })
+      nf: "",
+      insurName: "",
+    });
 
     // 初始化数据
     onMounted(() => {
-      nf.value = new Date()
-      queryData.nf = formatYear(nf.value)
-      queryData.insurName = insurId.value === '1' ? '长沙市城职普通住院' : '长沙市城居普通住院'
-    })
+      nf.value = new Date();
+      queryData.nf = formatYear(nf.value);
+      queryData.insurName =
+        insurId.value === "1" ? "长沙市城职普通住院" : "长沙市城居普通住院";
+    });
 
     // ------------------ 上传 ---------------------
-    const fileList = ref([])
-    const apiUrl = import.meta.env.VITE_BASE_URL
+    const fileList = ref([]);
+    const apiUrl = env.VITE_BASE_URL;
 
-    const upload = ref(null)
+    const upload = ref(null);
     const header = {
       token: useUserStore().getToken,
-    }
+    };
     const submitUpload = () => {
-      queryData.insurName = insurId.value === '1' ? '长沙市城职普通住院' : '长沙市城居普通住院'
-      queryData.nf = formatYear(nf.value)
+      queryData.insurName =
+        insurId.value === "1" ? "长沙市城职普通住院" : "长沙市城居普通住院";
+      queryData.nf = formatYear(nf.value);
       nextTick(() => {
-        upload.value.submit()
-      })
-    }
+        upload.value.submit();
+      });
+    };
     const fileSizeOutLimit = () => {
-      ElMessage.error('已经选取excel,如须更换请先移除已选取的excel!')
-    }
+      ElMessage.error("已经选取excel,如须更换请先移除已选取的excel!");
+    };
     const uploadSuccess = () => {
-      ElMessage.success('上传成功!')
-    }
+      ElMessage.success("上传成功!");
+    };
     const uploadError = () => {
-      ElMessage.error('上传失败!')
-    }
+      ElMessage.error("上传失败!");
+    };
 
     return {
       queryData,
@@ -93,9 +104,9 @@ export default {
       uploadSuccess,
       uploadError,
       upload,
-    }
+    };
   },
-}
+};
 </script>
 
 <style scoped>
@@ -103,4 +114,4 @@ export default {
   display: inline-block;
   vertical-align: top;
 }
-</style>
+</style>

+ 60 - 38
src/layout/function-list/UserInfo.vue

@@ -1,98 +1,120 @@
 <template>
   <el-popover :width="260" trigger="click" :offset="24">
     <template #reference>
-      <div style="white-space: nowrap;display: flex;justify-content: center;align-items: center">
+      <div
+        style="
+          white-space: nowrap;
+          display: flex;
+          justify-content: center;
+          align-items: center;
+        "
+      >
         <div>
           <el-avatar :size="25" :src="userInfo.avatar" @error="errorHandler">
-            <img :src="makeTextPortrait()"/>
+            <img :src="makeTextPortrait()" />
           </el-avatar>
         </div>
         <div style="margin-left: 6px">
           {{ userInfo.name }}
         </div>
       </div>
-
     </template>
 
     <template #default>
       <div class="avatar_img">
         <div>
           <el-avatar :size="70" :src="userInfo.avatar" @error="errorHandler">
-            <img :src="makeTextPortrait()"/>
+            <img :src="makeTextPortrait()" />
           </el-avatar>
         </div>
 
         <div>
-          <user-info-display/>
+          <user-info-display />
         </div>
-
       </div>
 
       <div class="button">
-        <el-button type="primary" plain @click="emit('password')">修改密码</el-button>
-        <el-button type="danger" plain @click="emit('logout')">退出登录</el-button>
+        <el-button type="primary" plain @click="emit('password')"
+          >修改密码
+        </el-button>
+        <el-button type="danger" plain @click="emit('logout')"
+          >退出登录
+        </el-button>
       </div>
     </template>
   </el-popover>
-  <el-dialog title="上传签名" v-model="signatureDialog" :close-on-click-modal="false" :close-on-press-escape="false"
-             destroy-on-close>
+  <el-dialog
+    title="上传签名"
+    v-model="signatureDialog"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    destroy-on-close
+  >
     <!-- LUpload组件 -->
-    <LUpload :otherData="paramData" :headers="headerData" v-model="urlList" :multiple="false"
-             :sendUrl="sendUrl" :signatureData="signatureData" @closeSignatureDialog="closeSignatureDialog"/>
+    <LUpload
+      :otherData="paramData"
+      :headers="headerData"
+      v-model="urlList"
+      :multiple="false"
+      :sendUrl="sendUrl"
+      :signatureData="signatureData"
+      @closeSignatureDialog="closeSignatureDialog"
+    />
   </el-dialog>
 </template>
 
-<script setup name='UserInfo' lang="ts">
-import {genTextPortrait} from '@/utils/portrait'
+<script setup name="UserInfo" lang="ts">
+import { genTextPortrait } from "@/utils/portrait";
 import UserInfoDisplay from "@/layout/function-list/UserInfoDisplay.vue";
-import {useUserStore} from "@/pinia/user-store";
-import {stringNotBlank} from "@/utils/blank-utils";
+import { useUserStore } from "@/pinia/user-store";
+import { stringNotBlank } from "@/utils/blank-utils";
 import LUpload from "@/views/settings/permissions/LUpload.vue";
+import env from "@/utils/setting";
 
-const emit = defineEmits(['password', 'logout'])
+const emit = defineEmits(["password", "logout"]);
 
-const userInfo = useUserStore().userInfo
+const userInfo = useUserStore().userInfo;
 
 const makeTextPortrait = () => {
   if (stringNotBlank(userInfo.avatar)) {
-    return userInfo.avatar
+    return userInfo.avatar;
   }
   return genTextPortrait(userInfo.name);
-}
+};
 
 const errorHandler = () => {
-  return true
-}
+  return true;
+};
 
 // 上传签名图片
-const baseurl = import.meta.env.VITE_BASE_URL
+const baseurl = env.VITE_BASE_URL;
 const signatureData = ref({
-  uploadUrl: baseurl + '/settings/setAutographImage',
+  uploadUrl: baseurl + "/settings/setAutographImage",
   coversList: [],
   fileList: [],
-  param: {code: ''},
+  param: { code: "" },
   limitCountImg: 1,
   pSize: 2,
   showBtnDealImg: true,
   noneBtnImg: false,
-})
-const signatureDialog = ref(false)
+});
+const signatureDialog = ref(false);
 const uploadSignature = () => {
-  signatureData.value.param.code = userInfo.code
-  paramData.value.code = userInfo.code
-  signatureDialog.value = true
-}
-const closeSignatureDialog = (flag:any) => {
+  signatureData.value.param.code = userInfo.code;
+  paramData.value.code = userInfo.code;
+  signatureDialog.value = true;
+};
+const closeSignatureDialog = (flag: any) => {
   if (flag) {
-    signatureDialog.value = false
+    signatureDialog.value = false;
   }
-}
-const sendUrl = ref(baseurl+'/settings/setAutographImage')
-const urlList = ref([])
+};
+const sendUrl = ref(baseurl + "/settings/setAutographImage");
+const urlList = ref([]);
 const headerData = {
   token: localStorage.token,
-}
-const paramData = ref({code:''})
+};
+const paramData = ref({ code: "" });
 </script>
 
 <style scoped lang="scss">

+ 56 - 57
src/utils/database/magic-api-request.ts

@@ -1,73 +1,72 @@
-import axios, {AxiosRequestConfig} from "axios";
-import {xcMessage} from "../xiaochan-element-plus";
-import {CyMessageBox} from "@/components/cy/message-box";
+import axios, { AxiosRequestConfig } from "axios";
+import { xcMessage } from "../xiaochan-element-plus";
+import { CyMessageBox } from "@/components/cy/message-box";
+import env from "@/utils/setting";
 
-export const MAGIC_API = import.meta.env.VITE_DATA_BASE
-export const MAGIC_API_IFRAME = import.meta.env.VITE_MAGIC_API_IFRAME
+export const MAGIC_API = env.VITE_DATA_BASE;
+export const MAGIC_API_IFRAME = env.VITE_MAGIC_API_IFRAME;
 
 const service = axios.create({
-    baseURL: MAGIC_API,
-    withCredentials: true,
-    timeout: 0
-})
+  baseURL: MAGIC_API,
+  withCredentials: true,
+  timeout: 0,
+});
 
 service.interceptors.request.use(
-    (config) => {
-        if (localStorage.token) {
-            // @ts-ignore
-            config.headers['token'] = localStorage.token
-            // @ts-ignore
-            config.headers['Magic-Token'] = localStorage.token
-        }
-        return config
-    },
-    (error) => {
-        return Promise.reject(error)
+  config => {
+    if (localStorage.token) {
+      // @ts-ignore
+      config.headers["token"] = localStorage.token;
+      // @ts-ignore
+      config.headers["Magic-Token"] = localStorage.token;
     }
-)
+    return config;
+  },
+  error => {
+    return Promise.reject(error);
+  }
+);
 
-service.interceptors.response.use((response) => {
-    if (response.data.code === 1) {
-        return response.data.data
-    }
-    if (response.data.code === 200) {
-        xcMessage.success(response.data.message)
-        return response.data.data
-    }
-
-    if (response.data.code === -1) {
-        xcMessage.error(response.data.message)
-        return Promise.reject(response.data)
-    }
+service.interceptors.response.use(response => {
+  if (response.data.code === 1) {
+    return response.data.data;
+  }
+  if (response.data.code === 200) {
+    xcMessage.success(response.data.message);
+    return response.data.data;
+  }
 
-    if (response.data.code === -2) {
-        CyMessageBox.alert({
-            message: response.data.message,
-            type: 'error',
-            title: '错误',
-        }).then(() => {
+  if (response.data.code === -1) {
+    xcMessage.error(response.data.message);
+    return Promise.reject(response.data);
+  }
 
-        })
-        return Promise.reject(response.data)
-    }
+  if (response.data.code === -2) {
+    CyMessageBox.alert({
+      message: response.data.message,
+      type: "error",
+      title: "错误",
+    }).then(() => {});
+    return Promise.reject(response.data);
+  }
 
-    if (response.data.code === -3) {
-        xcMessage.warning(response.data.message)
-        return Promise.reject(response.data)
-    }
+  if (response.data.code === -3) {
+    xcMessage.warning(response.data.message);
+    return Promise.reject(response.data);
+  }
 
-    xcMessage.error(response.data.message)
-    return Promise.reject(response.data)
-})
+  xcMessage.error(response.data.message);
+  return Promise.reject(response.data);
+});
 
 const request = <D = any>(options: AxiosRequestConfig): Promise<D> => {
-    // @ts-ignore
-    return service(options)
-}
+  // @ts-ignore
+  return service(options);
+};
 
 export const magicApi = (options: AxiosRequestConfig) => {
-    options.url = '/thyy/api' + options.url
-    return request(options)
-}
+  options.url = "/thyy/api" + options.url;
+  return request(options);
+};
 
-export default request
+export default request;

+ 54 - 51
src/utils/excel.js

@@ -1,63 +1,66 @@
-import axios from 'axios'
-import XLSX from 'xlsx'
-import {startLoading, endLoading} from './loading'
-import {ElMessage} from 'element-plus'
-import {useProgressBarStore} from "@/pinia/progress-bar-store";
+import axios from "axios";
+import XLSX from "xlsx";
+import { startLoading, endLoading } from "./loading";
+import { ElMessage } from "element-plus";
+import { useProgressBarStore } from "@/pinia/progress-bar-store";
+import env from "@/utils/setting";
 
-const apiUrl = import.meta.env.VITE_BASE_URL
+const apiUrl = env.VITE_BASE_URL;
 
 export function writeExcelFile(workSheet, fileName) {
-    const workBook = XLSX.utils.book_new()
-    XLSX.utils.book_append_sheet(workBook, workSheet, 'sheet1')
-    XLSX.writeFile(workBook, fileName)
-    endLoading()
+  const workBook = XLSX.utils.book_new();
+  XLSX.utils.book_append_sheet(workBook, workSheet, "sheet1");
+  XLSX.writeFile(workBook, fileName);
+  endLoading();
 }
 
 export function createWorkSheet(data, fields, titles) {
-    const workSheet = XLSX.utils.json_to_sheet(data, {header: fields})
-    const range = XLSX.utils.decode_range(workSheet['!ref'])
-    for (let c = range.s.c; c <= range.e.c; c++) {
-        const header = XLSX.utils.encode_col(c) + '1'
-        workSheet[header].v = titles[workSheet[header].v]
-    }
-    return workSheet
+  const workSheet = XLSX.utils.json_to_sheet(data, { header: fields });
+  const range = XLSX.utils.decode_range(workSheet["!ref"]);
+  for (let c = range.s.c; c <= range.e.c; c++) {
+    const header = XLSX.utils.encode_col(c) + "1";
+    workSheet[header].v = titles[workSheet[header].v];
+  }
+  return workSheet;
 }
 
-const progressBarStore = useProgressBarStore()
+const progressBarStore = useProgressBarStore();
 
 export function downloadExcel(data) {
-    if (data.jdt) {
-        progressBarStore.initialize({
-            title: '正在导出 Excel',
-            isOpen: true,
-            closeButton: false
-        })
-    } else {
-        startLoading()
-    }
-    axios({
-        method: data.method || 'post',
-        url: apiUrl + data.url,
-        data: data.param,
-        responseType: 'blob',
-        headers: {
-            token: localStorage.token,
-        },
-    }).then((res) => {
-        const link = document.createElement('a')
-        let blob = new Blob([res.data], {type: 'application/vnd.ms-excel'})
-        link.style.display = 'none'
-        link.href = URL.createObjectURL(blob)
-        link.download = data.fileName //下载的文件名
-        document.body.appendChild(link)
-        link.click()
-        document.body.removeChild(link)
-        endLoading()
-        progressBarStore.closeProgressBar()
-    }).catch((error) => {
-        ElMessage.error('网络连接错误', '错误')
-        console.error(error)
-        endLoading()
-        progressBarStore.closeProgressBar()
+  if (data.jdt) {
+    progressBarStore.initialize({
+      title: "正在导出 Excel",
+      isOpen: true,
+      closeButton: false,
+    });
+  } else {
+    startLoading();
+  }
+  axios({
+    method: data.method || "post",
+    url: apiUrl + data.url,
+    data: data.param,
+    responseType: "blob",
+    headers: {
+      token: localStorage.token,
+    },
+  })
+    .then(res => {
+      const link = document.createElement("a");
+      let blob = new Blob([res.data], { type: "application/vnd.ms-excel" });
+      link.style.display = "none";
+      link.href = URL.createObjectURL(blob);
+      link.download = data.fileName; //下载的文件名
+      document.body.appendChild(link);
+      link.click();
+      document.body.removeChild(link);
+      endLoading();
+      progressBarStore.closeProgressBar();
     })
+    .catch(error => {
+      ElMessage.error("网络连接错误", "错误");
+      console.error(error);
+      endLoading();
+      progressBarStore.closeProgressBar();
+    });
 }

+ 119 - 120
src/utils/public.ts

@@ -1,159 +1,158 @@
 // @ts-ignore
-import {xcMessage} from "./xiaochan-element-plus";
-import XEUtils, {isFunction, isObject} from "xe-utils";
-import {useUserStore} from "@/pinia/user-store";
+import { xcMessage } from "./xiaochan-element-plus";
+import XEUtils, { isFunction, isObject } from "xe-utils";
+import { useUserStore } from "@/pinia/user-store";
+import env from "@/utils/setting";
 
 export function needRule(...val: number[]) {
-    const userRoles = useUserStore().userInfo.roles
-    if (userRoles.includes(1)) {
-        return true;
+  const userRoles = useUserStore().userInfo.roles;
+  if (userRoles.includes(1)) {
+    return true;
+  }
+  for (let i = 0; i < val.length; i++) {
+    if (userRoles.includes(val[i])) {
+      return true;
     }
-    for (let i = 0; i < val.length; i++) {
-        if (userRoles.includes(val[i])) {
-            return true;
-        }
-    }
-    return false;
+  }
+  return false;
 }
 
 export function noNeedRule(...val: number[]) {
-    return !needRule(...val)
+  return !needRule(...val);
 }
 
 // @ts-ignore
-export let isDev = import.meta.env.MODE === "development"
+export let isDev = import.meta.env.MODE === "development";
 
 export const nullToEmpty = (val: string): string => {
-    if (typeof val === 'undefined' || val === null) {
-        return ''
-    } else {
-        return val
-    }
-}
+  if (typeof val === "undefined" || val === null) {
+    return "";
+  } else {
+    return val;
+  }
+};
 
 /**
  * 对比版本号,需要考虑带有英文字殮的版本号
  */
 export const compareVersion = (v1: string, v2: string): number => {
-    const v1s = v1.split(".");
-    const v2s = v2.split(".");
-    const len = Math.max(v1s.length, v2s.length);
-    while (v1s.length < len) {
-        v1s.push("0");
-    }
-    while (v2s.length < len) {
-        v2s.push("0");
-    }
-    for (let i = 0; i < len; i++) {
-        const num1 = parseInt(v1s[i]);
-        const num2 = parseInt(v2s[i]);
-        if (num1 > num2) {
-            return 1;
-        } else if (num1 < num2) {
-            return -1;
-        }
+  const v1s = v1.split(".");
+  const v2s = v2.split(".");
+  const len = Math.max(v1s.length, v2s.length);
+  while (v1s.length < len) {
+    v1s.push("0");
+  }
+  while (v2s.length < len) {
+    v2s.push("0");
+  }
+  for (let i = 0; i < len; i++) {
+    const num1 = parseInt(v1s[i]);
+    const num2 = parseInt(v2s[i]);
+    if (num1 > num2) {
+      return 1;
+    } else if (num1 < num2) {
+      return -1;
     }
-    return 0;
-}
+  }
+  return 0;
+};
 
 export const chineseEncrypt = {
-    encrypt: (val: string): string => {
-        if (!val) {
-            return "";
-        }
-        return encodeURI(JSON.stringify(val))
-    },
-    decrypt: (val: string): string | any => {
-        if (!val) {
-            return "";
-        }
-        return JSON.parse(decodeURI(val))
+  encrypt: (val: string): string => {
+    if (!val) {
+      return "";
     }
-}
+    return encodeURI(JSON.stringify(val));
+  },
+  decrypt: (val: string): string | any => {
+    if (!val) {
+      return "";
+    }
+    return JSON.parse(decodeURI(val));
+  },
+};
 
 export const windowBtoaAndAtob = {
-    btoa(data: any) {
-        if (XEUtils.isString(data)) {
-            return window.btoa(data)
-        } else {
-            return window.btoa(JSON.stringify(data))
-        }
-    },
-    atob<T>(data: any, defaultValue: null | T = null): T | null {
-        if (!XEUtils.isString(data)) return defaultValue
-        return JSON.parse(window.atob(data));
+  btoa(data: any) {
+    if (XEUtils.isString(data)) {
+      return window.btoa(data);
+    } else {
+      return window.btoa(JSON.stringify(data));
     }
-}
+  },
+  atob<T>(data: any, defaultValue: null | T = null): T | null {
+    if (!XEUtils.isString(data)) return defaultValue;
+    return JSON.parse(window.atob(data));
+  },
+};
 
 export let copyStrFunc = (val: any) => {
-    if (navigator.clipboard) {
-        copyStrFunc = (val) => {
-            if (!XEUtils.isString(val)) {
-                val = JSON.stringify(val)
-            }
-            navigator.clipboard.writeText(val).then(() => {
-                xcMessage.success("复制成功。")
-            })
-        }
-    } else {
-        copyStrFunc = (val) => {
-            if (!XEUtils.isString(val)) {
-                val = JSON.stringify(val)
-            }
-            let input = document.createElement('textarea')
-            document.body.appendChild(input);
-            input.value = val;
-            input.select();
-            input.setSelectionRange(0, input.value.length);
-            document.execCommand("copy");
-            document.body.removeChild(input);
-            xcMessage.success("复制成功。")
-        }
-    }
-    copyStrFunc(val)
-}
+  if (navigator.clipboard) {
+    copyStrFunc = val => {
+      if (!XEUtils.isString(val)) {
+        val = JSON.stringify(val);
+      }
+      navigator.clipboard.writeText(val).then(() => {
+        xcMessage.success("复制成功。");
+      });
+    };
+  } else {
+    copyStrFunc = val => {
+      if (!XEUtils.isString(val)) {
+        val = JSON.stringify(val);
+      }
+      let input = document.createElement("textarea");
+      document.body.appendChild(input);
+      input.value = val;
+      input.select();
+      input.setSelectionRange(0, input.value.length);
+      document.execCommand("copy");
+      document.body.removeChild(input);
+      xcMessage.success("复制成功。");
+    };
+  }
+  copyStrFunc(val);
+};
 
 // 判断字符串是否包含中文
 export const isChinese = (str: string) => {
-    return /[\u4e00-\u9fa5]/.test(str);
-}
+  return /[\u4e00-\u9fa5]/.test(str);
+};
 // 判断字符串是否为纯英文
 export const isEnglish = (str: string) => {
-    return /^[a-zA-Z]+$/.test(str);
-}
+  return /^[a-zA-Z]+$/.test(str);
+};
 
 export function isContain(element: HTMLElement) {
-    let elementIsVisible: boolean
-    try {
-        const rect = element.getBoundingClientRect();
-        const document = window.document;
-        elementIsVisible =
-          rect.top <=
-            (window.innerHeight || document.documentElement.clientHeight) &&
-          rect.left <=
-            (window.innerWidth || document.documentElement.clientWidth) &&
-          rect.bottom >= 0 &&
-          rect.right >= 0;
-        return elementIsVisible    
-    }catch {
-        return false;
-    }
-    
+  let elementIsVisible: boolean;
+  try {
+    const rect = element.getBoundingClientRect();
+    const document = window.document;
+    elementIsVisible =
+      rect.top <=
+        (window.innerHeight || document.documentElement.clientHeight) &&
+      rect.left <=
+        (window.innerWidth || document.documentElement.clientWidth) &&
+      rect.bottom >= 0 &&
+      rect.right >= 0;
+    return elementIsVisible;
+  } catch {
+    return false;
+  }
 }
 
 export const SYSTEM_CONFIG = {
-    // @ts-ignore
-    HOSPITAL_NAME: import.meta.env.VITE_HOSPITAL_NAME,
-    // @ts-ignore
-    SYSTEM_NAME: import.meta.env.VITE_SYSTEM_NAME,
-    // @ts-ignore
-    HOSPITAL_CODE: import.meta.env.VITE_HOSPITAL_CODE,
-}
-
+  // @ts-ignore
+  HOSPITAL_NAME: env.VITE_HOSPITAL_NAME,
+  // @ts-ignore
+  SYSTEM_NAME: env.VITE_SYSTEM_NAME,
+  // @ts-ignore
+  HOSPITAL_CODE: env.VITE_HOSPITAL_CODE,
+};
 
 export const isPromise = (val: Promise<any | unknown>) => {
-    if (val === null || typeof val === 'undefined') {
-        return false
-    }
-    return isObject(val) && isFunction(val.then) && isFunction(val.catch);
+  if (val === null || typeof val === "undefined") {
+    return false;
+  }
+  return isObject(val) && isFunction(val.then) && isFunction(val.catch);
 };

+ 2 - 1
src/utils/request.js

@@ -6,9 +6,10 @@ import { CyMessageBox } from "@/components/cy/message-box";
 import { useProgressBarStore } from "@/pinia/progress-bar-store";
 import XEUtils from "xe-utils";
 import { stringify } from "qs";
+import env from "@/utils/setting";
 
 const service = axios.create({
-  baseURL: import.meta.env.VITE_BASE_URL,
+  baseURL: env.VITE_BASE_URL,
   withCredentials: true,
   timeout: 0,
   showLoading: true,

+ 6 - 0
src/utils/setting.ts

@@ -0,0 +1,6 @@
+const isProduction = import.meta.env.MODE === "production";
+const env: ImportMetaEnv = isProduction
+  ? window["__PRODUCTION____APP__CONF__"]
+  : import.meta.env;
+
+export default env;

+ 73 - 72
src/utils/websocket.js

@@ -1,93 +1,94 @@
-import {ElMessageBox} from 'element-plus'
-import Cookies from 'js-cookie'
-import router from '@/router'
-import {useUserStore} from "@/pinia/user-store";
+import { ElMessageBox } from "element-plus";
+import Cookies from "js-cookie";
+import router from "@/router";
+import { useUserStore } from "@/pinia/user-store";
+import env from "@/utils/setting";
 
-const socketUrl = import.meta.env.VITE_SOCKET_URL
+const socketUrl = env.VITE_SOCKET_URL;
 
-let webSocket = null
-let globalCallback = new Map()
+let webSocket = null;
+let globalCallback = new Map();
 
 export function closeWebSocket() {
-    if (webSocket !== null) {
-        webSocket.close()
-        webSocket = null
-    }
+  if (webSocket !== null) {
+    webSocket.close();
+    webSocket = null;
+  }
 }
 
 export function setCallback(messageName, callback) {
-    globalCallback.set(messageName, callback)
+  globalCallback.set(messageName, callback);
 }
 
 export function sendAMessage(name, data) {
-    if (globalCallback.has(name)) {
-        try {
-            globalCallback.get(name)(data)
-        } catch {
-
-        }
-    }
+  if (globalCallback.has(name)) {
+    try {
+      globalCallback.get(name)(data);
+    } catch {}
+  }
 }
 
-export const socketErrDialog = ref(false)
+export const socketErrDialog = ref(false);
 
 export function initWebSocket(sid, force) {
-    if ('WebSocket' in window) {
-        if (webSocket === null || force) {
-            const url = socketUrl + sid
-            webSocket = new WebSocket(url)
-        }
-    } else {
-        alert('该浏览器不支持websocket!')
-        webSocket = 'unsupport'
+  if ("WebSocket" in window) {
+    if (webSocket === null || force) {
+      const url = socketUrl + sid;
+      webSocket = new WebSocket(url);
     }
+  } else {
+    alert("该浏览器不支持websocket!");
+    webSocket = "unsupport";
+  }
 
-    webSocket.onopen = function () {
-        socketErrDialog.value = false
-        console.log('WebSocket连接')
-    }
+  webSocket.onopen = function () {
+    socketErrDialog.value = false;
+    console.log("WebSocket连接");
+  };
 
-    webSocket.onmessage = function (e) {
-        let data = JSON.parse(e.data)
-        sendAMessage(data.name, data.message)
-    }
+  webSocket.onmessage = function (e) {
+    let data = JSON.parse(e.data);
+    sendAMessage(data.name, data.message);
+  };
 
-    webSocket.onclose = function () {
-        if (router.currentRoute.value.path === '/login') {
-            location.reload()
-        } else {
-            socketErrDialog.value = true
-        }
-        webSocket = null
-        let sid
-        if (router.currentRoute.value.path === '/triageRoomScreen') {
-            sid = Cookies.get('room-screen-sid')
-        } else {
-            sid = useUserStore().getSid
-        }
-        if (!sid) {
-            if (router.currentRoute.value.path === '/login') {
-                return
-            }
-            ElMessageBox.confirm('未检测到WebSocket连接的sid,请重新登录。', '提示', {
-                showCancelButton: false,
-                type: 'warning',
-            }).then(async () => {
-                await router.push('/login')
-            }).catch(async () => {
-                await router.push('/login')
-            })
-        } else {
-            if (router.currentRoute.value.path === '/triageFloorScreen') {
-                sid += '-triageFloorScreen'
-            }
-            setTimeout(() => {
-                initWebSocket(sid)
-            }, 3000)
-        }
+  webSocket.onclose = function () {
+    if (router.currentRoute.value.path === "/login") {
+      location.reload();
+    } else {
+      socketErrDialog.value = true;
     }
-
-    webSocket.onerror = function () {
-        console.error('WebSocket连接发生错误')
+    webSocket = null;
+    let sid;
+    if (router.currentRoute.value.path === "/triageRoomScreen") {
+      sid = Cookies.get("room-screen-sid");
+    } else {
+      sid = useUserStore().getSid;
     }
+    if (!sid) {
+      if (router.currentRoute.value.path === "/login") {
+        return;
+      }
+      ElMessageBox.confirm("未检测到WebSocket连接的sid,请重新登录。", "提示", {
+        showCancelButton: false,
+        type: "warning",
+      })
+        .then(async () => {
+          await router.push("/login");
+        })
+        .catch(async () => {
+          await router.push("/login");
+        });
+    } else {
+      if (router.currentRoute.value.path === "/triageFloorScreen") {
+        sid += "-triageFloorScreen";
+      }
+      setTimeout(() => {
+        initWebSocket(sid);
+      }, 3000);
+    }
+  };
+
+  webSocket.onerror = function () {
+    console.error("WebSocket连接发生错误");
+  };
 }

+ 2 - 1
src/views/archive/ArchiveUpload.vue

@@ -1,6 +1,7 @@
 <script setup lang="ts">
 import { UploadFilled } from "@element-plus/icons-vue";
 import { UploadFile, UploadFiles } from "element-plus";
+import env from "@/utils/setting";
 
 const props = defineProps<{ patNo?: string; times?: number; parent: string }>();
 const emits = defineEmits(["cyDialogConfirm", "cyDialogCancel"]);
@@ -16,7 +17,7 @@ function confirm() {
 }
 
 const bindUpload = {
-  action: `${import.meta.env.VITE_BASE_URL}/thyy/archive/upload`,
+  action: `${env.VITE_BASE_URL}/thyy/archive/upload`,
   headers: {
     token: localStorage.getItem("token"),
   },

+ 2 - 1
src/views/archive/index.tsx

@@ -10,6 +10,7 @@ import ArchiveUpload from "./ArchiveUpload.vue";
 import ArchiveAllLog from "@/views/archive/ArchiveAllLog.vue";
 import ArchiveRun from "@/views/archive/ArchiveRun.vue";
 import { ElButton, ElNotification } from "element-plus";
+import env from "@/utils/setting";
 
 type PatInfo = {
   inpatientNo: string;
@@ -128,7 +129,7 @@ export const useArchive = () => {
       store.patNo = split[0];
       store.times = XEUtils.toNumber(split[1]);
       socket.setUrl(
-        `${import.meta.env.VITE_SOCKET_V2}/archive/${store.patNo}-${store.times}-${useUserStore().userInfo.code}`
+        `${env.VITE_SOCKET_V2}/archive/${store.patNo}-${store.times}-${useUserStore().userInfo.code}`
       );
       const res = await getPatientAll(store.patNo, store.times);
       store.patInfo = res as any;

+ 337 - 194
src/views/clinic/DoctorInfoManagement.vue

@@ -2,21 +2,42 @@
   <div class="layout_container">
     <header>
       <el-select
-          placeholder="医生科室"
-          v-model="queryParam.deptCode"
-          filterable clearable
-          style="width: 150px"
+        placeholder="医生科室"
+        v-model="queryParam.deptCode"
+        filterable
+        clearable
+        style="width: 150px"
       >
-        <el-option v-for="item in allMzDepts" :key="item.code" :value="item.code" :label="item.name"></el-option>
+        <el-option
+          v-for="item in allMzDepts"
+          :key="item.code"
+          :value="item.code"
+          :label="item.name"
+        ></el-option>
       </el-select>
-      <el-input v-model="queryParam.doctorName" style="width: 120px" placeholder="医生姓名" clearable></el-input>
-      <el-checkbox v-model="queryParam.includeDeleted" style="margin-left: 4px">搜索已删除医生</el-checkbox>
+      <el-input
+        v-model="queryParam.doctorName"
+        style="width: 120px"
+        placeholder="医生姓名"
+        clearable
+      ></el-input>
+      <el-checkbox v-model="queryParam.includeDeleted" style="margin-left: 4px"
+        >搜索已删除医生
+      </el-checkbox>
       <el-divider direction="vertical"></el-divider>
-      <el-button type="primary" icon="Search" @click="fetchDoctors">查询</el-button>
-      <el-button type="primary" icon="Refresh" @click="resetSearch">重置</el-button>
+      <el-button type="primary" icon="Search" @click="fetchDoctors"
+        >查询
+      </el-button>
+      <el-button type="primary" icon="Refresh" @click="resetSearch"
+        >重置
+      </el-button>
       <el-divider direction="vertical"></el-divider>
-      <el-button icon="Top" @click="manageRecommendOrder">服务号推荐排序</el-button>
-      <el-button icon="Warning" type="danger" @click="refreshWxDoctorCache">刷新服务号医生数据</el-button>
+      <el-button icon="Top" @click="manageRecommendOrder"
+        >服务号推荐排序
+      </el-button>
+      <el-button icon="Warning" type="danger" @click="refreshWxDoctorCache"
+        >刷新服务号医生数据
+      </el-button>
     </header>
 
     <div class="layout_main layout_el-table">
@@ -29,33 +50,71 @@
         <el-table-column prop="titleName" label="级别"></el-table-column>
         <el-table-column label="服务号首页推荐">
           <template v-slot="scope">
-            <el-select v-model="scope.row.wxHomepageFlag" style="width: 100px" @change="(wxHomepageFlag) => handleSelectRec(scope.row.code, wxHomepageFlag)">
-              <el-option v-for="item in yesOrNo" :key="item.code" :value="item.code" :label="item.name"> </el-option>
+            <el-select
+              v-model="scope.row.wxHomepageFlag"
+              style="width: 100px"
+              @change="
+                wxHomepageFlag =>
+                  handleSelectRec(scope.row.code, wxHomepageFlag)
+              "
+            >
+              <el-option
+                v-for="item in yesOrNo"
+                :key="item.code"
+                :value="item.code"
+                :label="item.name"
+              ></el-option>
             </el-select>
           </template>
         </el-table-column>
         <el-table-column label="操作" width="300">
           <template v-slot="scope">
-            <el-button @click="viewDoctor(scope.row)" text icon="View" type="success">查看</el-button>
+            <el-button
+              @click="viewDoctor(scope.row)"
+              text
+              icon="View"
+              type="success"
+              >查看
+            </el-button>
             <el-divider direction="vertical"></el-divider>
-            <el-button @click="editDoctor(scope.row)" text icon="Edit" type="primary">编辑</el-button>
+            <el-button
+              @click="editDoctor(scope.row)"
+              text
+              icon="Edit"
+              type="primary"
+              >编辑
+            </el-button>
             <el-divider direction="vertical"></el-divider>
-            <el-button v-if="queryParam.includeDeleted" @click="undoDelete(scope.row)" text icon="Check" type="info">恢复</el-button>
-            <el-button v-else @click="beforeDelete(scope.row)" text icon="Delete" type="danger">删除</el-button>
+            <el-button
+              v-if="queryParam.includeDeleted"
+              @click="undoDelete(scope.row)"
+              text
+              icon="Check"
+              type="info"
+            >
+              恢复
+            </el-button>
+            <el-button
+              v-else
+              @click="beforeDelete(scope.row)"
+              text
+              icon="Delete"
+              type="danger"
+              >删除
+            </el-button>
           </template>
         </el-table-column>
       </el-table>
       <el-pagination
-          @size-change="handleSizeChange"
-          @current-change="handleCurrentChange"
-          :current-page="queryParam.currentPage"
-          :page-sizes="[20, 30, 50]"
-          :page-size="queryParam.pageSize"
-          layout="total, sizes, prev, pager, next, jumper"
-          :total="totalSize"
+        @size-change="handleSizeChange"
+        @current-change="handleCurrentChange"
+        :current-page="queryParam.currentPage"
+        :page-sizes="[20, 30, 50]"
+        :page-size="queryParam.pageSize"
+        layout="total, sizes, prev, pager, next, jumper"
+        :total="totalSize"
       ></el-pagination>
     </div>
-
   </div>
 
   <el-drawer title="" v-model="drawer" size="40%" :with-header="false">
@@ -64,70 +123,113 @@
       <div>
         医生头像:请上传一寸照
         <el-upload
-            class="upload-demo"
-            ref="upload"
-            :action="apiUrl + '/manageDoctorInfo/uploadPortrait'"
-            :headers="header"
-            :file-list="fileList"
-            :limit="1"
-            :data="{ code: doctor.code }"
-            :on-exceed="fileSizeOutLimit"
-            :before-upload="beforeAvatarUpload"
-            :on-success="uploadSuccess"
-            :on-error="uploadError"
-            :auto-upload="false"
+          class="upload-demo"
+          ref="upload"
+          :action="apiUrl + '/manageDoctorInfo/uploadPortrait'"
+          :headers="header"
+          :file-list="fileList"
+          :limit="1"
+          :data="{ code: doctor.code }"
+          :on-exceed="fileSizeOutLimit"
+          :before-upload="beforeAvatarUpload"
+          :on-success="uploadSuccess"
+          :on-error="uploadError"
+          :auto-upload="false"
         >
           <template #trigger>
             <el-button type="primary" icon="Picture">选取文件</el-button>
           </template>
-          <el-button style="margin-left: 10px" type="success" icon="Upload" @click="submitUpload">上传到服务器</el-button>
+          <el-button
+            style="margin-left: 10px"
+            type="success"
+            icon="Upload"
+            @click="submitUpload"
+            >上传到服务器
+          </el-button>
           <template #tip>
-            <div class="el-upload__tip">只能上传 jpg/png 文件,且不超过 500kb</div>
+            <div class="el-upload__tip">
+              只能上传 jpg/png 文件,且不超过 500kb
+            </div>
           </template>
         </el-upload>
       </div>
       <div style="margin-top: 130px">
         <span class="require">*</span>
-        医生编号:<el-input class="w200" v-model="doctor.code" disabled></el-input>
+        医生编号:
+        <el-input class="w200" v-model="doctor.code" disabled></el-input>
       </div>
       <div>
         <span class="require">*</span>
-        医生姓名:<el-input class="w200" v-model="doctor.name"></el-input>
+        医生姓名:
+        <el-input class="w200" v-model="doctor.name"></el-input>
       </div>
       <div>
         <span class="require">*</span>
         医生性别:
         <el-select v-model="doctor.sex" class="w200">
-          <el-option v-for="item in sexCodes" :key="item.code" :label="item.name" :value="item.code"></el-option>
+          <el-option
+            v-for="item in sexCodes"
+            :key="item.code"
+            :label="item.name"
+            :value="item.code"
+          ></el-option>
         </el-select>
       </div>
       <div>
         <span class="require">*</span>
         所属科室:
         <el-select v-model="doctor.deptCode" class="w200" clearable filterable>
-          <el-option v-for="item in allMzDepts" :key="item.code" :label="item.name" :value="item.code"></el-option>
+          <el-option
+            v-for="item in allMzDepts"
+            :key="item.code"
+            :label="item.name"
+            :value="item.code"
+          ></el-option>
         </el-select>
       </div>
       <div>
         <span class="require">*</span>
         医生职称:
         <el-select v-model="doctor.titleCode" class="w200" clearable filterable>
-          <el-option v-for="item in allTitles" :key="item.code" :label="item.name" :value="item.code"></el-option>
+          <el-option
+            v-for="item in allTitles"
+            :key="item.code"
+            :label="item.name"
+            :value="item.code"
+          ></el-option>
         </el-select>
       </div>
       <div style="height: max-content; margin-top: 15px">
         <span class="require">*</span>
         医生擅长:
-        <el-input class="w350" style="font-size: 13px" type="textarea" rows="3" maxlength="100" show-word-limit v-model="doctor.specialty"></el-input>
+        <el-input
+          class="w350"
+          style="font-size: 13px"
+          type="textarea"
+          rows="3"
+          maxlength="100"
+          show-word-limit
+          v-model="doctor.specialty"
+        ></el-input>
       </div>
       <div style="height: max-content; margin-top: 15px">
         <span>&nbsp;&nbsp;</span>
         医生介绍:
-        <el-input class="w350" style="font-size: 13px" type="textarea" rows="7" maxlength="300" show-word-limit v-model="doctor.introduction"></el-input>
+        <el-input
+          class="w350"
+          style="font-size: 13px"
+          type="textarea"
+          rows="7"
+          maxlength="300"
+          show-word-limit
+          v-model="doctor.introduction"
+        ></el-input>
       </div>
       <div style="margin-top: 15px">
         <span>&nbsp;&nbsp;</span>
-        <el-button type="primary" @click="saveDoctor" icon="Money">保存</el-button>
+        <el-button type="primary" @click="saveDoctor" icon="Money"
+          >保存
+        </el-button>
         <el-button plain @click="drawer = false" icon="Close">取消</el-button>
       </div>
     </div>
@@ -135,12 +237,24 @@
       <div style="height: 80px; width: 100%; background: #36af6b"></div>
       <div>
         <div class="inline pl15">
-          <el-avatar src="https://empty" shape="circle" style="width: 88px; height: 120px; margin-top: -60px" @error="avatarError">
+          <el-avatar
+            src="https://empty"
+            shape="circle"
+            style="width: 88px; height: 120px; margin-top: -60px"
+            @error="avatarError"
+          >
             <img :src="'data:image/png;base64,' + doctor.portrait" />
           </el-avatar>
         </div>
         <div class="inline child-pl15" style="width: calc(100% - 150px)">
-          <div style="margin-top: -30px; font-size: 16px; font-weight: bold; color: white">
+          <div
+            style="
+              margin-top: -30px;
+              font-size: 16px;
+              font-weight: bold;
+              color: white;
+            "
+          >
             {{ doctor.name }}
           </div>
           <div class="doctor-info">
@@ -162,8 +276,16 @@
     </div>
   </el-drawer>
   <el-dialog title="服务号推荐排序" width="60%" v-model="manageOrderDialog">
-    <el-table :data="recommendDoctors" stripe highlight-current-row height="600px">
-      <el-table-column prop="wxHomepageOrder" label="当前排序"></el-table-column>
+    <el-table
+      :data="recommendDoctors"
+      stripe
+      highlight-current-row
+      height="600px"
+    >
+      <el-table-column
+        prop="wxHomepageOrder"
+        label="当前排序"
+      ></el-table-column>
       <el-table-column prop="code" label="编号"></el-table-column>
       <el-table-column prop="name" label="姓名"></el-table-column>
       <el-table-column prop="sexName" label="性别"></el-table-column>
@@ -171,7 +293,13 @@
       <el-table-column prop="titleName" label="级别"></el-table-column>
       <el-table-column label="操作">
         <template v-slot="scope">
-          <el-button type="primary" plain icon="Edit" @click="modifyOrder(scope.row)">修改排序</el-button>
+          <el-button
+            type="primary"
+            plain
+            icon="Edit"
+            @click="modifyOrder(scope.row)"
+            >修改排序
+          </el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -179,7 +307,7 @@
 </template>
 
 <script setup name="DoctorInfoManagement">
-import { onMounted, reactive, ref } from 'vue'
+import { onMounted, reactive, ref } from "vue";
 import {
   updateDoctorStatus,
   getAllDoctors,
@@ -190,217 +318,223 @@ import {
   saveDoctorInfo,
   updateDoctorWxHomepageFlag,
   updateWxHomepageOrder,
-} from '@/api/manage-doctor-info'
-import { ElMessage, ElMessageBox } from 'element-plus'
-import axios from 'axios'
+} from "@/api/manage-doctor-info";
+import { ElMessage, ElMessageBox } from "element-plus";
+import axios from "axios";
+import env from "@/utils/setting";
 
-const apiUrl = import.meta.env.VITE_BASE_URL
-const allTitles = ref([])
-const allMzDepts = ref([])
-const allDoctors = ref([])
-const totalSize = ref(0)
+const apiUrl = env.VITE_BASE_URL;
+const allTitles = ref([]);
+const allMzDepts = ref([]);
+const allDoctors = ref([]);
+const totalSize = ref(0);
 const yesOrNo = [
-  { code: 1, name: '推荐' },
-  { code: 0, name: '不推荐' },
-]
+  { code: 1, name: "推荐" },
+  { code: 0, name: "不推荐" },
+];
 const sexCodes = [
-  { code: 1, name: '男' },
-  { code: 2, name: '女' },
-  { code: 9, name: '未知' },
-]
+  { code: 1, name: "男" },
+  { code: 2, name: "女" },
+  { code: 9, name: "未知" },
+];
 
 const queryParam = reactive({
-  deptCode: '',
-  doctorName: '',
+  deptCode: "",
+  doctorName: "",
   includeDeleted: false,
   currentPage: 1,
   pageSize: 20,
-})
+});
 
-const handleSizeChange = (val) => {
-  queryParam.pageSize = val
-  fetchDoctors()
-}
-const handleCurrentChange = (val) => {
-  queryParam.currentPage = val
-  fetchDoctors()
-}
+const handleSizeChange = val => {
+  queryParam.pageSize = val;
+  fetchDoctors();
+};
+const handleCurrentChange = val => {
+  queryParam.currentPage = val;
+  fetchDoctors();
+};
 
 const resetSearch = () => {
-  queryParam.deptCode = queryParam.doctorName = ''
-  fetchDoctors()
-}
+  queryParam.deptCode = queryParam.doctorName = "";
+  fetchDoctors();
+};
 
 const handleSelectRec = (code, flag) => {
   updateDoctorWxHomepageFlag(code, flag).then(() => {
-    const message = flag === 1 ? '已在微信服务号首页推荐此医生。' : '已取消此医生在微信服务号首页的推荐。'
-    const type = flag === 1 ? 'success' : 'warning'
+    const message =
+      flag === 1
+        ? "已在微信服务号首页推荐此医生。"
+        : "已取消此医生在微信服务号首页的推荐。";
+    const type = flag === 1 ? "success" : "warning";
     ElMessage({
       message,
       type,
       duration: 3000,
       showClose: true,
-    })
-  })
-}
+    });
+  });
+};
 
-const viewDoctor = (val) => {
-  getDoctorInfo(val.code).then((res) => {
-    doctor.value = res
-    edit.value = false
-    drawer.value = true
-  })
-}
-const editDoctor = (val) => {
-  getDoctorInfo(val.code).then((res) => {
-    doctor.value = res
-    edit.value = true
-    drawer.value = true
-  })
-}
+const viewDoctor = val => {
+  getDoctorInfo(val.code).then(res => {
+    doctor.value = res;
+    edit.value = false;
+    drawer.value = true;
+  });
+};
+const editDoctor = val => {
+  getDoctorInfo(val.code).then(res => {
+    doctor.value = res;
+    edit.value = true;
+    drawer.value = true;
+  });
+};
 
-const doctor = ref({})
+const doctor = ref({});
 const editStyle = {
-  padding: '0 15px 15px 50px',
-  height: window.innerHeight + 'px',
-  overflowY: 'scroll',
-}
-const edit = ref(true)
-const drawer = ref(false)
+  padding: "0 15px 15px 50px",
+  height: window.innerHeight + "px",
+  overflowY: "scroll",
+};
+const edit = ref(true);
+const drawer = ref(false);
 
-const fileList = ref([])
+const fileList = ref([]);
 
-const beforeAvatarUpload = (file) => {
-  const isJPG = file.type === 'image/jpeg' || file.type === 'image/png'
-  const isLt1M = file.size / 1024 / 1024 < 1
+const beforeAvatarUpload = file => {
+  const isJPG = file.type === "image/jpeg" || file.type === "image/png";
+  const isLt1M = file.size / 1024 / 1024 < 1;
   if (!isJPG) {
-    ElMessage.error('上传头像图片只能是 jpg 或 png 格式!')
+    ElMessage.error("上传头像图片只能是 jpg 或 png 格式!");
   }
   if (!isLt1M) {
-    ElMessage.error('上传头像图片大小不能超过 1MB!')
+    ElMessage.error("上传头像图片大小不能超过 1MB!");
   }
-  return isJPG && isLt1M
-}
+  return isJPG && isLt1M;
+};
 
-const upload = ref(null)
+const upload = ref(null);
 const header = {
   token: localStorage.token,
-}
+};
 const submitUpload = () => {
-  upload.value.submit()
-}
+  upload.value.submit();
+};
 const fileSizeOutLimit = () => {
-  ElMessage.error('已经选取头像,如须更换请先移除已选取的头像!')
-}
+  ElMessage.error("已经选取头像,如须更换请先移除已选取的头像!");
+};
 const uploadSuccess = () => {
-  ElMessage.success('上传成功!')
-}
+  ElMessage.success("上传成功!");
+};
 const uploadError = () => {
-  ElMessage.error('上传失败!')
-}
+  ElMessage.error("上传失败!");
+};
 
 const saveDoctor = () => {
   saveDoctorInfo(doctor.value).then(() => {
-    ElMessage.success('保存成功')
-  })
-}
+    ElMessage.success("保存成功");
+  });
+};
 
 const avatarError = () => {
-  return true
-}
+  return true;
+};
 
-const manageOrderDialog = ref(false)
-const recommendDoctors = ref([])
+const manageOrderDialog = ref(false);
+const recommendDoctors = ref([]);
 const manageRecommendOrder = () => {
-  getAllRecommendDoctors().then((res) => {
-    recommendDoctors.value = res
-    manageOrderDialog.value = true
-  })
-}
-const modifyOrder = (val) => {
-  ElMessageBox.prompt('请输入新序号', '提示', {
-    confirmButtonText: '确定',
-    cancelButtonText: '取消',
+  getAllRecommendDoctors().then(res => {
+    recommendDoctors.value = res;
+    manageOrderDialog.value = true;
+  });
+};
+const modifyOrder = val => {
+  ElMessageBox.prompt("请输入新序号", "提示", {
+    confirmButtonText: "确定",
+    cancelButtonText: "取消",
     inputPattern: /^[1-9]\d*$/,
-    inputErrorMessage: '请输入大于0的整数',
+    inputErrorMessage: "请输入大于0的整数",
   })
     .then(({ value }) => {
       updateWxHomepageOrder(val.code, value).then(() => {
-        val.wxHomepageOrder = value
+        val.wxHomepageOrder = value;
         ElMessage({
-          message: '保存排序成功',
-          type: 'success',
+          message: "保存排序成功",
+          type: "success",
           duration: 2000,
           showClose: true,
-        })
-      })
+        });
+      });
     })
-    .catch(() => {})
-}
+    .catch(() => {});
+};
 
 const refreshWxDoctorCache = () => {
-  axios('http://192.168.200.3/wxserver/homepage/refreshHomePageDoctors').then((res) => {
-    if (res.data.code === 200) {
-      ElMessage({
-        message: '强制刷新成功',
-        type: 'success',
-        duration: 2000,
-        showClose: true,
-      })
-    } else {
-      ElMessage.error(res.data.message)
+  axios("http://192.168.200.3/wxserver/homepage/refreshHomePageDoctors").then(
+    res => {
+      if (res.data.code === 200) {
+        ElMessage({
+          message: "强制刷新成功",
+          type: "success",
+          duration: 2000,
+          showClose: true,
+        });
+      } else {
+        ElMessage.error(res.data.message);
+      }
     }
-  })
-}
+  );
+};
 
-const undoDelete = (row) => {
-  updateDoctorStatus(row.code, 1).then((res) => {
+const undoDelete = row => {
+  updateDoctorStatus(row.code, 1).then(res => {
     ElMessage({
       message: res,
-      type: 'success',
+      type: "success",
       duration: 2000,
       showClose: true,
-    })
-    fetchDoctors()
-  })
-}
+    });
+    fetchDoctors();
+  });
+};
 
-const beforeDelete = (row) => {
-  ElMessageBox.confirm('删除后将无法在服务号首页推荐,是否确认删除?', '提示', {
-    type: 'warning',
-    confirmButtonText: '删除',
-    cancelButtonText: '取消',
+const beforeDelete = row => {
+  ElMessageBox.confirm("删除后将无法在服务号首页推荐,是否确认删除?", "提示", {
+    type: "warning",
+    confirmButtonText: "删除",
+    cancelButtonText: "取消",
   })
     .then(() => {
-      updateDoctorStatus(row.code, 0).then((res) => {
+      updateDoctorStatus(row.code, 0).then(res => {
         ElMessage({
           message: res,
-          type: 'success',
+          type: "success",
           duration: 2000,
           showClose: true,
-        })
-        fetchDoctors()
-      })
+        });
+        fetchDoctors();
+      });
     })
-    .catch(() => {})
-}
+    .catch(() => {});
+};
 
 const fetchDoctors = () => {
-  getAllDoctors(queryParam).then((res) => {
-    totalSize.value = res.totalSize
-    allDoctors.value = res.list
-  })
-}
+  getAllDoctors(queryParam).then(res => {
+    totalSize.value = res.totalSize;
+    allDoctors.value = res.list;
+  });
+};
 
 onMounted(() => {
-  getAllTitles().then((res) => {
-    allTitles.value = res
-  })
-  getAllMzDept().then((res) => {
-    allMzDepts.value = res
-    fetchDoctors()
-  })
-})
+  getAllTitles().then(res => {
+    allTitles.value = res;
+  });
+  getAllMzDept().then(res => {
+    allMzDepts.value = res;
+    fetchDoctors();
+  });
+});
 </script>
 
 <style scoped>
@@ -408,36 +542,45 @@ onMounted(() => {
   display: inline-block;
   vertical-align: top;
 }
+
 .pl15 {
   padding-left: 50px;
 }
+
 .child-pl15 > div {
   padding: 0 50px 0 15px;
 }
+
 .doctor-info,
 .edit-doctor-info {
   font-size: 13px;
   color: gray;
   margin-top: 15px;
 }
+
 .doctor-info > div {
   height: 30px;
   line-height: 30px;
 }
+
 .edit-doctor-info > div {
   height: 35px;
   line-height: 35px;
 }
+
 .info-title {
   margin-top: 15px;
   color: #333333;
 }
+
 .require {
   color: #db4242;
 }
+
 .w200 {
   width: 200px;
 }
+
 .w350 {
   width: 75%;
 }

+ 261 - 201
src/views/clinic/chronicDisease/ChronicDiseaseQuestionnaire.vue

@@ -1,10 +1,10 @@
 <template>
-  <el-row :gutter="5" style="height: 100%;">
-    <el-col :span="8" style="height: auto;">
+  <el-row :gutter="5" style="height: 100%">
+    <el-col :span="8" style="height: auto">
       <PageLayer>
         <template #main class="hd-cl">
           <el-row :gutter="5">
-            <el-descriptions :column="2" border style="width:100%;">
+            <el-descriptions :column="2" border style="width: 100%">
               <el-descriptions-item label="门诊号" width="15%">
                 {{ crmEmrPatientVo.hisMzNo }}
               </el-descriptions-item>
@@ -14,24 +14,26 @@
             </el-descriptions>
           </el-row>
           <el-row :gutter="5">
-            <el-descriptions :column="1" border style="width:100%;">
+            <el-descriptions :column="1" border style="width: 100%">
               <el-descriptions-item label="证件号" width="30%">
                 {{ crmEmrPatientVo.socialNo }}
               </el-descriptions-item>
             </el-descriptions>
           </el-row>
           <el-row :gutter="5">
-            <el-descriptions :column="1" border style="width:100%;">
+            <el-descriptions :column="1" border style="width: 100%">
               <el-descriptions-item label="慢病类型" width="30%">
                 {{
-                  crmEmrPatientVo.chronicDiseaseName.substring(0,
-                      crmEmrPatientVo.chronicDiseaseName.lastIndexOf(","))
+                  crmEmrPatientVo.chronicDiseaseName.substring(
+                    0,
+                    crmEmrPatientVo.chronicDiseaseName.lastIndexOf(",")
+                  )
                 }}
               </el-descriptions-item>
             </el-descriptions>
           </el-row>
           <el-row :gutter="5">
-            <el-descriptions :column="2" border style="width:100%;">
+            <el-descriptions :column="2" border style="width: 100%">
               <el-descriptions-item label="姓名" width="15%">
                 {{ crmEmrPatientVo.pName }}
               </el-descriptions-item>
@@ -41,86 +43,120 @@
             </el-descriptions>
           </el-row>
           <el-row :gutter="5">
-            <el-descriptions :column="2" border style="width:100%;">
+            <el-descriptions :column="2" border style="width: 100%">
               <el-descriptions-item label="性别" width="15%">
                 {{ crmEmrPatientVo.sexValue }}
               </el-descriptions-item>
               <el-descriptions-item label="年龄" width="15%">
-                {{ crmEmrPatientVo.age === null ? '' : crmEmrPatientVo.age + '岁' }}
+                {{
+                  crmEmrPatientVo.age === null ? "" : crmEmrPatientVo.age + "岁"
+                }}
               </el-descriptions-item>
             </el-descriptions>
           </el-row>
-          <el-row :gutter="5" style="padding-top: 5px;">
-            <el-tabs type="border-card" v-model="tabType" class="small_tabs" @tab-click="queryCrmEmdrData"
-                     style="width:100%;">
+          <el-row :gutter="5" style="padding-top: 5px">
+            <el-tabs
+              type="border-card"
+              v-model="tabType"
+              class="small_tabs"
+              @tab-click="queryCrmEmdrData"
+              style="width: 100%"
+            >
               <el-tab-pane label="慢病模板" name="0">
                 <el-table :data="emrTemplateData" @row-click="rowClick">
-                  <el-table-column type="index" label="序号" width="50"></el-table-column>
+                  <el-table-column
+                    type="index"
+                    label="序号"
+                    width="50"
+                  ></el-table-column>
                   <el-table-column label="名称" prop="name"></el-table-column>
                 </el-table>
               </el-tab-pane>
               <el-tab-pane label="历史模板" name="3">
-                <el-input v-model="filterText" placeholder="搜索" style="width: 100%;">
+                <el-input
+                  v-model="filterText"
+                  placeholder="搜索"
+                  style="width: 100%"
+                >
                   <template #prepend>关键字</template>
                 </el-input>
-                <el-tree style="width: 100%;" ref="treeRef" class="filter-tree" :data="treeData"
-                         :props="defaultProps" @node-click="handleNodeClick" node-key="id" highlight-current
-                         default-expand-all :filter-node-method="filterNode"/>
+                <el-tree
+                  style="width: 100%"
+                  ref="treeRef"
+                  class="filter-tree"
+                  :data="treeData"
+                  :props="defaultProps"
+                  @node-click="handleNodeClick"
+                  node-key="id"
+                  highlight-current
+                  default-expand-all
+                  :filter-node-method="filterNode"
+                />
               </el-tab-pane>
             </el-tabs>
           </el-row>
         </template>
       </PageLayer>
     </el-col>
-    <el-col :span="16" style="height: auto;">
+    <el-col :span="16" style="height: auto">
       <PageLayer>
         <template #header class="hd-cl">
-          <el-input v-model="textCode" placeholder="请输入证件号/门诊号/住院号" style="width: 320px;">
+          <el-input
+            v-model="textCode"
+            placeholder="请输入证件号/门诊号/住院号"
+            style="width: 320px"
+          >
             <template #prepend>关键字</template>
           </el-input>
-          <el-button type="primary" icon="Search" @click="selectCrmPatientMiByCode" style="margin-left: 10px">查询
+          <el-button
+            type="primary"
+            icon="Search"
+            @click="selectCrmPatientMiByCode"
+            style="margin-left: 10px"
+            >查询
           </el-button>
           <el-button type="success" @click="saveData">保存</el-button>
-          <el-button icon="Printer" type="primary" @click="handlePrint"> 打印</el-button>
+          <el-button icon="Printer" type="primary" @click="handlePrint">
+            打印
+          </el-button>
         </template>
         <template #main>
-          <div ref="emrDivRef" style="width: 100% ; height: 100%">
-          </div>
+          <div ref="emrDivRef" style="width: 100%; height: 100%"></div>
         </template>
       </PageLayer>
     </el-col>
   </el-row>
 </template>
 <script setup lang="ts">
-import {onMounted, ref, nextTick, watch, onActivated, onUnmounted} from "vue";
-import PageLayer from '@/layout/PageLayer.vue'
-import {useEmrInit, UseEmrInitReturn} from "@/utils/emr/emr-init-v2";
+import { onMounted, ref, nextTick, watch, onActivated, onUnmounted } from "vue";
+import PageLayer from "@/layout/PageLayer.vue";
+import { useEmrInit, UseEmrInitReturn } from "@/utils/emr/emr-init-v2";
 import {
   getCrmEmrModel,
   queryCrmEmrTree,
   queryCrmPatientInfoByCode,
-  saveCrmEmrModel
+  saveCrmEmrModel,
 } from "@/api/chronic-disease/chronic-disease-questionnaire";
-import {ElMessageBox, ElTree, ElMessage} from 'element-plus'
-import {stringIsBlank} from "@/utils/blank-utils";
-import {getServerDateApi, getUuid} from "@/api/public-api";
+import { ElMessageBox, ElTree, ElMessage } from "element-plus";
+import { stringIsBlank } from "@/utils/blank-utils";
+import { getServerDateApi, getUuid } from "@/api/public-api";
 import router from "@/router";
-import {useCompRef} from "@/utils/useCompRef";
-import {onDeactivated} from "@vue/runtime-core";
-import {xcMessage} from "@/utils/xiaochan-element-plus";
-import {useUserStore} from "@/pinia/user-store";
+import { useCompRef } from "@/utils/useCompRef";
+import { onDeactivated } from "@vue/runtime-core";
+import { xcMessage } from "@/utils/xiaochan-element-plus";
+import { useUserStore } from "@/pinia/user-store";
+import env from "@/utils/setting";
 
-const userInfo = useUserStore().userInfo
+const userInfo = useUserStore().userInfo;
 
-const textCode = ref('')
-const tabType = ref('0')
+const textCode = ref("");
+const tabType = ref("0");
 
 const emrEvent = {
-  'contextUpdate': (evt, contextMap, component, context) => {
-    const element = component.getAttribute('element')
-  }
-}
-
+  contextUpdate: (evt, contextMap, component, context) => {
+    const element = component.getAttribute("element");
+  },
+};
 
 export interface Property {
   editorVersion?: string;
@@ -138,7 +174,7 @@ export interface Version {
 }
 
 export interface emrTemplateType {
-  documentId?: string,
+  documentId?: string;
   parent?: string;
   code?: string;
   versions?: Version[];
@@ -150,59 +186,60 @@ export interface emrTemplateType {
   labels?: string[];
 }
 
-const emrTemplateData = ref<emrTemplateType[]>()
-const emrTemplateEditData = ref<emrTemplateType[]>()
-const emrDivRef = ref<HTMLDivElement>()
+const emrTemplateData = ref<emrTemplateType[]>();
+const emrTemplateEditData = ref<emrTemplateType[]>();
+const emrDivRef = ref<HTMLDivElement>();
 let editor: UseEmrInitReturn;
-const selectionStatus = ref(false)
-const categoryCode = ref<string>('')
-const mzEmrName = ref<string>('')
-const parent = ref<string>('')
+const selectionStatus = ref(false);
+const categoryCode = ref<string>("");
+const mzEmrName = ref<string>("");
+const parent = ref<string>("");
 
 const rowClick = async (row: emrTemplateType) => {
-  selectionStatus.value = true
-  categoryCode.value = row.code as string
-  mzEmrName.value = row.name as string
-  parent.value = row.parent as string
-  if (tabType.value == '0') {
+  selectionStatus.value = true;
+  categoryCode.value = row.code as string;
+  mzEmrName.value = row.name as string;
+  parent.value = row.parent as string;
+  if (tabType.value == "0") {
     await editor.loadAndSetDocument({
       categoryId: row._id,
       categoryCode: row.code,
-    })
+    });
   } else {
     await editor.loadAndSetDocument({
-      documentId: row.documentId
-    })
+      documentId: row.documentId,
+    });
   }
-  editor.editor.setEditorMode('form')
-}
+  editor.editor.setEditorMode("form");
+};
 
 const saveData = () => {
   const validator = editor.editor.getValidator();
   const valid = validator.valid(true);
 
   if (valid) {
-    xcMessage.error('请检查必填项或者填写值是否正确!')
-    return
+    xcMessage.error("请检查必填项或者填写值是否正确!");
+    return;
   }
 
-  if (!((tabType.value == '0' || tabType.value == '2') && selectionStatus.value)) {
-    return ElMessage.error('请选择数据,只有慢病模板才能保存!')
+  if (
+    !((tabType.value == "0" || tabType.value == "2") && selectionStatus.value)
+  ) {
+    return ElMessage.error("请选择数据,只有慢病模板才能保存!");
   }
-  ElMessageBox.confirm('请确认是否保存', {
-    cancelButtonText: '取消',
-    confirmButtonText: '确定',
+  ElMessageBox.confirm("请确认是否保存", {
+    cancelButtonText: "取消",
+    confirmButtonText: "确定",
   })
-      .then(() => {
-        clickSaveData()
-      })
-      .catch(() => {
-      })
-}
+    .then(() => {
+      clickSaveData();
+    })
+    .catch(() => {});
+};
 
 const clickSaveData = async () => {
   // 解析 id
-  let id = await analysisIframeSrcSearch()
+  let id = await analysisIframeSrcSearch();
   let data: any = {
     pId: crmEmrPatientVo.value.pId,
     pType: crmEmrPatientVo.value.pType,
@@ -214,218 +251,241 @@ const clickSaveData = async () => {
     parent: parent.value,
     inputId: crmEmrPatientVo.value.userIdCode,
     inputDept: crmEmrPatientVo.value.deptCode,
-    documentData: null
-  }
+    documentData: null,
+  };
   let newDate = await getServerDateApi();
   const document = editor.editor.getDocument();
 
-  document.properties.categoryCode = data.emrCategoryCode
+  document.properties.categoryCode = data.emrCategoryCode;
   document.properties.patientId = data.pId + "-" + data.visitTimes;
-  document._id = data.emrDocumentId
-  data.documentData = document
+  document._id = data.emrDocumentId;
+  data.documentData = document;
 
   if (document.properties.creator) {
-    document.properties.modifier = crmEmrPatientVo.value.userIdCode
-    document.properties.modifierId = crmEmrPatientVo.value.userName
-    document.properties.modifyTime = newDate
+    document.properties.modifier = crmEmrPatientVo.value.userIdCode;
+    document.properties.modifierId = crmEmrPatientVo.value.userName;
+    document.properties.modifyTime = newDate;
   } else {
-    document.properties.creator = crmEmrPatientVo.value.userIdCode
-    document.properties.creatorId = crmEmrPatientVo.value.userName
-    document.properties.createTime = newDate
+    document.properties.creator = crmEmrPatientVo.value.userIdCode;
+    document.properties.creatorId = crmEmrPatientVo.value.userName;
+    document.properties.createTime = newDate;
   }
   saveCrmEmrModel(data).then((res: any) => {
-    selectCrmPatientMiByCode()
-    queryCrmEmdrData(null, null)
-  })
-
-}
+    selectCrmPatientMiByCode();
+    queryCrmEmdrData(null, null);
+  });
+};
 
 const analysisIframeSrcSearch = async () => {
-  let id = getId()
-  let temp: string
+  let id = getId();
+  let temp: string;
   if (stringIsBlank(id)) {
     // 这个是 唯一 id 调用服务的雪花算法
-    temp = await getUuid()
+    temp = await getUuid();
   } else {
-    temp = id
+    temp = id;
   }
-  return temp
-}
+  return temp;
+};
 
 const getId = () => {
   if (editor) {
-    return editor.editor.documentData._id
+    return editor.editor.documentData._id;
   }
-  return null
-}
-
+  return null;
+};
 
 const appContext = () => {
   return {
     endpoints: {
       app: "http://172.16.32.160:9205/thyy/api/dataEmr/comp",
-      his: import.meta.env.VITE_BASE_URL,
+      his: env.VITE_BASE_URL,
     },
     input: {
       user: userInfo.code,
-      name: userInfo.name
+      name: userInfo.name,
     },
     userCode: userInfo.code,
     login: {
       token: localStorage.token,
       user: {
         id: userInfo.code,
-        name: userInfo.name
-      }
+        name: userInfo.name,
+      },
     },
     data: {
-      '姓名': crmEmrPatientVo.value.pName,
-      '性别': [{code: crmEmrPatientVo.value.sex, name: crmEmrPatientVo.value.sexValue}],
-      '年龄': crmEmrPatientVo.value.age,
-      '电话号码': crmEmrPatientVo.value.relTel,
-      '住址': crmEmrPatientVo.value.detailAdress,
-      '身份证号码': crmEmrPatientVo.value.socialNo,
-      '家属电话': crmEmrPatientVo.value.relNameTel,
-      '首次建卡时间': crmEmrPatientVo.value.createDate,
-      '随访医生': [{code: crmEmrPatientVo.value.userIdCode, name: crmEmrPatientVo.value.userName}],
-      '病人来源': [{code: crmEmrPatientVo.value.pType, name: crmEmrPatientVo.value.ptName}],
-      '管理医生': [{code: crmEmrPatientVo.value.referPhysician, name: crmEmrPatientVo.value.referPhysicianName}],
-      '建卡医生': [{code: crmEmrPatientVo.value.creatId, name: crmEmrPatientVo.value.creatIdName}],
-    }
-  }
-}
+      姓名: crmEmrPatientVo.value.pName,
+      性别: [
+        {
+          code: crmEmrPatientVo.value.sex,
+          name: crmEmrPatientVo.value.sexValue,
+        },
+      ],
+      年龄: crmEmrPatientVo.value.age,
+      电话号码: crmEmrPatientVo.value.relTel,
+      住址: crmEmrPatientVo.value.detailAdress,
+      身份证号码: crmEmrPatientVo.value.socialNo,
+      家属电话: crmEmrPatientVo.value.relNameTel,
+      首次建卡时间: crmEmrPatientVo.value.createDate,
+      随访医生: [
+        {
+          code: crmEmrPatientVo.value.userIdCode,
+          name: crmEmrPatientVo.value.userName,
+        },
+      ],
+      病人来源: [
+        {
+          code: crmEmrPatientVo.value.pType,
+          name: crmEmrPatientVo.value.ptName,
+        },
+      ],
+      管理医生: [
+        {
+          code: crmEmrPatientVo.value.referPhysician,
+          name: crmEmrPatientVo.value.referPhysicianName,
+        },
+      ],
+      建卡医生: [
+        {
+          code: crmEmrPatientVo.value.creatId,
+          name: crmEmrPatientVo.value.creatIdName,
+        },
+      ],
+    },
+  };
+};
 
 const handlePrint = () => {
   editor.editor.execute("print", {
     value: {
       showPreview: false,
-    }
-  })
-}
-
+    },
+  });
+};
 
 const crmEmrPatientVo = ref<any>({
-  pId: '',
-  pType: '',
-  hisMzNo: '',
-  hisZyNo: '',
+  pId: "",
+  pType: "",
+  hisMzNo: "",
+  hisZyNo: "",
   visitTimes: null,
-  userIdCode: '',
-  userName: '',
-  deptCode: '',
-  deptName: '',
-  pName: '',
-  sex: '',
-  sexValue: '',
+  userIdCode: "",
+  userName: "",
+  deptCode: "",
+  deptName: "",
+  pName: "",
+  sex: "",
+  sexValue: "",
   age: null,
-  relTel: '',
-  socialNo: '',
-  relNameTel: '',
-  chronicDiseaseName: '',
-  detailAdress: '',
-  createDate: '',
-  ptName: '',
+  relTel: "",
+  socialNo: "",
+  relNameTel: "",
+  chronicDiseaseName: "",
+  detailAdress: "",
+  createDate: "",
+  ptName: "",
   type: null,
-  referPhysician: '',
-  referPhysicianName: '',
-  creatId: '',
-  creatIdName: '',
-})
+  referPhysician: "",
+  referPhysicianName: "",
+  creatId: "",
+  creatIdName: "",
+});
 
-const treeData = ref<Tree[]>()
+const treeData = ref<Tree[]>();
 
 const selectCrmPatientMiByCode = () => {
   queryCrmPatientInfoByCode(textCode.value).then((res: any) => {
-    crmEmrPatientVo.value = res
+    crmEmrPatientVo.value = res;
     router.push({
-      name: 'chronicDiseaseQuestionnaire',
+      name: "chronicDiseaseQuestionnaire",
       query: {
-        id: textCode.value
-      }
-    })
-  })
-}
+        id: textCode.value,
+      },
+    });
+  });
+};
 
 const queryCrmEmdrData = async (tab: any, event: any) => {
-  tabType.value = tab === null ? '0' : tab.props.name
-  let type = Number.parseInt(tabType.value)
-  selectionStatus.value = false
+  tabType.value = tab === null ? "0" : tab.props.name;
+  let type = Number.parseInt(tabType.value);
+  selectionStatus.value = false;
   if (type == 0) {
     await getCrmEmrModel().then((res: any) => {
-      let tem = [] as Array<emrTemplateType>
+      let tem = [] as Array<emrTemplateType>;
       if (res) {
         for (let i = 0; i < res.length; i++) {
           if (res[i].parent != null) {
-            tem.push(res[i])
+            tem.push(res[i]);
           }
         }
       }
-      emrTemplateData.value = tem
-    })
+      emrTemplateData.value = tem;
+    });
   } else {
-    crmEmrPatientVo.value['type'] = type
+    crmEmrPatientVo.value["type"] = type;
     queryCrmEmrTree(crmEmrPatientVo.value).then((res: any) => {
-      treeData.value = res
-    })
+      treeData.value = res;
+    });
   }
-}
+};
 
 interface Tree {
-  [key: string]: any
+  [key: string]: any;
 }
 
-const filterText = ref('')
-const treeRef = useCompRef(ElTree)
+const filterText = ref("");
+const treeRef = useCompRef(ElTree);
 
 const defaultProps = {
-  children: 'children',
-  label: 'name',
-}
+  children: "children",
+  label: "name",
+};
 
-watch(filterText, (val) => {
-  treeRef.value!.filter(val)
-})
+watch(filterText, val => {
+  treeRef.value!.filter(val);
+});
 
 const filterNode = (value: string, data: Tree) => {
-  if (!value) return true
-  return data.name.includes(value)
-}
+  if (!value) return true;
+  return data.name.includes(value);
+};
 
 const handleNodeClick = (node: any, object: any, event: any) => {
-  selectionStatus.value = true
-  editor.editor.setEditorMode('readonly')
+  selectionStatus.value = true;
+  editor.editor.setEditorMode("readonly");
   editor.loadAndSetDocument({
-    documentId: node.emrDocumentId
-  })
-}
+    documentId: node.emrDocumentId,
+  });
+};
 
-let tempDocument = null
+let tempDocument = null;
 
 onDeactivated(() => {
-  tempDocument = editor.editor.getDocument()
-})
+  tempDocument = editor.editor.getDocument();
+});
 
 onActivated(async () => {
-  const id = router.currentRoute.value.query.id as string
+  const id = router.currentRoute.value.query.id as string;
   if (id) {
     if (textCode.value !== id) {
-      tempDocument = null
+      tempDocument = null;
     }
-    textCode.value = id
-    selectCrmPatientMiByCode()
+    textCode.value = id;
+    selectCrmPatientMiByCode();
   }
-  await nextTick()
-  useEmrInit(emrDivRef.value, {appContext, event: emrEvent}).then((res: any) => {
-    editor = res
-    if (tempDocument) {
-      editor.editor.setDocument(tempDocument)
-      tempDocument = null
+  await nextTick();
+  useEmrInit(emrDivRef.value, { appContext, event: emrEvent }).then(
+    (res: any) => {
+      editor = res;
+      if (tempDocument) {
+        editor.editor.setDocument(tempDocument);
+        tempDocument = null;
+      }
     }
-  })
-})
+  );
+});
 
 onMounted(async () => {
-  await queryCrmEmdrData(null, null)
-})
-
+  await queryCrmEmdrData(null, null);
+});
 </script>

+ 243 - 206
src/views/dictionary/OprtDoctorLevel.vue

@@ -1,40 +1,46 @@
 <template>
   <div class="layout_container layout-horizontal">
-    <div class="m-r_8px  layout_container" style="width: max-content">
+    <div class="m-r_8px layout_container" style="width: max-content">
       <header>
         医生:
         <input-and-table
-            v-model="asideQueryParam.nameDoctor"
-            :data="doctorData"
-            :table-header="doctorHeader"
-            valueId="name"
-            clearable
-            @currentChange="doctorCurrentPage"
-            @fetchData="queryDoctorClick"
-            @rowClick="selectSzDoctorRowClick"
+          v-model="asideQueryParam.nameDoctor"
+          :data="doctorData"
+          :table-header="doctorHeader"
+          valueId="name"
+          clearable
+          @currentChange="doctorCurrentPage"
+          @fetchData="queryDoctorClick"
+          @rowClick="selectSzDoctorRowClick"
         />
-        <el-button icon="Search" type="primary" @click="queryInfo">查询</el-button>
+        <el-button icon="Search" type="primary" @click="queryInfo"
+          >查询
+        </el-button>
         <el-button type="success" @click="addInfo">添加</el-button>
-        <el-button type="primary" @click="centerDialogVisible=true">批量导入</el-button>
+        <el-button type="primary" @click="centerDialogVisible = true"
+          >批量导入
+        </el-button>
       </header>
       <div class="layout_main layout_el-table">
-        <el-table :data="asideTableData"
-                  highlight-current-row
-                  @row-click="selectDoctor">
+        <el-table
+          :data="asideTableData"
+          highlight-current-row
+          @row-click="selectDoctor"
+        >
           <el-table-column label="医生编码" prop="code"></el-table-column>
           <el-table-column label="医生工号" prop="codeDoctor"></el-table-column>
           <el-table-column label="医生姓名" prop="nameDoctor"></el-table-column>
         </el-table>
         <el-pagination
-            small
-            :current-page="asideQueryParam.currentPage"
-            :page-size="asideQueryParam.pageSize"
-            :page-sizes="[20, 30, 40, 50]"
-            :total="asideQueryParam.total"
-            layout="total, sizes, prev, pager, next, jumper"
-            style="margin-top: 5px"
-            @size-change="handleSizeChange"
-            @current-change="handleCurrentChange"
+          small
+          :current-page="asideQueryParam.currentPage"
+          :page-size="asideQueryParam.pageSize"
+          :page-sizes="[20, 30, 40, 50]"
+          :total="asideQueryParam.total"
+          layout="total, sizes, prev, pager, next, jumper"
+          style="margin-top: 5px"
+          @size-change="handleSizeChange"
+          @current-change="handleCurrentChange"
         ></el-pagination>
       </div>
     </div>
@@ -43,37 +49,74 @@
         <el-tag style="width: max-content"> 请选择要配置的手术</el-tag>
         <div>
           关键字:
-          <el-input v-model="leftQueryParam.code" placeholder="支持手术编码,名称,拼音" clearable
-                    prefix-icon="Search" style="width: 170px"/>
-          <el-button icon="Search" type="primary" @click="queryidc9Info">查询</el-button>
+          <el-input
+            v-model="leftQueryParam.code"
+            placeholder="支持手术编码,名称,拼音"
+            clearable
+            prefix-icon="Search"
+            style="width: 170px"
+          />
+          <el-button icon="Search" type="primary" @click="queryidc9Info"
+            >查询
+          </el-button>
         </div>
-        <el-table :data="leftTableData" @selection-change="handleSelectionChange" highlight-current-row>
-          <el-table-column type="selection" width="55"/>
+        <el-table
+          :data="leftTableData"
+          @selection-change="handleSelectionChange"
+          highlight-current-row
+        >
+          <el-table-column type="selection" width="55" />
           <el-table-column label="手术编码" prop="code"></el-table-column>
-          <el-table-column label="手术名称" prop="name" show-overflow-tooltip></el-table-column>
+          <el-table-column
+            label="手术名称"
+            prop="name"
+            show-overflow-tooltip
+          ></el-table-column>
         </el-table>
       </div>
       <div>
-        <div style="width: 5%;height:89%;display: flex;align-items: center">
-          <div style="width: 30px;height: 15px;padding-left: 12px;cursor: pointer;" @click="addRight"> <el-icon><ArrowRightBold /></el-icon></div>
+        <div style="width: 5%; height: 89%; display: flex; align-items: center">
+          <div
+            style="
+              width: 30px;
+              height: 15px;
+              padding-left: 12px;
+              cursor: pointer;
+            "
+            @click="addRight"
+          >
+            <el-icon>
+              <ArrowRightBold />
+            </el-icon>
+          </div>
         </div>
-        <el-divider direction="vertical" border-style="dashed" style="margin: 0 10px; height: 100%"></el-divider>
+        <el-divider
+          direction="vertical"
+          border-style="dashed"
+          style="margin: 0 10px; height: 100%"
+        ></el-divider>
       </div>
       <div class="layout_flex_1-x layout_el-table">
         <el-tag style="width: max-content"> 请选择要配置的手术</el-tag>
-        <el-button style="width: max-content" type="success" @click="saveInfo">保存</el-button>
+        <el-button style="width: max-content" type="success" @click="saveInfo"
+          >保存
+        </el-button>
         <el-table :data="mainTableData" highlight-current-row>
           <el-table-column label="手术编码" prop="codeOp"></el-table-column>
-          <el-table-column label="手术名称" prop="codeOpName" show-overflow-tooltip></el-table-column>
+          <el-table-column
+            label="手术名称"
+            prop="codeOpName"
+            show-overflow-tooltip
+          ></el-table-column>
           <el-table-column label="操作">
             <template #default="scope">
               <el-popconfirm
-                  cancel-button-text="取消"
-                  confirm-button-text="确认"
-                  icon="Info"
-                  iconColor="#F56C6C"
-                  title="是否删除"
-                  @confirm="delClick(scope.$index, scope.row)"
+                cancel-button-text="取消"
+                confirm-button-text="确认"
+                icon="Info"
+                iconColor="#F56C6C"
+                title="是否删除"
+                @confirm="delClick(scope.$index, scope.row)"
               >
                 <template #reference>
                   <el-button size="small" type="danger">删除</el-button>
@@ -86,29 +129,35 @@
     </div>
   </div>
   <el-dialog
-      v-model="centerDialogVisible"
-      title="批量导入"
-      width="500"
-      align-center
+    v-model="centerDialogVisible"
+    title="批量导入"
+    width="500"
+    align-center
   >
     <div>
       <el-upload
-          class="upload-demo"
-          ref="upload"
-          accept=".xlsx,.xls"
-          :action="apiUrl + '/opLevelManagement/uploadOpLevelManagement'"
-          :headers="header"
-          :file-list="fileList"
-          :limit="1"
-          :on-exceed="fileSizeOutLimit"
-          :on-success="uploadSuccess"
-          :on-error="uploadError"
-          :auto-upload="false"
+        class="upload-demo"
+        ref="upload"
+        accept=".xlsx,.xls"
+        :action="apiUrl + '/opLevelManagement/uploadOpLevelManagement'"
+        :headers="header"
+        :file-list="fileList"
+        :limit="1"
+        :on-exceed="fileSizeOutLimit"
+        :on-success="uploadSuccess"
+        :on-error="uploadError"
+        :auto-upload="false"
       >
         <template #trigger>
           <el-button type="primary" icon="Picture">选取文件</el-button>
         </template>
-        <el-button style="margin-left: 10px" type="success" icon="Upload" @click="submitUpload">上传</el-button>
+        <el-button
+          style="margin-left: 10px"
+          type="success"
+          icon="Upload"
+          @click="submitUpload"
+          >上传
+        </el-button>
         <template #tip>
           <div class="el-upload__tip">只能上传 xls/xlsx 文件</div>
         </template>
@@ -124,224 +173,212 @@
 
 <script setup name="OprtDoctorLevel">
 import InputAndTable from "@/components/input-table-query/InputAndTable";
-import {doctorHeader} from '@/data/input-table-header'
-import {getRenYuanPage} from "@/api/public-api";
+import { doctorHeader } from "@/data/input-table-header";
+import { getRenYuanPage } from "@/api/public-api";
 import {
   queryOpLevelManagement,
   saveOpLevelManagement,
   queryOprtInfo,
   getEmpCodeRs,
-  queryZdIcd9Cm3
-} from '@/api/dictionary/oprt-lecel'
-import {ElMessage} from 'element-plus'
-import PageLayer from "@/layout/PageLayer";
-import {ref} from "vue";
-import {useUserStore} from "@/pinia/user-store";
-import {formatYear} from "@/utils/date";
-
-const centerDialogVisible = ref(false)
-
-const fileList = ref([])
-const apiUrl = import.meta.env.VITE_BASE_URL
-const upload = ref(null)
+  queryZdIcd9Cm3,
+} from "@/api/dictionary/oprt-lecel";
+import { ElMessage } from "element-plus";
+import { ref } from "vue";
+import { useUserStore } from "@/pinia/user-store";
+import env from "@/utils/setting";
+
+const centerDialogVisible = ref(false);
+
+const fileList = ref([]);
+const apiUrl = env.VITE_BASE_URL;
+const upload = ref(null);
 const header = {
   token: useUserStore().getToken,
-}
-
+};
 
 const fileSizeOutLimit = () => {
-  ElMessage.error('已经选取excel,如须更换请先移除已选取的excel!')
-}
-const uploadSuccess = (response) => {
-  console.log('response',response)
-  if(response.code ==200){
-    ElMessage.success('上传成功!')
-  }else {
-    ElMessage.error('上传失败,错误信息:'+response.message)
+  ElMessage.error("已经选取excel,如须更换请先移除已选取的excel!");
+};
+const uploadSuccess = response => {
+  console.log("response", response);
+  if (response.code == 200) {
+    ElMessage.success("上传成功!");
+  } else {
+    ElMessage.error("上传失败,错误信息:" + response.message);
   }
-}
-const uploadError = (error,file,fileList) => {
-  ElMessage.error('上传失败!')
-}
+};
+const uploadError = (error, file, fileList) => {
+  ElMessage.error("上传失败!");
+};
 const submitUpload = () => {
-    upload.value.submit()
-}
-
+  upload.value.submit();
+};
 
-const innerHeight = window.innerHeight
+const innerHeight = window.innerHeight;
 const asideQueryParam = ref({
-  nameDoctor: '',
-  codeDoctor: '',
-  code: '',
+  nameDoctor: "",
+  codeDoctor: "",
+  code: "",
   currentPage: 1,
   pageSize: 30,
   total: 0,
-})
-
-const doctorData = ref(
-    {
-      data: [],
-      clearable:true,
-      total: 0,
-      currentPage: 1,
-    }
-)
-
-const doctorCurrentPage =(inputData, val)=>{
-  doctorData.value.currentPage = val
-  getRenYuanPage(inputData,val).then(res => {
-    doctorData.value.data = res.records
-    doctorData.value.total =res.total
-  })
-}
-
-const queryDoctorClick = (val) => {
-  getRenYuanPage(val,1).then((res) => {
-    doctorData.value.data = res.records
-    doctorData.value.total =res.total
-  })
-}
-
-const selectSzDoctorRowClick = (row)=>{
-  asideQueryParam.value.code = row.code
-}
+});
 
+const doctorData = ref({
+  data: [],
+  clearable: true,
+  total: 0,
+  currentPage: 1,
+});
+
+const doctorCurrentPage = (inputData, val) => {
+  doctorData.value.currentPage = val;
+  getRenYuanPage(inputData, val).then(res => {
+    doctorData.value.data = res.records;
+    doctorData.value.total = res.total;
+  });
+};
+
+const queryDoctorClick = val => {
+  getRenYuanPage(val, 1).then(res => {
+    doctorData.value.data = res.records;
+    doctorData.value.total = res.total;
+  });
+};
+
+const selectSzDoctorRowClick = row => {
+  asideQueryParam.value.code = row.code;
+};
 
 const leftQueryParam = ref({
-  code: '',
+  code: "",
   opScaleList: [3, 4],
   currentPage: 1,
   pageSize: 30,
   total: 0,
-})
+});
 
 const mainQueryParam = ref({
-  code: '',
-  codeOp: '',
-  codeOpName: '',
+  code: "",
+  codeOp: "",
+  codeOpName: "",
   currentPage: 1,
   pageSize: 100000,
   total: 0,
-})
+});
 
+const asideTableData = ref([]);
 
-const asideTableData = ref([])
-
-const mainTableData = ref([])
-const leftTableData = ref([])
+const mainTableData = ref([]);
+const leftTableData = ref([]);
 
 const queryidc9Info = () => {
-  queryZdIcd9Cm3(leftQueryParam.value).then((res) => {
-    leftTableData.value = res.records
-    leftQueryParam.value.total = res.total
-  })
-}
+  queryZdIcd9Cm3(leftQueryParam.value).then(res => {
+    leftTableData.value = res.records;
+    leftQueryParam.value.total = res.total;
+  });
+};
 
-const selectionDoctor = ref({})
+const selectionDoctor = ref({});
 
-const selectDoctor = (row) => {
-  selectionDoctor.value = row
-  mainQueryParam.value.code = row.code
-  queryidc9Info()
-  oprtQueryInfo()
-}
+const selectDoctor = row => {
+  selectionDoctor.value = row;
+  mainQueryParam.value.code = row.code;
+  queryidc9Info();
+  oprtQueryInfo();
+};
 
 const queryInfo = () => {
-  queryOpLevelManagement(asideQueryParam.value).then((res) => {
-    asideTableData.value = res.records
-    asideQueryParam.value.total = res.total
-  })
-}
+  queryOpLevelManagement(asideQueryParam.value).then(res => {
+    asideTableData.value = res.records;
+    asideQueryParam.value.total = res.total;
+  });
+};
 
 const oprtQueryInfo = () => {
-  queryOprtInfo(mainQueryParam.value).then((res) => {
-    mainTableData.value = res.records
-  })
-}
-
+  queryOprtInfo(mainQueryParam.value).then(res => {
+    mainTableData.value = res.records;
+  });
+};
 
 const addInfo = () => {
-  getEmpCodeRs(asideQueryParam.value.code).then((res) => {
-    asideQueryParam.value.codeDoctor = res
+  getEmpCodeRs(asideQueryParam.value.code).then(res => {
+    asideQueryParam.value.codeDoctor = res;
     asideTableData.value.unshift({
       code: asideQueryParam.value.code,
       codeDoctor: asideQueryParam.value.codeDoctor,
-      nameDoctor: asideQueryParam.value.nameDoctor
-    })
-  })
-}
-
-const handleSizeChange = (val) => {
-  asideQueryParam.value.pageSize = val
-  queryInfo()
-}
-
-const leftHandleSizeChange = (val) => {
-  leftQueryParam.value.pageSize = val
-  queryidc9Info()
-}
-
-const handleCurrentChange = (val) => {
-  asideQueryParam.value.currentPage = val
-  queryInfo()
-}
-
-const leftHandleCurrentChange = (val) => {
-  leftQueryParam.value.currentPage = val
-  queryidc9Info()
-}
-
-const multipleSelection = ref([])
-const handleSelectionChange = (val) => {
-  multipleSelection.value = val
-}
+      nameDoctor: asideQueryParam.value.nameDoctor,
+    });
+  });
+};
+
+const handleSizeChange = val => {
+  asideQueryParam.value.pageSize = val;
+  queryInfo();
+};
+
+const leftHandleSizeChange = val => {
+  leftQueryParam.value.pageSize = val;
+  queryidc9Info();
+};
+
+const handleCurrentChange = val => {
+  asideQueryParam.value.currentPage = val;
+  queryInfo();
+};
+
+const leftHandleCurrentChange = val => {
+  leftQueryParam.value.currentPage = val;
+  queryidc9Info();
+};
+
+const multipleSelection = ref([]);
+const handleSelectionChange = val => {
+  multipleSelection.value = val;
+};
 
 const addRight = () => {
   if (multipleSelection.value.length <= 0) {
-    ElMessage.error('请至少选择一条手术')
-    return
+    ElMessage.error("请至少选择一条手术");
+    return;
   }
   for (let i = multipleSelection.value.length - 1; i >= 0; i--) {
     let temp = {
       codeOp: multipleSelection.value[i].code,
       codeOpName: multipleSelection.value[i].name,
-    }
+    };
     if (isInclude(mainTableData.value, multipleSelection.value[i].code)) {
-      ElMessage.error(`手术编码${multipleSelection.value[i].code}已有,请不要重复添加`)
-      return
+      ElMessage.error(
+        `手术编码${multipleSelection.value[i].code}已有,请不要重复添加`
+      );
+      return;
     }
-    mainTableData.value.unshift(temp)
+    mainTableData.value.unshift(temp);
   }
-}
-
+};
 
 function isInclude(data, code) {
   for (let i = 0; i < data.length; i++) {
     if (data[i].codeOp === code) {
-      return true
+      return true;
     }
   }
-  return false
+  return false;
 }
 
 const saveInfo = () => {
-
   let param = {
     code: selectionDoctor.value.code,
     codeDoctor: selectionDoctor.value.codeDoctor,
     nameDoctor: selectionDoctor.value.nameDoctor,
-    saveData: mainTableData.value
-  }
-  saveOpLevelManagement(param).then((res) => {
-
-  })
-}
+    saveData: mainTableData.value,
+  };
+  saveOpLevelManagement(param).then(res => {});
+};
 
 const delClick = (index, row) => {
-  mainTableData.value.splice(index, 1)
-}
+  mainTableData.value.splice(index, 1);
+};
 </script>
 
-<style scoped>
-
-</style>
+<style scoped></style>

+ 102 - 65
src/views/dictionary/TemplateThumb.vue

@@ -1,34 +1,71 @@
 <template>
   <div class="layout_container layout-horizontal">
-    <div style="width: 300px; margin-right: 10px" class="layout_container layout_el-table">
-      <el-input v-model="deptName" placeholder="科室名称过滤" clearable prefix-icon="Search"></el-input>
-      <el-table :data="filterDepts" stripe highlight-current-row @row-click="queryTemplates">
-        <el-table-column prop="deptName" label="科室名称" width="300"></el-table-column>
+    <div
+      style="width: 300px; margin-right: 10px"
+      class="layout_container layout_el-table"
+    >
+      <el-input
+        v-model="deptName"
+        placeholder="科室名称过滤"
+        clearable
+        prefix-icon="Search"
+      ></el-input>
+      <el-table
+        :data="filterDepts"
+        stripe
+        highlight-current-row
+        @row-click="queryTemplates"
+      >
+        <el-table-column
+          prop="deptName"
+          label="科室名称"
+          width="300"
+        ></el-table-column>
       </el-table>
     </div>
     <div class="layout_main layout_card">
       <div class="layout_container layout-horizontal">
         <aside class="layout_el-table">
           <h3>套餐列表</h3>
-          <el-table :data="deptTemplates" stripe highlight-current-row @row-click="handleClickTemplate">
-            <el-table-column prop="name" label="套餐名称" width="120"></el-table-column>
-            <el-table-column prop="tcFee" label="套餐价格" width="80"></el-table-column>
+          <el-table
+            :data="deptTemplates"
+            stripe
+            highlight-current-row
+            @row-click="handleClickTemplate"
+          >
+            <el-table-column
+              prop="name"
+              label="套餐名称"
+              width="120"
+            ></el-table-column>
+            <el-table-column
+              prop="tcFee"
+              label="套餐价格"
+              width="80"
+            ></el-table-column>
           </el-table>
         </aside>
-        <div class="layout_main" style="display: flex;justify-content: center;align-items: center">
+        <div
+          class="layout_main"
+          style="display: flex; justify-content: center; align-items: center"
+        >
           <div>
-            <img style="width: 240px; height: 240px" :src="currentThumbPath" alt=""/>
+            <img
+              style="width: 240px; height: 240px"
+              :src="currentThumbPath"
+              alt=""
+            />
             <el-upload
-                ref="upload"
-                :action="uploadTemplateThumbUrl"
-                :limit="1"
-                :on-exceed="handleExceed"
-                :auto-upload="false"
-                :data="thumb"
-                :before-upload="beforeAvatarUpload"
-                :on-change="handleSelectPic"
-                :on-success="onUploadComplete"
-                :on-error="onUploadComplete"
+              ref="upload"
+              :action="uploadTemplateThumbUrl"
+              :limit="1"
+              :on-exceed="handleExceed"
+              :auto-upload="false"
+              :data="thumb"
+              :before-upload="beforeAvatarUpload"
+              :on-change="handleSelectPic"
+              :on-success="onUploadComplete"
+              :on-error="onUploadComplete"
             >
               <template #trigger>
                 <el-button type="primary">选择图片</el-button>
@@ -53,83 +90,83 @@
   </div>
 </template>
 <script setup>
-import {ElMessage, genFileId} from "element-plus";
+import { ElMessage, genFileId } from "element-plus";
 import {
   queryAllDepartment,
-  queryTcByDepartment
+  queryTcByDepartment,
 } from "@/api/outpatient/tc-template";
+import env from "@/utils/setting";
 
-const uploadTemplateThumbUrl = import.meta.env.VITE_UPLOAD_TEMPLATE_THUMB
+const uploadTemplateThumbUrl = env.VITE_UPLOAD_TEMPLATE_THUMB;
 
-const deptName = ref('')
-const allDepts = ref([])
+const deptName = ref("");
+const allDepts = ref([]);
 const filterDepts = computed(() => {
   return allDepts.value.filter(item => {
-    return item.deptName.indexOf(deptName.value) !== -1
-  })
-})
+    return item.deptName.indexOf(deptName.value) !== -1;
+  });
+});
 
-const deptTemplates = ref([])
+const deptTemplates = ref([]);
 
-const queryTemplates = (row) => {
+const queryTemplates = row => {
   queryTcByDepartment(row).then(res => {
-    deptTemplates.value = res
-  })
-}
+    deptTemplates.value = res;
+  });
+};
 
-const currentThumbPath = ref('')
-const handleClickTemplate = (row) => {
-  currentThumbPath.value = row.thumbPath
-  thumb.value.templateId = row.templateId
-}
+const currentThumbPath = ref("");
+const handleClickTemplate = row => {
+  currentThumbPath.value = row.thumbPath;
+  thumb.value.templateId = row.templateId;
+};
 
 const thumb = ref({
-  templateId: null
-})
-const upload = ref(null)
-
+  templateId: null,
+});
+const upload = ref(null);
 
 const handleSelectPic = (uploadFile, uploadFiles) => {
-  currentThumbPath.value = URL.createObjectURL(uploadFile.raw)
-}
+  currentThumbPath.value = URL.createObjectURL(uploadFile.raw);
+};
 
-const beforeAvatarUpload = (rawFile) => {
+const beforeAvatarUpload = rawFile => {
   if (thumb.value.templateId === null) {
-    ElMessage.error('请先选择套餐!');
+    ElMessage.error("请先选择套餐!");
     return false;
   }
-  if (rawFile.type !== 'image/jpeg' && rawFile.type !== 'image/png') {
-    ElMessage.error('请选择jpg/png格式的图片!');
+  if (rawFile.type !== "image/jpeg" && rawFile.type !== "image/png") {
+    ElMessage.error("请选择jpg/png格式的图片!");
     return false;
   } else if (rawFile.size / 1024 / 1024 > 1) {
-    ElMessage.error('图片大小不能超过 1MB!');
+    ElMessage.error("图片大小不能超过 1MB!");
     return false;
   }
-  return true
-}
+  return true;
+};
 
-const handleExceed = (files) => {
-  upload.value.clearFiles()
-  const file = files[0]
-  file.uid = genFileId()
-  upload.value.handleStart(file)
-}
+const handleExceed = files => {
+  upload.value.clearFiles();
+  const file = files[0];
+  file.uid = genFileId();
+  upload.value.handleStart(file);
+};
 
 const submitUpload = () => {
-  upload.value.submit()
-}
+  upload.value.submit();
+};
 
-const onUploadComplete = (res) => {
+const onUploadComplete = res => {
   if (res.code === 200) {
-    ElMessage.success('上传成功。');
+    ElMessage.success("上传成功。");
   } else {
-    ElMessage.error(res)
+    ElMessage.error(res);
   }
-}
+};
 
 onMounted(() => {
   queryAllDepartment().then(res => {
-    allDepts.value = res
-  })
-})
+    allDepts.value = res;
+  });
+});
 </script>

+ 2 - 4
src/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/EmrMain.vue

@@ -153,10 +153,8 @@ import { xcMessage } from "@/utils/xiaochan-element-plus";
 import sleep from "@/utils/sleep";
 import { stringIsBlank, stringNotBlank } from "@/utils/blank-utils";
 import { isDev } from "@/utils/public";
-import { isThereADoctorEditing } from "@/api/zhu-yuan-yi-sheng/emr-socket";
 import XEUtils from "xe-utils";
 import { EmrEditCreateLimit } from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/emr-edit-create-limit";
-import { sendEmrSocketMessage } from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/force-refresh-func";
 import warning from "../../../../../assets/warning.png";
 import { DataElements, EditorMode, EditType, Runtime } from "@/utils/emr/edit";
 import {
@@ -183,6 +181,7 @@ import { useHistoricalData } from "@/views/hospitalization/zhu-yuan-yi-sheng/ele
 import PatientInfoView from "@/components/zhu-yuan-yi-sheng/public/PatientInfoView.vue";
 import { useSystemStore } from "@/pinia/system-store";
 import * as socket from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/socket/useEmrSocket";
+import env from "@/utils/setting";
 
 const EmrFirstPageOfMedicalRecord = defineAsyncComponent(
   () =>
@@ -518,7 +517,6 @@ const editJudgment = async () => {
   emrStore.documentSocket.open(getId());
 };
 
-
 const setEditorModel = (val: EditorMode = "free") => {
   try {
     editor!.setEditorMode(val);
@@ -1583,7 +1581,7 @@ const initEdit = () => {
     },
     endpoints: {
       app: "http://172.16.32.160:9205/thyy/api/dataEmr/comp",
-      his: import.meta.env.VITE_BASE_URL,
+      his: env.VITE_BASE_URL,
     },
     input: {
       user: userInfo.code,

+ 2 - 1
src/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/socket/useEmrSocket.ts

@@ -4,10 +4,11 @@ import { ElMessageBox, ElNotification } from "element-plus";
 import { EmrStore } from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-func/useEmrStore";
 import { EditType } from "@/utils/emr/edit";
 import XEUtils from "xe-utils";
+import env from "@/utils/setting";
 
 const us = useUserStore().userInfo;
 
-export const URL = import.meta.env.VITE_SOCKET_V2;
+export const URL = env.VITE_SOCKET_V2;
 
 export enum MessageType {
   USER_INFO = "USER_INFO",

+ 31 - 33
src/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-func/emr-socket.ts

@@ -1,46 +1,44 @@
-import {uuid} from '@/utils/getUuid'
+import { uuid } from "@/utils/getUuid";
 // @ts-ignore
-import {sendAMessage} from '@/utils/websocket'
-import {useUserStore} from "@/pinia/user-store";
+import { sendAMessage } from "@/utils/websocket";
+import { useUserStore } from "@/pinia/user-store";
+import env from "@/utils/setting";
 
-export const sid: string = useUserStore().userInfo.code + '_' + uuid(8, 62);
+export const sid: string = useUserStore().userInfo.code + "_" + uuid(8, 62);
 
 // @ts-ignore
-const emrServer: string = "ws://" + import.meta.env.VITE_EMR_CONTROL_URL + "/websocket/"
+const emrServer: string = "ws://" + env.VITE_EMR_CONTROL_URL + "/websocket/";
 
-let socket = null
+let socket = null;
 
-export const openSocket = (): () => void => {
+export const openSocket = (): (() => void) => {
+  let socketSetTimeout: number | null = null;
 
-    let socketSetTimeout: number | null = null
+  function clearSocket() {
+    if (socketSetTimeout !== null) clearTimeout(socketSetTimeout);
+  }
 
-    function clearSocket() {
-        if (socketSetTimeout !== null)
-            clearTimeout(socketSetTimeout)
-    }
+  let url: string = emrServer + sid;
 
-    let url: string = emrServer + sid;
+  if ("WebSocket" in window) {
+    socket = new WebSocket(url);
+  } else {
+    alert("该浏览器不支持websocket!");
+    socket = null;
+  }
 
-    if ('WebSocket' in window) {
-        socket = new WebSocket(url)
-    } else {
-        alert('该浏览器不支持websocket!')
-        socket = null
-    }
+  if (socket == null) return clearSocket;
 
-    if (socket == null) return clearSocket
+  socket.onmessage = function (e): void {
+    let data = JSON.parse(e.data);
+    sendAMessage(data.name, data.message);
+  };
 
-    socket.onmessage = function (e): void {
-        let data = JSON.parse(e.data)
-        sendAMessage(data.name, data.message)
-    }
+  socket.onclose = function (): void {
+    socketSetTimeout = setTimeout((): void => {
+      openSocket();
+    }, 3000);
+  };
 
-    socket.onclose = function (): void {
-        socketSetTimeout = setTimeout((): void => {
-            openSocket()
-        }, 3000)
-    }
-
-    return clearSocket
-
-}
+  return clearSocket;
+};

+ 186 - 181
src/views/mz-emr/MzEmr.vue

@@ -1,27 +1,30 @@
 <script setup lang="ts">
-import router from '@/router'
-import {onMounted, ref} from "vue";
+import router from "@/router";
+import { onMounted, ref } from "vue";
+import { useEmrInit, UseEmrInitReturn } from "@/utils/emr/emr-init-v2";
 import {
-  useEmrInit,
-  UseEmrInitReturn
-} from "@/utils/emr/emr-init-v2";
-import {getMzEmrModel, queryMzEmrTree, queryMzPatientInfo, saveMzEmrModel} from "@/api/mz-emr/mz-emr";
-import {ElMessageBox, ElTree, ElMessage} from 'element-plus'
-import {watch} from 'vue'
-import {stringIsBlank} from "@/utils/blank-utils";
-import {getServerDateApi, getUuid} from "@/api/public-api";
-import {useUserStore} from "@/pinia/user-store";
-
-const userInfo = useUserStore().userInfo
+  getMzEmrModel,
+  queryMzEmrTree,
+  queryMzPatientInfo,
+  saveMzEmrModel,
+} from "@/api/mz-emr/mz-emr";
+import { ElMessageBox, ElTree, ElMessage } from "element-plus";
+import { watch } from "vue";
+import { stringIsBlank } from "@/utils/blank-utils";
+import { getServerDateApi, getUuid } from "@/api/public-api";
+import { useUserStore } from "@/pinia/user-store";
+import env from "@/utils/setting";
+
+const userInfo = useUserStore().userInfo;
 let patNo: {
   times: number;
   patientId: string;
   userIdCode: string;
 } = {
   times: 2,
-  patientId: '',
-  userIdCode: '',
-}
+  patientId: "",
+  userIdCode: "",
+};
 
 export interface Property {
   editorVersion?: string;
@@ -39,7 +42,7 @@ export interface Version {
 }
 
 export interface emrTemplateType {
-  documentId?: string,
+  documentId?: string;
   parent?: string;
   code?: string;
   versions?: Version[];
@@ -51,55 +54,54 @@ export interface emrTemplateType {
   labels?: string[];
 }
 
-const emrTemplateData = ref<emrTemplateType[]>()
-
+const emrTemplateData = ref<emrTemplateType[]>();
 
-const emrDivRef = ref<HTMLDivElement>()
+const emrDivRef = ref<HTMLDivElement>();
 let editor: UseEmrInitReturn;
 
-const selectionStatus = ref(false)
+const selectionStatus = ref(false);
 
 const rowClick = (row: emrTemplateType) => {
-  selectionStatus.value = true
-  editor.editor.setEditorMode('free')
-  categoryCode.value = row.code
-  mzEmrName.value = row.name
-  parent.value = row.parent
+  selectionStatus.value = true;
+  editor.editor.setEditorMode("free");
+  categoryCode.value = row.code;
+  mzEmrName.value = row.name;
+  parent.value = row.parent;
   if (typeFlag.value == 0) {
     editor.loadAndSetDocument({
       categoryId: row._id,
       categoryCode: row.code,
-    })
+    });
   } else {
     editor.loadAndSetDocument({
-      documentId: row.documentId
-    })
+      documentId: row.documentId,
+    });
   }
+};
 
-}
-
-const categoryCode = ref<string>('')
-const mzEmrName = ref<string>('')
-const parent = ref<string>('')
+const categoryCode = ref<string>("");
+const mzEmrName = ref<string>("");
+const parent = ref<string>("");
 
 const saveData = () => {
-  if (!((typeFlag.value == 0 || typeFlag.value == 2) && selectionStatus.value)) {
-    return ElMessage.error('请选择数据,只有门诊模板和当前才能保存!')
+  if (
+    !((typeFlag.value == 0 || typeFlag.value == 2) && selectionStatus.value)
+  ) {
+    return ElMessage.error("请选择数据,只有门诊模板和当前才能保存!");
   }
-  ElMessageBox.confirm('请确认是否保存', {
-    cancelButtonText: '取消',
-    confirmButtonText: '确定',
+  ElMessageBox.confirm("请确认是否保存", {
+    cancelButtonText: "取消",
+    confirmButtonText: "确定",
   })
-      .then(() => {
-        clickSaveData()
-      })
-      .catch(() => {
-      })
-}
+    .then(() => {
+      clickSaveData();
+    })
+    .catch(() => {});
+};
 
 const clickSaveData = async () => {
   // 解析 id
-  let id = await analysisIframeSrcSearch()
+  let id = await analysisIframeSrcSearch();
   let data: any = {
     name: mzEmrName.value,
     emrDocumentId: id,
@@ -109,121 +111,120 @@ const clickSaveData = async () => {
     emrName: mzEmrName.value,
     parent: parent.value,
     userIdCode: mzEmrPatientVo.value.userIdCode,
-    documentData: null
-  }
+    documentData: null,
+  };
   let newDate = await getServerDateApi();
   const document = editor.editor.getDocument();
 
-  document.properties.categoryCode = data.emrCategoryCode
+  document.properties.categoryCode = data.emrCategoryCode;
   document.properties.patientId = data.patNo + "_" + data.times;
-  document._id = data.emrDocumentId
-  data.documentData = document
+  document._id = data.emrDocumentId;
+  data.documentData = document;
 
   if (document.properties.creator) {
-    document.properties.modifier = mzEmrPatientVo.value.userIdCode
-    document.properties.modifierId = mzEmrPatientVo.value.userName
-    document.properties.modifyTime = newDate
+    document.properties.modifier = mzEmrPatientVo.value.userIdCode;
+    document.properties.modifierId = mzEmrPatientVo.value.userName;
+    document.properties.modifyTime = newDate;
   } else {
-    document.properties.creator = mzEmrPatientVo.value.userIdCode
-    document.properties.creatorId = mzEmrPatientVo.value.userName
-    document.properties.createTime = newDate
+    document.properties.creator = mzEmrPatientVo.value.userIdCode;
+    document.properties.creatorId = mzEmrPatientVo.value.userName;
+    document.properties.createTime = newDate;
   }
 
-  saveMzEmrModel(data).then((res: any) => {
-
-  })
-
-}
+  saveMzEmrModel(data).then((res: any) => {});
+};
 
 const analysisIframeSrcSearch = async () => {
-  let id = getId()
-  let temp
+  let id = getId();
+  let temp;
   if (stringIsBlank(id)) {
     // 这个是 唯一 id 调用服务的雪花算法
-    temp = await getUuid()
+    temp = await getUuid();
   } else {
-    temp = id
+    temp = id;
   }
-  return temp
-}
+  return temp;
+};
 
 const getId = () => {
   if (editor) {
-    return editor.editor.documentData._id
+    return editor.editor.documentData._id;
   }
-  return null
-}
-
+  return null;
+};
 
 const appContext = () => {
   return {
     endpoints: {
       app: "http://172.16.32.167:9205/thyy/api/dataEmr/comp",
-      his: import.meta.env.VITE_BASE_URL,
+      his: env.VITE_BASE_URL,
     },
     input: {
       user: userInfo.code,
-      name: userInfo.name
+      name: userInfo.name,
     },
     userCode: userInfo.code,
     login: {
       token: localStorage.token,
       user: {
         id: userInfo.code,
-        name: userInfo.name
-      }
+        name: userInfo.name,
+      },
     },
     data: {
-      '患者姓名': mzEmrPatientVo.value.name,
-      '性别名称': mzEmrPatientVo.value.sex,
-      '患者年龄': mzEmrPatientVo.value.age,
-      '门/急诊号': mzEmrPatientVo.value.patientId,
-      '接诊科室门诊': mzEmrPatientVo.value.deptName,
-      '编辑者': [{code: mzEmrPatientVo.value.userIdCode, name: mzEmrPatientVo.value.userName}]
-    }
-  }
-}
+      患者姓名: mzEmrPatientVo.value.name,
+      性别名称: mzEmrPatientVo.value.sex,
+      患者年龄: mzEmrPatientVo.value.age,
+      "门/急诊号": mzEmrPatientVo.value.patientId,
+      接诊科室门诊: mzEmrPatientVo.value.deptName,
+      编辑者: [
+        {
+          code: mzEmrPatientVo.value.userIdCode,
+          name: mzEmrPatientVo.value.userName,
+        },
+      ],
+    },
+  };
+};
 
 const handlePrint = () => {
   editor.editor.execute("print", {
     value: {
       showPreview: false,
-    }
-  })
-}
-
+    },
+  });
+};
 
 const mzEmrPatientVo = ref<object>({
-  patientId: '',
+  patientId: "",
   times: null,
-  userIdCode: '',
-  userName: '',
-  deptCode: '',
-  deptName: '',
-  name: '',
-  sex: '',
+  userIdCode: "",
+  userName: "",
+  deptCode: "",
+  deptName: "",
+  name: "",
+  sex: "",
   age: null,
   type: null,
-})
+});
 onMounted(() => {
-  patNo = JSON.parse(window.atob(router.currentRoute.value.params.patientInfo))
+  patNo = JSON.parse(window.atob(router.currentRoute.value.params.patientInfo));
   queryMzPatientInfo(patNo).then((res: any) => {
-    mzEmrPatientVo.value = res
-  })
+    mzEmrPatientVo.value = res;
+  });
   useEmrInit(emrDivRef.value, {
-    appContext: appContext
+    appContext: appContext,
   }).then(res => {
-    editor = res
-  })
-})
-
+    editor = res;
+  });
+});
 
-const treeData = ref<Tree[]>()
-const typeFlag = ref<number>()
+const treeData = ref<Tree[]>();
+const typeFlag = ref<number>();
 
-const queryMzEmdrData = (type) => {
-  selectionStatus.value = false
-  typeFlag.value = type
+const queryMzEmdrData = type => {
+  selectionStatus.value = false;
+  typeFlag.value = type;
   if (type == 0 || type == 2) {
     modelFlag.value = true;
   } else {
@@ -231,88 +232,84 @@ const queryMzEmdrData = (type) => {
   }
   if (type == 0) {
     getMzEmrModel().then((res: any) => {
-      let tem = []
+      let tem = [];
       if (res) {
         for (let i = 0; i < res.length; i++) {
           if (res[i].parent != null) {
-            tem.push(res[i])
+            tem.push(res[i]);
           }
         }
       }
-      emrTemplateData.value = tem
-    })
+      emrTemplateData.value = tem;
+    });
   } else {
-    mzEmrPatientVo.value['type'] = type
+    mzEmrPatientVo.value["type"] = type;
     queryMzEmrTree(mzEmrPatientVo.value).then((res: any) => {
       if (type == 2) {
-        let tempData = []
+        let tempData = [];
         if (res) {
           for (let i = 0; i < res.length; i++) {
             let te = {
-              _id: '',
-              categoryCode: '',
-              documentId: '',
-              name: '',
-              cade: '',
-              parent: '',
-            }
-            te.cade = res[i].emrCategoryCode
-            te.parent = res[i].parent
-            te.categoryCode = res[i].emrCategoryCode
-            te.documentId = res[i].emrDocumentId
-            te.name = res[i].name
-            tempData.push(te)
+              _id: "",
+              categoryCode: "",
+              documentId: "",
+              name: "",
+              cade: "",
+              parent: "",
+            };
+            te.cade = res[i].emrCategoryCode;
+            te.parent = res[i].parent;
+            te.categoryCode = res[i].emrCategoryCode;
+            te.documentId = res[i].emrDocumentId;
+            te.name = res[i].name;
+            tempData.push(te);
           }
-          emrTemplateData.value = tempData
+          emrTemplateData.value = tempData;
         }
       } else {
-        treeData.value = res
+        treeData.value = res;
       }
-    })
+    });
   }
-}
-
+};
 
 interface Tree {
-  [key: string]: any
+  [key: string]: any;
 }
 
-const filterText = ref('')
-const treeRef = ref<InstanceType<typeof ElTree>>()
+const filterText = ref("");
+const treeRef = ref<InstanceType<typeof ElTree>>();
 
 const defaultProps = {
-  children: 'children',
-  label: 'name',
-}
+  children: "children",
+  label: "name",
+};
 
-watch(filterText, (val) => {
-  treeRef.value!.filter(val)
-})
+watch(filterText, val => {
+  treeRef.value!.filter(val);
+});
 
 const filterNode = (value: string, data: Tree) => {
-  if (!value) return true
-  return data.name.includes(value)
-}
+  if (!value) return true;
+  return data.name.includes(value);
+};
 
 const handleNodeClick = (node, object, event) => {
-  selectionStatus.value = true
-  editor.editor.setEditorMode('readonly')
+  selectionStatus.value = true;
+  editor.editor.setEditorMode("readonly");
   editor.loadAndSetDocument({
-    documentId: node.emrDocumentId
-  })
-
-
-}
-
-const modelFlag = ref<boolean>(false)
+    documentId: node.emrDocumentId,
+  });
+};
 
+const modelFlag = ref<boolean>(false);
 </script>
 
 <template>
   <el-container>
-    <el-aside style="width: 400px;padding: 20px;">
+    <el-aside style="width: 400px; padding: 20px">
       <div>
-        <el-descriptions :column="4" border style="width:100%;">
+        <el-descriptions :column="4" border style="width: 100%">
           <el-descriptions-item label="门诊号">
             {{ mzEmrPatientVo.patientId }}
           </el-descriptions-item>
@@ -323,15 +320,17 @@ const modelFlag = ref<boolean>(false)
             {{ mzEmrPatientVo.sex }}
           </el-descriptions-item>
           <el-descriptions-item label="年龄">
-            {{ mzEmrPatientVo.age + '岁' }}
+            {{ mzEmrPatientVo.age + "岁" }}
           </el-descriptions-item>
         </el-descriptions>
       </div>
       <div>
         <div>
-          <div style="width: 100%;text-align: right">
+          <div style="width: 100%; text-align: right">
             <el-button type="success" @click="saveData">保存</el-button>
-            <el-button icon="Printer" type="success" @click="handlePrint"> 打印</el-button>
+            <el-button icon="Printer" type="success" @click="handlePrint">
+              打印</el-button
+            >
           </div>
           <div>
             <el-button-group class="ml-4">
@@ -343,34 +342,40 @@ const modelFlag = ref<boolean>(false)
           </div>
         </div>
         <div>
-          <el-table :data="emrTemplateData" v-show="modelFlag" style="width: 210px" @row-click="rowClick">
+          <el-table
+            :data="emrTemplateData"
+            v-show="modelFlag"
+            style="width: 210px"
+            @row-click="rowClick"
+          >
             <el-table-column label="名称" prop="name"></el-table-column>
           </el-table>
-          <el-input v-model="filterText" v-show="!modelFlag" placeholder="搜索" style="width: 210px"/>
-          <el-tree v-show="!modelFlag" style="width: 210px"
-                   ref="treeRef"
-                   class="filter-tree"
-                   :data="treeData"
-                   :props="defaultProps"
-                   @node-click="handleNodeClick"
-                   node-key="id"
-                   highlight-current
-                   default-expand-all
-                   :filter-node-method="filterNode"
+          <el-input
+            v-model="filterText"
+            v-show="!modelFlag"
+            placeholder="搜索"
+            style="width: 210px"
+          />
+          <el-tree
+            v-show="!modelFlag"
+            style="width: 210px"
+            ref="treeRef"
+            class="filter-tree"
+            :data="treeData"
+            :props="defaultProps"
+            @node-click="handleNodeClick"
+            node-key="id"
+            highlight-current
+            default-expand-all
+            :filter-node-method="filterNode"
           />
-
         </div>
       </div>
     </el-aside>
-    <el-main style="width: 100% ; height: 100%">
-      <div ref="emrDivRef" style="width: 100% ; height: 100%">
-
-      </div>
+    <el-main style="width: 100%; height: 100%">
+      <div ref="emrDivRef" style="width: 100%; height: 100%"></div>
     </el-main>
   </el-container>
-
 </template>
 
-<style scoped lang="scss">
-
-</style>
+<style scoped lang="scss"></style>

+ 19 - 18
src/views/technology-archives/TechnologyArchivesMain.vue

@@ -396,7 +396,7 @@
                         :min-scale="0.2"
                         :preview-src-list="srcList"
                         :preview-teleported="true"
-                        fit="cover" 
+                        fit="cover"
                       />
                     </div>
                     <!-- <span v-else>{{ scope.row.image }}</span> -->
@@ -1146,6 +1146,7 @@ import {
   selectTechnologyArchives9
 } from "@/api/technology-archives/technology-archives";
 import {useUserStore} from "@/pinia/user-store";
+import env from "@/utils/setting";
 
 const editableTabsValue = ref('baseInfo')
 const ruleFormRef = ref()
@@ -1378,7 +1379,7 @@ const queryTechnologyArchives1 = () => {
             console.log(row)
             console.log(srcList.value)
         })
-      }) 
+      })
       firstData.value = res
     })
     .catch(() => {
@@ -1710,8 +1711,8 @@ const editFirstInfo = (row) => {
   row.isEdit = true
   // if(!row.isUpload){
   //   for(let i=0; i<fileList.value.length; i++){
-  //     fileList.value[i].name = row[i].image 
-  //   }  
+  //     fileList.value[i].name = row[i].image
+  //   }
   // }else{
   //   fileList.value = []
   // }
@@ -1729,7 +1730,7 @@ const cancelFirstInfo = (row, index) => {
   }
   if(!row.isUpload){
     fileList.value = []
-  } 
+  }
   if(row.getTime == null || row.issuingAuthority == null || row.name == null){
     fileList.value = []
   }
@@ -1737,13 +1738,13 @@ const cancelFirstInfo = (row, index) => {
 }
 
 //上传图片
-const apiUrl = import.meta.env.VITE_BASE_URL
+const apiUrl = env.VITE_BASE_URL
 const upload = ref()
 const fileList = ref([])
 const fileList2 = ref([])
 
 const dialogImageUrl = ref('')
-const dialogVisible = ref(false) 
+const dialogVisible = ref(false)
 
 const handleRemove= (uploadFile, uploadFiles) => {
   console.log(uploadFile, uploadFiles)
@@ -1756,16 +1757,16 @@ const handlePreview= (uploadFile) => {
 }
 
 // 图片上传前文件信息
-const beforeUpload = (file: File,row) => { 
+const beforeUpload = (file: File,row) => {
   if (file.size / 1024 / 1024 > 2) {
     ElMessage.error('上传图片大小不能超过 2MB!')
     row.isOversize = true
-  }              
+  }
   console.log('正在上传文件:'+ file.name)
 }
 
 const header = {
-  token: localStorage.token, 
+  token: localStorage.token,
 }
 
 const multiple = computed(() => {
@@ -1775,12 +1776,12 @@ const multiple = computed(() => {
   }
   return false
 })
- 
+
 //上传
 const submitUpload = (row) => {
   if(!row.isOversize){
     upload.value!.submit();
-    row.isUpload = true 
+    row.isUpload = true
   }else{
     row.isUpload = false
   }
@@ -1849,7 +1850,7 @@ const updateFirstInfo = (row) => {
       });
     } else {
       callSaveFirstInfo(row, null)
-    }  
+    }
   }else {
     let oldGetTime = row.oldRow.getTime
     if (oldGetTime !== row.getTime) {
@@ -1868,7 +1869,7 @@ const updateFirstInfo = (row) => {
       })
     } else {
       callSaveFirstInfo(row, oldGetTime)
-    } 
+    }
   }
 }
 
@@ -1905,7 +1906,7 @@ const callSaveFirstInfo = (row, oldGetTime) => {
           queryTechnologyArchives1()
         }
         console.log(url1.value)
-        setImage1(row.socialNo,row.getTime,url1.value)  
+        setImage1(row.socialNo,row.getTime,url1.value)
       })
     }).catch((action) => {
       if (action === 'cancel') {
@@ -1914,7 +1915,7 @@ const callSaveFirstInfo = (row, oldGetTime) => {
       }
     })
   }
-  
+
 }
 
 const deleteFirstInfo = (row) => {
@@ -2062,7 +2063,7 @@ const callSaveSecondInfo = (row, oldNo) => {
           queryTechnologyArchives2()
         }
         console.log(url2.value)
-        setImage2(row.socialNo,row.no,url2.value)  
+        setImage2(row.socialNo,row.no,url2.value)
       })
     }).catch((action) => {
       if (action === 'cancel') {
@@ -3061,4 +3062,4 @@ const totalFormat = (data) => {
   counter-increment: section; /* 每个li元素增加计数器的值 */
   content: counters(section, ".") " "; /* 在li元素前添加计数器的当前值 */
 }
-</style>
+</style>