Pārlūkot izejas kodu

优化触发方式

DESKTOP-0GD05B0\Administrator 2 gadi atpakaļ
vecāks
revīzija
4471c8fa76

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

@@ -536,7 +536,9 @@ const emrEvent = {
     await editJudgment()
   },
 
-  'contentChange': (event) => {
+  'contentchange': (e, op) => {
+    console.log(op.batch)
+    if (op.batch.type === 'persist') return
     if (!readonlyPattern()) {
       // 如果是空的编辑器就不触发了
       if (!emrRef.value.src.includes('/emr/runtime/#/editor')) {
@@ -1089,7 +1091,7 @@ const reQueryPatientInformation = () => {
   if (!readonlyPattern()) {
     // 如果没有文档 id 就说明是
     if (documentId) {
-      editor.setValues(extractData)
+      editor.setValues(extractData, true, true)
     }
   }
 }
@@ -1463,6 +1465,10 @@ const medicalRecordQualityControl = async () => {
   }
 }
 
+/**
+ * 打开已经保存了的病历
+ * @param id 病历 id
+ */
 const openAndSaveTheMedicalRecord = (id) => {
   saveDocumentId.value = `/emr/runtime/?documentId=${id}#/`
   showIframe.value = 2

+ 204 - 413
src/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/emr-init.js

@@ -38,8 +38,7 @@ export function EMRInteractive(data, editorEvent) {
                             viewParagraphDom.remove()
                         }
                     })
-                },
-                scope: this, params: params
+                }, persist: true, scope: this, params: params
             }
         })
     }
