diff --git a/nezha-fronted/src/assets/css/components/common/popBox/selectDashboard.scss b/nezha-fronted/src/assets/css/components/common/popBox/selectDashboard.scss
index fec23f1a0..100fb0227 100644
--- a/nezha-fronted/src/assets/css/components/common/popBox/selectDashboard.scss
+++ b/nezha-fronted/src/assets/css/components/common/popBox/selectDashboard.scss
@@ -186,6 +186,6 @@
// padding: 8px 0;
box-sizing: border-box;
.el-dropdown-menu__item{
- line-height: 32px;
+ // line-height: 32px;
}
}
\ No newline at end of file
diff --git a/nezha-fronted/src/components/common/mixin/editRigthBox.js b/nezha-fronted/src/components/common/mixin/editRigthBox.js
index 5101c32fd..85198f626 100644
--- a/nezha-fronted/src/components/common/mixin/editRigthBox.js
+++ b/nezha-fronted/src/components/common/mixin/editRigthBox.js
@@ -1,4 +1,3 @@
-import i18n from '@/components/common/i18n'
import { getUUID } from '../js/common'
export default {
data () {
diff --git a/nezha-fronted/src/components/common/popBox/selectDashboard.vue b/nezha-fronted/src/components/common/popBox/selectDashboard.vue
index ccffd7a93..ef205be92 100644
--- a/nezha-fronted/src/components/common/popBox/selectDashboard.vue
+++ b/nezha-fronted/src/components/common/popBox/selectDashboard.vue
@@ -163,8 +163,7 @@ export default {
// 其他tab的数据(我的收藏、我的创建、最近浏览数据)
otherData: [],
// 收藏列表
- starredList: [],
- visible: false
+ starredList: []
}
},
methods: {
diff --git a/nezha-fronted/src/components/common/rightBox/dashboardTempBox.vue b/nezha-fronted/src/components/common/rightBox/dashboardTempBox.vue
index c4e4ed1c8..b0d0b3be8 100644
--- a/nezha-fronted/src/components/common/rightBox/dashboardTempBox.vue
+++ b/nezha-fronted/src/components/common/rightBox/dashboardTempBox.vue
@@ -16,7 +16,7 @@
-
-
+
+
-
-
-
-
import bus from '@/libs/bus'
+import editRigthBox from '../mixin/editRigthBox'
export default {
props: {
},
+ mixins: [editRigthBox],
data () {
return {
- url: 'visual/panel/fromTmpl',
+ url: '/visual/panel/fromTmpl',
rules: {
name: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
@@ -208,26 +194,26 @@ export default {
link: '',
description: ''
},
- dashboardList: [],
+ templateList: [],
dataList: [],
- selectedTemp: {} // 选中的dashboard模板
+ templateType: undefined // 选中模板的varType
}
},
computed: {
language () { return this.$store.getters.getLanguage }
},
- mounted () {
+ created () {
+ this.isEdit = true
this.getDashboardTempData()
},
methods: {
// 选中的模板变化
tempChange: bus.debounce(function (val) {
- this.editDashboard.link = ''
- const newValue = val.length ? val[0] : {}
- const oldValue = this.$loadsh.cloneDeep(this.selectedTemp)
- this.selectedTemp = this.$loadsh.cloneDeep(newValue)
+ const newValue = this.$loadsh.get(val, ['0', 'varType'])
+ const oldValue = this.templateType
+ this.templateType = newValue
// 判断varType是否变化
- if (oldValue.varType != newValue.varType) {
+ if (oldValue != newValue) {
this.getTableData()
}
this.$refs.form.validateField('tmplId')
@@ -240,16 +226,17 @@ export default {
getDashboardTempData () {
this.$get('visual/panel', { type: 'template', pageSize: -1 }).then(response => {
if (response.code === 200) {
- this.dashboardList = response.data.list
+ this.templateList = response.data.list
}
})
},
// 根据选中模板vartype请求数据
getTableData () {
+ this.editDashboard.link = ''
this.dataList = []
- if (this.selectedTemp.varType === 1) {
+ if (this.templateType === 1) {
this.getAssetData()
- } else if (this.selectedTemp.varType === 2) {
+ } else if (this.templateType === 2) {
this.getEndpointData()
}
},
@@ -277,8 +264,8 @@ export default {
const params = this.$loadsh.cloneDeep(this.editDashboard)
this.$refs.form.validate((valid) => {
if (valid) {
- // 模板varType ≠ 0时有效且必填
- if (this.selectedTemp.varType == 0) {
+ // 模板varType ≠ 0时link有效且必填
+ if (this.templateType == 0) {
delete params.link
}
this.$post(this.url, params).then(response => {