NEZ-843 fix:asset,endpoint chart 导入模板接口错误
This commit is contained in:
@@ -37,20 +37,20 @@
|
||||
<operation-log-tab v-if="from === fromRoute.user && targetTab === 'operationLogTab'" :from="from" :obj="obj" :tabs="tabs.user.operationLog" @changeTab="changeTab"></operation-log-tab>
|
||||
<terminal-log-tab v-if="from === fromRoute.user && targetTab === 'terminalLogTab'" :from="from" :obj="obj" :tabs="tabs.user.terminalLog" @changeTab="changeTab"></terminal-log-tab>
|
||||
<!-- asset列表的3个 -->
|
||||
<panel-tab-new v-if="from === fromRoute.asset && targetTab === 'panelTab'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.asset.panel" :targetTab.sync="targetTab" @changeTab="changeTab"></panel-tab-new>
|
||||
<panel-tab-new :paramsType="'asset'" v-if="from === fromRoute.asset && targetTab === 'panelTab'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.asset.panel" :targetTab.sync="targetTab" @changeTab="changeTab"></panel-tab-new>
|
||||
<alertMessageTabNew v-if="from === fromRoute.asset && targetTab === 'alertMessageTab'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.asset.alertMessage" :targetTab="targetTab" @changeTab="changeTab"></alertMessageTabNew>
|
||||
<endpointTabNew v-if="from === fromRoute.asset && targetTab === 'endpointTab'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.asset.endpoint" :targetTab="targetTab" @changeTab="changeTab"></endpointTabNew>
|
||||
<assetSubTab v-if="from === fromRoute.asset && targetTab === 'assetSubTab' && obj.childrenNum" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.asset.alertMessageSub" :targetTab="targetTab" @changeTab="changeTab"></assetSubTab>
|
||||
<!--module列表的tab-->
|
||||
<endpointTabNew v-if="from === fromRoute.module && targetTab === 'endpoint'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.module.moduleTabTitle" :targetTab="targetTab" @changeTab="changeTab"></endpointTabNew>
|
||||
<alertMessageTabNew v-if="from === fromRoute.module && targetTab === 'moduleAlertMessage'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.module.moduleTabTitle" @changeTab="changeTab" :targetTab="targetTab"></alertMessageTabNew>
|
||||
<panel-tab-new v-if="from === fromRoute.module && targetTab === 'panel'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.module.moduleTabTitle" :targetTab.sync="targetTab" @changeTab="changeTab"></panel-tab-new>
|
||||
<panel-tab-new :paramsType="'module'" v-if="from === fromRoute.module && targetTab === 'panel'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.module.moduleTabTitle" :targetTab.sync="targetTab" @changeTab="changeTab"></panel-tab-new>
|
||||
<!--endpoint列表的tab-->
|
||||
<panel-tab-new v-if="from === fromRoute.endpoint && targetTab === 'panelTab'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.endpoint.endpointTabTitle" :targetTab.sync="targetTab" @changeTab="changeTab"></panel-tab-new>
|
||||
<panel-tab-new :paramsType="'endpoint'" v-if="from === fromRoute.endpoint && targetTab === 'panelTab'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.endpoint.endpointTabTitle" :targetTab.sync="targetTab" @changeTab="changeTab"></panel-tab-new>
|
||||
<endpointQuery v-if="from === fromRoute.endpoint && targetTab === 'endpointQuery'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.endpoint.endpointTabTitle" @changeTab="changeTab" :targetTab="targetTab"></endpointQuery>
|
||||
<alertMessageTabNew v-if="from === fromRoute.endpoint && targetTab === 'endpointAlertMessage'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.endpoint.endpointTabTitle" @changeTab="changeTab" :targetTab="targetTab"></alertMessageTabNew>
|
||||
<!--chartTemp的Tab-->
|
||||
<panel-tab-new v-if="from === fromRoute.chartTemp && targetTab === 'panel'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.chartTemp.chartTempTabTitle" :targetTab.sync="targetTab" @changeTab="changeTab"></panel-tab-new>
|
||||
<panel-tab-new :paramsType="'template'" v-if="from === fromRoute.chartTemp && targetTab === 'panel'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.chartTemp.chartTempTabTitle" :targetTab.sync="targetTab" @changeTab="changeTab"></panel-tab-new>
|
||||
<!--alertRule Tab-->
|
||||
<alertMessageTabNew v-if="from === fromRoute.alertRule && targetTab === 'alertRuleAlertMessage'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.alertRule.alertRule" @changeTab="changeTab" :targetTab="targetTab"></alertMessageTabNew>
|
||||
<!--model 下滑-->
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
<top-tool-more-options
|
||||
id="asset-list"
|
||||
:params="filter"
|
||||
:params-type="paramsType"
|
||||
:permissions="{import: 'panel_chart_add', export: 'panel_view'}"
|
||||
class="top-tool-export margin-r-10"
|
||||
export-file-name="asset-charts"
|
||||
@@ -57,6 +58,7 @@
|
||||
:params="filter"
|
||||
:permissions="{import: 'panel_chart_add', export: 'panel_view'}"
|
||||
:showCur="false"
|
||||
:params-type="paramsType"
|
||||
:showLock="from === fromRoute.endpoint"
|
||||
class="top-tool-export margin-r-10"
|
||||
export-file-name="endpoint-charts"
|
||||
@@ -122,7 +124,11 @@ export default {
|
||||
props: {
|
||||
from: String,
|
||||
obj: Object,
|
||||
draggable: { type: Boolean, default: true }
|
||||
draggable: { type: Boolean, default: true },
|
||||
paramsType: {
|
||||
type: String,
|
||||
default: 'dashboard'
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
|
||||
@@ -119,6 +119,10 @@ export default {
|
||||
},
|
||||
showLock: {
|
||||
type: Boolean, default: false
|
||||
},
|
||||
paramsType: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data () {
|
||||
@@ -128,12 +132,11 @@ export default {
|
||||
importFileList: [],
|
||||
importResult: null,
|
||||
exportShow: false,
|
||||
paramsType: '',
|
||||
panelLock: true
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
this.getParamsType()
|
||||
// this.getParamsType()
|
||||
},
|
||||
methods: {
|
||||
importChange (file, fileList) {
|
||||
@@ -220,12 +223,13 @@ export default {
|
||||
|
||||
let url = null
|
||||
const param = { language: language }
|
||||
if (this.paramsType === 'asset') {
|
||||
if (this.importUrl.indexOf('asset') > -1) {
|
||||
url = '/asset/asset/template'
|
||||
param.type = 'asset'
|
||||
} else if (this.paramsType === 'dashboard') {
|
||||
} else if (this.importUrl.indexOf('panel') > -1) {
|
||||
url = 'visual/panel/template'
|
||||
} else if (this.paramsType === 'endpoint') {
|
||||
param.type = this.paramsType
|
||||
} else if (this.importUrl.indexOf('endpoint') > -1) {
|
||||
url = '/monitor/endpoint/template'
|
||||
param.type = 'endpoint'
|
||||
} else if (this.importUrl.indexOf('tmpl') > -1) {
|
||||
@@ -244,12 +248,12 @@ export default {
|
||||
},
|
||||
exportCur () {
|
||||
const params = JSON.parse(JSON.stringify(this.params))
|
||||
if (this.params2){
|
||||
Object.keys(this.params2).forEach(key=>{
|
||||
if ( params[key] ) {
|
||||
if ( params[key].prototype.toString.call(val) === '[object Object]' ){
|
||||
Object.assign(params[key],this.params2[key])
|
||||
} else if (params[key].prototype.toString.call(val) === '[object Array]'){
|
||||
if (this.params2) {
|
||||
Object.keys(this.params2).forEach(key => {
|
||||
if (params[key]) {
|
||||
if (params[key].prototype.toString.call(val) === '[object Object]') {
|
||||
Object.assign(params[key], this.params2[key])
|
||||
} else if (params[key].prototype.toString.call(val) === '[object Array]') {
|
||||
params[key].concat(this.params2[key])
|
||||
}
|
||||
} else {
|
||||
@@ -270,12 +274,12 @@ export default {
|
||||
},
|
||||
exportAll () {
|
||||
const params = JSON.parse(JSON.stringify(this.params))
|
||||
if (this.params2){
|
||||
Object.keys(this.params2).forEach(key=>{
|
||||
if ( params[key] ) {
|
||||
if ( params[key].prototype.toString.call(val) === '[object Object]' ){
|
||||
Object.assign(params[key],this.params2[key])
|
||||
} else if (params[key].prototype.toString.call(val) === '[object Array]'){
|
||||
if (this.params2) {
|
||||
Object.keys(this.params2).forEach(key => {
|
||||
if (params[key]) {
|
||||
if (params[key].prototype.toString.call(val) === '[object Object]') {
|
||||
Object.assign(params[key], this.params2[key])
|
||||
} else if (params[key].prototype.toString.call(val) === '[object Array]') {
|
||||
params[key].concat(this.params2[key])
|
||||
}
|
||||
} else {
|
||||
@@ -367,16 +371,16 @@ export default {
|
||||
},
|
||||
formatNum (num) {
|
||||
return num > 9 ? num : '0' + num
|
||||
},
|
||||
getParamsType () {
|
||||
const path = this.$route.path
|
||||
switch (path) {
|
||||
case '/panel': this.paramsType = 'dashboard'; break
|
||||
case '/asset': this.paramsType = 'asset'; break
|
||||
case '/monitor/endpoint': this.paramsType = 'endpoint'; break
|
||||
default: this.paramsType = ''; break
|
||||
}
|
||||
}
|
||||
// getParamsType () {
|
||||
// const path = this.$route.path
|
||||
// switch (path) {
|
||||
// case '/panel': this.paramsType = 'dashboard'; break
|
||||
// case '/asset': this.paramsType = 'asset'; break
|
||||
// case '/monitor/endpoint': this.paramsType = 'endpoint'; break
|
||||
// default: this.paramsType = ''; break
|
||||
// }
|
||||
// }
|
||||
},
|
||||
watch: {
|
||||
panelLock: {
|
||||
|
||||
@@ -697,7 +697,7 @@
|
||||
<div class="p10 pl0">
|
||||
<el-select :popper-append-to-body="false" class="right-box-row-with-btn" :placeholder="$t('el.select.placeholder')" popper-class="chart-box-dropdown-small"
|
||||
size="mini"
|
||||
v-model="selection.pen.font.textOffsetX" value-key="chartType" @change="onChange">
|
||||
v-model="selection.pen.font.textBaseline" value-key="chartType" @change="onChange">
|
||||
<el-option :key="item.id" :label="item.name" :value="item.id" v-for="item in textBaselineOptions">
|
||||
<span class="panel-dropdown-label-txt">{{item.name}}</span>
|
||||
</el-option>
|
||||
|
||||
@@ -566,8 +566,13 @@ export default {
|
||||
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.editAsset.id) {
|
||||
this.$put(this.url, this.editAsset).then(res => {
|
||||
const params = JSON.parse(JSON.stringify(this.editAsset))
|
||||
if (params.type.vm !== 1) {
|
||||
params.parent = {}
|
||||
params.pid = ''
|
||||
}
|
||||
if (params.id) {
|
||||
this.$put(this.url, params).then(res => {
|
||||
this.prevent_opt.save = false
|
||||
if (res.code === 200) {
|
||||
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
|
||||
@@ -577,7 +582,7 @@ export default {
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$post(this.url, this.editAsset).then(res => {
|
||||
this.$post(this.url, params).then(res => {
|
||||
this.prevent_opt.save = false
|
||||
if (res.code === 200) {
|
||||
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
import: 'panel_chart_add',
|
||||
export: 'panel_view'
|
||||
}"
|
||||
:paramsType="'dashboard'"
|
||||
class="top-tool-export"
|
||||
export-file-name="chart"
|
||||
export-url="/visual/panel/export"
|
||||
|
||||
Reference in New Issue
Block a user