feat:NEZ-410
This commit is contained in:
@@ -28,11 +28,29 @@
|
|||||||
</el-input>
|
</el-input>
|
||||||
</div>
|
</div>
|
||||||
<pick-time :refresh-data-func="dateChange" v-model="searchTime" :use-chart-unit="false" v-if="from=='asset'"></pick-time>
|
<pick-time :refresh-data-func="dateChange" v-model="searchTime" :use-chart-unit="false" v-if="from=='asset'"></pick-time>
|
||||||
<button @click="addChart" :title="$t('overall.createChart')" v-if="from != 'alertRule' && from != 'endpoint'"
|
<export-excel
|
||||||
class="nz-btn nz-btn-size-normal nz-btn-style-light ">
|
export-file-name="chart"
|
||||||
|
export-url="/panel/export"
|
||||||
|
import-url="/panel/import"
|
||||||
|
:params="filter"
|
||||||
|
:from="'asset'"
|
||||||
|
:link="obj"
|
||||||
|
@afterImport="dateChange"
|
||||||
|
v-if="$route.path==='/asset' || $route.path==='/model'"
|
||||||
|
>
|
||||||
|
<template slot="optionZone">
|
||||||
|
<button @click="addChart" :title="$t('overall.createChart')" v-if="from != 'alertRule' && from != 'endpoint'"
|
||||||
|
class="nz-btn nz-btn-size-normal nz-btn-style-light ">
|
||||||
|
<i class="nz-icon-create-square nz-icon"></i>
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
</export-excel>
|
||||||
|
<span v-else>
|
||||||
|
<button @click="addChart" :title="$t('overall.createChart')" v-if="from != 'alertRule' && from != 'endpoint'"
|
||||||
|
class="nz-btn nz-btn-size-normal nz-btn-style-light ">
|
||||||
<i class="nz-icon-create-square nz-icon"></i>
|
<i class="nz-icon-create-square nz-icon"></i>
|
||||||
</button>
|
</button>
|
||||||
|
</span>
|
||||||
<button @click="syncChart" :title="$t('overall.syncChart')" v-if="from == 'asset'||from == 'model'" style="margin-left: 20px;"
|
<button @click="syncChart" :title="$t('overall.syncChart')" v-if="from == 'asset'||from == 'model'" style="margin-left: 20px;"
|
||||||
class="nz-btn nz-btn-size-normal nz-btn-style-light ">
|
class="nz-btn nz-btn-size-normal nz-btn-style-light ">
|
||||||
<i class="nz-icon-sync nz-icon"></i>
|
<i class="nz-icon-sync nz-icon"></i>
|
||||||
@@ -77,7 +95,8 @@
|
|||||||
import ChartBox from "../../../page/dashboard/chartBox";
|
import ChartBox from "../../../page/dashboard/chartBox";
|
||||||
import ChartList from '../../../charts/chart-list';
|
import ChartList from '../../../charts/chart-list';
|
||||||
import bus from '../../../../libs/bus';
|
import bus from '../../../../libs/bus';
|
||||||
import timePicker from '../../../common/timePicker'
|
import timePicker from '../../../common/timePicker';
|
||||||
|
import exportXLSX from "../../../common/exportXLSX";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "panel",
|
name: "panel",
|
||||||
@@ -154,7 +173,8 @@
|
|||||||
components: {
|
components: {
|
||||||
'chart-box': ChartBox,
|
'chart-box': ChartBox,
|
||||||
'chart-list': ChartList,
|
'chart-list': ChartList,
|
||||||
'time-picker':timePicker
|
'time-picker':timePicker,
|
||||||
|
'export-excel':exportXLSX,
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
//刷新
|
//刷新
|
||||||
|
|||||||
@@ -104,6 +104,7 @@
|
|||||||
params:{type:Object},
|
params:{type:Object},
|
||||||
exportFileName:{type:String},
|
exportFileName:{type:String},
|
||||||
importUrl: {type:String,required:true},
|
importUrl: {type:String,required:true},
|
||||||
|
link:{type:Object},
|
||||||
},
|
},
|
||||||
data:function(){
|
data:function(){
|
||||||
return {
|
return {
|
||||||
@@ -112,10 +113,14 @@
|
|||||||
importFileList:[],
|
importFileList:[],
|
||||||
importResult:null,
|
importResult:null,
|
||||||
exportShow: false,
|
exportShow: false,
|
||||||
|
paramsType:''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created(){
|
created(){
|
||||||
},
|
},
|
||||||
|
mounted(){
|
||||||
|
this.getParamsType();
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
importChange:function(file,fileList){
|
importChange:function(file,fileList){
|
||||||
if (fileList.length > 0) {
|
if (fileList.length > 0) {
|
||||||
@@ -152,6 +157,12 @@
|
|||||||
if(this.importFile && this.importFile.raw){
|
if(this.importFile && this.importFile.raw){
|
||||||
let form = new FormData();
|
let form = new FormData();
|
||||||
form.append('excelFile',this.importFile.raw);
|
form.append('excelFile',this.importFile.raw);
|
||||||
|
if(this.paramsType){
|
||||||
|
form.append('type',this.paramsType);
|
||||||
|
if(this.paramsType==='asset' || this.paramsType==='model'){
|
||||||
|
form.append('linkId',this.link.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
this.$post(this.importUrl,form,{'Content-Type': 'multipart/form-data'}).then(response=>{
|
this.$post(this.importUrl,form,{'Content-Type': 'multipart/form-data'}).then(response=>{
|
||||||
if(response.code==200 && response.msg=='success'){
|
if(response.code==200 && response.msg=='success'){
|
||||||
this.importResult=response.data;
|
this.importResult=response.data;
|
||||||
@@ -228,6 +239,9 @@
|
|||||||
},
|
},
|
||||||
exportExcel:function(url,params,fileName){
|
exportExcel:function(url,params,fileName){
|
||||||
let temp=this;
|
let temp=this;
|
||||||
|
if(this.paramsType){
|
||||||
|
params.type=this.paramsType;
|
||||||
|
}
|
||||||
axios.get(url,{responseType:'blob',params:params}).then(res=>{
|
axios.get(url,{responseType:'blob',params:params}).then(res=>{
|
||||||
if(window.navigator.msSaveOrOpenBlob){
|
if(window.navigator.msSaveOrOpenBlob){
|
||||||
// 兼容ie11
|
// 兼容ie11
|
||||||
@@ -248,6 +262,10 @@
|
|||||||
showImportBox:function(type){
|
showImportBox:function(type){
|
||||||
this.importBox.show=true;
|
this.importBox.show=true;
|
||||||
this.importBox.type=type;
|
this.importBox.type=type;
|
||||||
|
if(type == 2&&(this.$route.path==='/asset'|| this.$route.path==='/model')){
|
||||||
|
this.exportCur()
|
||||||
|
return
|
||||||
|
}
|
||||||
if(type == 1){//import
|
if(type == 1){//import
|
||||||
this.importBox.title=this.$t('overall.importExcel');
|
this.importBox.title=this.$t('overall.importExcel');
|
||||||
this.importBox.width='600px';
|
this.importBox.width='600px';
|
||||||
@@ -269,6 +287,16 @@
|
|||||||
},
|
},
|
||||||
formatNum:function(num){
|
formatNum:function(num){
|
||||||
return num>9?num:'0'+num;
|
return num>9?num:'0'+num;
|
||||||
|
},
|
||||||
|
getParamsType(){
|
||||||
|
console.log(this.$route);
|
||||||
|
let path=this.$route.path;
|
||||||
|
switch(path){
|
||||||
|
case '/panel': this.paramsType='dashboard';break;
|
||||||
|
case '/asset': this.paramsType='asset';break;
|
||||||
|
case '/model': this.paramsType='model';break;
|
||||||
|
default: this.paramsType='';break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user