diff --git a/src/utils/filter.js b/src/utils/filter.js
index 7c74fa05d..b89eac131 100644
--- a/src/utils/filter.js
+++ b/src/utils/filter.js
@@ -1,7 +1,9 @@
import Vue from 'vue'
import moment from 'moment'
import 'moment/locale/zh-cn'
-import { timeAgo } from '@/utils/util'
+import {
+ timeAgo
+} from '@/utils/util'
moment.locale('zh-cn')
Vue.filter('NumberFormat', function(value) {
@@ -21,3 +23,16 @@ Vue.filter('moment', function(dataStr, pattern = 'YYYY-MM-DD HH:mm:ss') {
})
Vue.filter('timeAgo', timeAgo)
+
+Vue.filter('fileSizeFormat', function(value) {
+ if (!value) {
+ return '0 Bytes'
+ }
+ var unitArr = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
+ var index = 0
+ var srcsize = parseFloat(value)
+ index = Math.floor(Math.log(srcsize) / Math.log(1024))
+ var size = srcsize / Math.pow(1024, index)
+ size = size.toFixed(2)
+ return size + ' ' + unitArr[index]
+})
diff --git a/src/views/attachment/components/AttachmentDetailDrawer.vue b/src/views/attachment/components/AttachmentDetailDrawer.vue
index c581df3f2..5e59dfd07 100644
--- a/src/views/attachment/components/AttachmentDetailDrawer.vue
+++ b/src/views/attachment/components/AttachmentDetailDrawer.vue
@@ -37,7 +37,10 @@
-
+
+
+ {{ attachment.size | fileSizeFormat }}
+
附件大小:
@@ -47,7 +50,10 @@
-
+
+
+ {{ attachment.createTime | moment }}
+
上传日期: