Browse Source

feat:修改bug

wangsisi 4 days ago
parent
commit
77df927ec9

+ 4 - 2
src/components/pageComponents/ArchivesFarmTimeLine.vue

@@ -1112,9 +1112,11 @@ watch(
                                 .left-date {
                                     color: #2199f8;
                                     border: 1px solid #2199f8;
-                                    padding: 1px 5px;
+                                    padding: 1px 0;
                                     border-radius: 2px;
                                     font-size: 12px;
+                                    width: 45px;
+                                    box-sizing: border-box;
                                 }
 
                                 .text {
@@ -1339,7 +1341,7 @@ watch(
 
     .timeline-term {
         position: absolute;
-        width: 32px;
+        width: 34px;
         display: flex;
         align-items: flex-start;
         flex-direction: column;

+ 3 - 3
src/views/old_mini/agri_record/index.vue

@@ -346,12 +346,12 @@ function handlePage(url) {
         width: 100%;
         height: 100%;
         background-color: rgba(0, 0, 0, 0.52);
-        z-index: 2;
+        z-index: 11;
     }
     .weather-info {
         width: calc(100% - 20px);
         position: absolute;
-        z-index: 3;
+        z-index: 12;
     }
     .archives-time-line {
         position: relative;
@@ -380,7 +380,7 @@ function handlePage(url) {
         }
         .archives-time-line-content {
             margin-top: 10px;
-            height: calc(100% - 35px);
+            height: calc(100% - 32px);
             background: #fff;
             border-radius: 8px;
             padding: 10px;

+ 7 - 0
src/views/old_mini/create_farm/index.vue

@@ -715,6 +715,13 @@ function getSpecieList() {
         // 只保留名称包含“荔枝”的品类
         const litchiList = list.filter((item) => item?.name && item.name.includes("荔枝"));
         specieList.value = litchiList;
+        // 非编辑模式且当前未选择品类时,默认选中第一项
+        if (route.query.type !== "edit" && !ruleForm.speciesItem && litchiList.length > 0) {
+            const first = { value: litchiList[0].id, ...litchiList[0] };
+            ruleForm.speciesItem = first;
+            // 同步触发品类变更逻辑(加载品种、自动生成农场名等)
+            changeSpecie(first);
+        }
         return litchiList;
     });
 }

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

@@ -261,6 +261,7 @@ onActivated(() => {
             query: { reload: route.query.reload },
         });
     }
+    sessionStorage.removeItem('interactionListScrollTop');
 });
 
 const userType = ref(localStorage.getItem("USER_TYPE"));

+ 1 - 1
src/views/old_mini/home/subPages/knowledgeList.vue

@@ -129,7 +129,7 @@ const formatDate = (dateStr) => {
 };
 
 const handleItemClick = (item) => {
-    router.push(`/warning_detail?id=${item.id}`);
+    router.push(`/warning_detail?id=${item.id}&showImage=true`);
 };
 </script>
 <style lang="scss" scoped>

+ 30 - 10
src/views/old_mini/interactionList/index.vue

@@ -1,6 +1,6 @@
 <template>
     <custom-header name="农情互动" bgColor="#f2f4f5"></custom-header>
-    <div class="interaction-list">
+    <div class="interaction-list" ref="interactionListRef">
         <div class="list-item" v-for="(item, index) in listData" :key="item.id || index"
             :class="{ 'uploaded-item': item.questionStatus !== 3 }">
             <!-- 标题区域 -->
@@ -21,7 +21,8 @@
             <!-- 未上传状态内容 -->
             <div class="uploaded-content" v-show="item.questionStatus === 3 || item.expanded">
                 <div class="content-wrapper">
-                    <text-ellipsis class="item-desc" rows="2" :content="item.remark + item.reason" expand-text="展开"
+                    <span>{{ item.remark }}</span>
+                    <text-ellipsis class="item-desc" rows="0" :content="item.reason" expand-text="展开"
                         collapse-text="收起" />
                     <div class="tip-box">如果不确定是否发生,直接上传照片即可</div>
                     <div class="example-wrapper">
@@ -190,7 +191,7 @@
     <more-popup ref="morePopupRef" />
 </template>
 <script setup>
-import { ref, onMounted, onActivated, computed, onUnmounted } from "vue";
+import { ref, onActivated, computed, onUnmounted } from "vue";
 import { ElMessage } from "element-plus";
 import { Uploader, Popup, TextEllipsis } from "vant";
 import customHeader from "@/components/customHeader.vue";
@@ -205,6 +206,9 @@ import UploadFile from "@/utils/upliadFile";
 import { getFileExt } from "@/utils/util";
 import MorePopup from "./components/morePopup.vue";
 
+const interactionListRef = ref(null);
+const SCROLL_KEY = 'interactionListScrollTop';
+
 const showDroneConsultPopup = ref(false);
 const handleShowDroneConsultPopup = () => {
     // showDroneConsultPopup.value = true;
@@ -530,6 +534,8 @@ const handleConfirm = async (item, isConfirm) => {
         uploadData.value = [];
         // 刷新列表
         await refreshList();
+        sessionStorage.removeItem("drawRegionPolygonData");
+        sessionStorage.removeItem("drawRegionInteractionId");
     } else {
         ElMessage.error(msg || '上传失败');
     }
@@ -587,6 +593,11 @@ const handleDrawRegion = (item) => {
     // 记录本次勾画对应的互动项 id,上传时若是同一项则保留回显,否则清除避免数据串
     sessionStorage.setItem("drawRegionInteractionId", String(item.id));
     const polygonData = sessionStorage.getItem("drawRegionPolygonData");
+    // 记录当前滚动位置
+    const container = interactionListRef.value;
+    if (container && typeof container.scrollTop === 'number') {
+        sessionStorage.setItem(SCROLL_KEY, String(container.scrollTop));
+    }
 
     if (item.rangeWkt && item.rangeWkt.length > 10) {
         router.push(`/draw_region?polygonData=${polygonData}&rangeWkt=${item.rangeWkt}&updatedTime=${item.updatedTime.slice(0, 10)}`);
@@ -597,7 +608,6 @@ const handleDrawRegion = (item) => {
             router.push(`/draw_region`);
         }
     }
-
 };
 
 onUnmounted(() => {
@@ -630,22 +640,31 @@ const onCopyWechatId = () => {
 };
 
 const oldUser = ref(false);
-onMounted(() => {
+// 页面从勾画页返回时,如果组件被 keep-alive 缓存,则会触发 onActivated,在此再做一次回显
+onActivated(() => {
     // 初始化加载
     getFarmList();
     // 加载数据
     loadData();
+    renderRegionFromSession();
+    // 恢复滚动位置
+    const container = interactionListRef.value;
+    const savedTop = sessionStorage.getItem(SCROLL_KEY);
+    if (container && savedTop != null) {
+        const top = Number(savedTop);
+        if (!Number.isNaN(top)) {
+            // 延迟一点,等 DOM 渲染完成后再滚动
+            setTimeout(() => {
+                container.scrollTop = top;
+            }, 0);
+        }
+    }
     oldUser.value = query.value.oldUser && Boolean(query.value.oldUser);
     if (oldUser.value) {
         showFarmInfoPopup.value = true;
     }
 });
 
-// 页面从勾画页返回时,如果组件被 keep-alive 缓存,则会触发 onActivated,在此再做一次回显
-onActivated(() => {
-    renderRegionFromSession();
-});
-
 const getFarmList = async () => {
     const { data } = await VE_API.farm.userFarmSelectOption();
     if (data && data.length === 0) {
@@ -805,6 +824,7 @@ const handleSubmitAll = () => {
                 .item-desc {
                     color: #3C3C3C;
                     margin-bottom: 10px;
+                    display: inline-block;
                 }
 
                 .tip-box {

+ 4 - 3
src/views/old_mini/monitor/index.vue

@@ -92,6 +92,7 @@ const isDefaultFarm = ref(false);
 const weatherInfoRef = ref(null);
 const hasReport = ref(false);
 onActivated(() => {
+    sessionStorage.removeItem('interactionListScrollTop');
     // 用来接收我的农场跳转过来的农场详情逻辑
     if (route.query.isHeaderShow) {
         isHeaderShow.value = true;
@@ -395,13 +396,13 @@ const getReport = () => {
         width: 100%;
         height: 100%;
         background-color: rgba(0, 0, 0, 0.52);
-        z-index: 2;
+        z-index: 11;
     }
 
     .weather-info {
         width: calc(100% - 20px);
         position: absolute;
-        z-index: 3;
+        z-index: 12;
     }
 
     .archives-time-line {
@@ -435,7 +436,7 @@ const getReport = () => {
 
         .archives-time-line-content {
             margin-top: 10px;
-            height: calc(100% - 35px);
+            height: calc(100% - 32px);
             background: #fff;
             border-radius: 8px;
             padding: 10px;