|
|
@@ -995,6 +995,34 @@ const phenologyHasFarmWorkOnOrBeforeToday = (phenology) => {
|
|
|
return reproductives.some((r) => reproductiveHasFarmWorkOnOrBeforeToday(r));
|
|
|
};
|
|
|
|
|
|
+// 该生育期下:存在农事且「凡有有效展示日期的卡片」全部严格晚于今天 → 左侧本行不因节气规则变蓝(与右侧 future-card 一致)
|
|
|
+const reproductiveAllDatedFarmWorksStrictlyFuture = (reproductive) => {
|
|
|
+ const fws = Array.isArray(reproductive?.farmWorkArrangeList) ? reproductive.farmWorkArrangeList : [];
|
|
|
+ if (fws.length === 0) return false;
|
|
|
+ const dated = fws.filter((fw) => {
|
|
|
+ const ms = getFarmWorkTimelineDateMs(fw);
|
|
|
+ return !Number.isNaN(ms) && ms > 0;
|
|
|
+ });
|
|
|
+ if (dated.length === 0) return false;
|
|
|
+ return dated.every((fw) => isFarmWorkTimelineStrictlyFuture(fw));
|
|
|
+};
|
|
|
+
|
|
|
+// 物候期内:至少有一条农事带有效日期,且全部带有效日期的农事均为「严格未来」(无一 ≤ 今天)→ 最外层标题不因节气单独变蓝
|
|
|
+const phenologyAllDatedFarmWorksStrictlyFuture = (phenology) => {
|
|
|
+ const reproductives = Array.isArray(phenology?.reproductiveList) ? phenology.reproductiveList : [];
|
|
|
+ let anyDated = false;
|
|
|
+ for (const r of reproductives) {
|
|
|
+ const fws = Array.isArray(r?.farmWorkArrangeList) ? r.farmWorkArrangeList : [];
|
|
|
+ for (const fw of fws) {
|
|
|
+ const ms = getFarmWorkTimelineDateMs(fw);
|
|
|
+ if (Number.isNaN(ms) || ms <= 0) continue;
|
|
|
+ anyDated = true;
|
|
|
+ if (isFarmWorkDateOnOrBeforeToday(ms)) return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return anyDated;
|
|
|
+};
|
|
|
+
|
|
|
// 仅农事记录页(agri_record):该物候期内存在待认证农事时,左侧最外层物候期与各生育期/物候期文案均高亮为蓝;农事规划(agri_plan)不生效
|
|
|
const agriRecordHasPendingAuthInPhenology = (phenology) => {
|
|
|
if (props.pageType !== "agri_record") return false;
|
|
|
@@ -1061,6 +1089,7 @@ const shouldShowBlueBase = (phenology) => {
|
|
|
const shouldShowBlue = (phenology) => {
|
|
|
if (phenologyHasFarmWorkOnOrBeforeToday(phenology)) return true;
|
|
|
if (agriRecordHasPendingAuthInPhenology(phenology)) return true;
|
|
|
+ if (phenologyAllDatedFarmWorksStrictlyFuture(phenology)) return false;
|
|
|
return shouldShowBlueBase(phenology);
|
|
|
};
|
|
|
|
|
|
@@ -1068,6 +1097,7 @@ const shouldShowBlue = (phenology) => {
|
|
|
const shouldShowBlueLeft = (phenology, reproductive) => {
|
|
|
if (agriRecordHasPendingAuthInPhenology(phenology)) return true;
|
|
|
if (reproductiveHasFarmWorkOnOrBeforeToday(reproductive)) return true;
|
|
|
+ if (reproductiveAllDatedFarmWorksStrictlyFuture(reproductive)) return false;
|
|
|
return shouldShowBlueBase(phenology);
|
|
|
};
|
|
|
|