Преглед изворни кода

Merge branch 'master' of http://www.sysuimars.cn:3000/feiniao/feiniao-farm-h5

lxf пре 1 недеља
родитељ
комит
141d3e6f38

+ 32 - 10
src/components/pageComponents/FarmWorkPlanTimeline.vue

@@ -39,6 +39,10 @@
                                     >点击编辑</span
                                 >
                             </div>
+                            <!-- <div class="card-status">
+                                <el-icon color="#FF953D" size="14"><WarningFilled /></el-icon>
+                                <span>未完善</span>
+                            </div> -->
                         </div>
                     </div>
                     <div class="phenology-name">{{ r.name }}</div>
@@ -292,14 +296,14 @@ const handleSeasonClick = (seasonValue) => {
     wrap.scrollTo({ top: scrollTop, behavior: "smooth" });
 };
 
-// 农事状态样式映射(0:默认,1-4:正常,5:完成,6:预警
+// 农事状态样式映射(0:取消关注,1:关注,2:托管农事,
 const getArrangeStatusClass = (fw) => {
     const t = fw?.isFollow;
     if (t == 0) return "normal-style";
-    if (t >= 0 && t <= 4) return "status-normal";
-    if (t === 5) return "status-complete";
+    // if (t >= 0 && t <= 4) return "status-normal";
+    // if (t === 5) return "status-complete";
     if (t === 6) return "status-warning";
-    return "status-default";
+    return "status-normal";
 };
 
 const handleRowClick = (item) => {
@@ -317,6 +321,8 @@ const handleEdit = (item) => {
 // 获取农事规划数据
 const getFarmWorkPlan = () => {
     if (!props.farmId && !props.containerId) return;
+    // 更新时间戳,确保key变化,触发DOM重新渲染
+    uniqueTimestamp.value = Date.now();
     // 重置测量高度,等待重新测量
     timelineListHeight.value = 0;
     let savedScrollTop = 0;
@@ -422,9 +428,12 @@ watch(
 watch(
     () => props.schemeId,
     () => {
+        // 清空旧数据,确保重新渲染
+        solarTerms.value = [];
+        phenologyList.value = [];
+        // 触发数据重新加载
         getFarmWorkPlan();
-    },
-    { immediate: true }
+    }
 );
 </script>
 
@@ -471,8 +480,8 @@ watch(
             }
             .arranges {
                 display: flex;
-                max-width: calc(100vw - 86px);
-                gap: 5px;
+                max-width: calc(100vw - 84px);
+                gap: 10px;
                 letter-spacing: 0px;
                 .arrange-card {
                     width: 93%;
@@ -522,10 +531,23 @@ watch(
                             margin-left: 5px;
                         }
                     }
+                    .card-status{
+                        position: absolute;
+                        bottom: 0;
+                        right: 0;
+                        background: rgba(255, 149, 61, 0.1);
+                        border-radius: 3px;
+                        color: #FF953D;
+                        padding: 2px 6px;
+                        display: flex;
+                        align-items: center;
+                        gap: 4px;
+                        font-size: 12px;
+                    }
                     &::before {
                         content: "";
                         position: absolute;
-                        left: -6px;
+                        left: -5px;
                         top: 50%;
                         transform: translateY(-50%);
                         width: 0;
@@ -536,7 +558,7 @@ watch(
                     }
                 }
                 .arrange-card.normal-style {
-                    opacity: 0.4;
+                    opacity: 0.3;
                 }
                 .arrange-card.status-warning {
                     border-color: #ff953d;

+ 5 - 3
src/components/popup/interactPopup.vue

@@ -7,7 +7,7 @@
             <div class="form-item">
                 <div class="form-label">
                     <span class="required">*</span>
-                    请选择互动时间
+                    请选择互动阶段
                 </div>
                 <div class="form-input-wrapper">
                     <el-select v-model="formData.phenologyId" size="large" placeholder="请选择物候期" :editable="false">
@@ -23,7 +23,7 @@
             <div class="form-item">
                 <div class="form-label">
                     <span class="required">*</span>
-                    请选择强制触发互动时间
+                    请选择互动时间
                 </div>
                 <div class="form-input-wrapper">
                     <el-date-picker
@@ -44,7 +44,9 @@
                 <el-input
                     v-model="formData.interactionQuestion"
                     type="textarea"
-                    :rows="4"
+                    :rows="3"
+                    maxlength="35"
+                    show-word-limit
                     placeholder="请设置互动问题"
                     class="question-textarea"
                 />

+ 21 - 4
src/components/popup/tipPopup.vue

@@ -13,9 +13,13 @@
                 <div v-for="(line, index) in textLines" :key="index">{{ line }}</div>
             </div>
         </template>
-        <template v-else>
+        <template v-else-if="type === 'success'">
             <img class="tip-icon success-icon" src="@/assets/img/home/right.png" alt="" />
-            <div class="tip-text success-text">{{ text }}</div>
+            <div class="tip-text success-text">{{ text }} <span class="highlight-text">{{ highlightText }}</span></div>
+        </template>
+        <template v-else>
+            <img class="tip-icon success-icon" src="@/assets/img/home/create-farm-icon.png" alt="" />
+            <div class="tip-text success-text">{{ text }} <span class="highlight-text">{{ highlightText }}</span> {{ text2 }}</div>
         </template>
         <div class="tip-btn" @click.stop="handleBtnClick">
             {{ buttonText || (type === "create" ? "去创建农场" : "我知道了") }}
@@ -59,6 +63,16 @@ const props = defineProps({
         type: Boolean,
         default: true,
     },
+    // 高亮文字
+    highlightText: {
+        type: String,
+        default: "",
+    },
+    // 第二行文字
+    text2: {
+        type: String,
+        default: "",
+    },
 });
 
 const emit = defineEmits(["update:show", "confirm", "handleClickOverlay"]);
@@ -97,7 +111,7 @@ const handleClickOverlay = () => {
 
 <style scoped lang="scss">
 .tip-popup {
-    width: 75%;
+    width: 80%;
     padding: 28px 28px 20px;
     display: flex;
     flex-direction: column;
@@ -120,9 +134,12 @@ const handleClickOverlay = () => {
         margin-bottom: 32px;
         text-align: center;
         &.success-text {
-            font-size: 23px;
+            font-size: 22px;
             font-weight: 400;
         }
+        .highlight-text {
+            color: #2199f8;
+        }
     }
     .tip-btn {
         width: 100%;

+ 0 - 1
src/views/old_mini/home/index.vue

@@ -63,7 +63,6 @@ import { useRouter, useRoute } from "vue-router";
 import wx from "weixin-js-sdk";
 import tipPopup from "@/components/popup/tipPopup.vue";
 
-const curRole = localStorage.getItem("SET_USER_CUR_ROLE");
 const store = useStore();
 const tabBarHeight = computed(() => store.state.home.tabBarHeight);
 const router = useRouter();

+ 16 - 1
src/views/old_mini/mine/index.vue

@@ -45,6 +45,16 @@
         </div>
         <!-- 角色切换 -->
         <action-sheet :style="{ bottom: 50 + 'px' }" v-model:show="show" :actions="actions" @select="onSelect" />
+        <!-- 问题提醒 -->
+        <tip-popup
+            v-model:show="showTipPopup"
+            type="warning"
+            text="请设置"
+            highlightText="种植方案"
+            buttonText="去设置"
+            @confirm="handleBtn"
+            :closeOnClickOverlay="false"
+        />
     </div>
 </template>
 <script setup>
@@ -54,10 +64,15 @@ import { useStore } from "vuex";
 import wx from "weixin-js-sdk";
 import { ActionSheet } from "vant";
 import { SET_USER_CUR_ROLE } from "@/store/modules/app/type";
-
+import tipPopup from "@/components/popup/tipPopup.vue";
 const store = useStore();
 const router = useRouter();
 
+const showTipPopup = ref(false);
+const handleBtn = () => {
+    router.push("/plan?pageType=plant");
+};
+
 // 0: 农户, 1: 专家, 2:农资农服
 const curRole = ref(Number(localStorage.getItem("SET_USER_CUR_ROLE")));
 const roles = ref(JSON.parse(store.state.app.roles));

+ 75 - 14
src/views/old_mini/monitor/subPages/plan.vue

@@ -25,11 +25,18 @@
                     @change="handleTabChange"
                 />
             </div>
+            <div class="tip-box">
+                <Highlight
+                    :keywords="['关注农事/托管农事', '取消关注']"
+                    source-string="提示:关注农事/托管农事 会触发农情互动,并且为您推送农事,取消关注 会为您取消推送农事"
+                />
+            </div>
             <div
                 class="timeline-wrap"
                 :class="{
                     'timeline-container-plant-wrap': pageType == 'plant',
                     'timeline-container-no-permission-wrap': !hasPlanPermission,
+                    'no-default-plan-wrap': active !== tabs[0]?.id,
                 }"
             >
                 <farm-work-plan-timeline
@@ -43,14 +50,26 @@
                 />
             </div>
         </div>
-        <div class="custom-bottom-fixed-btns" :class="{'center':active === tabs[0]?.id}" v-has-permission="'农事规划'">
-            <div class="bottom-btn-group">
-                <div class="bottom-btn secondary-btn" @click="handlePhenologySetting" v-show="active !== tabs[0]?.id">物候期设置</div>
-                <div class="bottom-btn secondary-btn" v-if="pageType === 'plant'" @click="openCopyPlanPopup">
-                    {{ active === tabs[0]?.id ? "复制方案" : "方案设置" }}
+        <div class="custom-bottom-fixed-btns" :class="{ center: active === tabs[0]?.id }" v-has-permission="'农事规划'">
+            <div class="bottom-btn-group-wrap">
+                <div class="bottom-btn-group">
+                    <div
+                        class="bottom-btn secondary-btn"
+                        @click="handlePhenologySetting"
+                        v-show="active !== tabs[0]?.id"
+                    >
+                        物候期设置
+                    </div>
+                    <div class="bottom-btn secondary-btn" v-if="pageType === 'plant'" @click="openCopyPlanPopup">
+                        {{ active === tabs[0]?.id ? "复制方案" : "方案设置" }}
+                    </div>
                 </div>
+                <div class="bottom-btn primary-btn" @click="addNewTask" v-show="active !== tabs[0]?.id">新增农事</div>
             </div>
-            <div class="bottom-btn primary-btn" @click="addNewTask" v-show="active !== tabs[0]?.id">新增农事</div>
+            <template v-if="active !== tabs[0]?.id">
+                <div class="bottom-btn-divider"></div>
+                <div class="bottom-btn primary-btn submit-btn">提交方案</div>
+            </template>
         </div>
     </div>
     <!-- 农事信息弹窗 -->
@@ -100,21 +119,38 @@
         </div>
         <div class="phenology-footer" @click="handleConfirmPhenologySetting">确认设置</div>
     </Popup>
+
+    <tip-popup
+        v-model:show="showTipPopup"
+        type="warning"
+        text="请完善"
+        text2="信息"
+        highlightText="全托管方案"
+        buttonText="去完善"
+        @confirm="handleBtn"
+        :closeOnClickOverlay="false"
+    />
 </template>
 
 <script setup>
 import { ref, onMounted, computed } from "vue";
-import { Popup } from "vant";
+import { Popup, Highlight } from "vant";
 import customHeader from "@/components/customHeader.vue";
 import tabList from "@/components/pageComponents/TabList.vue";
 import FarmWorkPlanTimeline from "@/components/pageComponents/FarmWorkPlanTimeline.vue";
 import { useRouter, useRoute } from "vue-router";
 import detailDialog from "@/components/detailDialog.vue";
 import eventBus from "@/api/eventBus";
+import tipPopup from "@/components/popup/tipPopup.vue";
 import { ElMessage, ElMessageBox } from "element-plus";
 const router = useRouter();
 const route = useRoute();
 
+const showTipPopup = ref(false);
+const handleBtn = () => {
+    showTipPopup.value = false;
+};
+
 const userInfoStr = localStorage.getItem("localUserInfo");
 const userInfo = userInfoStr ? JSON.parse(userInfoStr) : {};
 // 检查是否有"农事规划"权限
@@ -382,31 +418,56 @@ const handleRowClick = (item) => {
                 margin-right: 8px;
             }
         }
-
+        .tip-box {
+            padding: 5px 10px;
+            background: rgba(33, 153, 248, 0.1);
+            border-radius: 5px;
+            font-size: 12px;
+            margin: 8px 10px;
+            color: #444;
+        }
         .timeline-wrap {
-            height: calc(100vh - 40px - 85px);
+            height: calc(100vh - 90px - 85px);
             padding: 0 12px;
             &.timeline-container-plant-wrap {
-                height: calc(100vh - 40px - 85px - 38px);
+                height: calc(100vh - 90px - 85px - 38px);
+            }
+            &.no-default-plan-wrap {
+                height: calc(100vh - 90px - 85px - 100px);
             }
             // 没有权限时,底部按钮不显示,高度增加 73px
             &.timeline-container-no-permission-wrap {
-                height: calc(100vh - 40px - 18px);
+                height: calc(100vh - 90px - 18px);
             }
         }
     }
     // 控制区域样式
     .custom-bottom-fixed-btns {
-        .bottom-btn-group {
+        flex-direction: column;
+        .bottom-btn-group-wrap {
             display: flex;
             gap: 12px;
+            justify-content: space-between;
+            .bottom-btn-group {
+                display: flex;
+                gap: 12px;
+            }
         }
-        &.center{
+        &.center {
             justify-content: center;
-            .bottom-btn{
+            .bottom-btn {
                 padding: 10px 45px;
             }
         }
+        .bottom-btn-divider {
+            width: calc(100% + 24px);
+            height: 1px;
+            background: #f0f0f0;
+            margin: 10px -12px;
+        }
+        .submit-btn {
+            padding: 10px 83px;
+        }
     }
 }
 .copy-plan-popup {