navigation.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <template>
  2. <div class="navigation yes-events">
  3. <el-select class="select" v-model="value" size="large" popper-class="focus-farm-select">
  4. <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
  5. </el-select>
  6. <div class="tabs" v-for="(ele, idx) in list" :key="idx">
  7. <div
  8. class="tab-item"
  9. @click="handleTab(item)"
  10. :class="{ active: active === item.id }"
  11. v-for="(item, index) in ele"
  12. :key="index"
  13. >
  14. {{ item.name }}
  15. </div>
  16. </div>
  17. <el-checkbox-group
  18. v-show="childrenData.length"
  19. class="checkbox-group"
  20. v-model="checkedChildren"
  21. @change="handleCheckedChange"
  22. >
  23. <el-checkbox v-for="item in childrenData" :key="item" :label="item" :value="item">
  24. {{ item }}
  25. </el-checkbox>
  26. </el-checkbox-group>
  27. <!-- <div class="btn" @click="toPage">农场确权</div> -->
  28. </div>
  29. </template>
  30. <script setup>
  31. import { useRouter } from "vue-router";
  32. import { ref } from "vue";
  33. const router = useRouter();
  34. const value = ref("Option1");
  35. const options = [
  36. {
  37. value: "Option1",
  38. label: "2区",
  39. }
  40. ];
  41. const emit = defineEmits(["handleTab","handleTabItem"])
  42. const checkedChildren = ref([]);
  43. const childrenData = ref([]);
  44. const handleCheckedChange = (e) => {
  45. checkedChildren.value = [e[e.length -1]];
  46. emit('handleTabItem',checkedChildren.value[0])
  47. };
  48. const active = ref(0);
  49. const handleTab = ({ id, name,children }) => {
  50. active.value = id;
  51. childrenData.value = []
  52. if(children){
  53. childrenData.value = children;
  54. checkedChildren.value = [children[0]];
  55. }
  56. emit('handleTab',{name,id})
  57. };
  58. const list = ref([
  59. [
  60. {
  61. name: "异常总览",
  62. id: 0,
  63. },
  64. {
  65. name: "基本指标",
  66. id: 1,
  67. children: ["树高", "冠幅"],
  68. },
  69. {
  70. name: "物候指标",
  71. id: 2,
  72. children: ["花穗长度", "单数华穗率"],
  73. },
  74. {
  75. name: "生态指标",
  76. id: 3,
  77. children: ["通风率", "清园程度","益草覆盖度"],
  78. },
  79. {
  80. name: "生长指标",
  81. id: 4,
  82. },
  83. {
  84. name: "病虫指标",
  85. id: 5,
  86. },
  87. ],
  88. [
  89. {
  90. name: "处方图",
  91. id: 6,
  92. },
  93. ],
  94. ]);
  95. const toPage = () => {
  96. router.push("/authentic");
  97. };
  98. </script>
  99. <style lang="scss" scoped>
  100. .navigation {
  101. position: fixed;
  102. top: 34px;
  103. left: calc(50% - 470px);
  104. width: calc(100% - 430px * 2);
  105. display: flex;
  106. justify-content: center;
  107. align-items: center;
  108. .select{
  109. width: 120px;
  110. height: 50px;
  111. margin-right: 21px;
  112. ::v-deep{
  113. .el-select__wrapper{
  114. height: 100%;
  115. background: rgba(0, 0, 0, 0.3);
  116. box-shadow: 0 0 0 1px #F7BE5A;
  117. border-radius: 2px;
  118. text-align: center;
  119. }
  120. .el-select__placeholder{
  121. color: #F7BE5A;
  122. font-size: 20px;
  123. font-family: "PangMenZhengDao";
  124. }
  125. .el-select__caret{
  126. color: #F7BE5A;
  127. font-size: 20px;
  128. }
  129. }
  130. }
  131. .tabs {
  132. background: rgba(35, 35, 35, 0.8);
  133. border: 1px solid #555555;
  134. padding: 8px;
  135. border-radius: 8px;
  136. display: flex;
  137. justify-content: center;
  138. .tab-item {
  139. font-size: 16px;
  140. color: rgba(255, 255, 255, 0.8);
  141. padding: 7px 12px 9px 12px;
  142. font-family: "PangMenZhengDao";
  143. cursor: pointer;
  144. &.active {
  145. background: #ffd489;
  146. color: #1d1d1d;
  147. border-radius: 4px;
  148. }
  149. }
  150. .tab-item + .tab-item {
  151. margin-left: 25px;
  152. }
  153. }
  154. .tabs + .tabs {
  155. margin-left: 12px;
  156. }
  157. .checkbox-group {
  158. position: absolute;
  159. top: 74px;
  160. right: 30px;
  161. background: rgba(35, 35, 35, 0.8);
  162. border-radius: 8px;
  163. border: 1px solid #555555;
  164. padding: 10px 20px;
  165. display: flex;
  166. flex-direction: column;
  167. ::v-deep {
  168. .el-checkbox {
  169. margin-right: 0;
  170. }
  171. .el-checkbox__input.is-checked + .el-checkbox__label {
  172. color: #ffd489;
  173. }
  174. .el-checkbox__input.is-checked .el-checkbox__inner {
  175. background-color: #ffd489;
  176. border-color: #ffd489;
  177. &::after {
  178. border-color: #1d1d1d;
  179. }
  180. }
  181. .el-checkbox__label {
  182. color: #fff;
  183. }
  184. }
  185. }
  186. .btn {
  187. width: 80px;
  188. height: 30px;
  189. text-align: center;
  190. line-height: 28px;
  191. border-radius: 5px;
  192. cursor: pointer;
  193. background: rgba(255, 255, 255, 0.5);
  194. }
  195. }
  196. </style>