Mobile.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <a-form
  3. :form="form.fc"
  4. v-bind="formItemLayout"
  5. hideRequiredMark>
  6. <a-form-item :label="$t('notify.configs.sms_driver')">
  7. <a-radio-group v-decorator="decorators.sms_driver">
  8. <a-radio-button
  9. v-for="item in driverOpts"
  10. :value="item.key"
  11. :key="item.key">
  12. {{ item.label }}
  13. </a-radio-button>
  14. </a-radio-group>
  15. </a-form-item>
  16. <component
  17. ref="typeRef"
  18. :is="form.fd.sms_driver"
  19. :form="form"
  20. :form-item-layout="formItemLayout" />
  21. </a-form>
  22. </template>
  23. <script>
  24. import smsaliyun from './smsaliyun'
  25. import smshuawei from './smshuawei'
  26. export default {
  27. name: 'MobileConfig',
  28. components: {
  29. smsaliyun,
  30. smshuawei,
  31. },
  32. props: {
  33. formItemLayout: {
  34. required: true,
  35. type: Object,
  36. },
  37. offsetWrapperCol: {
  38. required: true,
  39. type: Object,
  40. },
  41. loading: Boolean,
  42. docUrl: String,
  43. },
  44. data () {
  45. return {
  46. submiting: false,
  47. testLoding: false,
  48. form: {
  49. fc: this.$form.createForm(this, {
  50. onValuesChange: (props, values) => {
  51. Object.keys(values).forEach((key) => {
  52. this.form.fd[key] = values[key]
  53. })
  54. },
  55. }),
  56. fd: {
  57. sms_driver: 'smsaliyun',
  58. },
  59. },
  60. driverOpts: [
  61. { label: this.$t('providers.aliyun'), key: 'smsaliyun' },
  62. { label: this.$t('providers.huawei'), key: 'smshuawei' },
  63. ],
  64. decorators: {
  65. sms_driver: [
  66. 'sms_driver',
  67. {
  68. initialValue: 'smsaliyun',
  69. },
  70. ],
  71. },
  72. }
  73. },
  74. computed: {
  75. is_aliyun () {
  76. return this.form.fd.sms_driver === 'smsaliyun'
  77. },
  78. },
  79. }
  80. </script>