Header copy.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. <template>
  2. <div>
  3. <div class="top-nav flex-vertical-between">
  4. <div class="title flex-center">
  5. <!-- <img src="../assets/logo-white.png" alt="" /> -->
  6. 中医智能辅助诊疗系统
  7. </div>
  8. <el-menu
  9. :default-active="active"
  10. class="el-menu-demo"
  11. mode="horizontal"
  12. @select="handleSelect"
  13. background-color="#5386F6"
  14. text-color="#fff"
  15. active-text-color="#fff"
  16. active-background-color="#fff"
  17. >
  18. <el-menu-item v-for="(item,index) in navlist" :key="index" :index="item.index">{{item.name}}</el-menu-item>
  19. </el-menu>
  20. <div class="admin">
  21. <span class="name">{{getuserinfo.username}}</span>
  22. <img src="../assets/down-header.png" alt class="icon" />
  23. <div class="hover-show">
  24. <!-- <div class="flex-center">
  25. <span>{{getuserinfo.username}}</span>
  26. </div>-->
  27. <div class="flex-center" @click="$router.push({path:'/index/help'})">
  28. <span>修改密码</span>
  29. </div>
  30. <div class="flex-center" @click="$router.push({path:'/index/help'})">
  31. <span>帮助</span>
  32. </div>
  33. <div class="flex-center" @click="logOut">
  34. <span>退出登录</span>
  35. </div>
  36. </div>
  37. </div>
  38. </div>
  39. <div class="header-bottom flex-center">
  40. <!-- <div class="left-nav-tip">主页/{{activeName}}</div> -->
  41. <div class="left-nav-tip">{{navlist[active].name}}/{{$route.meta.title}}</div>
  42. <!-- <div class="left-nav-tip">navlist[active].name/{{navlist[active].child}}</div> -->
  43. <div class="tab-bar flex-center">
  44. <div
  45. v-for="(item,index) in navlist[active].child"
  46. :key="index"
  47. :class="item.id==activeID?'is-active':''"
  48. @click="choose(item.id,item.path,item.name)"
  49. >{{item.name}}</div>
  50. </div>
  51. <!-- 用户信息 -->
  52. <div class="user-info flex-column flex-center" v-if="getPatiensInfo!=null || getPatiensInfo ">
  53. <div @click="patientIn" class="flex-vertical-center-r">
  54. <img src="../assets/h-avatar.png" alt />
  55. <div>
  56. <span style="margin-right:27px;">
  57. {{getPatiensInfo.patientidSelsourceName}}&nbsp;&nbsp;
  58. {{getPatiensInfo.sex}}&nbsp;&nbsp;
  59. {{getPatiensInfo.basisPatient.age}}岁&nbsp;&nbsp;
  60. {{getPatiensInfo.pregnancy==2?'妊娠期':''}}&nbsp;&nbsp;
  61. {{getPatiensInfo.breastfeeding==1?'哺乳期':''}}
  62. </span>
  63. <div style="font-size:14px;">{{getPatiensInfo.code}}</div>
  64. </div>
  65. </div>
  66. <!-- <div class="flex-vertical-center-r">
  67. <img src="../assets/h-guahao.png" alt="">
  68. <span>{{getPatiensInfo.code}}</span>
  69. </div>-->
  70. <!-- 就诊记录列表 -->
  71. <div class="seeRecord" v-if="patiensMsg">
  72. <div class="seeRecord-header">就诊记录</div>
  73. <div class="list">
  74. <div
  75. class="seeRecord-item"
  76. @click="handleRecord(item)"
  77. v-for="(item,index) in list"
  78. :key="index"
  79. >
  80. {{item.timeStr}}
  81. <span
  82. v-if="item.illnessName"
  83. >{{item.illnessName}}-{{item.symptomType}}</span>
  84. </div>
  85. </div>
  86. <div class="block flex flex-col-center flex-row-center">
  87. <el-pagination layout="prev, pager, next" :total="total" @current-change="pageChange"></el-pagination>
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. <pageProup
  93. @cancle="closeCase"
  94. :showDialog="showCase"
  95. :showBtns="false"
  96. title
  97. width="70%"
  98. distanceTop="5vh"
  99. >
  100. <div slot="body">
  101. <outpatientRecord :info="caseItem"></outpatientRecord>
  102. </div>
  103. </pageProup>
  104. </div>
  105. </template>
  106. <script>
  107. import { mapState, mapGetters, mapActions, mapMutations } from "vuex";
  108. import { menus } from "@/utils/menu.js";
  109. import { getMenuPermiss } from "@/api/system.js";
  110. import { getPatiensBasisM, getRecordDetail } from "@/api/diagnosis";
  111. import { getPatiensVisitList } from "@/api/patients.js";
  112. import pageProup from "@/components/Propup";
  113. import outpatientRecord from "@/components/ui/outpatientRecords";
  114. export default {
  115. components: {
  116. pageProup,
  117. outpatientRecord
  118. },
  119. data() {
  120. return {
  121. activeName: "",
  122. active: "0",
  123. // 修改一级目录名称时 要同步修改 router 里面的 值
  124. navlist: menus,
  125. activeID: "1-1", // 默认值 从缓存取
  126. patiensMsg: null, // 病人信息
  127. showCase: false,
  128. caseItem: null,
  129. page: 1,
  130. list: [],
  131. total: 0
  132. };
  133. },
  134. created() {
  135. this.activeID = this.getActiveID;
  136. this.active = this.getActive;
  137. this.getMenuPermiss();
  138. },
  139. methods: {
  140. // 分页改变
  141. pageChange(e) {
  142. this.page = e;
  143. this._getPatiensVisitList();
  144. },
  145. // 鼠标进入
  146. patientIn() {
  147. this._getPatiensBasisM();
  148. },
  149. // 就诊记录点击
  150. handleRecord(item) {
  151. // this.showCase = true
  152. this._getRecordDetail(item.id);
  153. },
  154. // 关闭就诊 详情
  155. closeCase() {
  156. this.showCase = false;
  157. },
  158. handleSelect(key, keyPath) {
  159. // console.log(key, keyPath);
  160. this.active = key;
  161. this.setActive(key);
  162. this.activeID = this.navlist[key].child[0].id;
  163. this.setActiveID(this.navlist[key].child[0].id);
  164. this.activeName = this.navlist[key].child[0].name;
  165. if (this.navlist[key].child[0].path == this.$route.path) return;
  166. this.$router.push({
  167. path: this.navlist[key].child[0].path
  168. });
  169. },
  170. // 二级分类选中
  171. choose(id, path, name) {
  172. this.activeID = id;
  173. this.activeName = name;
  174. this.setActiveID(id);
  175. if (path == this.$route.path) return;
  176. this.$router.push({
  177. path: path
  178. });
  179. },
  180. // 退出登录
  181. logOut() {
  182. this.setActive("0");
  183. this.setActiveID("1-1");
  184. this.setPatiensInfo({});
  185. this.setUserinfo({});
  186. localStorage.clear();
  187. sessionStorage.clear();
  188. this.$router.replace({
  189. path: "/"
  190. });
  191. },
  192. async getMenuPermiss() {
  193. let res = await getMenuPermiss();
  194. if (res.ResultCode == 0) {
  195. let arr = [];
  196. if (res.Data.length == 0) return;
  197. this.navlist = res.Data;
  198. return;
  199. res.Data.forEach((item, index) => {
  200. let obj = {
  201. index: String(index),
  202. name: item.title,
  203. child: []
  204. };
  205. item.list.forEach((item1, index1) => {
  206. let obj1 = {
  207. id: item1.id,
  208. name: item1.title,
  209. path: item1.jump
  210. };
  211. obj.child.push(obj1);
  212. });
  213. arr.push(obj);
  214. });
  215. this.navlist = arr;
  216. }
  217. },
  218. // 获取患者己本信息
  219. async _getPatiensBasisM() {
  220. let res = await getPatiensBasisM({
  221. patientId: this.getPatiensInfo.pid
  222. });
  223. if (res.ResultCode == 0) {
  224. // res.Data.recordLength = res.Data.patientRecord.length;
  225. this.patiensMsg = res.Data;
  226. this._getPatiensVisitList(this.getPatiensInfo.basisPatient.pid);
  227. }
  228. },
  229. // 获取就诊详情
  230. async _getRecordDetail(id) {
  231. let res = await getRecordDetail({
  232. id: id
  233. // id: 'e68d293d-f1b7-4f6d-bed4-42b1aba6973e'
  234. });
  235. if (res.ResultCode == 0) {
  236. this.caseItem = res.Data;
  237. this.showCase = true;
  238. } else {
  239. this.$message.error(res.ResultInfo);
  240. }
  241. },
  242. // 获取就诊记录
  243. async _getPatiensVisitList(id) {
  244. let res = await getPatiensVisitList({
  245. patientId: id,
  246. page: this.page,
  247. limit: 11
  248. });
  249. if (res.ResultCode == 0) {
  250. this.list = res.Data.Items;
  251. this.total = res.Data.TotalRecordCount;
  252. }
  253. },
  254. ...mapMutations({
  255. setActiveID: "nav/setActiveID",
  256. setActive: "nav/setActive",
  257. setPatiensInfo: "user/setPatiensInfo",
  258. setUserinfo: "user/setUserinfo"
  259. })
  260. },
  261. watch: {
  262. $route: {
  263. handler: function(to, from) {
  264. this.navlist.forEach((item, index) => {
  265. // if (to.meta.pftitle == item.name) {
  266. item.child.forEach(item1 => {
  267. if (to.path.indexOf(item1.path) != -1) {
  268. this.activeID = item1.id;
  269. this.activeName = item1.name;
  270. this.active = String(index);
  271. this.setActive(this.active);
  272. this.setActiveID(this.activeID);
  273. }
  274. });
  275. // }
  276. if (to.path == "/") {
  277. this.logOut();
  278. }
  279. // return
  280. // if (to.path == '/index/physical' && this.getPatiensInfo.patientidSelsourceName &&
  281. // from
  282. // .name != 'physicald') {
  283. // this.$router.push({
  284. // path: '/index/physicald?pid=' + this.getPatiensInfo.basisPatient.pid
  285. // })
  286. // }
  287. });
  288. },
  289. immediate: true,
  290. deep: true
  291. },
  292. getPatiensInfo: {
  293. deep: true,
  294. immediate: true,
  295. handler: function() {
  296. this._getPatiensBasisM();
  297. }
  298. }
  299. },
  300. computed: {
  301. ...mapGetters(["getuserinfo", "getPatiensInfo", "getActiveID", "getActive"])
  302. }
  303. };
  304. </script>
  305. <style lang="scss" scoped>
  306. @import "../style/common.scss";
  307. .top-nav {
  308. background: #5386f6;
  309. padding: 0 24px 0 0;
  310. // padding: 0px;
  311. // height: 60px;
  312. height: 50px;
  313. // position: relative;
  314. box-sizing: border-box;
  315. .title {
  316. background: #5386f6;
  317. // height: 60px;
  318. height: 50px;
  319. padding: 0 32px;
  320. font-size: 20px;
  321. font-family: PingFang SC;
  322. font-weight: bold;
  323. color: #ffffff;
  324. cursor: pointer;
  325. // position: absolute;
  326. // left: 0;
  327. // top: 0;
  328. // bottom: 0;
  329. img {
  330. width: 40px;
  331. margin-right: 20px;
  332. }
  333. }
  334. .admin {
  335. width: 292px;
  336. // background: red;
  337. font-size: 14px;
  338. height: 32px;
  339. font-family: PingFang SC;
  340. font-weight: 400;
  341. color: #ffffff;
  342. cursor: pointer;
  343. text-align: right;
  344. // position: absolute;
  345. line-height: 32px;
  346. // right: 0px;
  347. // top: 18px;
  348. // bottom: 0;
  349. .name {
  350. margin-right: 10px;
  351. }
  352. .icon {
  353. width: 12px;
  354. }
  355. .hover-show {
  356. display: none;
  357. position: absolute;
  358. top: 27px;
  359. right: 0px;
  360. z-index: 999;
  361. width: 120px;
  362. // height: 300px;
  363. box-sizing: border-box;
  364. background: #ffffff;
  365. padding: 10px 0;
  366. border-radius: 8px;
  367. box-shadow: 2px 2px 15px rgba($color: #000000, $alpha: 0.2);
  368. div {
  369. // padding: 0px 20px 0;
  370. height: 40px;
  371. // line-height: 50px;
  372. }
  373. span {
  374. color: #000;
  375. }
  376. }
  377. }
  378. .admin:hover {
  379. .hover-show {
  380. display: block;
  381. }
  382. }
  383. .hover-show:hover {
  384. display: block;
  385. }
  386. }
  387. .header-bottom {
  388. background: #fff;
  389. // height: 50px;
  390. height: 40px;
  391. position: relative;
  392. .left-nav-tip {
  393. font-size: 14px;
  394. font-family: PingFang SC;
  395. font-weight: 400;
  396. color: #333333;
  397. position: absolute;
  398. left: 5px;
  399. }
  400. .user-info {
  401. position: absolute;
  402. right: 15px;
  403. cursor: pointer;
  404. img {
  405. width: 25px;
  406. margin-right: 8px;
  407. }
  408. span {
  409. font-size: 14px;
  410. font-family: PingFang SC;
  411. font-weight: 400;
  412. color: #333333;
  413. }
  414. }
  415. .user-info:hover .seeRecord {
  416. display: block;
  417. }
  418. .tab-bar {
  419. div {
  420. font-size: 16px;
  421. font-family: PingFang SC;
  422. font-weight: 400;
  423. color: #666666;
  424. margin-right: 25px;
  425. cursor: pointer;
  426. }
  427. .is-active {
  428. color: #5386f6;
  429. }
  430. }
  431. }
  432. .seeRecord {
  433. display: none;
  434. width: 350px;
  435. height: 400px;
  436. position: absolute;
  437. top: 35px;
  438. right: -18px;
  439. background: #fff;
  440. z-index: 9999;
  441. border: 1px solid #ebeef5;
  442. // overflow-y: auto;
  443. overflow: hidden;
  444. .list {
  445. height: 320px;
  446. overflow-y: auto;
  447. // background: red;
  448. }
  449. &-header {
  450. height: 40px;
  451. background: #5386f6;
  452. line-height: 40px;
  453. font-size: 18px;
  454. color: #fff;
  455. text-align: center;
  456. }
  457. &-item {
  458. overflow: hidden;
  459. text-overflow: ellipsis;
  460. white-space: nowrap;
  461. color: #000;
  462. font-size: 16px;
  463. margin-top: 10px;
  464. cursor: pointer;
  465. padding: 0 10px;
  466. }
  467. }
  468. .el-menu--horizontal > .el-menu-item {
  469. border-bottom: 0 !important;
  470. }
  471. .el-menu--horizontal > .el-menu-item.is-active {
  472. background: #2bab9b !important;
  473. }
  474. .el-menu-demo > ul > li {
  475. font-size: 16px !important;
  476. }
  477. .top-nav ::v-deep .el-menu-item {
  478. font-size: 16px;
  479. // font-weight: bold;
  480. }
  481. .top-nav ::v-deep .el-menu-item {
  482. padding: 0 5px;
  483. }
  484. </style>