mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-04 21:50:28 +08:00
38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
|
|
Vue.component("node-region-selector", {
|
||
|
|
props: ["v-region"],
|
||
|
|
data: function () {
|
||
|
|
return {
|
||
|
|
selectedRegion: this.vRegion
|
||
|
|
}
|
||
|
|
},
|
||
|
|
methods: {
|
||
|
|
selectRegion: function () {
|
||
|
|
let that = this
|
||
|
|
teaweb.popup("/clusters/regions/selectPopup?clusterId=" + this.vClusterId, {
|
||
|
|
callback: function (resp) {
|
||
|
|
that.selectedRegion = resp.data.region
|
||
|
|
}
|
||
|
|
})
|
||
|
|
},
|
||
|
|
addRegion: function () {
|
||
|
|
let that = this
|
||
|
|
teaweb.popup("/clusters/regions/createPopup?clusterId=" + this.vClusterId, {
|
||
|
|
callback: function (resp) {
|
||
|
|
that.selectedRegion = resp.data.region
|
||
|
|
}
|
||
|
|
})
|
||
|
|
},
|
||
|
|
removeRegion: function () {
|
||
|
|
this.selectedRegion = null
|
||
|
|
}
|
||
|
|
},
|
||
|
|
template: `<div>
|
||
|
|
<div class="ui label small basic" v-if="selectedRegion != null">
|
||
|
|
<input type="hidden" name="regionId" :value="selectedRegion.id"/>
|
||
|
|
{{selectedRegion.name}} <a href="" title="删除" @click.prevent="removeRegion()"><i class="icon remove"></i></a>
|
||
|
|
</div>
|
||
|
|
<div v-if="selectedRegion == null">
|
||
|
|
<a href="" @click.prevent="selectRegion()">[选择区域]</a> <a href="" @click.prevent="addRegion()">[添加区域]</a>
|
||
|
|
</div>
|
||
|
|
</div>`
|
||
|
|
})
|