|
|
@@ -176,7 +176,7 @@
|
|
|
></el-input>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="数量" width="60" align="center">
|
|
|
+ <el-table-column label="数量" width="80" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<el-input-number
|
|
|
size="mini"
|
|
|
@@ -283,7 +283,7 @@
|
|
|
></el-input>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="数量" width="60" align="center">
|
|
|
+ <el-table-column label="数量" width="80" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<el-input-number
|
|
|
size="mini"
|
|
|
@@ -681,7 +681,7 @@ export default {
|
|
|
singlePrice: "0.00",
|
|
|
coursePrice: "0.00",
|
|
|
totalPrice: "0.00",
|
|
|
- // 处方 tab
|
|
|
+ // 处方 tab
|
|
|
activeIndex: 0,
|
|
|
prescriptionDataMap: {},
|
|
|
// 新增处方弹窗
|
|
|
@@ -722,14 +722,39 @@ export default {
|
|
|
const p = this.prescriptions[this.activeIndex];
|
|
|
return p?.pricingUnit || "";
|
|
|
},
|
|
|
+ // 当前处方的单次数量模式:"0"=默认1,"1"=详情累计/计数系数
|
|
|
+ currentSingleNumber() {
|
|
|
+ const p = this.prescriptions[this.activeIndex];
|
|
|
+ return p?.singleNumber || "0";
|
|
|
+ },
|
|
|
+ // 当前处方的计数系数
|
|
|
+ currentCountCoefficient() {
|
|
|
+ const p = this.prescriptions[this.activeIndex];
|
|
|
+ return Number(p?.countCoefficient) || 1;
|
|
|
+ },
|
|
|
+ // 当前处方的详情累计项名称列表,如 ["穴位", "耳穴"]
|
|
|
+ currentDetailCumulativeTypes() {
|
|
|
+ const p = this.prescriptions[this.activeIndex];
|
|
|
+ const val = p?.detailCumulative || "";
|
|
|
+ if (!val) return [];
|
|
|
+ const CUMULATIVE_MAP = {
|
|
|
+ "1": "穴位",
|
|
|
+ "2": "部位",
|
|
|
+ "3": "耳穴",
|
|
|
+ "4": "经络",
|
|
|
+ "5": "其他详情",
|
|
|
+ };
|
|
|
+ return String(val)
|
|
|
+ .split(/[,、]/)
|
|
|
+ .filter(Boolean)
|
|
|
+ .map((v) => CUMULATIVE_MAP[v.trim()])
|
|
|
+ .filter(Boolean);
|
|
|
+ },
|
|
|
},
|
|
|
watch: {
|
|
|
- singleCount() {
|
|
|
- this.updatePrice();
|
|
|
- },
|
|
|
detailTables: {
|
|
|
handler() {
|
|
|
- this.calcPrice();
|
|
|
+ this.updatePrice();
|
|
|
},
|
|
|
deep: true,
|
|
|
},
|
|
|
@@ -742,7 +767,6 @@ export default {
|
|
|
this.loadClassifyOptions();
|
|
|
},
|
|
|
methods: {
|
|
|
- // ========== 分类数据加载 ==========
|
|
|
async loadClassifyOptions() {
|
|
|
try {
|
|
|
const res = await fetch(`${window.BASE_URL}data/classify.json`);
|
|
|
@@ -809,6 +833,10 @@ export default {
|
|
|
}
|
|
|
this.$nextTick(() => {
|
|
|
this._isLoadingTab = false;
|
|
|
+ // 加载完毕后,如果是自动计算模式,触发一次初始计算
|
|
|
+ if (this.currentSingleNumber !== "0") {
|
|
|
+ this.updatePrice();
|
|
|
+ }
|
|
|
});
|
|
|
},
|
|
|
switchTab(index) {
|
|
|
@@ -818,7 +846,6 @@ export default {
|
|
|
this.loadTabData(index);
|
|
|
},
|
|
|
|
|
|
- // ========== 新增处方弹窗 ==========
|
|
|
async openAddDialog() {
|
|
|
this.addForm = {
|
|
|
category: "",
|
|
|
@@ -841,7 +868,6 @@ export default {
|
|
|
params.classify = this.addForm.category;
|
|
|
}
|
|
|
if (query) {
|
|
|
- // 拼音用 py,中文用 itemName
|
|
|
if (/^[A-Za-z]+$/.test(query)) {
|
|
|
params.py = query;
|
|
|
} else {
|
|
|
@@ -899,7 +925,7 @@ export default {
|
|
|
|
|
|
// 检查项目是否已存在,不允许重复添加
|
|
|
const isDuplicate = this.prescriptions.some(
|
|
|
- (p) => p.itemId === this.addForm.itemId
|
|
|
+ (p) => p.itemId === this.addForm.itemId,
|
|
|
);
|
|
|
if (isDuplicate) {
|
|
|
this.$message.warning("该项目已添加,不能重复添加");
|
|
|
@@ -1045,7 +1071,6 @@ export default {
|
|
|
this.emitStatistics();
|
|
|
return;
|
|
|
}
|
|
|
- // 只清空当前选中 tab 的内容,保留处方 tab 本身
|
|
|
const p = this.prescriptions[this.activeIndex];
|
|
|
const unitPrice = p?.price || 0;
|
|
|
this.prescriptionDataMap[this.activeIndex] = createPrescriptionData({
|
|
|
@@ -1055,26 +1080,27 @@ export default {
|
|
|
unitPrice,
|
|
|
});
|
|
|
this.loadTabData(this.activeIndex);
|
|
|
- this.calcPrice();
|
|
|
+ this.updatePrice();
|
|
|
this.$emit("prescriptions-change", this.prescriptions);
|
|
|
},
|
|
|
|
|
|
- // ========== 工具栏 change ==========
|
|
|
onEditableChange(val) {
|
|
|
this.$emit("update:isEditable", val);
|
|
|
},
|
|
|
onDetailTypesChange(val) {
|
|
|
- // 无详情 与其他选项不能同时选中
|
|
|
const NO_DETAIL = "无详情";
|
|
|
- const lastSelected = val.length > this._prevDetailTypes?.length
|
|
|
- ? val.find((v) => !this._prevDetailTypes.includes(v))
|
|
|
- : null;
|
|
|
+ const lastSelected =
|
|
|
+ val.length > this._prevDetailTypes?.length
|
|
|
+ ? val.find((v) => !this._prevDetailTypes.includes(v))
|
|
|
+ : null;
|
|
|
|
|
|
if (lastSelected === NO_DETAIL) {
|
|
|
- // 选中了"无详情",取消其他所有选项
|
|
|
val = [NO_DETAIL];
|
|
|
- } else if (lastSelected && lastSelected !== NO_DETAIL && val.includes(NO_DETAIL)) {
|
|
|
- // 选中了其他选项,取消"无详情"
|
|
|
+ } else if (
|
|
|
+ lastSelected &&
|
|
|
+ lastSelected !== NO_DETAIL &&
|
|
|
+ val.includes(NO_DETAIL)
|
|
|
+ ) {
|
|
|
val = val.filter((v) => v !== NO_DETAIL);
|
|
|
}
|
|
|
this.innerDetailTypes = val;
|
|
|
@@ -1096,7 +1122,6 @@ export default {
|
|
|
this.$emit("update:detailTypes", val);
|
|
|
},
|
|
|
|
|
|
- // ========== 配穴表格(按详情类型) ==========
|
|
|
getDetailTable(type) {
|
|
|
if (!this.detailTables[type]) {
|
|
|
this.$set(this.detailTables, type, [createEmptyRow(1)]);
|
|
|
@@ -1287,9 +1312,10 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
|
|
|
- // ========== 底部统计 ==========
|
|
|
- // 仅更新价格,不重新计算 singleCount(用于用户手动修改单次数量时)
|
|
|
updatePrice() {
|
|
|
+ if (this.currentSingleNumber !== "0" && !this._isLoadingTab) {
|
|
|
+ this.singleCount = this.calcTotalCount();
|
|
|
+ }
|
|
|
const price = this.currentUnitPrice || this.unitPrice || 0;
|
|
|
this.singlePrice = (this.singleCount * price).toFixed(2);
|
|
|
this.coursePrice = (
|
|
|
@@ -1303,18 +1329,10 @@ export default {
|
|
|
this.totalPrice = total.toFixed(2);
|
|
|
this.emitStatistics();
|
|
|
},
|
|
|
- // 根据详情重新计算 singleCount 并更新价格(用于穴位详情变化时)
|
|
|
- calcPrice() {
|
|
|
- const totalFromDetails = this.calcTotalCount();
|
|
|
- if (totalFromDetails > 0 && !this._isLoadingTab) {
|
|
|
- this.singleCount = totalFromDetails;
|
|
|
- }
|
|
|
- this.updatePrice();
|
|
|
- },
|
|
|
calcTotalCount() {
|
|
|
let total = 0;
|
|
|
- const validTypes = ["穴位", "经络", "耳穴", "部位", "其他详情"];
|
|
|
- validTypes.forEach((type) => {
|
|
|
+ const types = this.activeDetailTypes;
|
|
|
+ types.forEach((type) => {
|
|
|
const table = this.detailTables[type];
|
|
|
if (table) {
|
|
|
table.forEach((row) => {
|
|
|
@@ -1324,7 +1342,8 @@ export default {
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
- return total;
|
|
|
+ const coefficient = this.currentCountCoefficient;
|
|
|
+ return coefficient > 0 ? total / coefficient : total;
|
|
|
},
|
|
|
emitStatistics() {
|
|
|
this.$emit("update:statistics", {
|
|
|
@@ -1478,10 +1497,11 @@ export default {
|
|
|
itemName: item.treatItemName || "",
|
|
|
price: unitPrice,
|
|
|
pricingUnit: pricingUnit,
|
|
|
- singleNumber: "",
|
|
|
- countCoefficient: 1,
|
|
|
- minTreatmentDuration: 0,
|
|
|
- detailCumulative: "",
|
|
|
+ singleNumber: item.basisStitutionsnondrug?.singleNumber || "0",
|
|
|
+ countCoefficient: item.basisStitutionsnondrug?.countCoefficient || 1,
|
|
|
+ minTreatmentDuration:
|
|
|
+ item.basisStitutionsnondrug?.minTreatmentDuration || 0,
|
|
|
+ detailCumulative: item.basisStitutionsnondrug?.detailCumulative || "",
|
|
|
});
|
|
|
|
|
|
const allDetails = [].concat(
|