@@ -56,19 +55,14 @@ export function EMRInteractive(data, editorEvent) {
     this.getAppContext = () => {
         return {
             endpoints: {
-                app: "/bdp/dataservice/api",
-                his: import.meta.env.VITE_BASE_URL,
+                app: "/bdp/dataservice/api", his: import.meta.env.VITE_BASE_URL,
             }, input: {
-                user: store.state.user.info.code,
-                name: store.state.user.info.name
+                user: store.state.user.info.code, name: store.state.user.info.name
             }, login: {
-                token: store.state.user.info.token,
-                user: {
-                    id: store.state.user.info.code,
-                    name: store.state.user.info.name,
+                token: store.state.user.info.token, user: {
+                    id: store.state.user.info.code, name: store.state.user.info.name,
                 }
-            },
-            data
+            }, data
         }
     };
 
@@ -99,10 +93,7 @@ export function EMRInteractive(data, editorEvent) {
 }
 
 export const query = ref({
-    patNo: '',
-    times: 0,
-    maxTimes: 1,
-    state: 0
+    patNo: '', times: 0, maxTimes: 1, state: 0
 })
 
 export const conciseMode = ref(false)
@@ -121,10 +112,7 @@ export const emrConfig = ref({
 // 默认查询的是全部的患者  state == 1 自己科室的患者
 export function getEmrUrl(patNo, times, state = 3) {
     let query = {
-        patNo,
-        times,
-        state: state,
-        maxTimes: 1
+        patNo, times, state: state, maxTimes: 1
     }
     let temp = JSON.stringify(query)
     return window.location.origin + '/myEmrEditor/' + window.btoa(temp)
@@ -138,10 +126,7 @@ export function getEmrUrl(patNo, times, state = 3) {
  */
 export function getInEmrUrl(patNo, times) {
     let query = {
-        patNo,
-        times,
-        state: 2,
-        maxTimes: 1
+        patNo, times, state: 2, maxTimes: 1
     }
     let temp = JSON.stringify(query)
     return window.location.origin + '/myEmrEditor/' + window.btoa(temp)
@@ -183,396 +168,202 @@ export const copyEnum = {
 
 export const emrClipBoardData = (val) => {
     if (stringNotBlank(val)) {
-        window.localStorage.setItem("clipBoardData",
-            JSON.stringify({
-                content: [{type: 'text', data: val}],
-                plainText: val,
-            }));
+        window.localStorage.setItem("clipBoardData", JSON.stringify({
+            content: [{type: 'text', data: val}], plainText: val,
+        }));
         xcMessage.success('复制成功。')
     }
 }
 
-export const fontSizes = [
-    {
-        "code": "42pt",
-        "name": "初号"
-    },
-    {
-        "code": "36pt",
-        "name": "小初"
-    },
-    {
-        "code": "26pt",
-        "name": "一号"
-    },
-    {
-        "code": "24pt",
-        "name": "小一"
-    },
-    {
-        "code": "22pt",
-        "name": "二号"
-    },
-    {
-        "code": "18pt",
-        "name": "小二"
-    },
-    {
-        "code": "16pt",
-        "name": "三号"
-    },
-    {
-        "code": "15pt",
-        "name": "小三"
-    },
-    {
-        "code": "14pt",
-        "name": "四号"
-    },
-    {
-        "code": "12pt",
-        "name": "小四"
-    },
-    {
-        "code": "10.5pt",
-        "name": "五号"
-    },
-    {
-        "code": "9pt",
-        "name": "小五"
-    },
-    {
-        "code": "7.5pt",
-        "name": "六号"
-    },
-    {
-        "code": "6.5pt",
-        "name": "小六"
-    },
-    {
-        "code": "5.5pt",
-        "name": "七号"
-    },
-    {
-        "code": "5pt",
-        "name": "八号"
-    },
-    {
-        "code": "4pt",
-        "name": "4"
-    },
-    {
-        "code": "8pt",
-        "name": "8"
-    },
-    {
-        "code": "10pt",
-        "name": "10"
-    },
-    {
-        "code": "11pt",
-        "name": "11"
-    },
-    {
-        "code": "20pt",
-        "name": "20"
-    },
-    {
-        "code": "28pt",
-        "name": "28"
-    },
-    {
-        "code": "48pt",
-        "name": "48"
-    },
-    {
-        "code": "72pt",
-        "name": "72"
-    }
-]
-export const availableFonts = [
-    {
-        "text": "微软雅黑",
-        "font": "\"Microsoft YaHei\""
-    },
-    {
-        "text": "宋体",
-        "font": "SimSun"
-    },
-    {
-        "text": "黑体",
-        "font": "SimHei"
-    },
-    {
-        "text": "仿宋",
-        "font": "FangSong"
-    },
-    {
-        "text": "楷体",
-        "font": "KaiTi"
-    },
-    {
-        "text": "新宋体",
-        "font": "NSimSun"
-    },
-    {
-        "text": "微软正黑体",
-        "font": "\"Microsoft JhengHei\""
-    },
-    {
-        "text": "Arial",
-        "font": "Arial"
-    },
-    {
-        "text": "Times New Roman",
-        "font": "\"Times New Roman\""
-    },
-    {
-        "text": "Calibri",
-        "font": "Calibri"
-    },
-    {
-        "text": "Comic Sans MS",
-        "font": "\"Comic Sans MS\""
-    },
-    {
-        "text": "Courier New",
-        "font": "\"Courier New\""
-    },
-    {
-        "text": "Georgia",
-        "font": "Georgia"
-    },
-    {
-        "text": "Impact",
-        "font": "Impact"
-    },
-    {
-        "text": "Trebuchet MS",
-        "font": "\"Trebuchet MS\""
-    },
-    {
-        "text": "Verdana",
-        "font": "Verdana"
-    },
-    {
-        "text": "Arial Black",
-        "font": "\"Arial Black\""
-    },
-    {
-        "text": "Arial Narrow",
-        "font": "\"Arial Narrow\""
-    },
-    {
-        "text": "Cambria",
-        "font": "Cambria"
-    },
-    {
-        "text": "Cambria Math",
-        "font": "\"Cambria Math\""
-    },
-    {
-        "text": "Candara",
-        "font": "Candara"
-    },
-    {
-        "text": "Consolas",
-        "font": "Consolas"
-    },
-    {
-        "text": "Constantia",
-        "font": "Constantia"
-    },
-    {
-        "text": "Corbel",
-        "font": "Corbel"
-    },
-    {
-        "text": "Ebrima",
-        "font": "Ebrima"
-    },
-    {
-        "text": "Franklin Gothic",
-        "font": "\"Franklin Gothic\""
-    },
-    {
-        "text": "Franklin Gothic Medium",
-        "font": "\"Franklin Gothic Medium\""
-    },
-    {
-        "text": "Gabriola",
-        "font": "Gabriola"
-    },
-    {
-        "text": "Gadugi",
-        "font": "Gadugi"
-    },
-    {
-        "text": "Lucida Console",
-        "font": "\"Lucida Console\""
-    },
-    {
-        "text": "Lucida Sans Unicode",
-        "font": "\"Lucida Sans Unicode\""
-    },
-    {
-        "text": "Malgun Gothic",
-        "font": "\"Malgun Gothic\""
-    },
-    {
-        "text": "Marlett",
-        "font": "Marlett"
-    },
-    {
-        "text": "Microsoft Himalaya",
-        "font": "\"Microsoft Himalaya\""
-    },
-    {
-        "text": "Microsoft JhengHei UI",
-        "font": "\"Microsoft JhengHei UI\""
-    },
-    {
-        "text": "Microsoft JhengHei UI Light",
-        "font": "\"Microsoft JhengHei UI Light\""
-    },
-    {
-        "text": "Microsoft New Tai Lue",
-        "font": "\"Microsoft New Tai Lue\""
-    },
-    {
-        "text": "Microsoft PhagsPa",
-        "font": "\"Microsoft PhagsPa\""
-    },
-    {
-        "text": "Microsoft Sans Serif",
-        "font": "\"Microsoft Sans Serif\""
-    },
-    {
-        "text": "Microsoft Tai Le",
-        "font": "\"Microsoft Tai Le\""
-    },
-    {
-        "text": "Microsoft YaHei UI",
-        "font": "\"Microsoft YaHei UI\""
-    },
-    {
-        "text": "Microsoft YaHei UI Light",
-        "font": "\"Microsoft YaHei UI Light\""
-    },
-    {
-        "text": "Microsoft Yi Baiti",
-        "font": "\"Microsoft Yi Baiti\""
-    },
-    {
-        "text": "MingLiU-ExtB",
-        "font": "MingLiU-ExtB"
-    },
-    {
-        "text": "MingLiU_HKSCS-ExtB",
-        "font": "MingLiU_HKSCS-ExtB"
-    },
-    {
-        "text": "Mongolian Baiti",
-        "font": "\"Mongolian Baiti\""
-    },
-    {
-        "text": "MS Gothic",
-        "font": "\"MS Gothic\""
-    },
-    {
-        "text": "MS PGothic",
-        "font": "\"MS PGothic\""
-    },
-    {
-        "text": "MS UI Gothic",
-        "font": "\"MS UI Gothic\""
-    },
-    {
-        "text": "MT Extra",
-        "font": "\"MT Extra\""
-    },
-    {
-        "text": "MV Boli",
-        "font": "\"MV Boli\""
-    },
-    {
-        "text": "Myanmar Text",
-        "font": "\"Myanmar Text\""
-    },
-    {
-        "text": "Nirmala UI",
-        "font": "\"Nirmala UI\""
-    },
-    {
-        "text": "Palatino Linotype",
-        "font": "\"Palatino Linotype\""
-    },
-    {
-        "text": "PMingLiU-ExtB",
-        "font": "PMingLiU-ExtB"
-    },
-    {
-        "text": "Segoe Print",
-        "font": "\"Segoe Print\""
-    },
-    {
-        "text": "Segoe Script",
-        "font": "\"Segoe Script\""
-    },
-    {
-        "text": "Segoe UI Symbol",
-        "font": "\"Segoe UI Symbol\""
-    },
-    {
-        "text": "Sylfaen",
-        "font": "Sylfaen"
-    },
-    {
-        "text": "Symbol",
-        "font": "Symbol"
-    },
-    {
-        "text": "Tahoma",
-        "font": "Tahoma"
-    },
-    {
-        "text": "Webdings",
-        "font": "Webdings"
-    },
-    {
-        "text": "Wingdings",
-        "font": "Wingdings"
-    },
-    {
-        "text": "Yu Gothic",
-        "font": "\"Yu Gothic\""
-    },
-    {
-        "text": "Yu Gothic Light",
-        "font": "\"Yu Gothic Light\""
-    },
-    {
-        "text": "Yu Gothic Medium",
-        "font": "\"Yu Gothic Medium\""
-    },
-    {
-        "text": "Yu Gothic UI",
-        "font": "\"Yu Gothic UI\""
-    },
-    {
-        "text": "Yu Gothic UI Light",
-        "font": "\"Yu Gothic UI Light\""
-    },
-    {
-        "text": "Yu Gothic UI Semibold",
-        "font": "\"Yu Gothic UI Semibold\""
-    },
-    {
-        "text": "Courier",
-        "font": "Courier"
-    },
-    {
-        "text": "Times",
-        "font": "Times"
-    }
-]
+export const fontSizes = [{
+    "code": "42pt", "name": "初号"
+}, {
+    "code": "36pt", "name": "小初"
+}, {
+    "code": "26pt", "name": "一号"
+}, {
+    "code": "24pt", "name": "小一"
+}, {
+    "code": "22pt", "name": "二号"
+}, {
+    "code": "18pt", "name": "小二"
+}, {
+    "code": "16pt", "name": "三号"
+}, {
+    "code": "15pt", "name": "小三"
+}, {
+    "code": "14pt", "name": "四号"
+}, {
+    "code": "12pt", "name": "小四"
+}, {
+    "code": "10.5pt", "name": "五号"
+}, {
+    "code": "9pt", "name": "小五"
+}, {
+    "code": "7.5pt", "name": "六号"
+}, {
+    "code": "6.5pt", "name": "小六"
+}, {
+    "code": "5.5pt", "name": "七号"
+}, {
+    "code": "5pt", "name": "八号"
+}, {
+    "code": "4pt", "name": "4"
+}, {
+    "code": "8pt", "name": "8"
+}, {
+    "code": "10pt", "name": "10"
+}, {
+    "code": "11pt", "name": "11"
+}, {
+    "code": "20pt", "name": "20"
+}, {
+    "code": "28pt", "name": "28"
+}, {
+    "code": "48pt", "name": "48"
+}, {
+    "code": "72pt", "name": "72"
+}]
+export const availableFonts = [{
+    "text": "微软雅黑", "font": "\"Microsoft YaHei\""
+}, {
+    "text": "宋体", "font": "SimSun"
+}, {
+    "text": "黑体", "font": "SimHei"
+}, {
+    "text": "仿宋", "font": "FangSong"
+}, {
+    "text": "楷体", "font": "KaiTi"
+}, {
+    "text": "新宋体", "font": "NSimSun"
+}, {
+    "text": "微软正黑体", "font": "\"Microsoft JhengHei\""
+}, {
+    "text": "Arial", "font": "Arial"
+}, {
+    "text": "Times New Roman", "font": "\"Times New Roman\""
+}, {
+    "text": "Calibri", "font": "Calibri"
+}, {
+    "text": "Comic Sans MS", "font": "\"Comic Sans MS\""
+}, {
+    "text": "Courier New", "font": "\"Courier New\""
+}, {
+    "text": "Georgia", "font": "Georgia"
+}, {
+    "text": "Impact", "font": "Impact"
+}, {
+    "text": "Trebuchet MS", "font": "\"Trebuchet MS\""
+}, {
+    "text": "Verdana", "font": "Verdana"
+}, {
+    "text": "Arial Black", "font": "\"Arial Black\""
+}, {
+    "text": "Arial Narrow", "font": "\"Arial Narrow\""
+}, {
+    "text": "Cambria", "font": "Cambria"
+}, {
+    "text": "Cambria Math", "font": "\"Cambria Math\""
+}, {
+    "text": "Candara", "font": "Candara"
+}, {
+    "text": "Consolas", "font": "Consolas"
+}, {
+    "text": "Constantia", "font": "Constantia"
+}, {
+    "text": "Corbel", "font": "Corbel"
+}, {
+    "text": "Ebrima", "font": "Ebrima"
+}, {
+    "text": "Franklin Gothic", "font": "\"Franklin Gothic\""
+}, {
+    "text": "Franklin Gothic Medium", "font": "\"Franklin Gothic Medium\""
+}, {
+    "text": "Gabriola", "font": "Gabriola"
+}, {
+    "text": "Gadugi", "font": "Gadugi"
+}, {
+    "text": "Lucida Console", "font": "\"Lucida Console\""
+}, {
+    "text": "Lucida Sans Unicode", "font": "\"Lucida Sans Unicode\""
+}, {
+    "text": "Malgun Gothic", "font": "\"Malgun Gothic\""
+}, {
+    "text": "Marlett", "font": "Marlett"
+}, {
+    "text": "Microsoft Himalaya", "font": "\"Microsoft Himalaya\""
+}, {
+    "text": "Microsoft JhengHei UI", "font": "\"Microsoft JhengHei UI\""
+}, {
+    "text": "Microsoft JhengHei UI Light", "font": "\"Microsoft JhengHei UI Light\""
+}, {
+    "text": "Microsoft New Tai Lue", "font": "\"Microsoft New Tai Lue\""
+}, {
+    "text": "Microsoft PhagsPa", "font": "\"Microsoft PhagsPa\""
+}, {
+    "text": "Microsoft Sans Serif", "font": "\"Microsoft Sans Serif\""
+}, {
+    "text": "Microsoft Tai Le", "font": "\"Microsoft Tai Le\""
+}, {
+    "text": "Microsoft YaHei UI", "font": "\"Microsoft YaHei UI\""
+}, {
+    "text": "Microsoft YaHei UI Light", "font": "\"Microsoft YaHei UI Light\""
+}, {
+    "text": "Microsoft Yi Baiti", "font": "\"Microsoft Yi Baiti\""
+}, {
+    "text": "MingLiU-ExtB", "font": "MingLiU-ExtB"
+}, {
+    "text": "MingLiU_HKSCS-ExtB", "font": "MingLiU_HKSCS-ExtB"
+}, {
+    "text": "Mongolian Baiti", "font": "\"Mongolian Baiti\""
+}, {
+    "text": "MS Gothic", "font": "\"MS Gothic\""
+}, {
+    "text": "MS PGothic", "font": "\"MS PGothic\""
+}, {
+    "text": "MS UI Gothic", "font": "\"MS UI Gothic\""
+}, {
+    "text": "MT Extra", "font": "\"MT Extra\""
+}, {
+    "text": "MV Boli", "font": "\"MV Boli\""
+}, {
+    "text": "Myanmar Text", "font": "\"Myanmar Text\""
+}, {
+    "text": "Nirmala UI", "font": "\"Nirmala UI\""
+}, {
+    "text": "Palatino Linotype", "font": "\"Palatino Linotype\""
+}, {
+    "text": "PMingLiU-ExtB", "font": "PMingLiU-ExtB"
+}, {
+    "text": "Segoe Print", "font": "\"Segoe Print\""
+}, {
+    "text": "Segoe Script", "font": "\"Segoe Script\""
+}, {
+    "text": "Segoe UI Symbol", "font": "\"Segoe UI Symbol\""
+}, {
+    "text": "Sylfaen", "font": "Sylfaen"
+}, {
+    "text": "Symbol", "font": "Symbol"
+}, {
+    "text": "Tahoma", "font": "Tahoma"
+}, {
+    "text": "Webdings", "font": "Webdings"
+}, {
+    "text": "Wingdings", "font": "Wingdings"
+}, {
+    "text": "Yu Gothic", "font": "\"Yu Gothic\""
+}, {
+    "text": "Yu Gothic Light", "font": "\"Yu Gothic Light\""
+}, {
+    "text": "Yu Gothic Medium", "font": "\"Yu Gothic Medium\""
+}, {
+    "text": "Yu Gothic UI", "font": "\"Yu Gothic UI\""
+}, {
+    "text": "Yu Gothic UI Light", "font": "\"Yu Gothic UI Light\""
+}, {
+    "text": "Yu Gothic UI Semibold", "font": "\"Yu Gothic UI Semibold\""
+}, {
+    "text": "Courier", "font": "Courier"
+}, {
+    "text": "Times", "font": "Times"
+}]