eight
2024-10-23 83bc7f6d33934f56fd1df80c7e8975e7c887d606
检查类型 字典移除,使用 本地存储
已添加1个文件
已修改14个文件
197 ■■■■ 文件已修改
src/api/ecg/checktype/index.ts 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/ecg/room/index.ts 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/RoomBedSelect/src/RoomBedSelect.vue 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/RoomStatus/src/RoomStatus.vue 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/hooks/web/useCache.ts 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/permission.ts 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/modules/checkType.ts 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/dict.ts 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/ecg/appointment/AppointmentConfirm.vue 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/ecg/appointment/AppointmentForm.vue 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/ecg/appointment/index.vue 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/ecg/doctor/components/QueuePanel.vue 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/ecg/queue/index.vue 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/ecg/room/RoomForm.vue 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/ecg/room/RoomSetting.vue 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/ecg/checktype/index.ts
@@ -12,6 +12,12 @@
// æ£€æŸ¥ç±»åž‹ API
export const CheckTypeApi = {
  // æŸ¥è¯¢æ£€æŸ¥ç±»åž‹.简单列表
  getSimpleCheckTypeList: async () => {
    return await request.get({ url: `/ecg/check-type/list-simple-check-type` })
  },
  // æŸ¥è¯¢æ£€æŸ¥ç±»åž‹åˆ†é¡µ
  getCheckTypePage: async (params: any) => {
    return await request.get({ url: `/ecg/check-type/page`, params })
src/api/ecg/room/index.ts
@@ -19,6 +19,7 @@
  activeQueueNum : number
  priorityQueueNum : number
  openingFlag : number
  checkTypeBedInfo: object
}
// è¯Šå®¤å’Œè¯Šç–—床 API
src/components/RoomBedSelect/src/RoomBedSelect.vue
@@ -3,6 +3,7 @@
import {PropType} from "vue";
import {useUserStore} from "@/store/modules/user";
import {DICT_TYPE, getIntDictOptions} from "@/utils/dict";
import {useCheckTypeStore} from "@/store/modules/checkType";
const emit = defineEmits(['event-haveseat', 'event-leaveseat'])
defineComponent({
@@ -25,6 +26,7 @@
  }
})
const checkTypeStore = useCheckTypeStore();
const userStore = useUserStore()
const curUser = userStore.getUser
@@ -35,19 +37,10 @@
  emit('event-leaveseat', curItem)
}
let mapCheckType: Map<number, string> = new Map();
const getCheckTypeList = () => {
  const data = getIntDictOptions(DICT_TYPE.ECG_CHECK_TYPE)
  console.info( data )
  data.forEach((checkTypeItem) => {
    mapCheckType.set(checkTypeItem.value, checkTypeItem.label)
  })
}
/** åˆå§‹åŒ– **/
onMounted(() => {
    //console.info(props.bedList)
  getCheckTypeList()
})
</script>
@@ -59,7 +52,7 @@
      <div class="deskwarp">
        <div v-for="(checkType, subIndex) in bedItem.checkTypes" :key="subIndex">
          {{mapCheckType.get(checkType)}}
          {{checkTypeStore.getCheckTypeName(checkType)}}
        </div>
        <div>
          {{bedItem.opType === 1?"领用":""}}
src/components/RoomStatus/src/RoomStatus.vue
@@ -3,6 +3,7 @@
import { QueueApi } from '@/api/ecg/queue'
import {PropType} from "vue";
import {DICT_TYPE, getIntDictOptions} from "@/utils/dict";
import {useCheckTypeStore} from "@/store/modules/checkType";
const emit = defineEmits(['refresh'])
defineComponent({
@@ -20,7 +21,7 @@
  }
})
let mapCheckType: Map<number, string> = new Map();
const checkTypeStore = useCheckTypeStore();
const openBed = async (item) => {
    await QueueApi.bedOpen(item)
@@ -32,17 +33,8 @@
    emit('refresh')
}
const getCheckTypeList = () => {
  const data = getIntDictOptions(DICT_TYPE.ECG_CHECK_TYPE)
  console.info( data )
  data.forEach((checkTypeItem) => {
    mapCheckType.set(checkTypeItem.value, checkTypeItem.label)
  })
}
/** åˆå§‹åŒ– **/
onMounted(() => {
  getCheckTypeList()
})
</script>
@@ -72,11 +64,12 @@
        />
        {{bedItem.bedNo}} {{bedItem.docName}} {{bedItem.status === 30?"-暂停":""}}
        <div v-for="(checkType, subIndex) in bedItem.checkTypes" :key="subIndex">
          {{mapCheckType.get(checkType)}}
          {{checkTypeStore.getCheckTypeName(checkType)}}
        </div>
        <div>
          {{bedItem.opType === 1?"领用":""}}
        </div>
        <el-divider/>
      </div>
    </div>
  </el-card>
