Ver código fonte

优化医嘱选择方式

xiaochan 2 anos atrás
pai
commit
0a5f8f4c6b

+ 221 - 219
src/components/xiao-chan/xc-table-v2/XcTableV2.vue

@@ -1,55 +1,55 @@
 <template>
-    <div v-if="isShow"
-         :style="{width: props.width === null ? '100%' :props.width+'px' }">
-        <div class="xc-table_v2"
-             ref="tableRef">
-            <div class="header"
-                 ref="headerRef">
-                <template v-for="(item,index) in props.columns">
-                    <div class="th"
-                         @click="headerClick(item)"
-                         :style="item.fixedStyle">
-                        <template v-if="item.type">
-                            <component :is="typeEnum[item.type].header()"/>
-                        </template>
-                        {{ item.name }}
-                    </div>
+  <div v-if="isShow"
+       :style="{width: props.width === null ? '100%' :props.width+'px' }">
+    <div class="xc-table_v2"
+         ref="tableRef">
+      <div class="header"
+           ref="headerRef">
+        <template v-for="(item,index) in props.columns">
+          <div class="th"
+               @click="headerClick(item)"
+               :style="item.fixedStyle">
+            <template v-if="item.type">
+              <component :is="typeEnum[item.type].header()"/>
+            </template>
+            {{ item.name }}
+          </div>
+        </template>
+      </div>
+      <div v-bind="containerProps"
+           class="xc-body_v2"
+           :style="{height : props.height + 'px'}">
+        <div v-bind="wrapperProps"
+             ref="dataRef">
+          <div v-for="item in list"
+               :key="props.rowKey === null ?  item.index : props.rowKey"
+               @contextmenu.prevent.stop="contextmenu(item.data,item.index,$event)"
+               :style="rowStyle(item.data, item.index)"
+               :class="rowClass(item.data, item.index)"
+               @dblclick.stop="dbRowClick($event,item.data,  item.index)"
+               @click="rowClick(item.data, $event, item.index)"
+               class="row">
+            <template v-for="(he,heindex) in props.columns">
+              <div :title="item.data[he.code]"
+                   :style="he.fixedStyle"
+                   class="cell">
+                <template v-if="he.type">
+                  <component :is="typeEnum[he.type].body(item)"/>
                 </template>
-            </div>
-            <div v-bind="containerProps"
-                 class="xc-body_v2"
-                 :style="{height : props.height + 'px'}">
-                <div v-bind="wrapperProps"
-                     ref="dataRef">
-                    <div v-for="item in list"
-                         :key="props.rowKey === null ?  item.index : props.rowKey"
-                         @contextmenu.prevent.stop="contextmenu(item.data,item.index,$event)"
-                         :style="rowStyle(item.data, item.index)"
-                         :class="rowClass(item.data, item.index)"
-                         @dblclick.stop="dbRowClick($event,item.data,  item.index)"
-                         @click="rowClick(item.data, $event, item.index)"
-                         class="row">
-                        <template v-for="(he,heindex) in props.columns">
-                            <div :title="item.data[he.code]"
-                                 :style="he.fixedStyle"
-                                 class="cell">
-                                <template v-if="he.type">
-                                    <component :is="typeEnum[he.type].body(item)"/>
-                                </template>
-                                <template v-else-if="he.cellRenderer">
-                                    <component
-                                            :is="he.cellRenderer({data: item.data,index:item.index,cellData: item.data[he.code]})"/>
-                                </template>
-                                <template v-else>
-                                    {{ item.data[he.code] }}
-                                </template>
-                            </div>
-                        </template>
-                    </div>
-                </div>
-            </div>
+                <template v-else-if="he.cellRenderer">
+                  <component
+                      :is="he.cellRenderer({data: item.data,index:item.index,cellData: item.data[he.code]})"/>
+                </template>
+                <template v-else>
+                  {{ item.data[he.code] }}
+                </template>
+              </div>
+            </template>
+          </div>
         </div>
+      </div>
     </div>
+  </div>
 </template>
 
 <script setup name='XcTableV2' lang="tsx">
@@ -58,35 +58,35 @@ import {computed, nextTick, onMounted, ref, Ref, h} from 'vue'
 import {ElCheckbox} from "element-plus";
 
 const props = defineProps({
-    data: Array,
-    columns: {
-        type: Array,
-        default: null
-    },
-    height: {
-        type: Number,
-        default: 300
-    },
-    rowStyle: {
-        type: Function,
-        default: null
-    },
-    rowClass: {
-        type: Function,
-        default: null
-    },
-    rowKey: {
-        type: String,
-        default: null
-    },
-    width: {
-        type: Number,
-        default: null
-    },
+  data: Array,
+  columns: {
+    type: Array,
+    default: null
+  },
+  height: {
+    type: Number,
+    default: 300
+  },
+  rowStyle: {
+    type: Function,
+    default: null
+  },
+  rowClass: {
+    type: Function,
+    default: null
+  },
+  rowKey: {
+    type: String,
+    default: null
+  },
+  width: {
+    type: Number,
+    default: null
+  },
 })
 
 const tempData = computed(() => {
-    return props.data
+  return props.data
 })
 
 const emits = defineEmits(['rowClick', 'dbRowClick', 'contextmenu'])
@@ -94,45 +94,45 @@ const emits = defineEmits(['rowClick', 'dbRowClick', 'contextmenu'])
 const {list, containerProps, wrapperProps, scrollTo} = useVirtualList(
     tempData,
     {
-        itemHeight: 23,
+      itemHeight: 23,
     },
 )
 
 const headerClick = (item) => {
-    if (item.headerFunc) {
-        item.headerFunc()
-    }
+  if (item.headerFunc) {
+    item.headerFunc()
+  }
 }
 
 const rowStyle = (data, index) => {
-    if (props.rowStyle === null) return
-    return props.rowStyle(data, index)
+  if (props.rowStyle === null) return
+  return props.rowStyle(data, index)
 }
 
 const rowClass = (data, index) => {
-    if (props.rowClass === null) return
-    return props.rowClass(data, index)
+  if (props.rowClass === null) return
+  return props.rowClass(data, index)
 }
 
 let timer = null
 const rowClick = (item, event, index) => {
-    if (timer) {
-        clearTimeout(timer)
-    }
-    timer = setTimeout(() => {
-        emits('rowClick', item, index, event)
-    }, 300)
+  if (timer) {
+    clearTimeout(timer)
+  }
+  timer = setTimeout(() => {
+    emits('rowClick', item, index, event)
+  }, 300)
 }
 
 const dbRowClick = (event, data, index) => {
-    if (timer) {
-        clearTimeout(timer)
-    }
-    emits('dbRowClick', {event, data, index})
+  if (timer) {
+    clearTimeout(timer)
+  }
+  emits('dbRowClick', {event, data, index})
 }
 
 const contextmenu = (data, index, event) => {
-    emits('contextmenu', data, index, event)
+  emits('contextmenu', data, index, event)
 }
 
 const tableRef: Ref<HTMLElement | null> = ref(null)
