admin-users-create.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <template lang="pug">
  2. v-dialog(v-model='isShown', max-width='550')
  3. v-card.wiki-form
  4. .dialog-header.is-short New Local User
  5. v-card-text
  6. v-text-field.md2(
  7. outline
  8. prepend-icon='email'
  9. v-model='email'
  10. label='Email Address'
  11. ref='emailInput'
  12. )
  13. v-text-field.md2(
  14. outline
  15. prepend-icon='person'
  16. v-model='name'
  17. label='Name'
  18. )
  19. v-text-field.md2(
  20. outline
  21. prepend-icon='lock'
  22. append-icon='casino'
  23. v-model='password'
  24. label='Password'
  25. counter='255'
  26. @click:append='generatePwd'
  27. )
  28. v-card-chin
  29. v-spacer
  30. v-btn(flat, @click='isShown = false') Cancel
  31. v-btn(color='primary', @click='createUser') Create User
  32. </template>
  33. <script>
  34. import uuidv4 from 'uuid/v4'
  35. export default {
  36. props: {
  37. value: {
  38. type: Boolean,
  39. default: false
  40. }
  41. },
  42. data() {
  43. return {
  44. email: '',
  45. name: '',
  46. password: '',
  47. jobTitle: '',
  48. location: ''
  49. }
  50. },
  51. computed: {
  52. isShown: {
  53. get() { return this.value },
  54. set(val) { this.$emit('input', val) }
  55. }
  56. },
  57. watch: {
  58. value(newValue, oldValue) {
  59. if (newValue) {
  60. this.$nextTick(() => {
  61. this.$refs.emailInput.focus()
  62. })
  63. }
  64. }
  65. },
  66. methods: {
  67. async createUser() {
  68. },
  69. generatePwd() {
  70. this.password = uuidv4().slice(-12)
  71. }
  72. }
  73. }
  74. </script>