invite.vue 20 KB

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