Commit bc1221ee authored by 黎博's avatar 黎博

对象转数组做个兼容

parent 26bb2da1
...@@ -399,24 +399,30 @@ export default { ...@@ -399,24 +399,30 @@ export default {
// 将数组转成对象存储 // 将数组转成对象存储
this.FormatTabledata = {} this.FormatTabledata = {}
original.forEach((item, index) => { original.forEach((item, index) => {
if (Object.keys(this.FormatTabledata).indexOf(item.labels.type) > -1) { if (item !== null) {
this.FormatTabledata[item.labels.type].push(item) if (
} else { Object.keys(this.FormatTabledata).indexOf(item.labels.type) > -1
this.FormatTabledata[item.labels.type] = [] ) {
this.FormatTabledata[item.labels.type].push(item) this.FormatTabledata[item.labels.type].push(item)
} else {
this.FormatTabledata[item.labels.type] = []
this.FormatTabledata[item.labels.type].push(item)
}
} }
}) })
}, },
// 获取服务列表 // 获取服务列表
getServiceList() { getServiceList() {
const tLoading = this.$loading.service(this.loadingOptions) const tLoading = this.$loading.service(this.loadingOptions)
getServiceList({ namespace: this.namespace }).then((resp) => { getServiceList({ namespace: this.namespace })
const serviceList = resp.data.data .then((resp) => {
this.array2Object(serviceList) const serviceList = resp.data.data
tLoading.close() this.array2Object(serviceList)
}).catch(() => { tLoading.close()
tLoading.close() })
}) .catch(() => {
tLoading.close()
})
}, },
// 刷新,重新获取服务列表 // 刷新,重新获取服务列表
refresh() { refresh() {
...@@ -486,11 +492,15 @@ export default { ...@@ -486,11 +492,15 @@ export default {
}, },
// 清空redis // 清空redis
clearRedis() { clearRedis() {
this.$confirm(`此操作将清空${this.namespace}环境所有Redis缓存, 是否继续?`, '提示', { this.$confirm(
confirmButtonText: '确定', `此操作将清空${this.namespace}环境所有Redis缓存, 是否继续?`,
cancelButtonText: '取消', '提示',
type: 'warning' {
}).then(() => { confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}
).then(() => {
var formdata = new FormData() var formdata = new FormData()
formdata.set('namespace', this.namespace) formdata.set('namespace', this.namespace)
flushRedis(formdata).then((resp) => { flushRedis(formdata).then((resp) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment