| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405 |
- <!-- -->
- <template>
- <div class="m-container">
- <h2>
- <el-page-header @back="onCancel" :content="detail.name"></el-page-header>
- </h2>
- <div class="m-core">
- <descriptions :column="3" class="desc">
- <descriptions-item label="群聊名称:">
- <div class="flexBox">
- {{ detail.name || "--" }}
- <i class="el-icon-edit" @click="reseDetail('name')"></i>
- </div>
- </descriptions-item>
- <descriptions-item label="所属乐团:">
- <div class="flexBox">
- {{ detail.memo || "--" }}
- <i class="el-icon-edit" @click="reseDetail('memo')"></i>
- </div>
- </descriptions-item>
- <descriptions-item label="群聊类型:">
- <div class="flexBox">
- {{ detail.groupType | catgGoupType }}
- <i class="el-icon-edit" @click="reseDetail('type')"></i>
- </div>
- </descriptions-item>
- </descriptions>
- <save-form
- :inline="true"
- :model="searchForm"
- @submit="search"
- @reset="onReSet"
- ref="searchForm"
- >
- <el-form-item prop="search">
- <el-input
- v-model="searchForm.search"
- placeholder="成员姓名/手机号"
- ></el-input>
- </el-form-item>
- <el-form-item prop="roleType">
- <el-select
- v-model.trim="searchForm.roleType"
- filterable
- clearable
- placeholder="角色"
- >
- <el-option
- v-for="(item, index) in catRoleList"
- :key="index"
- :label="item.label"
- :value="item.value"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <el-button native-type="submit" type="primary">搜索</el-button>
- <el-button native-type="reset" type="danger">重置</el-button>
- </el-form-item>
- </save-form>
- <div class="bWrap">
- <!-- -->
- <auth auths="imGroupMember/addGroupMember">
- <el-button type="primary" @click="addMembers">添加成员</el-button>
- </auth>
- <auth auths="imGroup/quitGroup" style="margin-left: 10px">
- <el-button type="danger" @click="deteleMembers">移除成员</el-button>
- </auth>
- </div>
- <div class="tableWrap">
- <el-table
- style="width: 100%"
- :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
- :data="tableList"
- @selection-change="handleSelectionChange"
- @select="onTableSelect"
- ref="multipleSelection"
- >
- <el-table-column type="selection" width="55"> </el-table-column>
- <el-table-column
- align="center"
- prop="userId"
- label="编号"
- ></el-table-column>
- <el-table-column
- align="center"
- prop="user.username"
- label="姓名"
- ></el-table-column>
- <el-table-column
- align="center"
- prop="user.phone"
- label="手机号"
- ></el-table-column>
- <el-table-column align="center" prop="roleType" label="角色">
- <template slot-scope="scope">
- <div>
- {{ scope.row.roleType ? scope.row.roleType : "学员" }}
- </div>
- </template>
- </el-table-column>
- <el-table-column align="center" prop="roleType" label="操作">
- <template slot-scope="scope">
- <div>
- <auth auths="imGroup/updateRoleType" v-if="scope.row.roleType">
- <el-button type="text" @click="resetroleType(scope.row)"
- >修改角色</el-button
- >
- </auth>
- <auth auths="imGroup/quitGroup" v-if="!scope.row.sendFlag">
- <el-button type="text" @click="deleteStudent(scope.row)"
- >移除成员</el-button
- >
- </auth>
- </div>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- sync
- :total.sync="rules.total"
- :page.sync="rules.page"
- :limit.sync="rules.limit"
- :page-sizes="rules.page_size"
- @pagination="getList"
- />
- </div>
- </div>
- <eidtCatInfo ref="eidtCatInfo" @getList="getDetail" />
- <addMember ref="addMember" @getList="getList" />
- <resetRoleType ref="resetRoleType" @getList="getList" />
- </div>
- </template>
- <script>
- import axios from "axios";
- import { getToken } from "@/utils/auth";
- import pagination from "@/components/Pagination/index";
- import load from "@/utils/loading";
- import { getGroupMemberList, getGroupDetail, quitGroupMember } from "./api";
- import { getSubject } from "@/api/buildTeam";
- import countTo from "vue-count-to";
- import { catRoleList } from "@/utils/searchArray";
- import eidtCatInfo from "./model/eidtCatInfo";
- import resetRoleType from "./model/resetRoleType";
- import addMember from "./model/addMember";
- // catRoleFilter
- export default {
- components: {
- pagination,
- "count-to": countTo,
- eidtCatInfo,
- addMember,
- resetRoleType,
- },
- data() {
- return {
- catRoleList,
- searchForm: {
- search: null,
- groupType: null,
- },
- detail: {
- groupType: "",
- id: "",
- img: "",
- introduce: "",
- memberNum: 0,
- memo: "",
- name: "",
- tags: "",
- tenantId: 0,
- type: "",
- },
- chatName: "",
- tableList: [{}],
- soundList: [],
- cooperationList: [],
- musicList: [],
- rules: {
- // 分页规则
- limit: 10, // 限制显示条数
- page: 1, // 当前页
- total: 0, // 总条数
- page_size: [10, 20, 40, 50], // 选择限制显示条数
- },
- multipleSelection: [],
- chioseIdList: [],
- isNewPage: false,
- };
- },
- //生命周期 - 创建完成(可以访问当前this实例)
- created() {},
- //生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {
- // 获取分部
- this.imGroupId = this.$route.query.imGroupId;
- this.$store.dispatch("setBranchs");
- this.init();
- },
- methods: {
- init() {
- getSubject({}).then((res) => {
- if (res.code == 200) {
- this.soundList = res.data;
- }
- });
- this.getDetail();
- this.getList();
- },
- async getDetail() {
- try {
- const res = await getGroupDetail({ imGroupId: this.imGroupId });
- this.detail = { ...res.data };
- } catch (e) {
- console.log(e);
- }
- },
- async getList() {
- try {
- const res = await getGroupMemberList({
- page: this.rules.page,
- rows: this.rules.limit,
- ...this.searchForm,
- imGroupId: this.$route.query.imGroupId,
- });
- // this.tableList = res.data;
- this.tableList = res.data.rows;
- this.rules.total = res.data.total;
- let idList = this.chioseIdList.map((group) => {
- return group.id;
- });
- this.isNewPage = true;
- this.$nextTick(() => {
- this.tableList.forEach((course) => {
- if (idList.indexOf(course.id) != -1) {
- this.$refs.multipleSelection.toggleRowSelection(course, true);
- }
- });
- this.isNewPage = false;
- });
- } catch (e) {
- console.log(e);
- }
- },
- search() {
- this.rules.page = 1;
- this.getList();
- },
- handleSelectionChange(val) {
- if (val.length > 0) {
- this.chioseIdList = this.chioseIdList.concat(val);
- this.chioseIdList = this.$helpers.lodash.uniqBy(
- this.chioseIdList,
- "id"
- );
- } else {
- if (this.isNewPage) return;
- let idList = this.chioseIdList.map((group) => {
- return group.id;
- });
- this.$nextTick(() => {
- let tableIdList = [];
- this.tableList.forEach((group) => {
- tableIdList.push(group.id);
- if (idList.indexOf(group.id) != -1) {
- this.$refs.multipleSelection.toggleRowSelection(group, false);
- }
- });
- this.chioseIdList = this.$helpers.lodash.remove(
- this.chioseIdList,
- function (item) {
- return tableIdList.indexOf(item.id) == -1;
- }
- );
- if (this.chioseIdList.length <= 0) {
- this.clearCom();
- }
- });
- }
- },
- clearCom() {
- this.chioseIdList = [];
- this.$refs.multipleSelection.clearSelection();
- },
- onTableSelect(rows, row) {
- let idList = this.chioseIdList.map((group) => {
- return group.id;
- });
- if (idList.indexOf(row.id) != -1) {
- this.chioseIdList.splice(idList.indexOf(row.id), 1);
- if (this.chioseIdList.length <= 0) {
- this.clearCom();
- }
- }
- },
- onReSet() {
- this.rules = {
- ...this.rules,
- page: 1,
- };
- this.$refs.searchForm.resetFields();
- this.search();
- },
- onCancel() {
- this.$store.dispatch("delVisitedViews", this.$route);
- this.$router.push({
- path: "/groupChatManager",
- });
- },
- async deleteStudent(row) {
- try {
- await this.$confirm(
- `是否确认移除成员 "${row.user.username}" ?`,
- "提示",
- {
- type: "warning",
- }
- );
- await quitGroupMember({
- imGroupId: this.$route.query.imGroupId,
- userId: row.userId,
- });
- this.$message.success("移除成功");
- this.getList();
- } catch (error) {
- console.log(error);
- }
- },
- reseDetail(type) {
- this.$refs.eidtCatInfo.openResetDioag(this.detail, type);
- },
- addMembers() {
- this.$refs.addMember.openDioag();
- },
- async deteleMembers() {
- if (!this.chioseIdList || this.chioseIdList.length <= 0) {
- this.$message.error(`请至少选择一位${str}`);
- return;
- }
- try {
- let idList = this.chioseIdList
- .map((group) => {
- return group.userId;
- })
- .join(",");
- let strName = this.chioseIdList
- .map((group) => {
- return group.user.username;
- })
- .join(",");
- strName.substring(0, strName.length - 1);
- await this.$confirm(`是否确认移除成员 "${strName}" ?`, "提示", {
- type: "warning",
- });
- await quitGroupMember({
- imGroupId: this.$route.query.imGroupId,
- userId: idList,
- });
- this.$message.success("移除成功");
- this.getList();
- } catch (error) {
- console.log(error);
- }
- },
- resetroleType(row) {
- this.$refs.resetRoleType.openDioag(row);
- },
- },
- };
- </script>
- <style lang='scss' scoped>
- .bWrap {
- display: flex;
- flex-direction: row;
- margin-bottom: 20px;
- }
- .statistic {
- .statistic-content > span {
- font-size: 20px !important;
- &:first-child {
- font-size: 24px !important;
- color: rgba(0, 0, 0, 0.85);
- font-weight: bold;
- }
- }
- }
- .desc {
- margin-bottom: 20px;
- }
- .flexBox {
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: space-between;
- i {
- font-size: 18px;
- cursor: pointer;
- }
- }
- </style>
|