数据同步更改

main
caiyiling 2026-04-02 17:32:35 +08:00
parent 9da9515930
commit 3b993bcd46
14 changed files with 1405 additions and 500 deletions

1408
package-lock.json generated

File diff suppressed because it is too large Load Diff

25
src/api/file.js Normal file
View File

@ -0,0 +1,25 @@
import request from '@/utils/request'
export function addOrUpdateFileUploadRecord(params) {
return request({
url: `/FileUploadRecord/addOrUpdateFileUploadRecord`,
method: 'post',
data: params
})
}
export function getFileUploadRecordList(params) {
return request({
url: `/FileUploadRecord/getFileUploadRecordList`,
method: 'post',
data: params
})
}
export function getUploadFileSyncRecordList(params) {
return request({
url: `/FileUploadRecord/getUploadFileSyncRecordList`,
method: 'post',
data: params
})
}

View File

@ -1174,6 +1174,7 @@ export default {
},
}
let arr = []
let uploadBatchId = scope.$guid()
for (let i = 0; i < seriesList.length; i++) {
let v = seriesList[i]
let instanceList = []
@ -1266,6 +1267,16 @@ export default {
) {
dicomInfo.uploadFileSize = dicomInfo.fileSize
}
},
{
fileName: o.file.name,
fileSize: o.file.size,
fileType: 'application/dicom',
uploadBatchId: uploadBatchId,
batchDataType: 5,
trialId: params.trialId,
subjectId: params.subjectId,
subjectVisitId: params.subjectVisitId
}
)
if (!res || !res.url) {
@ -1289,7 +1300,17 @@ export default {
let OSSclient = scope.OSSclient
let seriesRes = await OSSclient.put(
thumbnailPath,
blob
blob,
{
fileName: `${v.seriesUid}.jpg`,
fileSize: blob.size,
fileType: 'image/jpeg',
uploadBatchId: uploadBatchId,
batchDataType: 6,
trialId: params.trialId,
subjectId: params.subjectId,
subjectVisitId: params.subjectVisitId
}
)
if (seriesRes && seriesRes.url) {
ImageResizePath = scope.$getObjectName(
@ -1430,7 +1451,20 @@ export default {
}
let OSSclient = scope.OSSclient
try {
let seriesRes = await OSSclient.put(thumbnailPath, blob)
let seriesRes = await OSSclient.put(
thumbnailPath,
blob,
{
fileName: `${v.seriesUid}.jpg`,
fileSize: blob.size,
fileType: 'image/jpeg',
uploadBatchId: uploadBatchId,
batchDataType: 6,
trialId: params.trialId,
subjectId: params.subjectId,
subjectVisitId: params.subjectVisitId
}
)
if (seriesRes && seriesRes.url) {
o.ImageResizePath = scope.$getObjectName(seriesRes.url)
}
@ -1448,6 +1482,7 @@ export default {
if (scope.IsImageSegment) {
params.IsImageSegmentLabel = true
}
params.UploadBatchId = uploadBatchId
addOrUpdateArchiveTaskStudy(params)
.then((res) => {
if (dicomInfo.failedFileCount === dicomInfo.fileCount) {

View File

@ -548,8 +548,9 @@ export default {
})
if (res.IsSuccess) {
this.studyMonitorId = res.Result
let uploadBatchId = this.$guid()
for (let i = 0; i < num; i++) {
funArr.push(this.handleUploadTask(this.selectArr, i))
funArr.push(this.handleUploadTask(this.selectArr, i, uploadBatchId))
}
if (funArr.length > 0) {
let res = await Promise.all(funArr)
@ -560,7 +561,7 @@ export default {
}
},
//
async handleUploadTask(arr, index) {
async handleUploadTask(arr, index, uploadBatchId) {
if (!this.uploadVisible) return
let file = this.fileList.filter((item) => item.id === arr[index].id)[0]
file.status = 1
@ -576,7 +577,7 @@ export default {
}
file.curPath = path
const fileData = await this.fileToBlob(file.file)
let res = await this.fileToOss(path, fileData, file)
let res = await this.fileToOss(path, fileData, file, uploadBatchId)
if (res) {
file.status = 2
this.successFileList.push({
@ -610,13 +611,13 @@ export default {
}
let ind = arr.findIndex((item) => item.status === 0)
if (ind >= 0) {
return this.handleUploadTask(arr, ind)
return this.handleUploadTask(arr, ind, uploadBatchId)
} else {
return false
}
},
// fileoss
async fileToOss(path, file, item) {
async fileToOss(path, file, item, uploadBatchId) {
try {
let res = await this.OSSclient.multipartUpload(
{
@ -629,6 +630,17 @@ export default {
if (item.uploadFileSize > file.fileSize) {
item.uploadFileSize = file.fileSize > 0 ? file.fileSize : 1
}
},
{
fileName: item.name,
fileSize: item.size,
fileType: item.fileType,
uploadBatchId: uploadBatchId,
batchDataType: 7,
trialId: this.$route.query.trialId,
subjectId: this.currentRow.SubjectId,
subjectVisitId: this.currentRow.SourceSubjectVisitId,
studyCode: this.SubjectCode
}
)
if (res) {

View File

@ -1,6 +1,6 @@
import Vue from 'vue'
import { anonymization } from './anonymization'
export const dcmUpload = async function (data, config, progressFn) {
export const dcmUpload = async function (data, config, progressFn, fileInfo) {
return new Promise(async resolve => {
try {
// let blob = await encoder(file, config)
@ -8,7 +8,8 @@ export const dcmUpload = async function (data, config, progressFn) {
if (config) {
blob = await anonymization(data.file, config)
}
let res = await Vue.prototype.OSSclient.multipartUpload(Object.assign(data, { file: blob.blob }), progressFn)
let res = await Vue.prototype.OSSclient.multipartUpload(Object.assign(data, { file: blob.blob }), progressFn, fileInfo)
resolve({
...res,
image: blob.pixelDataElement

View File

@ -5,6 +5,7 @@ const stream = require('stream')
import Vue from 'vue'
import { customerHttp, OSSclose } from "@/utils/multipartUpload/oss"
import { exist, AWSclose } from "@/utils/multipartUpload/aws"
import { addOrUpdateFileUploadRecord } from '@/api/file'
const { GetObjectStoreToken } = require('../api/user.js')
const {
S3Client,
@ -22,7 +23,7 @@ async function ossGenerateSTS() {
res = await GetObjectStoreToken()
localStorage.setItem('stsToken', JSON.stringify(res))
}
let trialId = this.$route.query.trialId
// res.Result.ObjectStoreUse = 'AWS';
Vue.prototype.OSSclientConfig = { ...res.Result[res.Result.ObjectStoreUse] }
Vue.prototype.OSSclientConfig.ObjectStoreUse = res.Result.ObjectStoreUse;
@ -34,7 +35,8 @@ async function ossGenerateSTS() {
Vue.prototype.OSSclientConfig.timeout = 10 * 60 * 1000
let OSSclient = new OSS(Vue.prototype.OSSclientConfig)
Vue.prototype.OSSclient = {
put: async function (objectName, object) {
put: async function (objectName, object, fileInfo = {}) {
OSSclient = await RefreshClient(OSSclient)
return new Promise(async (resolve, reject) => {
try {
@ -52,6 +54,13 @@ async function ossGenerateSTS() {
}
let res = await OSSclient.put(objectName, object)
if (res && res.url) {
if (Object.keys(fileInfo).length !== 0) {
let params = Object.assign({path: objectName}, fileInfo)
addOrUpdateFileUploadRecord(params)
} else if (trialId) {
let params = { trialId }
addOrUpdateFileUploadRecord(params)
}
resolve({
name: objectName,
url: res.url
@ -65,7 +74,7 @@ async function ossGenerateSTS() {
}
})
},
multipartUpload: async (data, progress) => {
multipartUpload: async (data, progress, fileInfo = {}) => {
OSSclient = await RefreshClient(OSSclient)
return new Promise(async (resolve, reject) => {
try {
@ -95,6 +104,14 @@ async function ossGenerateSTS() {
}
let res = await customerHttp(OSSclient, data, progress);
if (res) {
if (Object.keys(fileInfo).length !== 0) {
let params = Object.assign({path: data.path}, fileInfo)
addOrUpdateFileUploadRecord(params)
} else if (trialId) {
let params = { trialId }
addOrUpdateFileUploadRecord(params)
}
resolve({
name: data.path,
url: Vue.prototype.OSSclientConfig.viewEndpoint + decodeUtf8(res.name)
@ -169,17 +186,17 @@ async function ossGenerateSTS() {
}
});
Vue.prototype.OSSclient = {
put: async function (objectName, object) {
put: async function (objectName, object, fileInfo = {}) {
let data = {
file: object,
path: objectName
}
aws = await RefreshClient(aws);
return uploadAWS(aws, data, () => { });
return uploadAWS(aws, data, () => { }, fileInfo);
},
multipartUpload: async (data, progress) => {
multipartUpload: async (data, progress, fileInfo = {}) => {
aws = await RefreshClient(aws);
return uploadAWS(aws, data, progress);
return uploadAWS(aws, data, progress, fileInfo);
},
close: () => {
AWSclose();
@ -189,7 +206,7 @@ async function ossGenerateSTS() {
return
}
// AWS上传函数
function uploadAWS(aws, data, progress) {
function uploadAWS(aws, data, progress, fileInfo) {
return new Promise(async (resolve, reject) => {
try {
const { file, path } = data;
@ -211,6 +228,14 @@ function uploadAWS(aws, data, progress) {
data.path = data.path.replace(`/${bucketName}/`, '');
await exist(aws, bucketName, data, progress, (path, status) => {
if (status === 'success') {
let trialId = this.$route.query.trialId
if (Object.keys(fileInfo).length !== 0) {
let params = Object.assign({path: decodeUtf8(curPath)}, fileInfo)
addOrUpdateFileUploadRecord(params)
} else if (trialId) {
let params = { trialId }
addOrUpdateFileUploadRecord(params)
}
resolve({
name: decodeUtf8(curPath),
url: Vue.prototype.OSSclientConfig.viewEndpoint + decodeUtf8(curPath)

View File

@ -3,6 +3,24 @@
<!-- 配置信息表单 -->
<el-form ref="processConfigForm" v-loading="loading" :model="form" label-width="300px" style="width: 800px"
:rules="rules" size="small">
<!-- 数据存储 -->
<el-form-item
:label="$t('trials:processCfg:form:trialDataStoreType')"
prop="TrialDataStoreType"
>
<el-radio-group
v-model="form.TrialDataStoreType"
:disabled="form.IsTrialProcessConfirmed && !isEdit"
>
<el-radio
v-for="item of $d.TrialDataStoreType"
:key="item.id"
:label="item.value"
>
{{ item.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<!-- 阅片方式 -->
<el-form-item :label="$t('trials:processCfg:form:readingMode')" prop="ReadingMode">
<el-radio-group v-model="form.ReadingMode" :disabled="form.IsTrialProcessConfirmed && !isEdit">
@ -78,6 +96,7 @@
</el-checkbox>
</el-checkbox-group>
</el-form-item>
<!-- 修约小数位数 -->
<!-- <el-form-item
:label="$t('trials:processCfg:form:digitPlaces')"
@ -724,6 +743,7 @@ export default {
VUE_IS_TEST: process.env.VUE_APP_IS_TEST,
form: {
TrialId: '',
TrialDataStoreType: 0,
ClinicalInformationTransmissionEnum: 1,
ClinicalDataSetNames: [],
ClinicalDataTrialSetIds: [],
@ -750,6 +770,13 @@ export default {
TrialCriterionIdEnums: [],
},
rules: {
TrialDataStoreType: [
{
required: true,
message: this.$t('common:ruleMessage:select'),
trigger: 'blur',
},
],
ClinicalDataSetNamesStr: [
{
required: true,
@ -1005,6 +1032,11 @@ export default {
// initialCriterions.push(this.$fd('ReadingStandard', id, 'id'))
// })
this.confirmData = [
{
Name: this.$t('trials:processCfg:form:trialDataStoreType'), //
NewVal: this.$fd('TrialDataStoreType', this.form.TrialDataStoreType),
OldVal: this.$fd('TrialDataStoreType', this.initialForm.TrialDataStoreType),
},
{
Name: this.$t('trials:processCfg:form:readingMode'), //
NewVal: this.$fd('ReadingMode', this.form.ReadingMode),

View File

@ -261,12 +261,23 @@ export default {
uploadFilesAndSave() {
return new Promise(async (resolve, reject) => {
this.form.AddFileList = []
let uploadBatchId = this.$guid()
for (var i = 0; i < this.pendingUploadList.length; ++i) {
// const file = await this.convertBase64ToBlob(this.pendingUploadList[i])
const file = await this.fileToBlob(this.pendingUploadList[i])
const res = await this.OSSclient.put(
`/${this.data.TrialId}/ClinicalData/${this.pendingUploadList[i].name}`,
file
file,
{
fileName: this.pendingUploadList[i].name,
fileSize: this.pendingUploadList[i].size,
fileType: this.pendingUploadList[i].type,
uploadBatchId: uploadBatchId,
batchDataType: 4,
trialId: this.data.TrialId,
subjectId: this.data.SubjectId,
subjectVisitId: this.data.SubjectVisitId
}
)
this.form.AddFileList.push({
fileName: this.pendingUploadList[i].name,

View File

@ -551,6 +551,7 @@ export default {
IsVisit: this.data.IsVisit,
SubjectId: this.data.SubjectId,
IsBaseLine: this.data.IsBaseLine,
SubjectVisitId: this.data.SubjectVisitId
}
)
this.addOrUpdateCD.title = this.$t('common:button:new')
@ -565,6 +566,7 @@ export default {
}
this.currentData.IsVisit = this.data.IsVisit
this.currentData.IsBaseLine = this.data.IsBaseLine
this.currentData.SubjectVisitId = this.data.SubjectVisitId
this.addOrUpdateCD.title = this.$t('common:button:edit')
this.currentOption = [
{

View File

@ -0,0 +1,220 @@
<template>
<BaseContainer>
<template slot="search-container">
<el-form :inline="true">
<!-- <el-form-item label="文件上传场景" prop="OptType">
<el-select v-model="searchData.BatchDataType" clearable style="width: 200px">
<el-option
v-for="item of $d.BatchDataType"
:key="'BatchDataType' + item.label"
:value="item.value"
:label="item.label"
/>
</el-select>
</el-form-item> -->
<el-form-item label="文件名称" prop="FileName">
<el-input v-model="searchData.FileName" size="small" clearable style="width: 120px" />
</el-form-item>
<!-- <el-form-item
:label="$t('trials:loginLog:table:incorrectUserName')"
prop="LoginFaildName"
v-if="!isMine"
>
<el-input
v-model="searchData.LoginFaildName"
size="small"
clearable
style="width: 120px"
/>
</el-form-item> -->
<!-- <el-form-item :label="$t('trials:loginLog:table:userName')" prop="LoginUserName" v-if="!isMine">
<el-select v-model="searchData.IdentityUserId" clearable style="width: 120px">
<el-option v-for="item of trialUserList" :key="item.IdentityUserId" :value="item.IdentityUserId"
:label="item.UserName" />
</el-select>
</el-form-item>
<el-form-item :label="$t('trials:loginLog:table:optUserName')" prop="TargetIdentityUserId" v-if="!isMine">
<el-select v-model="searchData.TargetIdentityUserId" clearable style="width: 120px">
<el-option v-for="item of trialUserList" :key="item.IdentityUserId" :value="item.IdentityUserId"
:label="item.UserName" />
</el-select>
</el-form-item>
<el-form-item :label="$t('trials:loginLog:table:userType')" prop="OptType" v-if="!isMine">
<el-select v-model="searchData.LoginUserType" clearable style="width: 120px">
<el-option v-for="item of $d.UserType" v-show="item.value !== 7 && item.value !== 8"
:key="'UserType' + item.label" :value="item.label" :label="item.label" />
</el-select>
</el-form-item>
<el-form-item :label="$t('trials:loginLog:table:createTime')">
<el-date-picker v-model="datetimerange" type="datetimerange" :default-time="['00:00:00', '23:59:59']"
:start-placeholder="$t('trials:loginLog:table:beginTime')"
:end-placeholder="$t('trials:loginLog:table:endTime')" value-format="yyyy-MM-dd HH:mm:ss"
@change="handleDatetimeChange" />
</el-form-item> -->
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleSearch">
{{ $t('common:button:search') }}
</el-button>
<!-- 重置 -->
<el-button type="primary" icon="el-icon-refresh-left" @click="handleReset">
{{ $t('common:button:reset') }}
</el-button>
</el-form-item>
</el-form>
</template>
<template slot="main-container">
<el-table v-loading="loading" v-adaptive="{ bottomOffset: 60 }" height="100" :data="list"
class="table" @sort-change="handleSortByColumn" :default-sort="{ prop: 'CreateTime', order: 'descending' }">
<el-table-column type="index" width="50" />
<!-- <el-table-column label="文件上传场景" prop="BatchDataType" min-width="100" show-overflow-tooltip sortable="custom">
<template slot-scope="scope">
{{ $fd('BatchDataType', scope.row.BatchDataType) }}
</template>
</el-table-column> -->
<el-table-column label="文件名称" prop="FileName" min-width="90" show-overflow-tooltip sortable="custom">
</el-table-column>
<el-table-column label="文件类型" prop="FileType" min-width="90" show-overflow-tooltip sortable="custom">
</el-table-column>
<el-table-column label="文件大小" prop="FileSize" min-width="90" show-overflow-tooltip sortable="custom">
<template slot-scope="scope">
{{ fileSizeFormatter(scope.row.FileSize) }}
</template>
</el-table-column>
<el-table-column label="源区域" prop="UploadRegion" min-width="90" show-overflow-tooltip sortable="custom" />
<el-table-column label="源可用时间" prop="CreateTime" min-width="90" show-overflow-tooltip sortable="custom" />
<el-table-column label="目标区域" prop="TargetRegion" min-width="90" show-overflow-tooltip sortable="custom" />
<el-table-column label="目标可用时间" prop="TargetRegion" min-width="90" show-overflow-tooltip sortable="custom" />
<el-table-column label="是否需要同步" prop="IsNeedSync" min-width="90" show-overflow-tooltip sortable="custom">
<template slot-scope="scope">
{{ $fd('YesOrNo', scope.row.IsNeedSync) }}
</template>
</el-table-column>
<el-table-column label="优先级" prop="Priority" min-width="90" show-overflow-tooltip sortable="custom" />
<el-table-column label="是否同步完成" prop="IsSync" min-width="90" show-overflow-tooltip sortable="custom">
<template slot-scope="scope">
{{ $fd('YesOrNo', scope.row.IsSync) }}
</template>
</el-table-column>
<el-table-column label="更新时间" prop="UpdateTime" min-width="90" show-overflow-tooltip sortable="custom" />
<el-table-column label="操作" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<el-button type="text" @click="handleOpenTaskTable(scope.row)">
任务表
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination class="page" :total="total" :page.sync="searchData.PageIndex" :limit.sync="searchData.PageSize"
@pagination="getList" />
</template>
<!-- <detail :config="config" :JsonObj="JsonObj" /> -->
</BaseContainer>
</template>
<script>
import { getFileUploadRecordList, getUploadFileSyncRecordList } from '@/api/file'
import BaseContainer from '@/components/BaseContainer'
import Pagination from '@/components/Pagination'
import moment from 'moment'
const searchDataDefault = () => {
return {
TrialId: '',
FileName: '',
BatchDataType: null,
Asc: false,
SortField: '',
PageIndex: 1,
PageSize: 20,
}
}
export default {
components: { BaseContainer, Pagination },
props: {
isMine: {
type: Boolean,
default: false,
},
id: {
type: String,
default: '',
},
},
data() {
return {
moment,
searchData: searchDataDefault(),
list: [],
total: 0,
loading: false,
datetimerange: [],
trialUserList: [],
config: {
visible: false,
title: this.$t('trials:loginLog:dialog:title'),
width: '500px',
top: '10vh',
},
JsonObj: null,
}
},
mounted() {
this.getList()
},
methods: {
async getList() {
try {
this.loading = true
this.searchData.TrialId = this.$route.query.trialId
let res = await getFileUploadRecordList(this.searchData)
this.loading = false
this.list = res.Result.CurrentPageData
this.total = res.Result.TotalCount
} catch(e) {
this.loading = false
console.log(e)
}
},
handleOpenTaskTable(row) {
// const { list, columns, title } = this.buildTaskDialogData(row)
// this.taskDialog.title = title
// this.taskDialog.list = list
// this.taskDialog.columns = columns
// this.taskDialog.visible = true
},
fileSizeFormatter(size) {
if (!size) return
return (size / Math.pow(1024, 2)).toFixed(3) + 'MB'
},
handleDatetimeChange(val) {
if (val) {
this.searchData.BeginDate = val[0]
this.searchData.EndDate = val[1]
} else {
this.searchData.BeginDate = ''
this.searchData.EndDate = ''
}
},
handleSearch() {
this.searchData.PageIndex = 1
this.getList()
},
//
handleReset() {
this.datetimerange = null
this.searchData = searchDataDefault()
this.getList()
},
//
handleSortByColumn(column) {
if (column.order === 'ascending') {
this.searchData.Asc = true
} else {
this.searchData.Asc = false
}
this.searchData.SortField = column.prop
this.searchData.PageIndex = 1
this.getList()
},
},
}
</script>

View File

@ -382,6 +382,7 @@ export default {
size: files[i].size,
type: extendName.split('.')[1],
file: files[i],
fileType: files[i].type
}
this.fileList.push(obj);
}
@ -401,7 +402,17 @@ export default {
var timestamp = Date.now();
const res = await this.OSSclient.put(
`/${this.trialId}/ClinicalData/${timestamp}_${this.fileList[i].file.name}`,
file
file,
{
fileName: `${this.fileList[i].file.name}`,
fileSize: file.size,
fileType: this.fileList[i].fileType,
uploadBatchId: this.$guid(),
batchDataType: 4,
trialId: this.trialId,
subjectId: this.data.SubjectId,
subjectVisitId: this.subjectVisitId
}
);
this.addFileList.push({
fileName: this.fileList[i].file.name,

View File

@ -1520,6 +1520,7 @@ export default {
},
}
let arr = []
let uploadBatchId = scope.$guid()
for (let i = 0; i < seriesList.length; i++) {
let v = seriesList[i]
let instanceList = []
@ -1587,6 +1588,7 @@ export default {
params.trialId
)}`
if (scope.isClose) return
console.log(o.file)
let res = await dcmUpload(
{
path: path,
@ -1607,6 +1609,16 @@ export default {
) {
dicomInfo.uploadFileSize = dicomInfo.fileSize
}
},
{
fileName: o.file.name,
fileSize: o.file.size,
fileType: 'application/dicom',
uploadBatchId: uploadBatchId,
batchDataType: 1,
trialId: params.trialId,
subjectId: params.subjectId,
subjectVisitId: params.subjectVisitId
}
)
if (!res || !res.url) {
@ -1623,11 +1635,22 @@ export default {
o.imageColumns,
o.imageRows
)
let thumbnailPath = `/${params.trialId}/Image/${params.subjectId}/${params.subjectVisitId}/${dicomInfo.studyUid}/${v.seriesUid}.jpg`
let OSSclient = scope.OSSclient
let seriesRes = await OSSclient.put(
thumbnailPath,
blob
blob,
{
fileName: `${v.seriesUid}.jpg`,
fileSize: blob.size,
fileType: 'image/jpeg',
uploadBatchId: scope.$guid(),
batchDataType: 2,
trialId: params.trialId,
subjectId: params.subjectId,
subjectVisitId: params.subjectVisitId
}
)
if (seriesRes && seriesRes.url) {
ImageResizePath = scope.$getObjectName(
@ -1762,7 +1785,20 @@ export default {
let thumbnailPath = `/${params.trialId}/Image/${params.trialSiteId}/${params.subjectId}/${params.subjectVisitId}/${dicomInfo.studyUid}/${v.seriesUid}.jpg`
let OSSclient = scope.OSSclient
try {
let seriesRes = await OSSclient.put(thumbnailPath, blob)
let seriesRes = await OSSclient.put(
thumbnailPath,
blob,
{
fileName: `${v.seriesUid}.jpg`,
fileSize: blob.size,
fileType: 'image/jpeg',
uploadBatchId: uploadBatchId,
batchDataType: 2,
trialId: params.trialId,
subjectId: params.subjectId,
subjectVisitId: params.subjectVisitId
}
)
if (seriesRes && seriesRes.url) {
o.ImageResizePath = scope.$getObjectName(seriesRes.url)
}
@ -1775,7 +1811,8 @@ export default {
params.study.instanceCount = dicomInfo.failedFileCount
params.RecordPath = scope.$getObjectName(logRes.url)
if (scope.isClose) return false
console.log(params)
params.UploadBatchId = uploadBatchId
addOrUpdateArchiveStudy(params)
.then((res) => {
if (dicomInfo.failedFileCount === dicomInfo.fileCount) {

View File

@ -756,6 +756,7 @@ export default {
.substring(fileName.lastIndexOf('.'))
.toLocaleLowerCase()
if (this.faccept.indexOf(extendName) !== -1) {
files[i].fileName = files[i].name
files[i].id = `${files[i].lastModified}${files[i].name}`
this.fileList.push(files[i])
}
@ -809,8 +810,9 @@ export default {
})
if (res.IsSuccess) {
this.studyMonitorId = res.Result
let uploadBatchId = this.$guid()
for (let i = 0; i < num; i++) {
funArr.push(this.handleUploadTask(this.selectArr, i))
funArr.push(this.handleUploadTask(this.selectArr, i, uploadBatchId))
}
if (funArr.length > 0) {
let res = await Promise.all(funArr)
@ -821,17 +823,16 @@ export default {
}
},
//
async handleUploadTask(arr, index) {
async handleUploadTask(arr, index, uploadBatchId) {
if (!this.uploadVisible) return
let file = this.fileList.filter((item) => item.id === arr[index].id)[0]
file.status = 1
let fileName = `${this.$guid()}${file.name.substring(file.name.lastIndexOf('.')).toLocaleLowerCase()}`
let path = `/${this.trialId}/Image/${this.data.SubjectId}/${this.data.Id
}/${this.$guid()}${file.name
.substring(file.name.lastIndexOf('.'))
.toLocaleLowerCase()}`
}/${fileName}`
file.curPath = path
const fileData = await this.fileToBlob(file.file)
let res = await this.fileToOss(path, fileData, file)
let res = await this.fileToOss(path, fileData, file, uploadBatchId)
if (res) {
file.status = 2
this.successFileList.push({
@ -865,13 +866,13 @@ export default {
}
let ind = arr.findIndex((item) => item.status === 0)
if (ind >= 0) {
return this.handleUploadTask(arr, ind)
return this.handleUploadTask(arr, ind, uploadBatchId)
} else {
return false
}
},
// fileoss
async fileToOss(path, file, item) {
async fileToOss(path, file, item, uploadBatchId) {
try {
let res = await this.OSSclient.multipartUpload(
{
@ -884,6 +885,18 @@ export default {
if (item.uploadFileSize > file.fileSize) {
item.uploadFileSize = file.fileSize > 0 ? file.fileSize : 1
}
},
{
fileName: item.name,
fileSize: item.size,
fileType: item.fileType,
uploadBatchId: uploadBatchId,
batchDataType: 3,
trialId: this.trialId,
subjectId: this.data.SubjectId,
subjectVisitId: this.subjectVisitId,
studyCode: this.currentRow.CodeView
}
)
if (res) {

View File

@ -361,6 +361,7 @@ export default {
size: files[i].size,
type: extendName.split('.')[1],
file: files[i],
fileType: files[i].type
}
this.fileList.push(obj)
}
@ -380,7 +381,17 @@ export default {
var timestamp = Date.now()
const res = await this.OSSclient.put(
`/${this.trialId}/ClinicalData/${timestamp}_${this.fileList[i].file.name}`,
file
file,
{
fileName: `${this.fileList[i].file.name}`,
fileSize: this.fileList[i].size,
fileType: this.fileList[i].fileType,
uploadBatchId: this.$guid(),
batchDataType: 4,
trialId: this.trialId,
subjectId: this.data.SubjectId,
subjectVisitId: this.subjectVisitId
}
)
this.addFileList.push({
fileName: this.fileList[i].file.name,