| | |
| | | <el-button size="small" @click="resetSchedule" > 重置定时任务 </el-button> |
| | | <el-button size="small" @click="refresh" > 刷新 </el-button> |
| | | </div> |
| | | <div class="mode-area"> |
| | | <span class="mode-label">选择工位模式:</span> |
| | | <el-select v-model="roomSelectMode" size="small" style="width: 210px" @change="saveRoomSelectMode"> |
| | | <el-option :value="0" label="0 - 按需要强制选择工位" /> |
| | | <el-option :value="1" label="1 - 登录IP匹配工位" /> |
| | | <el-option :value="2" label="2 - 登录时手动选择工位(写入本机IP)" /> |
| | | <el-option :value="3" label="3 - 按系统默认处理" /> |
| | | </el-select> |
| | | <span class="mode-tip"> |
| | | 0=每次都要选;1=按IP自动匹配,匹配不到才让选;2=每次都要选并把本机IP写到该工位; |
| | | 3=该IP首次选一次并记住,之后按1自动匹配 |
| | | </span> |
| | | <span class="mode-warn" v-if="unboundIpBeds.length > 0"> |
| | | 以下工位未绑定有效的 IPv4 地址(本系统工位绑定仅采用 IPv4),模式1、3将无法自动匹配到它们:{{ unboundIpBeds.join('、') }} |
| | | </span> |
| | | </div> |
| | | </el-main> |
| | | <el-aside width="210px" class="monitor-aside"> |
| | | <div>开诊时间:{{ openingPeriod }} {{ monitorInfo?.openingFlag }} </div> |
| | | <div> |
| | | 开诊时间:{{ openingPeriod }} |
| | | <!-- |
| | | 【本次说明】开诊状态是"自动补人"的总门闸: |
| | | 已闭诊时,**排队中的患者不会被自动搬进各工位的候诊区**(界面上不会有报错,只表现为"人不进来")。 |
| | | --> |
| | | <el-tag :type="monitorInfo?.openingFlag === 1 ? 'success' : 'info'" size="small"> |
| | | {{ monitorInfo?.openingFlag === 1 ? '开诊中(会自动补人)' : '已闭诊(不会自动补人)' }} |
| | | </el-tag> |
| | | </div> |
| | | <div>工位概况: {{monitorInfo?.openingBedNum}} {{monitorInfo?.docBedNum}} {{monitorInfo?.routingBedNum}} </div> |
| | | <div v-for="(value, key) in monitorInfo.checkTypeBedInfo" :key="key"> |
| | | {{ getCheckTypeName(Number(key)) }} {{ value }} |
| | |
| | | |
| | | <script setup lang="ts"> |
| | | import {RoomStatus} from "@/components/RoomStatus" |
| | | import { RoomApi, RoomVO, MonitorInfo } from '@/api/ecg/room' |
| | | import { RoomApi, RoomVO, MonitorInfo, isUsableSeatIp } from '@/api/ecg/room' |
| | | import { QueueApi } from '@/api/ecg/queue' |
| | | import { getConfigKey } from '@/api/infra/config' |
| | | import {useCheckTypeStore} from "@/store/modules/checkType"; |
| | | import {getCheckTypeName} from "../../../utils/checkTypeFormatter"; |
| | | import { getConfigKey, getConfigPage, createConfig, updateConfig } from '@/api/infra/config' |
| | | import { useCheckTypeStore } from "@/store/modules/checkType"; |
| | | import { getCheckTypeName } from "../../../utils/checkTypeFormatter"; |
| | | |
| | | defineOptions({ name: 'RoomSetting' }) |
| | | |
| | | const bedMap = ref() // 列表的数据 |
| | | |
| | | const openingPeriod = ref<string>('') |
| | | /** |
| | | * 「选择工位模式」参数(ecg.room.select.mode): |
| | | * 0=按需要强制选择工位(默认,原行为) 1=登录IP匹配工位 2=登录时手动选择工位(写入本机IP) 3=按系统默认处理 |
| | | */ |
| | | const roomSelectMode = ref<number>(0) |
| | | const roomSelectModeConfigId = ref<number | undefined>(undefined) |
| | | const monitorInfo = ref<MonitorInfo>({ |
| | | openingBedNum: 0, |
| | | docBedNum: 0, |
| | |
| | | |
| | | const checkTypeStore = useCheckTypeStore(); |
| | | |
| | | /** 该IP能否用于自动匹配工位(支持 IPv4/IPv6;空、0.0.0.0、::、127.x、::1 都是无效占位/回环值) */ |
| | | const isIpUsable = (ip?: string | null) => isUsableSeatIp(ip) |
| | | |
| | | /** 未绑定有效IP的工位(模式 1、3 匹配不到它们,管理页给出提醒) */ |
| | | const unboundIpBeds = computed<string[]>(() => { |
| | | const map: any = bedMap.value || {} |
| | | const list: string[] = [] |
| | | Object.keys(map).forEach((roomName) => { |
| | | ;(map[roomName] as RoomVO[]).forEach((bed) => { |
| | | if (!isIpUsable(bed.ip)) { |
| | | list.push(`${roomName}/${bed.bedNo ?? ''}`) |
| | | } |
| | | }) |
| | | }) |
| | | return list |
| | | }) |
| | | |
| | | const getOpeningPeriod = async () => { |
| | | const data = await getConfigKey('ecg.openingtime') |
| | | openingPeriod.value = data |
| | | } |
| | | |
| | | /** 读取「选择工位模式」参数(参数不存在时保持 0) */ |
| | | const ROOM_SELECT_MODE_KEY = 'ecg.room.select.mode' |
| | | const getRoomSelectMode = async () => { |
| | | try { |
| | | const page: any = await getConfigPage({ key: ROOM_SELECT_MODE_KEY, pageNo: 1, pageSize: 10 }) |
| | | const hit = (page?.list || []).find((c: any) => c.key === ROOM_SELECT_MODE_KEY) |
| | | if (hit) { |
| | | roomSelectModeConfigId.value = hit.id |
| | | const n = Number(hit.value) |
| | | roomSelectMode.value = [0, 1, 2, 3].includes(n) ? n : 0 |
| | | } else { |
| | | // 参数还没建:按缺省 0 显示,保存时再创建 |
| | | roomSelectMode.value = 0 |
| | | roomSelectModeConfigId.value = undefined |
| | | } |
| | | } catch (e) { |
| | | console.warn('[getRoomSelectMode] 读取选择工位模式失败,按 0 处理', e) |
| | | } |
| | | } |
| | | |
| | | /** 保存「选择工位模式」:已有参数则更新,没有则创建(ConfigSaveReqVO 没有 type 字段,别传) */ |
| | | const saveRoomSelectMode = async () => { |
| | | const payload: any = { |
| | | category: 'biz', |
| | | name: '选择工位模式', |
| | | key: ROOM_SELECT_MODE_KEY, |
| | | value: String(roomSelectMode.value), |
| | | visible: true, |
| | | remark: '0=按需要强制选择工位;1=登录IP匹配工位(匹配不到按0);2=登录时手动选择工位并写入本机IP;3=按系统默认处理(首次选并记IP,之后按1)' |
| | | } |
| | | try { |
| | | if (roomSelectModeConfigId.value) { |
| | | payload.id = roomSelectModeConfigId.value |
| | | await updateConfig(payload) |
| | | } else { |
| | | const id: any = await createConfig(payload) |
| | | roomSelectModeConfigId.value = id ?? undefined |
| | | await getRoomSelectMode() |
| | | } |
| | | ElMessage.success('选择工位模式已保存为 ' + roomSelectMode.value) |
| | | } catch (e: any) { |
| | | ElMessage.error('保存失败:' + (e?.message || e)) |
| | | } |
| | | } |
| | | |
| | | const getMonitorInfo = async () => { |
| | |
| | | onMounted(() => { |
| | | getList() |
| | | getOpeningPeriod() |
| | | getRoomSelectMode() |
| | | getMonitorInfo() |
| | | }) |
| | | |
| | |
| | | margin-bottom: 8px; |
| | | } |
| | | |
| | | /* 选择工位模式设置区 */ |
| | | .mode-area { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | align-items: center; |
| | | gap: 8px; |
| | | padding: 6px 8px; |
| | | font-size: 12px; |
| | | color: #606266; |
| | | } |
| | | |
| | | .mode-label { |
| | | font-weight: 600; |
| | | } |
| | | |
| | | .mode-tip { |
| | | color: #909399; |
| | | max-width: 640px; |
| | | line-height: 16px; |
| | | } |
| | | |
| | | .mode-warn { |
| | | flex: 1 0 100%; |
| | | color: #e6a23c; |
| | | } |
| | | |
| | | /* 右侧监控信息:字号收紧,避免换行撑高 */ |
| | | .monitor-aside { |
| | | padding: 8px 10px; |