channelUserManage.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  1. <template>
  2. <div class="record-warp">
  3. <div class="record-main">
  4. <el-row >
  5. <el-col :span="24">
  6. <div class="search-head">
  7. <el-input v-model="name" clearable placeholder="请输入姓名"></el-input
  8. >&nbsp;&nbsp;&nbsp;&nbsp;
  9. <el-input
  10. v-model="studentNumber"
  11. clearable
  12. placeholder="请输入学号"
  13. ></el-input
  14. >&nbsp;&nbsp;&nbsp;&nbsp;
  15. <el-cascader
  16. v-show="userInfo.roleType=='5'"
  17. placeholder="请选择组织架构"
  18. v-model="group"
  19. :options="groupData"
  20. :props="{ checkStrictly: true }"
  21. clearable
  22. ></el-cascader>
  23. <!-- :props="{ checkStrictly: true }" -->
  24. <el-cascader
  25. v-show="userInfo.roleType=='4'"
  26. placeholder="请选择组织架构"
  27. v-model="group"
  28. :options="groupData"
  29. clearable
  30. ></el-cascader>
  31. <!-- <el-select v-model="channel" placeholder="请选择所属组织架构">
  32. <el-option
  33. :label="item.name"
  34. :value="item.id"
  35. v-for="item in channelList"
  36. :key="item.id"
  37. ></el-option>
  38. </el-select> -->
  39. &nbsp;&nbsp;&nbsp;&nbsp;
  40. <!-- <span style="font-size: 16px;">性别:</span>&nbsp;&nbsp; -->
  41. <div style="display: flex; flex-direction: row; align-items: center">
  42. <span
  43. style="
  44. font-size: 16px;
  45. margin-right: 10px;
  46. line-height: 20px;
  47. min-width: 40px;
  48. "
  49. >性别:</span
  50. >
  51. <el-radio v-model="sex" label="1">男</el-radio>
  52. <el-radio v-model="sex" label="0">女</el-radio>
  53. </div>
  54. &nbsp;&nbsp;&nbsp;&nbsp;
  55. <el-button type="primary" round icon="el-icon-search" @click="searchTarget"
  56. >搜索</el-button
  57. >
  58. <el-button type="info" round @click="clearSearch">清空</el-button>
  59. </div>
  60. </el-col>
  61. </el-row>
  62. <div class="table-content">
  63. <el-table
  64. height="100%"
  65. :data="tableData"
  66. :row-style="{ height: '0px' }"
  67. :cell-style="{ padding: '5px' }"
  68. :header-cell-style="{ background: '#F8F8F8', color: '#606266' }"
  69. >
  70. <!-- <el-table-column prop="name" label="姓名" align="center" width="" show-overflow-tooltip>
  71. </el-table-column> -->
  72. <el-table-column
  73. show-overflow-tooltip
  74. prop="userName"
  75. label="姓名"
  76. align="center"
  77. width=""
  78. >
  79. </el-table-column>
  80. <el-table-column prop="userNo" label="学号" align="center" width="">
  81. </el-table-column>
  82. <!-- <el-table-column prop="totalScore" label="总分" align="center" width="">
  83. </el-table-column> -->
  84. <el-table-column
  85. prop="gender"
  86. label="性别"
  87. align="center"
  88. width=""
  89. :formatter="genderFun"
  90. >
  91. </el-table-column>
  92. <el-table-column prop="orgName" label="所属专业" align="center" width="">
  93. </el-table-column>
  94. <el-table-column label="操作" width="auto" align="center">
  95. <template slot-scope="scope">
  96. <div class="detail_button_out">
  97. <div class="detail_button" @click="selectPlan(scope.row)">
  98. <img src="../../../assets/img/table/search.png" />
  99. <span> 选择计划 </span>
  100. </div>
  101. </div>
  102. <!-- <el-popconfirm
  103. v-if="scope.row.state != 0"
  104. title="确定删除吗?"
  105. placement="top"
  106. @confirm="deleteUser(scope.$index, scope.row)"
  107. >
  108. <el-button
  109. size="small"
  110. style="margin-left: 10px"
  111. type="text"
  112. slot="reference"
  113. >删除</el-button
  114. >
  115. </el-popconfirm>
  116. <el-popconfirm
  117. v-if="scope.row.state != 0"
  118. title="密码将重置为123456"
  119. placement="top"
  120. @confirm="resetUser(scope.$index, scope.row)"
  121. >
  122. <el-button
  123. size="small"
  124. style="margin-left: 10px"
  125. type="text"
  126. slot="reference"
  127. >重置密码</el-button
  128. >
  129. </el-popconfirm> -->
  130. </template>
  131. </el-table-column>
  132. </el-table>
  133. </div>
  134. <!-- small -->
  135. <el-pagination
  136. class="pag_class"
  137. background
  138. @size-change="handleSizeChange"
  139. @current-change="handleCurrentChange"
  140. :current-page.sync="pageNum"
  141. layout="total, sizes, prev, pager, next"
  142. :page-size="pageSize"
  143. :page-sizes="[10, 20, 50, 100]"
  144. :total="total"
  145. >
  146. </el-pagination>
  147. <!-- <el-pagination small background layout="total prev, pager, next" :total="36">
  148. </el-pagination> -->
  149. </div>
  150. <Report ref="register" @search="searchTarget" />
  151. </div>
  152. </template>
  153. <script>
  154. import { oSessionStorage } from "../../../utils/utils";
  155. import report from "../../../components/Report.vue";
  156. import { basePath } from "../../../utils/http";
  157. export default {
  158. name: "userManage",
  159. components: {
  160. Report: report,
  161. },
  162. data() {
  163. return {
  164. basePath: basePath,
  165. //上传文件的弹出款的标志
  166. fileVisible: false,
  167. //判断点击的是重置密码还是点击删除
  168. isDelete: false,
  169. //重置密码需要调用个userId
  170. userId: "",
  171. //充值密码使用userName
  172. userName: "",
  173. //重置密码弹出框
  174. resetVisible: false,
  175. //根据名称搜索
  176. name: "",
  177. //搜索的用户编号
  178. studentNumber: "",
  179. //搜索的组织架构
  180. // 搜索需要的性别
  181. sex: "",
  182. group: "",
  183. ppData: [],
  184. groupData: [],
  185. options: [
  186. {
  187. value: "1",
  188. label: "选项1",
  189. children: [
  190. {
  191. value: "11",
  192. label: "选项11",
  193. children: [{ value: "111", label: "选项111" }],
  194. },
  195. ],
  196. },
  197. ],
  198. centerDialogVisible: false,
  199. editUserFlag: false,
  200. startTime: "",
  201. endTime: "",
  202. value1: null,
  203. total: 0,
  204. pageSize: 10,
  205. pageNum: 1,
  206. keyword: "",
  207. tableData: [],
  208. userInfo: {}, //用户信息
  209. invitationCode: "",
  210. roleType: "0",
  211. type: 0,
  212. view: {
  213. name: "",
  214. studentNumber: "",
  215. sex: "",
  216. orgName: "",
  217. },
  218. channel: "",
  219. channelList: [{ name: "渠道天成", id: "1" }],
  220. };
  221. },
  222. created() {},
  223. mounted() {
  224. this.userInfo = JSON.parse(oSessionStorage.getItem("userInfo"));
  225. this.getChannel();
  226. if (!this.userInfo) {
  227. //如果用户信息不存在跳转登陆页
  228. this.$router.push({ path: "/" });
  229. }
  230. this.searchTarget();
  231. },
  232. methods: {
  233. //文件上传成功
  234. fileSuccess(res) {
  235. if (res.code == 200) {
  236. this.searchTarget();
  237. this.$message({
  238. message: res.msg,
  239. type: "success",
  240. });
  241. } else {
  242. this.$message({
  243. message: res.msg,
  244. type: "error",
  245. });
  246. }
  247. //查询列表
  248. },
  249. //文件上传失败
  250. fileError() {
  251. this.$message({
  252. message: "上传失败",
  253. type: "error",
  254. });
  255. },
  256. cancle() {
  257. this.resetVisible = false;
  258. },
  259. //提交文本
  260. //性别---
  261. genderFun(val) {
  262. let sex = val.gender;
  263. if (sex == "1") {
  264. return "男";
  265. } else if (sex == "0") {
  266. return "女";
  267. } else {
  268. return sex;
  269. }
  270. },
  271. //每页多少条
  272. handleSizeChange(val) {
  273. this.pageSize=val;
  274. this.searchTarget();
  275. // console.log(`每页 ${val} 条`);
  276. //将首页重置为1时---且总条数变化
  277. //设置为当前总条数
  278. },
  279. //获取组织架构方法--------------------开始-----------------------
  280. getChannel() {
  281. this.$http.get(`/org/findAllOrgByPOrgNo?orgNo=${this.userInfo.orgNo}`, {}, (res) => {
  282. // this.$toast.success({message:'成功'});
  283. if (res && res.code == 200) {
  284. //将值赋值给list
  285. if (res.data.length > 0) {
  286. let resAdd = this.addPro(res.data);
  287. this.ppData = JSON.parse(JSON.stringify(resAdd));
  288. let forRes = this.arrToTree(resAdd);
  289. // console.log('格式化的结构')
  290. // console.log(forRes)
  291. let resultRes = this.deleteChildren(forRes);
  292. console.log("格式化的结构且去掉children");
  293. console.log(resultRes);
  294. this.groupData = resultRes[0].children;
  295. } else {
  296. this.groupData = [];
  297. }
  298. // this.channelList = res.data;
  299. } else {
  300. this.$message.error(res.msg);
  301. }
  302. });
  303. },
  304. //z增加
  305. addPro(val) {
  306. let data = JSON.parse(JSON.stringify(val));
  307. for (let i = 0; i < val.length; i++) {
  308. data[i].value = val[i].orgNo;
  309. data[i].label = val[i].orgName;
  310. }
  311. return data;
  312. },
  313. //非递归方式:将平铺数据转换为树形结构数据
  314. arrToTree(arr) {
  315. let data = arr.filter((item) => {
  316. item.children = arr.filter((e) => {
  317. return item.orgNo === e.parentOrgNo;
  318. });
  319. return this.userInfo.orgNo == item.orgNo;
  320. //return !item.parentOrgNo;
  321. });
  322. return data;
  323. },
  324. //去除转换树形结构数据后存在的空children
  325. deleteChildren(arr) {
  326. let childs = arr;
  327. for (let i = childs.length; i--; i > 0) {
  328. if (childs[i].children) {
  329. if (childs[i].children.length) {
  330. this.deleteChildren(childs[i].children);
  331. } else {
  332. delete childs[i].children;
  333. }
  334. }
  335. }
  336. return arr;
  337. },
  338. //获取组织架构方法--------------------结束-----------------------
  339. formatterDelete(row) {
  340. if (row.state == 0) {
  341. return "已删除";
  342. } else {
  343. return "正常";
  344. }
  345. },
  346. resetUser(flag, val) {
  347. this.resetVisible = true;
  348. this.isDelete = flag;
  349. this.userId = val.id;
  350. this.userName = val.userName;
  351. //当前用户id
  352. //重置密码
  353. },
  354. viewUser(row) {
  355. this.view.name = row.userName;
  356. this.view.studentNumber = row.userNo;
  357. this.view.sex = row.gender == "0" ? "女" : "男";
  358. this.view.orgName = row.orgName;
  359. this.centerDialogVisible = true;
  360. },
  361. selectPlan(val) {
  362. this.addRegisterUser(val);
  363. },
  364. clearSearch() {
  365. this.name = "";
  366. //搜索的用户编号
  367. this.studentNumber = "";
  368. //搜索的组织架构
  369. // 搜索需要的性别
  370. this.sex = "";
  371. this.group = "";
  372. this.searchTarget();
  373. },
  374. addRegisterUser(val) {
  375. this.$refs.register.open(val);
  376. },
  377. editRegisterUser(val) {
  378. this.$refs.register.edit(val);
  379. },
  380. handleCurrentChange(val) {
  381. this.pageNum = val;
  382. this.searchList();
  383. },
  384. //根据现有情况进行搜索
  385. searchList() {
  386. console.log(this.userInfo)
  387. let url = `/user/findUserListByPage?pageSize=${this.pageSize}&pageNum=${
  388. this.pageNum
  389. }&roleType=1${this.sex == "" ? "" : `&gender=${this.sex}`}${
  390. this.group.length == 0 ? `&orgNo=${this.userInfo.orgNo}` : `&orgNo=${this.group[this.group.length - 1]}`
  391. }${this.name == "" ? "" : `&userName=${this.name}`}${
  392. this.studentNumber == "" ? "" : `&userNo=${this.studentNumber}`
  393. }`;
  394. this.$http.get(url, {}, (res) => {
  395. console.log(res);
  396. if (res && res.code == 200) {
  397. this.tableData = res.data.content;
  398. this.total = res.data.totalElements;
  399. } else {
  400. // this.$toast.fail(res.msg);
  401. this.$message.error(res.msg);
  402. }
  403. });
  404. },
  405. searchTarget() {
  406. this.pageNum = 1;
  407. this.searchList();
  408. },
  409. //跳转首页
  410. goHome() {
  411. this.$router.push({ path: "/home" });
  412. },
  413. //跳转记录页
  414. goRecord() {
  415. this.$router.push({ path: "/record" });
  416. },
  417. //退出登陆
  418. logout() {
  419. oSessionStorage.removeItem("userInfo");
  420. oSessionStorage.removeItem("token");
  421. this.$router.push({ path: "/" });
  422. },
  423. //点击获取月出勤次数
  424. getTimes(param) {
  425. this.monthTimes = param;
  426. },
  427. },
  428. };
  429. </script>
  430. <style lang="less" scoped>
  431. @import "../../../styles/theme.less";
  432. .pag_class {
  433. text-align: end;
  434. }
  435. .pag_class /deep/.el-input__inner {
  436. width: 100% !important;
  437. }
  438. .pag_class /deep/.el-pagination--small span:not([class*="suffix"]) {
  439. height: 22px;
  440. line-height: 28px !important;
  441. }
  442. .record-warp {
  443. width: 100%;
  444. height: 80vh;
  445. position: relative;
  446. .record-main {
  447. width: 100%;
  448. height: 100%;
  449. box-sizing: border-box;
  450. overflow-y: auto;
  451. display: flex;
  452. flex-direction: column;
  453. .search-head {
  454. width: 100%;
  455. display: flex;
  456. flex-direction: row;
  457. justify-content: flex-start;
  458. align-items: center;
  459. .zc-title {
  460. color: #606266;
  461. font-size: 14px;
  462. }
  463. }
  464. .table-content {
  465. display: flex;
  466. flex: 1;
  467. margin: 10px 0;
  468. overflow: auto;
  469. }
  470. }
  471. }
  472. .add_user_class {
  473. margin-top: 10px;
  474. }
  475. .user_out {
  476. display: flex;
  477. width: 100%;
  478. align-items: center;
  479. border: 1px solid #eeeeef;
  480. line-height: 50px;
  481. margin-top: 10px;
  482. }
  483. .user_out_sub {
  484. flex: 1;
  485. background-color: #fafafa;
  486. text-align: center;
  487. // color:#ffffff
  488. }
  489. .user_out_subNext {
  490. padding-left: 10px;
  491. flex: 3;
  492. }
  493. .detail_button_out {
  494. display: flex;
  495. justify-content: space-around;
  496. .detail_button {
  497. display: flex;
  498. align-items: center;
  499. cursor: pointer;
  500. letter-spacing: 2px;
  501. img {
  502. width: 15px;
  503. margin-right: 5px;
  504. }
  505. span {
  506. color: #00bf78;
  507. // font-weight: 600;
  508. }
  509. }
  510. }
  511. //弹出框样式
  512. .dig_update /deep/.el-cascader {
  513. position: relative;
  514. font-size: 14px;
  515. line-height: 40px;
  516. width: 100%;
  517. }
  518. .dig_update /deep/.el-dialog {
  519. box-shadow: none !important;
  520. background: transparent !important;
  521. }
  522. .demo-ruleForm /deep/ .el-form-item {
  523. margin-right: 10px;
  524. vertical-align: top;
  525. display: flex !important;
  526. flex-direction: column;
  527. }
  528. .demo-ruleForm /deep/.el-dialog__header {
  529. background-color: #ffffff;
  530. padding-left: 140px !important;
  531. }
  532. .demo-ruleForm /deep/.el-form-item__label {
  533. text-align: left;
  534. vertical-align: middle;
  535. float: left;
  536. font-size: 14px;
  537. color: #606266;
  538. line-height: 40px;
  539. padding: 0 12px 0 0;
  540. -webkit-box-sizing: border-box;
  541. box-sizing: border-box;
  542. }
  543. .demo-ruleForm /deep/.el-input {
  544. width: 100% !important;
  545. }
  546. .demo-ruleForm /deep/.el-input__inner {
  547. width: 100% !important;
  548. background-color: #f7f7f7;
  549. border: 0px;
  550. }
  551. .dig_button {
  552. margin-top: 40px;
  553. display: flex;
  554. width: 100%;
  555. justify-content: space-around;
  556. }
  557. .demo-ruleForm {
  558. background-color: #ffffff;
  559. // border-radius: 20px;
  560. margin-right: -10px;
  561. margin-top: -10px;
  562. padding-right: 100px;
  563. padding-left: 100px;
  564. border-radius: 20px;
  565. padding-top: 20px;
  566. padding-bottom: 20px;
  567. .dig_title {
  568. margin-bottom: 30px;
  569. text-align: center;
  570. font-weight: 700;
  571. }
  572. }
  573. </style>