瀏覽代碼

使用 setup 中的糖语法

xiaochan 3 年之前
父節點
當前提交
ae4bbbb3e0

+ 236 - 0
package-lock.json

@@ -4,6 +4,12 @@
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
+    "@antfu/utils": {
+      "version": "0.5.0",
+      "resolved": "https://registry.npmmirror.com/@antfu/utils/-/utils-0.5.0.tgz",
+      "integrity": "sha512-MrAQ/MrPSxbh1bBrmwJjORfJymw4IqSHFBXqvxaga3ZdDM+/zokYF8DjyJpSjY2QmpmgQrajDUBJOWrYeARfzA==",
+      "dev": true
+    },
     "@babel/code-frame": {
       "version": "7.16.7",
       "resolved": "https://registry.npmmirror.com/@babel/code-frame/download/@babel/code-frame-7.16.7.tgz",
@@ -6427,6 +6433,12 @@
         "json5": "^1.0.1"
       }
     },
+    "local-pkg": {
+      "version": "0.4.1",
+      "resolved": "https://registry.npmmirror.com/local-pkg/-/local-pkg-0.4.1.tgz",
+      "integrity": "sha512-lL87ytIGP2FU5PWwNDo0w3WhIo2gopIAxPg9RxDYF7m4rr5ahuZxP22xnJHIvaLTe4Z9P6uKKY2UHiwyB4pcrw==",
+      "dev": true
+    },
     "locate-path": {
       "version": "5.0.0",
       "resolved": "https://registry.nlark.com/locate-path/download/locate-path-5.0.0.tgz?cache=0&sync_timestamp=1629895724478&other_urls=https%3A%2F%2Fregistry.nlark.com%2Flocate-path%2Fdownload%2Flocate-path-5.0.0.tgz",
@@ -10420,6 +10432,12 @@
         "has-flag": "^3.0.0"
       }
     },
+    "supports-preserve-symlinks-flag": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmmirror.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
+      "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
+      "dev": true
+    },
     "svgo": {
       "version": "1.3.2",
       "resolved": "https://registry.npmmirror.com/svgo/download/svgo-1.3.2.tgz",
@@ -10883,6 +10901,131 @@
       "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=",
       "dev": true
     },
+    "unplugin": {
+      "version": "0.4.0",
+      "resolved": "https://registry.npmmirror.com/unplugin/-/unplugin-0.4.0.tgz",
+      "integrity": "sha512-4ScITEmzlz1iZW3tkz+3L1V5k/xMQ6kjgm4lEXKxH0ozd8/OUWfiSA7RMRyrawsvq/t50JIzPpp1UyuSL/AXkA==",
+      "dev": true,
+      "requires": {
+        "chokidar": "^3.5.3",
+        "webpack-virtual-modules": "^0.4.3"
+      },
+      "dependencies": {
+        "braces": {
+          "version": "3.0.2",
+          "resolved": "https://registry.npmmirror.com/braces/-/braces-3.0.2.tgz",
+          "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
+          "dev": true,
+          "requires": {
+            "fill-range": "^7.0.1"
+          }
+        },
+        "chokidar": {
+          "version": "3.5.3",
+          "resolved": "https://registry.npmmirror.com/chokidar/-/chokidar-3.5.3.tgz",
+          "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==",
+          "dev": true,
+          "requires": {
+            "anymatch": "~3.1.2",
+            "braces": "~3.0.2",
+            "fsevents": "~2.3.2",
+            "glob-parent": "~5.1.2",
+            "is-binary-path": "~2.1.0",
+            "is-glob": "~4.0.1",
+            "normalize-path": "~3.0.0",
+            "readdirp": "~3.6.0"
+          }
+        },
+        "fill-range": {
+          "version": "7.0.1",
+          "resolved": "https://registry.npmmirror.com/fill-range/-/fill-range-7.0.1.tgz",
+          "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
+          "dev": true,
+          "requires": {
+            "to-regex-range": "^5.0.1"
+          }
+        },
+        "glob-parent": {
+          "version": "5.1.2",
+          "resolved": "https://registry.npmmirror.com/glob-parent/-/glob-parent-5.1.2.tgz",
+          "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
+          "dev": true,
+          "requires": {
+            "is-glob": "^4.0.1"
+          }
+        },
+        "is-number": {
+          "version": "7.0.0",
+          "resolved": "https://registry.npmmirror.com/is-number/-/is-number-7.0.0.tgz",
+          "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
+          "dev": true
+        },
+        "to-regex-range": {
+          "version": "5.0.1",
+          "resolved": "https://registry.npmmirror.com/to-regex-range/-/to-regex-range-5.0.1.tgz",
+          "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+          "dev": true,
+          "requires": {
+            "is-number": "^7.0.0"
+          }
+        }
+      }
+    },
+    "unplugin-auto-import": {
+      "version": "0.6.6",
+      "resolved": "https://registry.npmmirror.com/unplugin-auto-import/-/unplugin-auto-import-0.6.6.tgz",
+      "integrity": "sha512-x3YxAI9ePoumXOakuS5YJlFkSyAkl5vJlaFZSJhSp75nH5gg8LpqQ/0Gz1/CG/JRRv+xaE1CZpEV161AqFGjEg==",
+      "dev": true,
+      "requires": {
+        "@antfu/utils": "^0.5.0",
+        "@rollup/pluginutils": "^4.2.0",
+        "local-pkg": "^0.4.1",
+        "magic-string": "^0.26.1",
+        "resolve": "^1.22.0",
+        "unplugin": "^0.4.0"
+      },
+      "dependencies": {
+        "@rollup/pluginutils": {
+          "version": "4.2.0",
+          "resolved": "https://registry.npmmirror.com/@rollup/pluginutils/-/pluginutils-4.2.0.tgz",
+          "integrity": "sha512-2WUyJNRkyH5p487pGnn4tWAsxhEFKN/pT8CMgHshd5H+IXkOnKvKZwsz5ZWz+YCXkleZRAU5kwbfgF8CPfDRqA==",
+          "dev": true,
+          "requires": {
+            "estree-walker": "^2.0.1",
+            "picomatch": "^2.2.2"
+          }
+        },
+        "is-core-module": {
+          "version": "2.8.1",
+          "resolved": "https://registry.npmmirror.com/is-core-module/-/is-core-module-2.8.1.tgz",
+          "integrity": "sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==",
+          "dev": true,
+          "requires": {
+            "has": "^1.0.3"
+          }
+        },
+        "magic-string": {
+          "version": "0.26.1",
+          "resolved": "https://registry.npmmirror.com/magic-string/-/magic-string-0.26.1.tgz",
+          "integrity": "sha512-ndThHmvgtieXe8J/VGPjG+Apu7v7ItcD5mhEIvOscWjPF/ccOiLxHaSuCAS2G+3x4GKsAbT8u7zdyamupui8Tg==",
+          "dev": true,
+          "requires": {
+            "sourcemap-codec": "^1.4.8"
+          }
+        },
+        "resolve": {
+          "version": "1.22.0",
+          "resolved": "https://registry.npmmirror.com/resolve/-/resolve-1.22.0.tgz",
+          "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==",
+          "dev": true,
+          "requires": {
+            "is-core-module": "^2.8.1",
+            "path-parse": "^1.0.7",
+            "supports-preserve-symlinks-flag": "^1.0.0"
+          }
+        }
+      }
+    },
     "unquote": {
       "version": "1.1.1",
       "resolved": "https://registry.npm.taobao.org/unquote/download/unquote-1.1.1.tgz",
@@ -11289,6 +11432,93 @@
         }
       }
     },
+    "vite-plugin-vue-setup-extend": {
+      "version": "0.4.0",
+      "resolved": "https://registry.npmmirror.com/vite-plugin-vue-setup-extend/-/vite-plugin-vue-setup-extend-0.4.0.tgz",
+      "integrity": "sha512-WMbjPCui75fboFoUTHhdbXzu4Y/bJMv5N9QT9a7do3wNMNHHqrk+Tn2jrSJU0LS5fGl/EG+FEDBYVUeWIkDqXQ==",
+      "dev": true,
+      "requires": {
+        "@vue/compiler-sfc": "^3.2.29",
+        "magic-string": "^0.25.7"
+      },
+      "dependencies": {
+        "@vue/compiler-core": {
+          "version": "3.2.31",
+          "resolved": "https://registry.npmmirror.com/@vue/compiler-core/-/compiler-core-3.2.31.tgz",
+          "integrity": "sha512-aKno00qoA4o+V/kR6i/pE+aP+esng5siNAVQ422TkBNM6qA4veXiZbSe8OTXHXquEi/f6Akc+nLfB4JGfe4/WQ==",
+          "dev": true,
+          "requires": {
+            "@babel/parser": "^7.16.4",
+            "@vue/shared": "3.2.31",
+            "estree-walker": "^2.0.2",
+            "source-map": "^0.6.1"
+          }
+        },
+        "@vue/compiler-dom": {
+          "version": "3.2.31",
+          "resolved": "https://registry.npmmirror.com/@vue/compiler-dom/-/compiler-dom-3.2.31.tgz",
+          "integrity": "sha512-60zIlFfzIDf3u91cqfqy9KhCKIJgPeqxgveH2L+87RcGU/alT6BRrk5JtUso0OibH3O7NXuNOQ0cDc9beT0wrg==",
+          "dev": true,
+          "requires": {
+            "@vue/compiler-core": "3.2.31",
+            "@vue/shared": "3.2.31"
+          }
+        },
+        "@vue/compiler-sfc": {
+          "version": "3.2.31",
+          "resolved": "https://registry.npmmirror.com/@vue/compiler-sfc/-/compiler-sfc-3.2.31.tgz",
+          "integrity": "sha512-748adc9msSPGzXgibHiO6T7RWgfnDcVQD+VVwYgSsyyY8Ans64tALHZANrKtOzvkwznV/F4H7OAod/jIlp/dkQ==",
+          "dev": true,
+          "requires": {
+            "@babel/parser": "^7.16.4",
+            "@vue/compiler-core": "3.2.31",
+            "@vue/compiler-dom": "3.2.31",
+            "@vue/compiler-ssr": "3.2.31",
+            "@vue/reactivity-transform": "3.2.31",
+            "@vue/shared": "3.2.31",
+            "estree-walker": "^2.0.2",
+            "magic-string": "^0.25.7",
+            "postcss": "^8.1.10",
+            "source-map": "^0.6.1"
+          }
+        },
+        "@vue/compiler-ssr": {
+          "version": "3.2.31",
+          "resolved": "https://registry.npmmirror.com/@vue/compiler-ssr/-/compiler-ssr-3.2.31.tgz",
+          "integrity": "sha512-mjN0rqig+A8TVDnsGPYJM5dpbjlXeHUm2oZHZwGyMYiGT/F4fhJf/cXy8QpjnLQK4Y9Et4GWzHn9PS8AHUnSkw==",
+          "dev": true,
+          "requires": {
+            "@vue/compiler-dom": "3.2.31",
+            "@vue/shared": "3.2.31"
+          }
+        },
+        "@vue/reactivity-transform": {
+          "version": "3.2.31",
+          "resolved": "https://registry.npmmirror.com/@vue/reactivity-transform/-/reactivity-transform-3.2.31.tgz",
+          "integrity": "sha512-uS4l4z/W7wXdI+Va5pgVxBJ345wyGFKvpPYtdSgvfJfX/x2Ymm6ophQlXXB6acqGHtXuBqNyyO3zVp9b1r0MOA==",
+          "dev": true,
+          "requires": {
+            "@babel/parser": "^7.16.4",
+            "@vue/compiler-core": "3.2.31",
+            "@vue/shared": "3.2.31",
+            "estree-walker": "^2.0.2",
+            "magic-string": "^0.25.7"
+          }
+        },
+        "@vue/shared": {
+          "version": "3.2.31",
+          "resolved": "https://registry.npmmirror.com/@vue/shared/-/shared-3.2.31.tgz",
+          "integrity": "sha512-ymN2pj6zEjiKJZbrf98UM2pfDd6F2H7ksKw7NDt/ZZ1fh5Ei39X5tABugtT03ZRlWd9imccoK0hE8hpjpU7irQ==",
+          "dev": true
+        },
+        "source-map": {
+          "version": "0.6.1",
+          "resolved": "https://registry.npmmirror.com/source-map/-/source-map-0.6.1.tgz",
+          "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+          "dev": true
+        }
+      }
+    },
     "vm-browserify": {
       "version": "1.1.2",
       "resolved": "https://registry.npm.taobao.org/vm-browserify/download/vm-browserify-1.1.2.tgz",
@@ -12079,6 +12309,12 @@
         }
       }
     },
+    "webpack-virtual-modules": {
+      "version": "0.4.3",
+      "resolved": "https://registry.npmmirror.com/webpack-virtual-modules/-/webpack-virtual-modules-0.4.3.tgz",
+      "integrity": "sha512-5NUqC2JquIL2pBAAo/VfBP6KuGkHIZQXW/lNKupLPfhViwh8wNsu0BObtl09yuKZszeEUfbXz8xhrHvSG16Nqw==",
+      "dev": true
+    },
     "websocket-driver": {
       "version": "0.7.4",
       "resolved": "https://registry.npm.taobao.org/websocket-driver/download/websocket-driver-0.7.4.tgz",

+ 2 - 0
package.json

@@ -38,8 +38,10 @@
     "@vue/cli-service": "^4.5.15",
     "@vue/compiler-sfc": "^3.0.5",
     "sass": "^1.32.12",
+    "unplugin-auto-import": "^0.6.6",
     "vite": "2.3.7",
     "vite-plugin-mock": "2.8.0",
+    "vite-plugin-vue-setup-extend": "^0.4.0",
     "vue-tsc": "^0.0.24"
   }
 }

+ 29 - 29
src/api/covid.js

@@ -1,48 +1,48 @@
 import request from '../utils/request'
 
 export function getList(patientId) {
-  return request({
-    url: '/covid/getList',
-    method: 'get',
-    params: { patientId },
-  })
+    return request({
+        url: '/covid/getList',
+        method: 'get',
+        params: {patientId},
+    })
 }
 
 export function getDetail(id) {
-  return request({
-    url: '/covid/getDetail',
-    method: 'get',
-    params: { id },
-  })
+    return request({
+        url: '/covid/getDetail',
+        method: 'get',
+        params: {id},
+    })
 }
 
 export function getPatientInfo(patientId) {
-  return request({
-    url: '/covid/getPatientInfo',
-    method: 'get',
-    params: { patientId },
-  })
+    return request({
+        url: '/covid/getPatientInfo',
+        method: 'get',
+        params: {patientId},
+    })
 }
 
 export function submitCovidAssessment(data) {
-  return request({
-    url: '/covid/submit',
-    method: 'post',
-    data,
-  })
+    return request({
+        url: '/covid/submit',
+        method: 'post',
+        data,
+    })
 }
 
 export function getRegionProvince() {
-  return request({
-    url: '/covid/getRegionProvince',
-    method: 'get',
-  })
+    return request({
+        url: '/covid/getRegionProvince',
+        method: 'get',
+    })
 }
 
 export function getChildRegion(parentCode) {
-  return request({
-    url: '/covid/getChildRegion',
-    method: 'get',
-    params: { parentCode },
-  })
+    return request({
+        url: '/covid/getChildRegion',
+        method: 'get',
+        params: {parentCode},
+    })
 }

