|
|
@@ -27,19 +27,20 @@
|
|
|
<div class="example-wrapper">
|
|
|
<div class="example-header">
|
|
|
<div>示例照片</div>
|
|
|
- <div class="more" v-if="item.exampleImagesJson.length > 3"
|
|
|
- @click="openMorePopup(item.exampleImagesJson,item)">查看更多</div>
|
|
|
+ <div class="more" v-if="item.exampleImageWithAnnotations.length > 3"
|
|
|
+ @click="openMorePopup(item)">查看更多</div>
|
|
|
</div>
|
|
|
- <div class="example-list" v-if="item.exampleImagesJson.length > 0">
|
|
|
- <div class="image-item-wrapper" v-for="(example, exIndex) in item.exampleImagesJson"
|
|
|
- :key="example" @click="showExample(item,item.exampleImagesJson, exIndex)">
|
|
|
- <img class="image-item" :src="example" alt="" />
|
|
|
+ <div class="example-list" v-if="item.exampleImageWithAnnotations.length > 0">
|
|
|
+ <div class="image-item-wrapper"
|
|
|
+ v-for="(example, exIndex) in item.exampleImageWithAnnotations"
|
|
|
+ :key="example.exampleImageUrl" @click="showExample(item, exIndex)">
|
|
|
+ <img class="image-item" :src="example.exampleImageUrl" alt="" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<text-ellipsis class="patrol-suggestion" rows="2" :content="'巡园建议:' + item.patrolSuggestion">
|
|
|
<template #action="{ expanded }"><span class="action-text">{{ expanded ? '收起' : '展开'
|
|
|
- }}</span></template>
|
|
|
+ }}</span></template>
|
|
|
</text-ellipsis>
|
|
|
</div>
|
|
|
|
|
|
@@ -50,7 +51,7 @@
|
|
|
<!-- 图片展示 -->
|
|
|
<div class="uploaded-images">
|
|
|
<div class="uploaded-img-wrap" v-for="(image, imgIndex) in item.imagePaths" :key="image"
|
|
|
- @click="showExample(item,item.imagePaths.map(p => base_img_url2 + p), imgIndex, { hideLabel: true })">
|
|
|
+ @click="showExample(item, imgIndex, { hideLabel: true })">
|
|
|
<img class="uploaded-img" :src="base_img_url2 + image" alt="" />
|
|
|
<span v-show="item.questionStatus === 3" class="uploaded-img-remove"
|
|
|
@click.stop="removeUploadedImage(item, imgIndex)">×</span>
|
|
|
@@ -119,9 +120,11 @@
|
|
|
:style="{ justifyContent: item.expanded ? 'center' : 'space-between' }">
|
|
|
<template v-if="!item.expanded">
|
|
|
<span class="proportion-text">{{(item.questionList && item.questionList.length
|
|
|
- ? item.questionList.map((q, i) => q + ':' + (item.answerValues[i] ?? '') + (item.indicators[i]?.unit
|
|
|
- ?? item.indicators[0]?.unit ?? '%')).join('')
|
|
|
- : item.question + ':' + (item.answerValues[0] ?? '') + (item.indicators[0]?.unit ?? '%')) }}</span>
|
|
|
+ ? item.questionList.map((q, i) => q + ':' + (item.answerValues[i] ?? '') +
|
|
|
+ (item.indicators[i]?.unit
|
|
|
+ ?? item.indicators[0]?.unit ?? '%')).join('')
|
|
|
+ : item.question + ':' + (item.answerValues[0] ?? '') + (item.indicators[0]?.unit ?? '%'))
|
|
|
+ }}</span>
|
|
|
</template>
|
|
|
<div class="toggle-btn" @click="toggleExpand(item)">
|
|
|
<span>{{ item.expanded ? "收起" : "展开" }}</span>
|
|
|
@@ -146,8 +149,8 @@
|
|
|
<drone-consult-popup v-model:show="showDroneConsultPopup" @copy="onCopyWechatId" />
|
|
|
|
|
|
<!-- 示例照片轮播组件 -->
|
|
|
- <example-popup v-model:show="showExamplePopup" :images="exampleList" :tips="currentPhotData?.shootingMethod" :start-index="exampleStartIndex" :title="currentPhotData?.exampleImageAnnotation"
|
|
|
- :show-title-and-tips="exampleShowTitleAndTips" />
|
|
|
+ <example-popup v-model:show="showExamplePopup" :images="exampleList" :tips="currentPhotData?.shootingMethod"
|
|
|
+ :start-index="exampleStartIndex" :show-title-and-tips="exampleShowTitleAndTips" />
|
|
|
<!-- 照片上传进度 -->
|
|
|
|
|
|
<popup v-model:show="showUploadProgressPopup" round class="upload-progress-popup">
|
|
|
@@ -185,9 +188,6 @@
|
|
|
|
|
|
<!-- 查看更多弹窗 -->
|
|
|
<more-popup ref="morePopupRef" />
|
|
|
-
|
|
|
- <tip-popup v-model:show="showTipPopup" type="success" text="您的农情报告已生成
|
|
|
- 请查看" buttonText="查看报告" @confirm="handleBtn" :zIndex="9999" />
|
|
|
</template>
|
|
|
<script setup>
|
|
|
import { ref, onMounted, onActivated, computed, onUnmounted } from "vue";
|
|
|
@@ -204,14 +204,6 @@ import DrawRegionMap from "./map/drawRegionMap.js";
|
|
|
import UploadFile from "@/utils/upliadFile";
|
|
|
import { getFileExt } from "@/utils/util";
|
|
|
import MorePopup from "./components/morePopup.vue";
|
|
|
-import tipPopup from "@/components/popup/tipPopup.vue";
|
|
|
-
|
|
|
-
|
|
|
-const showTipPopup = ref(false)
|
|
|
-const handleBtn = () => {
|
|
|
- console.log('00')
|
|
|
-}
|
|
|
-
|
|
|
|
|
|
const showDroneConsultPopup = ref(false);
|
|
|
const handleShowDroneConsultPopup = () => {
|
|
|
@@ -452,9 +444,9 @@ const exampleList = ref([]);
|
|
|
const exampleStartIndex = ref(0);
|
|
|
const exampleShowTitleAndTips = ref(true);
|
|
|
const currentPhotData = ref({})
|
|
|
-const showExample = (item, list, index, options = {}) => {
|
|
|
+const showExample = (item, index, options = {}) => {
|
|
|
currentPhotData.value = item;
|
|
|
- exampleList.value = list || [];
|
|
|
+ exampleList.value = options?.hideLabel ? item.imagePaths.map(p => ({exampleImageUrl: base_img_url2 + p})) : item.exampleImageWithAnnotations || [];
|
|
|
exampleStartIndex.value = index || 0;
|
|
|
exampleShowTitleAndTips.value = options.hideLabel !== true;
|
|
|
showExamplePopup.value = true;
|
|
|
@@ -467,22 +459,6 @@ const loadData = async () => {
|
|
|
try {
|
|
|
const { data } = await VE_API.home.listTriggeredByFarm({ farmId: localStorage.getItem("selectedFarmId") })
|
|
|
listData.value = data.map(item => {
|
|
|
- // 将 exampleImagesJson 转换为数组
|
|
|
- if (item.exampleImagesJson) {
|
|
|
- try {
|
|
|
- item.exampleImagesJson = typeof item.exampleImagesJson === 'string'
|
|
|
- ? JSON.parse(item.exampleImagesJson)
|
|
|
- : item.exampleImagesJson;
|
|
|
- // 确保是数组格式
|
|
|
- if (!Array.isArray(item.exampleImagesJson)) {
|
|
|
- item.exampleImagesJson = [];
|
|
|
- }
|
|
|
- } catch (e) {
|
|
|
- item.exampleImagesJson = [];
|
|
|
- }
|
|
|
- } else {
|
|
|
- item.exampleImagesJson = [];
|
|
|
- }
|
|
|
// question 按 || 切割成数组,用于循环渲染
|
|
|
const questionStr = item.question != null ? String(item.question) : '';
|
|
|
item.questionList = questionStr
|
|
|
@@ -524,7 +500,7 @@ const removeUploadedImage = (item, imgIndex) => {
|
|
|
const handleConfirm = async (item, isConfirm) => {
|
|
|
if (isConfirm) {
|
|
|
const list = item.questionList || [];
|
|
|
- const needFill = list.length || 1;
|
|
|
+ // const needFill = list.length || 1;
|
|
|
// const hasEmpty = Array.from({ length: needFill }, (_, i) => i).some(
|
|
|
// (i) => item.answerValues[i] === '' || item.answerValues[i] === null || item.answerValues[i] === undefined
|
|
|
// );
|
|
|
@@ -546,6 +522,7 @@ const handleConfirm = async (item, isConfirm) => {
|
|
|
replyText: item.replyText,
|
|
|
answerValues: item.answerValues
|
|
|
}
|
|
|
+ await VE_API.home.uploadAnswerData(parmas);
|
|
|
const { code, msg } = await VE_API.home.uploadAnswer(parmas);
|
|
|
if (code === 0) {
|
|
|
ElMessage.success("上传成功");
|
|
|
@@ -612,7 +589,7 @@ const handleDrawRegion = (item) => {
|
|
|
const polygonData = sessionStorage.getItem("drawRegionPolygonData");
|
|
|
|
|
|
if (item.rangeWkt && item.rangeWkt.length > 10) {
|
|
|
- router.push(`/draw_region?polygonData=${polygonData}&rangeWkt=${item.rangeWkt}&updatedTime=${item.updatedTime.slice(0,10)}`);
|
|
|
+ router.push(`/draw_region?polygonData=${polygonData}&rangeWkt=${item.rangeWkt}&updatedTime=${item.updatedTime.slice(0, 10)}`);
|
|
|
} else {
|
|
|
if (polygonData) {
|
|
|
router.push(`/draw_region?polygonData=${polygonData}`);
|
|
|
@@ -637,13 +614,13 @@ const handleUploadSuccess = (data) => {
|
|
|
uploadedSuccessCount.value = len;
|
|
|
};
|
|
|
|
|
|
-const openMorePopup = (images, item) => {
|
|
|
- const data = images.map(image => {
|
|
|
+const openMorePopup = (item) => {
|
|
|
+ const data = item.exampleImageWithAnnotations.map(exampleItem => {
|
|
|
return {
|
|
|
- name: item.exampleImageAnnotation,
|
|
|
- image: image
|
|
|
+ ...exampleItem,
|
|
|
+ shootingMethod: item.shootingMethod,
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
morePopupRef.value.setItems(data);
|
|
|
morePopupRef.value.openPopup();
|
|
|
}
|
|
|
@@ -1008,6 +985,7 @@ const handleSubmitAll = () => {
|
|
|
margin: 12px 0 6px;
|
|
|
box-sizing: border-box;
|
|
|
width: 100%;
|
|
|
+
|
|
|
.question-text {
|
|
|
background: #ffffff;
|
|
|
color: #6f6f6f;
|
|
|
@@ -1023,7 +1001,7 @@ const handleSubmitAll = () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- .question-text + .question-text {
|
|
|
+ .question-text+.question-text {
|
|
|
margin-top: 6px;
|
|
|
}
|
|
|
|