232 lines
4.9 KiB
Vue
232 lines
4.9 KiB
Vue
<template>
|
|
<view>
|
|
<view class="tit_warp">
|
|
<view class="cirtit">负责人</view>
|
|
</view>
|
|
<view class="cirinfo" v-for="(item,index) in arr" :key="index" v-if="item.roles == 1">
|
|
<image :src="item.img?item.img:BASE_IMG_URL+'headImg.png'" class="staffimg" mode=""></image>
|
|
<view class="staffinfo">
|
|
<view class="staffright" @click="toSelectStaff">
|
|
<view class="ri_left">
|
|
<view class="name">{{item.name}}</view>
|
|
<!-- <view class="post">{{item.post}}</view> -->
|
|
</view>
|
|
<view class="iconfont icon-you"></view>
|
|
</view>
|
|
<view class="staffli" @click="noChange">
|
|
<view class="statext">权限</view>
|
|
<view class="liright">
|
|
负责人
|
|
<view class="iconfont icon-arrows_right"></view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="tit_warp">
|
|
<view class="cirtit">团队成员</view>
|
|
<view class="titright" @click="toSelect">添加团队成员</view>
|
|
</view>
|
|
<view class="cirinfo" v-for="(item,index) in arr" :key="index" v-if="item.roles == 2">
|
|
<image :src="item.img?item.img:BASE_IMG_URL+'headImg.png'" class="staffimg" mode=""></image>
|
|
<view class="staffinfo">
|
|
<view class="staffright">
|
|
<view class="ri_left">
|
|
<view class="name">{{item.name}}</view>
|
|
<!-- <view class="post">{{item.post}}</view> -->
|
|
</view>
|
|
<image :src="BASE_IMG_URL+'delete1.png'" @click="delFollow(index)" class="deleimg" mode=""></image>
|
|
</view>
|
|
<view class="staffli">
|
|
<view class="statext">权限</view>
|
|
<picker @change="(e)=>{changePre(e,index)}" :range="preArr" :value="preIndex">
|
|
<view class="liright">
|
|
{{preArr[item.is_edit]?preArr[item.is_edit]:'请选择'}}
|
|
<view class="iconfont icon-arrows_right"></view>
|
|
</view>
|
|
</picker>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view id="btn" class="btn_g bg-blue button-hover round" @click="$noMultipleClicks(sureSub)">
|
|
确定
|
|
</view>
|
|
|
|
<!-- 选择成员 -->
|
|
<select-staff ref="staffChild" @sureStaff="sureStaff" :type="2"></select-staff>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import { BASE_IMG_URL} from '@/util/api.js'
|
|
import { netTeamList, netTeamEdit } from '@/api/index.js'
|
|
import selectStaff from '@/components/selectStaff.vue'
|
|
|
|
export default{
|
|
components:{
|
|
selectStaff
|
|
},
|
|
data() {
|
|
return{
|
|
noClick:true, //防止 重复点击
|
|
BASE_IMG_URL:BASE_IMG_URL,
|
|
id:'',
|
|
type:'',
|
|
arr:[],
|
|
preArr:['只读','读写'],
|
|
preIndex:0
|
|
}
|
|
},
|
|
onLoad(options) {
|
|
this.id = options.id
|
|
this.getList()
|
|
},
|
|
methods:{
|
|
changePre(e,index) {
|
|
let obj = this.arr[index]
|
|
obj.is_edit = e.detail.value
|
|
this.$set(this.arr,index,obj)
|
|
},
|
|
toSelect() {
|
|
this.$refs.staffChild.init()
|
|
},
|
|
sureStaff(obj) {
|
|
if(obj.id){
|
|
let flag = false
|
|
this.arr.forEach(ele=>{
|
|
if(ele.id == obj.id){
|
|
flag = true
|
|
}
|
|
})
|
|
if(!flag){
|
|
let item = {
|
|
id:obj.id,
|
|
img:obj.img,
|
|
name:obj.name,
|
|
post:obj.post,
|
|
roles:2,
|
|
is_edit:0
|
|
}
|
|
this.arr.push(item)
|
|
}
|
|
}
|
|
},
|
|
delFollow(index) {
|
|
this.arr.splice(index,1)
|
|
},
|
|
getList() {
|
|
netTeamList({id:this.id}).then(res=>{
|
|
this.arr = res.data
|
|
})
|
|
},
|
|
sureSub() {
|
|
let a = []
|
|
this.arr.forEach(ele=>{
|
|
if(ele.roles == 2){
|
|
a.push({
|
|
id:ele.id,
|
|
is_edit:ele.is_edit
|
|
})
|
|
}
|
|
})
|
|
let params = {
|
|
id:this.id,
|
|
staff:a
|
|
}
|
|
netTeamEdit(params).then(res=>{
|
|
uni.showToast({
|
|
title:res.msg,
|
|
icon:'none'
|
|
})
|
|
setTimeout(()=>{
|
|
uni.navigateBack({
|
|
delta:1
|
|
})
|
|
},2000)
|
|
})
|
|
},
|
|
noChange() {
|
|
uni.showToast({
|
|
title:'不允许修改负责人',
|
|
icon:'none'
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.tit_warp{
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding:24rpx 30rpx;
|
|
border-bottom:1rpx solid #d2d0d0;
|
|
.cirtit{
|
|
font-size:28rpx;
|
|
}
|
|
.titright{
|
|
font-size:24rpx;
|
|
color:$uni-text-color;
|
|
}
|
|
}
|
|
|
|
.cirinfo{
|
|
padding:24rpx;
|
|
border-bottom:1rpx solid #d2d0d0;
|
|
display: flex;
|
|
justify-content: flex-start;
|
|
&:last-child{
|
|
border-bottom:0;
|
|
}
|
|
.staffimg{
|
|
width:80rpx;
|
|
height:80rpx;
|
|
border-radius: 50%;
|
|
margin-right:24rpx;
|
|
}
|
|
.staffinfo{
|
|
flex:1;
|
|
.staffright{
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom:24rpx;
|
|
.ri_left{
|
|
.name{
|
|
font-size:26rpx;
|
|
color:#333;
|
|
}
|
|
.post{
|
|
font-size:24rpx;
|
|
color:#666;
|
|
margin-top:15rpx;
|
|
}
|
|
}
|
|
.deleimg{
|
|
width:44rpx;
|
|
height:44rpx;
|
|
}
|
|
}
|
|
.staffli{
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding:24rpx 0;
|
|
border-top:1rpx solid #d2d0d0;
|
|
.statext{
|
|
font-size:26rpx;
|
|
color:#666;
|
|
}
|
|
.liright{
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
align-items: center;
|
|
color:#666;
|
|
font-size:28rpx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|