feat(doctorstation): 新增传染病报告卡功能并优化患者登记组件
- 新增传染病报告卡完整实现,包含甲乙丙类传染病选择和报告信息录入 - 在患者登记组件中修复性别字典数据去重问题 - 添加编辑模式支持和原始数据存储功能 - 实现姓名和身份证唯一性校验的编辑模式跳过逻辑 - 添加年龄自动计算功能基于出生日期 - 确保性别值为字符串类型以便与下拉框选项匹配 - 更新患者登记组件的标题和状态管理逻辑
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<el-table
|
||||
ref="adviceBaseRef"
|
||||
height="400"
|
||||
:data="adviceBaseList"
|
||||
:data="filteredAdviceBaseList"
|
||||
highlight-current-row
|
||||
@current-change="handleCurrentChange"
|
||||
row-key="patientId"
|
||||
@@ -28,7 +28,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {nextTick} from 'vue';
|
||||
import {nextTick, ref, computed, watch} from 'vue';
|
||||
import {getTcmMedicine} from '@/views/doctorstation/components/api';
|
||||
import {throttle} from 'lodash-es';
|
||||
|
||||
@@ -53,6 +53,29 @@ const queryParams = ref({
|
||||
pageNum: 1,
|
||||
});
|
||||
const adviceBaseList = ref([]);
|
||||
|
||||
// 计算属性:过滤无库存的药品
|
||||
const filteredAdviceBaseList = computed(() => {
|
||||
// 过滤无库存的药品(只针对药品类型 adviceType === 1)
|
||||
return adviceBaseList.value.filter(item => {
|
||||
if (item.adviceType === 1) {
|
||||
// 检查是否有库存
|
||||
if (item.inventoryList && item.inventoryList.length > 0) {
|
||||
// 计算总库存数量,确保转换为数字进行正确计算
|
||||
const totalQuantity = item.inventoryList.reduce((sum, inv) => {
|
||||
const qty = inv.quantity !== undefined && inv.quantity !== null
|
||||
? (typeof inv.quantity === 'number' ? inv.quantity : Number(inv.quantity) || 0)
|
||||
: 0;
|
||||
return sum + qty;
|
||||
}, 0);
|
||||
return totalQuantity > 0;
|
||||
}
|
||||
return false; // 无库存列表或库存为空,视为无库存
|
||||
}
|
||||
return true; // 非药品类型不过滤
|
||||
});
|
||||
});
|
||||
|
||||
// 节流函数
|
||||
const throttledGetList = throttle(
|
||||
() => {
|
||||
@@ -79,8 +102,8 @@ function getList() {
|
||||
total.value = res.data.total;
|
||||
nextTick(() => {
|
||||
currentIndex.value = 0;
|
||||
if (adviceBaseList.value.length > 0) {
|
||||
adviceBaseRef.value.setCurrentRow(adviceBaseList.value[0]);
|
||||
if (filteredAdviceBaseList.value.length > 0) {
|
||||
adviceBaseRef.value.setCurrentRow(filteredAdviceBaseList.value[0]);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -89,7 +112,7 @@ function getList() {
|
||||
// 处理键盘事件
|
||||
const handleKeyDown = (event) => {
|
||||
const key = event.key;
|
||||
const data = adviceBaseList.value;
|
||||
const data = filteredAdviceBaseList.value;
|
||||
|
||||
switch (key) {
|
||||
case 'ArrowUp': // 上箭头
|
||||
@@ -138,7 +161,7 @@ const setCurrentRow = (row) => {
|
||||
|
||||
// 当前行变化时更新索引
|
||||
const handleCurrentChange = (currentRow) => {
|
||||
currentIndex.value = adviceBaseList.value.findIndex((item) => item === currentRow);
|
||||
currentIndex.value = filteredAdviceBaseList.value.findIndex((item) => item === currentRow);
|
||||
currentSelectRow.value = currentRow;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user