Header.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726
  1. <template>
  2. <div>
  3. <div class="top-nav flex-vertical-between">
  4. <div class="title flex-center" v-if="innerWidth>768">
  5. <img v-if="logo" :src="logo" alt />
  6. {{title}}
  7. </div>
  8. <div class="title flex-center" v-else>
  9. <img v-if="logo" :src="logo" alt />
  10. {{titleSplit[0]}}<br />{{titleSplit[1]}}
  11. </div>
  12. <div v-if="ai_url">
  13. <AIModal :url="ai_url">
  14. <template #default="{ handle }">
  15. <svg @click="handle()" class="ai" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32">
  16. <path d="M501.824 32C303.552 32 141.504 176.992 141.504 357.76c0 23.712 2.816 47.104 8.32 69.856l-51.008 114.208a32 32 0 0 0 24.704 44.736c54.272 7.744 76.672 31.168 76.672 77.312v111.552a64 64 0 0 0 64 64h20.704a64 64 0 0 1 64 64V960a32 32 0 0 0 32 32h345.6a32 32 0 0 0 0-64h-313.6v-24.608a128 128 0 0 0-128-128h-20.736v-111.552c0-65.664-32.192-110.688-91.2-131.136l39.872-89.28a31.968 31.968 0 0 0 1.568-21.792 233.088 233.088 0 0 1-8.896-63.904c0-143.712 131.936-261.76 296.32-261.76s296.32 118.016 296.32 261.76a32 32 0 0 0 64 0C862.144 176.992 700.064 32 501.824 32zM904 448a32 32 0 0 0-32 32v360a32 32 0 0 0 64 0V480a32 32 0 0 0-32-32z" fill="#ffffff"></path>
  17. <path d="M673.888 466.656c-11.744-25.568-48.416-24.64-58.816 1.536l-132.8 333.76a32 32 0 0 0 59.488 23.68l32.608-81.92c0.576 0.032 1.088 0.32 1.664 0.32h154.848l38.176 83.104a31.968 31.968 0 1 0 58.144-26.72l-153.312-333.76zM599.68 680l47.264-118.72 54.528 118.72H599.68z" fill="#ffffff"></path>
  18. </svg>
  19. </template>
  20. </AIModal>
  21. </div>
  22. <!-- <el-menu :default-active="active" class="el-menu-demo" mode="horizontal" @select="handleSelect"
  23. background-color="#5386F6" text-color="#fff" active-text-color="#fff" active-background-color="#fff">
  24. <el-menu-item v-for="(item,index) in navlist" :key="index" :index="item.id">{{item.title}}
  25. </el-menu-item>
  26. </el-menu>-->
  27. <div class="main-menu flex flex-row-center flex-col-center" v-if="navlist.length>0">
  28. <div
  29. :class="['menu-item',active==index?'active':'']"
  30. @click="handleSelect1(index)"
  31. v-for="(item,index) in navlist"
  32. :key="index"
  33. >{{item.title}}</div>
  34. </div>
  35. <div class="admin">
  36. <span class="name">{{getuserinfo.username}}</span>
  37. <img src="../assets/down-header.png" alt class="icon" />
  38. <div class="hover-show">
  39. <!-- <div class="flex-center">
  40. <span>{{getuserinfo.username}}</span>
  41. </div>-->
  42. <div class="flex-center" @click="$router.push({path:'/index/help'})">
  43. <span>修改密码</span>
  44. </div>
  45. <div class="flex-center" @click="$router.push({path:'/index/help'})">
  46. <span>帮助</span>
  47. </div>
  48. <div class="flex-center" @click="logOut">
  49. <span>退出登录</span>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. <div class="header-bottom flex-center" v-if="navlist.length>0">
  55. <!-- <div class="left-nav-tip">主页/{{activeName}}</div> -->
  56. <div class="left-nav-tip">{{navlist[active].title}}/{{$route.meta.title}}</div>
  57. <!-- <div class="left-nav-tip">navlist[active].name/{{navlist[active].child}}</div> -->
  58. <div class="tab-bar flex-center">
  59. <div
  60. v-for="(item,index) in navlist[active].list"
  61. :key="index"
  62. :class="item.id==activeID?'is-active':''"
  63. @click="choose(item.id,item.jump,item.title)"
  64. >{{item.title}}</div>
  65. </div>
  66. <!-- 用户信息 -->
  67. <div class="user-info flex-column flex-center" v-if="getPatiensInfo!=null ">
  68. <div @click="patientIn" class="flex-vertical-center-r">
  69. <img src="../assets/h-avatar.png" alt />
  70. <div v-if=" Object.keys(getPatiensInfo).length>0">
  71. <span style="margin-right:27px;">
  72. {{getPatiensInfo.patientidSelsourceName}}&nbsp;&nbsp;
  73. {{getPatiensInfo.sex}}&nbsp;&nbsp;
  74. {{getPatiensInfo.basisPatient.age}}岁&nbsp;&nbsp;
  75. {{getPatiensInfo.pregnancy==2?'妊娠期':''}}&nbsp;&nbsp;
  76. {{getPatiensInfo.breastfeeding==1?'哺乳期':''}}
  77. </span>
  78. <div style="font-size:14px;">{{getPatiensInfo.code}}</div>
  79. </div>
  80. </div>
  81. <!-- <div class="flex-vertical-center-r">
  82. <img src="../assets/h-guahao.png" alt="">
  83. <span>{{getPatiensInfo.code}}</span>
  84. </div>-->
  85. <!-- 就诊记录列表 -->
  86. <div class="seeRecord" v-if="patiensMsg">
  87. <div class="seeRecord-header">就诊记录</div>
  88. <div class="list">
  89. <div
  90. class="seeRecord-item"
  91. @click="handleRecord(item)"
  92. v-for="(item,index) in list"
  93. :key="index"
  94. >
  95. {{item.timeStr}}
  96. <span
  97. v-if="item.illnessName"
  98. >{{item.illnessName}}-{{item.symptomType}}</span>
  99. </div>
  100. </div>
  101. <div class="block flex flex-col-center flex-row-center">
  102. <el-pagination
  103. layout="prev, pager, next"
  104. :page-size="11"
  105. :total="total"
  106. @current-change="pageChange"
  107. ></el-pagination>
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. <pageProup
  113. @cancle="closeCase"
  114. :showDialog="showCase"
  115. :showBtns="false"
  116. title
  117. width="70%"
  118. distanceTop="5vh"
  119. >
  120. <div slot="body">
  121. <outpatientRecord :info="caseItem"></outpatientRecord>
  122. </div>
  123. </pageProup>
  124. </div>
  125. </template>
  126. <script>
  127. import { mapState, mapGetters, mapActions, mapMutations } from "vuex";
  128. import { menus } from "@/utils/menu.js";
  129. import { getMenuPermiss } from "@/api/system.js";
  130. import { getPatiensBasisM, getRecordDetail } from "@/api/diagnosis";
  131. import { getPatiensVisitList } from "@/api/patients.js";
  132. import pageProup from "@/components/Propup";
  133. import outpatientRecord from "@/components/ui/outpatientRecords";
  134. import AIModal from '@/components/AIModal.vue';
  135. export default {
  136. components: {
  137. AIModal,
  138. pageProup,
  139. outpatientRecord
  140. },
  141. data() {
  142. return {
  143. title: window.SIX_config.title,
  144. logo: window.SIX_config.logo,
  145. ai_url: window.SIX_config.AI_URL,
  146. activeName: "",
  147. active: "0",
  148. // 修改一级目录名称时 要同步修改 router 里面的 值
  149. navlist: [],
  150. activeID: "1-1", // 默认值 从缓存取
  151. patiensMsg: null, // 病人信息
  152. showCase: false,
  153. caseItem: null,
  154. page: 1,
  155. list: [],
  156. total: 0,
  157. innerWidth: 1920
  158. };
  159. },
  160. created() {
  161. this.activeID = this.getActiveID;
  162. this.active = this.getActive;
  163. this.navlist = [];
  164. this.getMenuPermiss();
  165. this.innerWidth = window.innerWidth;
  166. },
  167. methods: {
  168. // 分页改变
  169. pageChange(e) {
  170. this.page = e;
  171. this._getPatiensVisitList(this.getPatiensInfo.basisPatient.pid);
  172. },
  173. // 鼠标进入
  174. patientIn() {
  175. this._getPatiensBasisM();
  176. },
  177. // 就诊记录点击
  178. handleRecord(item) {
  179. // this.showCase = true
  180. this._getRecordDetail(item.id);
  181. },
  182. // 关闭就诊 详情
  183. closeCase() {
  184. this.showCase = false;
  185. },
  186. handleSelect1(index) {
  187. this.active = index;
  188. this.setActive(index);
  189. this.activeID = this.navlist[index].list[0].id;
  190. this.setActiveID(this.navlist[index].list[0].id);
  191. this.activeName = this.navlist[index].list[0].title;
  192. if (this.navlist[index].list[0].jump == this.$route.path) return;
  193. this.$router.push({
  194. path: this.navlist[index].list[0].jump
  195. });
  196. },
  197. // 二级分类选中
  198. choose(id, path, name) {
  199. this.activeID = id;
  200. this.activeName = name;
  201. this.setActiveID(id);
  202. if (path == this.$route.path) return;
  203. this.$router.push({
  204. path: path
  205. });
  206. },
  207. // 退出登录
  208. logOut() {
  209. this.setActive("0");
  210. this.setActiveID("1-1");
  211. this.setPatiensInfo({});
  212. this.setUserinfo({});
  213. localStorage.clear();
  214. sessionStorage.clear();
  215. this.$router.replace({
  216. path: "/"
  217. });
  218. },
  219. async getMenuPermiss() {
  220. let res = await getMenuPermiss();
  221. if (res.ResultCode == 0) {
  222. let arr = [];
  223. if (res.Data.length == 0) return;
  224. // res.Data[5].list.push({
  225. // id: "6-6",
  226. // jump: "/index/patientData",
  227. // name: "patientData",
  228. // title: "患者分析",
  229. // type: "page",
  230. // })
  231. // res.Data[5].list.push({
  232. // id: "6-7",
  233. // jump: "/index/dosage",
  234. // name: "dosage",
  235. // title: "中药用量分析",
  236. // type: "page",
  237. // })
  238. this.navlist = res.Data;
  239. this.navlist.forEach((item, index) => {
  240. item.list.forEach(item1 => {
  241. if (this.$route.path == item1.jump) {
  242. this.activeID = item1.id;
  243. this.activeName = item1.title;
  244. this.active = String(index);
  245. this.setActive(this.active);
  246. this.setActiveID(this.activeID);
  247. }
  248. });
  249. });
  250. // console.log(this.navlist, '导航')
  251. this.$forceUpdate();
  252. return;
  253. res.Data.forEach((item, index) => {
  254. let obj = {
  255. index: String(index),
  256. name: item.title,
  257. child: []
  258. };
  259. item.list.forEach((item1, index1) => {
  260. let obj1 = {
  261. id: item1.id,
  262. name: item1.title,
  263. path: item1.jump
  264. };
  265. obj.child.push(obj1);
  266. });
  267. arr.push(obj);
  268. });
  269. this.navlist = arr;
  270. }
  271. },
  272. // 获取患者己本信息
  273. async _getPatiensBasisM() {
  274. let res = await getPatiensBasisM({
  275. patientId: this.getPatiensInfo.pid
  276. });
  277. if (res.ResultCode == 0) {
  278. // res.Data.recordLength = res.Data.patientRecord.length;
  279. this.patiensMsg = res.Data;
  280. this._getPatiensVisitList(this.getPatiensInfo.basisPatient.pid);
  281. }
  282. },
  283. // 获取就诊详情
  284. async _getRecordDetail(id) {
  285. let res = await getRecordDetail({
  286. id: id
  287. // id: 'e68d293d-f1b7-4f6d-bed4-42b1aba6973e'
  288. });
  289. if (res.ResultCode == 0) {
  290. this.caseItem = res.Data;
  291. this.showCase = true;
  292. } else {
  293. this.$message.error(res.ResultInfo);
  294. }
  295. },
  296. // 获取就诊记录
  297. async _getPatiensVisitList(id) {
  298. let res = await getPatiensVisitList({
  299. patientId: id,
  300. page: this.page,
  301. limit: 11
  302. });
  303. if (res.ResultCode == 0) {
  304. this.list = res.Data.Items;
  305. this.total = res.Data.TotalRecordCount;
  306. }
  307. },
  308. ...mapMutations({
  309. setActiveID: "nav/setActiveID",
  310. setActive: "nav/setActive",
  311. setPatiensInfo: "user/setPatiensInfo",
  312. setUserinfo: "user/setUserinfo"
  313. })
  314. },
  315. watch: {
  316. $route: {
  317. deep: true,
  318. immediate: true,
  319. handler: function(to, from) {
  320. this.navlist.forEach((item, index) => {
  321. item.list.forEach(item1 => {
  322. if (to.path == item1.jump) {
  323. this.activeID = item1.id;
  324. this.activeName = item1.title;
  325. this.active = String(index);
  326. this.setActive(this.active);
  327. this.setActiveID(this.activeID);
  328. }
  329. });
  330. if (to.path == "/") {
  331. this.logOut();
  332. }
  333. });
  334. },
  335. immediate: true,
  336. deep: true
  337. },
  338. getPatiensInfo: {
  339. deep: true,
  340. immediate: true,
  341. handler: function() {
  342. if (!this.getPatiensInfo) return;
  343. if (Object.keys(this.getPatiensInfo).length > 0) {
  344. this._getPatiensBasisM();
  345. }
  346. }
  347. },
  348. getActiveID: {
  349. deep: true,
  350. immediate: true,
  351. handler: function() {
  352. this.activeID = this.getActiveID;
  353. }
  354. }
  355. },
  356. computed: {
  357. titleSplit() {
  358. const suffix = `辅助诊疗系统`
  359. const values = this.title.split(suffix);
  360. values[1] = values.length === 2 ? suffix + values[1] : '';
  361. return values;
  362. },
  363. ...mapGetters(["getuserinfo", "getPatiensInfo", "getActiveID", "getActive"])
  364. }
  365. };
  366. </script>
  367. <style lang="scss" scoped>
  368. @import "../style/common.scss";
  369. .main-menu {
  370. flex: 1;
  371. // background: red;
  372. height: 100%;
  373. margin: 0 10px;
  374. .menu-item {
  375. height: 100%;
  376. display: flex;
  377. align-items: center;
  378. padding: 0 10px;
  379. cursor: pointer;
  380. color: #fff;
  381. }
  382. .active {
  383. background: rgba($color: #ffffff, $alpha: 0.2);
  384. }
  385. }
  386. .top-nav {
  387. svg.ai {
  388. cursor: pointer;
  389. &:hover {
  390. path {
  391. fill: #f56c6c;
  392. }
  393. }
  394. }
  395. background: #5386f6;
  396. padding: 0 24px 0 0;
  397. // padding: 0px;
  398. // height: 60px;
  399. height: 50px;
  400. // position: relative;
  401. box-sizing: border-box;
  402. .title {
  403. background: #5386f6;
  404. // height: 60px;
  405. height: 50px;
  406. padding: 0px 32px;
  407. font-size: 18px;
  408. box-sizing: border-box;
  409. font-family: PingFang SC;
  410. font-weight: bold;
  411. color: #ffffff;
  412. // padding: 5px 0;
  413. cursor: pointer;
  414. // position: absolute;
  415. // left: 0;
  416. // top: 0;
  417. // bottom: 0;
  418. img {
  419. width: 45px;
  420. margin-right: 10px;
  421. }
  422. }
  423. .admin {
  424. width: 292px;
  425. // background: red;
  426. font-size: 14px;
  427. height: 32px;
  428. font-family: PingFang SC;
  429. font-weight: 400;
  430. color: #ffffff;
  431. cursor: pointer;
  432. text-align: right;
  433. // position: absolute;
  434. line-height: 32px;
  435. // right: 0px;
  436. // top: 18px;
  437. // bottom: 0;
  438. .name {
  439. margin-right: 10px;
  440. }
  441. .icon {
  442. width: 12px;
  443. }
  444. .hover-show {
  445. display: none;
  446. position: absolute;
  447. top: 27px;
  448. right: 0px;
  449. z-index: 999;
  450. width: 120px;
  451. // height: 300px;
  452. box-sizing: border-box;
  453. background: #ffffff;
  454. padding: 10px 0;
  455. border-radius: 8px;
  456. box-shadow: 2px 2px 15px rgba($color: #000000, $alpha: 0.2);
  457. div {
  458. // padding: 0px 20px 0;
  459. height: 40px;
  460. // line-height: 50px;
  461. }
  462. span {
  463. color: #000;
  464. }
  465. }
  466. }
  467. .admin:hover {
  468. .hover-show {
  469. display: block;
  470. }
  471. }
  472. .hover-show:hover {
  473. display: block;
  474. }
  475. }
  476. .header-bottom {
  477. background: #fff;
  478. // height: 50px;
  479. height: 40px;
  480. position: relative;
  481. .left-nav-tip {
  482. font-size: 14px;
  483. font-family: PingFang SC;
  484. font-weight: 400;
  485. color: #333333;
  486. position: absolute;
  487. left: 5px;
  488. }
  489. .user-info {
  490. position: absolute;
  491. right: 15px;
  492. cursor: pointer;
  493. img {
  494. width: 25px;
  495. margin-right: 8px;
  496. }
  497. span {
  498. font-size: 14px;
  499. font-family: PingFang SC;
  500. font-weight: 400;
  501. color: #333333;
  502. }
  503. }
  504. .user-info:hover .seeRecord {
  505. display: block;
  506. }
  507. .tab-bar {
  508. div {
  509. font-size: 16px;
  510. font-family: PingFang SC;
  511. font-weight: 400;
  512. color: #666666;
  513. margin-right: 25px;
  514. cursor: pointer;
  515. }
  516. .is-active {
  517. color: #5386f6;
  518. }
  519. }
  520. }
  521. .seeRecord {
  522. display: none;
  523. width: 350px;
  524. height: 400px;
  525. position: absolute;
  526. top: 35px;
  527. right: -18px;
  528. background: #fff;
  529. z-index: 9999;
  530. border: 1px solid #ebeef5;
  531. // overflow-y: auto;
  532. overflow: hidden;
  533. .list {
  534. height: 320px;
  535. overflow-y: auto;
  536. // background: red;
  537. }
  538. &-header {
  539. height: 40px;
  540. background: #5386f6;
  541. line-height: 40px;
  542. font-size: 18px;
  543. color: #fff;
  544. text-align: center;
  545. }
  546. &-item {
  547. overflow: hidden;
  548. text-overflow: ellipsis;
  549. white-space: nowrap;
  550. color: #000;
  551. font-size: 16px;
  552. margin-top: 10px;
  553. cursor: pointer;
  554. padding: 0 10px;
  555. }
  556. }
  557. .el-menu--horizontal > .el-menu-item {
  558. border-bottom: 0 !important;
  559. }
  560. .el-menu--horizontal > .el-menu-item.is-active {
  561. background: #2bab9b !important;
  562. }
  563. .el-menu-demo > ul > li {
  564. font-size: 16px !important;
  565. }
  566. .top-nav ::v-deep .el-menu-item {
  567. font-size: 16px;
  568. // font-weight: bold;
  569. }
  570. .top-nav ::v-deep .el-menu-item {
  571. padding: 0 5px;
  572. }
  573. </style>
  574. <style scoped lang="scss">
  575. @media screen and (max-width: 1280px) {
  576. .main-menu {
  577. .menu-item {
  578. padding: 0 5px;
  579. font-size: 12px;
  580. }
  581. }
  582. }
  583. @media screen and (max-width: 768px) {
  584. .main-menu {
  585. .menu-item {
  586. padding: 0 5px;
  587. }
  588. }
  589. .top-nav {
  590. background: #5386f6;
  591. padding: 0 12px 0 0;
  592. // padding: 0px;
  593. // height: 60px;
  594. height: 50px;
  595. // position: relative;
  596. box-sizing: border-box;
  597. .title {
  598. background: #5386f6;
  599. // height: 60px;
  600. height: 50px;
  601. padding: 0 6px;
  602. font-size: 14px;
  603. font-family: PingFang SC;
  604. font-weight: bold;
  605. color: #ffffff;
  606. cursor: pointer;
  607. img {
  608. width: 40px;
  609. margin-right: 5px;
  610. }
  611. }
  612. .admin {
  613. width: 94px;
  614. }
  615. }
  616. .header-bottom {
  617. background: #fff;
  618. // height: 50px;
  619. height: 30px;
  620. position: relative;
  621. .left-nav-tip {
  622. font-size: 12px;
  623. font-family: PingFang SC;
  624. font-weight: 400;
  625. color: #333333;
  626. position: absolute;
  627. left: 5px;
  628. }
  629. .user-info {
  630. position: absolute;
  631. right: 10px;
  632. cursor: pointer;
  633. img {
  634. width: 20px;
  635. margin-right: 8px;
  636. }
  637. span {
  638. font-size: 12px;
  639. font-family: PingFang SC;
  640. font-weight: 400;
  641. color: #333333;
  642. }
  643. }
  644. .user-info:hover .seeRecord {
  645. display: block;
  646. }
  647. .tab-bar {
  648. div {
  649. font-size: 12px;
  650. font-family: PingFang SC;
  651. font-weight: 400;
  652. color: #666666;
  653. margin-right: 10px;
  654. cursor: pointer;
  655. }
  656. .is-active {
  657. color: #5386f6;
  658. }
  659. }
  660. }
  661. }
  662. </style>