addAdmin.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. <script>
  2. import { post, get } from '../../../utils/request'
  3. // import Warning from '@/components/icon/warning.vue'
  4. export default {
  5. data() {
  6. return {
  7. formData: {
  8. AdminEmail: '',
  9. TeamAdmin: [],
  10. },
  11. teamList: {},
  12. click: true,
  13. memberRole: ''
  14. // dialogVisible: false,
  15. }
  16. },
  17. // components:{Warning},
  18. methods: {
  19. // 重置表单
  20. resetForm (formName) {
  21. this.$refs[formName].resetFields()
  22. this.$router.push("/manageAdmin")
  23. },
  24. //提交添加表单
  25. submitFormSingle(){
  26. if(this.click && this.memberRole === '1'){
  27. this.click = false
  28. const regEmail = /^([A-Za-z0-9_\-.])+@([A-Za-z0-9_\-.])+\.([A-Za-z]{2,4})$/
  29. if (this.formData.AdminEmail.trim() === '' || this.formData.TeamAdmin.length === 0) {
  30. this.$message.error('Missing required information')
  31. } else {
  32. var urlencoded = new URLSearchParams()
  33. urlencoded.append("teamIds", this.formData.TeamAdmin)
  34. urlencoded.append("account", this.formData.AdminEmail)
  35. post('/pdf-tech/vppTeam/sendEmailForAddTeamAdmin', urlencoded).then((res)=>{
  36. if(res.data.code === 200){
  37. this.$message({
  38. duration: 5000,
  39. message: 'Change Success',
  40. type: "success",
  41. })
  42. } else if(res.data.msg === "Member has joined a non-default team"){
  43. this.$message({
  44. duration: 5000,
  45. message: 'Member has joined a non-default team',
  46. type: "error",
  47. })
  48. } else if(res.data.msg === "Invalid Email Addresses"){
  49. this.$message({
  50. message: 'Invalid Email Addresses',
  51. type: "error",
  52. })
  53. }
  54. })
  55. }
  56. //限制点击
  57. setTimeout(() => {
  58. this.click = true
  59. }, 3000)
  60. }
  61. },
  62. },
  63. mounted() {
  64. // 获取团队列表
  65. get('/pdf-tech/vppTeam/listWithAdmin').then(
  66. (res) => {
  67. if(res.data.code === 200){
  68. this.teamList = res.data.result
  69. }
  70. }
  71. )
  72. get('/pdf-tech/vppMember/getMemberInfo').then((res)=>{
  73. if(res.data.code === 200){
  74. this.memberRole = res.data.result.role
  75. }
  76. })
  77. }
  78. }
  79. </script>
  80. <template>
  81. <div>
  82. <h1 class="text-28px leading-40px mb-15px font-700">Add Admin</h1>
  83. <div class="bg-[#fff] card">
  84. <el-form
  85. label-position="top"
  86. label-width="100px"
  87. class="p-40px"
  88. :model="formData"
  89. ref="formData"
  90. >
  91. <el-form-item prop="memberEmail" class="required">
  92. <span slot="label" class="label">
  93. Admin Email
  94. </span>
  95. <el-input v-model="formData.AdminEmail" class="under-border" placeholder="Admin Email"></el-input>
  96. </el-form-item>
  97. <el-form-item prop="team">
  98. <span slot="label" class="label">
  99. Team Admin
  100. </span>
  101. <el-select
  102. v-model="formData.TeamAdmin"
  103. placeholder="Team Admin"
  104. multiple
  105. class="w-[40%]"
  106. >
  107. <el-option
  108. v-for="item in teamList"
  109. :key="item.id"
  110. :label="item.name"
  111. :value="item.id"
  112. >
  113. </el-option>
  114. </el-select>
  115. </el-form-item>
  116. <el-form-item>
  117. <button
  118. type="button"
  119. @click="resetForm('formData')"
  120. class="
  121. w-168px
  122. h-48px
  123. border-1px border-[#1460F3]
  124. text-[#1460F3]
  125. rounded-8px
  126. font-bold
  127. mr-16px
  128. hover:opacity-80
  129. "
  130. >
  131. Cancel
  132. </button>
  133. <button
  134. type="button"
  135. @click="submitFormSingle()"
  136. class="
  137. w-168px
  138. h-48px
  139. bg-[#1460F3]
  140. text-[#fff]
  141. rounded-8px
  142. font-bold
  143. hover:opacity-80
  144. "
  145. >
  146. Add
  147. </button>
  148. </el-form-item>
  149. </el-form>
  150. </div>
  151. <!-- 账号未注册弹出框 -->
  152. <!-- <el-dialog
  153. title=""
  154. :visible.sync="dialogVisible"
  155. width="376px"
  156. center
  157. top="30vh"
  158. :show-close="false"
  159. >
  160. <Warning class="inline-block" />
  161. <div class="mt-16px text-16px leading-24px text-[#232A40]">
  162. <p>Your admin account hasn't created.<br>Send invitation and add admin?</p>
  163. </div>
  164. <span slot="footer" class="dialog-footer">
  165. <el-button @click="dialogVisible = false">Cancel</el-button>
  166. <el-button type="primary" @click="sureSave">Yes</el-button>
  167. </span>
  168. </el-dialog> -->
  169. </div>
  170. </template>
  171. <style lang="scss" scoped>
  172. .el-form-item::v-deep label {
  173. color: #232a40 !important;
  174. }
  175. .active {
  176. color: #1460f3;
  177. background-color: #fff;
  178. }
  179. .card {
  180. border-radius: 8px;
  181. border-top-left-radius: 0px;
  182. }
  183. .el-input::v-deep input {
  184. border: 0px !important;
  185. border-bottom: 1px solid #d9d9d9 !important;
  186. // border-radius: 6px !important;
  187. }
  188. .username::v-deep input {
  189. border-radius: 0px !important;
  190. }
  191. .email::v-deep input {
  192. border: 0px !important;
  193. }
  194. .required::v-deep label::before {
  195. display: none;
  196. }
  197. .el-form-item::v-deep label {
  198. font-weight: 700;
  199. padding: 0;
  200. margin-left: 8px;
  201. }
  202. .el-select-dropdown::v-deep .popper__arrow {
  203. display: none;
  204. }
  205. ::v-deep .el-dialog {
  206. border-radius: 8px;
  207. .el-dialog__header {
  208. display: none;
  209. }
  210. .el-dialog__body {
  211. text-align: center;
  212. padding: 24px;
  213. }
  214. .el-dialog__footer {
  215. padding: 0 24px 24px;
  216. .el-button {
  217. width: 133px;
  218. height: 32px;
  219. padding: 0;
  220. &.el-button--default {
  221. border-color: #1460F3;
  222. span {
  223. color: #1460F3;
  224. }
  225. }
  226. span {
  227. line-height: 20px;
  228. }
  229. }
  230. .el-button + .el-button {
  231. margin-left: 8px;
  232. }
  233. }
  234. }
  235. </style>
  236. <style lang="scss">
  237. .popper__arrow {
  238. display: none !important;
  239. }
  240. .el-select-dropdown {
  241. margin-top: 0 !important;
  242. }
  243. </style>
  244. <style lang="scss">
  245. .el-message--success {
  246. margin-top: 90px !important;
  247. background-color: #373A47 !important;
  248. height: 36px;
  249. min-width: auto !important;
  250. padding: 12px !important;
  251. p{
  252. color: #fff !important;
  253. }
  254. }
  255. </style>