|
|
|
|
@ -5,24 +5,51 @@
|
|
|
|
|
<div class>
|
|
|
|
|
<div class="g_h_10"></div>
|
|
|
|
|
<div class="r_box g_ml_10 g_mr_10" style="border-radius: 8px;background-color: #fff;">
|
|
|
|
|
<div v-for="(item, index) in teamList" :key="item.id"
|
|
|
|
|
class="g_flex_row_start" style="padding: 0 10px">
|
|
|
|
|
<div v-for="(item, index) in memberList" :key="'m_' + item.id" @click="editMember(item)"
|
|
|
|
|
class="g_flex_row_between g_fs_18" style="padding: 0 10px">
|
|
|
|
|
<div class="g_flex_c g_flex_none g_mr_10">
|
|
|
|
|
<img :src="item.avatar || 'https://bocai-cms.oss-cn-beijing.aliyuncs.com/web-resource/pugongying/default.svg'"
|
|
|
|
|
alt="" style="width: 40px;height: 40px;border-radius: 50%;">
|
|
|
|
|
</div>
|
|
|
|
|
<div class="g_flex_column_between g_flex_1"
|
|
|
|
|
:style="(index === memberList.length - 1 && teamList.length === 0) ? 'padding: 9px 0;' : 'border-bottom: 0.5px solid #eee;padding: 9px 0;'"
|
|
|
|
|
>
|
|
|
|
|
<div class="g_flex_1 g_flex_row_start" style="font-size: 17px;color: rgba(0, 0, 0, 0.9);">
|
|
|
|
|
{{ item.aliasName || item.userName }}
|
|
|
|
|
<div class="g_flex_column_center">
|
|
|
|
|
<div class="g_flex_row_start">
|
|
|
|
|
<div class="g_fs_12 g_pl_2 g_h_18 g_pr_2 g_radius_4 g_flex_c g_ml_4"
|
|
|
|
|
v-for="(role, rIndex) in getDisplayRoles(item.agencyRoleNameList)"
|
|
|
|
|
:key="rIndex"
|
|
|
|
|
:class="role !== '...' ? (role == '创建人' ? 'creator' : role == '管理员' ? 'manager' : 'member') : ''"
|
|
|
|
|
v-show="role && role.trim()">
|
|
|
|
|
{{ role }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="g_flex_none" style="font-size: 14px;color: #999999;">
|
|
|
|
|
@{{ agencyInfo.fullName }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-for="(item, index) in teamList" :key="'t_' + item.id" @click="goChildGroup(item)"
|
|
|
|
|
class="g_flex_row_start" style="padding: 0 10px;">
|
|
|
|
|
<div class="g_flex_none g_flex_column_center" style="margin-right: 10px;">
|
|
|
|
|
<div class="g_flex_c" style="width: 40px;height: 40px;background-color: rgba(2, 122, 255, 0.1);color: #1890ff;border-radius: 50%;">
|
|
|
|
|
<i class="iconfont icon-folder-fill" style="font-size: 20px;"></i>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="g_flex_1 g_flex_column_center"
|
|
|
|
|
style="height: 60px;"
|
|
|
|
|
:style="index === teamList.length - 1 ? 'padding: 9px 0;' : 'border-bottom: 0.5px solid #eee;padding: 9px 0;'"
|
|
|
|
|
:style="index === teamList.length - 1 ? 'padding: 9px 0;height: 60px;' : 'border-bottom: 0.5px solid #eee;padding: 9px 0;height: 60px;'"
|
|
|
|
|
>
|
|
|
|
|
<div style="font-size: 17px;color: rgba(2, 122, 255, 1);" class="g_ell_1">
|
|
|
|
|
{{ item.teamName }}({{ item.userNum }})
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-if="teamList.length === 0" class="g_text_c g_c_9" style="padding: 40px 0;">
|
|
|
|
|
暂无子部门
|
|
|
|
|
<div v-if="memberList.length === 0 && teamList.length === 0" class="g_text_c g_c_9" style="padding: 40px 0;">
|
|
|
|
|
暂无数据
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="g_h_40"></div>
|
|
|
|
|
@ -115,6 +142,7 @@
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
memberList: [],
|
|
|
|
|
teamList: [],
|
|
|
|
|
currentId: "",
|
|
|
|
|
currentParentId: "",
|
|
|
|
|
@ -126,6 +154,7 @@ export default {
|
|
|
|
|
editNameValue: "",
|
|
|
|
|
deleteShow: false,
|
|
|
|
|
deleteLoading: false,
|
|
|
|
|
agencyInfo: uni.getStorageSync("agencyInfo"),
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
onLoad(options) {
|
|
|
|
|
@ -138,12 +167,57 @@ export default {
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
onShow() {
|
|
|
|
|
this.initData();
|
|
|
|
|
this.getList();
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
initData() {
|
|
|
|
|
let childs = uni.getStorageSync("childGroup_childs") || [];
|
|
|
|
|
this.teamList = childs;
|
|
|
|
|
compare(a, b) {
|
|
|
|
|
let sortList = ["创建人", "管理员", "成员"];
|
|
|
|
|
if (sortList.includes(a) && sortList.includes(b)) {
|
|
|
|
|
return sortList.indexOf(a) - sortList.indexOf(b);
|
|
|
|
|
} else if (sortList.includes(a)) {
|
|
|
|
|
return -1;
|
|
|
|
|
} else if (sortList.includes(b)) {
|
|
|
|
|
return 1;
|
|
|
|
|
} else {
|
|
|
|
|
return a.localeCompare(b);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
getDisplayRoles(roles) {
|
|
|
|
|
if (!roles || roles.length <= 2) {
|
|
|
|
|
return (roles || []).filter(role => role && role.trim());
|
|
|
|
|
}
|
|
|
|
|
const filteredRoles = (roles || []).filter(role => role && role.trim());
|
|
|
|
|
if (filteredRoles.length <= 3) {
|
|
|
|
|
return filteredRoles;
|
|
|
|
|
}
|
|
|
|
|
return [...filteredRoles.slice(0, 3), '...'];
|
|
|
|
|
},
|
|
|
|
|
getList() {
|
|
|
|
|
let that = this;
|
|
|
|
|
uni.showLoading({
|
|
|
|
|
title: "加载中...",
|
|
|
|
|
});
|
|
|
|
|
that.G.Post('/yishoudan/agency/team/list', {}, (teamRes) => {
|
|
|
|
|
let currentChild = that.findChildById(teamRes.list, that.currentId);
|
|
|
|
|
that.teamList = currentChild ? (currentChild.childs || []) : [];
|
|
|
|
|
|
|
|
|
|
that.G.Get(that.api.order_peopleList, {
|
|
|
|
|
pageSize: 500,
|
|
|
|
|
agencyTeamIds: that.currentId,
|
|
|
|
|
}, (res) => {
|
|
|
|
|
that.memberList = res.recordList || [];
|
|
|
|
|
that.memberList.forEach((item) => {
|
|
|
|
|
item.agencyRoleNameList = item.agencyRoleName.split(";");
|
|
|
|
|
item.agencyRoleNameList = item.agencyRoleNameList.sort(that.compare);
|
|
|
|
|
});
|
|
|
|
|
uni.hideLoading();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
editMember(_item) {
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: "/root/merchantManagement/addOrUpdataMember?info=" + JSON.stringify(_item),
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
goChildGroup(item) {
|
|
|
|
|
uni.setStorageSync("childGroup_childs", item.childs || []);
|
|
|
|
|
@ -192,7 +266,7 @@ export default {
|
|
|
|
|
uni.setNavigationBarTitle({
|
|
|
|
|
title: this.pageTitle,
|
|
|
|
|
});
|
|
|
|
|
this.refreshList();
|
|
|
|
|
this.getList();
|
|
|
|
|
}, (err) => {
|
|
|
|
|
this.editNameLoading = false;
|
|
|
|
|
});
|
|
|
|
|
@ -200,7 +274,7 @@ export default {
|
|
|
|
|
submitDelete() {
|
|
|
|
|
if (this.deleteLoading) return;
|
|
|
|
|
this.deleteLoading = true;
|
|
|
|
|
this.G.Post(`/yishoudan/agency/team/del/${this.currentId}`, {}, (res) => {
|
|
|
|
|
this.G.Get(`/yishoudan/agency/team/del/${this.currentId}`, {}, (res) => {
|
|
|
|
|
this.deleteLoading = false;
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: "删除成功",
|
|
|
|
|
@ -211,15 +285,6 @@ export default {
|
|
|
|
|
this.deleteLoading = false;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
refreshList() {
|
|
|
|
|
this.G.Post('/yishoudan/agency/team/list', {}, (res) => {
|
|
|
|
|
let currentChild = this.findChildById(res.list, this.currentId);
|
|
|
|
|
if (currentChild) {
|
|
|
|
|
this.teamList = currentChild.childs || [];
|
|
|
|
|
uni.setStorageSync("childGroup_childs", this.teamList);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
findChildById(list, id) {
|
|
|
|
|
for (let item of list) {
|
|
|
|
|
if (String(item.id) === String(id)) {
|
|
|
|
|
@ -237,4 +302,22 @@ export default {
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
|
.creator {
|
|
|
|
|
color: #fff;
|
|
|
|
|
background-color: #ff4d4f;
|
|
|
|
|
zoom: 0.9;
|
|
|
|
|
line-height: 18px;
|
|
|
|
|
}
|
|
|
|
|
.member {
|
|
|
|
|
color: #fff;
|
|
|
|
|
background-color: rgba(0, 0, 0, 0.25);
|
|
|
|
|
zoom: 0.9;
|
|
|
|
|
line-height: 18px;
|
|
|
|
|
}
|
|
|
|
|
.manager {
|
|
|
|
|
background-color: rgba(0, 145, 255, 1);
|
|
|
|
|
color: #fff;
|
|
|
|
|
zoom: 0.9;
|
|
|
|
|
line-height: 18px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|