1. 配送仓库
This commit is contained in:
@@ -571,6 +571,8 @@ export const usePrescriptionStore = defineStore('prescription', () => {
|
||||
frequency_id: data.drug.frequency_id,
|
||||
unit_id: data.drug.unit_id,
|
||||
image: data.drug.image,
|
||||
// 规格(选仓弹窗等处展示)
|
||||
specification: data.drug?.specification || data.specification || '',
|
||||
instruction: data.drug.instruction,
|
||||
type: data.drug.type,
|
||||
select_number: (() => {
|
||||
@@ -701,6 +703,8 @@ export const usePrescriptionStore = defineStore('prescription', () => {
|
||||
frequency_id: data.drug.frequency_id,
|
||||
unit_id: data.drug.unit_id,
|
||||
image: data.drug.image,
|
||||
// 规格(选仓弹窗等处展示)
|
||||
specification: data.drug?.specification || data.specification || '',
|
||||
instruction: data.drug.instruction,
|
||||
type: data.drug.type,
|
||||
};
|
||||
@@ -987,8 +991,13 @@ export const usePrescriptionStore = defineStore('prescription', () => {
|
||||
// 诊所选择参数(转诊挂号时自动使用承接方诊所ID)
|
||||
send_mode: finalSendMode,
|
||||
custom_store_id: finalSendMode === 1 ? finalStoreId : null,
|
||||
// 药店按药选配送仓映射 drug_id -> warehouse_id
|
||||
warehouse_map: warehouseMap || undefined,
|
||||
// 在线复诊手选仓:列表格式避免数字键对象序列化丢失
|
||||
warehouse_map: warehouseMap
|
||||
? Object.entries(warehouseMap).map(([drug_id, warehouse_id]) => ({
|
||||
drug_id: Number(drug_id),
|
||||
warehouse_id: Number(warehouse_id),
|
||||
}))
|
||||
: undefined,
|
||||
});
|
||||
|
||||
const res = await response;
|
||||
@@ -1019,7 +1028,9 @@ export const usePrescriptionStore = defineStore('prescription', () => {
|
||||
userStore.currentUser.doctor_id,
|
||||
);
|
||||
resetForm();
|
||||
|
||||
// 发送成功后清空本挂号下全部分类草稿(含另一分类与 activeCategory)
|
||||
clearLocalPrescriptionCache();
|
||||
|
||||
// 返回包含转诊信息的响应数据
|
||||
return {
|
||||
success: true,
|
||||
@@ -1034,6 +1045,33 @@ export const usePrescriptionStore = defineStore('prescription', () => {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 清除当前挂号会话的处方 localStorage 草稿
|
||||
* 原因:resetForm 只会把当前分类写成空数组,另一分类与 activeCategory 会残留,再次打开仍会回填
|
||||
*/
|
||||
const clearLocalPrescriptionCache = () => {
|
||||
const registerId = currentRegisterId.value;
|
||||
if (!registerId) return;
|
||||
try {
|
||||
// 与小程序 PrescriptionStorage.clearAllPrescriptionData 对齐的分类集合
|
||||
const categories = [1, 2, 3, 5, 6, 7];
|
||||
categories.forEach((cat) => {
|
||||
localStorage.removeItem(
|
||||
`${storagePrefix.value}prescriptionData_${cat}_${registerId}`,
|
||||
);
|
||||
// 清理历史双横线孤儿 key(旧版弹窗 `${prefix}-prescriptionData_`)
|
||||
localStorage.removeItem(
|
||||
`${storagePrefix.value}-prescriptionData_${cat}_${registerId}`,
|
||||
);
|
||||
});
|
||||
localStorage.removeItem(
|
||||
`${storagePrefix.value}activeCategory${registerId}`,
|
||||
);
|
||||
} catch (error) {
|
||||
console.error('清除处方本地缓存失败:', error);
|
||||
}
|
||||
};
|
||||
|
||||
const resetForm = () => {
|
||||
updateCurrentDrugs([]);
|
||||
diagnosis.value = '';
|
||||
@@ -1168,6 +1206,7 @@ export const usePrescriptionStore = defineStore('prescription', () => {
|
||||
checkChineseMedicineConflict,
|
||||
sendPrescription,
|
||||
resetForm,
|
||||
clearLocalPrescriptionCache,
|
||||
changeCategory,
|
||||
getProcessRuleListData,
|
||||
splitString,
|
||||
|
||||
Reference in New Issue
Block a user