ArchivesFarmTimeLine.vue 56 KB

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