|
|
@@ -302,23 +302,35 @@ const beforeReadUpload = (file) => {
|
|
|
};
|
|
|
|
|
|
const curStage = ref({});
|
|
|
-
|
|
|
-function onStageScrollSettled(index, stage) {
|
|
|
+const curCode = ref('')
|
|
|
+function onStageScrollSettled(index, stage, code) {
|
|
|
if (stage) curStage.value = stage;
|
|
|
+ curCode.value = code ?? stage?.phenophase_code ?? "";
|
|
|
+}
|
|
|
+
|
|
|
+/** 从节点文案如「60%展开」中取出百分数,转为 0~1,如 60% -> 0.6 */
|
|
|
+function labelPercentToProgress(label) {
|
|
|
+ if (typeof label !== "string" || !label.trim()) return 0;
|
|
|
+ const m = label.match(/(\d+(?:\.\d+)?)\s*%/);
|
|
|
+ if (!m) return 0;
|
|
|
+ return Number(m[1]) / 100;
|
|
|
}
|
|
|
|
|
|
const hanldeSubmit = () =>{
|
|
|
const farmData = JSON.parse(localStorage.getItem('selectedFarmData'))
|
|
|
- const time = new Date().toLocaleDateString()
|
|
|
+ const time = new Date().toISOString()
|
|
|
const params = {
|
|
|
farm_id:farmData.farm_id,
|
|
|
farm_variety:farmData.farm_variety,
|
|
|
- current_code:'',
|
|
|
- new_start_date: time,
|
|
|
- progress:''
|
|
|
+ current_code:curCode.value,
|
|
|
+ new_start_date: time.slice(0,10),
|
|
|
+ progress: labelPercentToProgress(curStage.value.label),
|
|
|
}
|
|
|
- console.log(params)
|
|
|
- // VE_API.monitor.farmPhenologyAdjust(params)
|
|
|
+ VE_API.monitor.farmPhenologyAdjust(params).then(res =>{
|
|
|
+ if(res.code === 200){
|
|
|
+ ElMessage.success('确认成功')
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
const afterReadUpload = async (data) => {
|
|
|
@@ -437,6 +449,7 @@ function syncCurStageFromModel() {
|
|
|
}
|
|
|
const stage = stages[i];
|
|
|
if (stage) curStage.value = stage;
|
|
|
+ curCode.value = stage?.phenophase_code ?? "";
|
|
|
}
|
|
|
|
|
|
watch([growthStages, growthStageIndex], syncCurStageFromModel, { immediate: true });
|
|
|
@@ -498,6 +511,7 @@ const getFindPhenologyInfo = async () => {
|
|
|
tags: Array.isArray(t.tags) ? t.tags : [],
|
|
|
periodTitle: item.phenophase_name ?? '',
|
|
|
periodSubtitle: item.phenophase_discribe ?? '',
|
|
|
+ phenophase_code: item.phenophase_code ?? item.phenophaseCode ?? '',
|
|
|
});
|
|
|
}
|
|
|
}
|