分割数据不一致问题

uat_us
wangxiaoshuang 2026-04-29 13:42:16 +08:00
parent 1e57777d3b
commit 06f52f4f24
4 changed files with 79 additions and 14 deletions

View File

@ -408,6 +408,14 @@ export function changeSegmentationSavedStatus(data) {
data data
}) })
} }
// 修改分割片段锁定状态
export function lockOrUnLockSegment(data) {
return request({
url: `/Segmentation/lockOrUnLockSegment`,
method: 'post',
data
})
}
// 图像数据匿名 // 图像数据匿名
export function studyMaskImage(data) { export function studyMaskImage(data) {
return request({ return request({

View File

@ -1003,6 +1003,24 @@ export default {
this.getSystemInfoReading(); this.getSystemInfoReading();
}, },
methods: { methods: {
changeScreenSave() {
return new Promise(async (reslove, reject) => {
if (this.$refs.Segmentations.readingTaskState < 2) {
let isSaved = this.$refs.Segmentations.segmentList.some(item => !item.isSaved)
if (isSaved) {
let confirm = await this.$confirm(this.$t("trials:reading:Segmentations:confirm:changeScreenSave"))
if (!confirm) reslove(true)
this.$refs.Segmentations.saveSegmentGroup(null, true, () => {
reslove(true)
})
} else {
reslove(true)
}
} else {
reslove(true)
}
})
},
resetHistogram() { resetHistogram() {
if (!this.histogramVisible) return false if (!this.histogramVisible) return false
if (this.timer['histogram']) { if (this.timer['histogram']) {
@ -3042,6 +3060,10 @@ export default {
}, },
// //
async changeLayout(v) { async changeLayout(v) {
if (this.readingTool === 3) {
let res = await this.changeScreenSave()
if (!res) return false
}
this.setToolsPassive() this.setToolsPassive()
this.fullScreenIndex = null this.fullScreenIndex = null
this.layout = v this.layout = v
@ -3355,9 +3377,12 @@ export default {
}, time) }, time)
}, },
// //
toggleFullScreen(e, index) { async toggleFullScreen(e, index) {
if (this.isDelay && (this.readingTool === 3 || this.isMPR)) return false if (this.isDelay && (this.readingTool === 3 || this.isMPR)) return false
if (this.readingTool === 3) {
let res = await this.changeScreenSave()
if (!res) return false
}
this.fullScreenIndex = this.fullScreenIndex === index ? null : index this.fullScreenIndex = this.fullScreenIndex === index ? null : index
this.activeViewportIndex = index this.activeViewportIndex = index
if (this.readingTool === 3 || this.isMPR) { if (this.readingTool === 3 || this.isMPR) {
@ -3515,8 +3540,12 @@ export default {
this.setToolsPassive() this.setToolsPassive()
}, },
// //
activeViewport(index) { async activeViewport(index) {
if (this.activeViewportIndex === index) return if (this.activeViewportIndex === index) return
if (this.readingTool === 3) {
let res = await this.changeScreenSave()
if (!res) return false
}
this.activeViewportIndex = index this.activeViewportIndex = index
// //
const series = this.$refs[`${this.viewportKey}-${this.activeViewportIndex}`][0].series const series = this.$refs[`${this.viewportKey}-${this.activeViewportIndex}`][0].series
@ -4173,6 +4202,11 @@ export default {
if (!data) return resolve(false) if (!data) return resolve(false)
let viewportSeries = this.$refs[`viewport-MPR-0`][0].series let viewportSeries = this.$refs[`viewport-MPR-0`][0].series
if (data && viewportSeries.SeriesInstanceUid === data.SeriesInstanceUid) return resolve(true) if (data && viewportSeries.SeriesInstanceUid === data.SeriesInstanceUid) return resolve(true)
} else {
if (this.readingTool === 3) {
let res = await this.changeScreenSave()
if (!res) return false
}
} }
if (!data) { if (!data) {
let { imageOrientationPatient, imagePositionPatient } = this.$refs[`viewport-${this.activeViewportIndex}`][0].imageInfo let { imageOrientationPatient, imagePositionPatient } = this.$refs[`viewport-${this.activeViewportIndex}`][0].imageInfo

View File

@ -133,8 +133,8 @@
<template v-if="segmentList.length > 0"> <template v-if="segmentList.length > 0">
<div class="SegmentGroupBox"> <div class="SegmentGroupBox">
<div style="display: flex;align-items: center;"> <div style="display: flex;align-items: center;">
<el-popover placement="left" width="200px" trigger="click" v-if="readingTaskState < 2" <el-popover placement="left" width="200px" trigger="click"
v-model="popoverVisible" :teleported="true"> v-if="readingTaskState < 2 && !isMPR" v-model="popoverVisible" :teleported="true">
<div class="SegmentGroupBtnBox"> <div class="SegmentGroupBtnBox">
<div class="SegmentGroupBtn" @click.stop="addSegmentGroup"> <div class="SegmentGroupBtn" @click.stop="addSegmentGroup">
{{ $t('trials:reading:Segmentations:button:addSegmentGroup') }} {{ $t('trials:reading:Segmentations:button:addSegmentGroup') }}
@ -151,6 +151,7 @@
</div> </div>
<i slot="reference" class="el-icon-more" style="cursor: pointer;color:#fff" /> <i slot="reference" class="el-icon-more" style="cursor: pointer;color:#fff" />
</el-popover> </el-popover>
<i class="el-icon-more" style="cursor: not-allowed;color: #fff;" v-if="isMPR"></i>
<el-select v-model="segmentationId" placeholder="" @change="selectSegmentGroup()" <el-select v-model="segmentationId" placeholder="" @change="selectSegmentGroup()"
:disabled="saveLoading"> :disabled="saveLoading">
<el-option v-for="item in segmentList" :key="`${item.segmentationId}`" <el-option v-for="item in segmentList" :key="`${item.segmentationId}`"
@ -162,7 +163,7 @@
<i class="el-icon-warning-outline" style="color:red;margin-right: 5px;" <i class="el-icon-warning-outline" style="color:red;margin-right: 5px;"
:title="$t('trials:reading:Segmentations:tip:segmentationIsNotSave')" :title="$t('trials:reading:Segmentations:tip:segmentationIsNotSave')"
v-if="!curSegmentGroup.isSaved"></i> v-if="!curSegmentGroup.isSaved"></i>
<el-button type="success" size="small" :disabled="saveLoading" <el-button type="success" size="small" :disabled="saveLoading && isMPR"
@click="saveSegmentGroup([curSegmentGroup])"> @click="saveSegmentGroup([curSegmentGroup])">
{{ $t("trials:reading:Segmentations:button:save") }} {{ $t("trials:reading:Segmentations:button:save") }}
</el-button> </el-button>
@ -225,7 +226,7 @@
<i class="el-icon-lock" v-if="item.lock" @click.stop="lockSegment(item, false)"></i> <i class="el-icon-lock" v-if="item.lock" @click.stop="lockSegment(item, false)"></i>
<el-popover placement="bottom" width="40" trigger="click" class="docShow" <el-popover placement="bottom" width="40" trigger="click" class="docShow"
:value="popoverId === `popover-${item.segmentationId}_${item.segmentIndex}`" :value="popoverId === `popover-${item.segmentationId}_${item.segmentIndex}`"
@show="handleClickPopover(item)" v-if="readingTaskState < 2"> @show="handleClickPopover(item)" v-if="readingTaskState < 2 && !isMPR">
<div class="SegmentGroupBtnBox"> <div class="SegmentGroupBtnBox">
<div class="SegmentGroupBtn" @click.stop="rename('segment', item)"> <div class="SegmentGroupBtn" @click.stop="rename('segment', item)">
{{ $t('trials:reading:Segmentations:button:renameSegmentGroup') }} {{ $t('trials:reading:Segmentations:button:renameSegmentGroup') }}
@ -244,21 +245,22 @@
</div> </div>
<i slot="reference" class="el-icon-more" style="cursor: pointer;color:#fff" /> <i slot="reference" class="el-icon-more" style="cursor: pointer;color:#fff" />
</el-popover> </el-popover>
<i class="el-icon-more" style="cursor: not-allowed;color: #fff;" v-if="isMPR"></i>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
</el-collapse-item> </el-collapse-item>
</el-collapse> </el-collapse>
<div class="saveBtnBox" v-if="readingTaskState < 2"> <div class="saveBtnBox" v-if="readingTaskState < 2 && segmentList && segmentList.length > 1">
<el-button type="success" size="small" :disabled="saveLoading" @click="saveSegmentGroup()"> <el-button type="success" size="small" :disabled="saveLoading && isMPR" @click="saveSegmentGroup()">
{{ $t("trials:reading:Segmentations:button:saveAll") }} {{ $t("trials:reading:Segmentations:button:saveAll") }}
</el-button> </el-button>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { changeSegmentationSavedStatus, getSegmentationList, addOrUpdateSegmentation, deleteSegmentation, getSegmentList, addOrUpdateSegment, deleteSegment, getSegmentBindingList, saveSegmentBindingAndAnswer, getReadingTableQuestionTrialById, getReadingQuestionTrialById } from '@/api/reading' import { changeSegmentationSavedStatus, getSegmentationList, addOrUpdateSegmentation, deleteSegmentation, getSegmentList, addOrUpdateSegment, deleteSegment, getSegmentBindingList, saveSegmentBindingAndAnswer, getReadingTableQuestionTrialById, getReadingQuestionTrialById, lockOrUnLockSegment } from '@/api/reading'
import * as cornerstoneTools from '@cornerstonejs/tools'; import * as cornerstoneTools from '@cornerstonejs/tools';
import * as cornerstone from "@cornerstonejs/core"; import * as cornerstone from "@cornerstonejs/core";
import dcmjs from '@/utils/dcmUpload/dcmjs' import dcmjs from '@/utils/dcmUpload/dcmjs'
@ -418,7 +420,7 @@ export default {
if (this.isMPR) return false if (this.isMPR) return false
if (Id === this.series.Id && TaskInfo.VisitTaskId === this.visitInfo.VisitTaskId) return false if (Id === this.series.Id && TaskInfo.VisitTaskId === this.visitInfo.VisitTaskId) return false
this.series = series this.series = series
this.$emit("update:curSegSeries", Object.assign(series, {})) this.$emit("update:curSegSeries", Object.assign({}, series))
this.getSegmentationList() this.getSegmentationList()
}) })
DicomEvent.$on('isloaded', (data) => { DicomEvent.$on('isloaded', (data) => {
@ -691,9 +693,12 @@ export default {
}, },
lockSegment(item, lock) { lockSegment(item, lock) {
if (this.readingTaskState >= 2) return false if (this.readingTaskState >= 2) return false
if (this.isMPR) return false
this.$emit('setToolsPassive')
segmentation.segmentLocking.setSegmentIndexLocked(item.segmentationId, item.segmentIndex, lock) segmentation.segmentLocking.setSegmentIndexLocked(item.segmentationId, item.segmentIndex, lock)
item.lock = lock item.lock = lock
if (!lock) this.changeSegmentationSavedStatus(item.segmentationId, lock) if (!lock) this.changeSegmentationSavedStatus(item.segmentationId, lock)
this.lockOrUnLockSegment(item.id, lock)
}, },
selectSegment(item, isChange = true) { selectSegment(item, isChange = true) {
if (isChange) { if (isChange) {
@ -787,6 +792,7 @@ export default {
}, },
async addSegment() { async addSegment() {
if (this.saveLoading) return false if (this.saveLoading) return false
if (this.isMPR) return false
if (this.segmentList.length <= 0) { if (this.segmentList.length <= 0) {
let obj = { let obj = {
name: this.getSegmentationName(), name: this.getSegmentationName(),
@ -831,6 +837,7 @@ export default {
// this.readingSegmentByConfig() // this.readingSegmentByConfig()
} else { } else {
this.changeSegmentationSavedStatus(this.segmentationId, false)
let item = this.segmentList.find(i => i.segmentationId === this.segmentationId) let item = this.segmentList.find(i => i.segmentationId === this.segmentationId)
let arr = item.segments.sort((a, b) => a.segmentIndex - b.segmentIndex) let arr = item.segments.sort((a, b) => a.segmentIndex - b.segmentIndex)
let segmentIndex = arr[item.segments.length - 1].segmentIndex + 1 let segmentIndex = arr[item.segments.length - 1].segmentIndex + 1
@ -1457,7 +1464,7 @@ export default {
} }
}, },
// //
async saveSegmentGroup(list = null, saveSegment = true) { async saveSegmentGroup(list = null, saveSegment = true, callback) {
try { try {
let segmentList = list ? list : this.segmentList let segmentList = list ? list : this.segmentList
if (segmentList.length <= 0) return false if (segmentList.length <= 0) return false
@ -1516,6 +1523,7 @@ export default {
DicomEvent.$emit("IsBeSegment", { StudyId: this.series.StudyId, Id: this.series.Id, IsBeSegment: f }) DicomEvent.$emit("IsBeSegment", { StudyId: this.series.StudyId, Id: this.series.Id, IsBeSegment: f })
} }
this.$emit("update:globalLoading", false) this.$emit("update:globalLoading", false)
if (callback) callback()
} catch (err) { } catch (err) {
this.loading = false this.loading = false
console.log(err) console.log(err)
@ -1703,7 +1711,7 @@ export default {
bidirectional: SegmentJson.bidirectional, bidirectional: SegmentJson.bidirectional,
bidirectionalView: true, bidirectionalView: true,
view: true, view: true,
lock: true, lock: s.IsLock,
id: s.Id id: s.Id
} }
obj.segments.push(o) obj.segments.push(o)
@ -1823,6 +1831,20 @@ export default {
console.log(err) console.log(err)
} }
}, },
//
async lockOrUnLockSegment(SegmentId, IsLock) {
try {
let data = {
SegmentId,
IsLock
}
let res = await lockOrUnLockSegment(data)
if (res.IsSuccess) return true
return false
} catch (err) {
console.log(err)
}
},
hex2Rgb(hexValue, alpha = 1) { hex2Rgb(hexValue, alpha = 1) {
const rgx = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; const rgx = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
const hex = hexValue.replace(rgx, (m, r, g, b) => r + r + g + g + b + b); const hex = hexValue.replace(rgx, (m, r, g, b) => r + r + g + g + b + b);
@ -2053,6 +2075,7 @@ export default {
.messageBox { .messageBox {
color: #333; color: #333;
cursor: not-allowed;
} }
.serialNum { .serialNum {

View File

@ -383,7 +383,7 @@ async function renderSegmentation(series, visitInfo, viewportId, SegmentConfig,
let SegmentJson = s.SegmentJson ? JSON.parse(s.SegmentJson) : {}; let SegmentJson = s.SegmentJson ? JSON.parse(s.SegmentJson) : {};
segmentation.segmentIndex.setActiveSegmentIndex(s.SegmentationId, s.SegmentNumber); segmentation.segmentIndex.setActiveSegmentIndex(s.SegmentationId, s.SegmentNumber);
segmentation.config.color.setSegmentIndexColor(viewportId, s.SegmentationId, s.SegmentNumber, hex2Rgb(s.ColorRgb)) segmentation.config.color.setSegmentIndexColor(viewportId, s.SegmentationId, s.SegmentNumber, hex2Rgb(s.ColorRgb))
segmentation.segmentLocking.setSegmentIndexLocked(s.SegmentationId, s.SegmentNumber, true) segmentation.segmentLocking.setSegmentIndexLocked(s.SegmentationId, s.SegmentNumber, s.IsLock)
if (SegmentJson.bidirectional) { if (SegmentJson.bidirectional) {
let an = annotation.state.getAllAnnotations().find(i => i.metadata.segmentationId === s.SegmentationId && i.metadata.segmentIndex === SegmentJson.bidirectional.segmentIndex && i.metadata.toolName === "SegmentBidirectional"); let an = annotation.state.getAllAnnotations().find(i => i.metadata.segmentationId === s.SegmentationId && i.metadata.segmentIndex === SegmentJson.bidirectional.segmentIndex && i.metadata.toolName === "SegmentBidirectional");
if (!an) { if (!an) {