feat:配片单验光参数调整优化

This commit is contained in:
一休哥哥6666
2026-07-14 14:53:12 +08:00
parent 9be6fd6ec9
commit 324679964c
6 changed files with 492 additions and 87 deletions

View File

@@ -535,17 +535,26 @@
</el-table-column>
<el-table-column label="球镜S" align="center" min-width="90">
<template slot-scope="scope">
<el-input-number v-model="scope.row.sphereS" :precision="2" :step="0.25" controls-position="right" style="width: 100%" />
<el-input-number v-model="scope.row.sphereS" :precision="2" :step="0.25" controls-position="right" style="width: 100%" @change="val => onSphereSChange(val, scope.row)" />
</template>
</el-table-column>
<el-table-column label="柱镜C" align="center" min-width="90">
<template slot-scope="scope">
<el-input-number v-model="scope.row.cylinderC" :precision="2" :step="0.25" controls-position="right" style="width: 100%" />
<el-input-number
v-model="scope.row.cylinderC"
:precision="2"
:step="0.25"
:min="getCylinderCMin(scope.row)"
:max="getCylinderCMax(scope.row)"
controls-position="right"
style="width: 100%"
@change="val => onCylinderCChange(val, scope.row)"
/>
</template>
</el-table-column>
<el-table-column label="轴位A" align="center" min-width="80">
<template slot-scope="scope">
<el-input-number v-model="scope.row.axisA" :min="0" :max="180" controls-position="right" style="width: 100%" />
<el-input-number v-model="scope.row.axisA" :min="0" :max="180" :disabled="!isAxisAEditable(scope.row)" controls-position="right" style="width: 100%" />
</template>
</el-table-column>
<el-table-column label="瞳距(mm)" align="center" min-width="90">
@@ -553,7 +562,7 @@
<el-input-number v-model="scope.row.pd" :precision="2" :min="0" controls-position="right" style="width: 100%" />
</template>
</el-table-column>
<el-table-column label="瞳高(mm)" align="center" min-width="80">
<el-table-column v-if="form.progressiveMultifocal === 1" label="瞳高(mm)" align="center" min-width="80">
<template slot-scope="scope">
<el-input-number v-model="scope.row.pupilHeight" :precision="2" :min="0" controls-position="right" style="width: 100%" />
</template>
@@ -563,9 +572,9 @@
<el-input v-model="scope.row.distanceVa" placeholder="远用VA" />
</template>
</el-table-column>
<el-table-column label="近用ADD(屈光度)" align="center" min-width="100">
<el-table-column v-if="form.progressiveMultifocal === 1" label="近用ADD(屈光度)" align="center" min-width="100">
<template slot-scope="scope">
<el-input-number v-model="scope.row.nearAdd" :precision="2" :min="0" controls-position="right" style="width: 100%" />
<el-input-number v-model="scope.row.nearAdd" :precision="2" :step="0.25" :min="0.75" :max="4" controls-position="right" style="width: 100%" />
</template>
</el-table-column>
</el-table>
@@ -963,7 +972,7 @@
<span>{{ formatDetailPdValue(scope.row, scope.$index) }}</span>
</template>
</el-table-column>
<el-table-column label="瞳高(mm)" align="center" min-width="80">
<el-table-column v-if="detail.progressiveMultifocal === 1" label="瞳高(mm)" align="center" min-width="80">
<template slot-scope="scope">
<span>{{ scope.row.pupilHeight != null ? scope.row.pupilHeight : '-' }}</span>
</template>
@@ -973,7 +982,7 @@
<span>{{ scope.row.distanceVa != null && scope.row.distanceVa !== '' ? scope.row.distanceVa : '-' }}</span>
</template>
</el-table-column>
<el-table-column label="近用ADD(屈光度)" align="center" min-width="100">
<el-table-column v-if="detail.progressiveMultifocal === 1" label="近用ADD(屈光度)" align="center" min-width="100">
<template slot-scope="scope">
<span>{{ formatDetailNearAdd(scope.row.nearAdd) }}</span>
</template>
@@ -1471,8 +1480,8 @@ export default {
},
createDefaultOptometryList() {
return [
{ eyeSide: 'OS', sphereS: null, cylinderC: null, axisA: null, pd: null, dualPd: null, pupilHeight: null, distanceVa: null, nearAdd: null },
{ eyeSide: 'OD', sphereS: null, cylinderC: null, axisA: null, pd: null, dualPd: null, pupilHeight: null, distanceVa: null, nearAdd: null }
{ eyeSide: 'OS', sphereS: 0, cylinderC: null, axisA: null, pd: null, dualPd: null, pupilHeight: null, distanceVa: null, nearAdd: null },
{ eyeSide: 'OD', sphereS: 0, cylinderC: null, axisA: null, pd: null, dualPd: null, pupilHeight: null, distanceVa: null, nearAdd: null }
];
},
detectPdMode(optometryList) {
@@ -1516,6 +1525,45 @@ export default {
if (Number.isNaN(num)) return String(value);
return '+' + num.toFixed(2);
},
isAxisAEditable(row) {
const val = row && row.cylinderC;
if (val == null || val === '') return false;
const num = Number(val);
return !Number.isNaN(num) && num !== 0;
},
getSphereSign(sphereS) {
if (sphereS == null || sphereS === '') return 0;
const num = Number(sphereS);
if (Number.isNaN(num) || num === 0) return 0;
return num > 0 ? 1 : -1;
},
getCylinderCMin(row) {
return this.getSphereSign(row && row.sphereS) > 0 ? 0 : -10;
},
getCylinderCMax(row) {
return this.getSphereSign(row && row.sphereS) < 0 ? 0 : 10;
},
alignCylinderSignWithSphere(row) {
if (!row || row.cylinderC == null || row.cylinderC === '') return;
let cylinder = Number(row.cylinderC);
if (Number.isNaN(cylinder) || cylinder === 0) return;
const sphereSign = this.getSphereSign(row.sphereS);
if (sphereSign > 0 && cylinder < 0) cylinder = Math.abs(cylinder);
else if (sphereSign < 0 && cylinder > 0) cylinder = -Math.abs(cylinder);
row.cylinderC = Math.min(this.getCylinderCMax(row), Math.max(this.getCylinderCMin(row), cylinder));
},
onSphereSChange(val, row) {
this.alignCylinderSignWithSphere(row);
if (!this.isAxisAEditable(row)) row.axisA = null;
},
onCylinderCChange(val, row) {
if (val == null || val === '' || Number(val) === 0) {
row.axisA = null;
return;
}
this.alignCylinderSignWithSphere(row);
if (!this.isAxisAEditable(row)) row.axisA = null;
},
cancel() {
this.open = false;
this.reset();
@@ -1523,6 +1571,12 @@ export default {
handleProgressiveMultifocalChange(value) {
if (Number(value) !== 1) {
this.form.progressiveMultifocalPrice = 0;
if (this.form.optometryList) {
this.form.optometryList.forEach(row => {
row.nearAdd = null;
row.pupilHeight = null;
});
}
return;
}
if (!this.form.lensFactoryTenantId) {
@@ -1979,6 +2033,19 @@ export default {
? this.resolveProgressiveMultifocalPrice()
: 0
};
if (Number(payload.progressiveMultifocal) !== 1 && payload.optometryList) {
payload.optometryList.forEach(row => {
row.nearAdd = null;
row.pupilHeight = null;
});
}
if (payload.optometryList) {
payload.optometryList.forEach(row => {
if (!this.isAxisAEditable(row)) {
row.axisA = null;
}
});
}
if (Number(payload.progressiveMultifocal) === 1) {
if (!payload.lensFactoryTenantId) {
this.$modal.msgWarning("选择渐进多焦点时需先选择镜片厂");