Files
his/backup/vxetable-migration-20260602/medicationmanagement/priceAdjustmentManagement/components/medicineList.vue
华佗 1d21661a78 feat: Spring Boot 3.5.14 全量升级 + 组件升级
核心升级:
- Spring Boot 2.7.18 → 3.5.14
- MyBatis Plus 3.5.5 → 3.5.16 (spring-boot3-starter)
- Springdoc 1.8.0 → 2.8.6 (OpenAPI 3)
- Flowable 6.8.0 → 7.1.0
- Druid 1.2.x → 1.2.28 (boot3-starter)
- kotlin-reflect 1.9.10 → 1.9.25

迁移适配:
- javax → jakarta 命名空间 (620+ 文件)
- Swagger 注解迁移到 OpenAPI 3 (@Tag/@Schema/@Operation/@Parameter)
- Spring Security 6.2 适配 (antMatchers→requestMatchers, EnableMethodSecurity)
- Druid 包名迁移 (boot→boot3)
- Redis 配置路径迁移 (spring.redis→spring.data.redis)
- Flyway 适配 (flyway-database-postgresql)
- Flowable 7.x 适配 (MULE_TASK_IMAGE 移除)

修复:
- spring-boot-maven-plugin 2.5.15→3.5.14 (SPI服务发现失效)
- mybatis-plus-boot-starter 3.5.5→3.5.16 (kotlin-reflect+fastjson2冲突)
- Flowable database-schema-update 启用自动建表

验证: 23/23 测试通过, 1374 API端点正常
2026-06-04 22:39:49 +08:00

137 lines
3.1 KiB
Vue
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div>
<el-table
ref="medicineRef"
height="400"
:data="medicineList"
@cell-click="clickRow"
>
<el-table-column
label="项目编码"
align="center"
prop="busNo"
/>
<el-table-column
label="项目名称"
align="center"
prop="name"
/>
<el-table-column
v-if="categoryEnum !== 26"
label="当前进货价"
align="center"
prop="originBuyingPrice"
/>
<el-table-column
label="当前零售价"
align="center"
prop="originRetailPrice"
/>
<el-table-column
v-if="categoryEnum !== 26"
label="规格"
align="center"
prop="volume"
/>
</el-table>
</div>
</template>
<script setup>
import {getMedicineListByActivity, getMedicineListByDevice, getMedicineListByMed} from './api';
import {watch} from 'vue';
import {throttle} from 'lodash-es';
const props = defineProps({
searchKey: {
type: String,
default: '',
},
supplierId: {
type: String,
default: '',
},
categoryEnum: {
type: Number,
default: 24, // 默认值为0表示药品类别
},
});
// 选择药品
const emit = defineEmits(['selectRow']);
// 查询参数
const queryParams = ref({
searchKey: props.searchKey,
categoryEnum: props.categoryEnum, // 使用props传入的categoryCode
});
// 药品列表
const medicineList = ref([]);
// 是否正在请求中,防止重复请求
const isRequesting = ref(false);
const loadding = ref(false);
// 获取药品列表
const getList = async (query) => {
// 防止重复请求
if (isRequesting.value) {
return;
}
const params = query || queryParams.value;
console.log('queryParams', queryParams.value);
loadding.value = true;
isRequesting.value = true;
let apiPromise;
// 根据categoryEnum值选择不同的API函数
if (params.categoryEnum === 24) {
// 药品
apiPromise = getMedicineListByMed(params);
} else if (params.categoryEnum === 25) {
// 耗材
apiPromise = getMedicineListByDevice(params);
} else if (params.categoryEnum === 26) {
// 诊疗
apiPromise = getMedicineListByActivity(params);
}
try {
const res = await apiPromise;
// 检查响应数据结构API返回的data是直接数组而不是带records属性的对象
medicineList.value = Array.isArray(res.data) ? res.data : res.data.data || [];
} catch (error) {
medicineList.value = [];
} finally {
loadding.value = false;
isRequesting.value = false;
}
};
// 节流函数 - 使用防抖更合适,避免频繁请求
const throttledGetList = throttle(
() => {
getList();
},
500,
{ leading: true, trailing: false }
);
// 点击行
const clickRow = (row) => {
emit('selectRow', row);
};
// 监听搜索关键字和类别编码
watch(
() => [props.searchKey, props.categoryEnum],
([newSearchKey, newCategoryEnum]) => {
queryParams.value.searchKey = newSearchKey;
queryParams.value.categoryEnum = newCategoryEnum; // 直接使用数字类型
throttledGetList();
},
{ immediate: true, deep: true }
);
</script>
<style scoped>
</style>