From e140d7407309a7dc87d15d72a4e5d2a47554fc2c Mon Sep 17 00:00:00 2001 From: zhangyu Date: Wed, 1 Jun 2022 14:37:59 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=20asset=E6=89=B9=E9=87=8F=E6=90=9C?= =?UTF-8?q?=E7=B4=A0=20=20=E6=90=9C=E7=B4=A2=E6=9D=A1=E4=BB=B6=E5=8F=98?= =?UTF-8?q?=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/common/js/constants.js | 2 +- .../rightBox/asset/assetBatchEditBox.vue | 84 ++++++++++--------- .../src/components/common/searchInput.vue | 37 +++++++- 3 files changed, 80 insertions(+), 43 deletions(-) diff --git a/nezha-fronted/src/components/common/js/constants.js b/nezha-fronted/src/components/common/js/constants.js index 972d5e6b0..f96a3657e 100644 --- a/nezha-fronted/src/components/common/js/constants.js +++ b/nezha-fronted/src/components/common/js/constants.js @@ -156,7 +156,7 @@ export const asset = { }, editTypeOptions: [ { value: 1, label: i18n.t('overall.account') }, - { value: 2, label: 'Label' }, + { value: 2, label: i18n.t('overall.labels') }, { value: 3, label: i18n.t('asset.state') }, { value: 4, label: i18n.t('asset.snmpCredential') } ], diff --git a/nezha-fronted/src/components/common/rightBox/asset/assetBatchEditBox.vue b/nezha-fronted/src/components/common/rightBox/asset/assetBatchEditBox.vue index 162d4aeec..3f9288422 100644 --- a/nezha-fronted/src/components/common/rightBox/asset/assetBatchEditBox.vue +++ b/nezha-fronted/src/components/common/rightBox/asset/assetBatchEditBox.vue @@ -283,45 +283,51 @@ export default { selectedData: [], searchLabel: {}, searchMsg: { // 给搜索框子组件传递的信息 - searchLabelList: [ - { - id: 1, - name: 'ID', - type: 'input', - label: 'id', - disabled: false - }, { - id: 20, - name: this.$t('asset.sn'), - type: 'input', - label: 'sn', - disabled: false - }, { - id: 21, - name: this.$t('webshell.host'), - type: 'input', - label: 'manageIp', - disabled: false - }, { - id: 22, - name: this.$t('asset.state'), - type: 'select', - label: 'assetState', - disabled: false - }, { - id: 23, - name: this.$t('asset.pingStatus'), - type: 'select', - label: 'pingStatus', - disabled: false - }, { - id: 23, - name: this.$t('asset.cabinet'), - type: 'input', - label: 'cabinetName', - disabled: false - } - ] + searchLabelList: [{ + id: 'ids', + name: 'ID', + type: 'input', + label: 'ids', + disabled: false + }, { + name: this.$t('overall.name'), + type: 'input', + label: 'name', + id: 'name', + disabled: false + }, { + name: 'SN', + type: 'input', + label: 'sn', + id: 'sn', + disabled: false + }, { + name: this.$t('dashboard.overview.dataCenter.dataCenter'), + type: 'dc', + label: 'dcIds', + readonly: true, + disabled: false + }, { + name: 'IP', + type: 'input', + label: 'manageIp', + id: 'manageIp', + disabled: false + }, { + name: this.$t('asset.state'), + type: 'assetState', + label: 'stateIds', + id: 'stateIds', + readonly: true, + disabled: false + }, { + name: this.$t('asset.type'), + type: 'assetType', + label: 'assetType', + id: 'typeIds', + readonly: true, + disabled: false + }] }, tableTitle: [ { diff --git a/nezha-fronted/src/components/common/searchInput.vue b/nezha-fronted/src/components/common/searchInput.vue index 9fd082a71..22b398ee1 100644 --- a/nezha-fronted/src/components/common/searchInput.vue +++ b/nezha-fronted/src/components/common/searchInput.vue @@ -100,6 +100,16 @@
  • {{$t(item.name)}}
  • +
    + +
      +
    • {{$t(item.name)}}
    • +
    +
    + +
      @@ -316,7 +326,8 @@ export default { selectInfo: false, disabaled: true, downBool: false, - where: this.$route.path + where: this.$route.path, + assetTypeTree: [] } }, watch: { @@ -509,6 +520,10 @@ export default { val.val = selectItem.name val.valnum = selectItem.id val.valString = '' + } else if (val.type == 'assetType' && selectItem.searchType == 'assetType') { + val.val = selectItem.name + val.valnum = selectItem.id + val.valString = '' } else if (val.type === 'brand' && selectItem.searchType === 'brand') { val.val = selectItem.name val.valnum = selectItem.id @@ -613,6 +628,16 @@ export default { } }) }, + getAssetTypeData () { + this.$get('asset/typeConf/tree').then(response => { + if (response.code === 200) { + this.assetTypeTree = response.data.list + this.assetTypeTree.forEach((item, index) => { + this.$set(item, 'searchType', 'assetType') + }) + } + }) + }, getBrandData () { this.$get('asset/brand', { pageNo: 1, pageSize: -1 }).then(response => { if (response.code === 200) { @@ -869,6 +894,8 @@ export default { objectInfo.type = val.valnum } else if (val.label === 'assetState') { objectInfo.state = val.valnum + } else if (val.label === 'assetType') { + objectInfo.typeIds = val.valnum } else if (val.label === 'credentialType') { objectInfo.types = val.valnum } else if (val.label === 'promState') { @@ -902,8 +929,11 @@ export default { objectInfo.moduleId = val.valnum } else if (val.type === 'project') { objectInfo.projectIds = val.valnum - } else if (val.type === 'assetState') { - objectInfo.stateIds = val.valnum + } else if (val.label === 'assetState') { + console.log(val) + objectInfo.state = val.valnum + } else if (val.label === 'assetType') { + objectInfo.typeIds = val.valnum } else if (val.type === 'brand') { objectInfo.brandIds = val.valnum } else if (val.type === 'group') { @@ -1467,6 +1497,7 @@ export default { setTimeout(() => { if (this.$route.path === '/asset' || this.targetTab === 'asset') { this.getAssetStateData() + this.getAssetTypeData() } if (this.$route.path === '/agent' || this.$route.path === '/ipam') { this.getDcData()