From 74033b2d4fd379b328d1566f9892165aaf5c4eb8 Mon Sep 17 00:00:00 2001 From: wangxiaoshuang <825034831@qq.com> Date: Tue, 8 Jul 2025 13:39:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=A4=A7=E5=B0=8F=E4=B8=BANU?= =?UTF-8?q?LL=E6=97=B6=EF=BC=8C=E5=B1=95=E7=A4=BA=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=EF=BC=8C=E4=B8=8D=E8=A6=81=E4=B8=BA0.=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E6=97=B6=E5=8D=95=E4=BD=8D=E9=9C=80=E8=A6=81=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../uploadDicomAndNonedicom/nonedicomFile.vue | 8 +- src/main.js | 3 + src/utils/index.js | 10 + .../reading-period/components/AddOrEditCD.vue | 4 +- .../trial-summary/audit-record/index.vue | 8 +- .../trial-summary/image-summary/index.vue | 6 +- .../trial-summary/push-record/index.vue | 199 ++------ .../components/historyFileList.vue | 6 +- .../components/uploadClinicalData.vue | 434 +++++------------- .../components/uploadNonDicomFiles.vue | 4 +- .../components/uploadPetClinicalData.vue | 416 ++++------------- .../qc-check/components/qualityAssurance.vue | 6 +- 12 files changed, 269 insertions(+), 835 deletions(-) diff --git a/src/components/uploadDicomAndNonedicom/nonedicomFile.vue b/src/components/uploadDicomAndNonedicom/nonedicomFile.vue index fe6833ec..afb67955 100644 --- a/src/components/uploadDicomAndNonedicom/nonedicomFile.vue +++ b/src/components/uploadDicomAndNonedicom/nonedicomFile.vue @@ -29,9 +29,7 @@ {{ - scope.row.FileSize && scope.row.FileSize > 0 - ? `${(scope.row.FileSize / 1024 / 1024).toFixed(3)}MB` - : '' + $FormatSize(scope.row.FileSize) }} @@ -68,9 +66,7 @@ {{ - scope.row.FileSize && scope.row.FileSize > 0 - ? `${(scope.row.FileSize / 1024 / 1024).toFixed(3)}MB` - : '' + $FormatSize(scope.row.FileSize) }} diff --git a/src/main.js b/src/main.js index c9751734..2fe29606 100644 --- a/src/main.js +++ b/src/main.js @@ -26,6 +26,9 @@ Vue.use(VueClipboard) import permission from './utils/permission' Vue.use(permission) +import { formatSize } from "./utils" +Vue.prototype.$FormatSize = formatSize + import Viewer from 'v-viewer' import './assets/css/viewer.css' Viewer.setDefaults({ diff --git a/src/utils/index.js b/src/utils/index.js index caab2046..23817cf2 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -91,4 +91,14 @@ export function deepClone(source, map = new WeakMap()) { } return target; +} + +export function formatSize(size, fixed = 0) { + if (isNaN(parseFloat(size))) return '' + let kbSize = size / 1024 + if (kbSize <= 1024) { + return `${kbSize.toFixed(fixed)}KB` + } + let mbSize = kbSize / 1024 + return `${mbSize.toFixed(fixed)}MB` } \ No newline at end of file diff --git a/src/views/trials/trials-panel/subject/reading-period/components/AddOrEditCD.vue b/src/views/trials/trials-panel/subject/reading-period/components/AddOrEditCD.vue index 61024ca3..e7fff323 100644 --- a/src/views/trials/trials-panel/subject/reading-period/components/AddOrEditCD.vue +++ b/src/views/trials/trials-panel/subject/reading-period/components/AddOrEditCD.vue @@ -99,9 +99,9 @@ {{ scope.row.size && scope.row.size > 0 - ? `${(scope.row.size / 1024 / 1024).toFixed(3)}MB` + ? $FormatSize(scope.row.size) : scope.row.Size && scope.row.Size > 0 - ? `${(scope.row.Size / 1024 / 1024).toFixed(3)}MB` + ? $FormatSize(scope.row.Size) : '' }} diff --git a/src/views/trials/trials-panel/trial-summary/audit-record/index.vue b/src/views/trials/trials-panel/trial-summary/audit-record/index.vue index 1e05d6f9..be10bdf7 100644 --- a/src/views/trials/trials-panel/trial-summary/audit-record/index.vue +++ b/src/views/trials/trials-panel/trial-summary/audit-record/index.vue @@ -850,22 +850,22 @@ export default { item = { key: v.Code, Enum: this.$i18n.locale === 'zh' ? v.ValueCN : v.Value, - newValue: parseInt(obj[v.Code] ) >= 0 ? `${(obj[v.Code] / 1024 / 1024).toFixed(3)}MB` : '--', + newValue: parseInt(obj[v.Code] ) >= 0 ? this.$FormatSize(obj[v.Code]) : '--', oldValue: '' } } else if (row.OptType === 'Delete') { item = { key: v.Code, Enum: this.$i18n.locale === 'zh' ? v.ValueCN : v.Value, - oldValue: parseInt(obj[v.Code] ) >= 0 ? `${(obj[v.Code] / 1024 / 1024).toFixed(3)}MB` : '--', + oldValue: parseInt(obj[v.Code] ) >= 0 ? this.$FormatSize(obj[v.Code]) : '--', newValue: '--' } } else { item = { key: v.Code, Enum: this.$i18n.locale === 'zh' ? v.ValueCN : v.Value, - newValue: parseInt(obj[v.Code] ) >= 0 ? `${(obj[v.Code] / 1024 / 1024).toFixed(3)}MB` : '--', - oldValue: parseInt(upObj[v.Code] ) >= 0 ? `${(upObj[v.Code] / 1024 / 1024).toFixed(3)}MB` : '--', + newValue: parseInt(obj[v.Code] ) >= 0 ? this.$FormatSize(obj[v.Code]) : '--', + oldValue: parseInt(upObj[v.Code] ) >= 0 ? this.$FormatSize(upObj[v.Code]) : '--', } } item.DataType = v.DataType diff --git a/src/views/trials/trials-panel/trial-summary/image-summary/index.vue b/src/views/trials/trials-panel/trial-summary/image-summary/index.vue index 598f310f..baa26951 100644 --- a/src/views/trials/trials-panel/trial-summary/image-summary/index.vue +++ b/src/views/trials/trials-panel/trial-summary/image-summary/index.vue @@ -66,10 +66,10 @@ {{ $fd('IsDicom', true) - }} + }} {{ $fd('IsDicom', false) - }} + }} @@ -308,7 +308,7 @@ export default { this.selectArr = selection let num = this.selectArr.reduce((sum, item) => sum + item.TotalImageSize, 0) if (num <= 0) return this.image_size.CheckImageSize = null - this.image_size.CheckImageSize = (num / 1024 / 1024).toFixed(3) + 'MB' + this.image_size.CheckImageSize = this.$FormatSize(num) }, // 获取site下拉框数据 getSite() { diff --git a/src/views/trials/trials-panel/trial-summary/push-record/index.vue b/src/views/trials/trials-panel/trial-summary/push-record/index.vue index f87a4550..94472ff8 100644 --- a/src/views/trials/trials-panel/trial-summary/push-record/index.vue +++ b/src/views/trials/trials-panel/trial-summary/push-record/index.vue @@ -3,212 +3,100 @@ - - + + - - - + + + - - - + + + - + :end-placeholder="$t('trials:loginLog:table:endTime')" value-format="yyyy-MM-dd HH:mm:ss" + @change="handleDatetimeChange" /> {{ $t('common:button:search') }} - + {{ $t('common:button:reset') }} - + {{ $t('common:button:export') }} - + - + - + - + - + - + - + - + - + {{ - scope.row.FileSize && scope.row.FileSize > 0 - ? `${(scope.row.FileSize / 1024 / 1024).toFixed(3)}MB` - : '' + $FormatSize(scope.row.FileSize) }} - + - + - + {{ scope.row.UploadIntervalStr }} - + - - \ No newline at end of file + \ No newline at end of file diff --git a/src/views/trials/trials-panel/trial-summary/trial-document/components/historyFileList.vue b/src/views/trials/trials-panel/trial-summary/trial-document/components/historyFileList.vue index 27cf342a..2d8386db 100644 --- a/src/views/trials/trials-panel/trial-summary/trial-document/components/historyFileList.vue +++ b/src/views/trials/trials-panel/trial-summary/trial-document/components/historyFileList.vue @@ -35,10 +35,8 @@ sortable="custom"> {{ - scope.row.FileSize && scope.row.FileSize > 0 - ? `${(scope.row.FileSize / 1024 / 1024).toFixed(3)}MB` - : '' - }} + $FormatSize(scope.row.FileSize) + }} - + {{ $t("trials:uploadClinicalData:title:pastTreatment") }} - + {{ $t("common:button:new") }} - + - + - + {{ scope.row.StartTime @@ -52,10 +33,7 @@ - + {{ scope.row.EndTime @@ -65,71 +43,39 @@ - + {{ $fd("IsPdEnum", scope.row.IsPD) }} - + - + - + {{ $t("trials:uploadClinicalData:title:pastSurgery") }} - + {{ $t("common:button:new") }} - + - + - + {{ scope.row.OperationTime @@ -139,33 +85,17 @@ - + - + - + @@ -173,30 +103,17 @@ {{ $t("trials:uploadClinicalData:title:others") }} - + {{ $t("common:button:new") }} - + - + - + {{ scope.row.StartTime @@ -206,10 +123,7 @@ - + {{ scope.row.EndTime @@ -219,33 +133,17 @@ - + - + - + @@ -254,42 +152,21 @@ - + {{ $t("trials:uploadClinicalData:button:downloadTemplate") }} - + "> - + {{ $t("common:button:new") }} - beginScanFiles($event, cd.Id, cd.ClinicalDataTrialSetId) - " - /> + " /> - + - - - {{ - scope.row.Size && scope.row.Size > 0 - ? `${(scope.row.Size / 1024 / 1024).toFixed(3)}MB` - : '' - }} - + + + {{ + $FormatSize(scope.row.Size) + }} + - + - + - + - - + + - - + + - - + + - - + + - - + + - - - + + + @@ -567,7 +341,7 @@ export default { }; this.currentRow.TrialId = this.$route.query.trialId; var files = e.target.files; - this.fileList= []; + this.fileList = []; for (var i = 0; i < files.length; ++i) { const fileName = files[i].name; var extendName = fileName @@ -575,15 +349,15 @@ export default { .toLocaleLowerCase(); if (this.faccept.indexOf(extendName) !== -1) { let obj = { - size:files[i].size, - type:extendName.split('.')[1], - file:files[i], + size: files[i].size, + type: extendName.split('.')[1], + file: files[i], } this.fileList.push(obj); } } this.handleUploadFile(); - this.$refs.addFile.forEach(item=>{ + this.$refs.addFile.forEach(item => { item.value = null; }) }, diff --git a/src/views/trials/trials-panel/visit/crc-upload/components/uploadNonDicomFiles.vue b/src/views/trials/trials-panel/visit/crc-upload/components/uploadNonDicomFiles.vue index ec01ed3a..6dc6592e 100644 --- a/src/views/trials/trials-panel/visit/crc-upload/components/uploadNonDicomFiles.vue +++ b/src/views/trials/trials-panel/visit/crc-upload/components/uploadNonDicomFiles.vue @@ -38,9 +38,7 @@ {{ - scope.row.FileSize && scope.row.FileSize > 0 - ? `${(scope.row.FileSize / 1024 / 1024).toFixed(3)}MB` - : '' + $FormatSize(scope.row.FileSize) }} diff --git a/src/views/trials/trials-panel/visit/crc-upload/components/uploadPetClinicalData.vue b/src/views/trials/trials-panel/visit/crc-upload/components/uploadPetClinicalData.vue index 34c1dae7..9a7c6d99 100644 --- a/src/views/trials/trials-panel/visit/crc-upload/components/uploadPetClinicalData.vue +++ b/src/views/trials/trials-panel/visit/crc-upload/components/uploadPetClinicalData.vue @@ -1,48 +1,29 @@ - + {{ $t('trials:uploadClinicalData:title:pastTreatment') }} - + {{ $t('common:button:new') }} - + - + - + {{ scope.row.StartTime @@ -52,10 +33,7 @@ - + {{ scope.row.EndTime @@ -65,71 +43,39 @@ - + {{ $fd('IsPdEnum', scope.row.IsPD) }} - + - + - + {{ $t('trials:uploadClinicalData:title:pastSurgery') }} - + {{ $t('common:button:new') }} - + - + - + {{ scope.row.OperationTime @@ -139,33 +85,17 @@ - + - + - + @@ -173,30 +103,17 @@ {{ $t('trials:uploadClinicalData:title:others') }} - + {{ $t('common:button:new') }} - + - + - + {{ scope.row.StartTime @@ -206,10 +123,7 @@ - + {{ scope.row.EndTime @@ -219,53 +133,27 @@ - + - + - + - + - + {{ $t('trials:uploadClinicalData:button:downloadTemplate') }} @@ -279,22 +167,10 @@ --> - + {{ $t('common:button:new') }} - beginScanFiles($event, cd.Id, cd.ClinicalDataTrialSetId) - " - /> + " /> - + - + {{ - scope.row.Size && scope.row.Size > 0 - ? `${(scope.row.Size / 1024 / 1024).toFixed(3)}MB` - : '' + $FormatSize(scope.row.Size) }} - + - + - + - - + + - - + + - - + + - - + + - - + + - - - + + + diff --git a/src/views/trials/trials-panel/visit/qc-check/components/qualityAssurance.vue b/src/views/trials/trials-panel/visit/qc-check/components/qualityAssurance.vue index 60fc77c5..ba31ee73 100644 --- a/src/views/trials/trials-panel/visit/qc-check/components/qualityAssurance.vue +++ b/src/views/trials/trials-panel/visit/qc-check/components/qualityAssurance.vue @@ -285,11 +285,7 @@ {{ - scope.row.FileSize && scope.row.FileSize > 0 - ? `${(scope.row.FileSize / 1024 / 1024).toFixed( - 2 - )}MB` - : 0 + $FormatSize(scope.row.FileSize) }}