index.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. <template>
  2. <div class="device">
  3. <Dnav
  4. @handleEmit="handleEmit"
  5. :routerName="routerName"
  6. />
  7. <Modal
  8. :obj="obj"
  9. :routerName="routerName"
  10. @handlerouterName="handlerouterName"
  11. />
  12. <div class="baseimg">
  13. <img
  14. class="floor"
  15. :src="require(`../../assets/images/device/${src}.png`)"
  16. alt="bg"
  17. />
  18. <!-- 机房 -->
  19. <div
  20. v-show="src == 'B2'"
  21. class="basebtn"
  22. @click="handleModal"
  23. >
  24. <!-- <img
  25. src="../../assets/images/device/B2-hover.png"
  26. alt=""
  27. > -->
  28. </div>
  29. </div>
  30. <img
  31. class="tip"
  32. :src="require(`../../assets/images/device/floor${src}.png`)"
  33. alt=""
  34. />
  35. <!--楼层分布-->
  36. <div class="floor-switch">
  37. <div class="floor-switch-btn">
  38. <div
  39. v-show="type == 'Fire'"
  40. class="fire-legend"
  41. >
  42. <img
  43. class="legend"
  44. @click="isLegendDetailShow = !isLegendDetailShow"
  45. src="../../assets/images/device/legend-fire.png"
  46. />
  47. </div>
  48. <div>
  49. <img
  50. class="legend"
  51. @click="isLegendShow = !isLegendShow"
  52. src="../../assets/images/icon_legend.png"
  53. />
  54. </div>
  55. <ul>
  56. <li><img src="../../assets/images/icon_arrow.png" /></li>
  57. <li
  58. v-for="(item, index) in floorLists.data"
  59. :key="index"
  60. :class="{ active: index === floorLists.curIndex }"
  61. @click="handleTab(item.name, index, item.type)"
  62. >
  63. {{ item.name }}
  64. </li>
  65. <li>
  66. <img
  67. src="../../assets/images/icon_arrow.png"
  68. class="icon-arrow-down"
  69. />
  70. </li>
  71. </ul>
  72. <div
  73. class="map"
  74. v-show="isLegendShow"
  75. :style="{ top: type == 'Fire' ? '80px' : '0px' }"
  76. >
  77. <img
  78. :src="require(`../../assets/images/device/${ledgentSrc}.png`)"
  79. alt=""
  80. />
  81. </div>
  82. <div
  83. class="map1"
  84. v-show="isLegendDetailShow"
  85. >
  86. <img
  87. src="../../assets/images/device/legend-detail.png"
  88. alt=""
  89. />
  90. </div>
  91. </div>
  92. </div>
  93. <div
  94. class="mask"
  95. v-show="obj.show"
  96. ></div>
  97. </div>
  98. </template>
  99. <script>
  100. import Dnav from "./Dnav";
  101. import Modal from "./Modal";
  102. export default {
  103. props: {
  104. routerName: {
  105. type: String
  106. }
  107. },
  108. name: "device",
  109. mounted() {
  110. // console.log(this.$props.routerName, 111);
  111. },
  112. data() {
  113. return {
  114. obj: {
  115. show: false,
  116. src: "main-list"
  117. },
  118. isLegendShow: false,
  119. isFireLegend: false,
  120. isLegendDetailShow: false,
  121. src: "B2",
  122. ledgentSrc: "legend-left",
  123. floorLists: {
  124. data: [
  125. {
  126. name: "F2",
  127. type: ""
  128. },
  129. {
  130. name: "F1",
  131. type: ""
  132. },
  133. {
  134. name: "B1",
  135. type: ""
  136. },
  137. {
  138. name: "B2",
  139. type: ""
  140. }
  141. ],
  142. curIndex: 3
  143. },
  144. type: "General"
  145. };
  146. },
  147. methods: {
  148. handleEmit(val) {
  149. // console.log(val)
  150. if (val.src.includes("Fire")) {
  151. const data = [
  152. {
  153. name: "F2",
  154. type: "fire"
  155. },
  156. {
  157. name: "F1",
  158. type: "fire"
  159. },
  160. {
  161. name: "B1",
  162. type: "fire"
  163. },
  164. {
  165. name: "B2",
  166. type: "fire"
  167. }
  168. ];
  169. this.$set(this.floorLists, "data", data);
  170. this.handleTab("B2", 3, "fire");
  171. this.type = "Fire";
  172. this.ledgentSrc = "legend-fire-left";
  173. this.isLegendShow = false;
  174. this.isLegendDetailShow = false;
  175. } else if (val.src.includes("General")) {
  176. const data = [
  177. {
  178. name: "F2",
  179. type: ""
  180. },
  181. {
  182. name: "F1",
  183. type: ""
  184. },
  185. {
  186. name: "B1",
  187. type: ""
  188. },
  189. {
  190. name: "B2",
  191. type: ""
  192. }
  193. ];
  194. this.$set(this.floorLists, "data", data);
  195. this.handleTab("B2", 3, "");
  196. this.type = "General";
  197. this.ledgentSrc = "legend-left";
  198. this.isLegendShow = false;
  199. this.isLegendDetailShow = false;
  200. } else {
  201. // console.log(1111)
  202. this.obj = val;
  203. }
  204. },
  205. handleTab(name, index, type) {
  206. this.floorLists.curIndex = index;
  207. if (name.includes("F1") || name.includes("B2")) {
  208. this.src = type + name;
  209. }
  210. },
  211. handleModal() {
  212. this.obj = {
  213. show: true,
  214. src: "room-layout",
  215. istab: true
  216. };
  217. },
  218. handlerouterName(val) {
  219. this.$emit("handlerouterName", val);
  220. // console.log(val);
  221. // this.$emit("handlerouterName", val);
  222. // this.$set(this.obj, "show", false);
  223. }
  224. },
  225. components: {
  226. Dnav,
  227. Modal
  228. },
  229. watch: {
  230. routerName: {
  231. immediate: true,
  232. handler: function(val) {
  233. if (val == "device1") {
  234. this.handleModal();
  235. } else {
  236. this.obj = {
  237. show: false,
  238. src: "room-layout",
  239. istab: true
  240. };
  241. }
  242. }
  243. }
  244. }
  245. };
  246. </script>
  247. <style lang="less" scoped>
  248. .device {
  249. width: 100%;
  250. height: 100%;
  251. // height: 960px;
  252. // border: 1px solid red;
  253. }
  254. .baseimg {
  255. padding-top: 120px;
  256. position: absolute;
  257. left: 50%;
  258. top: 50%;
  259. transform: translate(-50%, -50%);
  260. // z-index: 20000;
  261. .basebtn {
  262. position: absolute;
  263. width: 304px;
  264. height: 121px;
  265. top: 145px;
  266. left: 649px;
  267. cursor: pointer;
  268. &:hover {
  269. background: url("../../assets/images/device/B2-hover.png");
  270. }
  271. }
  272. }
  273. .floor-switch {
  274. position: relative;
  275. color: #fff;
  276. padding-top: 94px;
  277. flex: 1;
  278. .floor-switch-image {
  279. position: relative;
  280. right: 134px;
  281. &.floor-switch-image-b2 {
  282. right: 116px;
  283. }
  284. }
  285. .floor-switch-btn {
  286. position: absolute;
  287. top: 94px;
  288. right: 20px;
  289. width: 61px;
  290. ul {
  291. border: 1px solid rgb(22, 73, 206);
  292. border-radius: 4px;
  293. background-color: rgba(22, 73, 206, 0.22);
  294. margin-top: 11px;
  295. li {
  296. margin: 0 auto;
  297. width: 42px;
  298. height: 42px;
  299. line-height: 42px;
  300. text-align: center;
  301. cursor: pointer;
  302. &.active {
  303. border: 1px solid rgb(0, 174, 232);
  304. border-radius: 4px;
  305. background-color: rgba(0, 174, 232, 0.502);
  306. }
  307. .icon-arrow-down {
  308. transform: rotate(180deg);
  309. }
  310. }
  311. }
  312. .fire-legend {
  313. margin-bottom: 11px;
  314. }
  315. .map {
  316. position: absolute;
  317. right: 80px;
  318. top: 0;
  319. }
  320. .map1 {
  321. position: absolute;
  322. right: 80px;
  323. top: 0;
  324. }
  325. .legend {
  326. cursor: pointer;
  327. }
  328. }
  329. }
  330. .tip {
  331. width: 256px;
  332. height: 40px;
  333. position: fixed;
  334. top: 162px;
  335. left: 516px;
  336. }
  337. .floor {
  338. // height: 695px;
  339. }
  340. .mask {
  341. position: fixed;
  342. top: 0;
  343. width: 100%;
  344. height: 100%;
  345. background: #000;
  346. z-index: 1100;
  347. opacity: 0.8;
  348. }
  349. </style>