darkRoom.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px" @submit.native.prevent>
  4. <el-form-item label="关键词" prop="keyword">
  5. <el-input
  6. style="width:220px"
  7. v-model="queryParams.keyword"
  8. placeholder="请输入微信名称/手机号"
  9. clearable
  10. size="small"
  11. @keyup.enter.native="handleQuery"
  12. />
  13. </el-form-item>
  14. <el-form-item>
  15. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  16. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  17. </el-form-item>
  18. </el-form>
  19. <el-row :gutter="10" class="mb8">
  20. <el-button
  21. size="mini"
  22. type="primary"
  23. style="margin-left: 5px"
  24. :disabled="ids.length === 0"
  25. @click="handleUpdateBatch"
  26. v-hasPermi="['users:user:enabledUsers']"
  27. >批量启用</el-button>
  28. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  29. </el-row>
  30. <el-table height="500" border v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
  31. <el-table-column type="selection" width="55" align="center" />
  32. <el-table-column label="用户id" align="center" prop="userId" />
  33. <el-table-column label="项目" align="center" prop="projectName" />
  34. <el-table-column label="用户昵称" align="center" prop="nickname" />
  35. <el-table-column label="用户头像" align="center" prop="avatar">
  36. <template slot-scope="scope">
  37. <el-popover trigger="hover" placement="top">
  38. <el-image :src="scope.row.avatar" style="width: 200px;height: 200px"/>
  39. <div slot="reference" class="name-wrapper">
  40. <el-avatar shape="square" size="large" :src="scope.row.avatar"/>
  41. </div>
  42. </el-popover>
  43. </template>
  44. </el-table-column>
  45. <el-table-column label="注册时间" align="center" prop="createTime" width="160px"/>
  46. <!-- <el-table-column label="看课数量" align="center" prop="watchCourseCount" />-->
  47. <!-- <el-table-column label="缺课数量" align="center" prop="missCourseCount" />-->
  48. <!-- <el-table-column label="缺课状态" align="center" prop="missCourseStatus">-->
  49. <!-- <template slot-scope="scope">-->
  50. <!-- <el-tag effect="dark" type="danger" v-if="scope.row.missCourseStatus === 1">已缺课</el-tag>-->
  51. <!-- <el-tag effect="dark" type="success" v-else>未缺课</el-tag>-->
  52. <!-- </template>-->
  53. <!-- </el-table-column>-->
  54. <!-- <el-table-column label="参与营期数量" align="center" prop="partCourseCount" width="100px"/>-->
  55. <el-table-column label="最后一次看课时间" align="center" prop="lastWatchDate" width="160px"/>
  56. <!-- <el-table-column label="用户状态" align="center" prop="courseCountStatus">-->
  57. <!-- <template slot-scope="scope">-->
  58. <!-- <el-tag effect="dark" type="success" v-if="scope.row.courseCountStatus === 1">正常</el-tag>-->
  59. <!-- <el-tag effect="dark" type="info" v-else-if="scope.row.courseCountStatus === 2">停止</el-tag>-->
  60. <!-- <el-tag effect="dark" type="danger" v-else>未看</el-tag>-->
  61. <!-- </template>-->
  62. <!-- </el-table-column>-->
  63. <!-- <el-table-column label="停课天数" align="center" prop="stopWatchDays" />-->
  64. <!-- <el-table-column label="完播时间" align="center" prop="completeWatchDate" width="160px"/>-->
  65. <el-table-column label="标签名称" align="center" prop="tag" />
  66. <el-table-column label="所属销售名称" align="center" prop="companyUserNickName" width="120px"/>
  67. <el-table-column label="备注" align="center" prop="remark" />
  68. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  69. <template slot-scope="scope">
  70. <el-button
  71. size="mini"
  72. type="text"
  73. @click="handleUpdate(scope.row)"
  74. v-hasPermi="['users:user:darkRoomList']"
  75. >启用</el-button>
  76. </template>
  77. </el-table-column>
  78. </el-table>
  79. <pagination
  80. v-show="total>0"
  81. :total="total"
  82. :page.sync="queryParams.pageNum"
  83. :limit.sync="queryParams.pageSize"
  84. @pagination="getList"
  85. />
  86. </div>
  87. </template>
  88. <script>
  89. import { darkRoomList,enabledUsers } from "@/api/store/user";
  90. export default {
  91. name: "darkRoom",
  92. data() {
  93. return {
  94. // 遮罩层
  95. loading: true,
  96. // 选中数组
  97. ids: [],
  98. // 非单个禁用
  99. single: true,
  100. // 非多个禁用
  101. multiple: true,
  102. // 显示搜索条件
  103. showSearch: true,
  104. // 总条数
  105. total: 0,
  106. // 用户列表数据
  107. userList: [],
  108. // 查询参数
  109. queryParams: {
  110. pageNum: 1,
  111. pageSize: 10,
  112. keyword: null,
  113. status: 2
  114. },
  115. selectUser: []
  116. };
  117. },
  118. created() {
  119. this.getList();
  120. },
  121. methods: {
  122. /** 查询客户列表 */
  123. getList() {
  124. this.loading = true;
  125. darkRoomList(this.queryParams).then(response => {
  126. this.userList = response.rows;
  127. this.total = response.total;
  128. this.loading = false;
  129. });
  130. },
  131. /** 搜索按钮操作 */
  132. handleQuery() {
  133. this.queryParams.pageNum = 1;
  134. this.getList();
  135. },
  136. /** 重置按钮操作 */
  137. resetQuery() {
  138. this.resetForm("queryForm");
  139. this.handleQuery();
  140. },
  141. // 多选框选中数据
  142. handleSelectionChange(selection) {
  143. this.ids = selection.map(item => item.userId)
  144. this.selectedUser = selection.map(item => {return {userId: item.userId, projectId: item.projectId}})
  145. this.single = selection.length!==1
  146. this.multiple = !selection.length
  147. },
  148. // 启用
  149. handleUpdate(row) {
  150. enabledUsers([{userId: row.userId, projectId: row.projectId}]).then(response => {
  151. if (response.code === 200) {
  152. this.msgSuccess("取消禁用成功");
  153. this.getList();
  154. } else {
  155. this.msgError(response.msg);
  156. }
  157. });
  158. },
  159. // 启用
  160. handleUpdateBatch() {
  161. enabledUsers(this.selectedUser).then(response => {
  162. if (response.code === 200) {
  163. this.msgSuccess("取消禁用成功");
  164. this.getList();
  165. } else {
  166. this.msgError(response.msg);
  167. }
  168. });
  169. }
  170. }
  171. };
  172. </script>
  173. <style scoped>
  174. .app-container {
  175. height: 87.5vh;
  176. }
  177. </style>