userList.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  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="position" label-width="50px">
  18. <el-select style="width:200px;" v-model="queryParams.position" placeholder="请选择身份" clearable>
  19. <el-option v-for="dict in typeList" :key="dict.postId" :label="dict.postName" :value="dict.postId"></el-option>
  20. </el-select>
  21. </el-form-item>
  22. <!--<el-form-item label="工号/学号" prop="userName" label-width="80px">-->
  23. <!--<el-input-->
  24. <!--style="width:160px;"-->
  25. <!--maxlength="20"-->
  26. <!--v-model="queryParams.userName"-->
  27. <!--placeholder="请输入工号/学号"-->
  28. <!--clearable-->
  29. <!--size="small"-->
  30. <!--/>-->
  31. <!--</el-form-item>-->
  32. <!--<el-form-item label="联系方式" prop="phonenumber" label-width="80px">-->
  33. <!--<el-input-->
  34. <!--style="width:160px;"-->
  35. <!--maxlength="11"-->
  36. <!--v-model="queryParams.phonenumber"-->
  37. <!--placeholder="请输入联系方式"-->
  38. <!--clearable-->
  39. <!--size="small"-->
  40. <!--/>-->
  41. <!--</el-form-item>-->
  42. <el-form-item label="学院" prop="deptId" label-width="50px">
  43. <el-select style="width:200px;" v-model="queryParams.deptId" placeholder="请选择学院" clearable>
  44. <el-option
  45. v-for="dict in deptList"
  46. :key="dict.deptId"
  47. :label="dict.deptName"
  48. :value="dict.deptId"
  49. ></el-option>
  50. </el-select>
  51. </el-form-item>
  52. <el-form-item>
  53. <p class="inquire-button-one" @click="handleQuery">查询</p>
  54. <p class="reset-button-one" @click="resetQuery">重置</p>
  55. </el-form-item>
  56. </el-form>
  57. <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;">
  58. <i class="el-icon-warning" style="color:#0045AF;margin:10px 16px 0 14px;height:20px;width:20px;font-size:20px;display: block;"></i>
  59. <p class="color_99" style="margin:0;width:132px;font-size:14px;height:40px;line-height:40px;">已选择 {{selectedNum}} 项</p>
  60. <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>
  61. <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>
  62. </div>
  63. <el-table v-loading="loading" border :data="userList" @selection-change="handleSelectionChange" ref="multipleTable" :row-key="getRowKeys">
  64. <el-table-column type="selection" width="55" :reserve-selection="true" align="center" />
  65. <el-table-column label="姓名" align="left" prop="nickName" />
  66. <el-table-column label="身份" align="left" prop="positionName" />
  67. <el-table-column label="工号/学号" align="left" prop="userName" />
  68. <el-table-column label="联系方式" align="left" prop="phonenumber" />
  69. <el-table-column label="学院" align="left" prop="dept.deptName" />
  70. </el-table>
  71. <pagination :page-sizes="[20, 30, 40, 50]"
  72. v-show="total>0"
  73. :total="total"
  74. :page.sync="queryParams.pageNum"
  75. :limit.sync="queryParams.pageSize"
  76. @pagination="getList"
  77. />
  78. <div style="margin-top:30px;padding-top:20px;display: flex;border-top:1px solid #dedede">
  79. <p style="flex:1;"></p>
  80. <p style="margin-right:20px;" class="reset-button-one" @click="show(2)">取消</p>
  81. <p class="inquire-button-one" @click="okButton">确定</p>
  82. </div>
  83. </div>
  84. </el-dialog>
  85. </div>
  86. </template>
  87. <script>
  88. import {
  89. filterDept,optionselect,
  90. listUser,listClassifiedAll,
  91. listClasstypeAll
  92. } from "@/api/hierarchicalControl/indexDemo";
  93. export default {
  94. name: "userList",
  95. data() {
  96. return {
  97. userOpen:false,
  98. loading:false,
  99. // 显示搜索条件
  100. showSearch: true,
  101. // 总条数
  102. total: 0,
  103. queryParams:{
  104. pageNum:1,
  105. pageSize:20,
  106. searchValue:"",
  107. position:"",
  108. deptId:"",
  109. },
  110. userList:[],
  111. //已选中数量
  112. selectedNum:0,
  113. //已选中
  114. ids:[],
  115. idData:[],
  116. // 非单个禁用
  117. single: true,
  118. // 非多个禁用
  119. multiple: true,
  120. //分类数据
  121. typeList:[],
  122. //分级数据
  123. levelList:[],
  124. addUserList:[],
  125. }
  126. },
  127. created(){
  128. },
  129. mounted(){
  130. // this.getListClasstypeAll();
  131. this.getListClassifiedAll();
  132. this.filterDept();
  133. this.optionselect();
  134. },
  135. methods:{
  136. //确定按钮
  137. okButton(){
  138. if(!this.ids[0]){
  139. this.msgError("请勾选人员")
  140. return
  141. }
  142. this.$parent.takeUserData(this.ids,this.idData);
  143. },
  144. show(data){
  145. let self = this;
  146. this.resetQuery();
  147. // this.getListClasstypeAll();
  148. this.getListClassifiedAll();
  149. this.filterDept();
  150. this.optionselect();
  151. this.userOpen = !this.userOpen;
  152. if(data){
  153. this.addUserList = data;
  154. // this.queryParams.pageNum = 1;
  155. // setTimeout(function(){
  156. // for(let i=0;i<data.length;i++){
  157. // self.$refs.multipleTable.toggleRowSelection(data[i],true)
  158. // }
  159. // self.getList();
  160. // },300);
  161. }
  162. self.getList();
  163. // if(type == 1){
  164. // this.userOpen = true;
  165. // }else if(type == 2){
  166. // this.userOpen = false;
  167. // }
  168. },
  169. //获取学院
  170. filterDept(){
  171. filterDept().then(response => {
  172. this.deptList = response.data;
  173. });
  174. },
  175. //获取身份
  176. optionselect(){
  177. optionselect().then(response => {
  178. this.typeList = response.data;
  179. });
  180. },
  181. //获取数据列表
  182. getList(){
  183. this.loading = true;
  184. let obj = JSON.parse(JSON.stringify(this.queryParams));
  185. obj.ids = this.addUserList+'';
  186. obj.include = true;
  187. listUser(obj).then(response => {
  188. this.userList = response.rows;
  189. this.total = response.total;
  190. this.loading = false;
  191. });
  192. },
  193. /** 搜索按钮操作 */
  194. handleQuery() {
  195. this.queryParams.pageNum = 1;
  196. this.getList();
  197. },
  198. /** 重置按钮操作 */
  199. resetQuery() {
  200. // this.resetForm("queryForm");
  201. this.queryParams.searchValue = "";
  202. this.queryParams.position = "";
  203. this.queryParams.deptId = "";
  204. this.handleQuery();
  205. },
  206. /*===记录勾选数据===
  207. 需要再el-table 添加 :row-key="getRowKeys"
  208. 需要在selection 添加 :reserve-selection="true"
  209. */
  210. getRowKeys(row) {
  211. return row.userId
  212. },
  213. //选择本页
  214. selectPage(){
  215. this.$refs.multipleTable.toggleAllSelection()
  216. },
  217. //清除选择
  218. clearSelection(){
  219. this.$refs.multipleTable.clearSelection()
  220. },
  221. // 多选框选中数据
  222. handleSelectionChange(selection) {
  223. this.selectedNum = selection.length;
  224. this.ids = selection.map(item => item.userId);
  225. this.idData = selection.map(item => item);
  226. this.single = selection.length!==1
  227. this.multiple = !selection.length
  228. },
  229. //查询安全分级
  230. getListClassifiedAll(){
  231. listClassifiedAll().then(response=>{
  232. if(response.code==200){
  233. this.levelList=response.data
  234. }
  235. })
  236. },
  237. //查询安全分类
  238. getListClasstypeAll(){
  239. listClasstypeAll().then(response=>{
  240. if(response.code==200){
  241. this.typeList=response.data;
  242. }
  243. });
  244. },
  245. }
  246. }
  247. </script>
  248. <style lang="scss" scoped>
  249. .userList{
  250. height:700px;
  251. display: flex!important;
  252. flex-direction: column;
  253. }
  254. </style>