| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284 |
- <template>
- <div class="agricultural-detail">
- <custom-header name="农事详情"></custom-header>
- <div class="detail-content">
- <div class="card-wrap" v-if="route.query.title !== '气象风险'">
- <div class="card-box photo-card">
- <div class="card-title">
- <span>农情照片</span>
- <span class="date">{{ imgInfo.samplingTime }}</span>
- </div>
- <div class="ratio-tip" :class="archiveColorObj[route.query.title]">
- <div class="title">{{ route.query.title }}</div>
- <span class="content van-ellipsis">{{ route.query.content }}</span>
- </div>
- <!-- <div class="location-tip">
- 由于系统审核,某些照片拍摄位置与农场相差超 3 公里,请在农场现场使用水印相机重新拍摄上传,谢谢配合
- </div> -->
- <div class="photo-grid">
- <div v-for="(photo, index) in imgInfo.imageList" :key="photo.id" class="photo-item"
- @click="handlePhotoClick(index)">
- <img :src="photo.url" alt="农情照片" />
- </div>
- </div>
- </div>
- <div class="card-box region-card">
- <div class="card-title">区域勾选</div>
- <div class="map-container" ref="mapContainer"></div>
- </div>
- </div>
- <div class="card-wrap" v-else>
- <div class="card-box risk-card">
- <div class="card-title">
- <span>农情详情</span>
- <span class="date">2025.05.06</span>
- </div>
- <img class="risk-image" src="" alt="">
- <div class="risk-content">
- <p class="risk-highlight">
- <span class="risk-title">高湿风险:</span>
- <span class="risk-text">预计未来7天平均相对湿度≥85%,伴随间歇性小雨或雾天。</span>
- </p>
- <p>潜在危害:田间湿度过高极易诱发霜疫霉病、炭疽病等真菌病害,病菌侵染幼果后导致腐烂、脱落。影响幼果正常发育和果皮着色,可能造成裂果、烂果。</p>
- <p>高湿环境利于蒂蛀虫等害虫繁殖,成虫活动增加,增加后期虫果率。</p>
- <div class="warning-tip">预警等级:黄色预警(中等风险),建议在未来48小时内启动预防措施。</div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script setup>
- import { useRoute } from "vue-router";
- import { ref, onActivated, computed } from "vue";
- import customHeader from "@/components/customHeader.vue";
- import { showImagePreview } from 'vant';
- import IndexMap from "@/views/old_mini/common_map/index.js";
- const route = useRoute();
- const mapContainer = ref(null);
- const indexMap = new IndexMap();
- const previewImages = computed(() => {
- const list = imgInfo.value?.imageList || [];
- return list.map((item) => item?.url).filter(Boolean);
- });
- const archiveColorObj = {
- '管理信息': "green",
- '异常发现': "red",
- '气象风险': "orange",
- // '气象风险': "yellow",
- };
- const handlePhotoClick = (index) => {
- const images = previewImages.value;
- const safeIndex = Math.min(Math.max(Number(index) || 0, 0), Math.max(images.length - 1, 0));
- showImagePreview({
- images,
- startPosition: safeIndex,
- closeable: true,
- showIndex: true,
- });
- };
- onActivated(() => {
- // getFarmImagePage();
- if(route.query.title !== '气象风险') {
- indexMap.initMap('POINT(113.6142086995688 23.585836479509055)', mapContainer.value);
- }
- });
- const imgInfo = ref({});
- const getFarmImagePage = () => {
- VE_API.monitor.getFarmImagePage({
- id: route.query.id
- }).then((res) => {
- if (res.code === 0) {
- imgInfo.value = res.data;
- }
- });
- };
- </script>
- <style lang="scss" scoped>
- .agricultural-detail {
- min-height: 100vh;
- width: 100%;
- background: #f2f3f5;
- .detail-content {
- padding: 12px;
- padding-bottom: 24px;
- box-sizing: border-box;
- .card-wrap {
- .card-box {
- background: #fff;
- border-radius: 8px;
- padding: 12px 16px;
- box-sizing: border-box;
- .card-title {
- font-size: 16px;
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin-bottom: 12px;
- .date {
- font-size: 12px;
- color: rgba(0, 0, 0, 0.2);
- }
- }
- }
- .sampling-card {
- .sampling-title {
- font-size: 16px;
- font-weight: 500;
- color: #333;
- margin-bottom: 6px;
- }
- .sampling-desc {
- font-size: 14px;
- color: rgba(0, 0, 0, 0.5);
- }
- }
- .photo-card {
- .ratio-tip {
- font-size: 14px;
- padding: 5px 8px;
- background: rgba(33, 153, 248, 0.08);
- border-radius: 5px;
- display: flex;
- align-items: center;
-
- .title {
- font-size: 12px;
- color: #fff;
- margin-right: 12px;
- background: #2199f8;
- padding: 2px 6px;
- border-radius: 2px;
- }
- .content {
- max-width: 210px;
- }
- &.green {
- background: rgba(71, 184, 129, 0.1);
- .title {
- background: #47B881;
- }
- }
- &.red {
- background: rgba(255, 78, 78, 0.1);
- .title {
- background: #FF4E4E;
- }
- }
- &.orange {
- background: rgba(255, 148, 61, 0.1);
- .title {
- background: #FF943D;
- }
- }
- }
- .location-tip {
- margin-top: 12px;
- padding: 5px 10px;
- border: 1px solid #FF953D;
- border-radius: 5px;
- color: #FA7406;
- }
- .photo-grid {
- margin-top: 12px;
- display: grid;
- grid-template-columns: repeat(4, 1fr);
- grid-gap: 6px;
- .photo-item {
- position: relative;
- width: 100%;
- padding-bottom: 100%;
- border-radius: 8px;
- overflow: hidden;
- background: #e5f5e5;
- img {
- position: absolute;
- inset: 0;
- width: 100%;
- height: 100%;
- object-fit: cover;
- display: block;
- }
- }
- }
- }
- .risk-card {
- .risk-image {
- width: 100%;
- height: 170px;
- border-radius: 5px;
- margin-bottom: 12px;
- background: #ff8a3d;
- }
- .risk-content {
- line-height: 22px;
- border-radius: 5px;
- padding: 5px 8px;
- background: rgba(190, 190, 190, 0.11);
- p {
- margin: 0 0 12px;
- }
- .risk-highlight {
- .risk-title {
- font-weight: 500;
- color: #FFAA14;
- }
- }
- }
- .warning-tip {
- border-radius: 5px;
- background: rgba(255, 177, 41, 0.1);
- color: #FFAA14;
- font-size: 14px;
- line-height: 22px;
- font-weight: 500;
- padding: 5px 8px;
- }
- }
- .region-card {
- margin-top: 10px;
- .map-container {
- width: 100%;
- height: 170px;
- clip-path: inset(0px round 5px);
- }
- }
- }
- }
- }
- .image-popup {
- width: 327px;
- border-radius: 8px;
- .popup-content {
- width: 100%;
- }
- }
- </style>
|