临床数据上传列表添加文件大小字段
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"
|
width="190"
|
||||||
show-overflow-tooltip
|
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
|
<el-table-column
|
||||||
:label="$t('common:action:action')"
|
:label="$t('common:action:action')"
|
||||||
width="100"
|
width="100"
|
||||||
|
@ -276,7 +289,7 @@ export default {
|
||||||
const fileName = files[i].name
|
const fileName = files[i].name
|
||||||
var extendName = fileName.substring(fileName.lastIndexOf('.')).toLocaleLowerCase()
|
var extendName = fileName.substring(fileName.lastIndexOf('.')).toLocaleLowerCase()
|
||||||
if (this.faccept.indexOf(extendName) !== -1) {
|
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"
|
type="file"
|
||||||
name="file"
|
name="file"
|
||||||
multiple
|
multiple
|
||||||
|
ref="file"
|
||||||
style="
|
style="
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
@ -312,6 +313,20 @@
|
||||||
:label="$t('trials:uploadClinicalData:table:fileName')"
|
:label="$t('trials:uploadClinicalData:table:fileName')"
|
||||||
width="250"
|
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
|
<el-table-column
|
||||||
prop="CreateTime"
|
prop="CreateTime"
|
||||||
|
@ -551,16 +566,23 @@ export default {
|
||||||
};
|
};
|
||||||
this.currentRow.TrialId = this.$route.query.trialId;
|
this.currentRow.TrialId = this.$route.query.trialId;
|
||||||
var files = e.target.files;
|
var files = e.target.files;
|
||||||
|
this.fileList= [];
|
||||||
for (var i = 0; i < files.length; ++i) {
|
for (var i = 0; i < files.length; ++i) {
|
||||||
const fileName = files[i].name;
|
const fileName = files[i].name;
|
||||||
var extendName = fileName
|
var extendName = fileName
|
||||||
.substring(fileName.lastIndexOf("."))
|
.substring(fileName.lastIndexOf("."))
|
||||||
.toLocaleLowerCase();
|
.toLocaleLowerCase();
|
||||||
if (this.faccept.indexOf(extendName) !== -1) {
|
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.handleUploadFile();
|
||||||
|
this.$refs.file.value = null;
|
||||||
},
|
},
|
||||||
async handleUploadFile() {
|
async handleUploadFile() {
|
||||||
this.btnLoading = true;
|
this.btnLoading = true;
|
||||||
|
@ -568,16 +590,18 @@ export default {
|
||||||
this.addFileList = [];
|
this.addFileList = [];
|
||||||
try {
|
try {
|
||||||
for (var i = 0; i < this.fileList.length; ++i) {
|
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();
|
var timestamp = Date.now();
|
||||||
const res = await this.OSSclient.put(
|
const res = await this.OSSclient.put(
|
||||||
`/${this.trialId}/ClinicalData/${timestamp}_${this.fileList[i].name}`,
|
`/${this.trialId}/ClinicalData/${timestamp}_${this.fileList[i].file.name}`,
|
||||||
file
|
file
|
||||||
);
|
);
|
||||||
this.addFileList.push({
|
this.addFileList.push({
|
||||||
fileName: this.fileList[i].name,
|
fileName: this.fileList[i].file.name,
|
||||||
path: this.$getObjectName(res.url),
|
path: this.$getObjectName(res.url),
|
||||||
url: this.$getObjectName(res.url),
|
url: this.$getObjectName(res.url),
|
||||||
|
type: this.fileList[i].type,
|
||||||
|
size: this.fileList[i].size,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.saveClinicalData();
|
this.saveClinicalData();
|
||||||
|
|
Loading…
Reference in New Issue