上传bug处理,bug日志记录

uat_us
熊飞 2024-01-16 13:23:53 +08:00
parent d5e6a324bf
commit 7bd25cf192
3 changed files with 135 additions and 24 deletions

View File

@ -1,7 +1,7 @@
<template> <template>
<div id="app" style="position: relative"> <div id="app" style="position: relative">
<router-view /> <router-view />
<div v-adaptive @click="openI18n" style="position: fixed;bottom: 100px;left: 50px;z-index: 100000;width: 50px;height: 50px;background: #409eff88;line-height: 50px;text-align: center;color:#fff;border-radius: 50%;cursor: pointer"> <div v-adaptive @click="openI18n" style="position: fixed;bottom: 50px;left: 50px;z-index: 100000;width: 50px;height: 50px;background: #409eff88;line-height: 50px;text-align: center;color:#fff;border-radius: 50%;cursor: pointer">
i18n i18n
</div> </div>
<el-drawer <el-drawer

View File

@ -260,10 +260,45 @@
show-overflow-tooltip show-overflow-tooltip
sortable="custom" sortable="custom"
/> />
<el-table-column
:label="$t('common:action:action')"
width="250"
fixed="right"
>
<template slot-scope="scope">
<!-- 查看 -->
<el-button
circle
:title="$t('trials:readTask:button:view')"
:disabled="!scope.row.RecordPath"
icon="el-icon-view"
@click="handleLook(scope.row)"
/>
</template>
</el-table-column>
</el-table> </el-table>
<!-- 分页组件 --> <!-- 分页组件 -->
<pagination class="page" :total="total" :page.sync="searchData.PageIndex" :limit.sync="searchData.PageSize" @pagination="getList" /> <pagination class="page" :total="total" :page.sync="searchData.PageIndex" :limit.sync="searchData.PageSize" @pagination="getList" />
</template> </template>
<el-dialog
v-if="lookVisible"
:title="$t('trials:uploadMonitor:dagTitle:look')"
:visible.sync="lookVisible"
width="800px"
append-to-body
:close-on-click-modal="false"
custom-class="base-dialog-wrapper"
>
<div>
{{ lookText }}
</div>
<div slot="footer" class="dialog-footer">
<!-- 取消 -->
<el-button size="small" type="primary" @click="lookVisible = false">
{{ $t('common:button:cancel') }}
</el-button>
</div>
</el-dialog>
</BaseContainer> </BaseContainer>
</template> </template>
@ -273,6 +308,7 @@ import { getStudyUploadMonitor_Export } from '@/api/export'
import Pagination from '@/components/Pagination' import Pagination from '@/components/Pagination'
import BaseContainer from '@/components/BaseContainer' import BaseContainer from '@/components/BaseContainer'
import BaseModel from '@/components/BaseModel' import BaseModel from '@/components/BaseModel'
import axios from "axios";
const searchDataDefault = () => { const searchDataDefault = () => {
return { return {
SortField: '', SortField: '',
@ -300,7 +336,9 @@ export default {
searchData: searchDataDefault(), searchData: searchDataDefault(),
trialId: this.$route.query.trialId, trialId: this.$route.query.trialId,
siteOptions:[], siteOptions:[],
visitPlanOptions:[] visitPlanOptions:[],
lookVisible: false,
lookText: null
} }
}, },
mounted() { mounted() {
@ -309,6 +347,13 @@ export default {
this.getVisitPlanOptions() this.getVisitPlanOptions()
}, },
methods: { methods: {
async handleLook(row) {
this.lookVisible = true
var htmlUrl = this.OSSclientConfig.basePath + row.RecordPath
var res = await axios.get(htmlUrl)
console.log(res.data)
this.lookText = res.data
},
getList() { getList() {
this.loading = true this.loading = true
this.searchData.TrialId = this.trialId this.searchData.TrialId = this.trialId

View File

@ -132,7 +132,7 @@
<el-divider content-position="left">{{ $t('trials:uploadedDicoms:title:dicomFilesOnly') }}</el-divider> <el-divider content-position="left">{{ $t('trials:uploadedDicoms:title:dicomFilesOnly') }}</el-divider>
<div class="form-group"> <div class="form-group">
<div id="directoryInputWrapper" class="btn btn-link file-input"> <div id="directoryInputWrapper" class="btn btn-link file-input">
<el-button type="primary" size="small">{{ $t('trials:uploadedDicomsicom:button:selectFolder') }}</el-button> <el-button type="primary" :loading="btnLoading" size="small">{{ $t('trials:uploadedDicomsicom:button:selectFolder') }}</el-button>
<input <input
type="file" type="file"
name="file" name="file"
@ -267,7 +267,41 @@
<span v-else-if="scope.row.dicomInfo.failedFileCount === scope.row.dicomInfo.fileCount">{{$t('trials:uploadDicomList:table:status3')}}</span> <span v-else-if="scope.row.dicomInfo.failedFileCount === scope.row.dicomInfo.fileCount">{{$t('trials:uploadDicomList:table:status3')}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column
:label="$t('trials:uploadDicomList:table:record')"
min-width="140"
show-overflow-tooltip
>
<template slot-scope="scope">
<el-tooltip placement="top" v-if="scope.row.uploadState.record">
<div slot="content">
{{$t('trials:uploadDicomList:table:Existed')}}
<div v-if="scope.row.uploadState.record.Existed.length">
<span v-for="item of scope.row.uploadState.record.Existed">{{item}}</span>
</div>
<div v-else>
</div>
{{$t('trials:uploadDicomList:table:Uploaded')}}
<div v-if="scope.row.uploadState.record.Uploaded.length">
<span v-for="item of scope.row.uploadState.record.Uploaded">{{item}}</span>
</div>
<div v-else>
</div>
<br>
{{$t('trials:uploadDicomList:table:Failed')}}
<div v-if="scope.row.uploadState.record.Failed.length">
<span v-for="item of scope.row.uploadState.record.Failed">{{item}}</span>
</div>
<div v-else>
</div>
</div>
<div style="cursor: pointer">{{ scope.row.uploadState.record.Existed.length }}/{{ scope.row.uploadState.record.Uploaded.length }}/{{ scope.row.uploadState.record.Failed.length }}</div>
</el-tooltip>
</template>
</el-table-column>
<el-table-column v-show="isScan" :label="$t('common:action:action')" width="200"> <el-table-column v-show="isScan" :label="$t('common:action:action')" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<!-- 预览 --> <!-- 预览 -->
@ -915,6 +949,10 @@ export default {
await this.archiveStudy(index, res.OtherInfo) await this.archiveStudy(index, res.OtherInfo)
} }
} }
this.uploadQueues = this.uploadQueues.filter(v => {
return !!v.uploadState.record.Failed.length
})
console.log(this.uploadQueues)
this.btnLoading = false this.btnLoading = false
}).catch(_ => { this.btnLoading = false }) }).catch(_ => { this.btnLoading = false })
}, },
@ -1000,8 +1038,10 @@ export default {
}, 5000) }, 5000)
scope.myInterval.push(t) scope.myInterval.push(t)
let Record = { let Record = {
successFile: [], Existed: [],
errorFile: [] Uploaded: [],
Failed: [],
FileCount: 0
} }
let params = { let params = {
trialId: scope.trialId, trialId: scope.trialId,
@ -1041,8 +1081,11 @@ export default {
arr.push((function (){ arr.push((function (){
return new Promise(async resolve1 => { return new Promise(async resolve1 => {
let o = v.instanceList[ii] let o = v.instanceList[ii]
let name = `${v.instanceList[ii].instanceUid}_${v.instanceList[ii].file.webkitRelativePath}`
if (o.isReUpload) { if (o.isReUpload) {
dicomInfo.failedFileCount++ dicomInfo.failedFileCount++
Record.Existed.push(name)
Record.FileCount++
} else { } else {
let path = `/${params.trialId}/Image/${params.siteId}/${params.subjectId}/${params.subjectVisitId}/${dicomInfo.studyUid}/${v.seriesUid}/${o.instanceUid}/${scope.getGuid(dicomInfo.studyUid + v.seriesUid + o.instanceUid + params.trialId)}` let path = `/${params.trialId}/Image/${params.siteId}/${params.subjectId}/${params.subjectVisitId}/${dicomInfo.studyUid}/${v.seriesUid}/${o.instanceUid}/${scope.getGuid(dicomInfo.studyUid + v.seriesUid + o.instanceUid + params.trialId)}`
let res = await dcmUpload(path, o.file, config) let res = await dcmUpload(path, o.file, config)
@ -1080,6 +1123,11 @@ export default {
windowWidth: o.windowWidth, windowWidth: o.windowWidth,
path: scope.$getObjectName(res.url) path: scope.$getObjectName(res.url)
}) })
Record.Uploaded.push(name)
Record.FileCount++
} else {
Record.Failed.push(name)
Record.FileCount++
} }
} }
resolve1() resolve1()
@ -1112,29 +1160,47 @@ export default {
ImageResizePath: ImageResizePath, ImageResizePath: ImageResizePath,
}) })
} }
params.study.instanceCount = dicomInfo.failedFileCount console.log(Record)
addOrUpdateArchiveStudy(params).then(res => { let text = JSON.stringify(Record)
if (dicomInfo.failedFileCount === dicomInfo.fileCount) { let logJsonBlob = scope.generateTxtFile(text)
scope.$message.success(scope.$t('trials:uploadDicomList:label:uploaded')) console.log(logJsonBlob)
} else { let logJsonObjectName = `/${params.trialId}/Image/${params.siteId}/${params.subjectId}/${params.subjectVisitId}/${dicomInfo.studyUid}/${params.studyMonitorId}.txt`
scope.$message.error(scope.$t('trials:uploadDicomList:label:uploadFailed')) let logRes = await scope.OSSclient.put(logJsonObjectName, logJsonBlob)
} if (logRes && logRes.url) {
// scope.uploadQueues[index].uploadState.selected = true params.study.instanceCount = dicomInfo.failedFileCount
scope.uploadQueues[index].uploadState.selected = true params.RecordPath = logJsonObjectName
// scope.$refs.dicomFilesTable.toggleRowSelection(scope.uploadQueues[index]) addOrUpdateArchiveStudy(params).then(res => {
scope.getStudyInfo() if (dicomInfo.failedFileCount === dicomInfo.fileCount) {
if (scope.$route.path !== '/trials/trials-panel/visit/crc-question') { scope.$message.success(scope.$t('trials:uploadDicomList:label:uploaded'))
scope.$emit('getList') } else {
} scope.$alert(scope.$t('trials:uploadDicomList:label:uploadFailed'))
clearInterval(t) }
resolve() // scope.uploadQueues[index].uploadState.selected = true
}).catch((res) => { scope.uploadQueues[index].uploadState.selected = true
scope.uploadQueues[index].uploadState.record = Record
// scope.$refs.dicomFilesTable.toggleRowSelection(scope.uploadQueues[index])
scope.getStudyInfo()
if (scope.$route.path !== '/trials/trials-panel/visit/crc-question') {
scope.$emit('getList')
}
clearInterval(t)
resolve()
}).catch((res) => {
reject()
clearInterval(t)
})
} else {
scope.$alert(scope.$t('trials:uploadDicomList:label:generateLogFailed'))
reject() reject()
clearInterval(t) clearInterval(t)
}) }
}) })
}) })
}, },
generateTxtFile(text) {
let blob = new Blob(["\ufeff", text], {type: 'text/plain'})
return blob
},
// warning // warning
handleCancelWarnVisible() { handleCancelWarnVisible() {
this.warning_cfg.visible = false this.warning_cfg.visible = false