fix: 修复ipam type 下拉重复内容

This commit is contained in:
@changcode
2022-03-21 18:05:33 +08:00
parent 0aa0716ce5
commit 72435b9581
3 changed files with 13 additions and 40 deletions

View File

@@ -67,7 +67,7 @@
</template> </template>
</nz-bottom-data-list> </nz-bottom-data-list>
<transition name="right-box"> <transition name="right-box">
<ip-details-box v-if="rightBox.show" :obj="object" @close="closeRightBox"></ip-details-box> <ip-details-box v-if="rightBox.show" :obj="object" :details-type="obj.type" @close="closeRightBox"></ip-details-box>
</transition> </transition>
</div> </div>
</template> </template>
@@ -101,8 +101,7 @@ export default {
addr: '', addr: '',
mac: '', mac: '',
state: '', state: '',
remark: '', remark: ''
asset: { id: '', name: '' }
}, },
searchMsg: { // 给搜索框子组件传递的信息 searchMsg: { // 给搜索框子组件传递的信息
zheze_none: true, zheze_none: true,
@@ -133,7 +132,6 @@ export default {
} }
}, },
methods: { methods: {
// 数据请求
getTableData (params) { getTableData (params) {
if (params && Object.keys(params).length > 0) { if (params && Object.keys(params).length > 0) {
for (const key in params) { for (const key in params) {
@@ -149,39 +147,6 @@ export default {
this.$set(this.searchLabel, 'id', this.obj.id) this.$set(this.searchLabel, 'id', this.obj.id)
this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize) this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize)
this.tools.loading = true this.tools.loading = true
this.tableData = [{
id: 1,
name: 'node-1',
subnet: {
id: 1,
name: 'bj'
},
asset: {
id: 1,
name: 'bj'
},
addr: '192.168.40.0',
mac: '1a:1b:6b:1d:65:1d',
remark: '',
state: 1,
uts: 1646982371692
}, {
id: 2,
name: 'node-1',
subnet: {
id: 1,
name: 'bj'
},
asset: {
id: 1,
name: 'bj'
},
addr: '192.168.40.0',
mac: '1a:1b:6b:1d:65:1d',
remark: '',
state: 1,
uts: 1646982371692
}]
this.$get(this.url, { ...this.searchLabel }).then(response => { this.$get(this.url, { ...this.searchLabel }).then(response => {
this.tools.loading = false this.tools.loading = false
if (response.code === 200) { if (response.code === 200) {

View File

@@ -310,9 +310,9 @@ export default {
url = '/dc/cabinet/template' url = '/dc/cabinet/template'
} else if (this.importUrl.indexOf('dc') > -1) { } else if (this.importUrl.indexOf('dc') > -1) {
url = '/dc/template' url = '/dc/template'
} else if (this.importUrl.indexOf('/ipam/subnet') > -1) { } else if (this.importUrl.indexOf('ipam/subnet') > -1) {
url = '/ipam/subnet/template' url = '/ipam/subnet/template'
} else if (this.importUrl.indexOf('/ipam/ip') > -1) { } else if (this.importUrl.indexOf('ipam/ip') > -1) {
url = '/ipam/ip/template' url = '/ipam/ip/template'
} }
if (!url) { if (!url) {

View File

@@ -237,6 +237,14 @@ export default {
id: e.type.id id: e.type.id
} }
}) })
for (let i = 0; i < this.typeDataList.length - 1; i++) {
for (let j = i + 1; j < this.typeDataList.length; j++) {
if (this.typeDataList[i].id == this.typeDataList[j].id) {
this.typeDataList.splice(j, 1)
j--
}
}
}
}) })
} }
} }