aboutGroup.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <view class="section about-group">
  3. <view class="section-title" @click="handleMore">
  4. <image :src="$static('images/crm_about/contacts.png')" class="icon" />
  5. <text class="title">
  6. 相关团队
  7. </text>
  8. <view
  9. v-if="!config.isSeas"
  10. class="add-btn"
  11. @click="handleAdd">
  12. <text class="wk wk-plus icon-add" />
  13. <text>新建</text>
  14. </view>
  15. </view>
  16. <view class="section-body">
  17. <template v-if="list.length > 0">
  18. <view class="list">
  19. <view v-for="(item, index) in list" :key="index" class="list-item">
  20. <wk-avatar
  21. :name="item.realname"
  22. :avatar="item.img"
  23. :size="12"
  24. class="list-item-avatar" />
  25. <view class="list-item-content">
  26. <view class="box">
  27. <text class="name">
  28. {{ item.realname }}
  29. </text>
  30. <text class="role">
  31. {{ getRoleText(item.power) }}
  32. </text>
  33. </view>
  34. <view class="dept">
  35. {{ item.deptName }}
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. </template>
  41. <template v-else>
  42. <view class="no-data">
  43. 暂无数据
  44. </view>
  45. </template>
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. export default {
  51. name: 'AboutGroup',
  52. props: {
  53. list: {
  54. type: Array,
  55. required: true
  56. },
  57. config: {
  58. type: Object,
  59. default: () => {}
  60. }
  61. },
  62. data() {
  63. return {}
  64. },
  65. methods: {
  66. getRoleText(power) {
  67. // 3 负责人 1 2 普通员工
  68. if (Number(power) === 3) return '负责人'
  69. return '普通员工'
  70. },
  71. handleMore() {
  72. if (this.config.isSeas) return
  73. const type = this.config.type
  74. const checkRes = this.$auth(`crm.${type}.teamsave`)
  75. if (!checkRes) {
  76. this.$toast('权限不足!')
  77. return
  78. }
  79. // let id = null
  80. // if (type === 'customer') {
  81. // id = this.config.detail.customerId
  82. // }
  83. let id = this.config.detail[`${type}Id`]
  84. this.$Router.navigateTo({
  85. url: '/pages_crm/group/index',
  86. query: {
  87. type: this.config.type,
  88. id: id
  89. }
  90. })
  91. },
  92. handleAdd() {}
  93. }
  94. }
  95. </script>
  96. <style scoped lang="scss">
  97. @import './style.scss';
  98. .about-group {
  99. .list {
  100. background-color: white;
  101. padding: 0 32rpx;
  102. .list-item {
  103. border-bottom: 1rpx solid $border-color;
  104. @include padding;
  105. @include left;
  106. &:last-child {
  107. border-bottom: 0 none;
  108. }
  109. &-avatar {
  110. width: 66rpx;
  111. height: 66rpx;
  112. border-radius: 50%;
  113. margin-right: 26rpx;
  114. }
  115. &-content {
  116. flex: 1;
  117. .box {
  118. width: 100%;
  119. display: flex;
  120. .name {
  121. flex: 1;
  122. font-size: $wk-font-medium;
  123. color: $dark;
  124. }
  125. .role {
  126. font-size: $wk-font-sm;
  127. color: $gray;
  128. }
  129. }
  130. .dept {
  131. font-size: $wk-font-sm;
  132. color: $gray;
  133. }
  134. }
  135. }
  136. }
  137. }
  138. </style>