userList.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <!--分级管控/人员列表-->
  2. <template>
  3. <div class="userList" v-if="userOpen">
  4. <el-dialog title="选择用户" :visible.sync="userOpen" width="1500px" append-to-body :close-on-click-modal="false">
  5. <div class="gradeManage-userList" style="height:626px;display: flex;flex-direction: column">
  6. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch">
  7. <el-form-item label="关键字" prop="searchValue" label-width="80px">
  8. <el-input
  9. style="width:200px;"
  10. maxlength="10"
  11. v-model="queryParams.searchValue"
  12. placeholder="请输入名称/联系方式"
  13. clearable
  14. size="small"
  15. />
  16. </el-form-item>
  17. <el-form-item label="学院" prop="deptId" label-width="50px">
  18. <el-select style="width:200px;" v-model="queryParams.deptId" placeholder="请选择学院" clearable>
  19. <el-option
  20. v-for="dict in deptList"
  21. :key="dict.deptId"
  22. :label="dict.deptName"
  23. :value="dict.deptId"
  24. ></el-option>
  25. </el-select>
  26. </el-form-item>
  27. <el-form-item>
  28. <p class="page-reset-common-style-button" style="margin-right:10px;" @click="handleQuery">查询</p>
  29. <p class="page-inquire-common-style-button" @click="resetQuery">重置</p>
  30. </el-form-item>
  31. </el-form>
  32. <div class="sheet-expand-box" style="height:40px;display:flex;background:rgba(1,131,250,0.1);border-radius: 5px;margin-bottom:18px;font-size:14px;">
  33. <i class="el-icon-warning" style="color:#0045AF;margin:10px 16px 0 14px;height:20px;width:20px;font-size:20px;display: block;"></i>
  34. <p class="color_99" style="margin:0;width:132px;font-size:14px;height:40px;line-height:40px;">已选择 {{selectedNum}} 项</p>
  35. <p class="color_one cursor_hover" style="margin:0;width:60px;font-size:14px;height:40px;line-height:40px;margin-right:20px;" @click="selectPage">全选本页</p>
  36. <p class="color_warn cursor_hover" style="margin:0;width:60px;font-size:14px;height:40px;line-height:40px;margin-right:20px;" @click="clearSelection">清除选项</p>
  37. </div>
  38. <el-table class="table-box" v-loading="loading" border :data="userList" @selection-change="handleSelectionChange" ref="multipleTable" :row-key="getRowKeys">
  39. <el-table-column type="selection" width="55" :reserve-selection="true" align="center" />
  40. <el-table-column label="姓名" align="left" prop="nickName" />
  41. <el-table-column label="身份" align="left" prop="positionName" />
  42. <el-table-column label="工号/学号" align="left" prop="userName" />
  43. <el-table-column label="联系方式" align="left" prop="phonenumber" />
  44. <el-table-column label="学院" align="left" prop="dept.deptName" />
  45. </el-table>
  46. <pagination :page-sizes="[20, 30, 40, 50]"
  47. v-show="total>0"
  48. :total="total"
  49. :page.sync="queryParams.page"
  50. :limit.sync="queryParams.pageSize"
  51. @pagination="getList"
  52. />
  53. <div style="margin-top:30px;padding-top:20px;display: flex;border-top:1px solid #dedede">
  54. <p style="flex:1;"></p>
  55. <p style="margin-right:20px;" class="reset-button-one" @click="show(2)">取消</p>
  56. <p class="inquire-button-one" @click="okButton">确定</p>
  57. </div>
  58. </div>
  59. </el-dialog>
  60. </div>
  61. </template>
  62. <script>
  63. import {
  64. getDeptDropList,
  65. systemUserDropDateAuthList,
  66. } from '@/api/commonality/permission'
  67. export default {
  68. name: "userList",
  69. data() {
  70. return {
  71. userOpen:false,
  72. loading:false,
  73. // 显示搜索条件
  74. showSearch: true,
  75. // 总条数
  76. total: 0,
  77. queryParams:{
  78. page:1,
  79. pageSize:20,
  80. searchValue:"",
  81. deptId:null,
  82. },
  83. userList:[],
  84. //已选中数量
  85. selectedNum:0,
  86. //已选中
  87. ids:[],
  88. idData:[],
  89. // 非单个禁用
  90. single: true,
  91. // 非多个禁用
  92. multiple: true,
  93. //分类数据
  94. typeList:[],
  95. //分级数据
  96. levelList:[],
  97. addUserList:[],
  98. deptList:[],
  99. }
  100. },
  101. created(){
  102. },
  103. mounted(){
  104. this.getDeptDropList();
  105. },
  106. methods:{
  107. //确定按钮
  108. okButton(){
  109. if(!this.ids[0]){
  110. this.msgError("请勾选人员")
  111. return
  112. }
  113. this.$parent.takeUserData(this.ids,this.idData);
  114. },
  115. show(data){
  116. let self = this;
  117. this.resetQuery();
  118. this.getDeptDropList();
  119. this.userOpen = !this.userOpen;
  120. if(data){
  121. this.addUserList = data;
  122. }
  123. self.getList();
  124. },
  125. //获取学院
  126. getDeptDropList(){
  127. getDeptDropList({level: 2, deptType: 1 }).then(response => {
  128. this.$set(this,'deptList',response.data);
  129. });
  130. },
  131. //获取数据列表
  132. getList(){
  133. this.$set(this,'loading',true);
  134. let obj = JSON.parse(JSON.stringify(this.queryParams));
  135. obj.ids = this.addUserList[0]?this.addUserList+'':null;
  136. obj.include = true;
  137. systemUserDropDateAuthList(obj).then(response => {
  138. this.$set(this,'dataList',response.data.records);
  139. this.$set(this,'total',response.data.total);
  140. this.$set(this,'loading',false);
  141. });
  142. },
  143. /** 搜索按钮操作 */
  144. handleQuery() {
  145. this.queryParams.page = 1;
  146. this.getList();
  147. },
  148. /** 重置按钮操作 */
  149. resetQuery() {
  150. // this.resetForm("queryForm");
  151. this.queryParams.searchValue = "";
  152. this.queryParams.deptId = null;
  153. this.handleQuery();
  154. },
  155. /*===记录勾选数据===
  156. 需要再el-table 添加 :row-key="getRowKeys"
  157. 需要在selection 添加 :reserve-selection="true"
  158. */
  159. getRowKeys(row) {
  160. return row.userId
  161. },
  162. //选择本页
  163. selectPage(){
  164. this.$refs.multipleTable.toggleAllSelection()
  165. },
  166. //清除选择
  167. clearSelection(){
  168. this.$refs.multipleTable.clearSelection()
  169. },
  170. // 多选框选中数据
  171. handleSelectionChange(selection) {
  172. this.selectedNum = selection.length;
  173. this.ids = selection.map(item => item.userId);
  174. this.idData = selection.map(item => item);
  175. this.single = selection.length!==1
  176. this.multiple = !selection.length
  177. },
  178. }
  179. }
  180. </script>
  181. <style lang="scss" scoped>
  182. .userList{
  183. height:700px;
  184. display: flex!important;
  185. flex-direction: column;
  186. }
  187. </style>