|
|
@@ -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 {
|