|
|
@@ -1,8 +1,14 @@
|
|
|
<template>
|
|
|
<div class="plan-page">
|
|
|
- <custom-header name="农事规划"></custom-header>
|
|
|
+ <custom-header :name="pageType === 'plant' ? '种植方案' : '农事规划'"></custom-header>
|
|
|
<div class="plan-content">
|
|
|
- <div class="timeline-container" ref="timelineContainerRef">
|
|
|
+ <div class="plan-content-header" v-if="pageType === 'plant'">
|
|
|
+ <el-select class="select-item" v-model="value" placeholder="选择品类">
|
|
|
+ <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
+ </el-select>
|
|
|
+ <tab-list type="light" v-model="active" :tabs="tabs" @change="handleTabChange" />
|
|
|
+ </div>
|
|
|
+ <div class="timeline-container" ref="timelineContainerRef" :class="{ 'timeline-container-plant': pageType === 'plant' }">
|
|
|
<div class="timeline-list" :style="getListStyle">
|
|
|
<div class="timeline-middle-line"></div>
|
|
|
<!-- 物候期覆盖条(progress 为起点,progress2 为终点,单位 %) -->
|
|
|
@@ -88,12 +94,17 @@
|
|
|
<!-- 新增:激活上传弹窗 -->
|
|
|
<active-upload-popup ref="activeUploadPopupRef" @handleUploadSuccess="getFarmWorkPlan"></active-upload-popup>
|
|
|
<!-- 互动设置弹窗 -->
|
|
|
- <interact-popup ref="interactPopupRef" @handleSaveSuccess="getFarmWorkPlan" @handleDeleteInteract="handleDeleteInteract"></interact-popup>
|
|
|
+ <interact-popup
|
|
|
+ ref="interactPopupRef"
|
|
|
+ @handleSaveSuccess="getFarmWorkPlan"
|
|
|
+ @handleDeleteInteract="handleDeleteInteract"
|
|
|
+ ></interact-popup>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
import { ref, onMounted, computed, nextTick } from "vue";
|
|
|
import customHeader from "@/components/customHeader.vue";
|
|
|
+import tabList from "@/components/pageComponents/TabList.vue";
|
|
|
import { useRouter, useRoute } from "vue-router";
|
|
|
import detailDialog from "@/components/detailDialog.vue";
|
|
|
import eventBus from "@/api/eventBus";
|
|
|
@@ -120,7 +131,41 @@ const getCurrentSeason = () => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+const active = ref(1);
|
|
|
+const tabs = ref([
|
|
|
+ {
|
|
|
+ id: 1,
|
|
|
+ name: "标准化方案",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 2,
|
|
|
+ name: "全托管方案",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 3,
|
|
|
+ name: "半托管方案",
|
|
|
+ },
|
|
|
+]);
|
|
|
+const handleTabChange = (id, item) => {
|
|
|
+ active.value = id;
|
|
|
+ console.log(id, item);
|
|
|
+};
|
|
|
+
|
|
|
+const value = ref("1");
|
|
|
+const options = ref([
|
|
|
+ {
|
|
|
+ value: "1",
|
|
|
+ label: "荔枝",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: "2",
|
|
|
+ label: "全托管方案",
|
|
|
+ },
|
|
|
+]);
|
|
|
+
|
|
|
+const pageType = ref("");
|
|
|
onMounted(() => {
|
|
|
+ pageType.value = route.query.pageType || "";
|
|
|
getFarmWorkPlan();
|
|
|
});
|
|
|
|
|
|
@@ -214,9 +259,9 @@ const handleEdit = (item) => {
|
|
|
if (interactPopupRef.value) {
|
|
|
interactPopupRef.value.showPopup({
|
|
|
arrangeIdVal: item.id,
|
|
|
- interactTitleVal: item.farmWorkName || '梢期杀虫', // 使用农事名称作为标题
|
|
|
- interactTimeVal: item.interactTime || '', // 如果有已保存的互动时间
|
|
|
- forceTriggerTimeVal: item.forceTriggerTime || '', // 如果有已保存的强制触发时间
|
|
|
+ interactTitleVal: item.farmWorkName || "梢期杀虫", // 使用农事名称作为标题
|
|
|
+ interactTimeVal: item.interactTime || "", // 如果有已保存的互动时间
|
|
|
+ forceTriggerTimeVal: item.forceTriggerTime || "", // 如果有已保存的强制触发时间
|
|
|
interactQuestionVal: item.interactQuestion, // 如果有已保存的互动问题
|
|
|
});
|
|
|
}
|
|
|
@@ -264,7 +309,7 @@ const getListStyle = computed(() => {
|
|
|
const minP = minProgress.value;
|
|
|
const maxP = maxProgress.value;
|
|
|
const range = Math.max(1, maxP - minP); // 避免除0
|
|
|
- const total = (solarTerms.value?.length || 0) * 250;
|
|
|
+ const total = (solarTerms.value?.length || 0) * 450;
|
|
|
const minH = total; // 无上下留白
|
|
|
return { minHeight: `${minH}px` };
|
|
|
});
|
|
|
@@ -274,7 +319,7 @@ const getTermStyle = (t) => {
|
|
|
const minP = minProgress.value;
|
|
|
const maxP = maxProgress.value;
|
|
|
const range = Math.max(1, maxP - minP); // 避免除0
|
|
|
- const total = (solarTerms.value?.length || 0) * 250;
|
|
|
+ const total = (solarTerms.value?.length || 0) * 450;
|
|
|
// 将progress映射到0开始的位置,最小progress对应top: 0
|
|
|
const normalizedP = range > 0 ? ((p - minP) / range) * 100 : 0;
|
|
|
const top = (normalizedP / 100) * total;
|
|
|
@@ -305,7 +350,7 @@ const handleSeasonClick = (seasonValue) => {
|
|
|
const minP = minProgress.value;
|
|
|
const maxP = maxProgress.value;
|
|
|
const range = Math.max(1, maxP - minP);
|
|
|
- const total = (solarTerms.value?.length || 0) * 250;
|
|
|
+ const total = (solarTerms.value?.length || 0) * 450;
|
|
|
const normalizedP = range > 0 ? ((p - minP) / range) * 100 : 0;
|
|
|
const targetTop = (normalizedP / 100) * total; // 内容内的像素位置
|
|
|
const wrap = timelineContainerRef.value;
|
|
|
@@ -327,7 +372,7 @@ const getPhenologyBarStyle = (item) => {
|
|
|
const minP = minProgress.value;
|
|
|
const maxP = maxProgress.value;
|
|
|
const range = Math.max(1, maxP - minP);
|
|
|
- const total = (solarTerms.value?.length || 0) * 250; // 有效绘制区高度(px)
|
|
|
+ const total = (solarTerms.value?.length || 0) * 450; // 有效绘制区高度(px)
|
|
|
// 将progress映射到0开始的位置
|
|
|
const normalizedStart = range > 0 ? ((start - minP) / range) * 100 : 0;
|
|
|
const normalizedEnd = range > 0 ? ((end - minP) / range) * 100 : 0;
|
|
|
@@ -393,7 +438,7 @@ const getPhenologyBarHeight = (item) => {
|
|
|
const minP = minProgress.value;
|
|
|
const maxP = maxProgress.value;
|
|
|
const range = Math.max(1, maxP - minP);
|
|
|
- const total = (solarTerms.value?.length || 0) * 250;
|
|
|
+ const total = (solarTerms.value?.length || 0) * 450;
|
|
|
// 将progress映射到0开始的位置
|
|
|
const normalizedStart = range > 0 ? ((start - minP) / range) * 100 : 0;
|
|
|
const normalizedEnd = range > 0 ? ((end - minP) / range) * 100 : 0;
|
|
|
@@ -409,22 +454,42 @@ const getReproductiveItemHeight = (phenologyItem) => {
|
|
|
// 如果列表为空,返回 barHeight;否则等分
|
|
|
return listLength > 0 ? barHeight / listLength : barHeight;
|
|
|
};
|
|
|
-
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
.plan-page {
|
|
|
width: 100%;
|
|
|
height: 100vh;
|
|
|
- background: #fff;
|
|
|
+ background: #f5f7fb;
|
|
|
.plan-content {
|
|
|
padding: 12px 0;
|
|
|
+ .plan-content-header {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ gap: 12px;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ margin-left: 12px;
|
|
|
+ .select-item{
|
|
|
+ width: 82px;
|
|
|
+ ::v-deep {
|
|
|
+ .el-select__wrapper {
|
|
|
+ box-shadow: none;
|
|
|
+ border-radius: 25px;
|
|
|
+ border: 0.5px solid rgba(153, 153, 153, 0.5);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
.timeline-container {
|
|
|
height: calc(100vh - 40px - 73px);
|
|
|
overflow: auto;
|
|
|
position: relative;
|
|
|
box-sizing: border-box;
|
|
|
padding: 0 12px;
|
|
|
+ &.timeline-container-plant{
|
|
|
+ height: calc(100vh - 40px - 73px - 38px);
|
|
|
+ }
|
|
|
.timeline-list {
|
|
|
position: relative;
|
|
|
}
|
|
|
@@ -588,7 +653,7 @@ const getReproductiveItemHeight = (phenologyItem) => {
|
|
|
width: 100%;
|
|
|
height: 46px;
|
|
|
line-height: 30px;
|
|
|
- background: #fff;
|
|
|
+ background: #f5f7fb;
|
|
|
font-size: 13px;
|
|
|
word-break: break-all;
|
|
|
writing-mode: vertical-rl;
|