invite.vue 18 KB

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