userListOne.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <!--分级管控/人员列表-->
  2. <template>
  3. <div class="userList" v-if="userOpen">
  4. <el-dialog title="选择账号" :visible.sync="userOpen" width="1500px" append-to-body>
  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:160px;"
  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="nature" label-width="80px">
  18. <el-select
  19. v-model="queryParams.nature"
  20. placeholder="请选择"
  21. clearable
  22. style="width:160px;"
  23. >
  24. <el-option
  25. key="0"
  26. label="在职"
  27. value="0"/>
  28. <el-option
  29. key="1"
  30. label="离职"
  31. value="1"/>
  32. </el-select>
  33. </el-form-item>
  34. <el-form-item label="学院" prop="deptName" label-width="80px">
  35. <el-cascader
  36. :show-all-levels="false"
  37. v-model="queryParams.deptId"
  38. :options="deptOptions"
  39. :props="{ checkStrictly: true, value: 'id', label: 'label',emitPath:false }"></el-cascader>
  40. </el-form-item>
  41. <el-form-item>
  42. <p class="inquire-button-one" @click="handleQuery">查询</p>
  43. <p class="reset-button-one" @click="resetQuery">重置</p>
  44. </el-form-item>
  45. </el-form>
  46. <el-table v-loading="loading" border :data="userList" @selection-change="handleSelectionChange" ref="multipleTable" :row-key="getRowKeys">
  47. <el-table-column type="selection" width="55" :reserve-selection="true" align="center" />
  48. <el-table-column label="序号" width="50" align="center" type="index"/>
  49. <el-table-column label="姓名" align="left" prop="nickName" />
  50. <el-table-column label="工号" align="left" prop="userName" />
  51. <el-table-column label="手机号码" align="left" prop="phonenumber" />
  52. <el-table-column label="所在部门" align="left" prop="deptName" />
  53. <el-table-column label="检查身份" align="left" prop="isCheck" >
  54. <template slot-scope="scope">
  55. {{scope.row.isCheck == 0?'否':'是'}}
  56. </template>
  57. </el-table-column>
  58. <el-table-column label="账号状态" align="left" prop="dept.deptName">
  59. <template slot-scope="scope">
  60. <span :class="scope.row.status == 0?'color_14AE10':'color_FF4E00'">{{scope.row.status == 0?"已启用":"已停用"}}</span>
  61. </template>
  62. </el-table-column>
  63. </el-table>
  64. <div style="display: flex;width:1460px;margin-top:7px;">
  65. <p style="flex:4;"></p>
  66. <!--<p style="text-align: right;margin:0;line-height:32px;margin-right:20px;color:#999;">-->
  67. <!--<i class="el-icon-warning" style="color:#0183FA;"></i>-->
  68. <!--已选择 {{selectedNum}} 项-->
  69. <!--</p>-->
  70. <div style="flex:5;">
  71. <pagination :page-sizes="[20, 30, 40, 50]"
  72. v-show="total>0"
  73. :total="total"
  74. style="margin:0;"
  75. :page.sync="queryParams.pageNum"
  76. :limit.sync="queryParams.pageSize"
  77. @pagination="getList"
  78. />
  79. </div>
  80. </div>
  81. <div style="margin-top:7px;padding-top:20px;display: flex;border-top:1px solid #dedede">
  82. <p style="flex:1;"></p>
  83. <p style="margin-right:20px;" class="reset-button-one" @click="show(2)">取消</p>
  84. <p class="inquire-button-one" @click="okButton">确定</p>
  85. <p style="flex:1;"></p>
  86. </div>
  87. </div>
  88. </el-dialog>
  89. </div>
  90. </template>
  91. <script>
  92. import { listDepartments } from "@/api/system/dept";
  93. import { optionselect } from "@/api/laboratory/gradeManage";
  94. import { listUser } from "@/api/system/user_teacher";
  95. import { listClassifiedAll } from "@/api/laboratory/classified";
  96. import { listClasstypeAll } from "@/api/laboratory/classtype";
  97. import { treeselect } from "@/api/system/dept";
  98. export default {
  99. name: "userList",
  100. props:{
  101. },
  102. data() {
  103. return {
  104. userOpen:false,
  105. loading:false,
  106. // 显示搜索条件
  107. showSearch: true,
  108. // 总条数
  109. total: 0,
  110. queryParams:{
  111. pageNum:1,
  112. pageSize:20,
  113. nickName:null,
  114. position:null,
  115. userName:null,
  116. phonenumber:null,
  117. deptName:null,
  118. },
  119. userList:[],
  120. //已选中数量
  121. selectedNum:0,
  122. //已选中
  123. ids:[],
  124. idData:[],
  125. // 非单个禁用
  126. single: true,
  127. // 非多个禁用
  128. multiple: true,
  129. //分类数据
  130. typeList:[],
  131. //分级数据
  132. levelList:[],
  133. // 部门树选项
  134. deptOptions: [],
  135. }
  136. },
  137. created(){
  138. },
  139. mounted(){
  140. this.getDicts("work_class").then(response => {
  141. this.workClass = response.data;
  142. });
  143. // this.getListClasstypeAll();
  144. this.getListClassifiedAll();
  145. this.listDepartments();
  146. this.optionselect();
  147. this.getList();
  148. this.getTreeselect();
  149. },
  150. methods:{
  151. getTreeselect() {
  152. treeselect().then(response => {
  153. this.deptOptions = response.data;
  154. });
  155. },
  156. //确定按钮
  157. okButton(){
  158. if(!this.ids[0]){
  159. this.msgError("请勾选人员")
  160. return
  161. }
  162. this.$parent.takeUserData(this.ids);
  163. },
  164. show(data){
  165. this.queryParams = {
  166. pageNum:1,
  167. pageSize:20,
  168. searchValue:null,
  169. nature:null,
  170. deptId:null,
  171. };
  172. this.getList();
  173. let self = this;
  174. this.userOpen = !this.userOpen;
  175. if(data){
  176. this.queryParams.pageNum = 1;
  177. setTimeout(function(){
  178. for(let i=0;i<data.length;i++){
  179. self.$refs.multipleTable.toggleRowSelection(data[i],true)
  180. }
  181. self.getList();
  182. },100);
  183. }
  184. },
  185. //获取学院
  186. listDepartments(){
  187. listDepartments().then(response => {
  188. this.deptList = response.data;
  189. });
  190. },
  191. //获取身份
  192. optionselect(){
  193. optionselect().then(response => {
  194. this.typeList = response.data;
  195. });
  196. },
  197. //获取数据列表
  198. getList(){
  199. this.loading = true;
  200. listUser(this.queryParams).then(response => {
  201. this.userList = response.rows;
  202. this.total = response.total;
  203. this.loading = false;
  204. });
  205. },
  206. /** 搜索按钮操作 */
  207. handleQuery() {
  208. this.queryParams.pageNum = 1;
  209. this.getList();
  210. },
  211. /** 重置按钮操作 */
  212. resetQuery() {
  213. this.resetForm("queryForm");
  214. this.handleQuery();
  215. },
  216. /*===记录勾选数据===
  217. 需要再el-table 添加 :row-key="getRowKeys"
  218. 需要在selection 添加 :reserve-selection="true"
  219. */
  220. getRowKeys(row) {
  221. return row.userId
  222. },
  223. //选择本页
  224. selectPage(){
  225. this.$refs.multipleTable.toggleAllSelection()
  226. },
  227. //清除选择
  228. clearSelection(){
  229. this.$refs.multipleTable.clearSelection()
  230. },
  231. // 多选框选中数据
  232. handleSelectionChange(selection) {
  233. let self = this;
  234. this.currentRow = selection
  235. this.userList.forEach(item => {
  236. if (selection[selection.length - 1] === item) {
  237. this.$refs.multipleTable.toggleRowSelection(item, true)
  238. let list = [item];
  239. self.selectedNum = list.length;
  240. self.ids = list.map(item => item.userId);
  241. self.idData = list.map(item => item);
  242. self.single = list.length!==1
  243. self.multiple = !list.length
  244. } else {
  245. this.$refs.multipleTable.toggleRowSelection(item, false)
  246. }
  247. })
  248. // setTimeout(function(){
  249. // self.selectedNum = newData.length;
  250. // self.ids = newData.map(item => item.userId);
  251. // self.idData = newData.map(item => item);
  252. // self.single = newData.length!==1
  253. // self.multiple = !newData.length
  254. // },1000);
  255. },
  256. //查询安全分级
  257. getListClassifiedAll(){
  258. listClassifiedAll().then(response=>{
  259. if(response.code==200){
  260. this.levelList=response.data
  261. }
  262. })
  263. },
  264. //查询安全分类
  265. getListClasstypeAll(){
  266. listClasstypeAll().then(response=>{
  267. if(response.code==200){
  268. this.typeList=response.data;
  269. }
  270. });
  271. },
  272. }
  273. }
  274. </script>
  275. <style lang="scss" scoped>
  276. .userList{
  277. height:700px;
  278. display: flex!important;
  279. flex-direction: column;
  280. }
  281. </style>