src/hooks/web/useCache.ts
@@ -16,6 +16,7 @@
  THEME: 'theme',
  LAYOUT: 'layout',
  DICT_CACHE: 'dictCache',
  CHECKTYPE_CACHE: 'checkTypeCache',
  // ç™»å½•表单
  LoginForm: 'loginForm',
  TenantId: 'tenantId'
src/permission.ts
@@ -6,6 +6,7 @@
import { useNProgress } from '@/hooks/web/useNProgress'
import { usePageLoading } from '@/hooks/web/usePageLoading'
import { useDictStoreWithOut } from '@/store/modules/dict'
import { useCheckTypeStoreWithOut } from '@/store/modules/checkType'
import { useUserStoreWithOut } from '@/store/modules/user'
import { usePermissionStoreWithOut } from '@/store/modules/permission'
@@ -82,10 +83,14 @@
  // èŽ·å–æ‰€æœ‰å­—å…¸
  const dictStore = useDictStoreWithOut()
  const userStore = useUserStoreWithOut()
  const checkTypeStore = useCheckTypeStoreWithOut()
  const permissionStore = usePermissionStoreWithOut()
  if (!dictStore.getIsSetDict) {
    await dictStore.setDictMap()
  }
  if (!checkTypeStore.getIsSetCheckType) {
    await checkTypeStore.setCheckTypeMap()
  }
  if (userStore.getIsSetUser ) {
src/store/modules/checkType.ts
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,94 @@
import { defineStore } from 'pinia'
import { store } from '../index'
// @ts-ignore
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
const { wsCache } = useCache('sessionStorage')
import {CheckTypeApi} from "@/api/ecg/checktype";
export interface CheckTypeSimpleVO {
  value: number
  name: string
}
export interface CheckTypeState {
  checkTypeMap: Map<number, string>
  isSetCheckType: boolean
}
export const useCheckTypeStore = defineStore('checktype ', {
  state: (): CheckTypeState => ({
    checkTypeMap: new Map<number, string>(),
    isSetCheckType: false
  }),
  getters: {
    getCheckTypeMap(): Recordable {
      const checkTypeMap = wsCache.get(CACHE_KEY.CHECKTYPE_CACHE)
      if (checkTypeMap) {
        this.checkTypeMap = checkTypeMap
      }
      return this.checkTypeMap
    },
    getIsSetCheckType(): boolean {
      return this.isSetCheckType
    }
  },
  actions: {
    async setCheckTypeMap() {
      const checkTypeMap = wsCache.get(CACHE_KEY.CHECKTYPE_CACHE)
      if (checkTypeMap) {
        this.checkTypeMap = checkTypeMap
        this.isSetCheckType = true
      } else {
        const res = await CheckTypeApi.getSimpleCheckTypeList()
        // è®¾ç½®æ•°æ®
        const checkTypeMap = new Map<number, string>()
        res.forEach((simpleVO: CheckTypeSimpleVO) => {
          // èŽ·å¾— dictType å±‚级
          const enumValueObj = checkTypeMap[simpleVO.value]
          if (!enumValueObj) {
            checkTypeMap[simpleVO.value] = simpleVO.name
          }
        })
        this.checkTypeMap = checkTypeMap
        this.isSetCheckType = true
        wsCache.set(CACHE_KEY.CHECKTYPE_CACHE, checkTypeMap, { exp: 60 }) // 60 ç§’ è¿‡æœŸ
      }
    },
    getCheckTypeName(type: number) {
      if (!this.isSetCheckType) {
        this.setcheckTypeMap()
      }
      return this.checkTypeMap[type]
    },
    getCheckTypeOptions() {
      if (!this.isSetCheckType) {
        this.setcheckTypeMap()
      }
      return Object.keys(this.checkTypeMap).map((key) => {
        return {
          value: key,
          label: this.checkTypeMap[key]
        }
      });
    },
    async resetCheckTypeInfo() {
      wsCache.delete(CACHE_KEY.CHECKTYPE_CACHE)
      const res = await CheckTypeApi.getSimpleCheckTypeList()
      // è®¾ç½®æ•°æ®
      const checkTypeMap = new Map<number, string>()
      res.forEach((simpleVO: CheckTypeSimpleVO) => {
        // èŽ·å¾— dictType å±‚级
        const enumValueObj = checkTypeMap[simpleVO.value]
        if (!enumValueObj) {
          checkTypeMap[simpleVO.value] = simpleVO.name
        }
      })
      this.checkTypeMap = checkTypeMap
      this.isSetCheckType = true
      wsCache.set(CACHE_KEY.CHECKTYPE_CACHE, checkTypeMap, { exp: 60 }) // 60 ç§’ è¿‡æœŸ
    }
  }
})
export const useCheckTypeStoreWithOut = () => {
  return useCheckTypeStore(store)
}
src/utils/dict.ts
@@ -144,7 +144,6 @@
  // ========== ECG æ¨¡å— ==========
  ECG_BOOK_TIMESLOT = 'ecg_book_timeslot',
  ECG_CHECK_TYPE = 'ecg_check_type',
  ECG_BOOK_SRC = 'ecg_book_src',
  ECG_QUEUE_STATUS = 'ecg_queue_status',
  ECG_DEV_BRAND = 'ecg_dev_brand',
src/views/ecg/appointment/AppointmentConfirm.vue
@@ -53,7 +53,7 @@
      <el-form-item label="预约检查类型" prop="bookCheckType">
        <el-select v-model="formData.bookCheckType" placeholder="请选择预约检查类型">
          <el-option
            v-for="dict in getIntDictOptions(DICT_TYPE.ECG_CHECK_TYPE)"
            v-for="dict in checkTypeStore.getCheckTypeOptions()"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
@@ -111,10 +111,13 @@
<script setup lang="ts">
import {DICT_TYPE, getIntDictOptions} from '@/utils/dict'
import { AppointmentApi, AppointmentVO } from '@/api/ecg/appointment'
import {useCheckTypeStore} from "@/store/modules/checkType";
/** é¢„约确认 è¡¨å• */
defineOptions({ name: 'AppointmentConfirm' })
const checkTypeStore = useCheckTypeStore();
const message = useMessage() // æ¶ˆæ¯å¼¹çª—
const loading = ref(true) // åˆ—表的加载中
src/views/ecg/appointment/AppointmentForm.vue
@@ -68,7 +68,7 @@
          <el-form-item label="预约检查类型" prop="bookCheckType">
            <el-select v-model="formData.bookCheckType" placeholder="请选择预约检查类型">
              <el-option
                  v-for="dict in getIntDictOptions(DICT_TYPE.ECG_CHECK_TYPE)"
                  v-for="dict in checkTypeStore.getCheckTypeOptions()"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
@@ -157,10 +157,13 @@
<script setup lang="ts">
import {DICT_TYPE, getIntDictOptions} from '@/utils/dict'
import { AppointmentApi, AppointmentVO } from '@/api/ecg/appointment'
import {useCheckTypeStore} from "@/store/modules/checkType";
/** é¢„约 è¡¨å• */
defineOptions({ name: 'AppointmentForm' })
const checkTypeStore = useCheckTypeStore();
const { t } = useI18n() // å›½é™…化
const message = useMessage() // æ¶ˆæ¯å¼¹çª—
src/views/ecg/appointment/index.vue
@@ -149,7 +149,7 @@
          class="!w-240px"
        >
          <el-option
            v-for="dict in getIntDictOptions(DICT_TYPE.ECG_CHECK_TYPE)"
            v-for="dict in checkTypeStore.getCheckTypeOptions()"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
@@ -229,7 +229,7 @@
      </el-table-column>
      <el-table-column label="预约检查类型" align="center" prop="bookCheckType">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.ECG_CHECK_TYPE" :value="scope.row.bookCheckType" />
          checkTypeStore.getCheckTypeName(scope.row.bookCheckType)
        </template>
      </el-table-column>
      <el-table-column label="预约来源" align="center" prop="bookSrc">
@@ -277,6 +277,7 @@
import download from '@/utils/download'
import { AppointmentApi, AppointmentVO } from '@/api/ecg/appointment'
import AppointmentForm from './AppointmentForm.vue'
import {useCheckTypeStore} from "@/store/modules/checkType";
/** é¢„约 åˆ—表 */
defineOptions({ name: 'Appointment' })
@@ -312,6 +313,8 @@
const queryFormRef = ref() // æœç´¢çš„表单
const exportLoading = ref(false) // å¯¼å‡ºçš„加载中
const checkTypeStore = useCheckTypeStore();
/** æŸ¥è¯¢åˆ—表 */
const getList = async () => {
  loading.value = true
src/views/ecg/doctor/components/QueuePanel.vue
@@ -3,12 +3,15 @@
import { QueueVO } from '@/api/ecg/queue'
import {DICT_TYPE} from "@/utils/dict";
import {PatientVO, DoctorApi} from "@/api/ecg/doctor";
import {useCheckTypeStore} from "@/store/modules/checkType";
defineComponent({
  name: 'QueuePanel'
})
const emit = defineEmits(['event_RecallFinish']) // å®šä¹‰ success äº‹ä»¶ï¼Œç”¨äºŽæ“ä½œæˆåŠŸåŽçš„å›žè°ƒ
const checkTypeStore = useCheckTypeStore();
const message = useMessage() // æ¶ˆæ¯å¼¹çª—
@@ -50,7 +53,7 @@
  <span style="display:inline-block; width:70px;"> {{item.seqNum}} &nbsp; {{item.patName}}{{item.passed === 0 ? "":"*"}} </span>
  <dict-tag :type="DICT_TYPE.SYSTEM_USER_SEX" :value="item.patGender" />
<!--  {{item.roomName}} {{item.bedNo}}-->
  <dict-tag :type="DICT_TYPE.ECG_CHECK_TYPE" :value="item.bookCheckType" />
  checkTypeStore.getCheckTypeName(item.bookCheckType)
  <dict-tag :type="DICT_TYPE.ECG_QUEUE_STATUS" :value="item.status" />
  <el-button v-if="item.status === 5 || item.status === 7" @click="recall(item)"> å¬å›ž </el-button>
</div>
src/views/ecg/queue/index.vue
@@ -49,7 +49,7 @@
          class="!w-240px"
        >
          <el-option
            v-for="dict in getIntDictOptions(DICT_TYPE.ECG_CHECK_TYPE)"
            v-for="dict in checkTypeStore.getCheckTypeOptions()"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
@@ -137,7 +137,7 @@
      </el-table-column>
      <el-table-column label="检查类型" align="center" prop="bookCheckType" >
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.ECG_CHECK_TYPE" :value="scope.row.bookCheckType" />
          checkTypeStore.getCheckTypeName(scope.row.bookCheckType)
        </template>
      </el-table-column>
        <el-table-column label="排队序号" align="center" prop="seqNum" />
@@ -217,6 +217,7 @@
import queueForm from './QueueForm.vue'
import {DICT_TYPE, getIntDictOptions} from '@/utils/dict'
import {DoctorApi, PatientVO} from "@/api/ecg/doctor";
import {useCheckTypeStore} from "@/store/modules/checkType";
/** æŽ’队 åˆ—表 */
defineOptions({ name: 'queue' })
@@ -224,6 +225,8 @@
const message = useMessage() // æ¶ˆæ¯å¼¹çª—
const { t } = useI18n() // å›½é™…化
const checkTypeStore = useCheckTypeStore();
const loading = ref(true) // åˆ—表的加载中
const list = ref<QueueVO[]>([]) // åˆ—表的数据
const total = ref(0) // åˆ—表的总页数
src/views/ecg/room/RoomForm.vue
@@ -26,7 +26,7 @@
      <el-form-item label="检查类型" prop="checkTypes">
        <el-checkbox-group v-model="formData.checkTypes">
          <el-checkbox v-for="checkType in checkTypeDict" :value="checkType.value" :key="checkType.value">{{checkType.label}}</el-checkbox>
          <el-checkbox v-for="checkType in checkTypeStore.getCheckTypeOptions()" :value="checkType.value" :key="checkType.value">{{checkType.label}}</el-checkbox>
        </el-checkbox-group>
      </el-form-item>
@@ -48,12 +48,15 @@
<script setup lang="ts">
import { RoomApi, RoomVO } from '@/api/ecg/room'
import {DICT_TYPE, getIntDictOptions} from "@/utils/dict";
import {CheckTypeApi} from "@/api/ecg/checktype";
/** è¯Šå®¤å’Œè¯Šç–—床 è¡¨å• */
defineOptions({ name: 'RoomForm' })
const { t } = useI18n() // å›½é™…化
const message = useMessage() // æ¶ˆæ¯å¼¹çª—
const checkTypeStore = useCheckTypeStore();
const dialogVisible = ref(false) // å¼¹çª—的是否展示
const dialogTitle = ref('') // å¼¹çª—的标题
@@ -74,8 +77,6 @@
})
const formRef = ref() // è¡¨å• Ref
const roomListRef = ref<RoomVO[]>([]) // åˆ—表的数据
const checkTypeDict = ref()
/** æ‰“开弹窗 */
const open = async (type: string, id?: number) => {
@@ -141,16 +142,9 @@
    return roomListRef.value.find( e => e.roomId === id)!.roomName
}
const getCheckTypeList = () => {
  const data = getIntDictOptions(DICT_TYPE.ECG_CHECK_TYPE)
  console.info( data )
  checkTypeDict.value = data
}
/** åˆå§‹åŒ– **/
onMounted(() => {
  getSimpleRoomList()
  getCheckTypeList()
})
</script>
src/views/ecg/room/RoomSetting.vue
@@ -18,7 +18,7 @@
      <div>开诊时间:{{ openingPeriod }}  {{ monitorInfo.openingFlag }}  </div>
      <div>工位概况: {{monitorInfo.queueNum}} {{monitorInfo.activeQueueNum}} {{monitorInfo.priorityQueueNum}} </div>
      <div v-for="(value, key) in monitorInfo.checkTypeBedInfo" :key="key">
        {{ mapCheckType.get(Number(key)) }}  {{ value }}
        {{ checkTypeStore.getCheckTypeName(Number(key)) }}  {{ value }}
      </div>
    </el-aside>
  </el-container>
