From dbf0e74e7a84bb2c1f5effb04815e01b281a6312 Mon Sep 17 00:00:00 2001 From: chenjinsong <523037378@qq.com> Date: Tue, 25 May 2021 19:47:22 +0800 Subject: [PATCH] =?UTF-8?q?NEZ-663=20fix:=20=E6=8E=92=E6=9F=A5=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/charts/chart-list.vue | 11 +- .../common/bottomBox/tabs/panelTabNew.vue | 14 +- .../common/rightBox/asset/assetBox.vue | 47 +- .../components/common/rightBox/assetBox.vue | 725 ------------------ .../common/rightBox/snmpCredentialBox.vue | 2 +- .../common/table/asset/assetMetaTable.vue | 2 +- 6 files changed, 36 insertions(+), 765 deletions(-) delete mode 100644 nezha-fronted/src/components/common/rightBox/assetBox.vue diff --git a/nezha-fronted/src/components/charts/chart-list.vue b/nezha-fronted/src/components/charts/chart-list.vue index c85a176be..01196ac03 100644 --- a/nezha-fronted/src/components/charts/chart-list.vue +++ b/nezha-fronted/src/components/charts/chart-list.vue @@ -1717,12 +1717,17 @@ export default { resize () { this.init() this.$nextTick(() => { - this.$parent.$parent.dateChange() + if (this.$parent && this.$parent.$parent) { + this.$parent.$parent.dateChange() + } }) }, init () { - this.stepWidth = this.chartResizeTool.stepWidth(document.getElementById('listContainer').offsetWidth - 14) - this.tempDomInit() + const dom = document.getElementById('listContainer') + if (dom) { + this.stepWidth = this.chartResizeTool.stepWidth(dom.offsetWidth - 14) + this.tempDomInit() + } }, chartBySync (item) { this.$post('visual/panel/chart/syncTmpl', { ids: [item.id] }).then(res => { diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue b/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue index 4a144317f..fb316c1db 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue @@ -333,12 +333,14 @@ export default { // 选择日期变化 dateChange (val) { // this.searchTime = [...val]; - const nowTimeType = this.$refs.pickTime.$refs.timePicker.nowTimeType - this.setSearchTime(nowTimeType.type, nowTimeType.value) - this.filter.start_time = bus.timeFormate(this.searchTime[0], 'yyyy-MM-dd hh:mm:ss') - this.filter.end_time = bus.timeFormate(this.searchTime[1], 'yyyy-MM-dd hh:mm:ss') - this.filter.panelId = this.showPanel.id - this.getData(this.filter) + if (this.$refs.pickTime) { + const nowTimeType = this.$refs.pickTime.$refs.timePicker.nowTimeType + this.setSearchTime(nowTimeType.type, nowTimeType.value) + this.filter.start_time = bus.timeFormate(this.searchTime[0], 'yyyy-MM-dd hh:mm:ss') + this.filter.end_time = bus.timeFormate(this.searchTime[1], 'yyyy-MM-dd hh:mm:ss') + this.filter.panelId = this.showPanel.id + this.getData(this.filter) + } }, /* 时间条件查询--end */ setSearchTime (type, val) { // 设置searchTime diff --git a/nezha-fronted/src/components/common/rightBox/asset/assetBox.vue b/nezha-fronted/src/components/common/rightBox/asset/assetBox.vue index 5b4c80ad0..3e8f16d61 100644 --- a/nezha-fronted/src/components/common/rightBox/asset/assetBox.vue +++ b/nezha-fronted/src/components/common/rightBox/asset/assetBox.vue @@ -317,40 +317,25 @@ export default { { required: true, message: this.$t('validate.required'), trigger: 'blur' } ] }, - /* modelCascProp: { - lazy: true, - value: 'id', - label: 'name', - lazyLoad (node, resolve) { - const { level } = node - vm.$get('asset/model', { brandIds: node.data.id }).then(response => { - if (response.code === 200) { - const models = response.data.list.map(item => ({ - ...item, - leaf: level >= 1 - })) - resolve(models) - } - }) - } - }, */ labelCascProp: { lazy: true, value: 'id', label: 'name', lazyLoad (node, resolve) { const { level } = node - vm.$get('asset/field/meta', { groupIds: node.data.id }).then(response => { - if (response.code === 200) { - const meta = response.data.list.map(item => ({ - ...item, - leaf: level >= 1, - disabled: vm.editAsset.fields.some(a => a.id === item.id) - })) - vm.options.metaOptions = meta - resolve(meta) - } - }) + if (node && node.data) { + vm.$get('asset/field/meta', { groupIds: node.data.id }).then(response => { + if (response.code === 200) { + const meta = response.data.list.map(item => ({ + ...item, + leaf: level >= 1, + disabled: vm.editAsset.fields.some(a => a.id === item.id) + })) + vm.options.metaOptions = meta + resolve(meta) + } + }) + } } } } @@ -463,9 +448,13 @@ export default { this.esc(false) }, setLocationData ({ cabinet, dc, u }) { + if (cabinet) { + this.editAsset.cabinetId = cabinet.id + } if (dc) { this.editAsset.dcId = dc.id - this.editAsset.cabinetId = cabinet.id + } + if (u) { this.editAsset.cabinetStart = u[0] this.editAsset.cabinetEnd = u[1] } diff --git a/nezha-fronted/src/components/common/rightBox/assetBox.vue b/nezha-fronted/src/components/common/rightBox/assetBox.vue deleted file mode 100644 index 7b5f4a871..000000000 --- a/nezha-fronted/src/components/common/rightBox/assetBox.vue +++ /dev/null @@ -1,725 +0,0 @@ - - - - - diff --git a/nezha-fronted/src/components/common/rightBox/snmpCredentialBox.vue b/nezha-fronted/src/components/common/rightBox/snmpCredentialBox.vue index cf857e628..30f29c95b 100644 --- a/nezha-fronted/src/components/common/rightBox/snmpCredentialBox.vue +++ b/nezha-fronted/src/components/common/rightBox/snmpCredentialBox.vue @@ -220,7 +220,7 @@ export default { deep: true, handler (n, o) { this.editCredential = JSON.parse(JSON.stringify(n)) - if (this.editCredential.config) { + if (this.editCredential.config && typeof this.editCredential.config === 'string') { this.editCredential.config = JSON.parse(this.editCredential.config) } } diff --git a/nezha-fronted/src/components/common/table/asset/assetMetaTable.vue b/nezha-fronted/src/components/common/table/asset/assetMetaTable.vue index 392abd7e2..08616dfc4 100644 --- a/nezha-fronted/src/components/common/table/asset/assetMetaTable.vue +++ b/nezha-fronted/src/components/common/table/asset/assetMetaTable.vue @@ -67,7 +67,7 @@ fixed="right">
{{$t('overall.option')}}
- +