xiaochan 1 year ago
parent
commit
11135d2340

+ 10 - 2
src/css/vxe-table-modify.scss

@@ -1,7 +1,14 @@
 .vxe-table {
-  --vxe-font-color: #000
+  --vxe-font-color: #000;
+  --vxe-table-row-current-background-color: #409EFF;
+  --vxe-table-row-hover-background-color: #409EFF;
+
+  .row--hover {
+    background-color: var(--vxe-table-row-hover-background-color) !important;
+  }
 }
 
+
 .vxe-header-max_content {
   .vxe-table--header {
     tr th {
@@ -57,4 +64,5 @@
   cursor: pointer;
   border-radius: 5px;
   user-select: none;
-}
+}
+

+ 3 - 0
src/utils/blank-utils.js

@@ -1,3 +1,5 @@
+import XEUtils from 'xe-utils';
+
 export function stringIsBlank(val) {
     try {
         val = val.trim()
@@ -11,6 +13,7 @@ export const stringNotBlank = (val) => !stringIsBlank(val)
 
 
 export function listIsBlank(val) {
+    if (!XEUtils.isArray(val)) return true
     return typeof val === 'undefined' || val === null || val.length === 0
 }
 

+ 13 - 1
src/utils/cy-use/useVxeTable.tsx

@@ -14,6 +14,7 @@ import {IsCyDialog} from "@/components/cy/dialog/src/useCyDialog";
 import CyFlex from "@/components/cy/flex/src/CyFlex.vue";
 import {tsxVModel} from "@/utils/cy-use/useTsxUtils";
 import {isDev} from "@/utils/public";
+import {useElementVisibility} from '@vueuse/core'
 
 export declare type PageQuery = {
     currentPage?: number,
@@ -143,7 +144,7 @@ function useVxeTable<D>(simplifiedConfiguration: SimplifiedConfiguration<D> = {}
         }
     }
 
-    watch(() => props.currentKey, () => {
+    function handleFindKeyScrolling() {
         if (stringNotBlank(defaultProps.value.rowConfig?.keyField)) {
             const findData = XEUtils.find(tableRef.value?.getData(), (item) => {
                 // @ts-ignore
@@ -154,8 +155,19 @@ function useVxeTable<D>(simplifiedConfiguration: SimplifiedConfiguration<D> = {}
                 tableRef.value?.setCurrentRow(findData)
             }
         }
+    }
+
+    watch(() => props.currentKey, () => {
+        handleFindKeyScrolling()
     }, {flush: 'post'})
 
+    const targetIsVisible = useElementVisibility(tableRef)
+
+    watch(() => targetIsVisible.value, (val) => {
+        val && handleFindKeyScrolling()
+    }, {flush: 'post'})
+
+
     const defaultProps = computed(() => {
         return {
             ...simplifiedConfiguration?.tableProps,

+ 2 - 4
src/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng.ts

@@ -242,7 +242,6 @@ export interface YzType {
     execDept: string
     execDeptName: string
 }
-
 export interface SearchOrdersType {
     id: string;
     pyCode: string;
@@ -289,7 +288,6 @@ export interface SearchOrdersType {
     drugFlagName: string;
     infusionFlagName: string;
 }
-
 // 医嘱数据
 export const yiZhuData = ref<YzType>({
     actOrderNo: addTempOrderNo,
@@ -451,7 +449,7 @@ export const yiZhuDataInit = (clearOrderNo: boolean = true): void => {
     }
 }
 // 保存医嘱数据
-export const yzData = ref<Array<YzType>>([])
+export const yzData = ref<YzType[]>([])
 
 export const jsQueryYzData = async () => {
     if (stringNotBlank(huanZheXinXi.value.inpatientNo)) {
@@ -540,7 +538,7 @@ export function yzDataToTree(data: YzType[]): YzType[] {
     // 判断 noParent 不为空
     if (noParent.size > 0) {
         // 把 noParent 的 value 全部放到 tree 数组中
-        let a = Array.from(noParent.values());
+        const a = Array.from(noParent.values());
         tree.push(...a)
     }
 

+ 0 - 9
src/views/hospitalization/zhu-yuan-yi-sheng/yi-zhu-lu-ru/components/table/YzTableV3.vue

@@ -24,15 +24,6 @@ import {xcMessage} from "@/utils/xiaochan-element-plus";
 import XEUtils from "xe-utils";
 import {TablePublicMethods} from "vxe-table/types/table";
 
-const props = defineProps({
-  height: {
-    type: [Number]
-  },
-  width: {
-    type: [Number]
-  }
-})
-
 const emits = defineEmits(['rowClick', 'voidOrders'])
 
 const tableRef = ref<TablePublicMethods>()