index.vue 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <div class="page_staffManagement">
  3. <van-sticky>
  4. <div class="staffManagementTitle">
  5. <i class="iconfont icon-zuojiantou jiantou" @click="$router.go(-1)"></i>
  6. <span class="titleName">员工管理</span>
  7. </div>
  8. </van-sticky>
  9. <div class="staffBox">
  10. <div
  11. class="staffOne"
  12. v-for="(item, index) in admin_user"
  13. :key="index"
  14. v-if="admin_user.length > 0"
  15. @click="goEditStaff(item.user_id,item.is_sub_admin)"
  16. >
  17. <img v-if="item.avatar.length > 0" :src="item.avatar" alt />
  18. <img
  19. v-if="item.avatar.length == 0"
  20. src="../../../../../assets/images/default_avatar.jpg"
  21. alt
  22. />
  23. <p >
  24. <span>{{ item.user_name }}</span>
  25. <i
  26. v-if="org_creator != item.user_id"
  27. class="iconfont icon-bianji bianji"
  28. ></i>
  29. </p>
  30. </div>
  31. </div>
  32. <van-overlay :show="loading" type="spinner" size="30px">
  33. <div class="wrapper">
  34. <van-loading size="24px" vertical>正在加载中...</van-loading>
  35. </div>
  36. </van-overlay>
  37. </div>
  38. </template>
  39. <script>
  40. // import "../libs/rem.js";
  41. import { setRem } from "@/libs/functionRem";
  42. import { GetAllStaff } from "@/api/admin_user";
  43. export default {
  44. data() {
  45. return {
  46. loading:false,
  47. active: 0,
  48. admin_user: [],
  49. org_creator:0,
  50. };
  51. },
  52. methods: {
  53. GetAllStaff: function() {
  54. this.loading = true
  55. GetAllStaff().then(response => {
  56. if (response.data.state === 1) {
  57. this.admin_user = response.data.data.admins;
  58. for (let i = 0; i < this.admin_user.length; i++) {
  59. if (this.admin_user[i].role_ids.length > 0) {
  60. let isExist = -1;
  61. let ids = this.admin_user[i].role_ids.split(",");
  62. isExist = ids.indexOf(this.$route.query.id.toString());
  63. if (isExist < 0) {
  64. this.admin_user.splice(i, 1);
  65. i = i - 1;
  66. }
  67. }
  68. }
  69. this.loading = false
  70. } else {
  71. this.loading = false
  72. this.$toast({
  73. message: response.data.msg
  74. });
  75. }
  76. });
  77. },
  78. goEditStaff: function(id,is_sub_admin) {
  79. if (this.org_creator != id){
  80. this.$router.push({ path: "/staff/editstaff?id=" + id });
  81. }
  82. },
  83. goAddStaff: function() {
  84. this.$router.push({ path: "/staff/addstaff" });
  85. }
  86. },
  87. created() {
  88. setRem();
  89. //获取没被禁用的用户
  90. this.org_creator = this.$store.getters.user.org.creator
  91. this.GetAllStaff();
  92. }
  93. };
  94. </script>
  95. <style lang="scss" scoped>
  96. .page_staffManagement {
  97. height: 100%;
  98. overflow-y: auto;
  99. background: #fafafa;
  100. .staffManagementTitle {
  101. background: #fff;
  102. padding: 0 1.125rem;
  103. height: 3.125rem;
  104. display: flex;
  105. align-items: center;
  106. }
  107. .jiantou {
  108. font-size: 1.5rem;
  109. font-weight: 600;
  110. margin-right: 7rem;
  111. }
  112. .titleName {
  113. font-size: 1.125rem;
  114. font-weight: 600;
  115. }
  116. .iconOne {
  117. font-size: 1.5rem;
  118. }
  119. .staffBox {
  120. padding-left: 0.875rem;
  121. background: #fff;
  122. .staffOne {
  123. display: flex;
  124. align-items: center;
  125. height: 3.75rem;
  126. img {
  127. width: 2.5rem;
  128. height: 2.5rem;
  129. margin-right: 0.875rem;
  130. }
  131. p {
  132. display: flex;
  133. align-items: center;
  134. justify-content: space-between;
  135. padding-right: 0.875rem;
  136. flex: 1;
  137. height: 100%;
  138. // box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.1);
  139. border-bottom: 1px solid #e5e5e5;
  140. font-size: 1rem;
  141. }
  142. .bianji {
  143. font-size: 1.25rem;
  144. color: #cccccc;
  145. }
  146. }
  147. }
  148. }
  149. ::-webkit-scrollbar {
  150. width: 0;
  151. }
  152. </style>
  153. <style lang="scss">
  154. .page_staffManagement {
  155. .van-tabs__line {
  156. background: #5b98ff;
  157. }
  158. }
  159. .wrapper {
  160. position: fixed;
  161. left: 50%;
  162. top: 50%;
  163. transform: translate(-50%, -50%);
  164. }
  165. </style>