mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-10 17:30:29 +08:00
实现基本的集群DNS列表、设置、简单数据同步
This commit is contained in:
80
web/views/@default/dns/updateClusterPopup.js
Normal file
80
web/views/@default/dns/updateClusterPopup.js
Normal file
@@ -0,0 +1,80 @@
|
||||
Tea.context(function () {
|
||||
this.$delay(function () {
|
||||
this.changeProviderType()
|
||||
this.changeProvider()
|
||||
|
||||
this.$watch("providerId", function () {
|
||||
this.changeProvider()
|
||||
})
|
||||
this.$watch("domainId", function () {
|
||||
this.changeDomain()
|
||||
})
|
||||
})
|
||||
|
||||
this.success = NotifyPopup
|
||||
|
||||
// 初始化的内容
|
||||
// this.domainId = 0
|
||||
// this.domain = ""
|
||||
// this.providerId = 0
|
||||
|
||||
if (this.providerType == "") {
|
||||
this.providerType = this.providerTypes[0].code
|
||||
}
|
||||
this.providers = []
|
||||
this.domains = []
|
||||
|
||||
this.changeProviderType = function () {
|
||||
this.$post(".providerOptions")
|
||||
.params({
|
||||
type: this.providerType
|
||||
})
|
||||
.success(function (resp) {
|
||||
this.providers = resp.data.providers
|
||||
|
||||
// 检查providerId
|
||||
if (this.providers.length == 0) {
|
||||
this.providerId = 0
|
||||
return
|
||||
}
|
||||
let that = this
|
||||
if (this.providers.$find(function (k, v) {
|
||||
return v.id == that.providerId
|
||||
}) == null) {
|
||||
this.providerId = this.providers[0].id
|
||||
}
|
||||
this.changeProvider()
|
||||
})
|
||||
}
|
||||
|
||||
this.changeProvider = function () {
|
||||
this.$post(".domainOptions")
|
||||
.params({
|
||||
providerId: this.providerId
|
||||
})
|
||||
.success(function (resp) {
|
||||
this.domains = resp.data.domains
|
||||
this.changeDomain()
|
||||
})
|
||||
}
|
||||
|
||||
this.changeDomain = function () {
|
||||
if (this.domains.length == 0) {
|
||||
this.domainId = 0
|
||||
this.domain = ""
|
||||
return
|
||||
}
|
||||
|
||||
let domainId = this.domainId
|
||||
let domainInfo = this.domains.$find(function (k, v) {
|
||||
return v.id == domainId
|
||||
})
|
||||
if (domainInfo == null) {
|
||||
// 默认选取第一个
|
||||
this.domainId = this.domains[0].id
|
||||
this.domain = this.domains[0].name
|
||||
} else {
|
||||
this.domain = domainInfo.name
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user