@@ -141,176 +141,178 @@ const headerRef: Ref<HTMLElement | null> = ref(null)
 
 
 const typeEnum = {
-    "selected": {
-        header: () => {
-            return (<ElCheckbox modelValue={selectedAll.value}
-                                indeterminate={intermediate.value}
-                                onClick={(e) => {
-                                    e.stopImmediatePropagation();
-                                    e.preventDefault();
-                                    selectedAll.value = !selectedAll.value
-                                    clickSelectedAll(selectedAll.value)
-                                }}
-            />)
-        },
-        body: ({data, index}) => {
-            return h(ElCheckbox, {
-                modelValue: data.$selected,
-                key: 'table-checkbox' + index,
-                onClick: (e) => {
-                    data.$selected = !data.$selected
-                    clickSelected(e, data.$selected, data, index)
-                }
-            }, null)
-        }
+  "selected": {
+    header: () => {
+      return (<ElCheckbox modelValue={selectedAll.value}
+                          indeterminate={intermediate.value}
+                          onClick={(e) => {
+                            e.stopImmediatePropagation();
+                            e.preventDefault();
+                            selectedAll.value = !selectedAll.value
+                            clickSelectedAll(selectedAll.value)
+                          }}
+      />)
     },
-    "index": {
-        header: () => (<span>排序</span>),
-        body: ({index}) => (
-            <span>{index + 1}</span>
-        )
+    body: ({data, index}) => {
+      return h(ElCheckbox, {
+        modelValue: data.$selected,
+        key: 'table-checkbox' + index,
+        onClick: (e: Event) => {
+          e.stopImmediatePropagation();
+          e.preventDefault();
+          data.$selected = !data.$selected
+        }
+      }, null)
     }
+  },
+  "index": {
+    header: () => (<span>排序</span>),
+    body: ({index}) => (
+        <span>{index + 1}</span>
+    )
+  }
 }
 
-const selectData = ref({})
-const intermediate = ref(false)
 const selectedAll = ref(false)
 
-const selectedRow = (val, data, index) => {
-    if (val) {
-        selectData.value[index] = data
-    } else {
-        delete selectData.value[index]
-    }
-    data.$selected = val
-    let length = Object.keys(selectData.value).length
-    intermediate.value = length > 0
-    selectedAll.value = props.data.length === length
-    if (selectedAll.value) {
-        intermediate.value = false
-    }
-}
 
-const clickSelected = (e: Event, val, data, index) => {
-    if (e !== null) {
-        e.stopImmediatePropagation();
-        e.preventDefault();
+const intermediate = computed(() => {
+  let len = props.data.length
+  let tempLen = 0;
+  for (let i = 0; i < len; i++) {
+    let item = props.data[i]
+    if (item.$selected) {
+      tempLen += 1
     }
-    selectedRow(val, data, index)
-}
+  }
+  if (tempLen === 0) {
+    return false
+  }
+  if (tempLen === len) {
+    selectedAll.value = true
+    return false
+  }
+  return true
+})
 
 
 const clickSelectedAll = (val: boolean) => {
-    for (let i = 0, len = props.data.length; i < len; i++) {
-        let item = props.data[i]
-        selectedRow(val, item, i)
-    }
+  for (let i = 0, len = props.data.length; i < len; i++) {
+    let item = props.data[i]
+    item.$selected = val
+  }
 }
 
 const getSelectedData = () => {
-    let temp = []
-    for (const key in selectData.value) {
-        temp.push(selectData.value[key])
+  let temp = []
+  try {
+    for (let i = 0; i < props.data.length; i++) {
+      let item = props.data[i]
+      if (item.$selected) {
+        temp.push(item)
+      }
     }
     return temp
+  } catch (e) {
+    return []
+  }
 }
 
 const scrollToByData = (data) => {
-    let temp = JSON.stringify(data)
-    let index = -1
-    for (let i = 0, len = tempData.value.length; i < len; i++) {
-        let item = JSON.stringify(tempData.value[i])
-        if (item === temp) {
-            index = i
-            break;
-        }
-    }
-    if (index > 0) {
-        scrollTo(index)
+  let temp = JSON.stringify(data)
+  let index = -1
+  for (let i = 0, len = tempData.value.length; i < len; i++) {
+    let item = JSON.stringify(tempData.value[i])
+    if (item === temp) {
+      index = i
+      break;
     }
+  }
+  if (index > 0) {
+    scrollTo(index)
+  }
 }
 
 const scrollToByKey = (key) => {
-    if (props.rowKey === null) {
-        throw new Error('请先选择一个 key')
-    }
-    let index = -1
-    for (let i = 0, len = tempData.value.length; i < len; i++) {
-        if (tempData.value[i][props.rowKey] == key) {
-            index = i
-            break;
-        }
-    }
-    if (index > 0) {
-        scrollTo(index - 2)
+  if (props.rowKey === null) {
+    throw new Error('请先选择一个 key')
+  }
+  let index = -1
+  for (let i = 0, len = tempData.value.length; i < len; i++) {
+    if (tempData.value[i][props.rowKey] == key) {
+      index = i
+      break;
     }
-    return index
+  }
+  if (index > 0) {
+    scrollTo(index - 2)
+  }
+  return index
 }
 
 const fixedStyle = (item, index) => {
-    let str = {width: item.width + 'px'}
-    if (item.fixed) {
-        let px = 0
-        if (item.fixed === 'right') {
-            for (let i = index + 1, len = props.columns.length; i < len; i++) {
-                let item = props.columns[i]
-                px += item.width
-            }
-        }
-        str['position'] = 'sticky!important';
-        str[item.fixed] = px + 'px'
-        str['z-index'] = 2
-        str['background'] = '#fff'
+  let str = {width: item.width + 'px'}
+  if (item.fixed) {
+    let px = 0
+    if (item.fixed === 'right') {
+      for (let i = index + 1, len = props.columns.length; i < len; i++) {
+        let item = props.columns[i]
+        px += item.width
+      }
     }
-    return str
+    str['position'] = 'sticky!important';
+    str[item.fixed] = px + 'px'
+    str['z-index'] = 2
+    str['background'] = '#fff'
+  }
+  return str
 }
 
 const clearSelected = () => {
-    clickSelectedAll(false)
+  clickSelectedAll(false)
 }
 
 let tempScrollTop = 0
 const isShow = ref(false)
 
 const fixedRight = () => {
-    let temp = null
-    if (props.columns === null) {
-        return
+  let temp = null
+  if (props.columns === null) {
+    return
+  }
+  props.columns.forEach((item, index) => {
+    if (temp === null && item.fixed && item.fixed === 'right') {
+      temp = item
     }
-    props.columns.forEach((item, index) => {
-        if (temp === null && item.fixed && item.fixed === 'right') {
-            temp = item
-        }
-        item.fixedStyle = fixedStyle(item, index);
-    });
-    temp.fixedStyle['border-left'] = '1px solid #ebeef5'
+    item.fixedStyle = fixedStyle(item, index);
+  });
+  temp.fixedStyle['border-left'] = '1px solid #ebeef5'
 }
 
 onMounted(async () => {
-    fixedRight()
-    isShow.value = true
-    await nextTick()
-    useIntersectionObserver(
-        tableRef,
-        ([{isIntersecting}], observerElement) => {
-            if (isIntersecting) {
-                containerProps.ref.value.scrollTop = tempScrollTop
-            }
-        },
-    )
-    containerProps.ref.value.addEventListener('scroll', () => {
-        tempScrollTop = containerProps.ref.value.scrollTop
-        headerRef.value.scrollLeft = containerProps.ref.value.scrollLeft
-    })
+  fixedRight()
+  isShow.value = true
+  await nextTick()
+  useIntersectionObserver(
+      tableRef,
+      ([{isIntersecting}], observerElement) => {
+        if (isIntersecting) {
+          containerProps.ref.value.scrollTop = tempScrollTop
+        }
+      },
+  )
+  containerProps.ref.value.addEventListener('scroll', () => {
+    tempScrollTop = containerProps.ref.value.scrollTop
+    headerRef.value.scrollLeft = containerProps.ref.value.scrollLeft
+  })
 })
 
 defineExpose({
-    selectedRow,
-    getSelectedData,
-    scrollToByData,
-    scrollToByKey,
-    scrollTo,
-    clearSelected
+  getSelectedData,
+  scrollToByData,
+  scrollToByKey,
+  scrollTo,
+  clearSelected
 })
 
 

+ 273 - 273
src/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/table/YzTableV2.vue

@@ -1,15 +1,15 @@
 <template>
-    <xc-table-v2 :data="tempYzData"
-                 @rowClick="rowClick"
-                 :width="getWindowSize.w - 160"
-                 row-key="actOrderNo"
-                 @contextmenu="contextmenuItem"
-                 :height="getWindowSize.h  - (yzHeaderSize) - 180  "
-                 @dbRowClick="setDefaultStopTime"
-                 ref="tableRef"
-                 :row-class="rowClass"
-                 :columns="header"/>
-    <right-click-menu :mouse-position="mousePosition" :config="opt"/>
+  <xc-table-v2 :data="tempYzData"
+               @rowClick="rowClick"
+               :width="getWindowSize.w - 160"
+               row-key="actOrderNo"
+               @contextmenu="contextmenuItem"
+               :height="getWindowSize.h  - (yzHeaderSize) - 180  "
+               @dbRowClick="setDefaultStopTime"
+               ref="tableRef"
+               :row-class="rowClass"
+               :columns="header"/>
+  <right-click-menu :mouse-position="mousePosition" :config="opt"/>
 </template>
 
 
@@ -21,13 +21,13 @@ import {getFormatDatetime} from "@/utils/date";
 import {getServerDateApi} from '@/api/public-api'
 import {getWindowSize} from "@/utils/window-size";
 import {
-    tempYzData,
-    yiZhuData,
-    associateOrders,
-    clearAssociate,
-    drugManual,
-    yzHeaderSize,
-    yzMitt,
+  tempYzData,
+  yiZhuData,
+  associateOrders,
+  clearAssociate,
+  drugManual,
+  yzHeaderSize,
+  yzMitt,
 } from "@/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng";
 import sleep from "@/utils/sleep";
 import RightClickMenu from "@/components/menu-item/RightClickMenu.vue";
@@ -40,342 +40,342 @@ const emits = defineEmits(['rowClick', 'clickAssociate', 'voidOrders'])
 const tableRef = ref(null)
 
 const header = [
-    {type: 'selected', width: 20},
-    {width: 30, type: 'index'},
-    {width: 20, code: 'orderGroup', name: '组'},
-    {
-        width: 20, code: 'statusFlag', cellRenderer: ({cellData}) => {
-            return getYiZhuFlag(cellData)
-        }
-    },
-    {
-        width: 70, code: 'actOrderNo', name: '医嘱号', cellRenderer: ({data}) => {
-            if (data.error) {
-                return h('span', {
-                    style: {
-                        color: 'red'
-                    },
-                    class: () => orderNoClass(data)
-                }, data.actOrderNo)
-            } else {
-                return h('span', {
-                    class: orderNoClass(data)
-                }, data.actOrderNo)
-            }
+  {type: 'selected', width: 20},
+  {width: 30, type: 'index'},
+  {width: 20, code: 'orderGroup', name: '组'},
+  {
+    width: 20, code: 'statusFlag', cellRenderer: ({cellData}) => {
+      return getYiZhuFlag(cellData)
+    }
+  },
+  {
+    width: 70, code: 'actOrderNo', name: '医嘱号', cellRenderer: ({data}) => {
+      if (data.error) {
+        return h('span', {
+          style: {
+            color: 'red'
+          },
+          class: () => orderNoClass(data)
+        }, data.actOrderNo)
+      } else {
+        return h('span', {
+          class: orderNoClass(data)
+        }, data.actOrderNo)
+      }
 
-        }
-    },
-    {width: 225, code: 'orderName', name: '医嘱名称'},
-    {
-        code: 'dose', name: '剂量', width: 75, cellRenderer: ({data}) => {
-            return h('span', {}, nullToEmpty(data.dose) + ' ' + nullToEmpty(data.doseUnitName))
-        }
-    },
-    {code: 'frequCode', name: '频率', width: 75},
-    {code: 'supplyCodeName', name: '给药方式', width: 60},
-    {
-        code: 'startTime', name: '开始时间', width: 95, cellRenderer: ({data}) => {
-            return h('span', {}, timeFomat(data.startTime)) //  (<span>{timeFomat(data.startTime)}</span>)
-        }
-    },
-    {
-        code: 'endTime', name: '结束时间', width: 160, cellRenderer: ({data, index}) => {
-            if (stringIsBlank(data.endTime) && stringIsBlank(data.parentNo) && data.frequCode !== 'ONCE') {
-                return h('input', {
-                    type: 'datetime-local',
-                    style: endDateStyle(data),
-                    value: data.endTimeTemp,
-                    onInput: (event) => {
-                        data.endTimeTemp = event.target.value
-                    },
-                    onclick: (event) => {
-                        event.stopPropagation()
-                    },
-                    onContextmenu: (event) => {
-                        event.stopPropagation()
-                        event.preventDefault();
-                        cancelStopTime(data, index)
-                    }
-                }, null)
-            }
-            return h('span', null, timeFomat(data.endTime))
-        }
-    },
-    {
-        code: 'emergencyFlag', name: '紧急', cellRenderer: ({cellData}) => {
-            return h('span', null, cellData === '1' ? '√' : '')
-        },
-        width: 30
+    }
+  },
+  {width: 225, code: 'orderName', name: '医嘱名称'},
+  {
+    code: 'dose', name: '剂量', width: 75, cellRenderer: ({data}) => {
+      return h('span', {}, nullToEmpty(data.dose) + ' ' + nullToEmpty(data.doseUnitName))
+    }
+  },
+  {code: 'frequCode', name: '频率', width: 75},
+  {code: 'supplyCodeName', name: '给药方式', width: 60},
+  {
+    code: 'startTime', name: '开始时间', width: 95, cellRenderer: ({data}) => {
+      return h('span', {}, timeFomat(data.startTime)) //  (<span>{timeFomat(data.startTime)}</span>)
+    }
+  },
+  {
+    code: 'endTime', name: '结束时间', width: 160, cellRenderer: ({data, index}) => {
+      if (stringIsBlank(data.endTime) && stringIsBlank(data.parentNo) && data.frequCode !== 'ONCE') {
+        return h('input', {
+          type: 'datetime-local',
+          style: endDateStyle(data),
+          value: data.endTimeTemp,
+          onInput: (event) => {
+            data.endTimeTemp = event.target.value
+          },
+          onclick: (event) => {
+            event.stopPropagation()
+          },
+          onContextmenu: (event) => {
+            event.stopPropagation()
+            event.preventDefault();
+            cancelStopTime(data, index)
+          }
+        }, null)
+      }
+      return h('span', null, timeFomat(data.endTime))
+    }
+  },
+  {
+    code: 'emergencyFlag', name: '紧急', cellRenderer: ({cellData}) => {
+      return h('span', null, cellData === '1' ? '√' : '')
     },
-    {
-        code: 'ybSelfFlag', name: '自费', cellRenderer: ({cellData}) => {
-            return h('span', null, cellData === '1' ? '√' : '')
-        },
-        width: 30
+    width: 30
+  },
+  {
+    code: 'ybSelfFlag', name: '自费', cellRenderer: ({cellData}) => {
+      return h('span', null, cellData === '1' ? '√' : '')
     },
-    {code: 'physicianName', name: '医生', width: 65},
-    {code: 'selfBuyName', name: '费用标志', width: 60},
-    {code: 'execUnitName', name: '执行科室', width: 80},
-    {
-        code: 'drugQuan', name: '领量', cellRenderer: ({data}) => {
-            return h('span', null, nullToEmpty(data.drugQuan) + nullToEmpty(data.miniUnitName))
-        },
-        width: 30
+    width: 30
+  },
+  {code: 'physicianName', name: '医生', width: 65},
+  {code: 'selfBuyName', name: '费用标志', width: 60},
+  {code: 'execUnitName', name: '执行科室', width: 80},
+  {
+    code: 'drugQuan', name: '领量', cellRenderer: ({data}) => {
+      return h('span', null, nullToEmpty(data.drugQuan) + nullToEmpty(data.miniUnitName))
     },
-    {code: 'groupNoName', name: '药房', width: 91},
-    {code: 'serial', name: '序号', width: 35},
-    {code: 'instruction', name: '嘱托', width: 150},
-    {
-        name: '操作', width: 100, fixed: 'right', cellRenderer: ({data}) => {
-            return h('div', {
-                class: 'yz_button',
-                onclick: (e) => {
-                    e.preventDefault();
-                    e.stopImmediatePropagation();
-                    emits('voidOrders', data)
-                }
-            }, [hToVoidNode(data), hDeleteNode(data)])
+    width: 30
+  },
+  {code: 'groupNoName', name: '药房', width: 91},
+  {code: 'serial', name: '序号', width: 35},
+  {code: 'instruction', name: '嘱托', width: 150},
+  {
+    name: '操作', width: 100, fixed: 'right', cellRenderer: ({data}) => {
+      return h('div', {
+        class: 'yz_button',
+        onclick: (e) => {
+          e.preventDefault();
+          e.stopImmediatePropagation();
+          emits('voidOrders', data)
         }
+      }, [hToVoidNode(data), hDeleteNode(data)])
     }
+  }
 ];
 
 const hToVoidNode = (data) => {
-    return h('div', {
-        class: 'toVoid',
-        onclick: (e) => {
-            e.preventDefault();
-            e.stopImmediatePropagation();
-            emits('voidOrders', data)
-        }
-    }, {default: () => '作废'})
+  return h('div', {
+    class: 'toVoid',
+    onclick: (e) => {
+      e.preventDefault();
+      e.stopImmediatePropagation();
+      emits('voidOrders', data)
+    }
+  }, {default: () => '作废'})
 }
 
 const hDeleteNode = (data) => {
-    return h('div', {
-        class: 'delete',
-        onclick: (e) => {
-            e.preventDefault();
-            e.stopImmediatePropagation();
-            yzMitt.emit('deleteAnOrderByOrderNo', data, false)
-        }
-    }, {default: () => '删除'})
+  return h('div', {
+    class: 'delete',
+    onclick: (e) => {
+      e.preventDefault();
+      e.stopImmediatePropagation();
+      yzMitt.emit('deleteAnOrderByOrderNo', data, false)
+    }
+  }, {default: () => '删除'})
 }
 
 
 const orderNoClass = (data) => {
-    let c = ''
-    if (data.newOrderFlag > 0) {
-        c = 'new_order'
-    }
-    return c
+  let c = ''
+  if (data.newOrderFlag > 0) {
+    c = 'new_order'
+  }
+  return c
 }
 
 const timeFomat = (val) => {
-    return getFormatDatetime(val, 'YY-MM-DD HH:mm')
+  return getFormatDatetime(val, 'YY-MM-DD HH:mm')
 }
 
 function getYiZhuFlag(val) {
-    if (stringIsBlank(val)) {
-        return val
-    }
-    switch (val) {
-        case '1':
-            return h('span', {style: {color: '#05ff00'}}, 'R') // (<span style="color: #05ff00">R</span>)
-        case '2':
-            return h('span', {style: {color: '#0000fb'}}, 'Q')//(<span style="color: #0000fb">Q</span>)
-        case '3':
-            return h('span', {style: {color: '#ff07f3'}}, 'Z')// (<span style="color: #ff07f3">Z</span>)
-        case '4':
-            return h('span', {style: {color: '#ff07f3'}}, 'Z')// (<span style="color:  #ff07f3">Z</span>)
-        case '5':
-            return h('span', {style: {color: 'red'}}, 'T')// (<span style="color: red">T</span>)
-        case '-1':
-            return h('span', {style: {color: '#00ffe0'}}, 'D') // (<span style="color: #00ffe0">D</span>)
-        default:
-            return 'warning'
-    }
+  if (stringIsBlank(val)) {
+    return val
+  }
+  switch (val) {
+    case '1':
+      return h('span', {style: {color: '#05ff00'}}, 'R') // (<span style="color: #05ff00">R</span>)
+    case '2':
+      return h('span', {style: {color: '#0000fb'}}, 'Q')//(<span style="color: #0000fb">Q</span>)
+    case '3':
+      return h('span', {style: {color: '#ff07f3'}}, 'Z')// (<span style="color: #ff07f3">Z</span>)
+    case '4':
+      return h('span', {style: {color: '#ff07f3'}}, 'Z')// (<span style="color:  #ff07f3">Z</span>)
+    case '5':
+      return h('span', {style: {color: 'red'}}, 'T')// (<span style="color: red">T</span>)
+    case '-1':
+      return h('span', {style: {color: '#00ffe0'}}, 'D') // (<span style="color: #00ffe0">D</span>)
+    default:
+      return 'warning'
+  }
 }
 
 const endDateStyle = (item) => {
-    if (item.endTimeTemp && item.$selected) {
-        return {
-            width: '140px',
-            color: 'white',
-            backgroundColor: 'red',
-            border: 0,
-        }
-    } else {
-        return {
-            width: '140px',
-            border: 0,
-        }
+  if (item.endTimeTemp && item.$selected) {
+    return {
+      width: '140px',
+      color: 'white',
+      backgroundColor: 'red',
+      border: 0,
+    }
+  } else {
+    return {
+      width: '140px',
+      border: 0,
     }
+  }
 }
 
 const rowClick = (data) => {
-    emits('rowClick', data)
+  emits('rowClick', data)
 }
 
 const rowClass = (data) => {
-    if (typeof twinkleList.value[data.actOrderNo] !== 'undefined') {
-        sleep(3000).then(() => {
-            delete twinkleList.value[data.actOrderNo]
-        })
-        return 'animation_hzfirst'
+  if (typeof twinkleList.value[data.actOrderNo] !== 'undefined') {
+    sleep(3000).then(() => {
+      delete twinkleList.value[data.actOrderNo]
+    })
+    return 'animation_hzfirst'
 
 
-    } else if (typeof twinkleList.value[data.parentNo] !== 'undefined') {
-        return 'animation_hzfirst'
-    }
+  } else if (typeof twinkleList.value[data.parentNo] !== 'undefined') {
+    return 'animation_hzfirst'
+  }
 
-    // 父级
-    if (data.associationFlag) {
-        return 'parent_level'
-    }
+  // 父级
+  if (data.associationFlag) {
+    return 'parent_level'
+  }
 
-    // 子级
-    if (associateOrders.value.actOrderNo === data.actOrderNo) {
-        return 'child_level'
-    }
+  // 子级
+  if (associateOrders.value.actOrderNo === data.actOrderNo) {
+    return 'child_level'
+  }
 
-    if (data.actOrderNo === yiZhuData.value.actOrderNo) {
-        return 'activation'
-    }
+  if (data.actOrderNo === yiZhuData.value.actOrderNo) {
+    return 'activation'
+  }
 }
 
 const setDefaultStopTime = async ({data, index}) => {
-    if (stringIsBlank(data.endTime) && stringIsBlank(data.parentNo) && data.frequCode !== 'ONCE') {
-        data.endTimeTemp = getFormatDatetime(await getServerDateApi(), 'YYYY-MM-DDTHH:mm')
-        clickSelected(true, data, index)
-    }
+  if (stringIsBlank(data.endTime) && stringIsBlank(data.parentNo) && data.frequCode !== 'ONCE') {
+    data.endTimeTemp = getFormatDatetime(await getServerDateApi(), 'YYYY-MM-DDTHH:mm')
+    clickSelected(true, data, index)
+  }
 }
 
 const cancelStopTime = (val, index) => {
-    if (val.parentNo) return
-    val.endTimeTemp = ''
-    clickSelected(false, val, index)
+  if (val.parentNo) return
+  val.endTimeTemp = ''
+  clickSelected(false, val, index)
 }
 
 const clickSelected = (isSelected, data, index) => {
-    tableRef.value.selectedRow(isSelected, data, index)
+  data.$selected = !data.$selected
 }
 
 const twinkleList = ref({})
 const scrollTo = (key) => {
-    twinkleList.value[key] = true
-    let index = tableRef.value.scrollToByKey(key)
-    if (index < 0) {
-        scrollToEnd()
-    }
+  twinkleList.value[key] = true
+  let index = tableRef.value.scrollToByKey(key)
+  if (index < 0) {
+    scrollToEnd()
+  }
 }
 
 const scrollToEnd = () => {
-    tableRef.value.scrollTo(tempYzData.value.length)
+  tableRef.value.scrollTo(tempYzData.value.length)
 }
 
 const mousePosition = ref()
 const opt = [
-    {
-        name: '医嘱费用', click: (data) => {
-            yzMitt.emit('queryFeeByOrderNo', data)
-        }
+  {
+    name: '医嘱费用', click: (data) => {
+      yzMitt.emit('queryFeeByOrderNo', data)
+    }
+  },
+  {
+    name: '复制', click: (data) => {
+      yzMitt.emit('copy', data.actOrderNo, data.frequCode)
     },
-    {
-        name: '复制', click: (data) => {
-            yzMitt.emit('copy', data.actOrderNo, data.frequCode)
-        },
-        icon: h(ElIcon, null, () => h(DocumentCopy))
+    icon: h(ElIcon, null, () => h(DocumentCopy))
+  },
+  {
+    name: '粘贴', click: (data) => {
+      yzMitt.emit('paste')
     },
-    {
-        name: '粘贴', click: (data) => {
-            yzMitt.emit('paste')
-        },
-        validator: () => {
-            return yzMitt.emit('allowReplication')
-        },
-        icon: h('i', {
-            class: 'iconfont icon-zhantie'
-        })
+    validator: () => {
+      return yzMitt.emit('allowReplication')
     },
-    {
-        name: '关联', click: (data, index) => {
-            emits('clickAssociate', data)
-        }
-    }, {
-        name: '退出关联', click: () => {
-            clearAssociate()
-        }
-    }, {
-        name: '说明书', click: (data) => {
-            if (data.groupNo !== '00') {
-                drugManual.value.open(data.orderCode, data.serial);
-            }
-        }
-    }, {
-        name: '停止医嘱', click: (data, index) => {
-            if (data.$selected) {
-                cancelStopTime({data, index})
-            } else {
-                setDefaultStopTime({data, index})
-            }
-        },
-        validator: (data) => {
-            return !data.parentNo;
-        }
-    }, {
-        name: '作废', click: (data) => {
-            emits('voidOrders', data)
-        }
+    icon: h('i', {
+      class: 'iconfont icon-zhantie'
+    })
+  },
+  {
+    name: '关联', click: (data, index) => {
+      emits('clickAssociate', data)
+    }
+  }, {
+    name: '退出关联', click: () => {
+      clearAssociate()
+    }
+  }, {
+    name: '说明书', click: (data) => {
+      if (data.groupNo !== '00') {
+        drugManual.value.open(data.orderCode, data.serial);
+      }
+    }
+  }, {
+    name: '停止医嘱', click: (data, index) => {
+      if (data.$selected) {
+        cancelStopTime({data, index})
+      } else {
+        setDefaultStopTime({data, index})
+      }
+    },
+    validator: (data) => {
+      return !data.parentNo;
+    }
+  }, {
+    name: '作废', click: (data) => {
+      emits('voidOrders', data)
     }
+  }
 ];
 
 const contextmenuItem = (data, index, event) => {
-    mousePosition.value = {
-        event,
-        data: data,
-        index
-    }
-}
-
-const getSelectedData = () => {
-    return tableRef.value.getSelectedData()
+  mousePosition.value = {
+    event,
+    data: data,
+    index
+  }
 }
 
 const clearSelected = () => {
-    tableRef.value.clearSelected()
+
 }
 
 const callTemplate = (list) => {
-    twinkleList.value = list
-    scrollToEnd()
+  twinkleList.value = list
+  scrollToEnd()
 }
 
 onMounted(() => {
-    yzMitt.on('tableScroll', (val) => {
-        tableRef.value.scrollTo(val)
-    })
+  yzMitt.on('tableScroll', (val) => {
+    tableRef.value.scrollTo(val)
+  })
+
+  yzMitt.on('clearSelected', () => {
+    tableRef.value.clearSelected()
+  })
+
+  yzMitt.on('scrollEndAndTwinkle', async (val) => {
+    twinkleList.value = val;
+    await nextTick()
+    scrollToEnd()
+  });
+
+  yzMitt.on('getSelectedData', () => {
+    return tableRef.value.getSelectedData()
+  })
 
-    yzMitt.on('clearSelected', () => {
-        clearSelected()
-    })
 
-    yzMitt.on('scrollEndAndTwinkle', async (val) => {
-        twinkleList.value = val;
-        await nextTick()
-        scrollToEnd()
-    });
 })
 
 watch(() => tempYzData.value.length, () => {
-    tableRef.value.scrollTo(0)
+  tableRef.value.scrollTo(0)
 })
 
 defineExpose({
-    scrollTo,
-    scrollToEnd,
-    getSelectedData,
-    clearSelected,
-    callTemplate
+  scrollTo,
+  scrollToEnd,
+  callTemplate
 })
 
 </script>

+ 332 - 329
src/views/hospitalization/zhu-yuan-yi-sheng/yi-zhu-lu-ru/YiZhuLuRu.vue

@@ -1,94 +1,94 @@
 <template>
-    <div style="margin: 0;height: 100%">
-        <yz-query-condition :patient-info="huanZheXinXi"
-                            @batchDeleteOrdersClick="batchDeleteOrdersClick"
-                            :add-yi-zhu-click="addYiZhuClick"
-                            :click-on-the-order-template="clickOnTheOrderTemplate"
-                            :confirm-orders-click="confirmOrdersClick"/>
-        <div>
-            <div style="height: 5px"/>
-            <button @click="orderTemplateClick" title="维护自己创建的模板">维护模板</button>
-            <button @click="orderTemplateClickCopy" title="维护自己创建的模板">选中医嘱做模板</button>
-            <el-divider direction="vertical"></el-divider>
-            <button @click="clickToStopTheOrder" title="选择了停止时间后记得选中医嘱在点击">批量停止</button>
-            <button :disabled="stringIsBlank(huanZheXinXi.inpatientNo)"
-                    @click="clickToModifyTheDoctorSOrderTime"
-                    title="跳转到修改医嘱时间的页面,可修改开始和停止时间">
-                修改医嘱时间
-            </button>
-            <button :disabled="stringIsBlank(huanZheXinXi.inpatientNo)"
-                    @click="jumpToMedicalRecord" title="跳转到患者的病案首页">
-                病案首页
-            </button>
-            <button @click="confirmAssociationClick" title="关联医嘱">关联</button>
-            <button @click="openRationalDrugUse" title="进入到合理用药的页面">合理用药</button>
-            <button @click="allergen.open()" title="患者过敏源信息维护">过敏源维护</button>
-            <blood-sugar :pat-no="huanZheXinXi.inpatientNo" :times="huanZheXinXi.admissTimes"/>
-            <report-of-infectious-diseases :pat-no="huanZheXinXi.inpatientNo"
-                                           :times="huanZheXinXi.admissTimes"
-                                           :ward="huanZheXinXi.admissWard"/>
-        </div>
-        <div style="height: 5px"/>
-        <yz-editor :patient-info="huanZheXinXi"
-                   ref="yzEditorRef"
-                   :open-group-order-template="openGroupOrderTemplate"
-                   @successfullyEntered="successfullyEntered"/>
-
-        <yz-table-v2 ref="tableRef"
-                     @void-orders="voidOrdersClick"
-                     @clickAssociate="clickAssociate"
-                     @rowClick="rowClick"/>
-
-        <doctor-s-order-fee :data="chargeDetails.data"
-                            v-if="chargeDetails.dialog"
-                            :sum="chargeDetails.sum"
-                            @close="chargeDetails.dialog = false"/>
-        <!--  获取模板的数据  -->
-        <huo-qu-mu-ban
-                ref="mubanRef"
-                :editor="false"
-                @muBanShuJu="muBanShuJu"/>
-
-        <xc-dialog v-model="stopOrderDialog.dialog" title="停止医嘱错误信息">
-            <div v-for="(value,key) in stopOrderDialog.error">
-                医嘱号: {{ key }} 序号: {{ getYzIndex(key) + 1 }}
-                <br>
-                {{ value }}
-            </div>
-        </xc-dialog>
-
-        <yao-ping-xiang-qing v-if="drugManual.dialog"
-                             :code="drugManual.code"
-                             @close="drugManual.dialog = false"/>
-
-        <!-- 这个是过敏源的 -->
-        <AllergenEntry v-if="allergen.dialog"
-                       :pat-no="huanZheXinXi.inpatientNo"
-                       @close="allergen.dialog = false"/>
-
-        <order-progress ref="orderProgressRef"/>
-
-        <!--  合理用药窗口  -->
-        <rational-drug-use-window ref="reasonableRef" @submit="confirmOrder"/>
-        <fee-table/>
+  <div style="margin: 0;height: 100%">
+    <yz-query-condition :patient-info="huanZheXinXi"
+                        @batchDeleteOrdersClick="batchDeleteOrdersClick"
+                        :add-yi-zhu-click="addYiZhuClick"
+                        :click-on-the-order-template="clickOnTheOrderTemplate"
+                        :confirm-orders-click="confirmOrdersClick"/>
+    <div>
+      <div style="height: 5px"/>
+      <button @click="orderTemplateClick" title="维护自己创建的模板">维护模板</button>
+      <button @click="orderTemplateClickCopy" title="维护自己创建的模板">选中医嘱做模板</button>
+      <el-divider direction="vertical"></el-divider>
+      <button @click="clickToStopTheOrder" title="选择了停止时间后记得选中医嘱在点击">批量停止</button>
+      <button :disabled="stringIsBlank(huanZheXinXi.inpatientNo)"
+              @click="clickToModifyTheDoctorSOrderTime"
+              title="跳转到修改医嘱时间的页面,可修改开始和停止时间">
+        修改医嘱时间
+      </button>
+      <button :disabled="stringIsBlank(huanZheXinXi.inpatientNo)"
+              @click="jumpToMedicalRecord" title="跳转到患者的病案首页">
+        病案首页
+      </button>
+      <button @click="confirmAssociationClick" title="关联医嘱">关联</button>
+      <button @click="openRationalDrugUse" title="进入到合理用药的页面">合理用药</button>
+      <button @click="allergen.open()" title="患者过敏源信息维护">过敏源维护</button>
+      <blood-sugar :pat-no="huanZheXinXi.inpatientNo" :times="huanZheXinXi.admissTimes"/>
+      <report-of-infectious-diseases :pat-no="huanZheXinXi.inpatientNo"
+                                     :times="huanZheXinXi.admissTimes"
+                                     :ward="huanZheXinXi.admissWard"/>
     </div>
+    <div style="height: 5px"/>
+    <yz-editor :patient-info="huanZheXinXi"
+               ref="yzEditorRef"
+               :open-group-order-template="openGroupOrderTemplate"
+               @successfullyEntered="successfullyEntered"/>
+
+    <yz-table-v2 ref="tableRef"
+                 @void-orders="voidOrdersClick"
+                 @clickAssociate="clickAssociate"
+                 @rowClick="rowClick"/>
+
+    <doctor-s-order-fee :data="chargeDetails.data"
+                        v-if="chargeDetails.dialog"
+                        :sum="chargeDetails.sum"
+                        @close="chargeDetails.dialog = false"/>
+    <!--  获取模板的数据  -->
+    <huo-qu-mu-ban
+        ref="mubanRef"
+        :editor="false"
+        @muBanShuJu="muBanShuJu"/>
+
+    <xc-dialog v-model="stopOrderDialog.dialog" title="停止医嘱错误信息">
+      <div v-for="(value,key) in stopOrderDialog.error">
+        医嘱号: {{ key }} 序号: {{ getYzIndex(key) + 1 }}
+        <br>
+        {{ value }}
+      </div>
+    </xc-dialog>
+
+    <yao-ping-xiang-qing v-if="drugManual.dialog"
+                         :code="drugManual.code"
+                         @close="drugManual.dialog = false"/>
+
+    <!-- 这个是过敏源的 -->
+    <AllergenEntry v-if="allergen.dialog"
+                   :pat-no="huanZheXinXi.inpatientNo"
+                   @close="allergen.dialog = false"/>
+
+    <order-progress ref="orderProgressRef"/>
+
+    <!--  合理用药窗口  -->
+    <rational-drug-use-window ref="reasonableRef" @submit="confirmOrder"/>
+    <fee-table/>
+  </div>
 </template>
 
 <script name="YiZhuLuRuZhuJian" setup>
 import {
-    associateOrdersApi, deleteMultipleOrders, huoQuYiZhuShuJu,
-    insertTemplateOrder,
-    stopOrder, voidOrders,
+  associateOrdersApi, deleteMultipleOrders, huoQuYiZhuShuJu,
+  insertTemplateOrder,
+  stopOrder, voidOrders,
 } from '@/api/zhu-yuan-yi-sheng/yi-zhu-lu-ru'
 import {
-    huanZheXinXi,
-    getYzIndex,
-    zkList,
-    queryParam,
-    clickOnThePatient,
-    drugManual,
-    associateOrders,
-    clearAssociate, youWuXuanZheHuanZhe, yzData, errorMsg, yzMitt
+  huanZheXinXi,
+  getYzIndex,
+  zkList,
+  queryParam,
+  clickOnThePatient,
+  drugManual,
+  associateOrders,
+  clearAssociate, youWuXuanZheHuanZhe, yzData, errorMsg, yzMitt
 } from '../public-js/zhu-yuan-yi-sheng'
 import store from '@/store'
 import {listIsBlank, stringIsBlank, stringNotBlank} from '@/utils/blank-utils'
@@ -108,26 +108,26 @@ import AllergenEntry from "@/components/zhu-yuan-yi-sheng/AllergenEntry.vue";
 import OrderProgress from "@/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/OrderProgress.vue";
 import RationalDrugUseWindow from "@/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/RationalDrugUseWindow.vue";
 import ReportOfInfectiousDiseases
-    from "@/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/report-of-infectious-diseases/ReportOfInfectiousDiseases.vue";
+  from "@/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/report-of-infectious-diseases/ReportOfInfectiousDiseases.vue";
 import YzTableV2 from "@/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/table/YzTableV2.vue";
 import {clone} from "@/utils/clone";
 import BloodSugar from "@/views/hospitalization/zhu-yuan-yi-sheng/yi-zhu-lu-ru/components/BloodSugar.vue";
 import FeeTable from "@/views/hospitalization/zhu-yuan-yi-sheng/yi-zhu-lu-ru/components/FeeTable.vue";
 
 const windowSize = computed(() => {
-    return store.state.app.windowSize
+  return store.state.app.windowSize
 })
 
 const user = computed(() => {
-    return store.state.user.info
+  return store.state.user.info
 })
 
 let allergen = $ref({
-    dialog: false,
-    open: () => {
-        if (youWuXuanZheHuanZhe()) return
-        allergen.dialog = true
-    }
+  dialog: false,
+  open: () => {
+    if (youWuXuanZheHuanZhe()) return
+    allergen.dialog = true
+  }
 })
 
 // 医嘱进度
@@ -136,23 +136,23 @@ const orderProgressRef = ref(null)
 // 医嘱编辑
 const yzEditorRef = ref(null)
 const successfullyEntered = async (data) => {
-    queryParam.value.displayRange = 0
-    queryParam.value.zhuangTai = 0
-    yzData.value = await huoQuYiZhuShuJu({
-        patNo: huanZheXinXi.value.inpatientNo,
-        times: huanZheXinXi.value.admissTimes
-    })
-    yzMitt.emit('clearSelected')
-    if (data != null) {
-        tableRef.value.scrollTo(data.actOrderNo.toString())
-    }
-    addYiZhuClick()
+  queryParam.value.displayRange = 0
+  queryParam.value.zhuangTai = 0
+  yzData.value = await huoQuYiZhuShuJu({
+    patNo: huanZheXinXi.value.inpatientNo,
+    times: huanZheXinXi.value.admissTimes
+  })
+  yzMitt.emit('clearSelected')
+  if (data != null) {
+    tableRef.value.scrollTo(data.actOrderNo.toString())
+  }
+  addYiZhuClick()
 }
 /**
  * 下面这里是添加医嘱了
  */
 const addYiZhuClick = () => {
-    yzEditorRef.value.addOrderNo()
+  yzEditorRef.value.addOrderNo()
 }
 
 const reasonableRef = ref(null)
@@ -161,87 +161,87 @@ const reasonableRef = ref(null)
  * 确认医嘱 , 已经做过无患者的判断了
  */
 const confirmOrdersClick = async () => {
-    // 如果没有问题就可以直接确认医嘱了。
-    let temp = await reasonableRef.value.check(huanZheXinXi.value.inpatientNo, huanZheXinXi.value.admissTimes)
-    if (temp) {
-        await confirmOrder()
-    }
+  // 如果没有问题就可以直接确认医嘱了。
+  let temp = await reasonableRef.value.check(huanZheXinXi.value.inpatientNo, huanZheXinXi.value.admissTimes)
+  if (temp) {
+    await confirmOrder()
+  }
 }
 
 // 真正的向后台确认医嘱
 const confirmOrder = async () => {
-    // 确认医嘱
-    await yzEditorRef.value.confirmOrdersClick()
-    // 查询医嘱
-    await yzMitt.emit('queryYz');
+  // 确认医嘱
+  await yzEditorRef.value.confirmOrdersClick()
+  // 查询医嘱
+  await yzMitt.emit('queryYz');
 }
 
 const openRationalDrugUse = () => {
-    window.open('http://172.16.32.121:9097/index.html')
+  window.open('http://172.16.32.121:9097/index.html')
 }
 
 // 表格
 const tableRef = ref(null)
 const rowClick = (val) => {
-    orderProgressRef.value.fillOrder(val)
-    if (associateOrders.value.actOrderNo) {
-        let index = associateOrders.value.associatedGroup.indexOf(val.actOrderNo)
-        if (associateOrders.value.actOrderNo === val.actOrderNo) {
-            BizException(ExceptionEnum.MESSAGE_ERROR, '无法关联自己');
-        }
+  orderProgressRef.value.fillOrder(val)
+  if (associateOrders.value.actOrderNo) {
+    let index = associateOrders.value.associatedGroup.indexOf(val.actOrderNo)
+    if (associateOrders.value.actOrderNo === val.actOrderNo) {
+      BizException(ExceptionEnum.MESSAGE_ERROR, '无法关联自己');
+    }
 
-        if (val.orderCode !== '06054' && val.serial === '00') {
-            BizException(ExceptionEnum.MESSAGE_ERROR, '无法关联项目');
-        }
-        if (val.statusFlag !== '1') {
-            BizException(ExceptionEnum.MESSAGE_ERROR, '无法关联不是录入状态的医嘱。');
-        }
-        if (index > -1) {
-            val.associationFlag = false;
-            associateOrders.value.associatedGroup.splice(index, 1);
-        } else {
-            val.associationFlag = true;
-            associateOrders.value.associatedGroup.push(val.actOrderNo);
-        }
+    if (val.orderCode !== '06054' && val.serial === '00') {
+      BizException(ExceptionEnum.MESSAGE_ERROR, '无法关联项目');
+    }
+    if (val.statusFlag !== '1') {
+      BizException(ExceptionEnum.MESSAGE_ERROR, '无法关联不是录入状态的医嘱。');
+    }
+    if (index > -1) {
+      val.associationFlag = false;
+      associateOrders.value.associatedGroup.splice(index, 1);
     } else {
-        yzEditorRef.value.fillData(val)
+      val.associationFlag = true;
+      associateOrders.value.associatedGroup.push(val.actOrderNo);
     }
+  } else {
+    yzEditorRef.value.fillData(val)
+  }
 
 }
 
 const stopOrderDialog = ref({
-    dialog: false,
-    error: ''
+  dialog: false,
+  error: ''
 })
 
 /**
  * 停止医嘱
  */
 const clickToStopTheOrder = () => {
-    let tempData = tableRef.value.getSelectedData()
-    tempData.forEach(item => {
-        // 因为前端用的是浏览器自带的 所以要删除 T
-        item.endTime = getFormatDatetime(item.endTimeTemp)
-    })
-
-    let param = {
-        inpatientNo: huanZheXinXi.value.inpatientNo,
-        admissTimes: huanZheXinXi.value.admissTimes,
-        list: tempData
+  let tempData = yzMitt.emit('getSelectedData')
+  tempData.forEach(item => {
+    // 因为前端用的是浏览器自带的 所以要删除 T
+    item.endTime = getFormatDatetime(item.endTimeTemp)
+  })
+
+  let param = {
+    inpatientNo: huanZheXinXi.value.inpatientNo,
+    admissTimes: huanZheXinXi.value.admissTimes,
+    list: tempData
+  }
+  stopOrder(param).then(res => {
+    if (res?.error) {
+      stopOrderDialog.value.error = res.data
+      stopOrderDialog.value.dialog = true
+      for (let i = 0; i < tempData.length; i++) {
+        let item = tempData[i]
+        item.endTime = ''
+      }
+    } else {
+      stopOrderDialog.value.error = {}
+      yzMitt.emit('queryYz')
     }
-    stopOrder(param).then(res => {
-        if (res?.error) {
-            stopOrderDialog.value.error = res.data
-            stopOrderDialog.value.dialog = true
-            for (let i = 0; i < tempData.length; i++) {
-                let item = tempData[i]
-                item.endTime = ''
-            }
-        } else {
-            stopOrderDialog.value.error = {}
-            yzMitt.emit('queryYz')
-        }
-    })
+  })
 }
 
 
@@ -249,28 +249,28 @@ const clickToStopTheOrder = () => {
  * 作废医嘱
  */
 const voidOrdersClick = (val) => {
-    ElMessageBox.prompt(`请问是否要撤销<br><span style="color: red">【${val.orderName}】</span>医嘱<br>
+  ElMessageBox.prompt(`请问是否要撤销<br><span style="color: red">【${val.orderName}】</span>医嘱<br>
                         撤销父医嘱会自动撤销子医嘱。`, '提示', {
-        type: 'warning',
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        inputValidator: (val) => {
-            val = val.trim()
-            if (val === null || val.length < 1 || val.length > 50) {
-                return false;
-            }
-        },
-        dangerouslyUseHTMLString: true,
-        inputErrorMessage: '作废原因,不能为空,最多可输入50个字符。',
-        closeOnPressEscape: false,
-        closeOnClickModal: false
-    }).then(({value}) => {
-        voidOrders(val.id, value).then(res => {
-            yzMitt.emit('queryYz')
-        })
-    }).catch(() => {
-
+    type: 'warning',
+    confirmButtonText: '确定',
+    cancelButtonText: '取消',
+    inputValidator: (val) => {
+      val = val.trim()
+      if (val === null || val.length < 1 || val.length > 50) {
+        return false;
+      }
+    },
+    dangerouslyUseHTMLString: true,
+    inputErrorMessage: '作废原因,不能为空,最多可输入50个字符。',
+    closeOnPressEscape: false,
+    closeOnClickModal: false
+  }).then(({value}) => {
+    voidOrders(val.id, value).then(res => {
+      yzMitt.emit('queryYz')
     })
+  }).catch(() => {
+
+  })
 }
 
 
@@ -279,78 +279,78 @@ const voidOrdersClick = (val) => {
  * @param val
  */
 let doctorSOrderFee = $ref({
-    data: {},
-    problem: {},
-    totalCost: {}
+  data: {},
+  problem: {},
+  totalCost: {}
 })
 let chargeDetails = $ref({
-    dialog: false,
-    data: [],
-    sum: {}
+  dialog: false,
+  data: [],
+  sum: {}
 })
 
 const clickToViewTheDoctorSOrderFee = (val) => {
-    chargeDetails.data = doctorSOrderFee.data[val.actOrderNoStr]
-    if (chargeDetails.data) {
-        chargeDetails.sum = doctorSOrderFee.totalCost[val.actOrderNoStr]
-        chargeDetails.dialog = true
-    } else {
-        BizException(ExceptionEnum.MESSAGE_ERROR, '该医嘱还没有产生费用')
-    }
+  chargeDetails.data = doctorSOrderFee.data[val.actOrderNoStr]
+  if (chargeDetails.data) {
+    chargeDetails.sum = doctorSOrderFee.totalCost[val.actOrderNoStr]
+    chargeDetails.dialog = true
+  } else {
+    BizException(ExceptionEnum.MESSAGE_ERROR, '该医嘱还没有产生费用')
+  }
 }
 
 // 获取模板
 const mubanRef = ref(null)
 const clickOnTheOrderTemplate = () => {
-    if (stringIsBlank(huanZheXinXi.value.inpatientNo)) {
-        BizException(ExceptionEnum.MESSAGE_ERROR, '请先选择患者')
-    }
-    mubanRef.value.openOrCloseDialog(true)
+  if (stringIsBlank(huanZheXinXi.value.inpatientNo)) {
+    BizException(ExceptionEnum.MESSAGE_ERROR, '请先选择患者')
+  }
+  mubanRef.value.openOrCloseDialog(true)
 }
 /**
  * 把模板的数据插入到患者的医嘱表
  * @param val
  */
 const muBanShuJu = (val) => {
-    let tempGroupNo = ['71', '73']
-    if (queryParam.value.frequCode === 'takeMedicine') {
-        val = val.filter((item) => {
-            item.selfBuy = '4'
-            if (stringIsBlank(item.instruction)) {
-                item.instruction = item.frequCodeName;
-            }
-            item.supplyCode = '007'
-            item.frequCode = 'ONCE'
-            return item.serial !== '00'
-        })
-        if (val.length === 0) {
-            BizException(ExceptionEnum.LOGICAL_ERROR, '项目无法出院带药。')
-        }
-    }
-    val.forEach(item => {
-        if (item.serial === '00') {
-            item.groupNo = '00'
-        } else {
-            if (!tempGroupNo.includes(item.groupNo)) {
-                item.groupNo = queryParam.value.groupNo;
-            }
-        }
+  let tempGroupNo = ['71', '73']
+  if (queryParam.value.frequCode === 'takeMedicine') {
+    val = val.filter((item) => {
+      item.selfBuy = '4'
+      if (stringIsBlank(item.instruction)) {
+        item.instruction = item.frequCodeName;
+      }
+      item.supplyCode = '007'
+      item.frequCode = 'ONCE'
+      return item.serial !== '00'
     })
-    let param = {
-        inpatientNo: huanZheXinXi.value.inpatientNo,
-        admissTimes: huanZheXinXi.value.admissTimes,
-        groupNo: queryParam.value.groupNo,
-        list: val
+    if (val.length === 0) {
+      BizException(ExceptionEnum.LOGICAL_ERROR, '项目无法出院带药。')
     }
-    insertTemplateOrder(param).then(async (list) => {
-        mubanRef.value.openOrCloseDialog(false)
-        await successfullyEntered()
-        let data = {}
-        list.forEach(item => {
-            data[item] = true
-        })
-        tableRef.value.callTemplate(data)
+  }
+  val.forEach(item => {
+    if (item.serial === '00') {
+      item.groupNo = '00'
+    } else {
+      if (!tempGroupNo.includes(item.groupNo)) {
+        item.groupNo = queryParam.value.groupNo;
+      }
+    }
+  })
+  let param = {
+    inpatientNo: huanZheXinXi.value.inpatientNo,
+    admissTimes: huanZheXinXi.value.admissTimes,
+    groupNo: queryParam.value.groupNo,
+    list: val
+  }
+  insertTemplateOrder(param).then(async (list) => {
+    mubanRef.value.openOrCloseDialog(false)
+    await successfullyEntered()
+    let data = {}
+    list.forEach(item => {
+      data[item] = true
     })
+    tableRef.value.callTemplate(data)
+  })
 }
 
 /**
@@ -359,9 +359,9 @@ const muBanShuJu = (val) => {
  * @returns {Promise<void>}
  */
 const openGroupOrderTemplate = async (code) => {
-    mubanRef.value.openOrCloseDialog(true)
-    await nextTick()
-    mubanRef.value.openTemplateByCode(code)
+  mubanRef.value.openOrCloseDialog(true)
+  await nextTick()
+  mubanRef.value.openTemplateByCode(code)
 }
 
 
@@ -369,141 +369,144 @@ const openGroupOrderTemplate = async (code) => {
  * 添加模板
  */
 const orderTemplateClick = () => {
-    router.push({
-        name: 'orderTemplateMaintenance',
-    })
+  router.push({
+    name: 'orderTemplateMaintenance',
+  })
 }
 
 const orderTemplateClickCopy = () => {
-    let temp = clone(tableRef.value.getSelectedData())
-    if (listIsBlank(temp)) {
-        xcMessage.error('请先选中医嘱。')
-        return
-    }
-    let dept = {
-        code: huanZheXinXi.value.zkWard,
-        name: huanZheXinXi.value.zkWardName
+  let temp = clone(yzMitt.emit('getSelectedData'))
+  if (listIsBlank(temp)) {
+    xcMessage.error('请先选中医嘱。')
+    return
+  }
+  let dept = {
+    code: huanZheXinXi.value.zkWard,
+    name: huanZheXinXi.value.zkWardName
+  }
+  router.push({
+    name: 'orderTemplateMaintenance',
+    params: {
+      data: JSON.stringify(temp),
+      dept: JSON.stringify(dept)
     }
-    router.push({
-        name: 'orderTemplateMaintenance',
-        params: {
-            data: JSON.stringify(temp),
-            dept: JSON.stringify(dept)
-        }
-    })
+  })
 }
 
 onMounted(async () => {
-    await sleep(200)
-    zkList.value = await getTheTransferList()
+  await sleep(200)
+  zkList.value = await getTheTransferList()
 })
 
 
 // 点击修改医嘱时间
 const clickToModifyTheDoctorSOrderTime = () => {
-    router.push({
-        name: 'yzActOrderModify',
-        query: {
-            patNo: huanZheXinXi.value.inpatientNo,
-        },
-    })
+  router.push({
+    name: 'yzActOrderModify',
+    query: {
+      patNo: huanZheXinXi.value.inpatientNo,
+    },
+  })
 }
 
 // 跳转到病案首页
 const jumpToMedicalRecord = () => {
-    router.push({
-        name: 'fillCaseFrontSheet',
-        query: {
-            patNo: huanZheXinXi.value.inpatientNo,
-            deptCode: huanZheXinXi.value.smallDept,
-        },
-    })
+  router.push({
+    name: 'fillCaseFrontSheet',
+    query: {
+      patNo: huanZheXinXi.value.inpatientNo,
+      deptCode: huanZheXinXi.value.smallDept,
+    },
+  })
 }
 
 // 点击关联
 const clickAssociate = async (data) => {
-    if (stringNotBlank(data.parentNo)) {
-        xcMessage.error('该医嘱已经有父医嘱了。');
-    } else if (data.statusFlag !== '1') {
-        xcMessage.error('不是录入状态的医嘱无法关联。');
-    } else if (data.serial === '00') {
-        xcMessage.error('项目无法关联。');
+  if (stringNotBlank(data.parentNo)) {
+    xcMessage.error('该医嘱已经有父医嘱了。');
+  } else if (data.statusFlag !== '1') {
+    xcMessage.error('不是录入状态的医嘱无法关联。');
+  } else if (data.serial === '00') {
+    xcMessage.error('项目无法关联。');
+  } else {
+    if (associateOrders.value.actOrderNo === null) {
+      await yzMitt.emit('queryYz')
+      associateOrders.value.actOrderNo = data.actOrderNo
     } else {
-        if (associateOrders.value.actOrderNo === null) {
-            await yzMitt.emit('queryYz')
-            associateOrders.value.actOrderNo = data.actOrderNo
-        } else {
-            xcMessage.error('请先确认当前关联医嘱。')
-        }
+      xcMessage.error('请先确认当前关联医嘱。')
     }
+  }
 }
 
 // 点击确认关联
 const confirmAssociationClick = () => {
-    if (associateOrders.value.actOrderNo === null) {
-        BizException(ExceptionEnum.MESSAGE_ERROR, '请先选择需要关联的父医嘱')
-    }
-    if (associateOrders.value.associatedGroup.length === 0) {
-        BizException(ExceptionEnum.MESSAGE_ERROR, '至少选择一个子医嘱')
-    }
-    ElMessageBox.confirm('请确认是否要关联这些医嘱。', '提示', {
-        type: 'warning'
-    }).then(() => {
-        associateOrdersApi(associateOrders.value).then((res) => {
-            clearAssociate()
-            yzMitt.emit('queryYz')
-        })
-    }).catch(() => {
+  if (associateOrders.value.actOrderNo === null) {
+    BizException(ExceptionEnum.MESSAGE_ERROR, '请先选择需要关联的父医嘱')
+  }
+  if (associateOrders.value.associatedGroup.length === 0) {
+    BizException(ExceptionEnum.MESSAGE_ERROR, '至少选择一个子医嘱')
+  }
+  ElMessageBox.confirm('请确认是否要关联这些医嘱。', '提示', {
+    type: 'warning'
+  }).then(() => {
+    associateOrdersApi(associateOrders.value).then((res) => {
+      clearAssociate()
+      yzMitt.emit('queryYz')
     })
+  }).catch(() => {
+  })
 }
 
 /**
  * 点击批量删除数据
  */
 const batchDeleteOrdersClick = () => {
-    let tempData = tableRef.value.getSelectedData()
-    if (tempData.length === 0) {
-        BizException(ExceptionEnum.LOGICAL_ERROR, "请先选择要删除的数据");
+
+  let tempData = yzMitt.emit('getSelectedData')
+
+  if (tempData.length === 0) {
+    BizException(ExceptionEnum.LOGICAL_ERROR, "请先选择要删除的数据");
+  }
+
+  ElMessageBox.confirm('是否要批量删除这些医嘱?', '提示', {
+    type: 'warning'
+  }).then(() => {
+    let param = {
+      inpatientNo: huanZheXinXi.value.inpatientNo,
+      admissTimes: huanZheXinXi.value.admissTimes,
+      list: tempData
     }
-    ElMessageBox.confirm('是否要批量删除这些医嘱?', '提示', {
-        type: 'warning'
-    }).then(() => {
-        let param = {
-            inpatientNo: huanZheXinXi.value.inpatientNo,
-            admissTimes: huanZheXinXi.value.admissTimes,
-            list: tempData
+    deleteMultipleOrders(param).then((res) => {
+      if (res !== null && res.error) {
+        let errData = []
+        for (const key in res.data) {
+          let index = getYzIndex(key)
+          let tempYzData = yzData.value[index]
+          yzData.value[index].error = true
+          errData.push({
+            actOrderNo: key,
+            orderName: tempYzData.orderName,
+            errorMessage: res.data[key]
+          })
         }
-        deleteMultipleOrders(param).then((res) => {
-            if (res !== null && res.error) {
-                let errData = []
-                for (const key in res.data) {
-                    let index = getYzIndex(key)
-                    let tempYzData = yzData.value[index]
-                    yzData.value[index].error = true
-                    errData.push({
-                        actOrderNo: key,
-                        orderName: tempYzData.orderName,
-                        errorMessage: res.data[key]
-                    })
-                }
-                errorMsg.value.dialog = true
-                errorMsg.value.type = 2
-                errorMsg.value.data = errData
-            } else {
-                yzMitt.emit('queryYz', false)
-            }
-        })
-    }).catch(() => {
+        errorMsg.value.dialog = true
+        errorMsg.value.type = 2
+        errorMsg.value.data = errData
+      } else {
+        yzMitt.emit('queryYz', false)
+      }
     })
+  }).catch(() => {
+  })
 }
 
 
 onActivated(async () => {
-    if (router.currentRoute.value.params.inpatientNo) {
-        await nextTick()
-        await clickOnThePatient(router.currentRoute.value.params.inpatientNo);
-        await yzMitt.emit('queryYz')
-    }
+  if (router.currentRoute.value.params.inpatientNo) {
+    await nextTick()
+    await clickOnThePatient(router.currentRoute.value.params.inpatientNo);
+    await yzMitt.emit('queryYz')
+  }
 })