临床数据上传列表添加文件大小字段
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
d9f10055aa
commit
2f549846ba
|
@ -83,6 +83,19 @@
|
|||
width="190"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<!-- 文件大小 -->
|
||||
<el-table-column
|
||||
prop="size"
|
||||
:label="$t('trials:uploadClinicalData:table:fileSize')"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<span>{{
|
||||
scope.row.size && scope.row.size > 0
|
||||
? `${(scope.row.size / 1024 / 1024).toFixed(2)}MB`
|
||||
: 0
|
||||
}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
:label="$t('common:action:action')"
|
||||
width="100"
|
||||
|
@ -276,7 +289,7 @@ export default {
|
|||
const fileName = files[i].name
|
||||
var extendName = fileName.substring(fileName.lastIndexOf('.')).toLocaleLowerCase()
|
||||
if (this.faccept.indexOf(extendName) !== -1) {
|
||||
this.fileList.push({ FileName: fileName, Path: '', Status: 0, Files: files[i] })
|
||||
this.fileList.push({ FileName: fileName, Path: '', Status: 0, Files: files[i], size:files[i].size, type:fileName.split('.')[1] })
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -287,6 +287,7 @@
|
|||
type="file"
|
||||
name="file"
|
||||
multiple
|
||||
ref="file"
|
||||
style="
|
||||
position: absolute;
|
||||
top: 0;
|
||||
|
@ -312,6 +313,20 @@
|
|||
:label="$t('trials:uploadClinicalData:table:fileName')"
|
||||
width="250"
|
||||
/>
|
||||
<!-- 文件大小 -->
|
||||
<el-table-column
|
||||
prop="Size"
|
||||
:label="$t('trials:uploadClinicalData:table:fileSize')"
|
||||
width="150"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<span>{{
|
||||
scope.row.Size && scope.row.Size > 0
|
||||
? `${(scope.row.Size / 1024 / 1024).toFixed(2)}MB`
|
||||
: 0
|
||||
}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- 上传时间 -->
|
||||
<el-table-column
|
||||
prop="CreateTime"
|
||||
|
@ -551,16 +566,23 @@ export default {
|
|||
};
|
||||
this.currentRow.TrialId = this.$route.query.trialId;
|
||||
var files = e.target.files;
|
||||
this.fileList= [];
|
||||
for (var i = 0; i < files.length; ++i) {
|
||||
const fileName = files[i].name;
|
||||
var extendName = fileName
|
||||
.substring(fileName.lastIndexOf("."))
|
||||
.toLocaleLowerCase();
|
||||
if (this.faccept.indexOf(extendName) !== -1) {
|
||||
this.fileList.push(files[i]);
|
||||
let obj = {
|
||||
size:files[i].size,
|
||||
type:extendName.split('.')[1],
|
||||
file:files[i],
|
||||
}
|
||||
this.fileList.push(obj);
|
||||
}
|
||||
}
|
||||
this.handleUploadFile();
|
||||
this.$refs.file.value = null;
|
||||
},
|
||||
async handleUploadFile() {
|
||||
this.btnLoading = true;
|
||||
|
@ -568,16 +590,18 @@ export default {
|
|||
this.addFileList = [];
|
||||
try {
|
||||
for (var i = 0; i < this.fileList.length; ++i) {
|
||||
const file = await this.fileToBlob(this.fileList[i]);
|
||||
const file = await this.fileToBlob(this.fileList[i].file);
|
||||
var timestamp = Date.now();
|
||||
const res = await this.OSSclient.put(
|
||||
`/${this.trialId}/ClinicalData/${timestamp}_${this.fileList[i].name}`,
|
||||
`/${this.trialId}/ClinicalData/${timestamp}_${this.fileList[i].file.name}`,
|
||||
file
|
||||
);
|
||||
this.addFileList.push({
|
||||
fileName: this.fileList[i].name,
|
||||
fileName: this.fileList[i].file.name,
|
||||
path: this.$getObjectName(res.url),
|
||||
url: this.$getObjectName(res.url),
|
||||
type: this.fileList[i].type,
|
||||
size: this.fileList[i].size,
|
||||
});
|
||||
}
|
||||
this.saveClinicalData();
|
||||
|
|
Loading…
Reference in New Issue