修复缓存条件设置时界面可能不会自动刷新的问题

This commit is contained in:
刘祥超
2022-05-05 11:25:23 +08:00
parent d7bceb8f2d
commit f65b725b27
5 changed files with 49 additions and 33 deletions

View File

@@ -98,6 +98,8 @@ Vue.component("http-cache-refs-config-box", {
resp.data.cacheRef.id = that.refs[index].id
Vue.set(that.refs, index, resp.data.cacheRef)
that.change()
that.$refs.cacheRef[index].updateConds(resp.data.cacheRef.conds)
that.$refs.cacheRef[index].notifyChange()
}
})
},
@@ -140,6 +142,8 @@ Vue.component("http-cache-refs-config-box", {
return unit
},
change: function () {
this.$forceUpdate()
// 自动保存
if (this.vCachePolicyId != null && this.vCachePolicyId > 0) { // 缓存策略
Tea.action("/servers/components/cache/updateRefs")

View File

@@ -19,8 +19,7 @@ Vue.component("http-request-conds-view", {
})
return {
initConds: conds,
version: 0 // 为了让组件能及时更新加入此变量
initConds: conds
}
},
computed: {
@@ -39,18 +38,20 @@ Vue.component("http-request-conds-view", {
}
return cond.param + " " + cond.operator
},
updateConds: function (conds) {
this.initConds = conds
},
notifyChange: function () {
this.version++
let that = this
this.initConds.groups.forEach(function (group) {
group.conds.forEach(function (cond) {
cond.typeName = that.typeName(cond)
})
})
this.$forceUpdate()
}
},
template: `<div>
<span v-if="version < 0">{{version}}</span>
<div v-if="conds.groups.length > 0">
<div v-for="(group, groupIndex) in conds.groups">
<var v-for="(cond, index) in group.conds" style="font-style: normal;display: inline-block; margin-bottom:0.5em">

View File

@@ -25,8 +25,8 @@ Vue.component("ssl-certs-view", {
},
template: `<div>
<div v-if="certs != null && certs.length > 0">
<div class="ui label small" v-for="(cert, index) in certs">
{{cert.name}} / {{cert.dnsNames}} / 有效至{{formatTime(cert.timeEndAt)}} &nbsp;<a href="" title="查看" @click.prevent="viewCert(cert.id)"><i class="icon external alternate"></i></a>
<div class="ui label small basic" v-for="(cert, index) in certs">
{{cert.name}} / {{cert.dnsNames}} / 有效至{{formatTime(cert.timeEndAt)}} &nbsp;<a href="" title="查看" @click.prevent="viewCert(cert.id)"><i class="icon expand blue"></i></a>
</div>
</div>
</div>`