userListOne.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  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. console.log("this.deptOptions",this.deptOptions)
  155. });
  156. },
  157. //确定按钮
  158. okButton(){
  159. if(!this.ids[0]){
  160. this.msgError("请勾选人员")
  161. return
  162. }
  163. this.$parent.takeUserData(this.ids);
  164. },
  165. show(data){
  166. this.queryParams = {
  167. pageNum:1,
  168. pageSize:20,
  169. searchValue:null,
  170. nature:null,
  171. deptId:null,
  172. };
  173. this.getList();
  174. let self = this;
  175. this.userOpen = !this.userOpen;
  176. if(data){
  177. this.queryParams.pageNum = 1;
  178. setTimeout(function(){
  179. for(let i=0;i<data.length;i++){
  180. self.$refs.multipleTable.toggleRowSelection(data[i],true)
  181. }
  182. self.getList();
  183. },100);
  184. }
  185. },
  186. //获取学院
  187. listDepartments(){
  188. listDepartments().then(response => {
  189. this.deptList = response.data;
  190. });
  191. },
  192. //获取身份
  193. optionselect(){
  194. optionselect().then(response => {
  195. this.typeList = response.data;
  196. });
  197. },
  198. //获取数据列表
  199. getList(){
  200. this.loading = true;
  201. listUser(this.queryParams).then(response => {
  202. this.userList = response.rows;
  203. this.total = response.total;
  204. this.loading = false;
  205. });
  206. },
  207. /** 搜索按钮操作 */
  208. handleQuery() {
  209. this.queryParams.pageNum = 1;
  210. this.getList();
  211. },
  212. /** 重置按钮操作 */
  213. resetQuery() {
  214. this.resetForm("queryForm");
  215. this.handleQuery();
  216. },
  217. /*===记录勾选数据===
  218. 需要再el-table 添加 :row-key="getRowKeys"
  219. 需要在selection 添加 :reserve-selection="true"
  220. */
  221. getRowKeys(row) {
  222. return row.userId
  223. },
  224. //选择本页
  225. selectPage(){
  226. console.log(this.$refs.multipleTable)
  227. this.$refs.multipleTable.toggleAllSelection()
  228. // console.log(this.$refs.multipleTable.selection)
  229. },
  230. //清除选择
  231. clearSelection(){
  232. this.$refs.multipleTable.clearSelection()
  233. },
  234. // 多选框选中数据
  235. handleSelectionChange(selection) {
  236. let self = this;
  237. this.currentRow = selection
  238. this.userList.forEach(item => {
  239. if (selection[selection.length - 1] === item) {
  240. this.$refs.multipleTable.toggleRowSelection(item, true)
  241. let list = [item];
  242. self.selectedNum = list.length;
  243. self.ids = list.map(item => item.userId);
  244. self.idData = list.map(item => item);
  245. self.single = list.length!==1
  246. self.multiple = !list.length
  247. } else {
  248. this.$refs.multipleTable.toggleRowSelection(item, false)
  249. }
  250. })
  251. // console.log("newData",newData)
  252. // setTimeout(function(){
  253. // self.selectedNum = newData.length;
  254. // self.ids = newData.map(item => item.userId);
  255. // self.idData = newData.map(item => item);
  256. // self.single = newData.length!==1
  257. // self.multiple = !newData.length
  258. // },1000);
  259. },
  260. //查询安全分级
  261. getListClassifiedAll(){
  262. listClassifiedAll().then(response=>{
  263. if(response.code==200){
  264. console.log(response)
  265. this.levelList=response.data
  266. }
  267. })
  268. },
  269. //查询安全分类
  270. getListClasstypeAll(){
  271. listClasstypeAll().then(response=>{
  272. if(response.code==200){
  273. this.typeList=response.data;
  274. }
  275. });
  276. },
  277. }
  278. }
  279. </script>
  280. <style lang="scss" scoped>
  281. .userList{
  282. height:700px;
  283. display: flex!important;
  284. flex-direction: column;
  285. }
  286. </style>