projectManager.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <template>
  2. <div class="authentication-page">
  3. <custom-header name="项目管理员"></custom-header>
  4. <div class="team-content">
  5. <template v-if="teamList && teamList.length">
  6. <div class="team-list">
  7. <farm-info-card
  8. v-for="ele in teamList"
  9. :key="ele.id"
  10. class="list-item"
  11. :data="{
  12. ...ele,
  13. maxWidth: 'fit-content',
  14. roleName: '项目管理员',
  15. }"
  16. >
  17. <template #right>
  18. <div @click.stop="handleRemoveProjectManager(ele)">移除</div>
  19. </template>
  20. </farm-info-card>
  21. </div>
  22. </template>
  23. <div v-else class="empty-wrap">
  24. <div class="empty-text">暂无数据</div>
  25. </div>
  26. </div>
  27. <div class="custom-bottom-fixed-btns">
  28. <div class="bottom-btn primary-btn" @click="handleAddProjectManager">添加项目管理员</div>
  29. </div>
  30. </div>
  31. </template>
  32. <script setup>
  33. import customHeader from "@/components/customHeader.vue";
  34. import FarmInfoCard from "@/components/pageComponents/FarmInfoCard.vue";
  35. import { ref, onMounted } from "vue";
  36. import { useRouter } from "vue-router";
  37. import { ElMessage, ElMessageBox } from "element-plus";
  38. const router = useRouter();
  39. const handleRemoveProjectManager = async (item) => {
  40. ElMessageBox.confirm('确定移除该成员吗?', '提示', {
  41. confirmButtonText: '确定',
  42. cancelButtonText: '取消',
  43. type: 'warning',
  44. }).then(async () => {
  45. const { code,msg } = await VE_API.mine.saveManager({id: item.id, role: 3});
  46. if (code === 0) {
  47. ElMessage.success("移除成功");
  48. getManagerList();
  49. } else {
  50. ElMessage.error(msg);
  51. }
  52. }).catch(() => {});
  53. };
  54. const handleAddProjectManager = () => {
  55. router.push("/team_manage?add=true");
  56. };
  57. onMounted(() => {
  58. getManagerList();
  59. });
  60. const teamList = ref([]);
  61. const getManagerList = async () => {
  62. const { data } = await VE_API.mine.listManagerList();
  63. if (data && data.length > 0) {
  64. const list = Array.isArray(data) ? data.filter((item) => item.role == 2) : [];
  65. teamList.value = list;
  66. }
  67. };
  68. </script>
  69. <style lang="scss" scoped>
  70. .authentication-page {
  71. width: 100%;
  72. height: 100vh;
  73. background-color: #f5f7fb;
  74. .team-content {
  75. width: 100%;
  76. height: 100%;
  77. padding: 10px 12px;
  78. box-sizing: border-box;
  79. .team-list {
  80. width: 100%;
  81. }
  82. .empty-wrap {
  83. padding-top: 40px;
  84. text-align: center;
  85. .empty-text {
  86. font-size: 14px;
  87. color: #86909c;
  88. }
  89. }
  90. }
  91. .custom-bottom-fixed-btns {
  92. justify-content: center;
  93. }
  94. }
  95. </style>