feat(medicalOrderSet): 优化医嘱组套功能实现
- 实现医嘱基础列表的分页功能,添加loading状态和缓存机制 - 添加防抖处理和组织机构ID参数支持,优化性能表现 - 实现医嘱组套的完整编辑功能,包括增删改查操作界面 - 添加医嘱组套预览、应用和管理功能模块 - 实现西医组套筛选功能,确保tcmFlag参数正确传递 - 优化医嘱组套数据结构,完善明细项信息处理逻辑 - 添加表单验证和错误处理,提升用户体验和系统稳定性 - 重构代码结构,采用响应式设计提高可维护性
This commit is contained in:
@@ -401,10 +401,10 @@ const { method_code, rate_code, distribution_category_code } = proxy.useDict(
|
||||
'rate_code',
|
||||
'distribution_category_code'
|
||||
);
|
||||
// 查询参数
|
||||
const personalQuery = reactive({ searchKey: '' });
|
||||
const departmentQuery = reactive({ searchKey: '' });
|
||||
const hospitalQuery = reactive({ searchKey: '' });
|
||||
// 查询参数 - 西医组套 tcmFlag = 0
|
||||
const personalQuery = reactive({ searchKey: '', tcmFlag: 0 });
|
||||
const departmentQuery = reactive({ searchKey: '', tcmFlag: 0 });
|
||||
const hospitalQuery = reactive({ searchKey: '', tcmFlag: 0 });
|
||||
|
||||
// 加载状态
|
||||
const loading = reactive({
|
||||
@@ -462,18 +462,15 @@ function getInit() {
|
||||
});
|
||||
}
|
||||
|
||||
// 获取所有数据
|
||||
function fetchAllData(params = {}) {
|
||||
getPersonalListData(params);
|
||||
getDepartmentListData(params);
|
||||
getHospitalListData(params);
|
||||
// 获取所有数据(不传参,保留查询框已有的参数)
|
||||
function fetchAllData() {
|
||||
getPersonalListData();
|
||||
getDepartmentListData();
|
||||
getHospitalListData();
|
||||
}
|
||||
|
||||
// 获取个人医嘱列表
|
||||
function getPersonalListData(params = {}) {
|
||||
// 合并查询参数
|
||||
Object.assign(personalQuery, params);
|
||||
|
||||
function getPersonalListData() {
|
||||
loading.personal = true;
|
||||
getPersonalList(personalQuery)
|
||||
.then((response) => {
|
||||
@@ -488,10 +485,7 @@ function getPersonalListData(params = {}) {
|
||||
}
|
||||
|
||||
// 获取科室医嘱列表
|
||||
function getDepartmentListData(params = {}) {
|
||||
// 合并查询参数
|
||||
Object.assign(departmentQuery, params);
|
||||
|
||||
function getDepartmentListData() {
|
||||
loading.department = true;
|
||||
getDeptList(departmentQuery)
|
||||
.then((response) => {
|
||||
@@ -506,10 +500,7 @@ function getDepartmentListData(params = {}) {
|
||||
}
|
||||
|
||||
// 获取全院医嘱列表
|
||||
function getHospitalListData(params = {}) {
|
||||
// 合并查询参数
|
||||
Object.assign(hospitalQuery, params);
|
||||
|
||||
function getHospitalListData() {
|
||||
loading.hospital = true;
|
||||
getAllList(hospitalQuery)
|
||||
.then((response) => {
|
||||
@@ -627,10 +618,11 @@ function submitForm() {
|
||||
if (valid) {
|
||||
submitLoading.value = true;
|
||||
|
||||
// 模拟提交操作(这里应该调用相应的API)
|
||||
setTimeout(() => {
|
||||
console.log('提交表单数据:', formData);
|
||||
let params = { ...formData };
|
||||
// 提交数据
|
||||
console.log('提交表单数据:', formData);
|
||||
let params = { ...formData };
|
||||
// 添加 tcmFlag:西医组套为 0
|
||||
params.tcmFlag = 0;
|
||||
// 过滤掉空列表项(没有adviceDefinitionId的项)
|
||||
params.detailList = prescriptionList.value
|
||||
.filter((item) => item.adviceDefinitionId) // 过滤掉空列表项
|
||||
@@ -647,49 +639,70 @@ function submitForm() {
|
||||
doseQuantity: item.doseQuantity,
|
||||
};
|
||||
});
|
||||
console.log('保存参数:', params);
|
||||
// 编辑模式
|
||||
switch (currentTab.value) {
|
||||
case 'personal':
|
||||
savePersonal(params).then((res) => {
|
||||
console.log('保存个人组套返回:', res);
|
||||
if (res.code === 200) {
|
||||
ElMessage.success(res.message);
|
||||
ElMessage.success(res.msg || '保存成功');
|
||||
// 重新获取数据以保持一致性
|
||||
fetchAllData();
|
||||
} else {
|
||||
ElMessage.error(res.msg || '保存失败');
|
||||
}
|
||||
submitLoading.value = false;
|
||||
dialogVisible.value = false;
|
||||
// 清空处方列表
|
||||
prescriptionList.value = [];
|
||||
}).catch((err) => {
|
||||
console.error('保存个人组套失败:', err);
|
||||
ElMessage.error('保存失败: ' + (err.message || '未知错误'));
|
||||
submitLoading.value = false;
|
||||
});
|
||||
break;
|
||||
case 'department':
|
||||
saveDepartment(params).then((res) => {
|
||||
console.log('保存科室组套返回:', res);
|
||||
if (res.code === 200) {
|
||||
ElMessage.success(res.message);
|
||||
ElMessage.success(res.msg || '保存成功');
|
||||
// 重新获取数据以保持一致性
|
||||
fetchAllData();
|
||||
} else {
|
||||
ElMessage.error(res.msg || '保存失败');
|
||||
}
|
||||
submitLoading.value = false;
|
||||
dialogVisible.value = false;
|
||||
// 清空处方列表
|
||||
prescriptionList.value = [];
|
||||
}).catch((err) => {
|
||||
console.error('保存科室组套失败:', err);
|
||||
ElMessage.error('保存失败: ' + (err.message || '未知错误'));
|
||||
submitLoading.value = false;
|
||||
});
|
||||
break;
|
||||
case 'hospital':
|
||||
saveAll(params).then((res) => {
|
||||
console.log('保存全院组套返回:', res);
|
||||
if (res.code === 200) {
|
||||
ElMessage.success(res.message);
|
||||
ElMessage.success(res.msg || '保存成功');
|
||||
// 重新获取数据以保持一致性
|
||||
fetchAllData();
|
||||
} else {
|
||||
ElMessage.error(res.msg || '保存失败');
|
||||
}
|
||||
submitLoading.value = false;
|
||||
dialogVisible.value = false;
|
||||
// 清空处方列表
|
||||
prescriptionList.value = [];
|
||||
}).catch((err) => {
|
||||
console.error('保存全院组套失败:', err);
|
||||
ElMessage.error('保存失败: ' + (err.message || '未知错误'));
|
||||
submitLoading.value = false;
|
||||
});
|
||||
break;
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -728,6 +741,10 @@ function handleFocus(row, index) {
|
||||
row.showPopover = true;
|
||||
// 将输入框的值传递给adviceBaseList组件作为查询条件
|
||||
adviceQueryParams.searchKey = row.adviceName || '';
|
||||
// 获取当前登录用户的科室ID
|
||||
const userStore = useUserStore();
|
||||
adviceQueryParams.organizationId = userStore.orgId;
|
||||
console.log('handleFocus - organizationId:', userStore.orgId, 'userStore:', userStore);
|
||||
}
|
||||
|
||||
// 处理输入事件
|
||||
|
||||
Reference in New Issue
Block a user