|
|
@@ -1,10 +1,6 @@
|
|
|
<template>
|
|
|
- <custom-header name="农场信息" bgColor="#f2f3f5"></custom-header>
|
|
|
+ <custom-header name="农场基本信息" bgColor="#f2f3f5"></custom-header>
|
|
|
<div class="farm-details-page">
|
|
|
- <div class="map-wrap info-card">
|
|
|
- <div class="map-area" ref="mapContainer"></div>
|
|
|
- <div class="map-text" @click="handleEditMap">点击编辑地块</div>
|
|
|
- </div>
|
|
|
<div class="info-box info-card">
|
|
|
<div class="section-header">
|
|
|
<div class="line-title">基本信息</div>
|
|
|
@@ -19,113 +15,101 @@
|
|
|
<span class="info-value">{{ farmInfo.subjectName }}</span>
|
|
|
</div>
|
|
|
<div class="info-row">
|
|
|
- <span class="info-label">联系人:</span>
|
|
|
- <span class="info-value">{{ farmInfo.contactName }}</span>
|
|
|
- </div>
|
|
|
- <div class="info-row center-row">
|
|
|
- <span class="info-label">联系电话:</span>
|
|
|
- <span class="info-value">{{ farmInfo.contactPhone }}</span>
|
|
|
- </div>
|
|
|
- <div class="info-row">
|
|
|
- <span class="info-label">种植面积:</span>
|
|
|
+ <span class="info-label">农场面积:</span>
|
|
|
<span class="info-value">{{ farmInfo.farmArea }}亩</span>
|
|
|
</div>
|
|
|
<div class="info-row">
|
|
|
<span class="info-label">农场位置:</span>
|
|
|
<span class="info-value">{{ farmInfo.farmAddress }}</span>
|
|
|
</div>
|
|
|
- <div class="info-row">
|
|
|
- <span class="info-label">种植品种:</span>
|
|
|
- <div class="info-value crop-tags">
|
|
|
- <span v-for="crop in farmInfo.regionList" :key="crop.regionId" class="crop-tag">
|
|
|
- {{ crop.regionName }}
|
|
|
- </span>
|
|
|
- </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="info-box info-card">
|
|
|
+ <div class="section-header">
|
|
|
+ <div class="line-title">土壤性质</div>
|
|
|
+ <div class="edit-btn" @click="handleEditSoil">编辑信息</div>
|
|
|
+ </div>
|
|
|
+ <div class="info-list grid-list">
|
|
|
+ <div class="grid-item">
|
|
|
+ <div class="grid-value">壤土</div>
|
|
|
+ <div class="grid-name">质地</div>
|
|
|
+ </div>
|
|
|
+ <div class="grid-item">
|
|
|
+ <div class="grid-value">1%</div>
|
|
|
+ <div class="grid-name">有机质</div>
|
|
|
</div>
|
|
|
+ <div class="grid-item">
|
|
|
+ <div class="grid-value">5.5</div>
|
|
|
+ <div class="grid-name">PH</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="info-box info-card">
|
|
|
+ <div class="section-header">
|
|
|
+ <div class="line-title">历史高发风险</div>
|
|
|
+ <div class="edit-btn only-text" @click="handleEditFarmFacility">查看更多<el-icon><ArrowRight /></el-icon></div>
|
|
|
+ </div>
|
|
|
+ <div class="info-list">
|
|
|
+ <span class="text-label">物候风险:</span> 风险描述风险描述风险描述风险描述风险
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="info-box info-card">
|
|
|
<div class="section-header">
|
|
|
- <div class="line-title">农场设施</div>
|
|
|
- <div class="edit-btn" @click="handleEditFarmFacility">编辑信息</div>
|
|
|
+ <div class="line-title">种植类别</div>
|
|
|
</div>
|
|
|
<div class="info-list">
|
|
|
<div class="info-row">
|
|
|
- <span class="info-label">灌溉方式:</span>
|
|
|
+ <span class="info-label">过往种植:</span>
|
|
|
<div class="info-value crop-tags">
|
|
|
- <span v-for="method in basicFarmInfo.irrigation" :key="method.code" class="crop-tag">
|
|
|
- {{ method.name }}
|
|
|
+ <span v-for="crop in farmInfo.regionList" :key="crop.regionId" class="crop-tag dark-tag">
|
|
|
+ {{ crop.regionName }}
|
|
|
</span>
|
|
|
+ <span class="crop-tag border-tag" @click="handleAddVariety">+新增品种</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="info-row line-break">
|
|
|
+ <div class="info-label">当季作物:</div>
|
|
|
+ <div class="season-box">
|
|
|
+ <div class="info-value crop-tags">
|
|
|
+ <span class="crop-tag">
|
|
|
+ 桂味
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div class="season-content">
|
|
|
+ <div class="season-item">桂味-上市时间:06.08</div>
|
|
|
+ <div class="season-item">桂味-上市时间:06.08</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="season-box">
|
|
|
+ <div class="info-value crop-tags">
|
|
|
+ <span class="crop-tag">
|
|
|
+ 桂味
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div class="season-content">
|
|
|
+ <div class="season-item">桂味-上市时间:06.08</div>
|
|
|
+ <div class="season-item">桂味-上市时间:06.08</div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<FarmInfoPopup ref="farmInfoPopupRef" :farmId="route.query.subjectId" @success="fetchFarmSubjectDetail" />
|
|
|
+
|
|
|
+ <SoilPopup ref="soilPopupRef" />
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref, onMounted, nextTick } from "vue";
|
|
|
+import { ref, onMounted } from "vue";
|
|
|
import customHeader from "@/components/customHeader.vue";
|
|
|
import { useRouter, useRoute } from "vue-router";
|
|
|
-import DrawRegionMap from "@/views/old_mini/interactionList/map/drawRegionMap.js";
|
|
|
-import * as util from "@/common/ol_common.js";
|
|
|
-import { ElMessage } from "element-plus";
|
|
|
-import { useStore } from "vuex";
|
|
|
import FarmInfoPopup from "@/views/old_mini/home/components/farmInfoPopup.vue";
|
|
|
+import SoilPopup from "./soilPopup.vue";
|
|
|
|
|
|
const router = useRouter();
|
|
|
const route = useRoute();
|
|
|
-const store = useStore();
|
|
|
const farmInfo = ref({});
|
|
|
-const mapContainer = ref(null);
|
|
|
-const drawRegionMap = new DrawRegionMap();
|
|
|
-
|
|
|
-const initMap = () => {
|
|
|
- if (!mapContainer.value) return;
|
|
|
- if (drawRegionMap.kmap) return;
|
|
|
-
|
|
|
- const info = farmInfo.value || {};
|
|
|
-
|
|
|
- drawRegionMap.initMap(info.farmLocation, mapContainer.value, false, true, false);
|
|
|
-
|
|
|
- // 回显农场区域,多边形 WKT 数组(有就画,没有就不画)
|
|
|
- let geometryArr = [];
|
|
|
-
|
|
|
- // 优先使用 regionList 里的 geom:有值才渲染
|
|
|
- if (Array.isArray(info.regionList) && info.regionList.length > 0) {
|
|
|
- info.regionList.forEach((item) => {
|
|
|
- if (item?.geom) {
|
|
|
- geometryArr.push(item?.geom)
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- if (geometryArr.length) {
|
|
|
- // 农场信息页:地块用绿色展示;第三参留空表示面积仍按地块自动计算
|
|
|
- drawRegionMap.setAreaGeometry(Array.from(geometryArr), true, undefined, {
|
|
|
- fill: "rgba(0, 57, 44, 0.5)",
|
|
|
- stroke: "#18AA8B",
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- // 在区域中心落一个点位(使用与勾画页相同的图标)
|
|
|
- try {
|
|
|
- const geom = util.wktCastGeom(info.farmLocation);
|
|
|
- if (geom && typeof geom.getFirstCoordinate === "function") {
|
|
|
- const coord = geom.getFirstCoordinate();
|
|
|
- drawRegionMap.setMapPoint(coord);
|
|
|
- }
|
|
|
- } catch (e) {
|
|
|
- // 解析失败则忽略点位
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
-const destroyMap = () => {
|
|
|
- if (drawRegionMap && drawRegionMap.kmap && drawRegionMap.destroyMap) {
|
|
|
- drawRegionMap.destroyMap();
|
|
|
- }
|
|
|
-};
|
|
|
|
|
|
onMounted(() => {
|
|
|
fetchFarmSubjectDetail();
|
|
|
@@ -135,10 +119,6 @@ onMounted(() => {
|
|
|
function fetchFarmSubjectDetail() {
|
|
|
VE_API.basic_farm.fetchFarmSubjectDetail({ subjectId: route.query.subjectId }).then(({ data }) => {
|
|
|
farmInfo.value = data || {};
|
|
|
- nextTick(() => {
|
|
|
- destroyMap();
|
|
|
- initMap();
|
|
|
- });
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@@ -186,25 +166,13 @@ const handleEditFarmInfo = () => {
|
|
|
farmInfoPopupRef.value.handleShow();
|
|
|
};
|
|
|
|
|
|
-const handleEditFarmFacility = () => {
|
|
|
- router.push(`/prescription?subjectId=${route.query.subjectId}`);
|
|
|
+const soilPopupRef = ref(null);
|
|
|
+const handleEditSoil = () => {
|
|
|
+ soilPopupRef.value.open();
|
|
|
};
|
|
|
|
|
|
-// 点击编辑地块
|
|
|
-const handleEditMap = () => {
|
|
|
- const mapCenter = farmInfo.value.farmLocation || undefined;
|
|
|
- if (farmInfo.value.regionList.length) {
|
|
|
- // type=view 进入查看态;rangeWkt 用于回显多个地块
|
|
|
- router.push({
|
|
|
- path: "/draw_area",
|
|
|
- query: {
|
|
|
- type: "viewOnly",
|
|
|
- subjectId: route.query.subjectId
|
|
|
- },
|
|
|
- });
|
|
|
- } else {
|
|
|
- ElMessage.warning("暂无种植作物,无法编辑地块");
|
|
|
- }
|
|
|
+const handleEditFarmFacility = () => {
|
|
|
+ router.push(`/prescription?subjectId=${route.query.subjectId}`);
|
|
|
};
|
|
|
|
|
|
const handleAddVariety = () => {
|
|
|
@@ -244,28 +212,6 @@ const handleAddVariety = () => {
|
|
|
padding: 10px;
|
|
|
}
|
|
|
|
|
|
- .map-wrap {
|
|
|
- position: relative;
|
|
|
-
|
|
|
- .map-area {
|
|
|
- width: 100%;
|
|
|
- height: 142px;
|
|
|
- clip-path: inset(0px round 5px);
|
|
|
- }
|
|
|
-
|
|
|
- .map-text {
|
|
|
- position: absolute;
|
|
|
- right: 13px;
|
|
|
- bottom: 16px;
|
|
|
- font-size: 12px;
|
|
|
- color: #ffffff;
|
|
|
- background: rgba(0, 0, 0, 0.5);
|
|
|
- padding: 8px 12px;
|
|
|
- border-radius: 25px;
|
|
|
- border: 1px solid rgba(255, 255, 255, 0.5);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
.info-box {
|
|
|
margin-top: 12px;
|
|
|
|
|
|
@@ -288,6 +234,9 @@ const handleAddVariety = () => {
|
|
|
border-radius: 999px;
|
|
|
border: 0.5px solid #d0d3d8;
|
|
|
background-color: #ffffff;
|
|
|
+ &.only-text {
|
|
|
+ border: none;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.info-list {
|
|
|
@@ -299,12 +248,16 @@ const handleAddVariety = () => {
|
|
|
align-items: flex-start;
|
|
|
margin-bottom: 6px;
|
|
|
|
|
|
+ &.line-break {
|
|
|
+ display: block;
|
|
|
+ }
|
|
|
+
|
|
|
&.center-row {
|
|
|
align-items: center;
|
|
|
}
|
|
|
|
|
|
.info-label {
|
|
|
- min-width: 80px;
|
|
|
+ min-width: 70px;
|
|
|
color: #4E5969;
|
|
|
}
|
|
|
|
|
|
@@ -320,6 +273,15 @@ const handleAddVariety = () => {
|
|
|
color: #2199f8;
|
|
|
border-radius: 2px;
|
|
|
font-size: 12px;
|
|
|
+ height: 22px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ &.dark-tag {
|
|
|
+ background: #F8F8F8;
|
|
|
+ color: #7F7F7F;
|
|
|
+ }
|
|
|
+ &.border-tag {
|
|
|
+ border: 0.5px solid #2199F8;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -376,6 +338,48 @@ const handleAddVariety = () => {
|
|
|
gap: 4px;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ .season-box {
|
|
|
+ padding-top: 8px;
|
|
|
+ .season-content {
|
|
|
+ display: grid;
|
|
|
+ grid-template-columns: repeat(2, 1fr);
|
|
|
+ gap: 2px;
|
|
|
+ .season-item {
|
|
|
+ padding-top: 6px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .text-label {
|
|
|
+ color: #4E5969;
|
|
|
+ }
|
|
|
+
|
|
|
+ .grid-list {
|
|
|
+ display: grid;
|
|
|
+ grid-template-columns: repeat(3, 1fr);
|
|
|
+ gap: 6px;
|
|
|
+ .grid-item {
|
|
|
+ background: #F5F5F5;
|
|
|
+ border-radius: 5px;
|
|
|
+ padding: 3px;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ height: 50px;
|
|
|
+ .grid-value {
|
|
|
+ font-size: 16px;
|
|
|
+ color: #1D2129;
|
|
|
+ // line-height: 22px;
|
|
|
+ }
|
|
|
+ .grid-name {
|
|
|
+ // line-height: 14px;
|
|
|
+ font-size: 12px;
|
|
|
+ color: rgba(78, 89, 105, 0.5);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</style>
|