123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249 |
- <template>
- <div class="navigation yes-events">
- <el-select class="select" v-model="areaId" size="large" @change="changeSelect" popper-class="focus-farm-select">
- <el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id" />
- </el-select>
- <div class="tabs" v-for="(ele, idx) in list" :key="idx">
- <div
- class="tab-item"
- @click="handleTab(item)"
- :class="{ active: active === item.id }"
- v-for="(item, index) in ele"
- :key="index"
- >
- {{ item.name }}
- </div>
- </div>
- <el-checkbox-group
- v-show="childrenData.length"
- class="checkbox-group"
- v-model="checkedChildren"
- @change="handleCheckedChange"
- :min="1"
- >
- <el-checkbox v-for="item in childrenData" :key="item" :label="item" :value="item">
- {{ item }}
- </el-checkbox>
- </el-checkbox-group>
- <!-- <div class="btn" @click="toPage">农场确权</div> -->
- </div>
- </template>
- <script setup>
- import { useRouter } from "vue-router";
- import { onMounted, onUnmounted, ref } from "vue";
- import eventBus from "@/api/eventBus";
- const router = useRouter();
- const areaId = ref("");
- const options = ref([]);
- eventBus.off('garden:organId', gardenOrganId)
- eventBus.on('garden:organId',gardenOrganId)
- const organId = ref(null)
- function gardenOrganId(farmId){
- organId.value = farmId
- VE_API.region.list({farmId}).then(res =>{
- options.value = res.data
- areaId.value = res.data[0].id
- eventBus.emit('area:id',{areaId:areaId.value,farmId})
- sessionStorage.setItem('regionId',areaId.value)
- })
- }
- const changeSelect = (e) =>{
- eventBus.emit('area:id',{areaId:areaId.value,farmId:organId.value})
- sessionStorage.setItem('regionId',e)
- }
- onMounted(()=>{
- gardenOrganId(sessionStorage.getItem('farmId')*1)
- eventBus.on('handleActive',handleActive)
- })
- onUnmounted(()=>{
- eventBus.off('handleActive',handleActive)
- })
- const emit = defineEmits(["handleTab","handleTabItem"])
- const checkedChildren = ref([]);
- const childrenData = ref([]);
- const handleCheckedChange = (e) => {
- if(e.length){
- checkedChildren.value = [e[e.length -1]];
- emit('handleTabItem',checkedChildren.value[0])
- eventBus.emit('handleTabItem',checkedChildren.value[0])
- }
- };
- function handleActive({name,key}){
- childrenData.value = []
- const arr = list.value[0].filter(item =>item.name===key)
- active.value = arr[0].id;
- childrenData.value = arr[0].children
- checkedChildren.value = [name]
- emit('handleTab',{name:arr[0].name,id:active.value,isUpdate:true,params:name})
- }
- const active = ref(0);
- const handleTab = ({ id, name,children }) => {
- active.value = id;
- childrenData.value = []
- if(children){
- childrenData.value = children;
- checkedChildren.value = [children[0]];
- }
- emit('handleTab',{name,id})
- eventBus.emit('handleTab',name)
- };
- const list = ref([
- [
- {
- name: "异常总览",
- id: 0,
- },
- {
- name: "基本指标",
- id: 1,
- children: ["树高", "冠幅"],
- },
- {
- name: "物候指标",
- id: 2,
- children: ["花穗长度", "单树花穗率"],
- },
- {
- name: "生态指标",
- id: 3,
- children: ["通风率", "清园程度","益草覆盖度"],
- },
- {
- name: "生长指标",
- id: 4,
- children: ["生长缓慢", "花量大","花带叶"],
- },
- {
- name: "病虫指标",
- id: 5,
- children: ["病害比例", "虫害比例"],
- },
- ],
- [
- {
- name: "处方图",
- id: 6,
- },
- ],
- ]);
- const toPage = () => {
- router.push("/authentic");
- };
- </script>
- <style lang="scss" scoped>
- .navigation {
- position: fixed;
- top: 34px;
- // left: calc(50% - 470px);
- left: 50%;
- transform: translateX(-50%);
- width: calc(100% - 430px * 2);
- display: flex;
- justify-content: center;
- align-items: center;
- .select{
- // width: 120px;
- width: 226px;
- height: 50px;
- margin-right: 21px;
- ::v-deep{
- .el-select__wrapper{
- height: 100%;
- background: rgba(0, 0, 0, 0.3);
- box-shadow: 0 0 0 1px #F7BE5A;
- border-radius: 2px;
- text-align: center;
- }
- .el-select__placeholder{
- color: #F7BE5A;
- font-size: 20px;
- font-family: "PangMenZhengDao";
- }
- .el-select__caret{
- color: #F7BE5A;
- font-size: 20px;
- }
- }
- }
- .tabs {
- background: rgba(35, 35, 35, 0.8);
- border: 1px solid #555555;
- padding: 8px;
- border-radius: 8px;
- display: flex;
- justify-content: center;
- .tab-item {
- font-size: 16px;
- color: rgba(255, 255, 255, 0.8);
- padding: 7px 12px 9px 12px;
- font-family: "PangMenZhengDao";
- cursor: pointer;
- &.active {
- background: #ffd489;
- color: #1d1d1d;
- border-radius: 4px;
- }
- }
- .tab-item + .tab-item {
- margin-left: 25px;
- }
- }
- .tabs + .tabs {
- margin-left: 12px;
- }
- .checkbox-group {
- position: absolute;
- top: 74px;
- right: 30px;
- background: rgba(35, 35, 35, 0.8);
- border-radius: 8px;
- border: 1px solid #555555;
- padding: 10px 20px;
- display: flex;
- flex-direction: column;
- ::v-deep {
- .el-checkbox {
- margin-right: 0;
- }
- .el-checkbox__input.is-checked + .el-checkbox__label {
- color: #ffd489;
- }
- .el-checkbox__input.is-checked .el-checkbox__inner {
- background-color: #ffd489;
- border-color: #ffd489;
- &::after {
- border-color: #1d1d1d;
- }
- }
- .el-checkbox__label {
- color: #fff;
- }
- }
- }
- .btn {
- width: 80px;
- height: 30px;
- text-align: center;
- line-height: 28px;
- border-radius: 5px;
- cursor: pointer;
- background: rgba(255, 255, 255, 0.5);
- }
- }
- </style>
|