contract.vue 18 KB

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