diff --git a/nezha-fronted/package-lock.json b/nezha-fronted/package-lock.json index 88c58f08e..eedd67a0c 100644 --- a/nezha-fronted/package-lock.json +++ b/nezha-fronted/package-lock.json @@ -2262,6 +2262,11 @@ } } }, + "countup.js": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/countup.js/-/countup.js-1.9.3.tgz", + "integrity": "sha1-zj5QzXFgRB5HjwfaMYle3MDxyd0=" + }, "crc-32": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.0.tgz", @@ -12099,6 +12104,15 @@ "resolved": "https://registry.npmjs.org/vue/-/vue-2.6.10.tgz", "integrity": "sha512-ImThpeNU9HbdZL3utgMCq0oiMzAkt1mcgy3/E6zWC/G6AaQoeuFdsl9nDhTDU3X1R6FK7nsIUuRACVcjI+A2GQ==" }, + "vue-countupjs": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/vue-countupjs/-/vue-countupjs-1.0.0.tgz", + "integrity": "sha1-QcV6peSFnPwNgusDV0sL7NucqQs=", + "requires": { + "countup.js": "^1.8.5", + "vue": "^2.3.3" + } + }, "vue-hot-reload-api": { "version": "2.3.4", "resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.3.4.tgz", diff --git a/nezha-fronted/package.json b/nezha-fronted/package.json index 093b08572..85fd99c74 100644 --- a/nezha-fronted/package.json +++ b/nezha-fronted/package.json @@ -17,6 +17,7 @@ "node-sass": "^4.13.1", "pl-table": "^2.5.8", "vue": "^2.5.2", + "vue-countupjs": "^1.0.0", "vue-i18n": "^8.15.1", "vue-resource": "^1.5.1", "vue-router": "^3.0.1", diff --git a/nezha-fronted/src/components/common/exportXLSX.vue b/nezha-fronted/src/components/common/exportXLSX.vue index fb980904f..7c81bf96b 100644 --- a/nezha-fronted/src/components/common/exportXLSX.vue +++ b/nezha-fronted/src/components/common/exportXLSX.vue @@ -105,7 +105,7 @@ exportUrl:{type:String,required:true}, params:{type:Object}, exportFileName:{type:String}, - + importUrl: {type:String,required:true}, }, data:function(){ return { @@ -130,7 +130,13 @@ }, rollbackImport:function(){ - this.$delete('/asset/cancelImport?seq='+this.importResult.seq).then(response=>{ + let url; + if (this.importUrl.indexOf("asset") > -1) { + url = "/asset/cancelImport"; + } else if (this.importUrl.indexOf("endpoint") > -1) { + url = "/endpoint/cancelImport"; + } + this.$delete(url + '?seq='+this.importResult.seq).then(response=>{ if(response.code == 200 ){ this.$message({duration: 2000, type: 'success', message: this.$t("tip.saveSuccess")}); }else{ @@ -142,8 +148,8 @@ importExcel:function(){ if(this.importFile && this.importFile.raw){ let form = new FormData(); - form.append('assetsExcelFile',this.importFile.raw); - this.$post('/asset/import',form,{'Content-Type': 'multipart/form-data'}).then(response=>{ + form.append('excelFile',this.importFile.raw); + this.$post(this.importUrl,form,{'Content-Type': 'multipart/form-data'}).then(response=>{ if(response.code==200 && response.msg=='success'){ this.importResult=response.data; this.$emit('afterImport') diff --git a/nezha-fronted/src/components/page/asset/asset.vue b/nezha-fronted/src/components/page/asset/asset.vue index 137a2f662..7a8170f15 100644 --- a/nezha-fronted/src/components/page/asset/asset.vue +++ b/nezha-fronted/src/components/page/asset/asset.vue @@ -97,6 +97,7 @@ diff --git a/nezha-fronted/src/components/page/dashboard/overview/overview2.scss b/nezha-fronted/src/components/page/dashboard/overview/overview2.scss index efb8f19e6..09914fb2f 100644 --- a/nezha-fronted/src/components/page/dashboard/overview/overview2.scss +++ b/nezha-fronted/src/components/page/dashboard/overview/overview2.scss @@ -217,7 +217,7 @@ .content-row-box:first-of-type .content-col-box:last-of-type .content-col-content { position: relative; } -.content-row-box:first-of-type .content-col-box:last-of-type .content-col-content span { +.content-row-box:first-of-type .content-col-box:last-of-type .content-col-content>span:last-of-type { position: absolute; bottom: 5%; right: 5%; diff --git a/nezha-fronted/src/components/page/dashboard/overview/overview2.vue b/nezha-fronted/src/components/page/dashboard/overview/overview2.vue index 4b9396f4b..5df89fc68 100644 --- a/nezha-fronted/src/components/page/dashboard/overview/overview2.vue +++ b/nezha-fronted/src/components/page/dashboard/overview/overview2.vue @@ -33,31 +33,44 @@
{{$t("dashboard.overview.asset.title")}}
-
{{(assetData ? assetData.totalStat.total : "") | numberFormat}}
+
+ + {{(assetData ? assetData.totalStat.total : '') | unitFormat}} +
{{$t("dashboard.overview.project.project")}}
-
{{(projectData ? projectData.projectStat.length : "") | numberFormat}}
+
+ + {{(projectData ? projectData.projectStat.length : '') | unitFormat}} +
{{$t("dashboard.overview.module.module")}}
-
{{(moduleData ? moduleData.moduleStat.length : "") | numberFormat}}
+
+ + {{(moduleData ? moduleData.moduleStat.length : '') | unitFormat}} +
{{$t("dashboard.overview.endpoint.endpoint")}}
-
{{(endpointData ? endpointData.total : "") | numberFormat}}
+
+ + {{(endpointData ? endpointData.total : '') | unitFormat}} +
{{$t("dashboard.overview.alert.alertMessage")}}
-
{{(alertMessageData ? alertMessageData.alertMessageTotal : "") | numberFormat}}
+
+ {{(alertMessageData ? alertMessageData.alertMessageTotal : '') | unitFormat}} {{$t("dashboard.overview.alert.ruleNum")}} : {{(alertRuleData ? alertRuleData.alertRuleTotal : "") | numberFormat}}
@@ -188,12 +201,15 @@ import axios from 'axios'; import bus from '../../../../libs/bus'; import timePicker from '../../../common/timePicker' + import VueCountUp from 'vue-countupjs' + var timeout; //第三行第三个图的dropdown下拉菜单timeout export default { name: "overview2", components:{ 'chart-box': chart, - 'time-picker': timePicker + 'time-picker': timePicker, + 'vue-countup': VueCountUp }, data() { return { @@ -265,6 +281,23 @@ } } return 0; + }, + unitFormat(num) { + if (num) { + try { + num = parseFloat(num); + if (num < 1000) { + return ""; + } else if (num < 1000000) { + return " K"; + } else if (num < 1000000000) { + return " M"; + } + } catch (err) { + return ""; + } + } + return ""; } }, methods: { diff --git a/nezha-fronted/src/components/page/project/project.vue b/nezha-fronted/src/components/page/project/project.vue index 83a55c6f0..a1fa0ec9d 100644 --- a/nezha-fronted/src/components/page/project/project.vue +++ b/nezha-fronted/src/components/page/project/project.vue @@ -85,6 +85,7 @@