From e179d7e03a9914b5209082d436e836232b2fe344 Mon Sep 17 00:00:00 2001 From: Xiao Bai <2835066049@qq.com> Date: Tue, 22 Nov 2022 15:34:22 +0800 Subject: [PATCH] =?UTF-8?q?NEZ-2412=20feat=20:asset=20model=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E9=A1=B5=E9=9D=A2dashboardTemplate=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rightBox/administration/modelBox.vue | 59 +++++++++++++++---- .../src/components/page/config/model.vue | 3 +- 2 files changed, 50 insertions(+), 12 deletions(-) diff --git a/nezha-fronted/src/components/common/rightBox/administration/modelBox.vue b/nezha-fronted/src/components/common/rightBox/administration/modelBox.vue index cc3ac821b..b5d3e9036 100644 --- a/nezha-fronted/src/components/common/rightBox/administration/modelBox.vue +++ b/nezha-fronted/src/components/common/rightBox/administration/modelBox.vue @@ -26,7 +26,7 @@ - + + + + @@ -100,11 +119,17 @@ export default { brandList: [], // brand 列表数据 editModule: {}, typeDataList: [], - chartlList: [], // chart 列表数据 - ChartSearchShowFields: [ // ChartSearch 下拉搜索表头 + // chartlList: [], // chart 列表数据 + dashboardList: [], // dashboard 列表数据 + // ChartSearchShowFields: [ // ChartSearch 下拉搜索表头 + // { title: 'ID', data: 'id' }, + // { title: this.$t('overall.name'), data: 'name', key: 'name' }, + // { title: this.$t('overall.type'), data: 'type', key: 'type' }, + // { title: this.$t('overall.remark'), data: 'remark', key: 'remark' } + // ], + DashboardSearchShowFields: [ // DashboardSearch 下拉搜索表头 { title: 'ID', data: 'id' }, { title: this.$t('overall.name'), data: 'name', key: 'name' }, - { title: this.$t('overall.type'), data: 'type', key: 'type' }, { title: this.$t('overall.remark'), data: 'remark', key: 'remark' } ], url: 'asset/model', @@ -134,13 +159,15 @@ export default { handler (n) { this.isEdit = true this.editModel = JSON.parse(JSON.stringify(n)) + this.editModel.panelId = n.panelId ? n.panelId + '' : '' } } }, created () { this.getBrandList() this.modelTypeList() - this.ChartTemplateList() + // this.ChartTemplateList() + this.DashboardTemplateList () }, methods: { clickOutside () { @@ -154,8 +181,12 @@ export default { saveModel () { this.$refs.modelForm.validate((valid) => { if (valid) { + const params = { + ...this.editModel, + panelId: Number(this.editModel.panelId), + } if (this.editModel.id) { - this.$put(this.url, this.editModel).then(res => { + 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') }) @@ -165,7 +196,7 @@ export default { } }) } else { - this.$post(this.url, this.editModel).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') }) @@ -225,10 +256,16 @@ export default { return assetData } }, - /* 获取chart列表数据 */ - ChartTemplateList () { - this.$get('visual/panel/chart', { pageSize: -1, varType: 1, panelId: 0, groupId: 0, returnChildren: 0 }).then(res => { - this.chartlList = res.data.list + // /* 获取chart列表数据 */ + // ChartTemplateList () { + // this.$get('visual/panel/chart', { pageSize: -1, varType: 1, panelId: 0, groupId: 0, returnChildren: 0 }).then(res => { + // this.chartlList = res.data.list + // }) + // }, + /* 获取Dashboard列表数据 */ + DashboardTemplateList () { + this.$get('visual/panel', { pageSize: -1, varType: 1}).then(res => { + this.dashboardList = res.data.list }) }, modelTypeList () { diff --git a/nezha-fronted/src/components/page/config/model.vue b/nezha-fronted/src/components/page/config/model.vue index 1afebbd22..a6fd57f31 100644 --- a/nezha-fronted/src/components/page/config/model.vue +++ b/nezha-fronted/src/components/page/config/model.vue @@ -103,7 +103,8 @@ export default { blankObject: { // 空白对象 id: '', name: '', - chartIds: '', + // chartIds: '', + panelId:'', sysObjectId: '', type: { id: '', name: '' }, remark: ''