+ 52 - 0
src/auto-imports.d.ts

@@ -0,0 +1,52 @@
+// Generated by 'unplugin-auto-import'
+// We suggest you to commit this file into source control
+declare global {
+  const computed: typeof import('vue')['computed']
+  const createApp: typeof import('vue')['createApp']
+  const customRef: typeof import('vue')['customRef']
+  const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
+  const defineComponent: typeof import('vue')['defineComponent']
+  const effectScope: typeof import('vue')['effectScope']
+  const EffectScope: typeof import('vue')['EffectScope']
+  const getCurrentInstance: typeof import('vue')['getCurrentInstance']
+  const getCurrentScope: typeof import('vue')['getCurrentScope']
+  const h: typeof import('vue')['h']
+  const inject: typeof import('vue')['inject']
+  const isReadonly: typeof import('vue')['isReadonly']
+  const isRef: typeof import('vue')['isRef']
+  const markRaw: typeof import('vue')['markRaw']
+  const nextTick: typeof import('vue')['nextTick']
+  const onActivated: typeof import('vue')['onActivated']
+  const onBeforeMount: typeof import('vue')['onBeforeMount']
+  const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
+  const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
+  const onDeactivated: typeof import('vue')['onDeactivated']
+  const onErrorCaptured: typeof import('vue')['onErrorCaptured']
+  const onMounted: typeof import('vue')['onMounted']
+  const onRenderTracked: typeof import('vue')['onRenderTracked']
+  const onRenderTriggered: typeof import('vue')['onRenderTriggered']
+  const onScopeDispose: typeof import('vue')['onScopeDispose']
+  const onServerPrefetch: typeof import('vue')['onServerPrefetch']
+  const onUnmounted: typeof import('vue')['onUnmounted']
+  const onUpdated: typeof import('vue')['onUpdated']
+  const provide: typeof import('vue')['provide']
+  const reactive: typeof import('vue')['reactive']
+  const readonly: typeof import('vue')['readonly']
+  const ref: typeof import('vue')['ref']
+  const resolveComponent: typeof import('vue')['resolveComponent']
+  const shallowReactive: typeof import('vue')['shallowReactive']
+  const shallowReadonly: typeof import('vue')['shallowReadonly']
+  const shallowRef: typeof import('vue')['shallowRef']
+  const toRaw: typeof import('vue')['toRaw']
+  const toRef: typeof import('vue')['toRef']
+  const toRefs: typeof import('vue')['toRefs']
+  const triggerRef: typeof import('vue')['triggerRef']
+  const unref: typeof import('vue')['unref']
+  const useAttrs: typeof import('vue')['useAttrs']
+  const useCssModule: typeof import('vue')['useCssModule']
+  const useCssVars: typeof import('vue')['useCssVars']
+  const useSlots: typeof import('vue')['useSlots']
+  const watch: typeof import('vue')['watch']
+  const watchEffect: typeof import('vue')['watchEffect']
+}
+export {}

+ 0 - 164
src/components/zhu-yuan-yi-sheng/HuanZheLieBiao.vue

@@ -1,164 +0,0 @@
-<template>
-  <el-container>
-    <el-aside style="width: 190px;">
-      <el-select v-model="currentWard" filterable style="width: 120px" @change="huoQuHuanZheLieBiaoClick">
-        <el-option v-for="item in userWards" :key="item.code" :label="item.name" :value="item.code"></el-option>
-      </el-select>
-      <el-select v-model="inpatientNo" :filter-method="filterMethod" clearable filterable style="width: 120px;">
-        <el-option v-for="item in cptHuanZheLieBiaoData" :key="item.inpatientNo" :label="item.name"
-                   :value="item.inpatientNo"></el-option>
-      </el-select>
-      <el-checkbox v-model="woDeBingRen" style="margin-left: 10px" @change="woDeBingRenClick">我的病人</el-checkbox>
-      <el-table
-          :data="cptHuanZheLieBiaoData.slice((huanZheLieBiaoCurrentPage - 1) * 20,huanZheLieBiaoCurrentPage * 20 )"
-          :height="tableHeight / 1.15" :row-style="tableBackColor" @row-click="tableClick">
-        <el-table-column label="床位" prop="bedNo" width="40"></el-table-column>
-        <el-table-column label="姓名" prop="name">
-          <template #default="scope">
-            <div :title="scope.row.zkWardName">
-              <img :src="scope.row.sex === 1 ? maleIcon : femaleIcon"
-                   class="sex-icon"/>
-              {{ scope.row.name }}
-            </div>
-          </template>
-        </el-table-column>
-        <el-table-column label="住院号" prop="inpatientNo"></el-table-column>
-        <el-table-column label="小科室" prop="zkWardName"></el-table-column>
-      </el-table>
-      <el-pagination
-          :page-size="20"
-          :total="huanZheLieBiaoData.length"
-          layout="prev,pager,next,total"
-          small
-          @current-change="huanZheLeiBiaoCurrentChange"
-      >
-      </el-pagination>
-    </el-aside>
-  </el-container>
-</template>
-
-<script>
-
-import {computed, onMounted, ref, watch} from "vue";
-import store from "@/store";
-import {huoQuGeRenPinLv, huoQuHuanZheLieBiao, huoQuHuanZheXinXi} from "@/api/zhu-yuan-yi-sheng/yi-zhu-lu-ru";
-
-import {
-  huanZhePinLvData,
-  huanZheXinXi,
-  selectWardCode
-} from "@/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng"
-import maleIcon from '@/assets/male-icon.png'
-import femaleIcon from '@/assets/female-icon.png'
-import {getUserWards} from "@/api/case-front-sheet";
-import {listNotBlank, stringIsBlank, stringNotBlank} from "@/utils/blank-utils";
-import {clone} from "@/utils/clone";
-
-export default {
-  name: "HuanZheLieBiao",
-  props: ['inpatientNo'],
-  setup(props, cxt) {
-    const tableHeight = computed(() => {
-      return store.state.app.windowSize.h
-    })
-    // 选择的病房
-    const currentWard = ref('')
-    // 用户可以选择的 病房信息
-    const userWards = ref([])
-    // 住院号
-    const inpatientNo = ref('')
-
-    const cptHuanZheLieBiaoData = ref([])
-    const huanZheLieBiaoData = ref([])
-    const huanZheLieBiaoCurrentPage = ref(1)
-    const woDeBingRen = ref(false)
-
-    const huoQuHuanZheLieBiaoClick = () => {
-      huoQuHuanZheLieBiao(currentWard.value).then((res) => {
-        huanZheLieBiaoData.value = res
-        cptHuanZheLieBiaoData.value = clone(res)
-        selectWardCode.value = currentWard.value
-      }).catch((e) => {
-        huanZheLieBiaoData.value = []
-        cptHuanZheLieBiaoData.value = []
-      })
-    }
-
-    const huanZheLeiBiaoCurrentChange = (val) => {
-      huanZheLieBiaoCurrentPage.value = val
-    }
-
-    const tableClick = (val) => {
-      inpatientNo.value = val.inpatientNo
-    }
-
-    watch(() => inpatientNo.value, () => {
-      if (stringIsBlank(inpatientNo.value)) {
-        cptHuanZheLieBiaoData.value = huanZheLieBiaoData.value
-      } else {
-        huoQuHuanZheXinXi(inpatientNo.value).then((res) => {
-          huanZheXinXi.value = res
-          // 加载患者的频率
-          huoQuGeRenPinLv(res.inpatientNo, res.admissTimes).then((res) => {
-            huanZhePinLvData.value = res
-          })
-        })
-      }
-    })
-
-    const woDeBingRenClick = () => {
-      woDeBingRen.value ? filterMethod(store.state.user.info.code) : cptHuanZheLieBiaoData.value = huanZheLieBiaoData.value
-    }
-
-
-    const filterMethod = (val) => {
-      cptHuanZheLieBiaoData.value = huanZheLieBiaoData.value.filter(item => {
-        return item.inpatientNo.indexOf(val) > -1 || item.name.indexOf(val) > -1
-            || item.consultPhysician.indexOf(val) > -1 || (stringNotBlank(item.referPhysician) && item.referPhysician.indexOf(val) > -1)
-      })
-    }
-
-    const tableBackColor = ({row, column, rowIndex, columnIndex}) => {
-      if (row.inpatientNo === inpatientNo.value) {
-        return {
-          backgroundColor: '#a7d3ff!important'
-        }
-      }
-    }
-
-    onMounted(() => {
-      getUserWards().then((res) => {
-        userWards.value = res
-        if (listNotBlank(userWards.value)) {
-          currentWard.value = userWards.value[0].code
-          selectWardCode.value = currentWard.value
-          huoQuHuanZheLieBiaoClick()
-        }
-      })
-    })
-
-    return {
-      tableHeight,
-      currentWard,
-      userWards,
-      huanZheLieBiaoData,
-      huoQuHuanZheLieBiaoClick,
-      huanZheLieBiaoCurrentPage,
-      huanZheLeiBiaoCurrentChange,
-      maleIcon,
-      femaleIcon,
-      woDeBingRen,
-      cptHuanZheLieBiaoData,
-      tableClick,
-      inpatientNo,
-      filterMethod,
-      tableBackColor,
-      woDeBingRenClick
-    }
-  }
-}
-</script>
-
-<style scoped>
-
-</style>

+ 58 - 109
src/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/BaoCunMuBan.vue

@@ -1,5 +1,5 @@
 <template>
-  <el-dialog :title="title" v-model="dialog">
+  <el-dialog v-model="dialog" :title="title">
     模板名称:
     <el-input v-model="patternName" maxlength="50" show-word-limit style="width: 220px"
               @keyup.enter="dianJiBaoCun"></el-input>
@@ -21,128 +21,77 @@
   </el-dialog>
 </template>
 
-<script>
+<script name="BaoCunMuBan" setup>
 import {computed, ref} from "vue";
 import store from '../../../store'
 import {needRule} from "@/utils/public";
 import {baoCunMuBan, muBanCaoZuo} from "@/api/zhu-yuan-yi-sheng/yi-zhu-lu-ru";
 import {muBanMing} from '@/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng'
 import {ElMessageBox} from "element-plus";
-import {stringIsBlank, stringNotBlank} from "@/utils/blank-utils";
+import {stringNotBlank} from "@/utils/blank-utils";
 
