上传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>
<div id="app" style="position: relative">
<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
</div>
<el-drawer

View File

@ -260,10 +260,45 @@
show-overflow-tooltip
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>
<!-- 分页组件 -->
<pagination class="page" :total="total" :page.sync="searchData.PageIndex" :limit.sync="searchData.PageSize" @pagination="getList" />
</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>
</template>
@ -273,6 +308,7 @@ import { getStudyUploadMonitor_Export } from '@/api/export'
import Pagination from '@/components/Pagination'
import BaseContainer from '@/components/BaseContainer'
import BaseModel from '@/components/BaseModel'
import axios from "axios";
const searchDataDefault = () => {
return {
SortField: '',
@ -300,7 +336,9 @@ export default {
searchData: searchDataDefault(),
trialId: this.$route.query.trialId,
siteOptions:[],
visitPlanOptions:[]
visitPlanOptions:[],
lookVisible: false,
lookText: null
}
},
mounted() {
@ -309,6 +347,13 @@ export default {
this.getVisitPlanOptions()
},
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() {
this.loading = true
this.searchData.TrialId = this.trialId

View File

@ -132,7 +132,7 @@
<el-divider content-position="left">{{ $t('trials:uploadedDicoms:title:dicomFilesOnly') }}</el-divider>
<div class="form-group">
<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
type="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>
</template>
</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">
<template slot-scope="scope">
<!-- 预览 -->
@ -915,6 +949,10 @@ export default {
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
}).catch(_ => { this.btnLoading = false })
},
@ -1000,8 +1038,10 @@ export default {
}, 5000)
scope.myInterval.push(t)
let Record = {
successFile: [],
errorFile: []
Existed: [],
Uploaded: [],
Failed: [],
FileCount: 0
}
let params = {
trialId: scope.trialId,
@ -1041,8 +1081,11 @@ export default {
arr.push((function (){
return new Promise(async resolve1 => {
let o = v.instanceList[ii]
let name = `${v.instanceList[ii].instanceUid}_${v.instanceList[ii].file.webkitRelativePath}`
if (o.isReUpload) {
dicomInfo.failedFileCount++
Record.Existed.push(name)
Record.FileCount++
} 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 res = await dcmUpload(path, o.file, config)
@ -1080,6 +1123,11 @@ export default {
windowWidth: o.windowWidth,
path: scope.$getObjectName(res.url)
})
Record.Uploaded.push(name)
Record.FileCount++
} else {
Record.Failed.push(name)
Record.FileCount++
}
}
resolve1()
@ -1112,15 +1160,24 @@ export default {
ImageResizePath: ImageResizePath,
})
}
console.log(Record)
let text = JSON.stringify(Record)
let logJsonBlob = scope.generateTxtFile(text)
console.log(logJsonBlob)
let logJsonObjectName = `/${params.trialId}/Image/${params.siteId}/${params.subjectId}/${params.subjectVisitId}/${dicomInfo.studyUid}/${params.studyMonitorId}.txt`
let logRes = await scope.OSSclient.put(logJsonObjectName, logJsonBlob)
if (logRes && logRes.url) {
params.study.instanceCount = dicomInfo.failedFileCount
params.RecordPath = logJsonObjectName
addOrUpdateArchiveStudy(params).then(res => {
if (dicomInfo.failedFileCount === dicomInfo.fileCount) {
scope.$message.success(scope.$t('trials:uploadDicomList:label:uploaded'))
} else {
scope.$message.error(scope.$t('trials:uploadDicomList:label:uploadFailed'))
scope.$alert(scope.$t('trials:uploadDicomList:label:uploadFailed'))
}
// scope.uploadQueues[index].uploadState.selected = true
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') {
@ -1132,9 +1189,18 @@ export default {
reject()
clearInterval(t)
})
} else {
scope.$alert(scope.$t('trials:uploadDicomList:label:generateLogFailed'))
reject()
clearInterval(t)
}
})
})
},
generateTxtFile(text) {
let blob = new Blob(["\ufeff", text], {type: 'text/plain'})
return blob
},
// warning
handleCancelWarnVisible() {
this.warning_cfg.visible = false