|
@@ -186,7 +186,7 @@ import customHeader from "@/components/customHeader.vue";
|
|
|
import PhenologyTrackTimelineItem from "@/components/pageComponents/PhenologyTrackTimelineItem.vue";
|
|
import PhenologyTrackTimelineItem from "@/components/pageComponents/PhenologyTrackTimelineItem.vue";
|
|
|
import GrowthStageTimeline from "@/components/pageComponents/GrowthStageTimeline.vue";
|
|
import GrowthStageTimeline from "@/components/pageComponents/GrowthStageTimeline.vue";
|
|
|
import UploadProgressPopup from "@/components/popup/UploadProgressPopup.vue";
|
|
import UploadProgressPopup from "@/components/popup/UploadProgressPopup.vue";
|
|
|
-import { ref, onMounted } from 'vue';
|
|
|
|
|
|
|
+import { ref, onMounted, watch } from 'vue';
|
|
|
import { useRouter, useRoute } from 'vue-router';
|
|
import { useRouter, useRoute } from 'vue-router';
|
|
|
import { Uploader, TextEllipsis } from "vant";
|
|
import { Uploader, TextEllipsis } from "vant";
|
|
|
import { ElMessage } from "element-plus";
|
|
import { ElMessage } from "element-plus";
|
|
@@ -301,12 +301,10 @@ const beforeReadUpload = (file) => {
|
|
|
return true;
|
|
return true;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-const curStage = ref({})
|
|
|
|
|
|
|
+const curStage = ref({});
|
|
|
|
|
+
|
|
|
function onStageScrollSettled(index, stage) {
|
|
function onStageScrollSettled(index, stage) {
|
|
|
- console.log('index',index)
|
|
|
|
|
- console.log('stage',stage)
|
|
|
|
|
- curStage.value = stage
|
|
|
|
|
- // index:当前节点下标;stage:当前项(含 label、tags、periodTitle 等)
|
|
|
|
|
|
|
+ if (stage) curStage.value = stage;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const hanldeSubmit = () =>{
|
|
const hanldeSubmit = () =>{
|
|
@@ -426,6 +424,23 @@ const growthStages = ref([
|
|
|
},
|
|
},
|
|
|
]);
|
|
]);
|
|
|
|
|
|
|
|
|
|
+/** 与 GrowthStageTimeline 默认档一致:未绑 v-model 时用中间索引 */
|
|
|
|
|
+function syncCurStageFromModel() {
|
|
|
|
|
+ const stages = growthStages.value;
|
|
|
|
|
+ if (!Array.isArray(stages) || !stages.length) return;
|
|
|
|
|
+ const n = stages.length;
|
|
|
|
|
+ let i = growthStageIndex.value;
|
|
|
|
|
+ if (i === undefined || i === null) {
|
|
|
|
|
+ i = Math.max(0, Math.floor((n - 1) / 2));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ i = Math.min(Math.max(0, i), n - 1);
|
|
|
|
|
+ }
|
|
|
|
|
+ const stage = stages[i];
|
|
|
|
|
+ if (stage) curStage.value = stage;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+watch([growthStages, growthStageIndex], syncCurStageFromModel, { immediate: true });
|
|
|
|
|
+
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
getWorkDetail();
|
|
getWorkDetail();
|
|
|
getFarmRecord()
|
|
getFarmRecord()
|