98 lines
3.1 KiB
Plaintext
98 lines
3.1 KiB
Plaintext
<template>
|
|
<hr-page page-bg="#F3F4F6" status-bg="#FFFFFF" nav-title="处置记录 · 李华" :xloading="true"
|
|
@right-click="onAdd">
|
|
<template v-slot:right>
|
|
<x-icon name="add-line" color="#6B7280" font-size="19"></x-icon>
|
|
</template>
|
|
|
|
<view class="hr-body">
|
|
|
|
<!-- 处置类型筛选(组件库 xRadioButton 分段切换) -->
|
|
<view style="margin-bottom:8rpx">
|
|
<x-radio-button v-model="chipId" :list="chipTabs" height="64rpx" space="4rpx" round="22rpx"
|
|
text-style="font-weight:bold;" bg-color="#E5E7EB" active-color="#2563EB"
|
|
active-font-color="#FFFFFF" font-color="#6B7280" font-size="22rpx"></x-radio-button>
|
|
</view>
|
|
|
|
<hr-card style="margin-top:10px">
|
|
<hr-timeline :nodes="shownNodes"></hr-timeline>
|
|
</hr-card>
|
|
|
|
<hr-empty v-if="shownNodes.length == 0" icon="▤" title="该分类下暂无处置记录"
|
|
sub="切换其他分类,或点击右下角新增一条处置记录"></hr-empty>
|
|
|
|
<view style="height:14px"></view>
|
|
</view>
|
|
|
|
<template v-slot:footer>
|
|
<view class="hr-fixedbar">
|
|
<view class="hr-btn hr-btn-primary" style="flex:1" @click="onAdd">
|
|
<x-icon name="add-line" color="#FFFFFF" font-size="16"></x-icon>
|
|
<text class="trc-foot-t">新增处置记录</text>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</hr-page>
|
|
</template>
|
|
|
|
<script lang="uts" setup>
|
|
import { ref, computed } from 'vue'
|
|
import { treatRecords } from '@/mock/index.uts'
|
|
import { HrTimelineNode } from '@/mock/types.uts'
|
|
import { RADIO_BUTTON } from '@/uni_modules/tmx-ui/interface.uts'
|
|
|
|
/**
|
|
* s15 处置记录
|
|
* 按处置类型分类查看,时间线倒序。
|
|
*/
|
|
/**
|
|
* 处置类型筛选(组件库 xRadioButton 分段切换,替代原 hr-chip 横向滚动)
|
|
* ⚠ RADIO_BUTTON 的 id 是 string:统一用下标字符串,选中值即筛选序号。
|
|
*/
|
|
const chipTabs : RADIO_BUTTON[] = [
|
|
{ id: '0', title: '全部 4' } as RADIO_BUTTON,
|
|
{ id: '1', title: '止血 1' } as RADIO_BUTTON,
|
|
{ id: '2', title: '循环 1' } as RADIO_BUTTON,
|
|
{ id: '3', title: '分级 2' } as RADIO_BUTTON
|
|
]
|
|
const chipId = ref('0')
|
|
/** 由字符串 id 换算分类序号,供 shownNodes 筛选使用 */
|
|
const chip = computed(() : number => {
|
|
const i = parseInt(chipId.value)
|
|
return isNaN(i) ? 0 : i
|
|
})
|
|
|
|
const shownNodes = computed(() : HrTimelineNode[] => {
|
|
if (chip.value == 0) { return treatRecords }
|
|
const kw = chip.value == 1 ? '止血' : (chip.value == 2 ? '静脉' : '分级')
|
|
const arr : HrTimelineNode[] = []
|
|
for (let i = 0; i < treatRecords.length; i++) {
|
|
if (treatRecords[i].title.indexOf(kw) > -1) { arr.push(treatRecords[i]) }
|
|
}
|
|
return arr
|
|
})
|
|
|
|
function onAdd() : void {
|
|
uni.showModal({
|
|
title: '新增处置记录',
|
|
editable: true,
|
|
placeholderText: '如:15:40 清创缝合完成',
|
|
success: (res) => {
|
|
if (!res.confirm) { return }
|
|
const text = res.content
|
|
if (text == null || text == '') { return }
|
|
uni.showToast({ title: '处置记录已提交', icon: 'success' })
|
|
}
|
|
})
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
.trc-foot-t {
|
|
font-size: 32.4rpx;
|
|
font-weight: bold;
|
|
color: #FFFFFF;
|
|
margin-left: 12rpx;
|
|
}
|
|
</style>
|