|
@@ -34,7 +34,6 @@
|
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
- <!-- 新增红色提示文字 -->
|
|
|
|
|
<div style="color: #f56c6c; font-size: 12px; margin-top: 8px; text-align: center;">
|
|
<div style="color: #f56c6c; font-size: 12px; margin-top: 8px; text-align: center;">
|
|
|
处方类型选择后不可修改,请谨慎选择!
|
|
处方类型选择后不可修改,请谨慎选择!
|
|
|
</div>
|
|
</div>
|
|
@@ -120,9 +119,11 @@
|
|
|
<!-- 右侧处方图片渲染 -->
|
|
<!-- 右侧处方图片渲染 -->
|
|
|
<div class="drug-right-panel">
|
|
<div class="drug-right-panel">
|
|
|
<div class="prescription-scroll-wrapper">
|
|
<div class="prescription-scroll-wrapper">
|
|
|
|
|
+ <!-- 真实处方图片优先 -->
|
|
|
<div v-if="prescribeForm.prescribeImgUrl" class="real-prescription-wrapper">
|
|
<div v-if="prescribeForm.prescribeImgUrl" class="real-prescription-wrapper">
|
|
|
<img :src="prescribeForm.prescribeImgUrl" class="prescription-image" alt="处方图片" />
|
|
<img :src="prescribeForm.prescribeImgUrl" class="prescription-image" alt="处方图片" />
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ <!-- 无真实图片时显示背景预览 -->
|
|
|
<div v-else class="prescription-preview-container">
|
|
<div v-else class="prescription-preview-container">
|
|
|
<img src="/ysy_prescribe.jpg" class="prescription-bg-image" alt="处方背景" />
|
|
<img src="/ysy_prescribe.jpg" class="prescription-bg-image" alt="处方背景" />
|
|
|
<div class="prescription-overlay">
|
|
<div class="prescription-overlay">
|
|
@@ -134,7 +135,7 @@
|
|
|
</div>
|
|
</div>
|
|
|
<div class="diagnose">{{ prescribeForm.diagnose }}</div>
|
|
<div class="diagnose">{{ prescribeForm.diagnose }}</div>
|
|
|
<div class="drugs">
|
|
<div class="drugs">
|
|
|
- <div v-for="(drug, idx) in currentDrugList" :key="idx" class="drug-item">
|
|
|
|
|
|
|
+ <div v-for="(drug, idx) in currentDrugList" :key="drug.drugId || idx" class="drug-item">
|
|
|
{{ drug.drugName }} {{ drug.drugSpec }}
|
|
{{ drug.drugName }} {{ drug.drugSpec }}
|
|
|
<span class="usage">用法:{{ drug.usageMethod }} {{ drug.usageFrequencyUnit }} {{ drug.usagePerUseCount }}{{ drug.usagePerUseUnit || '' }}</span>
|
|
<span class="usage">用法:{{ drug.usageMethod }} {{ drug.usageFrequencyUnit }} {{ drug.usagePerUseCount }}{{ drug.usagePerUseUnit || '' }}</span>
|
|
|
</div>
|
|
</div>
|
|
@@ -195,7 +196,7 @@
|
|
|
</div>
|
|
</div>
|
|
|
<div class="diagnose">{{ prescribeForm.diagnose }}</div>
|
|
<div class="diagnose">{{ prescribeForm.diagnose }}</div>
|
|
|
<div class="drugs">
|
|
<div class="drugs">
|
|
|
- <div v-for="(drug, idx) in secondDrugList" :key="idx" class="drug-item">
|
|
|
|
|
|
|
+ <div v-for="(drug, idx) in secondDrugList" :key="drug.drugId || idx" class="drug-item">
|
|
|
{{ drug.drugName }} {{ drug.drugSpec }}
|
|
{{ drug.drugName }} {{ drug.drugSpec }}
|
|
|
<span class="usage">用法:{{ drug.usageMethod }} {{ drug.usageFrequencyUnit }} {{ drug.usagePerUseCount }}{{ drug.usagePerUseUnit || '' }}</span>
|
|
<span class="usage">用法:{{ drug.usageMethod }} {{ drug.usageFrequencyUnit }} {{ drug.usagePerUseCount }}{{ drug.usagePerUseUnit || '' }}</span>
|
|
|
</div>
|
|
</div>
|
|
@@ -260,7 +261,7 @@
|
|
|
</div>
|
|
</div>
|
|
|
<div class="diagnose">{{ prescribeForm.diagnose }}</div>
|
|
<div class="diagnose">{{ prescribeForm.diagnose }}</div>
|
|
|
<div class="drugs">
|
|
<div class="drugs">
|
|
|
- <div v-for="(drug, idx) in currentDrugList" :key="idx" class="drug-item">
|
|
|
|
|
|
|
+ <div v-for="(drug, idx) in currentDrugList" :key="drug.drugId || idx" class="drug-item">
|
|
|
{{ drug.drugName }} {{ drug.drugSpec }}
|
|
{{ drug.drugName }} {{ drug.drugSpec }}
|
|
|
<span class="usage">用法:{{ drug.usageMethod }} {{ drug.usageFrequencyUnit }} {{ drug.usagePerUseCount }}{{ drug.usagePerUseUnit || '' }}</span>
|
|
<span class="usage">用法:{{ drug.usageMethod }} {{ drug.usageFrequencyUnit }} {{ drug.usagePerUseCount }}{{ drug.usagePerUseUnit || '' }}</span>
|
|
|
</div>
|
|
</div>
|
|
@@ -301,7 +302,7 @@
|
|
|
</div>
|
|
</div>
|
|
|
<div class="diagnose">{{ prescribeForm.diagnose }}</div>
|
|
<div class="diagnose">{{ prescribeForm.diagnose }}</div>
|
|
|
<div class="drugs">
|
|
<div class="drugs">
|
|
|
- <div v-for="(drug, idx) in secondDrugList" :key="idx" class="drug-item">
|
|
|
|
|
|
|
+ <div v-for="(drug, idx) in secondDrugList" :key="drug.drugId || idx" class="drug-item">
|
|
|
{{ drug.drugName }} {{ drug.drugSpec }}
|
|
{{ drug.drugName }} {{ drug.drugSpec }}
|
|
|
<span class="usage">用法:{{ drug.usageMethod }} {{ drug.usageFrequencyUnit }} {{ drug.usagePerUseCount }}{{ drug.usagePerUseUnit || '' }}</span>
|
|
<span class="usage">用法:{{ drug.usageMethod }} {{ drug.usageFrequencyUnit }} {{ drug.usagePerUseCount }}{{ drug.usagePerUseUnit || '' }}</span>
|
|
|
</div>
|
|
</div>
|
|
@@ -329,7 +330,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
- <!-- 药品新增/编辑对话框(只读模式下不会弹出,因为按钮已隐藏,可保留) -->
|
|
|
|
|
|
|
+ <!-- 药品新增/编辑对话框 -->
|
|
|
<el-dialog :title="drugDialogTitle" :visible.sync="drugDialogVisible" width="600px" append-to-body>
|
|
<el-dialog :title="drugDialogTitle" :visible.sync="drugDialogVisible" width="600px" append-to-body>
|
|
|
<el-form ref="drugFormRef" :model="currentDrug" label-width="120px">
|
|
<el-form ref="drugFormRef" :model="currentDrug" label-width="120px">
|
|
|
<el-form-item label="药品名称" prop="drugName"><el-input v-model="currentDrug.drugName" /></el-form-item>
|
|
<el-form-item label="药品名称" prop="drugName"><el-input v-model="currentDrug.drugName" /></el-form-item>
|
|
@@ -494,8 +495,8 @@ export default {
|
|
|
if (data.prescribeType) {
|
|
if (data.prescribeType) {
|
|
|
this.selectedPrescribeType = data.prescribeType;
|
|
this.selectedPrescribeType = data.prescribeType;
|
|
|
this.isCombined = (this.selectedPrescribeType === 3);
|
|
this.isCombined = (this.selectedPrescribeType === 3);
|
|
|
- // 只读模式下不需要步骤,直接加载数据即可
|
|
|
|
|
- this.activeStep = this.readonly ? 1 : 1; // 只读模式也设置 activeStep 以便展示内容
|
|
|
|
|
|
|
+ // 只读模式直接加载数据
|
|
|
|
|
+ this.activeStep = this.readonly ? 1 : 1;
|
|
|
this.loadDrugsForCurrentPart();
|
|
this.loadDrugsForCurrentPart();
|
|
|
}
|
|
}
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
@@ -503,17 +504,23 @@ export default {
|
|
|
this.$message.error('获取处方信息失败');
|
|
this.$message.error('获取处方信息失败');
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ // 获取当前药品类型(用于新增时设置)
|
|
|
getCurrentDrugType() {
|
|
getCurrentDrugType() {
|
|
|
if (this.commonDrugForSecond) return 2;
|
|
if (this.commonDrugForSecond) return 2;
|
|
|
- if (this.isCombined && !this.secondPartActive && this.activeStep === 1) return 1;
|
|
|
|
|
if (this.isCombined && this.secondPartActive && this.activeStep === 2) return 2;
|
|
if (this.isCombined && this.secondPartActive && this.activeStep === 2) return 2;
|
|
|
- if (this.selectedPrescribeType === 1) return 1;
|
|
|
|
|
- if (this.selectedPrescribeType === 2) return 2;
|
|
|
|
|
- return 1;
|
|
|
|
|
|
|
+ if (this.isCombined && !this.secondPartActive && this.activeStep === 1) return 1;
|
|
|
|
|
+ // 单一处方
|
|
|
|
|
+ return this.selectedPrescribeType === 1 ? 1 : 2;
|
|
|
},
|
|
},
|
|
|
onPrescribeTypeChange(val) {
|
|
onPrescribeTypeChange(val) {
|
|
|
this.isCombined = (val === 3);
|
|
this.isCombined = (val === 3);
|
|
|
- if (!this.isCombined) this.secondPartActive = false;
|
|
|
|
|
|
|
+ if (!this.isCombined) {
|
|
|
|
|
+ this.secondPartActive = false;
|
|
|
|
|
+ // 如果当前在步骤2但取消组合,应回退
|
|
|
|
|
+ if (this.activeStep === 2) {
|
|
|
|
|
+ this.activeStep = 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
nextStep() {
|
|
nextStep() {
|
|
|
if (this.activeStep === 0) {
|
|
if (this.activeStep === 0) {
|
|
@@ -524,13 +531,23 @@ export default {
|
|
|
this.isCombined = (this.selectedPrescribeType === 3);
|
|
this.isCombined = (this.selectedPrescribeType === 3);
|
|
|
if (this.isCombined) this.secondPartActive = false;
|
|
if (this.isCombined) this.secondPartActive = false;
|
|
|
this.activeStep = 1;
|
|
this.activeStep = 1;
|
|
|
|
|
+ // 清空之前可能遗留的药品列表,重新加载
|
|
|
|
|
+ this.drugList = [];
|
|
|
|
|
+ this.drugTotal = 0;
|
|
|
this.loadDrugsForCurrentPart();
|
|
this.loadDrugsForCurrentPart();
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
prevStep() {
|
|
prevStep() {
|
|
|
if (this.activeStep > 0) {
|
|
if (this.activeStep > 0) {
|
|
|
|
|
+ if (this.activeStep === 2) {
|
|
|
|
|
+ // 从第二步回到第一步,重置中药激活状态
|
|
|
|
|
+ this.secondPartActive = false;
|
|
|
|
|
+ }
|
|
|
this.activeStep--;
|
|
this.activeStep--;
|
|
|
if (this.activeStep === 1 && this.isCombined) {
|
|
if (this.activeStep === 1 && this.isCombined) {
|
|
|
|
|
+ // 重新加载西药列表(清空之前的list确保刷新)
|
|
|
|
|
+ this.drugList = [];
|
|
|
|
|
+ this.drugTotal = 0;
|
|
|
this.loadDrugsForCurrentPart();
|
|
this.loadDrugsForCurrentPart();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -544,11 +561,19 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
getDrugList() {
|
|
getDrugList() {
|
|
|
- let drugType = null;
|
|
|
|
|
- if (this.isCombined && !this.secondPartActive) drugType = 1;
|
|
|
|
|
- else if (this.selectedPrescribeType === 1) drugType = 1;
|
|
|
|
|
- else if (this.selectedPrescribeType === 2) drugType = 2;
|
|
|
|
|
- else drugType = this.selectedPrescribeType;
|
|
|
|
|
|
|
+ // 确定药品类型:组合处方且未进入中药部分 => 西药(1),否则根据 selectedPrescribeType
|
|
|
|
|
+ let drugType = 1;
|
|
|
|
|
+ if (this.isCombined && !this.secondPartActive) {
|
|
|
|
|
+ drugType = 1;
|
|
|
|
|
+ } else if (this.selectedPrescribeType === 1) {
|
|
|
|
|
+ drugType = 1;
|
|
|
|
|
+ } else if (this.selectedPrescribeType === 2) {
|
|
|
|
|
+ drugType = 2;
|
|
|
|
|
+ } else if (this.selectedPrescribeType === 3 && this.secondPartActive) {
|
|
|
|
|
+ drugType = 2; // 但此方法通常不被调用,以防万一
|
|
|
|
|
+ } else {
|
|
|
|
|
+ drugType = this.selectedPrescribeType || 1;
|
|
|
|
|
+ }
|
|
|
this.drugQuery.prescribeId = this.prescribeId;
|
|
this.drugQuery.prescribeId = this.prescribeId;
|
|
|
this.drugQuery.drugType = drugType;
|
|
this.drugQuery.drugType = drugType;
|
|
|
listScrmPrescribeDrug(this.drugQuery).then(res => {
|
|
listScrmPrescribeDrug(this.drugQuery).then(res => {
|
|
@@ -565,6 +590,7 @@ export default {
|
|
|
}).catch(() => this.$message.error('获取中药列表失败'));
|
|
}).catch(() => this.$message.error('获取中药列表失败'));
|
|
|
},
|
|
},
|
|
|
async goToSecondPart() {
|
|
async goToSecondPart() {
|
|
|
|
|
+ // 校验西药表单
|
|
|
let valid = true;
|
|
let valid = true;
|
|
|
await this.$refs.basicForm.validate().catch(() => valid = false);
|
|
await this.$refs.basicForm.validate().catch(() => valid = false);
|
|
|
await this.$refs.drugForm.validate().catch((errors) => {
|
|
await this.$refs.drugForm.validate().catch((errors) => {
|
|
@@ -591,6 +617,9 @@ export default {
|
|
|
this.$message.success('西药处方信息已保存');
|
|
this.$message.success('西药处方信息已保存');
|
|
|
this.secondPartActive = true;
|
|
this.secondPartActive = true;
|
|
|
this.activeStep = 2;
|
|
this.activeStep = 2;
|
|
|
|
|
+ // 加载中药列表
|
|
|
|
|
+ this.secondDrugList = [];
|
|
|
|
|
+ this.secondDrugTotal = 0;
|
|
|
this.getSecondDrugList();
|
|
this.getSecondDrugList();
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
this.$message.error('保存失败');
|
|
this.$message.error('保存失败');
|
|
@@ -600,13 +629,13 @@ export default {
|
|
|
},
|
|
},
|
|
|
handleAddDrug() {
|
|
handleAddDrug() {
|
|
|
this.isEditingSecond = false;
|
|
this.isEditingSecond = false;
|
|
|
- this.currentDrug = { drugType: 1 };
|
|
|
|
|
|
|
+ this.currentDrug = {drugType: 1};
|
|
|
this.drugDialogTitle = '新增药品(西药)';
|
|
this.drugDialogTitle = '新增药品(西药)';
|
|
|
this.drugDialogVisible = true;
|
|
this.drugDialogVisible = true;
|
|
|
},
|
|
},
|
|
|
handleEditDrug(row) {
|
|
handleEditDrug(row) {
|
|
|
this.isEditingSecond = false;
|
|
this.isEditingSecond = false;
|
|
|
- this.currentDrug = { ...row };
|
|
|
|
|
|
|
+ this.currentDrug = {...row};
|
|
|
this.drugDialogTitle = '编辑药品';
|
|
this.drugDialogTitle = '编辑药品';
|
|
|
this.drugDialogVisible = true;
|
|
this.drugDialogVisible = true;
|
|
|
},
|
|
},
|
|
@@ -620,6 +649,10 @@ export default {
|
|
|
},
|
|
},
|
|
|
saveDrug() {
|
|
saveDrug() {
|
|
|
this.currentDrug.prescribeId = this.prescribeId;
|
|
this.currentDrug.prescribeId = this.prescribeId;
|
|
|
|
|
+ // 确保drugType正确
|
|
|
|
|
+ if (!this.currentDrug.drugType) {
|
|
|
|
|
+ this.currentDrug.drugType = this.isEditingSecond ? 2 : 1;
|
|
|
|
|
+ }
|
|
|
if (!this.currentDrug.drugName) {
|
|
if (!this.currentDrug.drugName) {
|
|
|
this.$message.warning('请填写药品名称');
|
|
this.$message.warning('请填写药品名称');
|
|
|
return;
|
|
return;
|
|
@@ -628,19 +661,22 @@ export default {
|
|
|
request.then(() => {
|
|
request.then(() => {
|
|
|
this.$message.success('保存成功');
|
|
this.$message.success('保存成功');
|
|
|
this.drugDialogVisible = false;
|
|
this.drugDialogVisible = false;
|
|
|
- if (!this.isEditingSecond) this.getDrugList();
|
|
|
|
|
- else this.getSecondDrugList();
|
|
|
|
|
|
|
+ if (this.isEditingSecond) {
|
|
|
|
|
+ this.getSecondDrugList();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.getDrugList();
|
|
|
|
|
+ }
|
|
|
}).catch(() => this.$message.error('保存失败'));
|
|
}).catch(() => this.$message.error('保存失败'));
|
|
|
},
|
|
},
|
|
|
handleAddDrugSecond() {
|
|
handleAddDrugSecond() {
|
|
|
this.isEditingSecond = true;
|
|
this.isEditingSecond = true;
|
|
|
- this.currentDrug = { drugType: 2 };
|
|
|
|
|
|
|
+ this.currentDrug = {drugType: 2};
|
|
|
this.drugDialogTitle = '新增药品(中药)';
|
|
this.drugDialogTitle = '新增药品(中药)';
|
|
|
this.drugDialogVisible = true;
|
|
this.drugDialogVisible = true;
|
|
|
},
|
|
},
|
|
|
handleEditDrugSecond(row) {
|
|
handleEditDrugSecond(row) {
|
|
|
this.isEditingSecond = true;
|
|
this.isEditingSecond = true;
|
|
|
- this.currentDrug = { ...row };
|
|
|
|
|
|
|
+ this.currentDrug = {...row};
|
|
|
this.drugDialogTitle = '编辑药品';
|
|
this.drugDialogTitle = '编辑药品';
|
|
|
this.drugDialogVisible = true;
|
|
this.drugDialogVisible = true;
|
|
|
},
|
|
},
|
|
@@ -775,6 +811,7 @@ export default {
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
<style scoped>
|
|
|
|
|
+/* 样式保持不变,与您原代码一致 */
|
|
|
.drug-split-layout {
|
|
.drug-split-layout {
|
|
|
display: flex;
|
|
display: flex;
|
|
|
gap: 20px;
|
|
gap: 20px;
|