-export default {
-  name: "BaoCunMuBan",
-  setup() {
-    const user = computed(() => {
-      return store.state.user.info
-    })
-    const dialog = ref(false)
-    const title = ref('')
-    const flag = ref(1)
-    const quanYuanFlag = needRule([1, 38])
-    const keZhuRenFlag = needRule([1, 38, 11])
-    // 模板名称
-    const patternCode = ref('')
-    const patternName = ref('')
-    const inputType = ref(3)
-    const sortNo = ref(0)
-    const list = ref([])
-
-
-    const daKaiBaoCunMuBan = (val) => {
-      if (stringNotBlank(muBanMing.value.patternName)) {
-        patternName.value = muBanMing.value.patternName
-        sortNo.value = muBanMing.value.sortNo
-        inputType.value = muBanMing.value.inputType
-      }
-      list.value = val
-      dialog.value = true
-      title.value = '保存模板'
-      flag.value = 1
-    }
+const user = computed(() => {
+  return store.state.user.info
+})
+const dialog = ref(false)
+const title = ref('')
+const flag = ref(1)
+const quanYuanFlag = needRule([1, 38])
+const keZhuRenFlag = needRule([1, 38, 11])
+// 模板名称
+const patternCode = ref('')
+const patternName = ref('')
+const inputType = ref(3)
+const sortNo = ref(0)
+const list = ref([])
 
-    const daKaiBianJiMuBan = (val) => {
-      patternCode.value = val.patternCode
-      patternName.value = val.patternName
-      sortNo.value = stringIsBlank(val.sortNo) ? 0 : val.sortNo
-      dialog.value = true
-      title.value = '修改模板'
-      flag.value = 2
+const dianJiBaoCun = () => {
+  if (flag.value === 1) {
+    let data = {
+      patternName: patternName.value,
+      inputType: inputType.value,
+      sortNo: sortNo.value,
+      list: list.value,
+      deptCode: user.value.deptCode,
+      qingZhiTiHuan: stringNotBlank(muBanMing.value.patternName)
     }
-
-    const bianJiNeiRong = (val) => {
-      patternCode.value = val.patternCode
-      patternName.value = val.patternName
-      sortNo.value = stringIsBlank(val.sortNo) ? 0 : val.sortNo
-      title.value = '编辑模板'
-    }
-
-    const dianJiBaoCun = () => {
-      if (flag.value === 1) {
-        let data = {
-          patternName: patternName.value,
-          inputType: inputType.value,
-          sortNo: sortNo.value,
-          list: list.value,
-          deptCode: user.value.deptCode,
-          qingZhiTiHuan: stringNotBlank(muBanMing.value.patternName)
-        }
-        baoCunMuBan(data).then((res) => {
-          qingKong()
-        }).catch(e => {
-          if (e.indexOf('是否替换:【900】') > -1) {
-            ElMessageBox.confirm('已存在相同的模板名称,是否覆盖原来的数据。', '提示', {
-              type: 'warning'
-            }).then(() => {
-              let data = {
-                patternName: patternName.value,
-                inputType: inputType.value,
-                sortNo: sortNo.value,
-                list: list.value,
-                deptCode: user.value.deptCode,
-                qingZhiTiHuan: true
-              }
-              baoCunMuBan(data).then((res) => {
-                qingKong()
-              })
-            }).catch((action) => {
-            })
+    baoCunMuBan(data).then((res) => {
+      qingKong()
+    }).catch(e => {
+      if (e.indexOf('是否替换:【900】') > -1) {
+        ElMessageBox.confirm('已存在相同的模板名称,是否覆盖原来的数据。', '提示', {
+          type: 'warning'
+        }).then(() => {
+          let data = {
+            patternName: patternName.value,
+            inputType: inputType.value,
+            sortNo: sortNo.value,
+            list: list.value,
+            deptCode: user.value.deptCode,
+            qingZhiTiHuan: true
           }
-        })
-      } else if (flag.value === 2) {
-        muBanCaoZuo(patternCode.value, patternName.value, user.value.deptCode, sortNo.value, 1).then((res) => {
-          qingKong()
+          baoCunMuBan(data).then((res) => {
+            qingKong()
+          })
+        }).catch((action) => {
         })
       }
-    }
-
-
-    const qingKong = () => {
-      patternName.value = null
-      sortNo.value = 0
-      inputType.value = 3
-      dialog.value = false
-      muBanMing.value = {}
-    }
-
-    return {
-      dialog,
-      patternName,
-      inputType,
-      user,
-      quanYuanFlag,
-      keZhuRenFlag,
-      daKaiBaoCunMuBan,
-      sortNo,
-      dianJiBaoCun,
-      title,
-      daKaiBianJiMuBan,
-      flag,
-      qingKong,
-      bianJiNeiRong
-    }
+    })
+  } else if (flag.value === 2) {
+    muBanCaoZuo(patternCode.value, patternName.value, user.value.deptCode, sortNo.value, 1).then((res) => {
+      qingKong()
+    })
   }
 }
+
+const qingKong = () => {
+  patternName.value = null
+  sortNo.value = 0
+  inputType.value = 3
+  dialog.value = false
+  muBanMing.value = {}
+}
+
 </script>
 
 <style scoped>

+ 256 - 296
src/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/HuoQuMuBan.vue

@@ -1,113 +1,115 @@
 <template>
-  <el-dialog v-model="dialog" :before-close="guanBi" destroy-on-close title="模板"
-             width="90%">
-    <el-container>
-      <el-aside>
-        <el-radio-group v-model="muBanLeiXing" size="small" @change="dianJiChaXun">
-          <el-radio-button :label="0">全部</el-radio-button>
-          <el-radio-button :label="1">全院</el-radio-button>
-          <el-radio-button :label="2">本科室</el-radio-button>
-          <el-radio-button :label="3">个人</el-radio-button>
-          <el-radio-button :label="4">收藏</el-radio-button>
-        </el-radio-group>
-        <el-input v-model="code" clearable style="width: 120px" @keyup.enter="dianJiChaXun"></el-input>
-        <el-button @click="dianJiChaXun">查询</el-button>
-        <el-table :data="fuJiMuBanShuJu.data"
-                  :height="windowSize.h / 1.6"
-                  highlight-current-row stripe style="width: 300px;">
-          <el-table-column label="名称" prop="patternName" width="70"></el-table-column>
-          <el-table-column label="排序" prop="sortNo"></el-table-column>
-          <el-table-column label="操作" width="120">
-            <template #default="scope">
-              <el-dropdown size="small" split-button type="primary" @click="dianJiMuBanMing(scope.row)">
-                选中
-                <template #dropdown>
-                  <el-dropdown-menu>
-                    <el-dropdown-item icon="el-icon-edit" @click="xiuGaiMuBan(scope.row)">修改</el-dropdown-item>
-                    <br>
-                    <el-dropdown-item icon="el-icon-delete" @click="shanChuMuBan(scope.row,scope.$index)">删除
-                    </el-dropdown-item>
-                    <br>
-                    <el-dropdown-item v-if="scope.row.yiBeiShouCang" :disabled="scope.row.inputId === user.code"
-                                      icon="el-icon-collection"
-                                      @click="dianJiShouCang(scope.row)">取消收藏
-                    </el-dropdown-item>
-                    <el-dropdown-item v-else :disabled="scope.row.inputId === user.code"
-                                      icon="el-icon-collection"
-                                      @click="dianJiShouCang(scope.row)">收藏
-                    </el-dropdown-item>
-                  </el-dropdown-menu>
-                </template>
-              </el-dropdown>
-            </template>
-          </el-table-column>
-        </el-table>
-        <el-pagination
-            :current-page="fuJiMuBanShuJu.currentPage"
-            :page-size="fuJiMuBanShuJu.pageSize"
-            :pager-count="5"
-            :total="fuJiMuBanShuJu.total"
-            layout="total,  prev, pager, next"
-            small
-            @current-change="handleCurrentChange"
-        >
-        </el-pagination>
-      </el-aside>
-      <el-main>
-        <el-button :disabled="xuanZhongShuJu.length === 0 " type="primary" @click="dianJiQueDing">确定</el-button>
-        开始时间:
-        <el-date-picker v-model="startTime"
-                        :disabled-date="disabledDate"
-                        format="YYYY-MM-DD HH:mm:ss"
-                        style="width: 180px"
-                        type="datetime" value-format="YYYY-MM-DD HH:mm:ss"></el-date-picker>
-        医嘱时间:
-        <el-input v-model="orderTime" disabled style="width: 180px"></el-input>
-        频率:
-        <el-select v-model="frequCode" :remote-method="pinLvRemoteMethod" clearable filterable remote
-                   size="mini" style="width: 120px"
-                   @change="getFrequCodeName" @clear="frequCode = null">
-          <el-option v-for="item in yaoPinPingLvData" :key="item.code" :label="item.name"
-                     :value="{label:item.name,value:item.code}">
-            <span style="color: #8492a6; font-size: 12px">{{ item.code }}</span>
-            <el-divider direction="vertical"></el-divider>
-            <span>{{ item.name }}</span>
-          </el-option>
-        </el-select>
-        <el-divider direction="vertical"></el-divider>
-        <el-button :disabled="muBanShuJu.length === 0" type="warning" @click="bianJiNeiRong">编辑内容</el-button>
-        <el-table ref="tableRef" :data="muBanShuJu" :height="windowSize.h / 1.6"
-                  :row-class-name="differChildrenRows" class="eltable" row-key="id"
-                  @selection-change="xuanZhongMuBan" @select-all="quanXuanMuBan">
-          <el-table-column fixed="left" type="selection"></el-table-column>
-          <el-table-column fixed="left" label="uuid" prop="id"></el-table-column>
-          <el-table-column label="医嘱名称" prop="orderName" show-overflow-tooltip width="135"></el-table-column>
-          <el-table-column label="规格" prop="drugSpecification"></el-table-column>
-          <el-table-column label="频率" prop="frequCodeName"></el-table-column>
-          <el-table-column label="一次剂量" prop="dose">
-            <template #default="scope">
-              {{ scope.row.dose }} {{ scope.row.doseUnitName }}
-            </template>
-          </el-table-column>
-          <el-table-column label="领量" prop="drugQuan">
-            <template #default="scope">
-              {{ scope.row.drugQuan }} {{ scope.row.miniUnitName }}
-            </template>
-          </el-table-column>
-          <el-table-column label="给药方式" prop="supplyCodeName"></el-table-column>
-          <el-table-column label="执行科室" prop="execUnitName"></el-table-column>
-          <el-table-column label="父医嘱" prop="parentNo"></el-table-column>
-        </el-table>
-      </el-main>
-    </el-container>
-    <bao-cun-mu-ban ref="baoCunMuBan"></bao-cun-mu-ban>
-  </el-dialog>
+  <div v-drag>
+    <el-dialog v-model="dialog" destroy-on-close
+               title="模板" width="90%" @close="emit('close')">
+      <el-container>
+        <el-aside>
+          <el-radio-group v-model="muBanLeiXing" size="small" @change="dianJiChaXun">
+            <el-radio-button :label="0">全部</el-radio-button>
+            <el-radio-button :label="1">全院</el-radio-button>
+            <el-radio-button :label="2">本科室</el-radio-button>
+            <el-radio-button :label="3">个人</el-radio-button>
+            <el-radio-button :label="4">收藏</el-radio-button>
+          </el-radio-group>
+          <el-input v-model="code" clearable style="width: 120px" @keyup.enter="dianJiChaXun"></el-input>
+          <el-button @click="dianJiChaXun">查询</el-button>
+          <el-table :data="fuJiMuBanShuJu.data"
+                    :height="windowSize.h / 1.6"
+                    highlight-current-row stripe style="width: 300px;">
+            <el-table-column label="名称" prop="patternName" width="70"></el-table-column>
+            <el-table-column label="排序" prop="sortNo"></el-table-column>
+            <el-table-column label="操作" width="120">
+              <template #default="scope">
+                <el-dropdown size="small" split-button type="primary" @click="dianJiMuBanMing(scope.row)">
+                  选中
+                  <template #dropdown>
+                    <el-dropdown-menu>
+                      <el-dropdown-item icon="el-icon-edit" @click="xiuGaiMuBan(scope.row)">修改</el-dropdown-item>
+                      <br>
+                      <el-dropdown-item icon="el-icon-delete" @click="shanChuMuBan(scope.row,scope.$index)">删除
+                      </el-dropdown-item>
+                      <br>
+                      <el-dropdown-item v-if="scope.row.yiBeiShouCang" :disabled="scope.row.inputId === user.code"
+                                        icon="el-icon-collection"
+                                        @click="dianJiShouCang(scope.row)">取消收藏
+                      </el-dropdown-item>
+                      <el-dropdown-item v-else :disabled="scope.row.inputId === user.code"
+                                        icon="el-icon-collection"
+                                        @click="dianJiShouCang(scope.row)">收藏
+                      </el-dropdown-item>
+                    </el-dropdown-menu>
+                  </template>
+                </el-dropdown>
+              </template>
+            </el-table-column>
+          </el-table>
+          <el-pagination
+              :current-page="fuJiMuBanShuJu.currentPage"
+              :page-size="fuJiMuBanShuJu.pageSize"
+              :pager-count="5"
+              :total="fuJiMuBanShuJu.total"
+              layout="total,  prev, pager, next"
+              small
+              @current-change="handleCurrentChange"
+          >
+          </el-pagination>
+        </el-aside>
+        <el-main>
+          <el-button :disabled="xuanZhongShuJu.length === 0 " type="primary" @click="dianJiQueDing">确定</el-button>
+          开始时间:
+          <el-date-picker v-model="startTime"
+                          :disabled-date="disabledDate"
+                          format="YYYY-MM-DD HH:mm:ss"
+                          style="width: 180px"
+                          type="datetime" value-format="YYYY-MM-DD HH:mm:ss"></el-date-picker>
+          医嘱时间:
+          <el-input v-model="orderTime" disabled style="width: 180px"></el-input>
+          频率:
+          <el-select v-model="frequCode" :remote-method="pinLvRemoteMethod" clearable filterable remote
+                     size="mini" style="width: 120px"
+                     @change="getFrequCodeName" @clear="frequCode = null">
+            <el-option v-for="item in yaoPinPingLvData" :key="item.code" :label="item.name"
+                       :value="{label:item.name,value:item.code}">
+              <span style="color: #8492a6; font-size: 12px">{{ item.code }}</span>
+              <el-divider direction="vertical"></el-divider>
+              <span>{{ item.name }}</span>
+            </el-option>
+          </el-select>
+          <el-divider direction="vertical"></el-divider>
+          <el-button :disabled="muBanShuJu.length === 0" type="warning" @click="bianJiNeiRong">编辑内容</el-button>
+          <el-table ref="tableRef" :data="muBanShuJu" :height="windowSize.h / 1.6" :row-class-name="differChildrenRows"
+                    border class="eltable" row-key="id"
+                    @selection-change="xuanZhongMuBan" @select-all="quanXuanMuBan">
+            <el-table-column fixed="left" type="selection"></el-table-column>
+            <el-table-column fixed="left" label="uuid" prop="id"></el-table-column>
+            <el-table-column label="医嘱名称" prop="orderName" show-overflow-tooltip width="135"></el-table-column>
+            <el-table-column label="规格" prop="drugSpecification"></el-table-column>
+            <el-table-column label="频率" prop="frequCodeName"></el-table-column>
+            <el-table-column label="一次剂量" prop="dose">
+              <template #default="scope">
+                {{ scope.row.dose }} {{ scope.row.doseUnitName }}
+              </template>
+            </el-table-column>
+            <el-table-column label="领量" prop="drugQuan">
+              <template #default="scope">
+                {{ scope.row.drugQuan }} {{ scope.row.miniUnitName }}
+              </template>
+            </el-table-column>
+            <el-table-column label="给药方式" prop="supplyCodeName"></el-table-column>
+            <el-table-column label="执行科室" prop="execUnitName"></el-table-column>
+            <el-table-column label="父医嘱" prop="parentNo"></el-table-column>
+          </el-table>
+        </el-main>
+      </el-container>
+      <bao-cun-mu-ban ref="baoCunMuBan"></bao-cun-mu-ban>
+    </el-dialog>
+  </div>
 </template>
 
-<script>
+<script name="HuoQuMuBan" setup>
 import store from '../../../store'
 import {huoQuMuBanShuJu, huoQuYiZhuMuBan, huoQuZhuYuanPinLv, muBanCaoZuo,} from "@/api/zhu-yuan-yi-sheng/yi-zhu-lu-ru";
-import {getSelfBuy, muBanMing} from "@/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng"
+import {muBanMing} from "@/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng"
 import {computed, ref} from "vue";
 import {listIsBlank, stringNotBlank} from "@/utils/blank-utils";
 import {ElMessage, ElMessageBox} from "element-plus";
@@ -115,220 +117,178 @@ import {clone} from "@/utils/clone";
 import BaoCunMuBan from "./BaoCunMuBan.vue";
 import {getServerDateApi} from "@/api/public-api";
 
-export default {
-  name: "HuoQuMuBan",
-  components: {BaoCunMuBan},
-  emits: ['mu-ban-shu-ju'],
-  setup(props, {emit}) {
-    const windowSize = computed(() => {
-      return store.state.app.windowSize
-    })
+// 调用父组件的方法
+const emit = defineEmits(['mu-ban-shu-ju', 'close'])
 
-    const user = computed(() => {
-      return store.state.user.info
-    })
+const windowSize = computed(() => {
+  return store.state.app.windowSize
+})
 
-    const code = ref('')
-    const dialog = ref(false)
-    const muBanShuJu = ref([])
-    const tableRef = ref(null)
-    const muBanLeiXing = ref(3)
+const user = computed(() => {
+  return store.state.user.info
+})
 
-    const startTime = ref('')
-    const orderTime = ref('')
-    const frequCode = ref('')
-    const frequCodeName = ref('')
-    const yaoPinPingLvData = ref([])
+const code = ref('')
+const dialog = ref(true)
+const muBanShuJu = ref([])
+const tableRef = ref(null)
+const muBanLeiXing = ref(3)
 
-    const dianJiFuJiXinXi = ref('')
+let startTime = $ref('')
+const orderTime = ref('')
+const frequCode = ref('')
+const frequCodeName = ref('')
+const yaoPinPingLvData = ref([])
 
-    // 修改模板
-    const baoCunMuBan = ref(null)
+const dianJiFuJiXinXi = ref('')
 
-    const fuJiMuBanShuJu = ref({
-      currentPage: 1,
-      pageSize: 20,
-      total: 0,
-      data: []
-    })
-    // 获取医嘱
-    const dianJiChaXun = () => {
-      huoQuYiZhuMuBan(code.value, user.value.deptCode, muBanLeiXing.value,
-          fuJiMuBanShuJu.value.currentPage, 0).then(res => {
-        fuJiMuBanShuJu.value.data = res.records
-        fuJiMuBanShuJu.value.total = res.total
-      })
-    }
-    dianJiChaXun()
-    const dianJiMuBanMing = (row) => {
-      dianJiFuJiXinXi.value = row
-      huoQuMuBanShuJu(row.inputType === '4' ? row.collectCode : row.patternCode).then((res) => {
-        muBanShuJu.value = res
-      })
-      getServerDateApi().then((res) => {
-        orderTime.value = res
-        startTime.value = res
-      })
-    }
+// 修改模板
+const baoCunMuBan = ref(null)
 
-    // 分页
-    const handleCurrentChange = (val) => {
-      fuJiMuBanShuJu.value.currentPage = val
-      huoQuYiZhuMuBan(code.value, user.value.deptCode, muBanLeiXing.value,
-          fuJiMuBanShuJu.value.currentPage, fuJiMuBanShuJu.value.total).then(res => {
-        fuJiMuBanShuJu.value.data = res.records
-      })
-    }
-
-    // 修改模板
-    const xiuGaiMuBan = (row) => {
-      baoCunMuBan.value.daKaiBianJiMuBan(row)
-    }
-    // 删除模板
-    const shanChuMuBan = (row, index) => {
-      ElMessageBox.confirm('确定要删除该模板吗?', '提示', {
-        type: "error"
-      }).then(() => {
-        muBanCaoZuo(row.patternCode, '', user.value.deptCode, 0, 2)
-      }).catch((e) => {
+const fuJiMuBanShuJu = ref({
+  currentPage: 1,
+  pageSize: 20,
+  total: 0,
+  data: []
+})
+// 获取医嘱
+const dianJiChaXun = () => {
+  huoQuYiZhuMuBan(code.value, user.value.deptCode, muBanLeiXing.value,
+      fuJiMuBanShuJu.value.currentPage, 0).then(res => {
+    fuJiMuBanShuJu.value.data = res.records
+    fuJiMuBanShuJu.value.total = res.total
+  })
+}
 
-      })
-    }
+const dianJiMuBanMing = (row) => {
+  dianJiFuJiXinXi.value = row
+  huoQuMuBanShuJu(row.inputType === '4' ? row.collectCode : row.patternCode).then((res) => {
+    muBanShuJu.value = res
+  })
+  getServerDateApi().then((res) => {
+    orderTime.value = res
+    startTime = res
+  })
+}
 
-    // 收藏模板
-    const dianJiShouCang = (row) => {
-      muBanCaoZuo(row.patternCode, '', user.value.deptCode, 0, 3)
-    }
+// 分页
+const handleCurrentChange = (val) => {
+  fuJiMuBanShuJu.value.currentPage = val
+  huoQuYiZhuMuBan(code.value, user.value.deptCode, muBanLeiXing.value,
+      fuJiMuBanShuJu.value.currentPage, fuJiMuBanShuJu.value.total).then(res => {
+    fuJiMuBanShuJu.value.data = res.records
+  })
+}
 
-    /* 添加子医嘱的背景颜色 */
-    const differChildrenRows = ({row}) => {
-      if (row.isChildren) {
-        return 'children-row'
-      }
-    }
-    // 获取选中的 医嘱数据
-    const xuanZhongShuJu = ref([])
-    const xuanZhongMuBan = (val) => {
-      xuanZhongShuJu.value = val
-    }
+// 修改模板
+const xiuGaiMuBan = (row) => {
+  baoCunMuBan.value.daKaiBianJiMuBan(row)
+}
+// 删除模板
+const shanChuMuBan = (row, index) => {
+  ElMessageBox.confirm('确定要删除该模板吗?', '提示', {
+    type: "error"
+  }).then(() => {
+    muBanCaoZuo(row.patternCode, '', user.value.deptCode, 0, 2)
+  }).catch((e) => {
 
-    // 用户切换全选和全不选 时 el-table中的全选不会选中子节点
-    const toggleSelection = (row, selected) => {
-      if (row) {
-        row.forEach(item => {
-          tableRef.value.toggleRowSelection(item, selected)
-        })
-      }
-    }
+  })
+}
 
-    let flag = false; // 默认 为全不选
-    const quanXuanMuBan = (selection) => {
-      flag = !flag
-      selection.forEach(item => {
-        if (stringNotBlank(item.children)) {
-          toggleSelection(item.children, flag)
-        }
-      })
-      if (!flag) {
-        // 在点击了全不选中 需要清空
-        tableRef.value.clearSelection()
-      }
-    }
+// 收藏模板
+const dianJiShouCang = (row) => {
+  muBanCaoZuo(row.patternCode, '', user.value.deptCode, 0, 3)
+}
 
-    const dianJiQueDing = () => {
-      if (listIsBlank(xuanZhongShuJu.value)) {
-        return ElMessage.error("请先选择数据")
-      }
-      xuanZhongShuJu.value.forEach(item => {
-        item.startTime = startTime.value
-        item.orderTime = orderTime
-        if (stringNotBlank(frequCode.value)) {
-          item.frequCode = frequCode.value
-          item.frequCodeName = frequCodeName.value
-        }
-      })
-      emit("mu-ban-shu-ju", clone(xuanZhongShuJu.value))
-      guanBi()
-    }
+/* 添加子医嘱的背景颜色 */
+const differChildrenRows = ({row}) => {
+  if (row.isChildren) {
+    return 'children-row'
+  }
+}
+// 获取选中的 医嘱数据
+const xuanZhongShuJu = ref([])
+const xuanZhongMuBan = (val) => {
+  xuanZhongShuJu.value = val
+}
 
-    // 时间限制
-    // 医嘱限制时间不能在之前
-    const disabledDate = (time) => {
-      return time.getTime() < Date.now() - 8.64e7;
-    }
+// 用户切换全选和全不选 时 el-table中的全选不会选中子节点
+const toggleSelection = (row, selected) => {
+  if (row) {
+    row.forEach(item => {
+      tableRef.value.toggleRowSelection(item, selected)
+    })
+  }
+}
 
-    // 获取评率
-    const getFrequCodeName = ({label, value}) => {
-      frequCodeName.value = label
-      frequCode.value = value
-    }
-    const pinLvRemoteMethod = (val) => {
-      if (val.length > 1) {
-        huoQuZhuYuanPinLv(val).then(res => {
-          yaoPinPingLvData.value = res
-        })
-      }
+let flag = false; // 默认 为全不选
+const quanXuanMuBan = (selection) => {
+  flag = !flag
+  selection.forEach(item => {
+    if (stringNotBlank(item.children)) {
+      toggleSelection(item.children, flag)
     }
+  })
+  if (!flag) {
+    // 在点击了全不选中 需要清空
+    tableRef.value.clearSelection()
+  }
+}
 
-    // 编辑内容
-    const bianJiNeiRong = () => {
-      muBanShuJu.value.forEach(item => {
-        item.startTime = startTime.value
-        item.orderTime = orderTime
-        if (stringNotBlank(frequCode.value)) {
-          item.frequCode = frequCode.value
-          item.frequCodeName = frequCodeName.value
-        }
-      })
-      emit("mu-ban-shu-ju", clone(muBanShuJu.value))
-      muBanMing.value = dianJiFuJiXinXi.value
-      guanBi()
+const dianJiQueDing = () => {
+  if (listIsBlank(xuanZhongShuJu.value)) {
+    return ElMessage.error("请先选择数据")
+  }
+  xuanZhongShuJu.value.forEach(item => {
+    item.startTime = startTime
+    item.orderTime = orderTime
+    if (stringNotBlank(frequCode.value)) {
+      item.frequCode = frequCode.value
+      item.frequCodeName = frequCodeName.value
     }
+  })
+  emit("mu-ban-shu-ju", clone(xuanZhongShuJu.value))
+}
 
-    const guanBi = (done) => {
-      dialog.value = false
-      if (store.state.app.yiZhuLuRu.jianRongMoShi) {
-        fuJiMuBanShuJu.value.data = []
-        muBanShuJu.value = []
-      }
-    }
+// 时间限制
+// 医嘱限制时间不能在之前
+const disabledDate = (time) => {
+  return time.getTime() < Date.now() - 8.64e7;
+}
 
+// 获取评率
+const getFrequCodeName = ({label, value}) => {
+  frequCodeName.value = label
+  frequCode.value = value
+}
+const pinLvRemoteMethod = (val) => {
+  if (val.length > 1) {
+    huoQuZhuYuanPinLv(val).then(res => {
+      yaoPinPingLvData.value = res
+    })
+  }
+}
 
-    return {
-      dialog,
-      dianJiChaXun,
-      code,
-      user,
-      fuJiMuBanShuJu,
-      dianJiMuBanMing,
-      muBanShuJu,
-      getSelfBuy,
-      windowSize,
-      differChildrenRows,
-      xuanZhongMuBan,
-      quanXuanMuBan,
-      tableRef,
-      handleCurrentChange,
-      xiuGaiMuBan,
-      shanChuMuBan,
-      dianJiQueDing,
-      xuanZhongShuJu,
-      muBanLeiXing,
-      disabledDate,
-      startTime,
-      orderTime,
-      frequCode,
-      yaoPinPingLvData,
-      pinLvRemoteMethod,
-      getFrequCodeName,
-      baoCunMuBan,
-      dianJiShouCang,
-      bianJiNeiRong,
-      dianJiFuJiXinXi,
-      guanBi,
+// 编辑内容
+const bianJiNeiRong = () => {
+  muBanShuJu.value.forEach(item => {
+    item.startTime = startTime
+    item.orderTime = orderTime
+    if (stringNotBlank(frequCode.value)) {
+      item.frequCode = frequCode.value
+      item.frequCodeName = frequCodeName.value
     }
-  }
+  })
+  emit("mu-ban-shu-ju", clone(muBanShuJu.value))
+  muBanMing.value = dianJiFuJiXinXi.value
 }
+
+
+onMounted(() => {
+  dianJiChaXun()
+})
+
+
 </script>
 
 <style scoped>

+ 31 - 15
src/layout/Menu/index.vue

@@ -1,24 +1,25 @@
 <template>
   <el-menu
-    class="layout-menu system-scrollbar"
-    background-color="var(--system-menu-background)"
-    text-color="var(--system-menu-text-color)"
-    active-text-color="var(--system-primary-color)"
-    :default-active="activeMenu"
-    :class="isCollapse ? 'collapse' : ''"
-    :collapse="isCollapse"
-    :collapse-transition="false"
-    :unique-opened="expandOneMenu"
+      :class="isCollapse ? 'collapse' : ''"
+      :collapse="isCollapse"
+      :collapse-transition="false"
+      :default-active="activeMenu"
+      :unique-opened="expandOneMenu"
+      active-text-color="var(--system-primary-color)"
+      background-color="var(--system-menu-background)"
+      class="layout-menu system-scrollbar"
+      text-color="var(--system-menu-text-color)"
   >
-    <menu-item v-for="(menu, key) in allRoutes" :key="key" :menu="menu" />
+    <menu-item v-for="(menu, key) in allRoutes" :key="key" :menu="menu"/>
   </el-menu>
 </template>
 
 <script>
-import { defineComponent, computed, onMounted } from 'vue'
-import { useRoute } from 'vue-router'
-import { useStore } from 'vuex'
+import {computed, defineComponent, onMounted} from 'vue'
+import {useRoute} from 'vue-router'
+import {useStore} from 'vuex'
 import MenuItem from './MenuItem.vue'
+
 export default defineComponent({
   components: {
     MenuItem,
@@ -30,13 +31,14 @@ export default defineComponent({
     const allRoutes = computed(() => store.state.user.routes)
     const route = useRoute()
     const activeMenu = computed(() => {
-      const { meta, path } = route
+      const {meta, path} = route
       if (meta.activeMenu) {
         return meta.activeMenu
       }
       return path
     })
-    onMounted(() => {})
+    onMounted(() => {
+    })
     return {
       isCollapse,
       expandOneMenu,
@@ -53,36 +55,44 @@ export default defineComponent({
   flex: 1;
   height: 0;
   overflow-y: auto;
+
   &.collapse {
     margin-left: 0px;
   }
+
   :deep() {
     .el-menu-item,
     .el-submenu {
       background-color: var(--system-menu-background) !important;
     }
+
     .el-menu-item i,
     .el-menu-item-group__title,
     .el-submenu__title i {
       color: var(--system-menu-text-color);
     }
+
     .el-menu-item,
     .el-submenu__title {
       &.is-active {
         background-color: var(--system-primary-color) !important;
         color: var(--system-primary-text-color) !important;
+
         i {
           color: var(--system-primary-text-color) !important;
         }
+
         &:hover {
           background-color: var(--system-primary-color) !important;
           color: var(--system-primary-text-color) !important;
         }
       }
+
       &:hover {
         background-color: var(--system-menu-hover-background) !important;
       }
     }
+
     .el-submenu {
       &.is-active {
         > .el-submenu__title,
@@ -90,24 +100,30 @@ export default defineComponent({
           color: var(--system-menu-submenu-active-color) !important;
         }
       }
+
       .el-menu-item {
         background-color: var(--system-menu-children-background) !important;
+
         &.is-active {
           background-color: var(--system-primary-color) !important;
           color: var(--system-primary-text-color) !important;
+
           &:hover {
             background-color: var(--system-primary-color) !important;
             color: var(--system-primary-text-color) !important;
           }
         }
+
         &:hover {
           background-color: var(--system-menu-hover-background) !important;
         }
       }
     }
+
     .el-submenu {
       .el-submenu__title {
         background-color: var(--system-menu-children-background) !important;
+
         &:hover {
           background-color: var(--system-primary-color) !important;
         }

+ 5 - 4
src/main.js

@@ -1,4 +1,4 @@
-import { createApp } from 'vue'
+import {createApp} from 'vue'
 import ElementPlus from 'element-plus'
 import 'element-plus/lib/theme-chalk/index.css'
 import 'element-plus/lib/theme-chalk/display.css' // 引入基于断点的隐藏类
@@ -6,13 +6,14 @@ import 'normalize.css' // css初始化
 import './assets/style/common.scss' // 公共css
 import App from './App.vue'
 import store from './store'
-import router from './router'
-import { addRoutes } from './router'
+import router, {addRoutes} from './router'
+import vDrag from '@/directive/drag/index'
 
 addRoutes()
 
 const app = createApp(App)
-app.use(ElementPlus, { size: store.state.app.elementSize })
+app.use(ElementPlus, {size: store.state.app.elementSize})
 app.use(store)
 app.use(router)
+app.directive('drag', vDrag)
 app.mount('#app')

+ 0 - 1
src/router/index.js

@@ -14,7 +14,6 @@ import Dashboard from './modules/dashboard'
 import System from './modules/system'
 
 let modules = [...Dashboard]
-const apiUrl = import.meta.env.VITE_BASE_URL
 
 const routes = modules
 

+ 0 - 3
src/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng.js

@@ -1,5 +1,4 @@
 // 判断是否选择了患者
-import {computed, ref} from "vue";
 import {stringIsBlank, stringNotBlank} from "@/utils/blank-utils";
 import {ElMessage} from "element-plus";
 import {baseinfo} from "@/data/inpatient";
@@ -16,8 +15,6 @@ export const huanZheXinXi = computed(() => {
     }
     return baseinfo()
 })
-// 获取医生选中的病区
-export const selectWardCode = ref(0)
 // 是否点击了修改整个模板
 export const muBanMing = ref({})
 // 复制选中的医嘱

+ 529 - 577
src/views/hospitalization/zhu-yuan-yi-sheng/yi-zhu-lu-ru/TianJiaYiZhu.vue

@@ -1,11 +1,13 @@
 <template>
-  <huo-qu-mu-ban ref="muBanRef" @muBanShuJu="muBanShuJu"></huo-qu-mu-ban>
+  <!-- 这里是获取模板的 -->
+  <huo-qu-mu-ban v-if="muBanDuiHuaKuang"
+                 @close="muBanDuiHuaKuang = false" @muBanShuJu="muBanShuJu"></huo-qu-mu-ban>
   <bao-cun-mu-ban ref="baoCunMuBanRef"></bao-cun-mu-ban>
   <template v-for="item in tiShiBiaoTi">
     <el-alert :title="item.title" :type="item.type" effect="dark"></el-alert>
   </template>
   <el-button icon="el-icon-arrow-left" style="font-size: 14px" type="text" @click="router.go(-1)">返回</el-button>
-  <el-button type="primary" @click="muBanRef.dialog = true">获取模板</el-button>
+  <el-button type="primary" @click="muBanDuiHuaKuang = true">获取模板</el-button>
   <el-button :disabled="yiZhuList.length === 0" type="primary" @click="baoCunMuBanClick">保存模板</el-button>
   <el-button icon="el-icon-check" type="success" @click="baoCunYiZhuClick">保存</el-button>
   {{ count }}
@@ -269,8 +271,7 @@
                   @xuanZhongFeiYong="xuanZhongFeiYong"></sou-suo-yi-zhu>
 </template>
 
-<script>
-import {computed, onMounted, onUnmounted, ref, watch} from 'vue'
+<script name="TianJiaYiZhu" setup>
 import {
   huoQuFeiYongXinXi,
   huoQuGeiYaoFangShi,
@@ -298,626 +299,577 @@ import router from '@/router'
 import SouSuoYiZhu from "@/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/SouSuoYiZhu.vue";
 import CuoWuXinXi from "@/components/zhu-yuan-yi-sheng/CuoWuXinXi.vue";
 
-export default {
-  name: 'TianJiaYiZhu',
-  components: {CuoWuXinXi, SouSuoYiZhu, BaoCunMuBan, HuoQuMuBan},
-  setup() {
-    const windowSize = computed(() => {
-      return store.state.app.windowSize
-    })
-
+const windowSize = computed(() => {
+  return store.state.app.windowSize
+})
+
+
+// 设置倒计时
+const seconds = ref(600)
+// 倒计时提示
+const count = ref('')
+// 搜索药品的输入框
+const searchInput = ref(null)
+
+const yiZhuData = ref({
+  id: '',
+  actOrderNo: null,
+  orderName: '',
+  orderCode: '',
+  // 频率
+  frequCode: '',
+  frequCodeName: '',
+  drugSpecification: '',
+  dose: 0,
+  // 领量
+  doseUnit: '',
+  doseUnitName: '',
+  supplyCode: '',
+  supplyCodeName: '',
+  startTime: '',
+  endTime: '',
+  orderTime: '',
+  doctorName: '',
+  drugFlag: '',
+  execUnit: '',
+  execUnitName: '',
+  parentNo: '',
+  parentNoName: '',
+  physicianName: '',
+  discription: '',
+  instruction: null,
+  kfFlag: null,
+  selfBuy: null,
+  ybSelfFlag: '0',
+  emergencyFlag: '0',
+  drugQuan: 0,
+  miniUnitName: '',
+  serial: '',
+  miniUnit: '',
+  psFlag: false,
+  kjywFlag: 0,
+  yyfs: null,
+  ssqk: null,
+  yysj: null,
+})
+/*提示信息*/
+const tiShiBiaoTi = ref([])
+
+const span = ref(6)
+const spanSize = (val) => {
+  if (val > 1200) {
+    span.value = 6
+  } else if (930 < val || val > 1200) {
+    span.value = 8
+  } else if (val < 930) {
+    span.value = 12
+  }
+}
+spanSize(windowSize.value.w)
 
-    // 设置倒计时
-    const seconds = ref(600)
-    // 倒计时提示
-    const count = ref('')
-    // 搜索药品的输入框
-    const searchInput = ref(null)
-
-    const yiZhuData = ref({
-      id: '',
-      actOrderNo: null,
-      orderName: '',
-      orderCode: '',
-      // 频率
-      frequCode: '',
-      frequCodeName: '',
-      drugSpecification: '',
-      dose: 0,
-      // 领量
-      doseUnit: '',
-      doseUnitName: '',
-      supplyCode: '',
-      supplyCodeName: '',
-      startTime: '',
-      endTime: '',
-      orderTime: '',
-      doctorName: '',
-      drugFlag: '',
-      execUnit: '',
-      execUnitName: '',
-      parentNo: '',
-      parentNoName: '',
-      physicianName: '',
-      discription: '',
-      instruction: null,
-      kfFlag: null,
-      selfBuy: null,
-      ybSelfFlag: '0',
-      emergencyFlag: '0',
-      drugQuan: 0,
-      miniUnitName: '',
-      serial: '',
-      miniUnit: '',
-      psFlag: false,
-      kjywFlag: 0,
-      yyfs: null,
-      ssqk: null,
-      yysj: null,
-    })
-    /*提示信息*/
-    const tiShiBiaoTi = ref([])
-
-    const span = ref(6)
-    const spanSize = (val) => {
-      if (val > 1200) {
-        span.value = 6
-      } else if (930 < val || val > 1200) {
-        span.value = 8
-      } else if (val < 930) {
-        span.value = 12
-      }
+watch(
+    () => windowSize.value,
+    () => {
+      spanSize(windowSize.value.w)
     }
-    spanSize(windowSize.value.w)
-
-    watch(
-        () => windowSize.value,
-        () => {
-          spanSize(windowSize.value.w)
-        }
-    )
-
-    // 搜索医嘱
-    const yiZhuMingDialog = ref(false)
-    const xuanZhongFeiYong = (row) => {
-      yiZhuMingDialog.value = false
-      qingKong()
-      yiZhuData.value = clone(row)
-      if (row.serial !== '00') {
-        huoQuFeiYongXinXi(row.orderCode, row.serial)
-            .then((res) => {
-              yiZhuData.value.drugFlag = row.orderType
-              // 判断是否 是皮试的药 如果是就只能有这些 给药方式
-              if (res.data.psFlag === 1) {
-                geiYaoFangShiData.value = res.piShi
-                tiShiBiaoTi.value.push({title: '该药品为皮试药品给药方式只能是皮试类型', type: 'warning'})
-                yiZhuData.value.psFlag = true
-              } else {
-                geiYaoFangShiData.value = []
-                yiZhuData.value.psFlag = false
-              }
-              yiZhuData.value.kjywFlag = res.data.kjywFlag
-              if (yiZhuData.value.kjywFlag === 1) {
-                tiShiBiaoTi.value.push({title: '该药品为抗菌药物,请填写抗菌药物医嘱附注信息录入。', type: 'error'})
-              }
-              if (res.data.selfFlagYb === 1) {
-                tiShiBiaoTi.value.push({title: '该药品医保自费药品,如符合条件请填写记账,不是请填写自费。'})
-              }
-              yiZhuData.value.miniUnitName = res.data.miniUnitName
-              yaoPinJiLiangData.value = res.yaoPingJiLiang
-              // 加载 剂量单位
-              if (stringNotBlank(yiZhuData.value.doseUnit)) {
-                yaoPinJiLiangData.value.forEach((item) => {
-                  if (item.code === yiZhuData.value.doseUnit) {
-                    jiLiangValue.value = item.value
-                  }
-                })
-              } else if (listNotBlank(yaoPinJiLiangData.value)) {
-                // 没有剂量单位的时候默认加载第一个计量单位 并且计算
-                yiZhuData.value.doseUnit = yaoPinJiLiangData.value[0].code
-                yiZhuData.value.dose = yaoPinJiLiangData.value[0].value
-                jiLiangValue.value = yaoPinJiLiangData.value[0].value
-                jiSuanLingLiang(yaoPinJiLiangData.value[0].value)
-              }
-              // 加载默认频率 如果已经填写了 就用有的
-              if (stringNotBlank(row.frequCode)) {
-                pinLvRemoteMethod(yiZhuData.value.frequCode)
-              } else if (stringNotBlank(res.data.frequCode)) {
-                yiZhuData.value.frequCode = res.data.frequCode
-                pinLvRemoteMethod(yiZhuData.value.frequCode)
-              } else {
-                yiZhuData.value.frequCode = 'ONCE'
-                pinLvRemoteMethod('ONCE')
-              }
-              // 加载给药方式
-              if (stringNotBlank(yiZhuData.value.supplyCode)) {
-                geiYaoFangShiRemoteMethod(yiZhuData.value.supplyCode)
-              } else if (stringNotBlank(res.data.supplyCode)) {
-                yiZhuData.value.supplyCode = res.data.supplyCode
-                geiYaoFangShiRemoteMethod(yiZhuData.value.supplyCode)
-              }
-            })
-            .catch((e) => {
-              setTimeout(() => {
-                console.error(e)
-                qingKong()
-              }, 100)
-            })
-      } else {
-        yiZhuData.value.kjywFlag = 0
-        huoQuFeiYongXinXi(row.orderCode, '00')
-            .then((res) => {
-              yiZhuData.value.drugFlag = row.orderType
-              yiZhuData.value.frequCode = 'ONCE'
-              pinLvRemoteMethod('ONCE')
-              if (stringNotBlank(res.paiChiYiZhu)) {
-                tiShiBiaoTi.value.push({title: res.paiChiYiZhu, type: 'error'})
+)
+
+// 搜索医嘱
+const yiZhuMingDialog = ref(false)
+const xuanZhongFeiYong = (row) => {
+  yiZhuMingDialog.value = false
+  qingKong()
+  yiZhuData.value = clone(row)
+  if (row.serial !== '00') {
+    huoQuFeiYongXinXi(row.orderCode, row.serial)
+        .then((res) => {
+          yiZhuData.value.drugFlag = row.orderType
+          // 判断是否 是皮试的药 如果是就只能有这些 给药方式
+          if (res.data.psFlag === 1) {
+            geiYaoFangShiData.value = res.piShi
+            tiShiBiaoTi.value.push({title: '该药品为皮试药品给药方式只能是皮试类型', type: 'warning'})
+            yiZhuData.value.psFlag = true
+          } else {
+            geiYaoFangShiData.value = []
+            yiZhuData.value.psFlag = false
+          }
+          yiZhuData.value.kjywFlag = res.data.kjywFlag
+          if (yiZhuData.value.kjywFlag === 1) {
+            tiShiBiaoTi.value.push({title: '该药品为抗菌药物,请填写抗菌药物医嘱附注信息录入。', type: 'error'})
+          }
+          if (res.data.selfFlagYb === 1) {
+            tiShiBiaoTi.value.push({title: '该药品医保自费药品,如符合条件请填写记账,不是请填写自费。'})
+          }
+          yiZhuData.value.miniUnitName = res.data.miniUnitName
+          yaoPinJiLiangData.value = res.yaoPingJiLiang
+          // 加载 剂量单位
+          if (stringNotBlank(yiZhuData.value.doseUnit)) {
+            yaoPinJiLiangData.value.forEach((item) => {
+              if (item.code === yiZhuData.value.doseUnit) {
+                jiLiangValue.value = item.value
               }
             })
-            .catch((e) => {
-              setTimeout(() => {
-                qingKong()
-              }, 100)
-            })
-      }
-      // 判断这个是不是 新添加的数据 如果是空的就是 新数据
-      if (stringIsBlank(row.newData)) {
-        getServerDateApi().then((res) => {
-          yiZhuData.value.orderTime = res
-          yiZhuData.value.startTime = res
+          } else if (listNotBlank(yaoPinJiLiangData.value)) {
+            // 没有剂量单位的时候默认加载第一个计量单位 并且计算
+            yiZhuData.value.doseUnit = yaoPinJiLiangData.value[0].code
+            yiZhuData.value.dose = yaoPinJiLiangData.value[0].value
+            jiLiangValue.value = yaoPinJiLiangData.value[0].value
+            jiSuanLingLiang(yaoPinJiLiangData.value[0].value)
+          }
+          // 加载默认频率 如果已经填写了 就用有的
+          if (stringNotBlank(row.frequCode)) {
+            pinLvRemoteMethod(yiZhuData.value.frequCode)
+          } else if (stringNotBlank(res.data.frequCode)) {
+            yiZhuData.value.frequCode = res.data.frequCode
+            pinLvRemoteMethod(yiZhuData.value.frequCode)
+          } else {
+            yiZhuData.value.frequCode = 'ONCE'
+            pinLvRemoteMethod('ONCE')
+          }
+          // 加载给药方式
+          if (stringNotBlank(yiZhuData.value.supplyCode)) {
+            geiYaoFangShiRemoteMethod(yiZhuData.value.supplyCode)
+          } else if (stringNotBlank(res.data.supplyCode)) {
+            yiZhuData.value.supplyCode = res.data.supplyCode
+            geiYaoFangShiRemoteMethod(yiZhuData.value.supplyCode)
+          }
         })
-      }
-      // 加载剂量单位 )
-      // 用来加载默认的执行科室
-      if (stringIsBlank(row.execUnit)) {
-        if (stringNotBlank(huanZheXinXi.value.smallDept)) {
-          yiZhuData.value.execUnit = huanZheXinXi.value.smallDept
-          zhiXingKeShiData.value.push({
-            code: huanZheXinXi.value.smallDept,
-            name: huanZheXinXi.value.smallDeptName,
-          })
-        }
-      } else {
-        metZhiXingKeShi(yiZhuData.value.execUnit)
-      }
-      if (stringIsBlank(row.id)) {
-        yiZhuData.value.id = uuid(8, 10)
-      }
-    }
-
-    /* 频率 */
-    const yaoPinPingLvData = ref([])
-    const pinLvRemoteMethod = (val) => {
-      if (val.length > 1) {
-        huoQuZhuYuanPinLv(val).then((res) => {
-          yaoPinPingLvData.value = res
+        .catch((e) => {
+          setTimeout(() => {
+            console.error(e)
+            qingKong()
+          }, 100)
         })
-      }
-    }
-    /* 选择剂量 */
-    const yaoPinJiLiangData = ref([])
-    const jiLiangValue = ref(0)
-    const xuanZheJiLiang = (val) => {
-      yaoPinJiLiangData.value.forEach((item) => {
-        if (item.code === val) {
-          jiLiangValue.value = item.value
-          yiZhuData.value.dose = item.value
-          yiZhuData.value.drugQuan = 1
-        }
+  } else {
+    yiZhuData.value.kjywFlag = 0
+    huoQuFeiYongXinXi(row.orderCode, '00')
+        .then((res) => {
+          yiZhuData.value.drugFlag = row.orderType
+          yiZhuData.value.frequCode = 'ONCE'
+          pinLvRemoteMethod('ONCE')
+          if (stringNotBlank(res.paiChiYiZhu)) {
+            tiShiBiaoTi.value.push({title: res.paiChiYiZhu, type: 'error'})
+          }
+        })
+        .catch((e) => {
+          setTimeout(() => {
+            qingKong()
+          }, 100)
+        })
+  }
+  // 判断这个是不是 新添加的数据 如果是空的就是 新数据
+  if (stringIsBlank(row.newData)) {
+    getServerDateApi().then((res) => {
+      yiZhuData.value.orderTime = res
+      yiZhuData.value.startTime = res
+    })
+  }
+  // 加载剂量单位 )
+  // 用来加载默认的执行科室
+  if (stringIsBlank(row.execUnit)) {
+    if (stringNotBlank(huanZheXinXi.value.smallDept)) {
+      yiZhuData.value.execUnit = huanZheXinXi.value.smallDept
+      zhiXingKeShiData.value.push({
+        code: huanZheXinXi.value.smallDept,
+        name: huanZheXinXi.value.smallDeptName,
       })
     }
-    /*计算领量*/
-    const jiSuanLingLiang = (val) => {
-      if (jiLiangValue.value > 0) {
-        yiZhuData.value.drugQuan = Math.ceil(val / jiLiangValue.value)
-      }
-    }
+  } else {
+    metZhiXingKeShi(yiZhuData.value.execUnit)
+  }
+  if (stringIsBlank(row.id)) {
+    yiZhuData.value.id = uuid(8, 10)
+  }
+}
 
-    /* 给药方式 */
-    const geiYaoFangShiData = ref([])
-    const geiYaoFangShiRemoteMethod = (val) => {
-      /*如果是皮试的那么就不可以用别的给药方式*/
-      if (yiZhuData.value.psFlag) return
-      huoQuGeiYaoFangShi(val).then((res) => {
-        geiYaoFangShiData.value = res
-      })
+/* 频率 */
+const yaoPinPingLvData = ref([])
+const pinLvRemoteMethod = (val) => {
+  if (val.length > 1) {
+    huoQuZhuYuanPinLv(val).then((res) => {
+      yaoPinPingLvData.value = res
+    })
+  }
+}
+/* 选择剂量 */
+const yaoPinJiLiangData = ref([])
+const jiLiangValue = ref(0)
+const xuanZheJiLiang = (val) => {
+  yaoPinJiLiangData.value.forEach((item) => {
+    if (item.code === val) {
+      jiLiangValue.value = item.value
+      yiZhuData.value.dose = item.value
+      yiZhuData.value.drugQuan = 1
     }
+  })
+}
+/*计算领量*/
+const jiSuanLingLiang = (val) => {
+  if (jiLiangValue.value > 0) {
+    yiZhuData.value.drugQuan = Math.ceil(val / jiLiangValue.value)
+  }
+}
 
-    /* 父医嘱 */
-    const fuYiZhuData = ref([])
-    const fuYiZhuClick = () => {
-      fuYiZhuData.value = []
-      yiZhuList.value.forEach((item, index) => {
-        if (stringNotBlank(item.drugFlag) && item.drugFlag === 'i' && item.id !== yiZhuData.value.id && stringIsBlank(item.parentNo)) {
-          fuYiZhuData.value.push({code: item.id, name: item.orderName})
-        }
-      })
-    }
+/* 给药方式 */
+const geiYaoFangShiData = ref([])
+const geiYaoFangShiRemoteMethod = (val) => {
+  /*如果是皮试的那么就不可以用别的给药方式*/
+  if (yiZhuData.value.psFlag) return
+  huoQuGeiYaoFangShi(val).then((res) => {
+    geiYaoFangShiData.value = res
+  })
+}
 
-    /* 获取执行科室 */
-    const zhiXingKeShiData = ref([])
-    const metZhiXingKeShi = (val) => {
-      if (stringIsBlank(val)) return
-      huoQuZhiXinKeShi(val).then((res) => {
-        zhiXingKeShiData.value = res
-      })
+/* 父医嘱 */
+const fuYiZhuData = ref([])
+const fuYiZhuClick = () => {
+  fuYiZhuData.value = []
+  yiZhuList.value.forEach((item, index) => {
+    if (stringNotBlank(item.drugFlag) && item.drugFlag === 'i' && item.id !== yiZhuData.value.id && stringIsBlank(item.parentNo)) {
+      fuYiZhuData.value.push({code: item.id, name: item.orderName})
     }
+  })
+}
 
-    /* 这里是添加信息 */
-    const yiZhuList = ref([])
-    const tianJiaYiZhuWeiYiBiaoShi = ref([])
-    const tianJiaYiZhu = () => {
-      if (stringIsBlank(yiZhuData.value.orderCode)) {
-        return ElMessage.error('请先选择数据')
-      }
-      if (stringNotBlank(yiZhuData.value.parentNo)) {
-        yiZhuData.value.supplyCode = '044'
-        yiZhuData.value.supplyCodeName = '副药'
-      }
-      const list = []
-      list.push(yiZhuData.value)
-      let data = {
-        inpatientNo: huanZheXinXi.value.inpatientNo,
-        admissTimes: huanZheXinXi.value.admissTimes,
-        list: list,
-      }
-      shangChuanYiZhu(data)
-          .then((res) => {
-            let index = tianJiaYiZhuWeiYiBiaoShi.value.indexOf(yiZhuData.value.id)
-            if (index > -1) {
-              yiZhuList.value.splice(index, 1)
-              tianJiaYiZhuWeiYiBiaoShi.value.splice(index, 1)
-              ElMessage.error('重复添加,老记录已删除。')
-            }
-            tianJiaShiHuoQuXiaLaKuangDeZhi()
-            tianJiaYiZhuWeiYiBiaoShi.value.push(yiZhuData.value.id)
-            yiZhuList.value.push(clone(yiZhuData.value))
-            qingKong()
-          })
-          .catch((e) => {
-            cuoWuXinXi.value = e
-          })
-    }
+/* 获取执行科室 */
+const zhiXingKeShiData = ref([])
+const metZhiXingKeShi = (val) => {
+  if (stringIsBlank(val)) return
+  huoQuZhiXinKeShi(val).then((res) => {
+    zhiXingKeShiData.value = res
+  })
+}
 
-    // 这里是获取下拉框中的值的
-    const tianJiaShiHuoQuXiaLaKuangDeZhi = () => {
-      yaoPinPingLvData.value.forEach((item) => {
-        if (item.code === yiZhuData.value.frequCode) {
-          yiZhuData.value.frequCodeName = item.name
-        }
-      })
-      yaoPinJiLiangData.value.forEach((item) => {
-        if (item.code === yiZhuData.value.doseUnit) {
-          yiZhuData.value.doseUnitName = item.name
-        }
-      })
-      geiYaoFangShiData.value.forEach((item) => {
-        if (item.code === yiZhuData.value.supplyCode) {
-          yiZhuData.value.supplyCodeName = item.name
+/* 这里是添加信息 */
+const yiZhuList = ref([])
+const tianJiaYiZhuWeiYiBiaoShi = ref([])
+const tianJiaYiZhu = () => {
+  if (stringIsBlank(yiZhuData.value.orderCode)) {
+    return ElMessage.error('请先选择数据')
+  }
+  if (stringNotBlank(yiZhuData.value.parentNo)) {
+    yiZhuData.value.supplyCode = '044'
+    yiZhuData.value.supplyCodeName = '副药'
+  }
+  const list = []
+  list.push(yiZhuData.value)
+  let data = {
+    inpatientNo: huanZheXinXi.value.inpatientNo,
+    admissTimes: huanZheXinXi.value.admissTimes,
+    list: list,
+  }
+  shangChuanYiZhu(data)
+      .then((res) => {
+        let index = tianJiaYiZhuWeiYiBiaoShi.value.indexOf(yiZhuData.value.id)
+        if (index > -1) {
+          yiZhuList.value.splice(index, 1)
+          tianJiaYiZhuWeiYiBiaoShi.value.splice(index, 1)
+          ElMessage.error('重复添加,老记录已删除。')
         }
+        tianJiaShiHuoQuXiaLaKuangDeZhi()
+        tianJiaYiZhuWeiYiBiaoShi.value.push(yiZhuData.value.id)
+        yiZhuList.value.push(clone(yiZhuData.value))
+        qingKong()
       })
-      zhiXingKeShiData.value.forEach((item) => {
-        if (item.code === yiZhuData.value.execUnit) {
-          yiZhuData.value.execUnitName = item.name
-        }
+      .catch((e) => {
+        cuoWuXinXi.value = e
       })
-    }
+}
 
-    /* 这个是点击单个修改的 */
-    const xiuGaiYiZhu = (val) => {
-      val.newData = true
-      xuanZhongFeiYong(val)
-      ElMessage.success('你点击了修改')
+// 这里是获取下拉框中的值的
+const tianJiaShiHuoQuXiaLaKuangDeZhi = () => {
+  yaoPinPingLvData.value.forEach((item) => {
+    if (item.code === yiZhuData.value.frequCode) {
+      yiZhuData.value.frequCodeName = item.name
     }
-
-    /* 删除表格医嘱 */
-    const shanChuBiaoGeYiZhu = (val) => {
-      yiZhuList.value.splice(val, 1)
-      tianJiaYiZhuWeiYiBiaoShi.value.splice(val, 1)
-      ElMessage.success('删除成功')
+  })
+  yaoPinJiLiangData.value.forEach((item) => {
+    if (item.code === yiZhuData.value.doseUnit) {
+      yiZhuData.value.doseUnitName = item.name
     }
-
-    /* 复制医嘱 */
-    const dianJiFuZhiYiZhu = (val) => {
-      yiZhuData.value = clone(val)
-      yiZhuData.value.id = uuid(8, 10)
-      ElMessage.success('复制成功')
+  })
+  geiYaoFangShiData.value.forEach((item) => {
+    if (item.code === yiZhuData.value.supplyCode) {
+      yiZhuData.value.supplyCodeName = item.name
     }
+  })
+  zhiXingKeShiData.value.forEach((item) => {
+    if (item.code === yiZhuData.value.execUnit) {
+      yiZhuData.value.execUnitName = item.name
+    }
+  })
+}
 
+/* 这个是点击单个修改的 */
+const xiuGaiYiZhu = (val) => {
+  val.newData = true
+  xuanZhongFeiYong(val)
+  ElMessage.success('你点击了修改')
+}
 
-    /* 保存信息 */
-    const baoCunYiZhuClick = () => {
-      if (listIsBlank(yiZhuList.value)) {
-        return ElMessage.error('请先选择数据')
-      }
-      if (youWuXuanZheHuanZhe()) return
-      let yiBaoBianMaTiShi = []
-      yiZhuList.value.forEach(item => {
-        yiBaoBianMaTiShi.push(item.orderCode + "-" + item.serial)
-      })
-      yaoPinShiFouPiPeiYiBao(yiBaoBianMaTiShi).then((res) => {
-        if (stringNotBlank(res)) {
-          cuoWuXinXi.value = res
-          ElMessageBox.confirm(res, '提示', {
-            type: 'warning',
-            dangerouslyUseHTMLString: true,
-            confirmButtonText: '继续录入'
-          }).then((res) => {
-            baoCunYiZhu()
-          }).catch(() => {
-          })
-        } else {
-          baoCunYiZhu()
-        }
-      })
-    }
+/* 删除表格医嘱 */
+const shanChuBiaoGeYiZhu = (val) => {
+  yiZhuList.value.splice(val, 1)
+  tianJiaYiZhuWeiYiBiaoShi.value.splice(val, 1)
+  ElMessage.success('删除成功')
+}
+
+/* 复制医嘱 */
+const dianJiFuZhiYiZhu = (val) => {
+  yiZhuData.value = clone(val)
+  yiZhuData.value.id = uuid(8, 10)
+  ElMessage.success('复制成功')
+}
 
-    function baoCunYiZhu() {
-      ElMessageBox.confirm('您确定要保存这些数据吗?请仔细检查数据。', '提示', {
+
+/* 保存信息 */
+const baoCunYiZhuClick = () => {
+  if (listIsBlank(yiZhuList.value)) {
+    return ElMessage.error('请先选择数据')
+  }
+  if (youWuXuanZheHuanZhe()) return
+  let yiBaoBianMaTiShi = []
+  yiZhuList.value.forEach(item => {
+    yiBaoBianMaTiShi.push(item.orderCode + "-" + item.serial)
+  })
+  yaoPinShiFouPiPeiYiBao(yiBaoBianMaTiShi).then((res) => {
+    if (stringNotBlank(res)) {
+      cuoWuXinXi.value = res
+      ElMessageBox.confirm(res, '提示', {
         type: 'warning',
-        closeOnClickModal: false,
-      }).then(() => {
-        let data = {
-          inpatientNo: huanZheXinXi.value.inpatientNo,
-          admissTimes: huanZheXinXi.value.admissTimes,
-          chaRuYiZhu: true,
-          list: yiZhuList.value,
-        }
-        shangChuanYiZhu(data)
-            .then((res) => {
-              fuZhiYiZhu.value = []
-              router.go(-1)
-            })
-            .catch((e) => {
-              cuoWuXinXi.value = e
-            })
+        dangerouslyUseHTMLString: true,
+        confirmButtonText: '继续录入'
+      }).then((res) => {
+        baoCunYiZhu()
       }).catch(() => {
       })
+    } else {
+      baoCunYiZhu()
     }
+  })
+}
 
-    /*  这里是抗菌药物,选择了除了 1和 2 的其他都可以不用填写 */
-    const kangJunYaoYongYaoFangShiGaiBian = (val) => {
-      if (val !== 1 || val !== 2) {
-        yiZhuData.value.ssqk = null
-        yiZhuData.value.yysj = null
-      }
+function baoCunYiZhu() {
+  ElMessageBox.confirm('您确定要保存这些数据吗?请仔细检查数据。', '提示', {
+    type: 'warning',
+    closeOnClickModal: false,
+  }).then(() => {
+    let data = {
+      inpatientNo: huanZheXinXi.value.inpatientNo,
+      admissTimes: huanZheXinXi.value.admissTimes,
+      chaRuYiZhu: true,
+      list: yiZhuList.value,
     }
+    shangChuanYiZhu(data)
+        .then((res) => {
+          fuZhiYiZhu.value = []
+          router.go(-1)
+        })
+        .catch((e) => {
+          cuoWuXinXi.value = e
+        })
+  }).catch(() => {
+  })
+}
 
-    // 模板数据
-    const muBanRef = ref(null)
-    // 这里是返回的模板数据
-    const muBanShuJu = (val) => {
-      let tongZhiCiShu = 0
-      val.forEach((item) => {
-        let index = tianJiaYiZhuWeiYiBiaoShi.value.indexOf(item.id)
-        if (index > -1) {
-          yiZhuList.value.splice(index, 1)
-          tianJiaYiZhuWeiYiBiaoShi.value.splice(index, 1)
-          tongZhi(tongZhiCiShu)
-          tongZhiCiShu++
-        }
-        tianJiaYiZhuWeiYiBiaoShi.value.push(item.id)
-        yiZhuList.value.push(item)
-      })
-
-      function tongZhi(val) {
-        if (val === 0) {
-          setTimeout(() => {
-            ElMessage.error('重复添加,老记录已删除。')
-          }, 200)
-        }
-      }
+/*  这里是抗菌药物,选择了除了 1和 2 的其他都可以不用填写 */
+const kangJunYaoYongYaoFangShiGaiBian = (val) => {
+  if (val !== 1 || val !== 2) {
+    yiZhuData.value.ssqk = null
+    yiZhuData.value.yysj = null
+  }
+}
 
-      ElMessage.success('添加成功。')
+// 模板数据
+let muBanDuiHuaKuang = $ref(false)
+// 这里是返回的模板数据
+const muBanShuJu = (val) => {
+  let tongZhiCiShu = 0
+  val.forEach((item) => {
+    let index = tianJiaYiZhuWeiYiBiaoShi.value.indexOf(item.id)
+    if (index > -1) {
+      yiZhuList.value.splice(index, 1)
+      tianJiaYiZhuWeiYiBiaoShi.value.splice(index, 1)
+      tongZhi(tongZhiCiShu)
+      tongZhiCiShu++
     }
-
-    // 保存模板
-    const baoCunMuBanRef = ref(null)
-    const baoCunMuBanClick = () => {
-      if (listIsBlank(yiZhuList.value)) {
-        return ElMessage.error('请先选择数据')
-      }
-      let data = {
-        inpatientNo: huanZheXinXi.value.inpatientNo,
-        admissTimes: huanZheXinXi.value.admissTimes,
-        list: yiZhuList.value,
-      }
-      shangChuanYiZhu(data)
-          .then((res) => {
-            baoCunMuBanRef.value.daKaiBaoCunMuBan(yiZhuList.value)
-            cuoWuXinXi.value = ''
-          })
-          .catch((e) => {
-            cuoWuXinXi.value = e
-          })
-    }
-    // 医嘱限制时间不能在之前
-    const disabledDate = (time) => {
-      return time.getTime() < Date.now() - 8.64e7
-    }
-
-    const xuanZhongShuJu = ref([])
-
-    const dianJiXuanZhongShuJu = (selection) => {
-      xuanZhongShuJu.value = selection
+    tianJiaYiZhuWeiYiBiaoShi.value.push(item.id)
+    yiZhuList.value.push(item)
+  })
+
+  function tongZhi(val) {
+    if (val === 0) {
+      setTimeout(() => {
+        ElMessage.error('重复添加,老记录已删除。')
+      }, 200)
     }
+  }
 
-    const dianJiXiuGaiZhiXingKeShi = () => {
-      if (listIsBlank(xuanZhongShuJu.value)) {
-        return ElMessage.error('请先选择数据。')
-      } else {
-        zhiXingKeShiData.value.forEach((item) => {
-          if (item.code === yiZhuData.value.execUnit) {
-            yiZhuData.value.execUnitName = item.name
-          }
-        })
-        xuanZhongShuJu.value.forEach((item) => {
-          item.execUnit = yiZhuData.value.execUnit
-          item.execUnitName = yiZhuData.value.execUnitName
-        })
-      }
-    }
+  ElMessage.success('添加成功。')
+}
 
+// 保存模板
+const baoCunMuBanRef = ref(null)
+const baoCunMuBanClick = () => {
+  if (listIsBlank(yiZhuList.value)) {
+    return ElMessage.error('请先选择数据')
+  }
+  let data = {
+    inpatientNo: huanZheXinXi.value.inpatientNo,
+    admissTimes: huanZheXinXi.value.admissTimes,
+    list: yiZhuList.value,
+  }
+  shangChuanYiZhu(data)
+      .then((res) => {
+        baoCunMuBanRef.value.daKaiBaoCunMuBan(yiZhuList.value)
+        cuoWuXinXi.value = ''
+      })
+      .catch((e) => {
+        cuoWuXinXi.value = e
+      })
+}
+// 医嘱限制时间不能在之前
+const disabledDate = (time) => {
+  return time.getTime() < Date.now() - 8.64e7
+}
 
-    const qingKong = () => {
-      cuoWuXinXi.value = ''
-      zhiXingKeShiData.value = []
-      yaoPinJiLiangData.value = []
-      yaoPinPingLvData.value = []
-      geiYaoFangShiData.value = []
-      jiLiangValue.value = 0
-      tiShiBiaoTi.value = []
-      yiZhuData.value = {
-        index: '',
-        actOrderNo: null,
-        orderName: '',
-        orderCode: '',
-        // 频率
-        frequCode: '',
-        frequCodeName: '',
-        drugSpecification: '',
-        dose: 0,
-        // 领量
-        doseUnit: '',
-        doseUnitName: '',
-        supplyCode: '',
-        supplyCodeName: '',
-        startTime: '',
-        endTime: '',
-        orderTime: '',
-        doctorName: '',
-        execUnit: '',
-        execUnitName: '',
-        parentNo: '',
-        parentNoName: '',
-        physicianName: '',
-        discription: '',
-        instruction: null,
-        kfFlag: null,
-        selfBuy: null,
-        ybSelfFlag: '0',
-        emergencyFlag: '0',
-        drugQuan: 0,
-        miniUnitName: '',
-        serial: '',
-        miniUnit: '',
-        psFlag: false,
-        kjywFlag: 0,
-        yyfs: null,
-        ssqk: null,
-        yysj: null,
-      }
-    }
+const xuanZhongShuJu = ref([])
 
-    let daoJiShi = null
+const dianJiXuanZhongShuJu = (selection) => {
+  xuanZhongShuJu.value = selection
+}
 
-    onMounted(() => {
-      yiZhuList.value = clone(fuZhiYiZhu.value)
-      for (let i = 0; i < yiZhuList.value.length; i++) {
-        yiZhuList.value[i].id = yiZhuList.value[i].actOrderNo
-      }
-      if (stringIsBlank(huanZheXinXi.value.inpatientNo)) {
-        ElMessage.warning('您现在进入的是医嘱模板编辑')
-      } else {
-        ElMessage.warning('您现在进入的是医嘱编辑模块,' + '您的编辑时间有 10 分钟,你准备好了吗?Are ya ready kids?')
-        kaiQiDaoJiShi()
-      }
-      if (stringNotBlank(huanZheXinXi.value.inpatientNo)) {
-        zhiXingKeShiData.value = [
-          {
-            code: huanZheXinXi.value.smallDept,
-            name: huanZheXinXi.value.smallDeptName,
-          },
-        ]
+const dianJiXiuGaiZhiXingKeShi = () => {
+  if (listIsBlank(xuanZhongShuJu.value)) {
+    return ElMessage.error('请先选择数据。')
+  } else {
+    zhiXingKeShiData.value.forEach((item) => {
+      if (item.code === yiZhuData.value.execUnit) {
+        yiZhuData.value.execUnitName = item.name
       }
-      fuZhiYiZhu.value = []
     })
-
-    onUnmounted(() => {
-      ElMessageBox.close()
-      clearInterval(daoJiShi)
+    xuanZhongShuJu.value.forEach((item) => {
+      item.execUnit = yiZhuData.value.execUnit
+      item.execUnitName = yiZhuData.value.execUnitName
     })
+  }
+}
 
-    // 倒计时功能
-    const kaiQiDaoJiShi = () => {
-      seconds.value = 600
-      clearInterval(daoJiShi)
-      daoJiShi = setInterval(() => {
-        seconds.value--
-        countDown()
-      }, 1000)
-    }
 
-    const countDown = () => {
-      let m = parseInt(((seconds.value / 60) % 60).toString())
-      m = m < 10 ? '0' + m : m
-      let s = parseInt((seconds.value % 60).toString())
-      s = s < 10 ? '0' + s : s
-      count.value = '剩余操作时间 ' + m + '分' + s + '秒'
-      if (seconds.value === 300) {
-        ElMessageBox.alert('您的操作时间过半', '提示', {
-          type: 'warning',
-        }).then((res) => {
-        })
-      } else if (seconds.value === 60 || seconds.value === 30 || seconds.value === 20) {
-        ElMessage({
-          message: '剩余操作时间' + seconds.value + '秒',
-          showClose: true,
-          type: 'error',
-          title: '成功',
-          duration: 4500,
-        })
-      } else if (seconds.value === 0) {
-        clearInterval(daoJiShi)
-        router.go(-1)
-      }
-    }
+const qingKong = () => {
+  cuoWuXinXi.value = ''
+  zhiXingKeShiData.value = []
+  yaoPinJiLiangData.value = []
+  yaoPinPingLvData.value = []
+  geiYaoFangShiData.value = []
+  jiLiangValue.value = 0
+  tiShiBiaoTi.value = []
+  yiZhuData.value = {
+    index: '',
+    actOrderNo: null,
+    orderName: '',
+    orderCode: '',
+    // 频率
+    frequCode: '',
+    frequCodeName: '',
+    drugSpecification: '',
+    dose: 0,
+    // 领量
+    doseUnit: '',
+    doseUnitName: '',
+    supplyCode: '',
+    supplyCodeName: '',
+    startTime: '',
+    endTime: '',
+    orderTime: '',
+    doctorName: '',
+    execUnit: '',
+    execUnitName: '',
+    parentNo: '',
+    parentNoName: '',
+    physicianName: '',
+    discription: '',
+    instruction: null,
+    kfFlag: null,
+    selfBuy: null,
+    ybSelfFlag: '0',
+    emergencyFlag: '0',
+    drugQuan: 0,
+    miniUnitName: '',
+    serial: '',
+    miniUnit: '',
+    psFlag: false,
+    kjywFlag: 0,
+    yyfs: null,
+    ssqk: null,
+    yysj: null,
+  }
+}
 
-    return {
-      router,
-      yiZhuData,
-      span,
-      searchInput,
-      yiZhuMingDialog,
-      windowSize,
-      xuanZhongFeiYong,
-      yaoPinJiLiangData,
-      pinLvRemoteMethod,
-      xuanZheJiLiang,
-      yaoPinPingLvData,
-      jiSuanLingLiang,
-      geiYaoFangShiData,
-      geiYaoFangShiRemoteMethod,
-      huanZheXinXi,
-      fuYiZhuClick,
-      fuYiZhuData,
-      store,
-      zhiXingKeShiData,
-      metZhiXingKeShi,
-      baoCunYiZhuClick,
-      kangJunYaoWuYongYaoFangShi,
-      kangJunYaoWuQieKou,
-      kangJunYaoWuYongYaoShiJian,
-      kangJunYaoYongYaoFangShiGaiBian,
-      tianJiaYiZhu,
-      yiZhuList,
-      xiuGaiYiZhu,
-      shanChuBiaoGeYiZhu,
-      tiShiBiaoTi,
-      getSelfBuy,
-      dianJiFuZhiYiZhu,
-      muBanShuJu,
-      muBanRef,
-      disabledDate,
-      baoCunMuBanRef,
-      baoCunMuBanClick,
-      cuoWuXinXi,
-      dianJiXuanZhongShuJu,
-      dianJiXiuGaiZhiXingKeShi,
-      count,
-    }
-  },
+let daoJiShi = null
+
+onMounted(() => {
+  yiZhuList.value = clone(fuZhiYiZhu.value)
+  for (let i = 0; i < yiZhuList.value.length; i++) {
+    yiZhuList.value[i].id = yiZhuList.value[i].actOrderNo
+  }
+  if (stringIsBlank(huanZheXinXi.value.inpatientNo)) {
+    ElMessage.warning('您现在进入的是医嘱模板编辑')
+  } else {
+    ElMessage.warning('您现在进入的是医嘱编辑模块,' + '您的编辑时间有 10 分钟,你准备好了吗?Are ya ready kids?')
+    kaiQiDaoJiShi()
+  }
+  if (stringNotBlank(huanZheXinXi.value.inpatientNo)) {
+    zhiXingKeShiData.value = [
+      {
+        code: huanZheXinXi.value.smallDept,
+        name: huanZheXinXi.value.smallDeptName,
+      },
+    ]
+  }
+  fuZhiYiZhu.value = []
+})
+
+onUnmounted(() => {
+  ElMessageBox.close()
+  clearInterval(daoJiShi)
+})
+
+// 倒计时功能
+const kaiQiDaoJiShi = () => {
+  seconds.value = 600
+  clearInterval(daoJiShi)
+  daoJiShi = setInterval(() => {
+    seconds.value--
+    countDown()
+  }, 1000)
+}
+
+const countDown = () => {
+  let m = parseInt(((seconds.value / 60) % 60).toString())
+  m = m < 10 ? '0' + m : m
+  let s = parseInt((seconds.value % 60).toString())
+  s = s < 10 ? '0' + s : s
+  count.value = '剩余操作时间 ' + m + '分' + s + '秒'
+  if (seconds.value === 300) {
+    ElMessageBox.alert('您的操作时间过半', '提示', {
+      type: 'warning',
+    }).then((res) => {
+    })
+  } else if (seconds.value === 60 || seconds.value === 30 || seconds.value === 20) {
+    ElMessage({
+      message: '剩余操作时间' + seconds.value + '秒',
+      showClose: true,
+      type: 'error',
+      title: '成功',
+      duration: 4500,
+    })
+  } else if (seconds.value === 0) {
+    clearInterval(daoJiShi)
+    router.go(-1)
+  }
 }
+
 </script>
 
 <style scoped>

+ 197 - 232
src/views/hospitalization/zhu-yuan-yi-sheng/yi-zhu-lu-ru/YiZhuLuRu.vue

@@ -162,8 +162,7 @@
   </el-container>
 </template>
 
-<script>
-import {computed, onActivated, ref, watch} from "vue";
+<script name="YiZhuLuRuZhuJian" setup>
 import {shortcuts} from '@/data/shortcuts'
 import {
   huoQuYiZhuMingCheng,
@@ -172,268 +171,234 @@ import {
   yiZhuChaoZuo,
 } from "@/api/zhu-yuan-yi-sheng/yi-zhu-lu-ru";
 import {fuZhiYiZhu, huanZhePinLvData, huanZheXinXi, youWuXuanZheHuanZhe,} from '../public-js/zhu-yuan-yi-sheng'
-
 import {getDateRangeFormatDate, getFormatDatetime} from "@/utils/date";
 import store from '@/store'
 import {stringIsBlank, stringNotBlank} from '@/utils/blank-utils';
 import {getServerDateApi} from "@/api/public-api";
 import router from "@/router";
 
-export default {
-  name: "YiZhuLuRuZhuJian",
-  setup(props, cxt) {
-    const windowSize = computed(() => {
-      return store.state.app.windowSize
-    })
+const windowSize = computed(() => {
+  return store.state.app.windowSize
+})
 
-    const user = computed(() => {
-      return store.state.user.info
-    })
+const user = computed(() => {
+  return store.state.user.info
+})
 
-    const dateRange = ref([])
-    // 根据医嘱的名字来进行搜索
-    const orderName = ref('')
-    const yiZhuMingZiData = ref([])
-    // 获取频率
-    const pinLv = ref('')
-    // 状态
-    const zhuangTai = ref(0)
-    // 分页
-    const yiZhuPage = ref({
-      currentPage: 1,
-      pageSize: 30,
-      total: 0,
-      data: []
+const dateRange = ref([])
+// 根据医嘱的名字来进行搜索
+let orderName = $ref('')
+const yiZhuMingZiData = ref([])
+// 获取频率
+const pinLv = ref('')
+// 状态
+const zhuangTai = ref(0)
+// 分页
+const yiZhuPage = ref({
+  currentPage: 1,
+  pageSize: 30,
+  total: 0,
+  data: []
+})
+const tableRef = ref(null)
+
+const remoteMethodChargeCode = (val) => {
+  if (youWuXuanZheHuanZhe()) return
+  if (val.length > 1) {
+    huoQuYiZhuMingCheng(huanZheXinXi.value.inpatientNo, huanZheXinXi.value.admissTimes, val).then((res) => {
+      yiZhuMingZiData.value = res
     })
-    const tableRef = ref(null)
+  }
+}
 
-    const remoteMethodChargeCode = (val) => {
-      if (youWuXuanZheHuanZhe()) return
-      if (val.length > 1) {
-        huoQuYiZhuMingCheng(huanZheXinXi.value.inpatientNo, huanZheXinXi.value.admissTimes, val).then((res) => {
-          yiZhuMingZiData.value = res
-        })
-      }
-    }
-    // 根据医嘱的名字来进行搜索 结束
-    const zhuangTaiList = ref([
-      {code: 0, name: '全部'},
-      {code: 1, name: '录入'},
-      {code: 2, name: '确认'},
-      {code: 3, name: '执行'},
-      {code: 5, name: '停止'},
-      {code: 6, name: '可停止'},
-      {code: 7, name: '可撤销'},
-      {code: 8, name: '临时医嘱'},
-      {code: 9, name: '长期医嘱'},
-    ])
+// 根据医嘱的名字来进行搜索 结束
+const zhuangTaiList = ref([
+  {code: 0, name: '全部'},
+  {code: 1, name: '录入'},
+  {code: 2, name: '确认'},
+  {code: 3, name: '执行'},
+  {code: 5, name: '停止'},
+  {code: 6, name: '可停止'},
+  {code: 7, name: '可撤销'},
+  {code: 8, name: '临时医嘱'},
+  {code: 9, name: '长期医嘱'},
+])
 
-    const zhuangTaiXuanZhe = (val) => {
-      if (val >= 6) {
-        orderName.value = ''
-        pinLv.value = ''
-      }
-    }
+const zhuangTaiXuanZhe = (val) => {
+  if (val >= 6) {
+    orderName = ''
+    pinLv.value = ''
+  }
+}
 
-    const chaXunYiZhuClick = (total) => {
-      if (youWuXuanZheHuanZhe()) return
-      const dateS = getDateRangeFormatDate(dateRange.value)
-      let data = {
-        currentPage: yiZhuPage.value.currentPage,
-        pageSize: yiZhuPage.value.pageSize,
-        total: total,
-        patNo: huanZheXinXi.value.inpatientNo,
-        times: huanZheXinXi.value.admissTimes,
-        startTime: dateS.startTime,
-        endTime: dateS.endTime,
-        frequCode: pinLv.value,
-        orderName: orderName.value,
-        zhuangTai: zhuangTai.value
-      }
-      huoQuYiZhuShuJu(data).then((res) => {
-        yiZhuPage.value.total = res.total
-        yiZhuPage.value.data = res.records
-      }).catch(e => {
-        yiZhuPage.value.total = 0
-        yiZhuPage.value.data = []
-      })
-    }
+const chaXunYiZhuClick = (total) => {
+  if (youWuXuanZheHuanZhe()) return
+  const dateS = getDateRangeFormatDate(dateRange.value)
+  let data = {
+    currentPage: yiZhuPage.value.currentPage,
+    pageSize: yiZhuPage.value.pageSize,
+    total: total,
+    patNo: huanZheXinXi.value.inpatientNo,
+    times: huanZheXinXi.value.admissTimes,
+    startTime: dateS.startTime,
+    endTime: dateS.endTime,
+    frequCode: pinLv.value,
+    orderName: orderName,
+    zhuangTai: zhuangTai.value
+  }
+  huoQuYiZhuShuJu(data).then((res) => {
+    yiZhuPage.value.total = res.total
+    yiZhuPage.value.data = res.records
+  }).catch(e => {
+    yiZhuPage.value.total = 0
+    yiZhuPage.value.data = []
+  })
+}
 
-    const handleSizeChange = (val) => {
-      yiZhuPage.value.pageSize = val
-      chaXunYiZhuClick(yiZhuPage.value.total)
-    }
+const handleSizeChange = (val) => {
+  yiZhuPage.value.pageSize = val
+  chaXunYiZhuClick(yiZhuPage.value.total)
+}
 
-    const handleCurrentChange = (val) => {
-      yiZhuPage.value.currentPage = val
-      chaXunYiZhuClick(yiZhuPage.value.total)
-    }
-    /* 添加子医嘱的背景颜色 */
-    const differChildrenRows = ({row}) => {
-      if (row.isChildren) {
-        return 'children-row'
-      }
-    }
+const handleCurrentChange = (val) => {
+  yiZhuPage.value.currentPage = val
+  chaXunYiZhuClick(yiZhuPage.value.total)
+}
+/* 添加子医嘱的背景颜色 */
+const differChildrenRows = ({row}) => {
+  if (row.isChildren) {
+    return 'children-row'
+  }
+}
 
-    /**
-     * 下面这里是添加医嘱了
-     */
-    const tianJiaXiuGaiYiZhu = ref(null)
-    const addYiZhuClick = () => {
-      router.push({
-        name: 'xinZengShuJu',
-        params: {
-          passRule: true,
-          name: '添加医嘱',
-        },
-        query: {
-          path: '/inpatient/zhuYuanYiSheng/yiZhuLuRu'
-        }
-      })
+/**
+ * 下面这里是添加医嘱了
+ */
+const addYiZhuClick = () => {
+  router.push({
+    name: 'xinZengShuJu',
+    params: {
+      passRule: true,
+      name: '添加医嘱',
+    },
+    query: {
+      path: '/inpatient/zhuYuanYiSheng/yiZhuLuRu'
     }
+  })
+}
 
-    const dianJiYiZhuChaoZuo = ({actOrderNo, orderName}, flag, name) => {
-      chaoZuoBiaoZhi.value = flag
-      yiZhuHao.value = actOrderNo
-      if (flag === 1) {
-        zhiXingChaoZuo()
-      } else {
-        yiZhuChaoZuoDialog.value = true
-        if (flag === 2) {
-          yiZhuChaoZuoBiaoTi.value = '撤销医嘱'
-        } else if (flag === 3) {
-          yiZhuChaoZuoBiaoTi.value = '停止医嘱'
-        }
-      }
+const dianJiYiZhuChaoZuo = ({actOrderNo, orderName}, flag, name) => {
+  chaoZuoBiaoZhi.value = flag
+  yiZhuHao.value = actOrderNo
+  if (flag === 1) {
+    zhiXingChaoZuo()
+  } else {
+    yiZhuChaoZuoDialog.value = true
+    if (flag === 2) {
+      yiZhuChaoZuoBiaoTi = '撤销医嘱'
+    } else if (flag === 3) {
+      yiZhuChaoZuoBiaoTi = '停止医嘱'
     }
+  }
+}
 
-    const zhiXingChaoZuo = () => {
-      if (chaoZuoBiaoZhi.value === 90) {
-        let data = {
-          actOrderNoList: [],
-          endTime: tingZhiRiQi.value
-        }
-        xuanZhongDeShuJu.value.forEach((item) => {
-          data.actOrderNoList.push(item.actOrderNo)
-        })
-        piLiangXiuGaiTingZhiShiJian(data).then((res) => {
-          handleCurrentChange(yiZhuPage.value.currentPage)
-          yiZhuChaoZuoDialog.value = false
-        })
-      } else {
-        let data = ''
-        if (chaoZuoBiaoZhi.value === 2) {
-          data = content.value
-        } else if (chaoZuoBiaoZhi.value === 3) {
-          data = tingZhiRiQi.value
-        }
-        yiZhuChaoZuo(yiZhuHao.value, chaoZuoBiaoZhi.value, data).then((res) => {
-          handleCurrentChange(yiZhuPage.value.currentPage)
-          yiZhuChaoZuoDialog.value = false
-          content.value = ''
-        })
-      }
+const zhiXingChaoZuo = () => {
+  if (chaoZuoBiaoZhi.value === 90) {
+    let data = {
+      actOrderNoList: [],
+      endTime: tingZhiRiQi.value
+    }
+    xuanZhongDeShuJu.value.forEach((item) => {
+      data.actOrderNoList.push(item.actOrderNo)
+    })
+    piLiangXiuGaiTingZhiShiJian(data).then((res) => {
+      handleCurrentChange(yiZhuPage.value.currentPage)
+      yiZhuChaoZuoDialog.value = false
+    })
+  } else {
+    let data = ''
+    if (chaoZuoBiaoZhi.value === 2) {
+      data = content.value
+    } else if (chaoZuoBiaoZhi.value === 3) {
+      data = tingZhiRiQi.value
     }
+    yiZhuChaoZuo(yiZhuHao.value, chaoZuoBiaoZhi.value, data).then((res) => {
+      handleCurrentChange(yiZhuPage.value.currentPage)
+      yiZhuChaoZuoDialog.value = false
+      content.value = ''
+    })
+  }
+}
 
-    const yiZhuChaoZuoDialog = ref(false)
-    const content = ref('')
-    const tingZhiRiQi = ref('')
-    const chaoZuoBiaoZhi = ref(0)
-    const yiZhuHao = ref(0)
-    const yiZhuChaoZuoBiaoTi = ref('')
+const yiZhuChaoZuoDialog = ref(false)
+const content = ref('')
+const tingZhiRiQi = ref('')
+const chaoZuoBiaoZhi = ref(0)
+const yiZhuHao = ref(0)
+let yiZhuChaoZuoBiaoTi = $ref('')
 
-    const xuanZhongDeShuJu = ref([])
+const xuanZhongDeShuJu = ref([])
 
-    const huoQuXuanZhongDeShuJu = (val) => {
-      xuanZhongDeShuJu.value = val
-    }
+const huoQuXuanZhongDeShuJu = (val) => {
+  xuanZhongDeShuJu.value = val
+}
 
-    // 用户切换全选和全不选 时 el-table中的全选不会选中子节点
-    const toggleSelection = (row, selected) => {
-      if (row) {
-        row.forEach(item => {
-          tableRef.value.toggleRowSelection(item, selected)
-        })
-      }
-    }
+// 用户切换全选和全不选 时 el-table中的全选不会选中子节点
+const toggleSelection = (row, selected) => {
+  if (row) {
+    row.forEach(item => {
+      tableRef.value.toggleRowSelection(item, selected)
+    })
+  }
+}
 
-    let quanXuanFlag = false; // 默认 为全不选
-    const quanXuanYiZhu = (selection) => {
-      quanXuanFlag = !quanXuanFlag
-      selection.forEach(item => {
-        if (stringNotBlank(item.children)) {
-          toggleSelection(item.children, quanXuanFlag)
-        }
-      })
-      if (!quanXuanFlag) {
-        tableRef.value.clearSelection()
-      }
+/**
+ * 切换全选和不全选
+ * @type {boolean}
+ */
+let quanXuanFlag = false; // 默认 为全不选
+const quanXuanYiZhu = (selection) => {
+  quanXuanFlag = !quanXuanFlag
+  selection.forEach(item => {
+    if (stringNotBlank(item.children)) {
+      toggleSelection(item.children, quanXuanFlag)
     }
+  })
+  if (!quanXuanFlag) {
+    tableRef.value.clearSelection()
+  }
+}
 
-    const dianJiFuZhuXuanZhongYiZhu = () => {
-      fuZhiYiZhu.value = xuanZhongDeShuJu.value
-    }
+/**
+ * 点击复制医嘱
+ */
+const dianJiFuZhuXuanZhongYiZhu = () => {
+  fuZhiYiZhu.value = xuanZhongDeShuJu.value
+}
 
 
-    onActivated(() => {
-      getServerDateApi().then((res) => {
-        dateRange.value[0] = getFormatDatetime(res, 'YYYY-MM-DD')
-        dateRange.value[1] = getFormatDatetime(res, 'YYYY-MM-DD')
-        chaXunYiZhuClick(0)
-      })
-    })
+onActivated(() => {
+  getServerDateApi().then((res) => {
+    dateRange.value[0] = getFormatDatetime(res, 'YYYY-MM-DD')
+    dateRange.value[1] = getFormatDatetime(res, 'YYYY-MM-DD')
+    chaXunYiZhuClick(0)
+  })
+})
 
-    watch(() => huanZheXinXi.value, () => {
-      getServerDateApi().then((res) => {
-        if (dateRange.value === null) {
-          dateRange.value = []
-          dateRange.value.push(getFormatDatetime(res, 'YYYY-MM-DD'))
-          dateRange.value.push(getFormatDatetime(res, 'YYYY-MM-DD'))
-        } else {
-          dateRange.value[0] = getFormatDatetime(res, 'YYYY-MM-DD')
-          dateRange.value[1] = getFormatDatetime(res, 'YYYY-MM-DD')
-        }
-        chaXunYiZhuClick(0)
-      })
-    })
 
-    return {
-      user,
-      dateRange,
-      shortcuts,
-      orderName,
-      yiZhuMingZiData,
-      remoteMethodChargeCode,
-      chaXunYiZhuClick,
-      pinLv,
-      huanZhePinLvData,
-      yiZhuPage,
-      windowSize,
-      handleSizeChange,
-      handleCurrentChange,
-      getYiZhuFlag,
-      addYiZhuClick,
-      tianJiaXiuGaiYiZhu,
-      differChildrenRows,
-      dianJiYiZhuChaoZuo,
-      zhuangTaiList,
-      zhuangTai,
-      zhuangTaiXuanZhe,
-      yiZhuChaoZuoDialog,
-      content,
-      chaoZuoBiaoZhi,
-      tingZhiRiQi,
-      zhiXingChaoZuo,
-      xuanZhongDeShuJu,
-      huoQuXuanZhongDeShuJu,
-      yiZhuChaoZuoBiaoTi,
-      quanXuanYiZhu,
-      tableRef,
-      huanZheXinXi,
-      dianJiFuZhuXuanZhongYiZhu
+watch(() => huanZheXinXi.value, () => {
+  getServerDateApi().then((res) => {
+    if (dateRange.value === null) {
+      dateRange.value = []
+      dateRange.value.push(getFormatDatetime(res, 'YYYY-MM-DD'))
+      dateRange.value.push(getFormatDatetime(res, 'YYYY-MM-DD'))
+    } else {
+      dateRange.value[0] = getFormatDatetime(res, 'YYYY-MM-DD')
+      dateRange.value[1] = getFormatDatetime(res, 'YYYY-MM-DD')
     }
-  }
-}
+    chaXunYiZhuClick(0)
+  })
+})
 
 function getYiZhuFlag(val) {
   if (stringIsBlank(val)) {

+ 31 - 19
vite.config.js

@@ -1,30 +1,42 @@
-import { defineConfig } from 'vite'
+import {defineConfig} from 'vite'
 import legacy from '@vitejs/plugin-legacy'
 import vue from '@vitejs/plugin-vue'
-import { resolve } from 'path'
+import {resolve} from 'path'
+// vue setup 的糖语法
+import VueSetupExtend from 'vite-plugin-vue-setup-extend'
+// 不用导入 vue 的 import 了
+import AutoImport from 'unplugin-auto-import/vite'
+
 
 const pathResolve = (dir) => {
-  return resolve(__dirname, '.', dir)
+    return resolve(__dirname, '.', dir)
 }
 
 const alias = {
-  '@': pathResolve('src'),
+    '@': pathResolve('src'),
 }
 
 export default defineConfig({
-  resolve: {
-    alias,
-  },
-  plugins: [
-    vue(),
-    legacy({
-      targets: 'chrome 49',
-    }),
-  ],
-  server: {
-    host: '0.0.0.0',
-  },
-  build: {
-    chunkSizeWarningLimit: 1000,
-  },
+    resolve: {
+        alias,
+    },
+    plugins: [
+        VueSetupExtend(),
+        vue({
+            refTransform: true
+        }),
+        legacy({
+            targets: 'chrome 49',
+        }),
+        AutoImport({
+            dts: 'src/auto-imports.d.ts',
+            imports: ['vue']
+        })
+    ],
+    server: {
+        host: '0.0.0.0',
+    },
+    build: {
+        chunkSizeWarningLimit: 1000,
+    },
 })