userList.vue 8.5 KB

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