Commit bc1221ee authored by 黎博's avatar 黎博

对象转数组做个兼容

parent 26bb2da1
...@@ -399,22 +399,28 @@ export default { ...@@ -399,22 +399,28 @@ 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) {
if (
Object.keys(this.FormatTabledata).indexOf(item.labels.type) > -1
) {
this.FormatTabledata[item.labels.type].push(item) this.FormatTabledata[item.labels.type].push(item)
} else { } else {
this.FormatTabledata[item.labels.type] = [] this.FormatTabledata[item.labels.type] = []
this.FormatTabledata[item.labels.type].push(item) 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 })
.then((resp) => {
const serviceList = resp.data.data const serviceList = resp.data.data
this.array2Object(serviceList) this.array2Object(serviceList)
tLoading.close() tLoading.close()
}).catch(() => { })
.catch(() => {
tLoading.close() tLoading.close()
}) })
}, },
...@@ -486,11 +492,15 @@ export default { ...@@ -486,11 +492,15 @@ export default {
}, },
// 清空redis // 清空redis
clearRedis() { clearRedis() {
this.$confirm(`此操作将清空${this.namespace}环境所有Redis缓存, 是否继续?`, '提示', { this.$confirm(
`此操作将清空${this.namespace}环境所有Redis缓存, 是否继续?`,
'提示',
{
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }
).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