AI创建折点维护界面

This commit is contained in:
tangw 2026-09-18 15:18:04 +08:00
parent ad24b9e8d9
commit e510746da5

View File

@ -41,7 +41,7 @@
<!-- 中栏:折点范围编辑 --> <!-- 中栏:折点范围编辑 -->
<div class="panel middle-panel"> <div class="panel middle-panel">
<div class="panel-header">折点范围编辑</div> <div class="panel-header">折点范围编辑<span v-if="currentGermClass" style="font-weight:400;color:#666;">({{ currentGermClass.zdmc }})</span></div>
<div class="panel-content"> <div class="panel-content">
<el-table <el-table
:data="breakpointList" :data="breakpointList"
@ -49,6 +49,7 @@
size="mini" size="mini"
height="100%" height="100%"
style="width: 100%" style="width: 100%"
:row-class-name="getRowClassName"
> >
<el-table-column prop="ywdh" label="药物代号" width="90" fixed /> <el-table-column prop="ywdh" label="药物代号" width="90" fixed />
<el-table-column label="抗生素" width="130" fixed show-overflow-tooltip> <el-table-column label="抗生素" width="130" fixed show-overflow-tooltip>
@ -64,7 +65,11 @@
<el-input v-model="scope.row.mic2" size="small" /> <el-input v-model="scope.row.mic2" size="small" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="micref" label="MIC折点" width="130" show-overflow-tooltip /> <el-table-column label="MIC折点" width="130" show-overflow-tooltip>
<template #default="scope">
<el-input v-model="scope.row.micref" size="small" />
</template>
</el-table-column>
<el-table-column label="S(KB>=)" width="75"> <el-table-column label="S(KB>=)" width="75">
<template #default="scope"> <template #default="scope">
<el-input v-model="scope.row.rad1" size="small" /> <el-input v-model="scope.row.rad1" size="small" />
@ -75,7 +80,11 @@
<el-input v-model="scope.row.rad2" size="small" /> <el-input v-model="scope.row.rad2" size="small" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="radref" label="KB折点" width="130" show-overflow-tooltip /> <el-table-column label="KB折点" width="130" show-overflow-tooltip>
<template #default="scope">
<el-input v-model="scope.row.radref" size="small" />
</template>
</el-table-column>
<el-table-column label="I=SDD" width="45" align="center"> <el-table-column label="I=SDD" width="45" align="center">
<template #default="scope"> <template #default="scope">
<el-checkbox v-model="scope.row.sddfalg" :true-value="1" :false-value="null" class="sdd-checkbox" /> <el-checkbox v-model="scope.row.sddfalg" :true-value="1" :false-value="null" class="sdd-checkbox" />
@ -167,41 +176,26 @@ const calcMicRef = (mic1, mic2) => {
const s = mic1 != null && mic1 !== '' ? Number(mic1) : null const s = mic1 != null && mic1 !== '' ? Number(mic1) : null
const r = mic2 != null && mic2 !== '' ? Number(mic2) : null const r = mic2 != null && mic2 !== '' ? Number(mic2) : null
if (s == null && r == null) return '' if (s == null && r == null) return ''
if (s != null && r != null) { if (s != null && r == null) return `<=${s}`
const mid = buildMicMiddle(s, r) if (s == null && r != null) return `>=${r}`
return `<=${s}${mid ? ', ' + mid : ''}, >=${r}` const sDouble = s * 2
} const rHalf = r / 2
return s != null ? `<=${s}` : `>=${r}` if (sDouble > rHalf) return `<=${s},,>=${r}`
if (sDouble === rHalf) return `<=${s},${sDouble},>=${r}`
return `<=${s},${sDouble}-${rHalf},>=${r}`
} }
const calcRadRef = (rad1, rad2) => { const calcRadRef = (rad1, rad2) => {
const s = rad1 != null && rad1 !== '' ? Number(rad1) : null const s = rad1 != null && rad1 !== '' ? Number(rad1) : null
const r = rad2 != null && rad2 !== '' ? Number(rad2) : null const r = rad2 != null && rad2 !== '' ? Number(rad2) : null
if (s == null && r == null) return '' if (s == null && r == null) return ''
if (s != null && r != null) { if (s != null && r == null) return `,,<=${s}`
const mid = buildRadMiddle(s, r) if (s == null && r != null) return `>=${r},,`
return `>=${r}${mid ? ', ' + mid : ''}, <=${s}` const sPlus1 = s + 1
} const rMinus1 = r - 1
return r != null ? `>=${r}` : `<=${s}` if (sPlus1 >= r) return `>=${r},,<=${s}`
} if (sPlus1 === rMinus1) return `>=${r},${sPlus1},<=${s}`
return `>=${r},${sPlus1}-${rMinus1},<=${s}`
const buildMicMiddle = (s, r) => {
if (r - s <= 1) return ''
if (Number.isInteger(s) && Number.isInteger(r)) {
return `${s + 1}-${r - 1}`
}
const vals = []
let v = s + 1
while (v < r) {
vals.push(Number.isInteger(v) ? v.toString() : v.toFixed(1))
v = Math.round((v + 1) * 10) / 10
}
return vals.join(',')
}
const buildRadMiddle = (s, r) => {
if (r - s <= 1) return ''
return `${s + 1}-${r - 1}`
} }
const setupBreakpointWatchers = (row) => { const setupBreakpointWatchers = (row) => {
@ -213,6 +207,26 @@ const setupBreakpointWatchers = (row) => {
] ]
} }
const snapshotRow = (row) => ({
mic1: row.mic1, mic2: row.mic2, rad1: row.rad1, rad2: row.rad2,
micref: row.micref, radref: row.radref, sddfalg: row.sddfalg, xh: row.xh
})
const isRowModified = (row) => {
if (row._isNew || !row._original) return false
const o = row._original
return o.mic1 !== row.mic1 || o.mic2 !== row.mic2 ||
o.rad1 !== row.rad1 || o.rad2 !== row.rad2 ||
o.micref !== row.micref || o.radref !== row.radref ||
o.sddfalg !== row.sddfalg || o.xh !== row.xh
}
const getRowClassName = ({ row }) => {
if (row._isNew) return 'row-new'
if (isRowModified(row)) return 'row-modified'
return ''
}
watch(treeFilter, val => { watch(treeFilter, val => {
treeRef.value?.filter(val) treeRef.value?.filter(val)
}) })
@ -244,7 +258,11 @@ const loadBreakpoints = () => {
getBreakpointList({ germClassCode: currentGermClass.value.zddh }).then(res => { getBreakpointList({ germClassCode: currentGermClass.value.zddh }).then(res => {
rowWatchers.forEach(stop => stop()) rowWatchers.forEach(stop => stop())
rowWatchers = [] rowWatchers = []
breakpointList.value = res.data || [] breakpointList.value = (res.data || []).map(row => {
row._isNew = false
row._original = snapshotRow(row)
return row
})
breakpointList.value.forEach(row => { breakpointList.value.forEach(row => {
rowWatchers.push(...setupBreakpointWatchers(row)) rowWatchers.push(...setupBreakpointWatchers(row))
}) })
@ -279,7 +297,9 @@ const handleAddBreakpoint = (row) => {
radref: '', radref: '',
xh: maxXh + 10, xh: maxXh + 10,
sddfalg: null, sddfalg: null,
bz: null bz: null,
_isNew: true,
_original: null
} }
breakpointList.value.push(newRow) breakpointList.value.push(newRow)
rowWatchers.push(...setupBreakpointWatchers(newRow)) rowWatchers.push(...setupBreakpointWatchers(newRow))
@ -352,9 +372,7 @@ onMounted(() => {
.unified-panel { .unified-panel {
background: #e6f7fa; background: #e6f7fa;
border-right: 1px solid #d9e8fb;
border-bottom: 1px solid #d9e8fb; border-bottom: 1px solid #d9e8fb;
border-left: 1px solid #d9e8fb;
border-radius: 0 0 8px 8px; border-radius: 0 0 8px 8px;
box-sizing: border-box; box-sizing: border-box;
overflow: hidden; overflow: hidden;
@ -370,7 +388,7 @@ onMounted(() => {
display: flex; display: flex;
flex: 1; flex: 1;
gap: 5px; gap: 5px;
padding: 10px; padding: 10px 0 0 0;
overflow: hidden; overflow: hidden;
min-height: 0; min-height: 0;
} }
@ -404,6 +422,8 @@ onMounted(() => {
.left-panel { .left-panel {
width: 220px; width: 220px;
flex-shrink: 0; flex-shrink: 0;
border-left: none;
border-bottom-left-radius: 0;
} }
.middle-panel { .middle-panel {
@ -414,6 +434,8 @@ onMounted(() => {
.right-panel { .right-panel {
width: 560px; width: 560px;
flex-shrink: 0; flex-shrink: 0;
border-right: none;
border-bottom-right-radius: 0;
} }
.right-content { .right-content {
@ -546,4 +568,12 @@ onMounted(() => {
.right-panel :deep(.el-table__row) { .right-panel :deep(.el-table__row) {
cursor: pointer; cursor: pointer;
} }
.middle-panel :deep(.el-table__row.row-new) td {
color: #c0392b;
}
.middle-panel :deep(.el-table__row.row-modified) td {
color: #2471a3;
}
</style> </style>