lxf 1 deň pred
rodič
commit
a3fc6888ae

+ 1 - 1
src/api/modules/report.js

@@ -3,7 +3,7 @@ const config = require("../config")
 module.exports = {
     // 今日巡园重点
     todayPatrolFocus: {
-        url: config.base_dev_url + "container_phenology_interaction/todayFocus",
+        url: config.base_dev_url + "container_phenology_interaction/todayFocus_v2",
         type: "get",
     },
     // 待执行农事

+ 244 - 0
src/views/old_mini/growth_report/adjustPopup.vue

@@ -0,0 +1,244 @@
+<template>
+    <Popup class="adjust-popup" teleport="body" :z-index="9999" round v-model:show="show" closeable>
+        <div class="popup-title">当前日期:2025.04.15</div>
+        <div class="adjust-content">
+            <div class="adjust-item">
+                <div class="item-title">请选择当前<span class="text-light">桂味</span>的物候期</div>
+                <div class="item-checkbox">
+                    <div class="tag-group add-tag-group">
+                        <div class="tag-item" :class="{ selected: item.selected }" @click="handleSelect(idx)"
+                            v-for="(item, idx) in periodList" :key="'eriod-' + idx">
+                            <span class="text">{{ item.name }}</span>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div class="adjust-item">
+                <div class="item-title">请选择当前<span class="text-light">桂味</span>的生育期</div>
+                <div class="sub-title">界定标准:<span class="text-bold">六成</span> 以上表型进入该阶段</div>
+                <div class="item-checkbox">
+                    <div class="tag-group add-tag-group child-tag-group">
+                        <div class="tag-item" :class="{ selected: item.selected }" @click="handleSelectChild(idx)"
+                            v-for="(item, idx) in childList" :key="'child-' + idx">
+                            <span class="text">{{ item.name }}</span>
+                            <img src="https://birdseye-img-ali-cdn.sysuimars.com/container_phenology_interaction/cover/284_0_1774863513631.png" alt="" class="right-icon">
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="popup-button">
+            <div class="button-item cancel" @click="close">取消</div>
+            <div class="button-item confirm" @click="handleConfirm">确认</div>
+        </div>
+    </Popup>
+</template>
+
+<script setup>
+import { ref } from 'vue';
+import { Popup } from "vant";
+
+const show = ref(false);
+
+const open = () => {
+    show.value = true;
+}
+
+const close = () => {
+    show.value = false;
+}
+
+const handleConfirm = () => {
+    close();
+}
+
+const handleSelect = (idx) => {
+    periodList.value.forEach((item, index) => {
+        item.selected = index === idx;
+    });
+}
+
+const periodList = ref([
+    { name: '花芽分化期', selected: false },
+    { name: '花穗期', selected: false },
+    { name: '坐果期', selected: false },
+]);
+
+
+// 生育期
+const childList = ref([
+    { name: '花穗萌动1', selected: false },
+    { name: '花穗萌动2', selected: false },
+    { name: '花穗萌动3', selected: false },
+]);
+const handleSelectChild = (idx) => {
+    childList.value.forEach((item, index) => {
+        item.selected = index === idx;
+    });
+}
+
+defineExpose({
+    open,
+    close,
+});
+</script>
+
+<style lang="scss" scoped>
+.adjust-popup {
+    width: 90%;
+    padding: 24px 18px 20px 18px;
+    background: linear-gradient(360deg, #FFFFFF 74.2%, #D1EBFF 100%);
+    border-radius: 8px;
+    font-size: 16px;
+    .adjust-content {
+        .item-title {
+            color: #000;
+        }
+        .text-light {
+            color: #2199F8;
+            font-weight: 500;
+            padding: 0 2px;
+        }
+        .adjust-item {
+            padding-top: 12px;
+        }
+        .sub-title {
+            font-size: 14px;
+            color: rgba(0, 0, 0, 0.5);
+            padding-top: 4px;
+            .text-bold {
+                color: #000000;
+            }
+        }
+    }
+
+    .item-checkbox {
+        .tag-group {
+            display: grid;
+            grid-template-columns: repeat(3, 1fr);
+            gap: 0 7px;
+            font-size: 14px;
+
+            &.child-tag-group {
+                grid-template-columns: repeat(2, 1fr);
+
+                .tag-item {
+                    height: 51px;
+                    line-height: 51px;
+                }
+            }
+
+            .tag-item {
+                margin-top: 12px;
+                position: relative;
+                border-radius: 4px;
+                color: #2199f8;
+                box-sizing: border-box;
+                height: 40px;
+                text-align: center;
+                line-height: 40px;
+                cursor: pointer;
+                transition: all 0.3s;
+
+                .right-icon {
+                    width: 40px;
+                    height: 40px;
+                    object-fit: cover;
+                    margin-left: 10px;
+                    border-radius: 50%;
+                }
+
+                .text {
+                    display: inline-flex;
+                    align-items: center;
+                }
+
+                &.selected {
+                    border: 1px solid #2199F8;
+                    background: #E8F5FF;
+                    color: #2199F8;
+
+                    &::after {
+                        content: "";
+                        position: absolute;
+                        z-index: 9;
+                        bottom: -1px;
+                        right: 0;
+                        width: 18px;
+                        height: 13px;
+                        background: url("@/assets/img/home/checked-bg.png") no-repeat bottom right / 18px 13px;
+                    }
+                }
+            }
+
+            &.add-tag-group {
+                .tag-item {
+                    color: #000000;
+                    background: rgba(241, 241, 241, 0.12);
+                    border: 1px solid #EBEBEB;
+                    cursor: pointer;
+
+                    &.self {
+                        border: 1px solid #2199F8;
+                        background: #E8F5FF;
+                        color: #2199F8;
+
+                        &::after {
+                            content: "";
+                            position: absolute;
+                            z-index: 9;
+                            bottom: -1px;
+                            right: 0;
+                            width: 18px;
+                            height: 13px;
+                            background: url("@/assets/img/home/checked-bg.png") no-repeat bottom right / 18px 13px;
+                        }
+                    }
+
+                    &.selected {
+                        border: 1px solid #2199F8;
+                        background: #E8F5FF;
+                        color: #2199F8;
+                    }
+
+                    &.last-add {
+                        display: flex;
+                        align-items: center;
+                        justify-content: center;
+                        cursor: pointer;
+
+                        .add-icon {
+                            font-size: 14px;
+                            font-weight: bold;
+                            margin-right: 3px;
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    .popup-button {
+        display: flex;
+        justify-content: space-between;
+        margin-top: 12px;
+        gap: 12px;
+        .button-item {
+            flex: 1;
+            border-radius: 20px;
+            background: #2199F8;
+            color: #fff;
+            text-align: center;
+            height: 40px;
+            box-sizing: border-box;
+            line-height: 40px;
+        }
+
+        .cancel {
+            color: #000;
+            border: 1px solid rgba(0, 0, 0, 0.2);
+            background: #fff;
+        }
+    }
+}
+</style>

+ 42 - 12
src/views/old_mini/growth_report/index.vue

@@ -38,17 +38,17 @@
                 <img class="header-img" src="@/assets/img/home/report.png" alt="" />
 
                 <div class="report-header">
-                    <div class="type-tabs" v-if="regionsData.length > 1">
+                    <div class="type-tabs" v-if="subjectData.length > 1">
                         <div
-                            @click="handleSwipeChange(index)"
+                            @click="handleTypeTabClick(item, index)"
                             class="type-item"
-                            v-for="(item, index) in regionsData"
-                            :class="{ 'type-item-active': currentIndex === index }"
-                            :key="index">荔枝</div>
+                            v-for="(item, index) in subjectData"
+                            :class="{ 'type-item-active': activeSubjectIndex === index }"
+                            :key="index">{{ item.speciesName }}</div>
                     </div>
 
                     <div class="time-tag">{{ workItems?.[0]?.reportDate }}</div>
-                    <div class="report-title">{{ regionsData[currentIndex]?.regionName }}长势报告</div>
+                    <div class="report-title">{{ subjectData[activeSubjectIndex]?.speciesName }}长势报告</div>
                     <div class="report-info">
                         <div class="info-item">
                             <img class="info-icon" src="@/assets/img/home/farm.png" alt="" />
@@ -109,9 +109,9 @@
                     <div class="box-text">
                         <div class="box-bg">
                             <div class="types-info">
-                                当前 <span class="text-bold">桂味</span> 处于为 梢期-新梢萌动<span class="text-link">(校准物候期)</span>,
-                                当前 <span class="text-bold">桂某某品种味</span> 处于为 梢期-新梢萌动<span class="text-link">(校准物候期)</span>,
-                                当前 <span class="text-bold">某某品种</span> 处于为 梢期-新梢萌动<span class="text-link">(校准物候期)</span>
+                                当前 <span class="text-bold">桂味</span> 处于为 梢期-新梢萌动<span class="text-link" @click="handleAdjustPopup">(校准物候期)</span>,
+                                当前 <span class="text-bold">桂某某品种味</span> 处于为 梢期-新梢萌动<span class="text-link" @click="handleAdjustPopup">(校准物候期)</span>,
+                                当前 <span class="text-bold">某某品种</span> 处于为 梢期-新梢萌动<span class="text-link" @click="handleAdjustPopup">(校准物候期)</span>
                             </div>
                         </div>
                         <div class="warning-part">
@@ -138,8 +138,8 @@
                 <div class="report-box">
                     <div class="box-title">农事建议</div>
                     <div class="box-text">
-                        <div class="warning-part">
-                            <div class="report-part" v-for="(part, partI) in 3" :key="partI">
+                        <div class="warning-part" v-for="(part, partI) in 3" :key="partI">
+                            <div class="report-part">
                                 <div class="part-top">
                                     <div class="part-title">某某农事</div>
                                     <div class="part-link">
@@ -226,6 +226,9 @@
         <start-interact-popup ref="startInteractPopupRef" />
 
         <agri-execute-popup ref="agriExecutePopupRef" />
+
+        <!-- 校准物候期 -->
+        <adjust-popup ref="adjustPopupRef" />
     </div>
 </template>
 
@@ -240,6 +243,7 @@ import tipPopup from "@/components/popup/tipPopup.vue";
 import startInteractPopup from "@/components/popup/startInteractPopup.vue";
 import agriExecutePopup from "@/components/popup/agriExecutePopup.vue";
 import gardenList from "@/components/gardenList.vue";
+import adjustPopup from "./adjustPopup.vue";
 
 const store = useStore();
 const tabBarHeight = computed(() => store.state.home.tabBarHeight);
@@ -255,6 +259,11 @@ const paramsPage = ref({});
 const showBindSuccess = ref(false);
 const startInteractPopupRef = ref(null);
 const agriExecutePopupRef = ref(null);
+const adjustPopupRef = ref(null);
+
+const handleAdjustPopup = () => {
+    adjustPopupRef.value.open();
+}
 // 天气组件相关
 const isExpanded = ref(false);
 const weatherInfoRef = ref(null);
@@ -309,6 +318,7 @@ const changeGarden = async ({ id, name }) => {
     };
     // 初始化品种/大物候期转换
     startInteractPopupRef.value.getPhenologyInitOrConfirmStatus();
+    await getSubjectData(id);
     await getRegions();
 };
 
@@ -401,7 +411,7 @@ const handleTodayPatrolFocusClick = (card) => {
 }
 
 const getTodayPatrolFocus = () => {
-    VE_API.report.todayPatrolFocus({ farmId: paramsPage.value.farmId, regionId: paramsPage.value.regionId }).then(({ data }) => {
+    VE_API.report.todayPatrolFocus({ farmId: paramsPage.value.farmId }).then(({ data }) => {
         todayPatrolFocus.value = data || [];
     });
 }
@@ -440,6 +450,23 @@ const getDetail = () => {
         });
 };
 
+const subjectData = ref([])
+
+const getSubjectData = async (id) => {
+    const res = await VE_API.monitor.listFarmsBySubjectId({ subjectId: id });
+    subjectData.value = res.data || [];
+}
+
+const activeSubjectIndex = ref(0);
+const handleTypeTabClick = (item, index) => {
+    activeSubjectIndex.value = index;
+    paramsPage.value = {
+            ...(paramsPage.value || {}),
+            farmId: item.farmId,
+    };
+    getTodayPatrolFocus();
+}
+
 const regionsData = ref([]);
 const getRegions = async () => {
     VE_API.monitor.listRegionsBySubjectId({
@@ -1070,6 +1097,9 @@ onUnmounted(() => {
                         }
                     }
                 }
+                .warning-part + .warning-part {
+                    margin-top: 8px;
+                }
                 .report-part + .report-part {
                     margin-top: 8px;
                 }