解决合并冲突
This commit is contained in:
@@ -74,7 +74,12 @@
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="目录分类" prop="categoryCode">
|
||||
<el-select v-model="form.categoryCode" clearable filterable :disabled="false">
|
||||
<el-select
|
||||
v-model="form.categoryCode"
|
||||
clearable
|
||||
filterable
|
||||
:disabled="form.isEditInfoDisable === 1"
|
||||
>
|
||||
<el-option
|
||||
v-for="category in activity_category_code"
|
||||
:key="category.value"
|
||||
@@ -96,18 +101,6 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="8">
|
||||
<el-form-item label="状态" prop="statusEnum">
|
||||
<el-select v-model="form.statusEnum" clearable>
|
||||
<el-option
|
||||
v-for="status in statusFlagOptions"
|
||||
:key="status.value"
|
||||
:label="status.info"
|
||||
:value="status.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col> -->
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="8">
|
||||
@@ -136,6 +129,7 @@
|
||||
clearable
|
||||
filterable
|
||||
style="width: 240px"
|
||||
:disabled="form.isEditInfoDisable === 1"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in med_chrgitm_type"
|
||||
@@ -164,7 +158,7 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="所需标本" prop="specimenCode">
|
||||
<el-select v-model="form.specimenCode" clearable filterable>
|
||||
@@ -181,7 +175,13 @@
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="医保等级" prop="chrgitmLv">
|
||||
<el-select v-model="form.chrgitmLv" placeholder="" clearable filterable>
|
||||
<el-select
|
||||
v-model="form.chrgitmLv"
|
||||
placeholder=""
|
||||
clearable
|
||||
filterable
|
||||
:disabled="form.isEditInfoDisable === 1"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in chrgitm_lv"
|
||||
:key="item.value"
|
||||
@@ -191,18 +191,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="8">
|
||||
<el-form-item label="执行科室" prop="ruleId">
|
||||
<el-select v-model="form.ruleId" placeholder="" clearable>
|
||||
<el-option
|
||||
v-for="item in exeOrganizations"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col> -->
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="使用单位" prop="permittedUnitCode">
|
||||
<el-select v-model="form.permittedUnitCode" clearable filterable>
|
||||
@@ -217,7 +206,12 @@
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="财务类型" prop="itemTypeCode">
|
||||
<el-select v-model="form.itemTypeCode" clearable filterable>
|
||||
<el-select
|
||||
v-model="form.itemTypeCode"
|
||||
clearable
|
||||
filterable
|
||||
:disabled="form.isEditInfoDisable === 1"
|
||||
>
|
||||
<el-option
|
||||
v-for="category in fin_type_code"
|
||||
:key="category.value"
|
||||
@@ -229,22 +223,13 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<!-- <el-col :span="8">
|
||||
<el-form-item label="购入价" prop="purchasePrice">
|
||||
<el-input
|
||||
v-model="form.purchasePrice"
|
||||
placeholder=""
|
||||
:disabled="form.id != undefined"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col> -->
|
||||
<el-col :span="8">
|
||||
<el-form-item label="零售价" prop="retailPrice">
|
||||
<el-input
|
||||
v-model="form.retailPrice"
|
||||
placeholder=""
|
||||
:disabled="false"
|
||||
@input="updatePrices"
|
||||
:disabled="form.isEditInfoDisable === 1"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -268,14 +253,34 @@
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="诊疗子项">
|
||||
<el-select v-model="item.adviceDefinitionId" placeholder="诊疗子项" filterable>
|
||||
<el-option
|
||||
v-for="item in diagnosisTreatmentList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
<div v-if="form.isEditInfoDisable === 0" style="position: relative">
|
||||
<PopoverList @search="handleSearch" :width="1000" :modelValue="item.name">
|
||||
<template #popover-content="{}">
|
||||
<medicineList
|
||||
@selectRow="(row) => selectRow(row, index)"
|
||||
:searchKey="medicineSearchKey"
|
||||
:shouldLoadData="isFirstOpen"
|
||||
:preloadedData="diagnosisTreatmentList"
|
||||
/>
|
||||
</template>
|
||||
</PopoverList>
|
||||
<!-- 清空按钮 -->
|
||||
<el-button
|
||||
v-if="item.name && item.name !== ''"
|
||||
type="text"
|
||||
icon="Delete"
|
||||
size="small"
|
||||
@click.stop="clearItem(index)"
|
||||
style="
|
||||
position: absolute;
|
||||
right: 3px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
color: #909399;
|
||||
"
|
||||
/>
|
||||
</el-select>
|
||||
</div>
|
||||
<span v-else>{{ item.name || '' }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
@@ -285,11 +290,22 @@
|
||||
controls-position="right"
|
||||
:min="1"
|
||||
:max="999"
|
||||
@change="calculateTotalPrice"
|
||||
:disabled="form.isEditInfoDisable === 1"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" style="display: flex; align-items: center; padding-bottom: 15px">
|
||||
<el-button @click="addItem" circle type="priamry" size="small" plain icon="Plus" />
|
||||
<!-- <div style="margin-right: 20px; font-weight: bold; color: #333">
|
||||
小计: ¥{{
|
||||
item.retailPrice && item.childrenRequestNum
|
||||
? (parseFloat(item.retailPrice) * parseInt(item.childrenRequestNum)).toFixed(
|
||||
2
|
||||
)
|
||||
: '0.00'
|
||||
}}
|
||||
</div> -->
|
||||
<el-button @click="addItem" circle type="primary" size="small" plain icon="Plus" />
|
||||
<el-button
|
||||
@click="removeItem(index)"
|
||||
circle
|
||||
@@ -313,6 +329,11 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" style="display: flex; align-items: center; justify-content: flex-start">
|
||||
<div style="font-size: 18px; font-weight: bold; color: #276ef1">
|
||||
总价: ¥{{ totalPrice }}
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer v-if="title != '查看'">
|
||||
@@ -334,7 +355,10 @@ import {
|
||||
bodyTreeSelect,
|
||||
locationTreeSelect,
|
||||
} from './diagnosistreatment';
|
||||
|
||||
import PopoverList from '@/components/OpenHis/popoverList/index.vue';
|
||||
import medicineList from './medicineList.vue';
|
||||
import MedicineList from '../components/medicineList.vue';
|
||||
import { getCurrentInstance, nextTick, watch } from 'vue';
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { unit_code, med_chrgitm_type, fin_type_code, activity_category_code, chrgitm_lv } =
|
||||
proxy.useDict(
|
||||
@@ -348,7 +372,6 @@ const { unit_code, med_chrgitm_type, fin_type_code, activity_category_code, chrg
|
||||
const title = ref('');
|
||||
const visible = ref(false);
|
||||
const emits = defineEmits(['submit']); // 声明自定义事件
|
||||
const categoryCode = ref('');
|
||||
const deptOptions = ref(undefined); // 部门树选项
|
||||
const bodyOptions = ref(undefined); // 身体部位树选项
|
||||
const locationOptions = ref(undefined); // 地点树选项
|
||||
@@ -363,26 +386,16 @@ const data = reactive({
|
||||
rules: {
|
||||
busNo: [{ required: true, message: "编码不能为空", trigger: "blur" }],
|
||||
name: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
|
||||
// statusEnum: [{ required: true, message: "状态不能为空", trigger: "blur" }],
|
||||
categoryCode: [{ required: true, message: '诊疗目录不能为空', trigger: 'blur' }],
|
||||
// typeEnum: [{ required: true, message: '器材种类不能为空', trigger: 'blur' }],
|
||||
permittedUnitCode: [{ required: true, message: '使用单位不能为空', trigger: 'blur' }],
|
||||
// ybFlag: [{ required: true, message: "医保标记不能为空", trigger: "blur" }],
|
||||
// ybMatchFlag: [
|
||||
// { required: true, message: "医保对码标记不能为空", trigger: "blur" },
|
||||
// ],
|
||||
// purchasePrice: [
|
||||
// { required: true, message: "购入价不能为空", trigger: "blur" },
|
||||
// ],
|
||||
retailPrice: [{ required: true, message: '零售价不能为空', trigger: 'blur' }],
|
||||
// maximumRetailPrice: [{ required: true, message: '最高零售价不能为空', trigger: 'blur' }],
|
||||
ybType: [{ required: true, message: '医保类型不能为空', trigger: 'blur' }],
|
||||
chrgitmLv: [{ required: true, message: '医保等级不能为空', trigger: 'blur' }],
|
||||
itemTypeCode: [{ required: true, message: '财务类型不能为空', trigger: 'blur' }],
|
||||
},
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
const { form, rules } = toRefs(data);
|
||||
|
||||
const props = defineProps({
|
||||
item: {
|
||||
@@ -416,17 +429,45 @@ const props = defineProps({
|
||||
});
|
||||
|
||||
// 表单数组,初始一条记录
|
||||
const treatmentItems = ref([{ adviceDefinitionId: '', childrenRequestNum: 1 }]);
|
||||
const treatmentItems = ref([
|
||||
{ adviceDefinitionId: '', childrenRequestNum: 1, name: '', retailPrice: 0 },
|
||||
]);
|
||||
const medicineSearchKey = ref('');
|
||||
const isFirstOpen = ref(true); // 标记是否首次打开弹窗
|
||||
const totalPrice = ref('0.00'); // 总价
|
||||
|
||||
// 计算总价
|
||||
function calculateTotalPrice() {
|
||||
try {
|
||||
let sum = 0;
|
||||
treatmentItems.value.forEach((item) => {
|
||||
if (item.adviceDefinitionId && item.retailPrice && item.childrenRequestNum) {
|
||||
const price = parseFloat(item.retailPrice) || 0;
|
||||
const count = parseInt(item.childrenRequestNum) || 0;
|
||||
sum += price * count;
|
||||
}
|
||||
});
|
||||
totalPrice.value = sum.toFixed(2);
|
||||
} catch (error) {
|
||||
totalPrice.value = '0.00';
|
||||
proxy.$modal.msgWarning('价格计算过程中遇到错误,请检查输入数据');
|
||||
}
|
||||
}
|
||||
|
||||
// 添加表单项
|
||||
function addItem() {
|
||||
treatmentItems.value.push({ adviceDefinitionId: '', childrenRequestNum: 1 });
|
||||
treatmentItems.value.push({ adviceDefinitionId: '', childrenRequestNum: 1, retailPrice: 0 });
|
||||
// 使用nextTick确保DOM更新后再计算
|
||||
nextTick(() => {
|
||||
calculateTotalPrice();
|
||||
});
|
||||
}
|
||||
|
||||
// 删除表单项
|
||||
function removeItem(index) {
|
||||
if (treatmentItems.value.length > 1) {
|
||||
treatmentItems.value.splice(index, 1);
|
||||
calculateTotalPrice();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -438,9 +479,10 @@ function handleImportYb() {
|
||||
function show() {
|
||||
reset();
|
||||
getLocationTree();
|
||||
getItemList();
|
||||
getBodyTree();
|
||||
getDeptTree();
|
||||
getItemList();
|
||||
|
||||
title.value = '';
|
||||
title.value = props.title;
|
||||
diagnosisCategoryOptions.value = props.diagnosisCategoryOptions;
|
||||
@@ -457,9 +499,6 @@ function setValue(row) {
|
||||
ybNo: formatValue(row.medicalCatalogCode), // 医保编码
|
||||
busNo: formatValue(row.medicalCatalogCode), // 项目编码使用医保编码
|
||||
categoryCode: props.currentCategoryEnum,
|
||||
// chrgitmLv: formatValue(
|
||||
// row.insuranceClass == '甲' ? '1' : row.insuranceClass == '乙' ? '2' : '3'
|
||||
// ), // 医保等级
|
||||
};
|
||||
}
|
||||
|
||||
@@ -467,16 +506,24 @@ function setValue(row) {
|
||||
function edit() {
|
||||
reset();
|
||||
getLocationTree();
|
||||
getItemList();
|
||||
getBodyTree();
|
||||
getDeptTree();
|
||||
getItemList();
|
||||
title.value = '';
|
||||
title.value = props.title;
|
||||
form.value = props.item;
|
||||
form.value.chrgitmLv = form.value.chrgitmLv ? form.value.chrgitmLv.toString() : undefined;
|
||||
treatmentItems.value = props.item.childrenJson
|
||||
? JSON.parse(props.item.childrenJson)
|
||||
: [{ adviceDefinitionId: '', childrenRequestNum: 1 }];
|
||||
|
||||
// 处理子项数据,确保包含retailPrice字段
|
||||
if (props.item.childrenJson) {
|
||||
const parsedItems = JSON.parse(props.item.childrenJson);
|
||||
treatmentItems.value = parsedItems.map((item) => ({
|
||||
...item,
|
||||
retailPrice: item.retailPrice || 0,
|
||||
}));
|
||||
} else {
|
||||
treatmentItems.value = [{ adviceDefinitionId: '', childrenRequestNum: 1, retailPrice: 0 }];
|
||||
}
|
||||
form.value.permittedUnitCode = form.value.permittedUnitCode
|
||||
? form.value.permittedUnitCode.toString()
|
||||
: undefined;
|
||||
@@ -485,6 +532,11 @@ function edit() {
|
||||
exeOrganizations.value = props.exeOrganizations;
|
||||
typeEnumOptions.value = props.typeEnumOptions;
|
||||
visible.value = true;
|
||||
|
||||
// 编辑时计算初始总价
|
||||
nextTick(() => {
|
||||
calculateTotalPrice();
|
||||
});
|
||||
}
|
||||
/** 重置操作表单 */
|
||||
function reset() {
|
||||
@@ -514,7 +566,8 @@ function reset() {
|
||||
descriptionText: undefined, // 说明
|
||||
chrgitmLv: undefined, //医保等级
|
||||
};
|
||||
treatmentItems.value = [{ adviceDefinitionId: '', childrenRequestNum: 1 }];
|
||||
treatmentItems.value = [{ adviceDefinitionId: '', childrenRequestNum: 1, retailPrice: 0 }];
|
||||
totalPrice.value = '0.00';
|
||||
proxy.resetForm('diagnosisTreatmentRef');
|
||||
}
|
||||
|
||||
@@ -552,51 +605,74 @@ function submitForm() {
|
||||
/** 查询部门下拉树结构 */
|
||||
function getDeptTree() {
|
||||
deptTreeSelect().then((response) => {
|
||||
console.log(response, 'response查询部门下拉树结构');
|
||||
deptOptions.value = response.data.records;
|
||||
});
|
||||
}
|
||||
/** 查询身体部位拉树结构 */
|
||||
function getBodyTree() {
|
||||
bodyTreeSelect().then((response) => {
|
||||
console.log(response, 'response查询身体部位下拉树结构');
|
||||
bodyOptions.value = response.data.records;
|
||||
});
|
||||
}
|
||||
/** 查询地点下拉树结构 */
|
||||
function getLocationTree() {
|
||||
locationTreeSelect({ formList: '8,4,10' }).then((response) => {
|
||||
console.log(response, 'response查询部门下拉树结构');
|
||||
locationOptions.value = response.data.records;
|
||||
});
|
||||
}
|
||||
|
||||
// 获取诊疗子项列表,只筛出无子项的数据
|
||||
function getItemList() {
|
||||
getDiagnosisTreatmentList({ statusEnum: 2, pageSize: 1000, pageNo: 1 }).then((response) => {
|
||||
diagnosisTreatmentList.value = response.data.records.filter((item) => {
|
||||
return item.childrenJson == null;
|
||||
});
|
||||
});
|
||||
}
|
||||
/** 取消按钮 */
|
||||
function cancel() {
|
||||
visible.value = false;
|
||||
reset();
|
||||
}
|
||||
|
||||
// 获取诊疗子项列表,只筛出无子项的数据
|
||||
function getItemList() {
|
||||
getDiagnosisTreatmentList({ statusEnum: 2, pageSize: 1000, pageNo: 1 }).then((res) => {
|
||||
diagnosisTreatmentList.value = res.data.records.filter((item) => {
|
||||
return item.childrenJson == null;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function formatValue(str) {
|
||||
if (str === null || str === undefined || str === '' || str === 'null') {
|
||||
return undefined;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
function handleSearch(value) {
|
||||
medicineSearchKey.value = value;
|
||||
}
|
||||
|
||||
function selectRow(row, index) {
|
||||
treatmentItems.value[index].name = row.name;
|
||||
treatmentItems.value[index].adviceDefinitionId = row.id;
|
||||
treatmentItems.value[index].retailPrice = row.retailPrice || 0;
|
||||
calculateTotalPrice();
|
||||
}
|
||||
|
||||
// 清空诊疗子项
|
||||
function clearItem(index) {
|
||||
treatmentItems.value[index].name = '';
|
||||
treatmentItems.value[index].adviceDefinitionId = '';
|
||||
treatmentItems.value[index].retailPrice = 0;
|
||||
calculateTotalPrice();
|
||||
}
|
||||
// 在这里可以根据购入价来更新零售价
|
||||
function updatePrices(value) {
|
||||
form.value.maximumRetailPrice = form.value.retailPrice;
|
||||
}
|
||||
|
||||
// 监听treatmentItems变化,实时更新总价
|
||||
watch(
|
||||
() => treatmentItems.value,
|
||||
() => {
|
||||
calculateTotalPrice();
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
defineExpose({
|
||||
show,
|
||||
edit,
|
||||
|
||||
@@ -1,99 +1,106 @@
|
||||
import request from '@/utils/request'
|
||||
import request from '@/utils/request';
|
||||
|
||||
// 查询诊疗目录列表
|
||||
export function getDiagnosisTreatmentList(query) {
|
||||
return request({
|
||||
export function getDiagnosisTreatmentList (query) {
|
||||
return request ({
|
||||
url: '/data-dictionary/diagnosis-treatment/information-page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
params: query,
|
||||
});
|
||||
}
|
||||
|
||||
// 查询诊疗目录详细
|
||||
export function getDiagnosisTreatmentOne(id) {
|
||||
return request({
|
||||
export function getDiagnosisTreatmentOne (id) {
|
||||
return request ({
|
||||
url: '/data-dictionary/diagnosis-treatment/information-one/',
|
||||
method: 'get',
|
||||
params: { id } // 确保参数正确传递
|
||||
})
|
||||
params: {id}, // 确保参数正确传递
|
||||
});
|
||||
}
|
||||
// 查询诊疗目录详细
|
||||
export function validateActivityEdit (activityId) {
|
||||
return request ({
|
||||
url: '/data-dictionary/diagnosis-treatment/validate-edit',
|
||||
method: 'get',
|
||||
params: {activityId}, // 确保参数正确传递
|
||||
});
|
||||
}
|
||||
|
||||
// 新增诊疗目录
|
||||
export function addDiagnosisTreatment(data) {
|
||||
return request({
|
||||
export function addDiagnosisTreatment (data) {
|
||||
return request ({
|
||||
url: '/data-dictionary/diagnosis-treatment/information',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
// 修改诊疗目录
|
||||
export function editDiagnosisTreatment(data) {
|
||||
return request({
|
||||
export function editDiagnosisTreatment (data) {
|
||||
return request ({
|
||||
url: '/data-dictionary/diagnosis-treatment/information',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
// 诊疗目录分类查询
|
||||
export function getDiseaseTreatmentInit() {
|
||||
return request({
|
||||
export function getDiseaseTreatmentInit () {
|
||||
return request ({
|
||||
url: '/data-dictionary/diagnosis-treatment/init',
|
||||
method: 'get'
|
||||
})
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
// 停用诊疗目录
|
||||
export function stopDiseaseTreatment(ids) {
|
||||
console.log(ids)
|
||||
return request({
|
||||
export function stopDiseaseTreatment (ids) {
|
||||
console.log (ids);
|
||||
return request ({
|
||||
url: '/data-dictionary/diagnosis-treatment/information-stop',
|
||||
method: 'put',
|
||||
data: ids
|
||||
})
|
||||
data: ids,
|
||||
});
|
||||
}
|
||||
|
||||
// 启用诊疗目录
|
||||
export function startDiseaseTreatment(ids) {
|
||||
console.log(ids)
|
||||
return request({
|
||||
export function startDiseaseTreatment (ids) {
|
||||
console.log (ids);
|
||||
return request ({
|
||||
url: '/data-dictionary/diagnosis-treatment/information-start',
|
||||
method: 'put',
|
||||
data: ids
|
||||
})
|
||||
data: ids,
|
||||
});
|
||||
}
|
||||
|
||||
// 查询部门树形数据
|
||||
export function deptTreeSelect(queryParams) {
|
||||
return request({
|
||||
export function deptTreeSelect (queryParams) {
|
||||
return request ({
|
||||
url: '/base-data-manage/organization/organization',
|
||||
method: 'get',
|
||||
param: queryParams
|
||||
})
|
||||
param: queryParams,
|
||||
});
|
||||
}
|
||||
// 查询身体部位树形数据
|
||||
export function bodyTreeSelect(queryParams) {
|
||||
return request({
|
||||
export function bodyTreeSelect (queryParams) {
|
||||
return request ({
|
||||
url: '/base-data-manage/body-structure/body',
|
||||
method: 'get',
|
||||
params: queryParams
|
||||
})
|
||||
params: queryParams,
|
||||
});
|
||||
}
|
||||
// 查询地点树形数据
|
||||
export function locationTreeSelect(queryParams) {
|
||||
return request({
|
||||
export function locationTreeSelect (queryParams) {
|
||||
return request ({
|
||||
url: '/base-data-manage/location/location-page-tree',
|
||||
method: 'get',
|
||||
params: queryParams
|
||||
})
|
||||
params: queryParams,
|
||||
});
|
||||
}
|
||||
|
||||
// 获取医用耗材目录
|
||||
export function getYbDiagnosisTreatmentList(queryParams) {
|
||||
return request({
|
||||
export function getYbDiagnosisTreatmentList (queryParams) {
|
||||
return request ({
|
||||
url: '/catalog/page',
|
||||
method: 'get',
|
||||
params: queryParams
|
||||
})
|
||||
params: queryParams,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-table ref="medicineRef" height="300" :data="filteredList" @cell-click="clickRow">
|
||||
<el-table-column label="项目名称" align="center" prop="name" width="300" />
|
||||
<el-table-column label="零售价" align="center" prop="retailPrice" />
|
||||
<el-table-column label="最高零售价" align="center" prop="maximumRetailPrice" />
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getDiagnosisTreatmentList } from './diagnosistreatment';
|
||||
import { ref, watch } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
itemType: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
searchKey: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
shouldLoadData: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
// 新增:从父组件接收预加载的数据
|
||||
preloadedData: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
const emit = defineEmits(['selectRow']);
|
||||
|
||||
const diagnosisTreatmentList = ref([]); // 原始数据列表
|
||||
const filteredList = ref([]); // 过滤后的数据列表
|
||||
const hasLoaded = ref(false); // 标记是否已加载数据
|
||||
|
||||
// 获取诊疗项目列表
|
||||
function getList() {
|
||||
if (hasLoaded.value) return; // 如果已经加载过数据,则不再重复请求
|
||||
|
||||
// 优先使用父组件传递的数据
|
||||
if (props.preloadedData && props.preloadedData.length > 0) {
|
||||
diagnosisTreatmentList.value = props.preloadedData;
|
||||
filterList(); // 初始化过滤
|
||||
hasLoaded.value = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果父组件没有传递数据或数据为空,则自己请求
|
||||
getDiagnosisTreatmentList({ statusEnum: 2, pageSize: 1000, pageNo: 1 })
|
||||
.then((res) => {
|
||||
diagnosisTreatmentList.value =
|
||||
res.data?.records?.filter((item) => item.childrenJson == null) || [];
|
||||
filterList(); // 初始化过滤
|
||||
hasLoaded.value = true; // 标记为已加载
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error('获取诊疗项目数据失败:', err);
|
||||
});
|
||||
}
|
||||
|
||||
// 监听shouldLoadData属性变化,仅在首次为true时加载数据
|
||||
watch(
|
||||
() => props.shouldLoadData,
|
||||
(newValue) => {
|
||||
if (newValue && !hasLoaded.value) {
|
||||
getList();
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
// 监听preloadedData变化,当父组件数据更新时同步更新列表
|
||||
watch(
|
||||
() => props.preloadedData,
|
||||
(newData) => {
|
||||
if (newData && newData.length > 0) {
|
||||
diagnosisTreatmentList.value = newData;
|
||||
filterList(); // 更新过滤
|
||||
hasLoaded.value = true;
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
// 监听搜索关键词变化,实时过滤数据
|
||||
watch(
|
||||
() => props.searchKey,
|
||||
() => {
|
||||
filterList();
|
||||
}
|
||||
);
|
||||
|
||||
// 根据搜索关键词过滤列表
|
||||
function filterList() {
|
||||
if (!props.searchKey || props.searchKey.trim() === '') {
|
||||
filteredList.value = diagnosisTreatmentList.value;
|
||||
} else {
|
||||
const searchTerm = props.searchKey.toLowerCase().trim();
|
||||
filteredList.value = diagnosisTreatmentList.value.filter(
|
||||
(item) => item.name && item.name.toLowerCase().includes(searchTerm)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function clickRow(row) {
|
||||
emit('selectRow', row);
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
Reference in New Issue
Block a user