selectUser.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <template>
  2. <!-- 授权用户 -->
  3. <el-dialog
  4. title="选择用户"
  5. :visible.sync="visible"
  6. width="800px"
  7. top="5vh"
  8. append-to-body
  9. custom-class="el-dialog3"
  10. >
  11. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
  12. <el-form-item label="用户名称" prop="userName">
  13. <el-input
  14. v-model="queryParams.userName"
  15. placeholder="请输入用户名称"
  16. clearable
  17. @keyup.enter.native="handleQuery"
  18. />
  19. </el-form-item>
  20. <el-form-item label="手机号码" prop="phonenumber">
  21. <el-input
  22. v-model="queryParams.phonenumber"
  23. placeholder="请输入手机号码"
  24. clearable
  25. @keyup.enter.native="handleQuery"
  26. />
  27. </el-form-item>
  28. <el-form-item>
  29. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  30. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  31. </el-form-item>
  32. </el-form>
  33. <el-row>
  34. <el-table @row-click="clickRow" ref="table" :data="userList" @selection-change="handleSelectionChange" height="260px">
  35. <el-table-column type="selection" width="55"></el-table-column>
  36. <el-table-column label="用户名称" prop="userName" :show-overflow-tooltip="true" />
  37. <el-table-column label="用户昵称" prop="nickName" :show-overflow-tooltip="true" />
  38. <el-table-column label="邮箱" prop="email" :show-overflow-tooltip="true" />
  39. <el-table-column label="手机" prop="phonenumber" :show-overflow-tooltip="true" />
  40. <el-table-column label="状态" align="center" prop="status">
  41. <template slot-scope="scope">
  42. <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
  43. </template>
  44. </el-table-column>
  45. <el-table-column label="创建时间" align="center" prop="createTime" width="180">
  46. <template slot-scope="scope">
  47. <span>{{ parseTime(scope.row.createTime) }}</span>
  48. </template>
  49. </el-table-column>
  50. </el-table>
  51. <pagination
  52. v-show="total>0"
  53. :total="total"
  54. :page.sync="queryParams.pageNum"
  55. :limit.sync="queryParams.pageSize"
  56. @pagination="getList"
  57. />
  58. </el-row>
  59. <div slot="footer" class="dialog-footer">
  60. <el-button type="primary" @click="handleSelectUser">确 定</el-button>
  61. <el-button @click="visible = false">取 消</el-button>
  62. </div>
  63. </el-dialog>
  64. </template>
  65. <script>
  66. import { unallocatedUserList, groupUserSelectAll } from "@/api/doc/groupUser";
  67. export default {
  68. dicts: ["sys_normal_disable"],
  69. props: {
  70. // 角色编号
  71. groupId: {
  72. type: [String],
  73. },
  74. },
  75. data() {
  76. return {
  77. // 遮罩层
  78. visible: false,
  79. // 选中数组值
  80. userIds: [],
  81. // 总条数
  82. total: 0,
  83. // 未授权用户数据
  84. userList: [],
  85. // 查询参数
  86. queryParams: {
  87. pageNum: 1,
  88. pageSize: 10,
  89. groupId: undefined,
  90. // userName: undefined,
  91. // phonenumber: undefined
  92. },
  93. };
  94. },
  95. methods: {
  96. // 显示弹框
  97. show() {
  98. this.queryParams.groupId = parseInt(this.groupId);
  99. this.getList();
  100. this.visible = true;
  101. },
  102. clickRow(row) {
  103. this.$refs.table.toggleRowSelection(row);
  104. },
  105. // 多选框选中数据
  106. handleSelectionChange(selection) {
  107. this.userIds = selection.map((item) => item.userId);
  108. },
  109. // 查询表数据
  110. getList() {
  111. unallocatedUserList(this.queryParams).then((res) => {
  112. this.userList = res.rows;
  113. this.total = res.total;
  114. });
  115. },
  116. /** 搜索按钮操作 */
  117. handleQuery() {
  118. this.queryParams.pageNum = 1;
  119. this.getList();
  120. },
  121. /** 重置按钮操作 */
  122. resetQuery() {
  123. this.resetForm("queryForm");
  124. this.handleQuery();
  125. },
  126. /** 选择授权用户操作 */
  127. handleSelectUser() {
  128. const groupId = this.queryParams.groupId;
  129. const userIds = this.userIds.join(",");
  130. if (userIds == "") {
  131. this.$modal.msgError("请选择要分配的用户");
  132. return;
  133. }
  134. groupUserSelectAll({ groupId: groupId, userIds: userIds }).then((res) => {
  135. this.$modal.msgSuccess(res.msg);
  136. if (res.code === 200) {
  137. this.visible = false;
  138. this.$emit("ok");
  139. }
  140. });
  141. },
  142. },
  143. };
  144. </script>
  145. <style scoped lang="scss">
  146. //弹窗样式
  147. ::v-deep .el-dialog3 {
  148. width: calc(100vw * (1050 / 1920)) !important;
  149. height: calc(100vh * (900 / 1080)) !important;
  150. background: url(../../../assets/img/Group-585.png);
  151. background-size: calc(100vw * (1050 / 1920)) calc(100vh * (900 / 1080));
  152. //标题
  153. .el-dialog__title{
  154. color: #ffffff;
  155. }
  156. .dialog-footer {
  157. position: absolute;
  158. right: 8%;
  159. bottom: 5%;
  160. }
  161. }
  162. ::v-deep .el-dialog .el-input {
  163. width: calc(100vw * (240 / 1920)) !important;
  164. }
  165. //表格
  166. ::v-deep .el-table {
  167. height: calc(100vh * (510 / 1080)) !important;
  168. width: calc(100vw * (855 / 1920)) !important;
  169. margin-left: calc(100vw * (20 / 1920)) !important;
  170. background: transparent;
  171. overflow: auto;
  172. //滚动条样式
  173. ::-webkit-scrollbar {
  174. width: 3.5px;
  175. }
  176. ::-webkit-scrollbar-track {
  177. background-color: rgba(0, 0, 0, 0);
  178. }
  179. ::-webkit-scrollbar-thumb {
  180. background: #2e8aec;
  181. border-radius: 3px;
  182. }
  183. ::-webkit-scrollbar-thumb:hover {
  184. background: #2e8aec;
  185. }
  186. }
  187. //搜索重置按钮颜色
  188. ::v-deep .el-button--primary,.el-button--mini{
  189. background-color: #002a5cff;
  190. }
  191. //关闭按钮
  192. ::v-deep .el-dialog__headerbtn{
  193. font-size: 25px;
  194. right: 3%;
  195. }
  196. //顶部和表格的距离
  197. ::v-deep .el-dialog .el-form-item{
  198. margin-top: calc(100vh * (30 / 1080)) !important;
  199. }
  200. //底部跳转
  201. ::v-deep .pagination-container .el-pagination{
  202. right: 10px;
  203. }
  204. </style>