浏览代码

no message

xiaochan 1 年之前
父节点
当前提交
e715821ea2

+ 0 - 53
src/components/cy/auto-popover/src/cy-auto-popover.vue

@@ -1,53 +0,0 @@
-<script setup lang="ts">
-import {nextTick, onMounted, ref, unref, useSlots} from "vue";
-import {onClickOutside} from '@vueuse/core'
-
-const visible = ref(false)
-
-const referenceRef = ref<HTMLDivElement>()
-const mainDivRef = ref<HTMLDivElement>()
-
-onClickOutside(mainDivRef, event => {
-  // @ts-ignore
-  if (referenceRef.value.contains(event.target)) {
-    return
-  }
-  visible.value = false
-})
-
-async function show() {
-  visible.value = true
-  await nextTick()
-}
-
-function test() {
-  console.log(123)
-}
-
-onMounted(() => {
-
-})
-
-defineExpose({
-  show
-})
-</script>
-
-<template>
-  <el-popover :visible="visible" :width="0">
-    <template #reference>
-      <div class="display_inline-block" ref="referenceRef">
-        <slot name="reference"/>
-      </div>
-    </template>
-    <div class="display_inline-block" ref="mainDivRef">
-      <slot/>
-    </div>
-  </el-popover>
-</template>
-
-<style lang="scss">
-.display_inline-block {
-  display: inline-block;
-}
-</style>

+ 35 - 57
src/components/zhu-yuan-yi-sheng/emr/auxiliary-tools/EmrInspect.vue

@@ -19,44 +19,41 @@
         </CyVxeTable>
       </CyFlex>
     </template>
-
-    <div class="main-class">
-      <el-form>
-        <el-form-item label="检查项目:">
-          {{ rowData.orderName }}
-        </el-form-item>
-        <el-form-item label="检查所见:">
-          <el-input type="textarea" rows="15" readonly v-model="rowData.examinationSee"/>
-        </el-form-item>
-        <el-form-item label="诊断意见:">
-          <el-input type="textarea" rows="5" readonly v-model="rowData.examinationreSult"/>
-        </el-form-item>
-        <el-form-item label="报告医生:">
-          {{ rowData?.doctorName }}
-        </el-form-item>
-        <el-form-item label="报告时间:">
-          {{ rowData?.reportTime }}
-        </el-form-item>
-        <el-form-item label="检查医生:">
-          {{ rowData?.checkDoctorName }}
-        </el-form-item>
-        <el-form-item label="检查时间:">
-          {{ rowData?.checkTime }}
-        </el-form-item>
-        <el-form-item label="">
-          <div style="text-align: right;width: 100%">
-            <el-button type="primary"
-                       @click="copyClick">
-              复制
-            </el-button>
-            <el-button type="warning"
-                       @click="copyAndPasteClick">
-              复制并粘贴
-            </el-button>
-          </div>
-        </el-form-item>
-      </el-form>
-    </div>
+    <el-form>
+      <el-form-item label="检查项目:">
+        {{ rowData.orderName }}
+      </el-form-item>
+      <el-form-item label="检查所见:">
+        <el-input type="textarea" rows="15" readonly v-model="rowData.examinationSee"/>
+      </el-form-item>
+      <el-form-item label="诊断意见:">
+        <el-input type="textarea" rows="5" readonly v-model="rowData.examinationreSult"/>
+      </el-form-item>
+      <el-form-item label="报告医生:">
+        {{ rowData?.doctorName }}
+      </el-form-item>
+      <el-form-item label="报告时间:">
+        {{ rowData?.reportTime }}
+      </el-form-item>
+      <el-form-item label="检查医生:">
+        {{ rowData?.checkDoctorName }}
+      </el-form-item>
+      <el-form-item label="检查时间:">
+        {{ rowData?.checkTime }}
+      </el-form-item>
+      <el-form-item label="">
+        <div style="text-align: right;width: 100%">
+          <el-button type="primary"
+                     @click="copyClick">
+            复制
+          </el-button>
+          <el-button type="warning"
+                     @click="copyAndPasteClick">
+            复制并粘贴
+          </el-button>
+        </div>
+      </el-form-item>
+    </el-form>
   </CyFlex>
 </template>
 
@@ -122,7 +119,6 @@ const {CyVxeTable, querySearch} = useVxeTable<JcType>({
   }
 })
 
