index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <div class="page-common-body">
  3. <div class="page-common-body-router">
  4. <router-view @getWtid="getWtid" />
  5. </div>
  6. <div v-if="!hidden" class="page-common-body-menu">
  7. <div class="page-common-body-menu-box">
  8. <div class="page-common-body-menu-border left-top"></div>
  9. <div class="page-common-body-menu-border left-bottom"></div>
  10. <div class="page-common-body-menu-border right-top"></div>
  11. <div class="page-common-body-menu-border right-bottom"></div>
  12. <div
  13. class="page-common-body-menu-item"
  14. v-for="(menuData, index) of menuDatas"
  15. :key="index"
  16. @click="clickMenu(index)"
  17. :class="{ active: activeIndex == index }"
  18. >
  19. <router-link :to="menuData.path">
  20. <span
  21. class="svg-icon"
  22. :class="
  23. activeIndex == index ? 'svg-icon-yellow' : 'svg-icon-green'
  24. "
  25. >
  26. <SvgIcon :svgid="menuData.icon"></SvgIcon>
  27. </span>
  28. </router-link>
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. </template>
  34. <script>
  35. import SvgIcon from "@com/coms/icon/svg-icon.vue";
  36. export default {
  37. name: "healthDetail",
  38. setup() {},
  39. components: { SvgIcon },
  40. data() {
  41. return {
  42. activeIndex: 0,
  43. wpId: "",
  44. wtId: "",
  45. menuDatas: [
  46. {
  47. icon: "svg-q实时监视",
  48. path: "/health/healthDetail/wtHealth",
  49. },
  50. {
  51. icon: "svg-q趋势",
  52. path: "/health/healthDetail/healthTrend",
  53. },
  54. {
  55. icon: "svg-q曲线",
  56. path: "/health/healthDetail/badState",
  57. },
  58. ],
  59. hidden: false,
  60. };
  61. },
  62. watch: {
  63. $route: {
  64. handler(val) {
  65. if (val.path.includes("wpHealth")) {
  66. this.hidden = true;
  67. } else {
  68. this.hidden = false;
  69. }
  70. },
  71. immediate: true,
  72. },
  73. },
  74. created() {
  75. this.wtId = this.$route.params.wtId;
  76. this.wpId = this.$route.params.wpId;
  77. if (this.wtId) {
  78. this.menuDatas.forEach((ele) => {
  79. ele.path += "/" + this.wpId + "/" + this.wtId;
  80. });
  81. }
  82. },
  83. methods: {
  84. getWtid(id, from) {
  85. // this.wtId = id;
  86. // if (from && from == "wpHealth") {
  87. // this.menuDatas.forEach((ele) => {
  88. // ele.path += "/" + this.wpId + "/" + id;
  89. // });
  90. // }
  91. },
  92. clickMenu: function (index) {
  93. this.activeIndex = index;
  94. },
  95. },
  96. };
  97. </script>
  98. <style lang="less" scoped>
  99. .page-common-body {
  100. height: 100%;
  101. display: flex;
  102. flex-direction: row;
  103. padding-top: 10px;
  104. .page-common-body-router {
  105. overflow: auto;
  106. overflow-x: hidden;
  107. height: calc(100% - 10px);
  108. flex: 1 1 auto;
  109. }
  110. .page-common-body-menu {
  111. padding: 0 12px 12px 12px;
  112. .page-common-body-menu-box {
  113. border: 1px solid @darkgray;
  114. background-color: fade(@darkgray, 30%);
  115. padding: 20px 5px;
  116. position: relative;
  117. .page-common-body-menu-border {
  118. position: absolute;
  119. width: 3px;
  120. height: 3px;
  121. background-color: @write;
  122. border-radius: 50%;
  123. &.left-top {
  124. left: 0;
  125. top: 0;
  126. }
  127. &.left-bottom {
  128. left: 0;
  129. bottom: 0;
  130. }
  131. &.right-top {
  132. right: 0;
  133. top: 0;
  134. }
  135. &.right-bottom {
  136. right: 0;
  137. bottom: 0;
  138. }
  139. }
  140. .page-common-body-menu-item {
  141. border: 1px solid fade(@green, 40%);
  142. width: 40px;
  143. height: 40px;
  144. border-radius: 5px;
  145. margin-top: 10px;
  146. display: flex;
  147. align-items: center;
  148. justify-content: center;
  149. cursor: pointer;
  150. a {
  151. line-height: 0;
  152. }
  153. &:first-child {
  154. margin-top: 0;
  155. }
  156. &.active {
  157. border-color: fade(@yellow, 40%);
  158. position: relative;
  159. &::after {
  160. content: "";
  161. width: calc(100% - 2px);
  162. height: calc(100% - 2px);
  163. position: absolute;
  164. border: 1px solid @yellow;
  165. box-shadow: 0 0 2px @yellow;
  166. top: 1px;
  167. left: 1px;
  168. }
  169. }
  170. }
  171. }
  172. }
  173. }
  174. </style>