Configure.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <script setup lang="ts">
  2. import type { BasicForm } from '@/types/form'
  3. import type { TabsPaneContext } from 'element-plus'
  4. // menu start
  5. const activeName = ref<string>('login')
  6. const handleClick = (tab: TabsPaneContext, event: Event) => {
  7. console.log(tab, event)
  8. }
  9. // menu end
  10. // loginConfig start
  11. // checkbox
  12. const isSingleLogin = ref<boolean>(false)
  13. const handleChange = (val: any) => {
  14. isSingleLogin.value = val
  15. }
  16. // radio
  17. const singleLoginType = ref<string>('1')
  18. // loginConfig end
  19. // messageConfig start
  20. const proFormRef = ref<any>()
  21. const formData = reactive<any>({})
  22. const formConfig = reactive<BasicForm>({
  23. span: 24,
  24. props: {
  25. labelPosition: 'right',
  26. labelWidth: '120px'
  27. },
  28. formItems: [
  29. {
  30. label: 'accessKeyId',
  31. value: '',
  32. name: 'accessKeyId',
  33. type: 'input',
  34. rules: [{ required: true, message: '请输入accessKeyId', trigger: 'blur' }]
  35. },
  36. {
  37. label: 'accessKeySecret',
  38. value: '',
  39. name: 'accessKeySecret',
  40. type: 'input',
  41. rules: [{ required: true, message: '请输入accessKeySecret', trigger: 'blur' }]
  42. },
  43. {
  44. label: '短信签名',
  45. value: '',
  46. name: 'messageSign',
  47. type: 'input',
  48. rules: [{ required: true, message: '请输入短信签名', trigger: 'blur' }]
  49. },
  50. {
  51. label: '短信模版',
  52. value: '',
  53. name: 'messageTemplate',
  54. type: 'input',
  55. rules: [{ required: true, message: '请输入短信模版', trigger: 'blur' }]
  56. }
  57. ]
  58. })
  59. const handleSaveMessage = () => {
  60. proFormRef.value.submit()
  61. }
  62. // messageConfig end
  63. // mailConfig start
  64. const proFormEmailRef = ref<any>()
  65. const formEmailData = reactive<any>({})
  66. const formEmailConfig = reactive<BasicForm>({
  67. span: 24,
  68. props: {
  69. labelPosition: 'right',
  70. labelWidth: '130px'
  71. },
  72. formItems: [
  73. {
  74. label: '邮箱服务器地址',
  75. value: '',
  76. name: 'serverAddress',
  77. type: 'input',
  78. rules: [{ required: true, message: '请输入邮箱服务器地址', trigger: 'blur' }]
  79. },
  80. {
  81. label: '邮箱服务器端口',
  82. value: '',
  83. name: 'serverPort',
  84. type: 'input',
  85. rules: [{ required: true, message: '请输入邮箱服务器端口', trigger: 'blur' }]
  86. },
  87. {
  88. label: '系统邮箱地址',
  89. value: '',
  90. name: 'mailAddress',
  91. type: 'input',
  92. rules: [{ required: true, message: '请输入系统邮箱地址', trigger: 'blur' }]
  93. },
  94. {
  95. label: '系统邮箱密码',
  96. value: '',
  97. name: 'mailPassword',
  98. type: 'input',
  99. rules: [{ required: true, message: '请输入系统邮箱密码', trigger: 'blur' }]
  100. }
  101. ]
  102. })
  103. const handleSaveEmail = () => {
  104. proFormEmailRef.value.submit()
  105. }
  106. // mailConfig end
  107. </script>
  108. <template>
  109. <div class="configure-container">
  110. <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
  111. <el-tab-pane label="登录" name="login">
  112. <el-card class="box-card">
  113. <div class="login-container">
  114. <div class="title">单一登录配置</div>
  115. <div>
  116. <el-checkbox v-model="isSingleLogin" @change="handleChange">单一登录</el-checkbox>
  117. </div>
  118. <div>
  119. <el-radio-group v-model="singleLoginType" :disabled="!isSingleLogin">
  120. <el-radio label="1" size="large">后登录踢出先登录</el-radio>
  121. <el-radio label="2" size="large">已登录禁止再登录</el-radio>
  122. </el-radio-group>
  123. </div>
  124. <div class="btn">
  125. <el-button type="primary">保存</el-button>
  126. </div>
  127. </div>
  128. </el-card>
  129. </el-tab-pane>
  130. <el-tab-pane label="短信" name="message">
  131. <el-card class="box-card">
  132. <div class="message-container">
  133. <div class="title">短信配置</div>
  134. <pro-form :formConfig="formConfig" :formData="formData" ref="proFormRef"> </pro-form>
  135. <div class="btn">
  136. <el-button type="primary" @click="handleSaveMessage">保存</el-button>
  137. </div>
  138. </div>
  139. </el-card>
  140. </el-tab-pane>
  141. <el-tab-pane label="邮箱" name="mail">
  142. <el-card class="box-card">
  143. <div class="mail-container">
  144. <div class="title">发件人账户</div>
  145. <pro-form :formConfig="formEmailConfig" :formData="formEmailData" ref="proFormEmailRef"> </pro-form>
  146. <div class="btn">
  147. <el-button type="primary" @click="handleSaveEmail">保存</el-button>
  148. </div>
  149. </div>
  150. </el-card>
  151. </el-tab-pane>
  152. </el-tabs>
  153. </div>
  154. </template>
  155. <style lang="scss" scoped>
  156. .configure-container {
  157. .box-card {
  158. margin-top: 10px;
  159. .login-container {
  160. div:not(:first-child) {
  161. margin-top: 20px;
  162. }
  163. }
  164. .message-container,
  165. .mail-container,
  166. .login-container {
  167. .title {
  168. font-size: 17px;
  169. font-weight: bold;
  170. margin-bottom: 20px;
  171. }
  172. }
  173. }
  174. }
  175. </style>