|
@@ -32,7 +32,7 @@
|
|
|
<!-- 未上传状态内容 -->
|
|
<!-- 未上传状态内容 -->
|
|
|
<div class="uploaded-content" v-show="item.isConfirmed == null">
|
|
<div class="uploaded-content" v-show="item.isConfirmed == null">
|
|
|
<div class="content-wrapper">
|
|
<div class="content-wrapper">
|
|
|
- <div class="item-desc">{{ item.question }}</div>
|
|
|
|
|
|
|
+ <div class="item-desc">{{ item.reason }}</div>
|
|
|
<div class="example-wrapper">
|
|
<div class="example-wrapper">
|
|
|
<div class="example-header">
|
|
<div class="example-header">
|
|
|
<div>示例照片</div>
|
|
<div>示例照片</div>
|
|
@@ -106,24 +106,34 @@
|
|
|
<span>照片上传进度</span>
|
|
<span>照片上传进度</span>
|
|
|
<el-progress class="upload-progress" :percentage="50" :stroke-width="10" :format="format" />
|
|
<el-progress class="upload-progress" :percentage="50" :stroke-width="10" :format="format" />
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="upload-wrap">
|
|
|
|
|
|
|
+ <div class="upload-box">
|
|
|
<!-- 把已经上传成功的图片传给 upload 组件做回显,同时保持原有上传事件不变 -->
|
|
<!-- 把已经上传成功的图片传给 upload 组件做回显,同时保持原有上传事件不变 -->
|
|
|
- <upload :maxCount="10" :initImgArr="imgArr" @handleUpload="handleUploadSuccess">
|
|
|
|
|
|
|
+ <upload :maxCount="10" :initImgArr="initImgArr" @handleUpload="handleUploadSuccess">
|
|
|
</upload>
|
|
</upload>
|
|
|
</div>
|
|
</div>
|
|
|
- <el-input v-model="uploadProgressText" placeholder="请输入您咨询的问题" clearable />
|
|
|
|
|
|
|
+ <div class="input-box">
|
|
|
|
|
+ <div class="input-item">
|
|
|
|
|
+ <span class="label-text">长势异常的果园占比</span>
|
|
|
|
|
+ <el-input v-model="uploadFormData.num" placeholder="请输入" type="number">
|
|
|
|
|
+ <template #suffix>
|
|
|
|
|
+ <span class="unit">%</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-input>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <el-input class="input-item" v-model="uploadFormData.text" placeholder="请输入您咨询的问题" clearable />
|
|
|
|
|
+ </div>
|
|
|
<div class="region-tips">勾画新发生区域,精准匹配专属农事方案</div>
|
|
<div class="region-tips">勾画新发生区域,精准匹配专属农事方案</div>
|
|
|
- <div class="region-map">
|
|
|
|
|
- <div class="region-map-text" @click="handleDrawRegion">点击勾画新发生区域</div>
|
|
|
|
|
|
|
+ <div class="region-map" ref="mapContainer" @click="handleDrawRegion">
|
|
|
|
|
+ <div class="region-map-text">点击勾画新发生区域</div>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="confirm-btn">确认上传</div>
|
|
|
|
|
|
|
+ <div class="confirm-btn" @click="handleConfirmUpload">确认上传</div>
|
|
|
</popup>
|
|
</popup>
|
|
|
|
|
|
|
|
<!-- 查看更多弹窗 -->
|
|
<!-- 查看更多弹窗 -->
|
|
|
<more-popup ref="morePopupRef" />
|
|
<more-popup ref="morePopupRef" />
|
|
|
</template>
|
|
</template>
|
|
|
<script setup>
|
|
<script setup>
|
|
|
-import { ref, onMounted } from "vue";
|
|
|
|
|
|
|
+import { ref, onMounted, onActivated } from "vue";
|
|
|
import { ElMessage } from "element-plus";
|
|
import { ElMessage } from "element-plus";
|
|
|
import { Uploader, Popup } from "vant";
|
|
import { Uploader, Popup } from "vant";
|
|
|
import customHeader from "@/components/customHeader.vue";
|
|
import customHeader from "@/components/customHeader.vue";
|
|
@@ -132,6 +142,7 @@ import FarmInfoPopup from "@/components/popup/farmInfoPopup.vue";
|
|
|
import ExamplePopup from "./components/examplePopup.vue";
|
|
import ExamplePopup from "./components/examplePopup.vue";
|
|
|
import { useRouter, useRoute } from "vue-router";
|
|
import { useRouter, useRoute } from "vue-router";
|
|
|
import { base_img_url2 } from "@/api/config";
|
|
import { base_img_url2 } from "@/api/config";
|
|
|
|
|
+import DrawRegionMap from "./map/drawRegionMap.js";
|
|
|
import UploadFile from "@/utils/upliadFile";
|
|
import UploadFile from "@/utils/upliadFile";
|
|
|
import { getFileExt } from "@/utils/util";
|
|
import { getFileExt } from "@/utils/util";
|
|
|
import MorePopup from "./components/morePopup.vue";
|
|
import MorePopup from "./components/morePopup.vue";
|
|
@@ -145,13 +156,40 @@ const query = ref(useRoute().query);
|
|
|
const morePopupRef = ref(null);
|
|
const morePopupRef = ref(null);
|
|
|
//照片上传进度
|
|
//照片上传进度
|
|
|
const showUploadProgressPopup = ref(false);
|
|
const showUploadProgressPopup = ref(false);
|
|
|
-const uploadProgressText = ref('');
|
|
|
|
|
|
|
+const uploadFormData = ref({
|
|
|
|
|
+ num: '',
|
|
|
|
|
+ text: ''
|
|
|
|
|
+});
|
|
|
const format = (percentage) => (percentage === 100 ? '上传完成' : `5/10`)
|
|
const format = (percentage) => (percentage === 100 ? '上传完成' : `5/10`)
|
|
|
|
|
|
|
|
|
|
+const drawRegionMap = new DrawRegionMap();
|
|
|
|
|
+const mapContainer = ref(null);
|
|
|
|
|
+
|
|
|
|
|
+// 从 sessionStorage 中回显已勾画的区域
|
|
|
|
|
+const renderRegionFromSession = () => {
|
|
|
|
|
+ const polygonStr = sessionStorage.getItem("drawRegionPolygonData");
|
|
|
|
|
+ console.log("polygonStr", polygonStr);
|
|
|
|
|
+ if (!polygonStr) return;
|
|
|
|
|
+ try {
|
|
|
|
|
+ const polygonData = JSON.parse(polygonStr);
|
|
|
|
|
+ if (polygonData && Array.isArray(polygonData.geometryArr) && polygonData.geometryArr.length > 0) {
|
|
|
|
|
+ // 先清空原有图层,再回显
|
|
|
|
|
+ drawRegionMap.clearLayer && drawRegionMap.clearLayer();
|
|
|
|
|
+ // needFitView 设为 true,让视图适配当前地块;同时传入面积用于只读模式展示“XX亩”
|
|
|
|
|
+ drawRegionMap.setAreaGeometry(polygonData.geometryArr, true, polygonData.mianji);
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
+ console.error("解析 drawRegionPolygonData 失败:", e);
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
const uploadFileObj = new UploadFile();
|
|
const uploadFileObj = new UploadFile();
|
|
|
-const imgArr = ref([]);
|
|
|
|
|
|
|
+const initImgArr = ref([]);
|
|
|
const miniUserId = localStorage.getItem("MINI_USER_ID");
|
|
const miniUserId = localStorage.getItem("MINI_USER_ID");
|
|
|
const afterReadUpload = async (data) => {
|
|
const afterReadUpload = async (data) => {
|
|
|
|
|
+ initImgArr.value = [];
|
|
|
|
|
+ drawRegionMap.clearLayer && drawRegionMap.clearLayer();
|
|
|
|
|
+ // sessionStorage.removeItem("drawRegionPolygonData");
|
|
|
if (!Array.isArray(data)) {
|
|
if (!Array.isArray(data)) {
|
|
|
data = [data];
|
|
data = [data];
|
|
|
}
|
|
}
|
|
@@ -166,7 +204,7 @@ const afterReadUpload = async (data) => {
|
|
|
file.status = "done";
|
|
file.status = "done";
|
|
|
file.message = "";
|
|
file.message = "";
|
|
|
if (resFilename) {
|
|
if (resFilename) {
|
|
|
- imgArr.value.push(resFilename)
|
|
|
|
|
|
|
+ initImgArr.value.push(resFilename)
|
|
|
} else {
|
|
} else {
|
|
|
file.status = 'failed';
|
|
file.status = 'failed';
|
|
|
file.message = '上传失败';
|
|
file.message = '上传失败';
|
|
@@ -174,8 +212,11 @@ const afterReadUpload = async (data) => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
// 所有文件上传结束后再打开进度弹窗,此时 imgArr 已包含全部图片
|
|
// 所有文件上传结束后再打开进度弹窗,此时 imgArr 已包含全部图片
|
|
|
- if (imgArr.value.length > 0) {
|
|
|
|
|
|
|
+ if (initImgArr.value.length > 0) {
|
|
|
showUploadProgressPopup.value = true;
|
|
showUploadProgressPopup.value = true;
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ drawRegionMap.initMap("POINT (113.6142086995688 23.585836479509055)", mapContainer.value, false, false,false);
|
|
|
|
|
+ }, 100);
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
// 示例照片轮播
|
|
// 示例照片轮播
|
|
@@ -270,7 +311,6 @@ const handleConfirm = async (item) => {
|
|
|
const { code, msg } = await VE_API.home.uploadAnswer(parmas);
|
|
const { code, msg } = await VE_API.home.uploadAnswer(parmas);
|
|
|
if (code === 0) {
|
|
if (code === 0) {
|
|
|
ElMessage.success("上传成功");
|
|
ElMessage.success("上传成功");
|
|
|
- sessionStorage.removeItem("drawRegionPolygonData");
|
|
|
|
|
// 清空上传数据
|
|
// 清空上传数据
|
|
|
uploadData.value = [];
|
|
uploadData.value = [];
|
|
|
// 刷新列表
|
|
// 刷新列表
|
|
@@ -280,20 +320,30 @@ const handleConfirm = async (item) => {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+const handleConfirmUpload = () => {
|
|
|
|
|
+ console.log("确认上传", uploadFormData.value);
|
|
|
|
|
+ showUploadProgressPopup.value = false;
|
|
|
|
|
+ sessionStorage.removeItem("drawRegionPolygonData");
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
// 切换展开/收起
|
|
// 切换展开/收起
|
|
|
const toggleExpand = (item) => {
|
|
const toggleExpand = (item) => {
|
|
|
item.expanded = !item.expanded;
|
|
item.expanded = !item.expanded;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const handleDrawRegion = (item) => {
|
|
const handleDrawRegion = (item) => {
|
|
|
- router.push(`/draw_region`)
|
|
|
|
|
- // router.push('/edit_map?type=edit')
|
|
|
|
|
|
|
+ console.log("勾画发生区域", item);
|
|
|
|
|
+ const polygonData = sessionStorage.getItem("drawRegionPolygonData");
|
|
|
|
|
+ if(polygonData){
|
|
|
|
|
+ router.push(`/draw_region?polygonData=${polygonData}`);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ router.push(`/draw_region`);
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const uploadData = ref([]);
|
|
const uploadData = ref([]);
|
|
|
const handleUploadSuccess = (data) => {
|
|
const handleUploadSuccess = (data) => {
|
|
|
uploadData.value = data.imgArr;
|
|
uploadData.value = data.imgArr;
|
|
|
- imgArr.value = [];
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const openMorePopup = (images) => {
|
|
const openMorePopup = (images) => {
|
|
@@ -308,6 +358,12 @@ onMounted(() => {
|
|
|
loadData();
|
|
loadData();
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+// 页面从勾画页返回时,如果组件被 keep-alive 缓存,则会触发 onActivated,在此再做一次回显
|
|
|
|
|
+onActivated(() => {
|
|
|
|
|
+ console.log("onActivated");
|
|
|
|
|
+ renderRegionFromSession();
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
const getFarmList = async () => {
|
|
const getFarmList = async () => {
|
|
|
const { data } = await VE_API.farm.userFarmSelectOption();
|
|
const { data } = await VE_API.farm.userFarmSelectOption();
|
|
|
if (data && data.length === 0) {
|
|
if (data && data.length === 0) {
|
|
@@ -616,10 +672,25 @@ const getFarmList = async () => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- .upload-wrap {
|
|
|
|
|
|
|
+ .upload-box {
|
|
|
margin-bottom: 12px;
|
|
margin-bottom: 12px;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ .input-box {
|
|
|
|
|
+ .input-item {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ gap: 6px;
|
|
|
|
|
+ .label-text{
|
|
|
|
|
+ width: 220px;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .input-item+.input-item {
|
|
|
|
|
+ margin-top: 6px;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
.region-tips {
|
|
.region-tips {
|
|
|
color: #2199F8;
|
|
color: #2199F8;
|
|
|
padding: 5px;
|
|
padding: 5px;
|
|
@@ -632,17 +703,18 @@ const getFarmList = async () => {
|
|
|
.region-map {
|
|
.region-map {
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
height: 168px;
|
|
height: 168px;
|
|
|
- background: red;
|
|
|
|
|
- border-radius: 5px;
|
|
|
|
|
- display: flex;
|
|
|
|
|
- align-items: center;
|
|
|
|
|
- justify-content: center;
|
|
|
|
|
|
|
+ clip-path: inset(0px round 5px);
|
|
|
|
|
+ position: relative;
|
|
|
|
|
|
|
|
.region-map-text {
|
|
.region-map-text {
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ bottom: 0;
|
|
|
|
|
+ right: 0;
|
|
|
color: #FFFFFF;
|
|
color: #FFFFFF;
|
|
|
padding: 5px 20px;
|
|
padding: 5px 20px;
|
|
|
border-radius: 5px;
|
|
border-radius: 5px;
|
|
|
background: rgba(0, 0, 0, 0.6);
|
|
background: rgba(0, 0, 0, 0.6);
|
|
|
|
|
+ z-index: 1;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|