leftToolBar.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <!-- 左侧工具栏 -->
  2. <template>
  3. <div class="left-tool-bar">
  4. <div class="btn-list">
  5. <ul>
  6. <li
  7. v-for="(item, index) in leftData"
  8. :key="index"
  9. :class="{ 'btn-active': chiceStatus == index }"
  10. @click="openTool(index)"
  11. >
  12. <!-- <img
  13. width="20px"
  14. height="20px"
  15. :src="chiceStatus == index ? item.activeIcon : item.icon"
  16. alt
  17. /> -->
  18. <span :class="['icon', 'iconfont', 'fontstyle', item.icon]"></span>
  19. <span>{{ item.name }}</span>
  20. <div class="btborder"></div>
  21. </li>
  22. </ul>
  23. </div>
  24. <el-drawer
  25. size="220px"
  26. :with-header="false"
  27. :destroy-on-close="true"
  28. :visible.sync="drawer"
  29. :direction="direction"
  30. :modal="false"
  31. :modal-append-to-body="false"
  32. :show-close="true"
  33. :before-close="handleClose"
  34. :wrapperClosable="false"
  35. custom-class="drawer-box"
  36. >
  37. <legendList :chiceStatus="chiceStatus"></legendList>
  38. </el-drawer>
  39. <!-- :visible.sync="drawer" -->
  40. </div>
  41. </template>
  42. <script>
  43. const leftData = [
  44. {
  45. id: "tongyong",
  46. name: "通用",
  47. icon: "icon-tongyong",
  48. },
  49. {
  50. id: "equipment",
  51. name: "设备",
  52. icon: "icon-shebei",
  53. },
  54. {
  55. id: "equipList",
  56. name: "设备组",
  57. icon: "icon-shebeizu",
  58. },
  59. {
  60. id: "guanxian",
  61. name: "管线",
  62. icon: "icon-guanxian",
  63. },
  64. {
  65. id: "space",
  66. name: "空间",
  67. icon: "icon-kongjian",
  68. },
  69. {
  70. id: "same",
  71. name: "楼层",
  72. icon: "icon-louceng",
  73. },
  74. ];
  75. import legendList from "./leftToolBar/legendList.vue";
  76. import { mapMutations } from "vuex";
  77. export default {
  78. components: { legendList },
  79. data() {
  80. return {
  81. drawer: false,
  82. chiceStatus: -1, //选中按钮状态
  83. direction: "ltr",
  84. leftData,
  85. };
  86. },
  87. methods: {
  88. ...mapMutations(["SETCHOICELEHEND"]),
  89. handleClose() {
  90. this.drawer = false;
  91. },
  92. openTool(val) {
  93. if (val != this.chiceStatus) {
  94. this.chiceStatus = val;
  95. if (this.drawer) {
  96. this.drawer = false;
  97. 4;
  98. setTimeout(() => {
  99. this.drawer = true;
  100. }, 300);
  101. } else {
  102. this.drawer = true;
  103. }
  104. } else {
  105. this.drawer = !this.drawer;
  106. this.chiceStatus = -1;
  107. }
  108. },
  109. choiceStatus() {
  110. this.chiceStatus = 0;
  111. this.drawer = false;
  112. this.SETCHOICELEHEND("");
  113. },
  114. },
  115. };
  116. </script>
  117. <style lang="less" scoped>
  118. ul,
  119. li {
  120. margin: 0;
  121. padding: 0;
  122. list-style-type: none;
  123. }
  124. .left-tool-bar {
  125. background: rgba(255, 255, 255, 1);
  126. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  127. box-sizing: border-box;
  128. height: calc(~"100% - 2px");
  129. .btn-list {
  130. height: 100%;
  131. ul {
  132. width: 54px;
  133. height: 100%;
  134. border-top: 1px solid #eee;
  135. border-right: 1px solid #eee;
  136. li {
  137. width: 100%;
  138. height: 58px;
  139. display: flex;
  140. justify-content: center;
  141. align-items: center;
  142. flex-direction: column;
  143. cursor: pointer;
  144. border-right: 2px solid rgba(0, 145, 255, 0);
  145. .btborder {
  146. width: 30px;
  147. height: 1px;
  148. background: #eee;
  149. }
  150. span {
  151. color: #8d9399;
  152. font-size: 12px;
  153. }
  154. .fontstyle {
  155. font-size: 18px;
  156. }
  157. }
  158. li:hover {
  159. background: #f5f6f7;
  160. }
  161. .btn-active {
  162. background: #e1f2ff !important;
  163. border-right: 2px solid #0091ff;
  164. span {
  165. color: #0091ff;
  166. }
  167. }
  168. }
  169. }
  170. }
  171. .el-drawer__wrapper {
  172. left: 64px;
  173. top: 86px;
  174. // box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  175. width: 242px;
  176. }
  177. </style>