ArchivesFarmTimeLine.vue 55 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360
  1. <template>
  2. <div class="timeline-container" ref="timelineContainerRef">
  3. <div class="timeline-list" ref="timelineListRef">
  4. <empty v-if="isEmpty" image="https://birdseye-img.sysuimars.com/birdseye-look-mini/custom-empty-image.png"
  5. image-size="80" description="暂无数据" class="empty-state" />
  6. <template v-else>
  7. <div class="timeline-middle-line"></div>
  8. <div v-for="(t, tIdx) in phenologyStartDates" :key="`term-${uniqueTimestamp}-${tIdx}`"
  9. class="timeline-term" :style="getTermStyle(t, tIdx)">
  10. <span class="term-name">{{ formatDate(t.startDate) }}</span>
  11. </div>
  12. <div v-for="(p, idx) in phenologyList" :key="`phenology-${uniqueTimestamp}-${idx}`"
  13. class="phenology-bar">
  14. <div class="phenology-title"
  15. :class="{ 'phenology-red': !shouldShowBlue(p), 'phenology-blue': shouldShowBlue(p) }"
  16. v-if="p.reproductiveList[0]?.phenologyName === getNextPhenologyName(idx, 0)">
  17. {{ p.reproductiveList[0]?.phenologyName }}
  18. </div>
  19. <div v-for="(r, rIdx) in Array.isArray(p.reproductiveList) ? p.reproductiveList : []"
  20. :key="`reproductive-${uniqueTimestamp}-${idx}-${rIdx}`" class="reproductive-item">
  21. <div class="arranges">
  22. <div v-for="(fw, aIdx) in Array.isArray(r.farmWorkArrangeList) ? r.farmWorkArrangeList : []"
  23. :key="`arrange-${uniqueTimestamp}-${idx}-${rIdx}-${aIdx}`" class="arrange-card" :class="[
  24. getArrangeStatusClass(fw),
  25. {
  26. 'last-card':
  27. aIdx === r.farmWorkArrangeList.length - 1 &&
  28. rIdx !== r.farmWorkArrangeList.length - 1,
  29. },
  30. // 右侧农事卡片跟随物候期颜色:未来节气对应的农事卡片置灰
  31. { 'future-card': !shouldShowBlue(p) },
  32. ]" @click="handleRowClick(fw)">
  33. <div class="card-content">
  34. <div class="card-left" :style="{ width: fw.sourceDataJson && fw.sourceDataJson.resFilename ? 'calc(100% - 45px)' : '100%' }" v-if="pageType === 'agri_plan'">
  35. <div class="left-info">
  36. <div class="left-date">{{ formatDate(fw.createTime) }}</div>
  37. <div class="text" @click.stop="handleStatusDetail(fw)">
  38. <span class="van-ellipsis">{{ fw.title}}</span>
  39. <el-icon v-if="shouldShowBlue(p)"><ArrowRight /></el-icon>
  40. </div>
  41. <!-- <div class="text green van-ellipsis" v-if="fw?.sourceType === 7">
  42. 执行者:{{ fw.sourceDataJson.executorName }}
  43. </div> -->
  44. </div>
  45. <div class="title-text van-ellipsis" v-if="shouldShowBlue(p)">{{ fw.title }}</div>
  46. </div>
  47. <div class="card-left agri-record-card" v-else>
  48. <div class="left-info">
  49. <div class="left-date">{{ formatDate(fw.recommendDate) }}</div>
  50. <div class="text van-ellipsis" @click.stop="handleStatusDetail(fw)">
  51. <span class="text-name">{{ fw.farmWorkName }}</span>
  52. <el-icon class="text-icon"><ArrowRight /></el-icon>
  53. </div>
  54. </div>
  55. <div class="title-wrap van-ellipsis" v-show="shouldShowBlue(p)">
  56. <div class="title-text" v-if="fw.flowStatus != null">{{ fw.flowStatus == null ? '未激活' : '已激活' }}</div>
  57. <!-- <div class="expert-info">
  58. <el-avatar :size="14" src="https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png" />
  59. <span>专家下发</span>
  60. </div> -->
  61. </div>
  62. </div>
  63. <div class="card-right"
  64. v-if="fw.sourceDataJson && fw.sourceDataJson.resFilename && fw.sourceDataJson.resFilename.length > 0 || fw.sourceType === 7"
  65. @click.stop="handleImageClick(fw)">
  66. <img v-if="fw.sourceType === 7"
  67. :src="base_img_url2 + fw.sourceDataJson?.executeImageUrls?.[0]" alt="" />
  68. <img v-else :src="base_img_url2 + fw.sourceDataJson?.resFilename?.[0]?.filename"
  69. alt="" />
  70. <div class="num" v-if="fw?.sourceDataJson?.imageIds || fw.sourceType === 7">
  71. {{ fw?.sourceDataJson?.imageIds?.length ||
  72. fw?.sourceDataJson?.executeImageUrls?.length || 0 }}
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. <template v-if="r.name === r.phenologyName">
  79. <div class="phenology-name single"
  80. :class="{ 'phenology-red': !shouldShowBlue(p), 'phenology-blue': shouldShowBlue(p) }"
  81. :style="r.phenologyName === getNextPhenologyName(idx, rIdx) ? 'padding: 6px 0;' : ''">
  82. {{ r.name }}
  83. </div>
  84. </template>
  85. <template v-else>
  86. <template v-if="r.phenologyName === getNextPhenologyName(idx, rIdx)">
  87. <div class="phenology-name"
  88. :class="{ 'text-red': !shouldShowBlue(p), 'text-blue': shouldShowBlue(p) }">
  89. {{ r.name }}
  90. </div>
  91. </template>
  92. <template v-else>
  93. <div class="phenology-name"
  94. :class="{ 'text-red': !shouldShowBlue(p), 'text-blue': shouldShowBlue(p) }">
  95. {{ r.name }}
  96. </div>
  97. <div class="phenology-name mr" :class="{
  98. 'phenology-red': !shouldShowBlue(p),
  99. 'phenology-blue': shouldShowBlue(p),
  100. }">
  101. {{ r.phenologyName }}
  102. </div>
  103. </template>
  104. </template>
  105. </div>
  106. </div>
  107. </template>
  108. </div>
  109. </div>
  110. <!-- 图片弹窗 -->
  111. <popup v-model:show="showImagePopup" class="image-popup" z-index="9999" teleport="body">
  112. <album-carousel class="popup-content" :key="imageList?.length" labelText="" :imgData="currentImageData"
  113. :images="imageList" :imgType="imgType" disableClick></album-carousel>
  114. </popup>
  115. </template>
  116. <script setup>
  117. import { ref, nextTick, watch, onMounted, onUnmounted, computed } from "vue";
  118. import { useRouter } from "vue-router";
  119. import { ElMessage } from "element-plus";
  120. import { Empty, Popup } from "vant";
  121. import { base_img_url2 } from "@/api/config";
  122. import AlbumCarousel from "@/components/album_compoents/albumCarousel";
  123. const router = useRouter();
  124. const props = defineProps({
  125. // 农场 ID,用于请求农事规划数据
  126. farmId: {
  127. type: [String, Number],
  128. default: null,
  129. },
  130. // 是否禁用所有点击事件(用于只读展示)
  131. disableClick: {
  132. type: Boolean,
  133. default: false,
  134. },
  135. // 是否是标准农事
  136. isStandard: {
  137. type: Boolean,
  138. default: false,
  139. },
  140. // 方案ID
  141. schemeId: {
  142. type: [Number, String],
  143. default: null,
  144. },
  145. // 类型:agri_record / agri_plan
  146. pageType: {
  147. type: String,
  148. default: "agri_plan",
  149. },
  150. });
  151. const farmWorkType = {
  152. 0: "预警农事",
  153. 1: "标准农事",
  154. 2: "建议农事",
  155. 3: "自建农事",
  156. };
  157. const emits = defineEmits(["row-click"]);
  158. const solarTerms = ref([]);
  159. const phenologyList = ref([]);
  160. // 从物候期列表中提取起始时间,用于时间轴显示
  161. const phenologyStartDates = computed(() => {
  162. if (!phenologyList.value || phenologyList.value.length === 0) {
  163. return [];
  164. }
  165. // 从每个物候期中提取起始时间,并去重排序
  166. const startDatesMap = new Map();
  167. phenologyList.value.forEach((phenology) => {
  168. if (phenology.startDate) {
  169. const dateKey = phenology.startDate;
  170. // 如果该日期还没有添加过,或者需要更新信息
  171. if (!startDatesMap.has(dateKey)) {
  172. startDatesMap.set(dateKey, {
  173. startDate: phenology.startDate,
  174. id: phenology.id || `phenology-${dateKey}`,
  175. });
  176. }
  177. }
  178. });
  179. // 转换为数组并按时间排序
  180. const result = Array.from(startDatesMap.values()).sort((a, b) => {
  181. const timeA = safeParseDate(a.startDate);
  182. const timeB = safeParseDate(b.startDate);
  183. if (isNaN(timeA) || isNaN(timeB)) return 0;
  184. return timeA - timeB;
  185. });
  186. return result;
  187. });
  188. const timelineContainerRef = ref(null);
  189. const timelineListRef = ref(null);
  190. // 标记是否为首次加载
  191. const isInitialLoad = ref(true);
  192. // 存储timeline-list的实际渲染高度
  193. const timelineListHeight = ref(0);
  194. // 生成唯一的时间戳,用于确保key的唯一性
  195. const uniqueTimestamp = ref(Date.now());
  196. // ResizeObserver 实例,用于监听高度变化
  197. let resizeObserver = null;
  198. // 标记是否为空数据
  199. const isEmpty = ref(false);
  200. // 控制图片弹窗显示/隐藏
  201. const showImagePopup = ref(false);
  202. // 标记是否正在请求数据,防止重复请求
  203. const isRequesting = ref(false);
  204. // 记录上一次请求的 farmId,避免相同 farmId 重复请求
  205. const lastRequestedFarmId = ref(null);
  206. // 获取当前季节
  207. const getCurrentSeason = () => {
  208. const month = new Date().getMonth() + 1; // 1-12
  209. if (month >= 1 && month <= 5) {
  210. return "spring"; // 春季:3-5月
  211. } else if (month >= 6 && month <= 8) {
  212. return "summer"; // 夏季:6-8月
  213. } else if (month >= 9 && month <= 10) {
  214. return "autumn"; // 秋季:9-10月
  215. } else {
  216. return "winter"; // 冬季:11-2月
  217. }
  218. };
  219. // 安全解析时间到时间戳(ms)
  220. const safeParseDate = (val) => {
  221. if (!val) return NaN;
  222. if (val instanceof Date) return val.getTime();
  223. if (typeof val === "number") return val;
  224. if (typeof val === "string") {
  225. // 兼容 "YYYY-MM-DD HH:mm:ss" -> Safari
  226. const s = val.replace(/-/g, "/").replace("T", " ");
  227. const d = new Date(s);
  228. return isNaN(d.getTime()) ? NaN : d.getTime();
  229. }
  230. return NaN;
  231. };
  232. const batchValidateData = ref({});
  233. const allTrue = ref(false);
  234. const invalidIds = ref([]);
  235. const invalidArr = ref([]);
  236. // 验证农事卡片药肥报价信息是否完整
  237. const batchValidatePesticideFertilizerQuotes = (ids, items) => {
  238. if (props.isStandard) {
  239. return;
  240. }
  241. VE_API.monitor
  242. .batchValidatePesticideFertilizerQuotes({ ids, schemeId: props.schemeId })
  243. .then(({ data, code }) => {
  244. if (code === 0) {
  245. batchValidateData.value = data || {};
  246. allTrue.value = Object.values(data).every((value) => value === true);
  247. invalidIds.value = Object.keys(data).filter((key) => data[key] !== true);
  248. // 清空之前的arrangeIds
  249. invalidArr.value = [];
  250. // 遍历items,判断farmWorkId是否在invalidIds中,如果对应上了就把item.id push进去
  251. items.forEach((item) => {
  252. // 判断item.farmWorkId是否在invalidIds数组中(需要转换为字符串进行比较)
  253. const farmWorkIdStr = String(item.farmWorkId);
  254. if (invalidIds.value.includes(farmWorkIdStr)) {
  255. invalidArr.value.push({
  256. arrangeId: item.id,
  257. farmWorkId: item.farmWorkId,
  258. });
  259. }
  260. });
  261. }
  262. })
  263. .catch(() => { });
  264. };
  265. // 获取图片 URL 列表
  266. const fetchImageUrls = async (params) => {
  267. try {
  268. const res = await VE_API.ali.getTreeImageList(params);
  269. if (res.code === 0 && Array.isArray(res.data)) {
  270. return res.data.map((item) => {
  271. if (item.filename) {
  272. return {
  273. ...item,
  274. cloudFilename: item.filename, // 兼容组件
  275. };
  276. }
  277. return null;
  278. }).filter(item => item !== null);
  279. }
  280. return [];
  281. } catch (error) {
  282. console.error("获取图片列表失败:", error);
  283. return [];
  284. }
  285. };
  286. // 点击图片
  287. const imgType = ref('');
  288. const imageList = ref([]);
  289. const currentImageData = ref({});
  290. const handleImageClick = (fw) => {
  291. console.log(fw, "fw");
  292. if (fw.sourceType !== 7) {
  293. imgType.value = fw.sourceDataJson.resFilename?.[0]?.source || '';
  294. imageList.value = fw.sourceDataJson.resFilename || [];
  295. } else {
  296. imgType.value = '';
  297. imageList.value = fw.sourceDataJson.executeImageUrls || [];
  298. }
  299. currentImageData.value = {
  300. ...fw,
  301. executeName: fw.sourceDataJson.executorName,
  302. executeDate: formatDate(fw.updateTime),
  303. farmName: fw.sourceDataJson.farmName,
  304. prescriptionList: fw.sourceDataJson.pesticideFertilizerNames,
  305. farmWorkName: fw.sourceDataJson.farmWorkName,
  306. droneDate: formatDateToYYMMDD(fw.updateTime)
  307. };
  308. showImagePopup.value = true;
  309. };
  310. // 获取下一个reproductive-item的phenologyName
  311. const getNextPhenologyName = (currentPhenologyIdx, currentReproductiveIdx) => {
  312. const currentPhenology = phenologyList.value[currentPhenologyIdx];
  313. if (!currentPhenology || !Array.isArray(currentPhenology.reproductiveList)) {
  314. return null;
  315. }
  316. // 如果当前reproductive-item不是最后一个,获取同一个物候期的下一个
  317. if (currentReproductiveIdx < currentPhenology.reproductiveList.length - 1) {
  318. const nextReproductive = currentPhenology.reproductiveList[currentReproductiveIdx + 1];
  319. return nextReproductive?.phenologyName || null;
  320. }
  321. // 如果当前reproductive-item是最后一个,获取下一个物候期的第一个reproductive-item
  322. if (currentPhenologyIdx < phenologyList.value.length - 1) {
  323. const nextPhenology = phenologyList.value[currentPhenologyIdx + 1];
  324. if (
  325. nextPhenology &&
  326. Array.isArray(nextPhenology.reproductiveList) &&
  327. nextPhenology.reproductiveList.length > 0
  328. ) {
  329. const firstReproductive = nextPhenology.reproductiveList[0];
  330. return firstReproductive?.phenologyName || null;
  331. }
  332. }
  333. return null;
  334. };
  335. // 计算物候期需要的实际高度(基于农事数量)
  336. const getPhenologyRequiredHeight = (item) => {
  337. // 统计该物候期内的农事数量
  338. let farmWorkCount = 0;
  339. if (Array.isArray(item.reproductiveList)) {
  340. item.reproductiveList.forEach((reproductive) => {
  341. if (Array.isArray(reproductive.farmWorkArrangeList)) {
  342. farmWorkCount += reproductive.farmWorkArrangeList.length;
  343. }
  344. });
  345. }
  346. // 如果没有农事,给一个最小高度
  347. if (farmWorkCount === 0) {
  348. return 50; // 最小50px
  349. }
  350. // 每个农事卡片的高度(根据实际内容,卡片高度可能因内容而异)
  351. // 卡片包含:padding(8px*2) + header(约25px) + content margin(4px+2px) + content(约25-30px) = 约72-77px
  352. // 考虑到内容可能换行,实际高度可能更高,设置为120px更安全,避免卡片重叠
  353. const farmWorkCardHeight = 120; // 卡片高度估算,确保能容纳内容且不重叠
  354. // 卡片之间的间距(与CSS中的gap保持一致)
  355. const cardGap = 12;
  356. // 计算总高度:卡片数量 * 卡片高度 + (卡片数量 - 1) * 间距
  357. // 如果有多个卡片,需要加上它们之间的间距
  358. const totalHeight = farmWorkCount * farmWorkCardHeight + (farmWorkCount > 1 ? (farmWorkCount - 1) * cardGap : 0);
  359. // 返回精确的总高度,只保留最小高度限制,不添加额外余量
  360. return Math.max(totalHeight, 50); // 最小50px,精确匹配农事卡片高度
  361. };
  362. // 计算所有物候期的累积位置和总高度
  363. const calculatePhenologyPositions = () => {
  364. let currentTop = 10; // 起始位置,留出顶部间距
  365. const positions = new Map();
  366. // 按progress排序物候期,确保按时间顺序排列
  367. const sortedPhenologyList = [...phenologyList.value].sort((a, b) => {
  368. const aProgress = Math.min(Number(a?.progress) || 0, Number(a?.progress2) || 0);
  369. const bProgress = Math.min(Number(b?.progress) || 0, Number(b?.progress2) || 0);
  370. return aProgress - bProgress;
  371. });
  372. sortedPhenologyList.forEach((phenology) => {
  373. const height = getPhenologyRequiredHeight(phenology);
  374. // 使用与数据生成时相同的ID生成逻辑
  375. const itemId =
  376. phenology.id ?? phenology.phenologyId ?? phenology.name ?? `${phenology.progress}-${phenology.progress2}`;
  377. positions.set(itemId, {
  378. top: currentTop,
  379. height: height,
  380. });
  381. currentTop += height; // 紧挨着下一个物候期,不留间距
  382. });
  383. return {
  384. positions,
  385. totalHeight: currentTop, // 总高度 = 最后一个物候期的底部位置,不添加额外间距
  386. };
  387. };
  388. // 计算所有农事的总高度(基于物候期紧挨排列)
  389. const calculateTotalHeightByFarmWorks = () => {
  390. const { totalHeight } = calculatePhenologyPositions();
  391. // 如果有物候期数据,直接使用计算出的总高度
  392. // totalHeight 已经包含了从 10 开始的起始位置和所有物候期的高度
  393. if (totalHeight > 10) {
  394. // 确保总高度至少能容纳所有物候期起始时间(每个至少50px)
  395. const baseHeight = (phenologyStartDates.value?.length || 0) * 50;
  396. // 返回物候期总高度和基础高度的较大值,确保物候期起始时间能正常显示
  397. return Math.max(totalHeight, baseHeight);
  398. }
  399. // 如果没有物候期数据,返回基础高度
  400. const baseHeight = (phenologyStartDates.value?.length || 0) * 50;
  401. return baseHeight || 100; // 至少返回100px,避免为0
  402. };
  403. const getTermStyle = (t, index) => {
  404. // 优先使用实际测量的timeline-list高度,如果没有测量到则使用计算值作为后备
  405. const totalHeight = timelineListHeight.value > 0 ? timelineListHeight.value : calculateTotalHeightByFarmWorks();
  406. // 获取物候期起始时间总数(使用新数组)
  407. const termCount = phenologyStartDates.value?.length || 1;
  408. // 等分高度:总高度 / 物候期起始时间数量
  409. const termHeight = totalHeight / termCount;
  410. // 计算top位置:索引 * 每个物候期起始时间的高度
  411. const top = index * termHeight;
  412. return {
  413. position: "absolute",
  414. top: `${top}px`,
  415. left: 0,
  416. width: "32px",
  417. height: `${termHeight}px`, // 高度等分,使用实际测量的高度
  418. display: "flex",
  419. alignItems: "center",
  420. };
  421. };
  422. // 点击季节 → 滚动到对应节气(立春/立夏/立秋/立冬)
  423. const handleSeasonClick = (seasonValue) => {
  424. const mapping = {
  425. spring: "立春",
  426. summer: "立夏",
  427. autumn: "立秋",
  428. winter: "立冬",
  429. };
  430. const targetName = mapping[seasonValue];
  431. if (!targetName) return;
  432. // 查找对应的节气
  433. const targetIndex = solarTerms.value.findIndex((t) => (t?.displayName || "") === targetName);
  434. if (targetIndex === -1) return;
  435. // 计算目标节气的top位置
  436. const totalHeight = timelineListHeight.value > 0 ? timelineListHeight.value : calculateTotalHeightByFarmWorks();
  437. const termCount = solarTerms.value?.length || 1;
  438. const termHeight = totalHeight / termCount;
  439. const targetTop = targetIndex * termHeight;
  440. // 滚动到目标位置
  441. const wrap = timelineContainerRef.value;
  442. if (!wrap) return;
  443. const viewH = wrap.clientHeight || 0;
  444. const maxScroll = Math.max(0, wrap.scrollHeight - viewH);
  445. // 将目标位置稍微靠上(使用 0.1 视口高度做偏移)
  446. let scrollTop = Math.max(0, targetTop - viewH * 0.1);
  447. if (scrollTop > maxScroll) scrollTop = maxScroll;
  448. wrap.scrollTo({ top: scrollTop, behavior: "smooth" });
  449. };
  450. // 农事状态样式映射
  451. const getArrangeStatusClass = (fw) => {
  452. const t = props.pageType === 'agri_record' ? fw?.flowStatus : fw?.sourceType;
  453. if(props.pageType === 'agri_record'){
  454. if (t == null) return "status-default";
  455. return "status-act";
  456. }else{
  457. if (t == 9) return "status-complete";
  458. if (t == 8 ) return "status-warning";
  459. if (t == 5) return "status-normal";
  460. return "status-complete";
  461. }
  462. };
  463. const handleRowClick = (item) => {
  464. // 记录当前页面滚动位置
  465. if (timelineContainerRef.value) {
  466. const scrollTop = timelineContainerRef.value.scrollTop || 0;
  467. sessionStorage.setItem("timelineScrollTop", scrollTop.toString());
  468. }
  469. emits("row-click", item);
  470. };
  471. // 获取农事规划数据
  472. const getFarmWorkPlan = () => {
  473. if (!props.farmId) return;
  474. // 如果正在请求,或者 farmId 与上次请求的相同,直接返回,防止重复请求
  475. if (isRequesting.value || lastRequestedFarmId.value === props.farmId) return;
  476. // 设置请求标志和记录 farmId
  477. isRequesting.value = true;
  478. lastRequestedFarmId.value = props.farmId;
  479. // 更新时间戳,确保key变化,触发DOM重新渲染
  480. uniqueTimestamp.value = Date.now();
  481. // 重置测量高度,等待重新测量
  482. timelineListHeight.value = 0;
  483. // 重置空数据状态
  484. isEmpty.value = false;
  485. let savedScrollTop = 0;
  486. if (!isInitialLoad.value && timelineContainerRef.value) {
  487. savedScrollTop = timelineContainerRef.value.scrollTop || 0;
  488. }
  489. const apiFunc = props.pageType === 'agri_record' ? VE_API.monitor.getFarmWorkPlan : VE_API.monitor.getArchivesList;
  490. const params = {
  491. farmId: props.farmId,
  492. }
  493. if(props.pageType === 'agri_record'){
  494. params.containerId = props.containerId || 26;
  495. }
  496. apiFunc(params)
  497. .then(async ({ data, code }) => {
  498. if (code === 0) {
  499. const list = Array.isArray(data?.solarTermsList) ? data.solarTermsList : [];
  500. const filtered = list
  501. .filter((t) => t && t.type === 1)
  502. .map((t) => ({
  503. id:
  504. t.id ??
  505. t.solarTermsId ??
  506. t.termId ??
  507. `${t.name || t.solarTermsName || t.termName || "term"}-${t.createDate || ""}`,
  508. displayName: t.name || t.solarTermsName || t.termName || "节气",
  509. createDate: t.createDate || null,
  510. progress: Number(t.progress) || 0,
  511. }));
  512. solarTerms.value = filtered;
  513. // 物候期数据
  514. const processedPhenologyList = Array.isArray(data?.phenologyList)
  515. ? await Promise.all(
  516. data.phenologyList.map(async (it) => {
  517. const reproductiveList = Array.isArray(it.reproductiveList)
  518. ? await Promise.all(
  519. it.reproductiveList.map(async (r) => {
  520. const farmWorkArrangeList = Array.isArray(r.broadcastList || r.interactionFarmWorkList)
  521. ? await Promise.all(
  522. (r.broadcastList || r.interactionFarmWorkList).map(async (fw) => {
  523. let sourceDataJson =
  524. fw.sourceData && JSON.parse(fw.sourceData);
  525. // 如果有 imageIds,获取图片 URL
  526. if (
  527. sourceDataJson &&
  528. sourceDataJson.imageIds &&
  529. Array.isArray(sourceDataJson.imageIds) &&
  530. sourceDataJson.imageIds.length > 0
  531. ) {
  532. const resFilenameList = await fetchImageUrls(
  533. {
  534. imageIds: sourceDataJson.imageIds,
  535. page: 1,
  536. limit: 100,
  537. }
  538. );
  539. sourceDataJson.resFilename = resFilenameList;
  540. // 调用 findSuitabilityByPoint 接口获取天气适宜性信息
  541. if (fw.farmId && fw.createTime) {
  542. try {
  543. const dateStr = formatDateForAPI(fw.createTime);
  544. if (dateStr) {
  545. const suitabilityRes = await VE_API.ali.findSuitabilityByPoint({
  546. farmId: fw.farmId,
  547. date: dateStr,
  548. });
  549. if (suitabilityRes && suitabilityRes.code === 0 && suitabilityRes.data) {
  550. // 将返回的数据合并到 sourceDataJson
  551. sourceDataJson.suitability = suitabilityRes.data;
  552. }
  553. }
  554. } catch (error) {
  555. console.error("获取天气适宜性信息失败:", error);
  556. }
  557. }
  558. }
  559. return {
  560. ...fw,
  561. phenologyName: r.phenologyName,
  562. sourceDataJson,
  563. containerSpaceTimeId: it.containerSpaceTimeId,
  564. };
  565. })
  566. )
  567. : [];
  568. return {
  569. ...r,
  570. farmWorkArrangeList,
  571. };
  572. })
  573. )
  574. : [];
  575. return {
  576. id: it.id ?? it.phenologyId ?? it.name ?? `${it.progress}-${it.progress2}`,
  577. progress: Number(it.progress) || 0, // 起点 %
  578. progress2: Number(it.progress2) || 0, // 终点 %
  579. startDate: it.startDate,
  580. startTimeMs: safeParseDate(
  581. it.startDate || it.beginDate || it.startTime || it.start || it.start_at
  582. ),
  583. reproductiveList,
  584. };
  585. })
  586. )
  587. : [];
  588. phenologyList.value = processedPhenologyList;
  589. // 使用多次 nextTick 和 requestAnimationFrame 确保DOM完全渲染
  590. nextTick(() => {
  591. requestAnimationFrame(() => {
  592. nextTick(() => {
  593. requestAnimationFrame(() => {
  594. // 测量timeline-list的实际渲染高度
  595. if (timelineListRef.value) {
  596. const height =
  597. timelineListRef.value.offsetHeight || timelineListRef.value.clientHeight;
  598. if (height > 0) {
  599. timelineListHeight.value = height;
  600. // 如果是首次加载,滚动到当前季节对应的节气
  601. if (isInitialLoad.value) {
  602. const currentSeason = getCurrentSeason();
  603. handleSeasonClick(currentSeason);
  604. isInitialLoad.value = false;
  605. }
  606. }
  607. }
  608. if (isInitialLoad.value) {
  609. // 如果测量失败,延迟一下再尝试滚动
  610. setTimeout(() => {
  611. if (timelineListRef.value) {
  612. const height =
  613. timelineListRef.value.offsetHeight ||
  614. timelineListRef.value.clientHeight;
  615. if (height > 0) {
  616. timelineListHeight.value = height;
  617. }
  618. }
  619. const currentSeason = getCurrentSeason();
  620. handleSeasonClick(currentSeason);
  621. isInitialLoad.value = false;
  622. }, 200);
  623. } else {
  624. // 尝试恢复之前保存的滚动位置
  625. const savedScrollTopFromStorage = sessionStorage.getItem("timelineScrollTop");
  626. if (savedScrollTopFromStorage) {
  627. // 等待 DOM 完全渲染后再恢复滚动位置
  628. nextTick(() => {
  629. requestAnimationFrame(() => {
  630. if (timelineContainerRef.value) {
  631. const scrollTop = Number(savedScrollTopFromStorage);
  632. timelineContainerRef.value.scrollTop = scrollTop;
  633. // 恢复后清除保存的位置,避免下次误恢复
  634. sessionStorage.removeItem("timelineScrollTop");
  635. }
  636. });
  637. });
  638. } else if (timelineContainerRef.value && savedScrollTop > 0) {
  639. timelineContainerRef.value.scrollTop = savedScrollTop;
  640. }
  641. }
  642. });
  643. });
  644. });
  645. });
  646. // 收集所有farmWorkId
  647. const farmWorkIds = [];
  648. const farmWorks = [];
  649. phenologyList.value.forEach((phenology) => {
  650. if (Array.isArray(phenology.reproductiveList)) {
  651. phenology.reproductiveList.forEach((reproductive) => {
  652. if (Array.isArray(reproductive.farmWorkArrangeList)) {
  653. reproductive.farmWorkArrangeList.forEach((farmWork) => {
  654. if (farmWork.farmWorkId && farmWork.isFollow !== 0) {
  655. farmWorkIds.push(farmWork.farmWorkId);
  656. farmWorks.push(farmWork);
  657. }
  658. });
  659. }
  660. });
  661. }
  662. });
  663. // 调用验证方法,传入所有ids
  664. if (farmWorkIds.length > 0) {
  665. batchValidatePesticideFertilizerQuotes(farmWorkIds, farmWorks);
  666. }
  667. // 判断是否为空数据:没有节气或没有物候期数据
  668. if (solarTerms.value.length === 0 && phenologyList.value.length === 0) {
  669. isEmpty.value = true;
  670. } else {
  671. isEmpty.value = false;
  672. }
  673. } else {
  674. // 接口返回错误码,显示暂无数据
  675. isEmpty.value = true;
  676. solarTerms.value = [];
  677. phenologyList.value = [];
  678. }
  679. })
  680. .catch((error) => {
  681. console.error("获取农事规划数据失败:", error);
  682. ElMessage.error("获取农事规划数据失败");
  683. // 接口报错,显示暂无数据
  684. isEmpty.value = true;
  685. solarTerms.value = [];
  686. phenologyList.value = [];
  687. })
  688. .finally(() => {
  689. // 请求完成,重置请求标志
  690. isRequesting.value = false;
  691. });
  692. };
  693. const updateFarmWorkPlan = () => {
  694. solarTerms.value = [];
  695. phenologyList.value = [];
  696. isEmpty.value = false;
  697. getFarmWorkPlan();
  698. };
  699. watch(
  700. () => props.farmId,
  701. (val, oldVal) => {
  702. // 如果 farmId 没有值,则不触发
  703. if (!val) return;
  704. // 如果 farmId 变化了,重置上次请求的 farmId,允许请求新数据
  705. if (val !== oldVal) {
  706. lastRequestedFarmId.value = null;
  707. }
  708. // getFarmWorkPlan 内部已经有防重复请求的检查,这里直接调用即可
  709. isInitialLoad.value = true;
  710. updateFarmWorkPlan();
  711. },
  712. { immediate: true }
  713. );
  714. const handleStatusDetail = (fw) => {
  715. // router.push({
  716. // path: props.pageType === 'agri_plan' ? "/agricultural_detail" : "/status_detail",
  717. // query: { miniJson: JSON.stringify({ id: fw.id }) },
  718. // });
  719. if(props.pageType === 'agri_record'){
  720. router.push({
  721. path: "/status_detail",
  722. query: { miniJson: JSON.stringify({ farmWorkLibId: fw.farmWorkLibId, farmWorkRecordId: fw.farmWorkRecordId, farmId: props.farmId }) },
  723. });
  724. }
  725. };
  726. // 格式化日期为 MM-DD 格式
  727. const formatDate = (dateStr) => {
  728. if (!dateStr) return "--";
  729. const date = new Date(dateStr);
  730. if (Number.isNaN(date.getTime())) return dateStr;
  731. const m = `${date.getMonth() + 1}`.padStart(2, "0");
  732. const d = `${date.getDate()}`.padStart(2, "0");
  733. return `${m}-${d}`;
  734. };
  735. // 格式化日期为 YYYY-MM-DD 格式(用于接口调用)
  736. const formatDateForAPI = (dateStr) => {
  737. if (!dateStr) return null;
  738. const date = new Date(dateStr);
  739. if (Number.isNaN(date.getTime())) return null;
  740. const y = date.getFullYear();
  741. const m = `${date.getMonth() + 1}`.padStart(2, "0");
  742. const d = `${date.getDate()}`.padStart(2, "0");
  743. return `${y}-${m}-${d}`;
  744. };
  745. // 格式化日期为 YYMMDD 格式(如:260110,26为年份,01为月份,10为日)
  746. const formatDateToYYMMDD = (dateStr) => {
  747. if (!dateStr) return "";
  748. const date = new Date(dateStr);
  749. if (Number.isNaN(date.getTime())) return "";
  750. const y = `${date.getFullYear()}`.substring(2); // 获取后两位年份,如 2026 -> 26
  751. const m = `${date.getMonth() + 1}`.padStart(2, "0");
  752. const d = `${date.getDate()}`.padStart(2, "0");
  753. return `${y}${m}${d}`;
  754. };
  755. // 获取下一个即将到来的节气(当前节气)的 progress
  756. const getNextTermProgress = () => {
  757. if (!solarTerms.value || solarTerms.value.length === 0) return Infinity;
  758. const now = new Date();
  759. now.setHours(0, 0, 0, 0);
  760. let nextTermProgress = Infinity;
  761. // 找到当前日期之后的下一个节气(当前节气)
  762. solarTerms.value.forEach((term) => {
  763. const termDate = safeParseDate(term.createDate);
  764. if (!isNaN(termDate)) {
  765. const termDateObj = new Date(termDate);
  766. termDateObj.setHours(0, 0, 0, 0);
  767. // 找到大于等于当前日期的第一个节气
  768. if (termDateObj >= now) {
  769. const termProgress = Number(term.progress) || 0;
  770. if (termProgress < nextTermProgress) {
  771. nextTermProgress = termProgress;
  772. }
  773. }
  774. }
  775. });
  776. // 如果没有找到未来的节气,说明所有节气都已过,返回 Infinity(所有物候期都显示蓝色)
  777. return nextTermProgress === Infinity ? Infinity : nextTermProgress;
  778. };
  779. // 根据物候期的 progress 判断它所属节气的 progress
  780. const getPhenologyTermProgress = (phenologyProgress) => {
  781. if (!solarTerms.value || solarTerms.value.length === 0) return -1;
  782. const progress = Number(phenologyProgress) || 0;
  783. // 找到物候期所属的节气(progress 最接近且小于等于的节气)
  784. let matchedTermProgress = -1;
  785. solarTerms.value.forEach((term) => {
  786. const termProgress = Number(term.progress) || 0;
  787. if (progress >= termProgress && termProgress > matchedTermProgress) {
  788. matchedTermProgress = termProgress;
  789. }
  790. });
  791. // 如果物候期的 progress 小于所有节气,返回第一个节气的 progress
  792. if (matchedTermProgress === -1 && solarTerms.value.length > 0) {
  793. const firstTermProgress = Number(solarTerms.value[0].progress) || 0;
  794. return firstTermProgress;
  795. }
  796. return matchedTermProgress;
  797. };
  798. // 判断物候期是否应该显示蓝色(已过或当前节气的物候期)
  799. const shouldShowBlue = (phenology) => {
  800. // 获取下一个即将到来的节气(当前节气)的 progress
  801. const nextTermProgress = getNextTermProgress();
  802. // 如果所有节气都已过(nextTermProgress === Infinity),所有物候期都显示蓝色
  803. if (nextTermProgress === Infinity) {
  804. return true;
  805. }
  806. // 根据物候期的 progress 判断它属于哪个节气
  807. const phenologyProgress = Math.min(Number(phenology?.progress) || 0, Number(phenology?.progress2) || 0);
  808. const phenologyTermProgress = getPhenologyTermProgress(phenologyProgress);
  809. // 找到下一个节气的完整信息,用于判断物候期是否属于当前节气
  810. let nextTerm = null;
  811. solarTerms.value.forEach((term) => {
  812. const termProgress = Number(term.progress) || 0;
  813. if (termProgress === nextTermProgress) {
  814. nextTerm = term;
  815. }
  816. });
  817. // 如果物候期所属的节气的 progress < 下一个节气的 progress,显示蓝色
  818. // 如果物候期所属的节气的 progress === 下一个节气的 progress,也显示蓝色(当前节气)
  819. // 也就是说,只有属于当前节气或之前节气的物候期才显示蓝色
  820. if (phenologyTermProgress === -1) {
  821. return false;
  822. }
  823. // 如果物候期正好属于下一个节气,需要判断它的 progress 是否在下一个节气的范围内
  824. if (phenologyTermProgress === nextTermProgress && nextTerm) {
  825. // 如果物候期的 progress 小于等于下一个节气的 progress,说明它属于当前节气,显示蓝色
  826. return phenologyProgress <= nextTermProgress;
  827. }
  828. // 如果物候期所属的节气的 progress < 下一个节气的 progress,显示蓝色
  829. return phenologyTermProgress < nextTermProgress;
  830. };
  831. defineExpose({
  832. updateFarmWorkPlan,
  833. });
  834. // 使用 ResizeObserver 监听高度变化,确保在DOM完全渲染后获取准确高度
  835. const setupResizeObserver = () => {
  836. if (!timelineListRef.value || typeof ResizeObserver === "undefined") {
  837. return;
  838. }
  839. // 如果已经存在观察者,先断开
  840. if (resizeObserver) {
  841. resizeObserver.disconnect();
  842. }
  843. // 创建新的观察者
  844. resizeObserver = new ResizeObserver((entries) => {
  845. for (const entry of entries) {
  846. const height = entry.contentRect.height;
  847. if (height > 0 && height !== timelineListHeight.value) {
  848. timelineListHeight.value = height;
  849. }
  850. }
  851. });
  852. // 开始观察
  853. resizeObserver.observe(timelineListRef.value);
  854. };
  855. // 组件挂载后设置 ResizeObserver
  856. onMounted(() => {
  857. nextTick(() => {
  858. requestAnimationFrame(() => {
  859. setupResizeObserver();
  860. });
  861. });
  862. });
  863. // 组件卸载前清理 ResizeObserver
  864. onUnmounted(() => {
  865. if (resizeObserver) {
  866. resizeObserver.disconnect();
  867. resizeObserver = null;
  868. }
  869. });
  870. // 在数据更新后重新设置 ResizeObserver
  871. watch(
  872. () => phenologyList.value.length,
  873. () => {
  874. nextTick(() => {
  875. requestAnimationFrame(() => {
  876. setupResizeObserver();
  877. });
  878. });
  879. }
  880. );
  881. </script>
  882. <style scoped lang="scss">
  883. .timeline-container {
  884. height: 100%;
  885. overflow: auto;
  886. position: relative;
  887. box-sizing: border-box;
  888. .timeline-list {
  889. position: relative;
  890. }
  891. .timeline-middle-line {
  892. position: absolute;
  893. left: 13px;
  894. /* 位于节气文字列中间(列宽约30px) */
  895. top: 0;
  896. bottom: 0;
  897. width: 2px;
  898. background: #e8e8e8;
  899. z-index: 1;
  900. }
  901. .phenology-bar {
  902. align-items: stretch;
  903. justify-content: center;
  904. box-sizing: border-box;
  905. position: relative;
  906. .phenology-title {
  907. width: 18px;
  908. height: 98.5%;
  909. color: #fff;
  910. font-size: 12px;
  911. position: absolute;
  912. left: 39px;
  913. z-index: 10;
  914. text-align: center;
  915. display: flex;
  916. align-items: center;
  917. &.phenology-blue {
  918. background: #2199f8;
  919. }
  920. &.phenology-red {
  921. background: #f1f1f1;
  922. color: #808080;
  923. }
  924. }
  925. .reproductive-item {
  926. font-size: 12px;
  927. text-align: center;
  928. word-break: break-all;
  929. writing-mode: vertical-rl;
  930. text-orientation: upright;
  931. letter-spacing: 3px;
  932. width: 100%;
  933. line-height: 23px;
  934. color: inherit;
  935. position: relative;
  936. .phenology-name {
  937. width: 18px;
  938. line-height: 16px;
  939. height: 100%;
  940. color: #fff;
  941. padding: 4px 0;
  942. font-size: 12px;
  943. box-sizing: border-box;
  944. &.mr {
  945. margin-right: 3px;
  946. }
  947. &.single {
  948. width: 39px;
  949. line-height: 39px;
  950. }
  951. &.phenology-blue {
  952. background: #2199f8;
  953. }
  954. &.phenology-red {
  955. background: #f1f1f1;
  956. color: #808080;
  957. }
  958. &.text-blue {
  959. background: rgba(33, 153, 248, 0.15);
  960. color: #2199f8;
  961. border: 1px solid #2199f8;
  962. line-height: 16px;
  963. box-sizing: border-box;
  964. }
  965. &.text-red {
  966. background: rgba(128, 128, 128, 0.15);
  967. color: #808080;
  968. border: 1px solid rgba(128, 128, 128, 0.35);
  969. line-height: 16px;
  970. box-sizing: border-box;
  971. }
  972. }
  973. .arranges {
  974. display: flex;
  975. max-width: calc(100vw - 118px);
  976. min-width: calc(100vw - 118px);
  977. gap: 5px;
  978. letter-spacing: 0px;
  979. // min-height: 90px;
  980. .arrange-card {
  981. width: 95%;
  982. border: 0.5px solid #2199f8;
  983. border-radius: 8px;
  984. background: #fff;
  985. box-sizing: border-box;
  986. position: relative;
  987. padding: 8px 15px 8px 10px;
  988. writing-mode: horizontal-tb;
  989. margin-bottom: 10px;
  990. // &.last-card {
  991. // margin-bottom: 0;
  992. // }
  993. .card-content {
  994. color: #242424;
  995. display: flex;
  996. justify-content: space-between;
  997. align-items: center;
  998. font-size: 14px;
  999. .card-left {
  1000. width: calc(100% - 45px);
  1001. .left-info {
  1002. display: flex;
  1003. align-items: center;
  1004. gap: 6px;
  1005. .left-date {
  1006. color: #2199f8;
  1007. border: 1px solid #2199f8;
  1008. padding: 1px 5px;
  1009. border-radius: 2px;
  1010. font-size: 12px;
  1011. }
  1012. .text {
  1013. display: flex;
  1014. align-items: center;
  1015. gap: 2px;
  1016. width: calc(100% - 50px);
  1017. }
  1018. }
  1019. .title-text {
  1020. margin-top: 5px;
  1021. width: fit-content;
  1022. text-align: left;
  1023. color: #2199F8;
  1024. padding: 0 6px;
  1025. border-radius: 2px;
  1026. font-size: 12px;
  1027. background: rgba(33, 153, 248, 0.1);
  1028. }
  1029. &.agri-record-card {
  1030. .title-wrap{
  1031. display: flex;
  1032. align-items: flex-end;
  1033. gap: 6px;
  1034. .expert-info{
  1035. display: flex;
  1036. align-items: center;
  1037. gap: 2px;
  1038. font-size: 12px;
  1039. color: #B7B7B7;
  1040. }
  1041. }
  1042. }
  1043. }
  1044. .card-right {
  1045. display: flex;
  1046. align-items: center;
  1047. position: relative;
  1048. img {
  1049. width: 45px;
  1050. height: 45px;
  1051. border-radius: 4px;
  1052. object-fit: cover;
  1053. }
  1054. .num {
  1055. position: absolute;
  1056. width: 18px;
  1057. height: 18px;
  1058. box-sizing: border-box;
  1059. top: -4px;
  1060. right: -6px;
  1061. background: #BFBFBF;
  1062. color: #fff;
  1063. font-size: 12px;
  1064. border-radius: 50%;
  1065. display: flex;
  1066. align-items: center;
  1067. justify-content: center;
  1068. }
  1069. }
  1070. }
  1071. &::before {
  1072. content: "";
  1073. position: absolute;
  1074. left: -5px;
  1075. top: 50%;
  1076. transform: translateY(-50%);
  1077. width: 0;
  1078. height: 0;
  1079. border-top: 5px solid transparent;
  1080. border-bottom: 5px solid transparent;
  1081. border-right: 5px solid #2199f8;
  1082. }
  1083. }
  1084. .arrange-card.normal-style {
  1085. opacity: 0.3;
  1086. }
  1087. .arrange-card.future-card .card-content {
  1088. color: #808080;
  1089. }
  1090. .arrange-card.status-normal {
  1091. border-color: #2199f8;
  1092. &::before {
  1093. border-right-color: #2199f8;
  1094. }
  1095. }
  1096. .arrange-card.status-warning {
  1097. border-color: #FF4E4E;
  1098. .card-left {
  1099. .left-info {
  1100. .left-date {
  1101. color: #FF4E4E;
  1102. border-color: #FF4E4E;
  1103. }
  1104. }
  1105. .title-text{
  1106. color: #FF4E4E;
  1107. background: rgba(255, 78, 78, 0.1);
  1108. }
  1109. }
  1110. &::before {
  1111. border-right-color: #FF4E4E;
  1112. }
  1113. }
  1114. .arrange-card.status-complete {
  1115. border-color: #FF943D;
  1116. .card-left {
  1117. .left-info {
  1118. .left-date {
  1119. color: #FF943D;
  1120. border-color: #FF943D;
  1121. }
  1122. }
  1123. .title-text{
  1124. color: #FF943D;
  1125. background: rgba(255, 149, 61, 0.1);
  1126. }
  1127. }
  1128. &::before {
  1129. border-right-color: #FF943D;
  1130. }
  1131. }
  1132. .arrange-card.status-act {
  1133. border-color: #FF953D;
  1134. .card-left {
  1135. .left-info {
  1136. .left-date {
  1137. color: #FF953D;
  1138. border-color: #FF953D;
  1139. }
  1140. }
  1141. .title-text{
  1142. color: #fff;
  1143. background: #FF953D;
  1144. }
  1145. }
  1146. &::before {
  1147. border-right-color: #FF953D;
  1148. }
  1149. }
  1150. .arrange-card.status-default {
  1151. border-color: #BBBBBB;
  1152. .card-left {
  1153. .left-info {
  1154. .left-date {
  1155. color: #BBBBBB;
  1156. border-color: #BBBBBB;
  1157. }
  1158. .text-name,.text-icon{
  1159. color: #BBBBBB;
  1160. }
  1161. }
  1162. .title-text{
  1163. color: #fff;
  1164. background: #BBBBBB;
  1165. }
  1166. }
  1167. &::before {
  1168. border-right-color: #BBBBBB;
  1169. }
  1170. }
  1171. // 未来节气对应的农事卡片:跟随左侧物候期的“未开始”灰色样式
  1172. .arrange-card.future-card {
  1173. border-color: #e4e4e4;
  1174. .card-left {
  1175. .left-info {
  1176. .left-date {
  1177. color: #fff;
  1178. background: #e4e4e4;
  1179. border-color: #e4e4e4;
  1180. }
  1181. }
  1182. }
  1183. &::before {
  1184. border-right-color: #e4e4e4;
  1185. }
  1186. }
  1187. }
  1188. }
  1189. }
  1190. .reproductive-item+.reproductive-item {
  1191. padding-top: 3px;
  1192. }
  1193. .phenology-bar+.phenology-bar {
  1194. padding-top: 3px;
  1195. }
  1196. .timeline-term {
  1197. position: absolute;
  1198. width: 32px;
  1199. display: flex;
  1200. align-items: flex-start;
  1201. flex-direction: column;
  1202. z-index: 2;
  1203. /* 置于中线之上 */
  1204. color: rgba(174, 174, 174, 0.6);
  1205. .term-name {
  1206. display: inline-block;
  1207. width: 100%;
  1208. min-height: 20px;
  1209. line-height: 26px;
  1210. background: #fff;
  1211. font-size: 12px;
  1212. }
  1213. }
  1214. .empty-state {
  1215. display: flex;
  1216. justify-content: center;
  1217. align-items: center;
  1218. min-height: 200px;
  1219. width: 100%;
  1220. }
  1221. }
  1222. </style>
  1223. <style lang="scss" scoped>
  1224. .image-popup {
  1225. width: 327px;
  1226. border-radius: 8px;
  1227. .popup-content {
  1228. width: 100%;
  1229. }
  1230. }
  1231. </style>