-
 const orderType = {
   'type_08': 'CT检查结果',
   'type_26': '磁共振检查结果'
@@ -160,22 +156,4 @@ function copyAndPasteClick() {
   })
   emits('close')
 }
-
-
 </script>
-
-<style scoped lang="scss">
-.main {
-  display: flex;
-  width: 100%;
-  height: 95%;
-}
-
-.side-class {
-  width: 400px;
-}
-
-.main-class {
-  flex: 1;
-}
-</style>

+ 21 - 17
src/utils/cy-use/useDateRange.tsx

@@ -1,8 +1,8 @@
-//@ts-nocheck
 import {ElDatePicker} from "element-plus";
-import {ref, Ref} from 'vue'
+import {ref, Ref, watch} from 'vue'
 import {currentAndAFewDaysAgo, elDateRangeAddTime} from "@/utils/moment-utils";
 import moment from 'moment'
+import {tsxVModel} from "@/utils/cy-use/useTsxUtils";
 
 const shortcuts = [
     {
@@ -46,21 +46,29 @@ interface ElDatePickerType {
     aFewDaysAgo?: number,
 }
 
+
 export default function useDateRange(props?: ElDatePickerType) {
+    props = {
+        clearable: true,
+        defaultValue: null,
+        teleported: false,
+        aFewDaysAgo: null,
+        ...props
+    }
+
     const modelValue: Ref<any[]> = ref([])
     const dateRange = ref({})
 
-    function handelChangeDate(value) {
-        modelValue.value = value
-        dateRange.value = elDateRangeAddTime(value)
-    }
+    watch(() => modelValue.value, () => {
+        dateRange.value = elDateRangeAddTime(modelValue.value)
+    })
 
-    if (typeof props?.aFewDaysAgo !== undefined) {
+    if (props.aFewDaysAgo !== null) {
         currentAndAFewDaysAgo(props?.aFewDaysAgo).then(res => {
-            handelChangeDate(res)
+            modelValue.value = res
         })
     }
-    
+
     function CyDateRange(dateProps) {
         return (<div style="display: inline-flex;vertical-align: middle;width:220px">
             <ElDatePicker
@@ -70,22 +78,18 @@ export default function useDateRange(props?: ElDatePickerType) {
                 end-placeholder={'结束日期'}
                 shortcuts={shortcuts}
                 // @ts-ignore
-                modelValue={modelValue.value}
                 type={'daterange'}
-                onUpdate:modelValue={(el) => {
-                    handelChangeDate(el)
-
-                }}
                 {...props}
                 {...dateProps}
-            >
-            </ElDatePicker>
+                {...tsxVModel(modelValue)}
+            />
         </div>)
     }
 
     return {
         CyDateRange,
-        dateRange
+        dateRange,
+        changeDateRange: (value: string[]) => modelValue.value = value
     }
 }
 

+ 77 - 36
src/utils/cy-use/useVxeTable.tsx

@@ -12,7 +12,7 @@ import setDialogToJs from "@/components/js-dialog-comp/useDialogToJs";
 import CyDialog from "@/components/cy/dialog/src/CyDialog.vue";
 import {IsCyDialog} from "@/components/cy/dialog/src/useCyDialog";
 import CyFlex from "@/components/cy/flex/src/CyFlex.vue";
-import {tsxTemplate, tsxVModel} from "@/utils/cy-use/useTsxUtils";
+import {tsxVModel} from "@/utils/cy-use/useTsxUtils";
 
 declare type PageQuery = {
     currentPage?: number,
@@ -37,11 +37,21 @@ declare type SimplifiedConfiguration<D> = {
     showCheckbox?: boolean,
     mountedQuery?: boolean,
     dialogProps?: IsCyDialog,
-    dialogHeader?: () => any
+    dialogHeader?: () => any,
+    getQueryParams?: () => any,
 }
 
 
-function useVxeTable<D = any>(simplifiedConfiguration: SimplifiedConfiguration<D>) {
+function useVxeTable<D>(simplifiedConfiguration: SimplifiedConfiguration<D> = {}) {
+    simplifiedConfiguration = {
+        rowHeight: 48,
+        keyField: '',
+        showPage: false,
+        mountedQuery: false,
+        result: 'result',
+        total: 'total',
+        ...simplifiedConfiguration
+    }
     const tableRef: Ref<TablePublicMethods<D> & TableExportMethods<D> | undefined> = ref()
     const props: VxeTableProps<D> & VxeTableEventProps<D> & SimplifiedConfiguration<D> = reactive({
         height: 'auto',
@@ -50,9 +60,9 @@ function useVxeTable<D = any>(simplifiedConfiguration: SimplifiedConfiguration<D
         rowConfig: {
             isHover: true,
             isCurrent: true,
-            height: simplifiedConfiguration?.rowHeight || 48,
+            height: simplifiedConfiguration?.rowHeight,
             useKey: true,
-            keyField: simplifiedConfiguration?.keyField || '',
+            keyField: simplifiedConfiguration?.keyField,
         },
         stripe: true,
         scrollY: {
@@ -88,10 +98,18 @@ function useVxeTable<D = any>(simplifiedConfiguration: SimplifiedConfiguration<D
         delete props.rowConfig?.height
         props.scrollY!.enabled = false
         props!.showOverflow = false
-        props!.checkboxConfig!.reserve = true
-        if (stringIsBlank(props.rowConfig?.keyField)) {
+
+        if (stringIsBlank(simplifiedConfiguration.keyField)) {
             BizException(ExceptionEnum.MESSAGE_ERROR, '请先设置行id')
         }
+
+        if (!XEUtils.isFunction(simplifiedConfiguration.remoteSearch)) {
+            console.error('请设置remoteSearch函数')
+        }
+
+        if (!XEUtils.isFunction(simplifiedConfiguration.getQueryParams)) {
+            console.error('请设置 getQueryParams  函数')
+        }
     }
 
     const pageVO = reactive({
@@ -126,8 +144,17 @@ function useVxeTable<D = any>(simplifiedConfiguration: SimplifiedConfiguration<D
 
     const CyVxeTable = (props: VxeTableProps<D>, {slots}: any) => {
 
-        mutation.setTableDefaultSlots = () => {
-            return slots.default ? slots.default() : null
+        function getSlotsByName(name: string) {
+            return slots[name] ? slots[name]() : null
+        }
+
+
+        mutation.getTableDefaultSlots = () => {
+            return getSlotsByName('default')
+        }
+
+        mutation.getDialogHeaderSlots = () => {
+            return getSlotsByName('dialogHeader')
         }
 
         const TempVxeTable = () => {
@@ -156,14 +183,19 @@ function useVxeTable<D = any>(simplifiedConfiguration: SimplifiedConfiguration<D
                             return <ElPopover placement="right">
                                 {{
                                     default: () => {
+                                        const size = simplifiedConfiguration.showPage ? pageMemory.size : getCheckboxRecords().length
+
                                         return [
-                                            `当前选中${pageMemory.size}条`,
+                                            `当前选中${size}条`,
                                             <div style="text-align: right;margin-top: 5px;">
                                                 <ElButton
                                                     type="primary"
                                                     onClick={(el) => {
-                                                        if (pageMemory.size > 0)
+                                                        if (simplifiedConfiguration.showPage && pageMemory.size > 0) {
+                                                            handelLookCheckBox()
+                                                        } else if (size > 0) {
                                                             handelLookCheckBox()
+                                                        }
                                                     }}
                                                 >{{default: () => '详情'}}
                                                 </ElButton>
@@ -211,7 +243,7 @@ function useVxeTable<D = any>(simplifiedConfiguration: SimplifiedConfiguration<D
                                         }
                                     }}
                                 </VxeColumn> : null,
-                            ...slots.default ? slots.default() : null,
+                            slots.default ? slots.default() : null,
                         ];
                     }
                 }}
@@ -276,9 +308,9 @@ function useVxeTable<D = any>(simplifiedConfiguration: SimplifiedConfiguration<D
         // @ts-ignore
         simplifiedConfiguration.remoteSearch(data).then(res => {
             // @ts-ignore
-            const data: D[] = XEUtils.get(res, simplifiedConfiguration!.result || 'result') as D[]
+            const data: D[] = XEUtils.get(res, simplifiedConfiguration!.result) as D[]
             // @ts-ignore
-            const total: number = XEUtils.get(res, simplifiedConfiguration!.total || 'total') as number
+            const total: number = XEUtils.get(res, simplifiedConfiguration!.total) as number
             props.data = data
             pageVO.total = total
         }).catch((e) => {
@@ -298,14 +330,19 @@ function useVxeTable<D = any>(simplifiedConfiguration: SimplifiedConfiguration<D
 
     const pageMemory = reactive(new Map<any, D>());
 
-    function getCheckboxRecords() {
-        // @ts-ignore
-        return eachAndReturnList(pageMemory, (item) => {
-            return item
-        })
+    function getCheckboxRecords(): D[] {
+        if (simplifiedConfiguration.showPage) {
+            // @ts-ignore
+            return eachAndReturnList(pageMemory, (item) => {
+                return item
+            })
+        } else {
+            return tableRef.value!.getCheckboxRecords()
+        }
     }
 
     function handelCheckbox() {
+        if (simplifiedConfiguration.showPage) return
         const data = tableRef.value!.getCheckboxRecords()
         if (data.length > 0) {
             XEUtils.arrayEach(tableRef.value!.getCheckboxRecords(), (item) => {
@@ -342,18 +379,18 @@ function useVxeTable<D = any>(simplifiedConfiguration: SimplifiedConfiguration<D
 
     function querySearch() {
         props.loading = true
-        // @ts-ignore
         if (simplifiedConfiguration.showPage) {
+            const parameterData = simplifiedConfiguration?.getQueryParams?.()
             const pageData = {
                 ...pageVO,
                 total: 0,
-                currentPage: 1
+                currentPage: 1,
+                ...parameterData
             }
             queryParamsCache = pageData
             pageQuery(pageData)
         } else {
-            // @ts-ignore
-            simplifiedConfiguration.remoteSearch({...pageVO}).then(res => {
+            simplifiedConfiguration?.remoteSearch?.({}).then(res => {
                 props.data = res
             }).catch(() => {
                 props.data = []
@@ -378,15 +415,16 @@ function useVxeTable<D = any>(simplifiedConfiguration: SimplifiedConfiguration<D
                             {{
                                 header: () => {
                                     try {
-                                        if (simplifiedConfiguration.dialogHeader) {
-                                            const Scc = simplifiedConfiguration?.dialogHeader();
-                                            if (typeof Scc !== 'undefined') {
-                                                return <Scc/>
-                                            } else {
-                                                console.error('dialogHeader需要返回一个组件')
-                                            }
+                                        let HeaderSlots = null
+                                        if (mutation.getDialogHeaderSlots() != null) {
+                                            HeaderSlots = mutation.getDialogHeaderSlots()
+                                        } else if (simplifiedConfiguration.dialogHeader) {
+                                            HeaderSlots = simplifiedConfiguration?.dialogHeader();
+                                        }
+                                        console.log(HeaderSlots)
+                                        if (HeaderSlots != null) {
+                                            return HeaderSlots
                                         }
-
                                     } catch (e) {
                                         console.error('dialogHeader需要返回一个组件', e)
                                         return null
@@ -406,7 +444,7 @@ function useVxeTable<D = any>(simplifiedConfiguration: SimplifiedConfiguration<D
                                         {{
                                             default: () => {
                                                 return [
-                                                    <VxeColumn title={"删除"} width={80} fixed="left">
+                                                    <VxeColumn title={"取消选中"} width={80} fixed="left">
                                                         {{
                                                             default({row}: any) {
                                                                 return <ElButton
@@ -414,12 +452,12 @@ function useVxeTable<D = any>(simplifiedConfiguration: SimplifiedConfiguration<D
                                                                     onClick={(el) => {
                                                                         handelCheckboxChange({row, checked: false})
                                                                     }}
-                                                                >{{default: () => '删除'}}
+                                                                >{{default: () => '取消'}}
                                                                 </ElButton>
                                                             }
                                                         }}
                                                     </VxeColumn>,
-                                                    mutation.setTableDefaultSlots()
+                                                    mutation.getTableDefaultSlots()
                                                 ]
                                             }
                                         }}
@@ -450,7 +488,7 @@ function useVxeTable<D = any>(simplifiedConfiguration: SimplifiedConfiguration<D
             await tableRef.value?.setCheckboxRow(row, checked)
             // @ts-ignore
             const key = XEUtils.get(row, simplifiedConfiguration!.keyField, null) as string | null
-            if (key === null) return
+            if (key === null || !simplifiedConfiguration.showPage) return
             if (checked) {
                 pageMemory.set(key, row)
             } else {
@@ -461,7 +499,10 @@ function useVxeTable<D = any>(simplifiedConfiguration: SimplifiedConfiguration<D
             tableRef.value?.clearCheckboxRow()
             pageMemory.clear()
         },
-        setTableDefaultSlots(): any {
+        getTableDefaultSlots(): any {
+
+        },
+        getDialogHeaderSlots(): any {
 
         }
     }