Files
EdgeAdmin/web/public/js/components/server/user-selector.js

32 lines
687 B
JavaScript
Raw Normal View History

2021-11-09 15:36:18 +08:00
Vue.component("user-selector", {
2022-08-03 12:20:24 +08:00
props: ["v-user-id", "data-url"],
2021-11-09 15:36:18 +08:00
data: function () {
let userId = this.vUserId
if (userId == null) {
userId = 0
}
2022-08-03 12:20:24 +08:00
let dataURL = this.dataUrl
if (dataURL == null || dataURL.length == 0) {
dataURL = "/servers/users/options"
}
2021-11-09 15:36:18 +08:00
return {
users: [],
2022-08-03 12:20:24 +08:00
userId: userId,
dataURL: dataURL
2021-11-09 15:36:18 +08:00
}
},
2022-08-03 12:20:24 +08:00
methods: {
change: function(item) {
if (item != null) {
this.$emit("change", item.id)
} else {
this.$emit("change", 0)
}
2021-11-09 15:36:18 +08:00
}
},
template: `<div>
2022-08-06 20:28:51 +08:00
<combo-box placeholder="选择用户" :data-url="dataURL" :data-key="'users'" data-search="on" name="userId" :v-value="userId" @change="change"></combo-box>
2021-11-09 15:36:18 +08:00
</div>`
})