修正格式化错误

This commit is contained in:
2026-06-03 11:20:57 +08:00
parent 5a2050a736
commit 1bcffc85ae

View File

@@ -157,9 +157,7 @@
() => { () => {
if (row.methodCode) { if (row.methodCode) {
handleEnter('methodCode'); handleEnter('methodCode');
} "
}
"
> >
<el-option <el-option
v-for="dict in config.methodCode" v-for="dict in config.methodCode"
@@ -186,9 +184,7 @@
() => { () => {
if (row.rateCode) { if (row.rateCode) {
handleEnter('rateCode'); handleEnter('rateCode');
} "
}
"
:ref="(el) => setInputRef('rateCode', el)" :ref="(el) => setInputRef('rateCode', el)"
> >
<el-option <el-option
@@ -262,10 +258,8 @@
row.unitPrice = row.minUnitPrice; row.unitPrice = row.minUnitPrice;
} else { } else {
row.unitPrice = row.unitTempPrice; row.unitPrice = row.unitTempPrice;
} row.unitCode_dictText = item.label;
row.unitCode_dictText = item.label; "
}
"
/> />
</template> </template>
</el-select> </el-select>
@@ -404,8 +398,7 @@
row.unitPrice = row.minUnitPrice; row.unitPrice = row.minUnitPrice;
} else { } else {
row.unitPrice = row.unitTempPrice; row.unitPrice = row.unitTempPrice;
} row.unitCode_dictText = item.label;
row.unitCode_dictText = item.label;
}" /> }" />
</template> </template>
</el-select> </el-select>
@@ -629,7 +622,6 @@ const formRef = ref();
const registerFormRef = () => { const registerFormRef = () => {
if (formRef.value && proxy?.$parent?.$refs) { if (formRef.value && proxy?.$parent?.$refs) {
proxy.$parent.$refs[props.formRefName] = formRef.value; proxy.$parent.$refs[props.formRefName] = formRef.value;
}
}; };
// 监听 formRef 变化,确保注册 // 监听 formRef 变化,确保注册
@@ -640,18 +632,19 @@ watch(
nextTick(() => { nextTick(() => {
registerFormRef(); registerFormRef();
}); });
} },
},
{ immediate: true } { immediate: true }
); );
}); });
} // Suppress el-form teardown errors during vxe-table expand collapse
return false;
if (err?.message?.includes('label') || err?.message?.includes('width') || err?.message?.includes('NaN')) {
onErrorCaptured((err) => { onErrorCaptured((err) => {
// Suppress el-form-label-wrap teardown errors during vxe-table expand collapse if (err?.message?.includes('label') || err?.message?.includes('width') || err?.message?.includes('NaN')) {
return false;
}
});
onMounted(() => { onMounted(() => {
nextTick(() => { nextTick(() => {
registerFormRef(); registerFormRef();
@@ -659,7 +652,6 @@ onMounted(() => {
// Bug #615: 临时医嘱频次默认改为 ONCE临时一次不再强制设为 ST // Bug #615: 临时医嘱频次默认改为 ONCE临时一次不再强制设为 ST
if (props.row.therapyEnum == '2' && !props.row.rateCode && props.row.adviceType != 7) { if (props.row.therapyEnum == '2' && !props.row.rateCode && props.row.adviceType != 7) {
setDefaultRateCode(); setDefaultRateCode();
}
}); });
watch( watch(
@@ -671,9 +663,7 @@ watch(
} else if (newVal == '1') { } else if (newVal == '1') {
props.row.rateCode = ''; props.row.rateCode = '';
props.row.rateCode_dictText = ''; props.row.rateCode_dictText = '';
} );
}
);
const setDefaultRateCode = () => { const setDefaultRateCode = () => {
if (Array.isArray(props.config.rateCode)) { if (Array.isArray(props.config.rateCode)) {
@@ -690,10 +680,7 @@ const setDefaultRateCode = () => {
} else { } else {
props.row.rateCode = 'ST'; props.row.rateCode = 'ST';
props.row.rateCode_dictText = 'ST 立即'; props.row.rateCode_dictText = 'ST 立即';
} };
}
}
};
// 格式化库存显示 // 格式化库存显示
const stockFormat = (partPercent: number, unitList: any[], quantity: number): string => { const stockFormat = (partPercent: number, unitList: any[], quantity: number): string => {
@@ -704,19 +691,15 @@ const stockFormat = (partPercent: number, unitList: any[], quantity: number): st
const b = Math.floor(quantity / partPercent); const b = Math.floor(quantity / partPercent);
if (a == 0) { if (a == 0) {
return b + ' ' + unitCode; return b + ' ' + unitCode;
}
return b + ' ' + unitCode + ' ' + a + ' ' + minUnitCode; return b + ' ' + unitCode + ' ' + a + ' ' + minUnitCode;
}; };
// 检查单位 // 检查单位
const checkUnit = (item: any): boolean => { const checkUnit = (item: any): boolean => {
if (item.type == 'dose') { if (item.type == 'dose') {
return false;
} else if (props.row.partAttributeEnum == '2' && item.type == 'minUnit') { } else if (props.row.partAttributeEnum == '2' && item.type == 'minUnit') {
return false;
} else { } else {
return true; return true;
}
}; };
const handleEnter = (prop: string) => props.handlers.handleEnter(prop, props.row, props.index); const handleEnter = (prop: string) => props.handlers.handleEnter(prop, props.row, props.index);
@@ -725,16 +708,13 @@ const handleSave = () => {
if (!formRef.value) { if (!formRef.value) {
console.error('Form ref not found'); console.error('Form ref not found');
return; return;
} formRef.value.validate((valid: boolean) => {
formRef.value.validate((valid: boolean) => {
if (valid) { if (valid) {
emit('save', props.row, props.index); emit('save', props.row, props.index);
} else { } else {
if (proxy?.$modal?.msgWarning) { if (proxy?.$modal?.msgWarning) {
proxy.$modal.msgWarning('请完善必填信息'); proxy.$modal.msgWarning('请完善必填信息');
} });
}
});
}); });
}; };
@@ -773,14 +753,10 @@ function findOrgName(orgId: any): string {
if (typeof node.id === 'string' && node.id.length >= 16 && strId.length >= 16 if (typeof node.id === 'string' && node.id.length >= 16 && strId.length >= 16
&& node.id.substring(0, 15) === strId.substring(0, 15)) { && node.id.substring(0, 15) === strId.substring(0, 15)) {
return node.name; return node.name;
} if (node.children) {
if (node.children) {
const found = walk(node.children); const found = walk(node.children);
if (found) return found; if (found) return found;
} return '';
}
return '';
}
return walk(props.config.organization); return walk(props.config.organization);
} }
@@ -803,8 +779,7 @@ const calculateTotalAmount = () => {
if (row.adviceType == 7 && row.doseQuantity && row.dispensePerDuration) { if (row.adviceType == 7 && row.doseQuantity && row.dispensePerDuration) {
const freq = row.rateCode ? 1 : 1; // 频次由医生手动选,总量仅依据单次用量×天数估算 const freq = row.rateCode ? 1 : 1; // 频次由医生手动选,总量仅依据单次用量×天数估算
row.quantity = new Decimal(row.doseQuantity || 0).mul(row.dispensePerDuration || 0).toNumber(); row.quantity = new Decimal(row.doseQuantity || 0).mul(row.dispensePerDuration || 0).toNumber();
} const qty = new Decimal(row.quantity || row.doseQuantity || 0);
const qty = new Decimal(row.quantity || row.doseQuantity || 0);
// 根据首次用量单位类型决定使用哪个单价 // 根据首次用量单位类型决定使用哪个单价
const unitType = row.unitCodeList?.find((k) => k.value == row.doseUnitCode)?.type; const unitType = row.unitCodeList?.find((k) => k.value == row.doseUnitCode)?.type;
const price = unitType == 'unit' ? row.unitPrice : row.minUnitPrice; const price = unitType == 'unit' ? row.unitPrice : row.minUnitPrice;
@@ -863,10 +838,8 @@ defineExpose({
.expend_div { .expend_div {
:deep(.el-form-item--default) { :deep(.el-form-item--default) {
margin-bottom: 0px; margin-bottom: 0px;
}
:deep(.el-input-number .el-input__inner) { :deep(.el-input-number .el-input__inner) {
text-align: center; text-align: center;
}
} }
</style> </style>