mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-06 14:50:25 +08:00
优化代码
This commit is contained in:
39
web/public/js/components/ns/ns-domain-group-selector.js
Normal file
39
web/public/js/components/ns/ns-domain-group-selector.js
Normal file
@@ -0,0 +1,39 @@
|
||||
Vue.component("ns-domain-group-selector", {
|
||||
props: ["v-domain-group-id"],
|
||||
data: function () {
|
||||
let groupId = this.vDomainGroupId
|
||||
if (groupId == null) {
|
||||
groupId = 0
|
||||
}
|
||||
return {
|
||||
userId: 0,
|
||||
groupId: groupId
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
change: function (group) {
|
||||
if (group != null) {
|
||||
this.$emit("change", group.id)
|
||||
} else {
|
||||
this.$emit("change", 0)
|
||||
}
|
||||
},
|
||||
reload: function (userId) {
|
||||
this.userId = userId
|
||||
this.$refs.comboBox.clear()
|
||||
this.$refs.comboBox.setDataURL("/ns/domains/groups/options?userId=" + userId)
|
||||
this.$refs.comboBox.reloadData()
|
||||
}
|
||||
},
|
||||
template: `<div>
|
||||
<combo-box
|
||||
data-url="/ns/domains/groups/options"
|
||||
placeholder="选择分组"
|
||||
data-key="groups"
|
||||
name="groupId"
|
||||
:v-value="groupId"
|
||||
@change="change"
|
||||
ref="comboBox">
|
||||
</combo-box>
|
||||
</div>`
|
||||
})
|
||||
Reference in New Issue
Block a user