@@ -29,12 +29,11 @@
import { RoomApi, RoomVO, MonitorInfo } from '@/api/ecg/room'
import { QueueApi } from '@/api/ecg/queue'
import { getConfigKey } from '@/api/infra/config'
import {DICT_TYPE, getIntDictOptions} from "@/utils/dict";
import {useCheckTypeStore} from "@/store/modules/checkType";
defineOptions({ name: 'RoomSetting' })
const bedMap = ref() // åˆ—表的数据
let mapCheckType: Map<number, string> = new Map();
const openingPeriod = ref<string>('')
const monitorInfo = ref<MonitorInfo>({
@@ -42,8 +41,10 @@
  activeQueueNum: 0,
  priorityQueueNum: 0,
  openingFlag: 0,
  checkTypeBedInfo: undefined
  checkTypeBedInfo: {}
})
const checkTypeStore = useCheckTypeStore();
const getOpeningPeriod = async () => {
  const data = await getConfigKey('ecg.openingtime')
@@ -86,18 +87,9 @@
  getMonitorInfo()
}
const getCheckTypeList = () => {
  const data = getIntDictOptions(DICT_TYPE.ECG_CHECK_TYPE)
  console.info( data )
  data.forEach((checkTypeItem) => {
    mapCheckType.set(checkTypeItem.value, checkTypeItem.label)
  })
}
/** åˆå§‹åŒ– **/
onMounted(() => {
  getList()
  getCheckTypeList()
  getOpeningPeriod()
  getMonitorInfo()
})