chatDetail.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. <!-- -->
  2. <template>
  3. <div class="m-container">
  4. <h2>
  5. <el-page-header @back="onCancel" :content="detail.name"></el-page-header>
  6. </h2>
  7. <div class="m-core">
  8. <descriptions :column="3" class="desc">
  9. <descriptions-item label="群里聊名称:">
  10. <div class="flexBox">
  11. {{ detail.name || "--" }}
  12. <i class="el-icon-edit" @click="reseDetail('name')"></i>
  13. </div>
  14. </descriptions-item>
  15. <descriptions-item label="所属乐团:">
  16. {{ detail.tags || "--" }}
  17. </descriptions-item>
  18. <descriptions-item label="群聊类型:">
  19. <div class="flexBox">
  20. {{ detail.groupType | catgGoupType }}
  21. <i class="el-icon-edit" @click="reseDetail('type')"></i>
  22. </div>
  23. </descriptions-item>
  24. </descriptions>
  25. <save-form
  26. :inline="true"
  27. :model="searchForm"
  28. @submit="search"
  29. @reset="onReSet"
  30. ref="searchForm"
  31. >
  32. <el-form-item prop="search">
  33. <el-input
  34. v-model="searchForm.search"
  35. placeholder="成员姓名/手机号"
  36. ></el-input>
  37. </el-form-item>
  38. <el-form-item prop="roleType">
  39. <el-select
  40. v-model.trim="searchForm.roleType"
  41. filterable
  42. clearable
  43. placeholder="角色"
  44. >
  45. <el-option
  46. v-for="(item, index) in catRoleList"
  47. :key="index"
  48. :label="item.label"
  49. :value="item.value"
  50. ></el-option>
  51. </el-select>
  52. </el-form-item>
  53. <el-form-item>
  54. <el-button native-type="submit" type="primary">搜索</el-button>
  55. <el-button native-type="reset" type="danger">重置</el-button>
  56. </el-form-item>
  57. </save-form>
  58. <div class="bWrap">
  59. <el-button type="primary" @click="addMembers">添加成员</el-button>
  60. <el-button type="danger">删除成员</el-button>
  61. </div>
  62. <div class="tableWrap">
  63. <el-table
  64. style="width: 100%"
  65. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  66. :data="tableList"
  67. @selection-change="handleSelectionChange"
  68. @select="onTableSelect"
  69. ref="multipleSelection"
  70. >
  71. <el-table-column type="selection" width="55"> </el-table-column>
  72. <el-table-column
  73. align="center"
  74. prop="userId"
  75. label="编号"
  76. ></el-table-column>
  77. <el-table-column
  78. align="center"
  79. prop="user.username"
  80. label="姓名"
  81. ></el-table-column>
  82. <el-table-column
  83. align="center"
  84. prop="user.phone"
  85. label="手机号"
  86. ></el-table-column>
  87. <el-table-column
  88. align="center"
  89. prop="roleType"
  90. label="角色"
  91. ></el-table-column>
  92. <el-table-column align="center" prop="roleType" label="操作">
  93. <template slot-scope="scope">
  94. <div>
  95. <auth
  96. auths="imSendGroupMessage/update"
  97. v-if="!scope.row.sendFlag"
  98. >
  99. <el-button type="text" @click="resetGroup(scope.row)"
  100. >修改角色</el-button
  101. >
  102. </auth>
  103. <auth
  104. auths="imSendGroupMessage/delete"
  105. v-if="!scope.row.sendFlag"
  106. >
  107. <el-button type="text" @click="deleteStudent(scope.row)"
  108. >移除成员</el-button
  109. >
  110. </auth>
  111. </div>
  112. </template>
  113. </el-table-column>
  114. </el-table>
  115. <pagination
  116. sync
  117. :total.sync="rules.total"
  118. :page.sync="rules.page"
  119. :limit.sync="rules.limit"
  120. :page-sizes="rules.page_size"
  121. @pagination="getList"
  122. />
  123. </div>
  124. </div>
  125. <eidtCatInfo ref="eidtCatInfo" @getList="getList" />
  126. <addMember ref="addMember" @getList="getList" />
  127. </div>
  128. </template>
  129. <script>
  130. import axios from "axios";
  131. import { getToken } from "@/utils/auth";
  132. import pagination from "@/components/Pagination/index";
  133. import load from "@/utils/loading";
  134. import { getGroupMemberList, getGroupDetail } from "./api";
  135. import { getSubject } from "@/api/buildTeam";
  136. import countTo from "vue-count-to";
  137. import { catRoleList } from "@/utils/searchArray";
  138. import eidtCatInfo from "./model/eidtCatInfo";
  139. import addMember from './model/addMember'
  140. // catRoleFilter
  141. export default {
  142. components: { pagination, "count-to": countTo ,eidtCatInfo,addMember},
  143. data() {
  144. return {
  145. catRoleList,
  146. searchForm: {
  147. search: null,
  148. groupType: null,
  149. },
  150. detail: {
  151. groupType: "",
  152. id: "",
  153. img: "",
  154. introduce: "",
  155. memberNum: 0,
  156. memo: "",
  157. name: "",
  158. tags: "",
  159. tenantId: 0,
  160. type: "",
  161. },
  162. chatName: "",
  163. tableList: [{}],
  164. soundList: [],
  165. cooperationList: [],
  166. musicList: [],
  167. rules: {
  168. // 分页规则
  169. limit: 10, // 限制显示条数
  170. page: 1, // 当前页
  171. total: 0, // 总条数
  172. page_size: [10, 20, 40, 50], // 选择限制显示条数
  173. },
  174. multipleSelection: [],
  175. chioseIdList: [],
  176. isNewPage: false,
  177. };
  178. },
  179. //生命周期 - 创建完成(可以访问当前this实例)
  180. created() {},
  181. //生命周期 - 挂载完成(可以访问DOM元素)
  182. mounted() {
  183. // 获取分部
  184. this.imGroupId = this.$route.query.imGroupId;
  185. this.$store.dispatch("setBranchs");
  186. this.init();
  187. },
  188. methods: {
  189. init() {
  190. getSubject({}).then((res) => {
  191. if (res.code == 200) {
  192. this.soundList = res.data;
  193. }
  194. });
  195. this.getDetail();
  196. this.getList();
  197. },
  198. async getDetail() {
  199. try {
  200. const res = await getGroupDetail({ imGroupId: this.imGroupId });
  201. this.detail = { ...res.data };
  202. } catch (e) {
  203. console.log(e);
  204. }
  205. },
  206. async getList() {
  207. try {
  208. const res = await getGroupMemberList({
  209. page: this.rules.page,
  210. rows: this.rules.limit,
  211. ...this.searchForm,
  212. imGroupId: this.$route.query.imGroupId,
  213. });
  214. // this.tableList = res.data;
  215. this.tableList = res.data.rows;
  216. this.rules.total = res.data.total;
  217. let idList = this.chioseIdList.map((group) => {
  218. return group.id;
  219. });
  220. this.isNewPage = true;
  221. this.$nextTick(() => {
  222. this.tableList.forEach((course) => {
  223. if (idList.indexOf(course.id) != -1) {
  224. this.$refs.multipleSelection.toggleRowSelection(course, true);
  225. }
  226. });
  227. this.isNewPage = false;
  228. });
  229. } catch (e) {
  230. console.log(e);
  231. }
  232. },
  233. search() {
  234. this.rules.page = 1;
  235. this.getList();
  236. },
  237. handleSelectionChange(val) {
  238. if (val.length > 0) {
  239. this.chioseIdList = this.chioseIdList.concat(val);
  240. this.chioseIdList = this.$helpers.lodash.uniqBy(
  241. this.chioseIdList,
  242. "id"
  243. );
  244. } else {
  245. if (this.isNewPage) return;
  246. let idList = this.chioseIdList.map((group) => {
  247. return group.id;
  248. });
  249. this.$nextTick(() => {
  250. let tableIdList = [];
  251. this.tableList.forEach((group) => {
  252. tableIdList.push(group.id);
  253. if (idList.indexOf(group.id) != -1) {
  254. this.$refs.multipleSelection.toggleRowSelection(group, false);
  255. }
  256. });
  257. this.chioseIdList = this.$helpers.lodash.remove(
  258. this.chioseIdList,
  259. function (item) {
  260. return tableIdList.indexOf(item.id) == -1;
  261. }
  262. );
  263. if (this.chioseIdList.length <= 0) {
  264. this.clearCom();
  265. }
  266. });
  267. }
  268. },
  269. clearCom() {
  270. this.chioseIdList = [];
  271. this.$refs.multipleSelection.clearSelection();
  272. },
  273. onTableSelect(rows, row) {
  274. let idList = this.chioseIdList.map((group) => {
  275. return group.id;
  276. });
  277. if (idList.indexOf(row.id) != -1) {
  278. this.chioseIdList.splice(idList.indexOf(row.id), 1);
  279. if (this.chioseIdList.length <= 0) {
  280. this.clearCom();
  281. }
  282. }
  283. },
  284. onReSet() {
  285. this.rules = {
  286. ...this.rules,
  287. page: 1,
  288. };
  289. this.$refs.searchForm.resetFields();
  290. this.search();
  291. },
  292. onCancel() {
  293. this.$store.dispatch("delVisitedViews", this.$route);
  294. this.$router.push({
  295. path: "/childrensDay",
  296. });
  297. },
  298. deleteStudent(row) {},
  299. reseDetail(type){
  300. this.$refs.eidtCatInfo.openResetDioag(this.detail,type);
  301. },
  302. addMembers(){
  303. this.$refs.addMember.openDioag()
  304. }
  305. },
  306. };
  307. </script>
  308. <style lang='scss' scoped>
  309. .bWrap {
  310. display: flex;
  311. flex-direction: row;
  312. margin-bottom: 20px;
  313. }
  314. .statistic {
  315. .statistic-content > span {
  316. font-size: 20px !important;
  317. &:first-child {
  318. font-size: 24px !important;
  319. color: rgba(0, 0, 0, 0.85);
  320. font-weight: bold;
  321. }
  322. }
  323. }
  324. .desc {
  325. margin-bottom: 20px;
  326. }
  327. .flexBox {
  328. display: flex;
  329. flex-direction: row;
  330. align-items: center;
  331. justify-content: space-between;
  332. i {
  333. font-size: 18px;
  334. cursor: pointer;
  335. }
  336. }
  337. </style>