ArchivesFarmTimeLine.vue 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361
  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.content }}123123123123</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 == 10) return "status-complete";
  458. if (t == 11 ) return "status-warning";
  459. return "status-normal";
  460. }
  461. };
  462. const handleRowClick = (item) => {
  463. // 记录当前页面滚动位置
  464. if (timelineContainerRef.value) {
  465. const scrollTop = timelineContainerRef.value.scrollTop || 0;
  466. sessionStorage.setItem("timelineScrollTop", scrollTop.toString());
  467. }
  468. emits("row-click", item);
  469. };
  470. // 获取农事规划数据
  471. const getFarmWorkPlan = () => {
  472. if (!props.farmId) return;
  473. // 如果正在请求,或者 farmId 与上次请求的相同,直接返回,防止重复请求
  474. if (isRequesting.value || lastRequestedFarmId.value === props.farmId) return;
  475. // 设置请求标志和记录 farmId
  476. isRequesting.value = true;
  477. lastRequestedFarmId.value = props.farmId;
  478. // 更新时间戳,确保key变化,触发DOM重新渲染
  479. uniqueTimestamp.value = Date.now();
  480. // 重置测量高度,等待重新测量
  481. timelineListHeight.value = 0;
  482. // 重置空数据状态
  483. isEmpty.value = false;
  484. let savedScrollTop = 0;
  485. if (!isInitialLoad.value && timelineContainerRef.value) {
  486. savedScrollTop = timelineContainerRef.value.scrollTop || 0;
  487. }
  488. const apiFunc = props.pageType === 'agri_record' ? VE_API.monitor.getFarmWorkPlan : VE_API.monitor.getArchivesList;
  489. const params = {
  490. farmId: props.farmId,
  491. }
  492. if(props.pageType === 'agri_record'){
  493. params.containerId = props.containerId || 26;
  494. }
  495. apiFunc(params)
  496. .then(async ({ data, code }) => {
  497. if (code === 0) {
  498. const list = Array.isArray(data?.solarTermsList) ? data.solarTermsList : [];
  499. const filtered = list
  500. .filter((t) => t && t.type === 1)
  501. .map((t) => ({
  502. id:
  503. t.id ??
  504. t.solarTermsId ??
  505. t.termId ??
  506. `${t.name || t.solarTermsName || t.termName || "term"}-${t.createDate || ""}`,
  507. displayName: t.name || t.solarTermsName || t.termName || "节气",
  508. createDate: t.createDate || null,
  509. progress: Number(t.progress) || 0,
  510. }));
  511. solarTerms.value = filtered;
  512. // 物候期数据
  513. const processedPhenologyList = Array.isArray(data?.phenologyList)
  514. ? await Promise.all(
  515. data.phenologyList.map(async (it) => {
  516. const reproductiveList = Array.isArray(it.reproductiveList)
  517. ? await Promise.all(
  518. it.reproductiveList.map(async (r) => {
  519. const farmWorkArrangeList = Array.isArray(r.broadcastList || r.interactionFarmWorkList)
  520. ? await Promise.all(
  521. (r.broadcastList || r.interactionFarmWorkList).map(async (fw) => {
  522. let sourceDataJson =
  523. fw.sourceData && JSON.parse(fw.sourceData);
  524. // 如果有 imageIds,获取图片 URL
  525. if (
  526. sourceDataJson &&
  527. sourceDataJson.imageIds &&
  528. Array.isArray(sourceDataJson.imageIds) &&
  529. sourceDataJson.imageIds.length > 0
  530. ) {
  531. const resFilenameList = await fetchImageUrls(
  532. {
  533. imageIds: sourceDataJson.imageIds,
  534. page: 1,
  535. limit: 100,
  536. }
  537. );
  538. sourceDataJson.resFilename = resFilenameList;
  539. // 调用 findSuitabilityByPoint 接口获取天气适宜性信息
  540. if (fw.farmId && fw.createTime) {
  541. try {
  542. const dateStr = formatDateForAPI(fw.createTime);
  543. if (dateStr) {
  544. const suitabilityRes = await VE_API.ali.findSuitabilityByPoint({
  545. farmId: fw.farmId,
  546. date: dateStr,
  547. });
  548. if (suitabilityRes && suitabilityRes.code === 0 && suitabilityRes.data) {
  549. // 将返回的数据合并到 sourceDataJson
  550. sourceDataJson.suitability = suitabilityRes.data;
  551. }
  552. }
  553. } catch (error) {
  554. console.error("获取天气适宜性信息失败:", error);
  555. }
  556. }
  557. }
  558. return {
  559. ...fw,
  560. phenologyName: r.phenologyName,
  561. sourceDataJson,
  562. containerSpaceTimeId: it.containerSpaceTimeId,
  563. };
  564. })
  565. )
  566. : [];
  567. return {
  568. ...r,
  569. farmWorkArrangeList,
  570. };
  571. })
  572. )
  573. : [];
  574. return {
  575. id: it.id ?? it.phenologyId ?? it.name ?? `${it.progress}-${it.progress2}`,
  576. progress: Number(it.progress) || 0, // 起点 %
  577. progress2: Number(it.progress2) || 0, // 终点 %
  578. startDate: it.startDate,
  579. startTimeMs: safeParseDate(
  580. it.startDate || it.beginDate || it.startTime || it.start || it.start_at
  581. ),
  582. reproductiveList,
  583. };
  584. })
  585. )
  586. : [];
  587. phenologyList.value = processedPhenologyList;
  588. // 使用多次 nextTick 和 requestAnimationFrame 确保DOM完全渲染
  589. nextTick(() => {
  590. requestAnimationFrame(() => {
  591. nextTick(() => {
  592. requestAnimationFrame(() => {
  593. // 测量timeline-list的实际渲染高度
  594. if (timelineListRef.value) {
  595. const height =
  596. timelineListRef.value.offsetHeight || timelineListRef.value.clientHeight;
  597. if (height > 0) {
  598. timelineListHeight.value = height;
  599. // 如果是首次加载,滚动到当前季节对应的节气
  600. if (isInitialLoad.value) {
  601. const currentSeason = getCurrentSeason();
  602. handleSeasonClick(currentSeason);
  603. isInitialLoad.value = false;
  604. }
  605. }
  606. }
  607. if (isInitialLoad.value) {
  608. // 如果测量失败,延迟一下再尝试滚动
  609. setTimeout(() => {
  610. if (timelineListRef.value) {
  611. const height =
  612. timelineListRef.value.offsetHeight ||
  613. timelineListRef.value.clientHeight;
  614. if (height > 0) {
  615. timelineListHeight.value = height;
  616. }
  617. }
  618. const currentSeason = getCurrentSeason();
  619. handleSeasonClick(currentSeason);
  620. isInitialLoad.value = false;
  621. }, 200);
  622. } else {
  623. // 尝试恢复之前保存的滚动位置
  624. const savedScrollTopFromStorage = sessionStorage.getItem("timelineScrollTop");
  625. if (savedScrollTopFromStorage) {
  626. // 等待 DOM 完全渲染后再恢复滚动位置
  627. nextTick(() => {
  628. requestAnimationFrame(() => {
  629. if (timelineContainerRef.value) {
  630. const scrollTop = Number(savedScrollTopFromStorage);
  631. timelineContainerRef.value.scrollTop = scrollTop;
  632. // 恢复后清除保存的位置,避免下次误恢复
  633. sessionStorage.removeItem("timelineScrollTop");
  634. }
  635. });
  636. });
  637. } else if (timelineContainerRef.value && savedScrollTop > 0) {
  638. timelineContainerRef.value.scrollTop = savedScrollTop;
  639. }
  640. }
  641. });
  642. });
  643. });
  644. });
  645. // 收集所有farmWorkId
  646. const farmWorkIds = [];
  647. const farmWorks = [];
  648. phenologyList.value.forEach((phenology) => {
  649. if (Array.isArray(phenology.reproductiveList)) {
  650. phenology.reproductiveList.forEach((reproductive) => {
  651. if (Array.isArray(reproductive.farmWorkArrangeList)) {
  652. reproductive.farmWorkArrangeList.forEach((farmWork) => {
  653. if (farmWork.farmWorkId && farmWork.isFollow !== 0) {
  654. farmWorkIds.push(farmWork.farmWorkId);
  655. farmWorks.push(farmWork);
  656. }
  657. });
  658. }
  659. });
  660. }
  661. });
  662. // 调用验证方法,传入所有ids
  663. if (farmWorkIds.length > 0) {
  664. batchValidatePesticideFertilizerQuotes(farmWorkIds, farmWorks);
  665. }
  666. // 判断是否为空数据:没有节气或没有物候期数据
  667. if (solarTerms.value.length === 0 && phenologyList.value.length === 0) {
  668. isEmpty.value = true;
  669. } else {
  670. isEmpty.value = false;
  671. }
  672. } else {
  673. // 接口返回错误码,显示暂无数据
  674. isEmpty.value = true;
  675. solarTerms.value = [];
  676. phenologyList.value = [];
  677. }
  678. })
  679. .catch((error) => {
  680. console.error("获取农事规划数据失败:", error);
  681. ElMessage.error("获取农事规划数据失败");
  682. // 接口报错,显示暂无数据
  683. isEmpty.value = true;
  684. solarTerms.value = [];
  685. phenologyList.value = [];
  686. })
  687. .finally(() => {
  688. // 请求完成,重置请求标志
  689. isRequesting.value = false;
  690. });
  691. };
  692. const updateFarmWorkPlan = () => {
  693. solarTerms.value = [];
  694. phenologyList.value = [];
  695. isEmpty.value = false;
  696. getFarmWorkPlan();
  697. };
  698. watch(
  699. () => props.farmId,
  700. (val, oldVal) => {
  701. // 如果 farmId 没有值,则不触发
  702. if (!val) return;
  703. // 如果 farmId 变化了,重置上次请求的 farmId,允许请求新数据
  704. if (val !== oldVal) {
  705. lastRequestedFarmId.value = null;
  706. }
  707. // getFarmWorkPlan 内部已经有防重复请求的检查,这里直接调用即可
  708. isInitialLoad.value = true;
  709. updateFarmWorkPlan();
  710. },
  711. { immediate: true }
  712. );
  713. const handleStatusDetail = (fw) => {
  714. // router.push({
  715. // path: props.pageType === 'agri_plan' ? "/agricultural_detail" : "/status_detail",
  716. // query: { miniJson: JSON.stringify({ id: fw.id }) },
  717. // });
  718. if(props.pageType === 'agri_record'){
  719. router.push({
  720. path: "/status_detail",
  721. query: { miniJson: JSON.stringify({ farmWorkLibId: fw.farmWorkLibId, farmWorkRecordId: fw.farmWorkRecordId, farmId: props.farmId }) },
  722. });
  723. }
  724. };
  725. // 格式化日期为 MM-DD 格式
  726. const formatDate = (dateStr) => {
  727. if (!dateStr) return "--";
  728. const date = new Date(dateStr);
  729. if (Number.isNaN(date.getTime())) return dateStr;
  730. const m = `${date.getMonth() + 1}`.padStart(2, "0");
  731. const d = `${date.getDate()}`.padStart(2, "0");
  732. return `${m}-${d}`;
  733. };
  734. // 格式化日期为 YYYY-MM-DD 格式(用于接口调用)
  735. const formatDateForAPI = (dateStr) => {
  736. if (!dateStr) return null;
  737. const date = new Date(dateStr);
  738. if (Number.isNaN(date.getTime())) return null;
  739. const y = date.getFullYear();
  740. const m = `${date.getMonth() + 1}`.padStart(2, "0");
  741. const d = `${date.getDate()}`.padStart(2, "0");
  742. return `${y}-${m}-${d}`;
  743. };
  744. // 格式化日期为 YYMMDD 格式(如:260110,26为年份,01为月份,10为日)
  745. const formatDateToYYMMDD = (dateStr) => {
  746. if (!dateStr) return "";
  747. const date = new Date(dateStr);
  748. if (Number.isNaN(date.getTime())) return "";
  749. const y = `${date.getFullYear()}`.substring(2); // 获取后两位年份,如 2026 -> 26
  750. const m = `${date.getMonth() + 1}`.padStart(2, "0");
  751. const d = `${date.getDate()}`.padStart(2, "0");
  752. return `${y}${m}${d}`;
  753. };
  754. // 获取下一个即将到来的节气(当前节气)的 progress
  755. const getNextTermProgress = () => {
  756. if (!solarTerms.value || solarTerms.value.length === 0) return Infinity;
  757. const now = new Date();
  758. now.setHours(0, 0, 0, 0);
  759. let nextTermProgress = Infinity;
  760. // 找到当前日期之后的下一个节气(当前节气)
  761. solarTerms.value.forEach((term) => {
  762. const termDate = safeParseDate(term.createDate);
  763. if (!isNaN(termDate)) {
  764. const termDateObj = new Date(termDate);
  765. termDateObj.setHours(0, 0, 0, 0);
  766. // 找到大于等于当前日期的第一个节气
  767. if (termDateObj >= now) {
  768. const termProgress = Number(term.progress) || 0;
  769. if (termProgress < nextTermProgress) {
  770. nextTermProgress = termProgress;
  771. }
  772. }
  773. }
  774. });
  775. // 如果没有找到未来的节气,说明所有节气都已过,返回 Infinity(所有物候期都显示蓝色)
  776. return nextTermProgress === Infinity ? Infinity : nextTermProgress;
  777. };
  778. // 根据物候期的 progress 判断它所属节气的 progress
  779. const getPhenologyTermProgress = (phenologyProgress) => {
  780. if (!solarTerms.value || solarTerms.value.length === 0) return -1;
  781. const progress = Number(phenologyProgress) || 0;
  782. // 找到物候期所属的节气(progress 最接近且小于等于的节气)
  783. let matchedTermProgress = -1;
  784. solarTerms.value.forEach((term) => {
  785. const termProgress = Number(term.progress) || 0;
  786. if (progress >= termProgress && termProgress > matchedTermProgress) {
  787. matchedTermProgress = termProgress;
  788. }
  789. });
  790. // 如果物候期的 progress 小于所有节气,返回第一个节气的 progress
  791. if (matchedTermProgress === -1 && solarTerms.value.length > 0) {
  792. const firstTermProgress = Number(solarTerms.value[0].progress) || 0;
  793. return firstTermProgress;
  794. }
  795. return matchedTermProgress;
  796. };
  797. // 判断物候期是否应该显示蓝色(已过或当前节气的物候期)
  798. const shouldShowBlue = (phenology) => {
  799. // 获取下一个即将到来的节气(当前节气)的 progress
  800. const nextTermProgress = getNextTermProgress();
  801. // 如果所有节气都已过(nextTermProgress === Infinity),所有物候期都显示蓝色
  802. if (nextTermProgress === Infinity) {
  803. return true;
  804. }
  805. // 根据物候期的 progress 判断它属于哪个节气
  806. const phenologyProgress = Math.min(Number(phenology?.progress) || 0, Number(phenology?.progress2) || 0);
  807. const phenologyTermProgress = getPhenologyTermProgress(phenologyProgress);
  808. // 找到下一个节气的完整信息,用于判断物候期是否属于当前节气
  809. let nextTerm = null;
  810. solarTerms.value.forEach((term) => {
  811. const termProgress = Number(term.progress) || 0;
  812. if (termProgress === nextTermProgress) {
  813. nextTerm = term;
  814. }
  815. });
  816. // 如果物候期所属的节气的 progress < 下一个节气的 progress,显示蓝色
  817. // 如果物候期所属的节气的 progress === 下一个节气的 progress,也显示蓝色(当前节气)
  818. // 也就是说,只有属于当前节气或之前节气的物候期才显示蓝色
  819. if (phenologyTermProgress === -1) {
  820. return false;
  821. }
  822. // 如果物候期正好属于下一个节气,需要判断它的 progress 是否在下一个节气的范围内
  823. if (phenologyTermProgress === nextTermProgress && nextTerm) {
  824. // 如果物候期的 progress 小于等于下一个节气的 progress,说明它属于当前节气,显示蓝色
  825. return phenologyProgress <= nextTermProgress;
  826. }
  827. // 如果物候期所属的节气的 progress < 下一个节气的 progress,显示蓝色
  828. return phenologyTermProgress < nextTermProgress;
  829. };
  830. defineExpose({
  831. updateFarmWorkPlan,
  832. });
  833. // 使用 ResizeObserver 监听高度变化,确保在DOM完全渲染后获取准确高度
  834. const setupResizeObserver = () => {
  835. if (!timelineListRef.value || typeof ResizeObserver === "undefined") {
  836. return;
  837. }
  838. // 如果已经存在观察者,先断开
  839. if (resizeObserver) {
  840. resizeObserver.disconnect();
  841. }
  842. // 创建新的观察者
  843. resizeObserver = new ResizeObserver((entries) => {
  844. for (const entry of entries) {
  845. const height = entry.contentRect.height;
  846. if (height > 0 && height !== timelineListHeight.value) {
  847. timelineListHeight.value = height;
  848. }
  849. }
  850. });
  851. // 开始观察
  852. resizeObserver.observe(timelineListRef.value);
  853. };
  854. // 组件挂载后设置 ResizeObserver
  855. onMounted(() => {
  856. nextTick(() => {
  857. requestAnimationFrame(() => {
  858. setupResizeObserver();
  859. });
  860. });
  861. });
  862. // 组件卸载前清理 ResizeObserver
  863. onUnmounted(() => {
  864. if (resizeObserver) {
  865. resizeObserver.disconnect();
  866. resizeObserver = null;
  867. }
  868. });
  869. // 在数据更新后重新设置 ResizeObserver
  870. watch(
  871. () => phenologyList.value.length,
  872. () => {
  873. nextTick(() => {
  874. requestAnimationFrame(() => {
  875. setupResizeObserver();
  876. });
  877. });
  878. }
  879. );
  880. </script>
  881. <style scoped lang="scss">
  882. .timeline-container {
  883. height: 100%;
  884. overflow: auto;
  885. position: relative;
  886. box-sizing: border-box;
  887. .timeline-list {
  888. position: relative;
  889. }
  890. .timeline-middle-line {
  891. position: absolute;
  892. left: 13px;
  893. /* 位于节气文字列中间(列宽约30px) */
  894. top: 0;
  895. bottom: 0;
  896. width: 2px;
  897. background: #e8e8e8;
  898. z-index: 1;
  899. }
  900. .phenology-bar {
  901. align-items: stretch;
  902. justify-content: center;
  903. box-sizing: border-box;
  904. position: relative;
  905. .phenology-title {
  906. width: 18px;
  907. height: 98.5%;
  908. color: #fff;
  909. font-size: 12px;
  910. position: absolute;
  911. left: 39px;
  912. z-index: 10;
  913. text-align: center;
  914. display: flex;
  915. align-items: center;
  916. &.phenology-blue {
  917. background: #2199f8;
  918. }
  919. &.phenology-red {
  920. background: #f1f1f1;
  921. color: #808080;
  922. }
  923. }
  924. .reproductive-item {
  925. font-size: 12px;
  926. text-align: center;
  927. word-break: break-all;
  928. writing-mode: vertical-rl;
  929. text-orientation: upright;
  930. letter-spacing: 3px;
  931. width: 100%;
  932. line-height: 23px;
  933. color: inherit;
  934. position: relative;
  935. .phenology-name {
  936. width: 18px;
  937. line-height: 16px;
  938. height: 100%;
  939. color: #fff;
  940. padding: 4px 0;
  941. font-size: 12px;
  942. box-sizing: border-box;
  943. &.mr {
  944. margin-right: 3px;
  945. }
  946. &.single {
  947. width: 39px;
  948. line-height: 39px;
  949. }
  950. &.phenology-blue {
  951. background: #2199f8;
  952. }
  953. &.phenology-red {
  954. background: #f1f1f1;
  955. color: #808080;
  956. }
  957. &.text-blue {
  958. background: rgba(33, 153, 248, 0.15);
  959. color: #2199f8;
  960. border: 1px solid #2199f8;
  961. line-height: 16px;
  962. box-sizing: border-box;
  963. }
  964. &.text-red {
  965. background: rgba(128, 128, 128, 0.15);
  966. color: #808080;
  967. border: 1px solid rgba(128, 128, 128, 0.35);
  968. line-height: 16px;
  969. box-sizing: border-box;
  970. }
  971. }
  972. .arranges {
  973. display: flex;
  974. max-width: calc(100vw - 118px);
  975. min-width: calc(100vw - 118px);
  976. gap: 5px;
  977. letter-spacing: 0px;
  978. // min-height: 90px;
  979. .arrange-card {
  980. width: 95%;
  981. border: 0.5px solid #2199f8;
  982. border-radius: 8px;
  983. background: #fff;
  984. box-sizing: border-box;
  985. position: relative;
  986. padding: 8px 15px 8px 10px;
  987. writing-mode: horizontal-tb;
  988. margin-bottom: 10px;
  989. // &.last-card {
  990. // margin-bottom: 0;
  991. // }
  992. .card-content {
  993. color: #242424;
  994. display: flex;
  995. justify-content: space-between;
  996. align-items: center;
  997. font-size: 14px;
  998. .card-left {
  999. width: calc(100% - 45px);
  1000. .left-info {
  1001. display: flex;
  1002. align-items: center;
  1003. gap: 6px;
  1004. .left-date {
  1005. color: #2199f8;
  1006. border: 1px solid #2199f8;
  1007. padding: 1px 5px;
  1008. border-radius: 2px;
  1009. font-size: 12px;
  1010. }
  1011. .text {
  1012. display: flex;
  1013. align-items: center;
  1014. gap: 2px;
  1015. width: calc(100% - 50px);
  1016. }
  1017. }
  1018. .title-text {
  1019. margin-top: 5px;
  1020. width: fit-content;
  1021. max-width: 100%;
  1022. text-align: left;
  1023. color: #2199F8;
  1024. padding: 0 6px;
  1025. border-radius: 2px;
  1026. font-size: 12px;
  1027. box-sizing: border-box;
  1028. background: rgba(33, 153, 248, 0.1);
  1029. }
  1030. &.agri-record-card {
  1031. .title-wrap{
  1032. display: flex;
  1033. align-items: flex-end;
  1034. gap: 6px;
  1035. .expert-info{
  1036. display: flex;
  1037. align-items: center;
  1038. gap: 2px;
  1039. font-size: 12px;
  1040. color: #B7B7B7;
  1041. }
  1042. }
  1043. }
  1044. }
  1045. .card-right {
  1046. display: flex;
  1047. align-items: center;
  1048. position: relative;
  1049. img {
  1050. width: 45px;
  1051. height: 45px;
  1052. border-radius: 4px;
  1053. object-fit: cover;
  1054. }
  1055. .num {
  1056. position: absolute;
  1057. width: 18px;
  1058. height: 18px;
  1059. box-sizing: border-box;
  1060. top: -4px;
  1061. right: -6px;
  1062. background: #BFBFBF;
  1063. color: #fff;
  1064. font-size: 12px;
  1065. border-radius: 50%;
  1066. display: flex;
  1067. align-items: center;
  1068. justify-content: center;
  1069. }
  1070. }
  1071. }
  1072. &::before {
  1073. content: "";
  1074. position: absolute;
  1075. left: -5px;
  1076. top: 50%;
  1077. transform: translateY(-50%);
  1078. width: 0;
  1079. height: 0;
  1080. border-top: 5px solid transparent;
  1081. border-bottom: 5px solid transparent;
  1082. border-right: 5px solid #2199f8;
  1083. }
  1084. }
  1085. .arrange-card.normal-style {
  1086. opacity: 0.3;
  1087. }
  1088. .arrange-card.future-card .card-content {
  1089. color: #808080;
  1090. }
  1091. .arrange-card.status-normal {
  1092. border-color: #2199f8;
  1093. &::before {
  1094. border-right-color: #2199f8;
  1095. }
  1096. }
  1097. .arrange-card.status-warning {
  1098. border-color: #FF4E4E;
  1099. .card-left {
  1100. .left-info {
  1101. .left-date {
  1102. color: #FF4E4E;
  1103. border-color: #FF4E4E;
  1104. }
  1105. }
  1106. .title-text{
  1107. color: #FF4E4E;
  1108. background: rgba(255, 78, 78, 0.1);
  1109. }
  1110. }
  1111. &::before {
  1112. border-right-color: #FF4E4E;
  1113. }
  1114. }
  1115. .arrange-card.status-complete {
  1116. border-color: #FF943D;
  1117. .card-left {
  1118. .left-info {
  1119. .left-date {
  1120. color: #FF943D;
  1121. border-color: #FF943D;
  1122. }
  1123. }
  1124. .title-text{
  1125. color: #FF943D;
  1126. background: rgba(255, 149, 61, 0.1);
  1127. }
  1128. }
  1129. &::before {
  1130. border-right-color: #FF943D;
  1131. }
  1132. }
  1133. .arrange-card.status-act {
  1134. border-color: #FF953D;
  1135. .card-left {
  1136. .left-info {
  1137. .left-date {
  1138. color: #FF953D;
  1139. border-color: #FF953D;
  1140. }
  1141. }
  1142. .title-text{
  1143. color: #fff;
  1144. background: #FF953D;
  1145. }
  1146. }
  1147. &::before {
  1148. border-right-color: #FF953D;
  1149. }
  1150. }
  1151. .arrange-card.status-default {
  1152. border-color: #BBBBBB;
  1153. .card-left {
  1154. .left-info {
  1155. .left-date {
  1156. color: #BBBBBB;
  1157. border-color: #BBBBBB;
  1158. }
  1159. .text-name,.text-icon{
  1160. color: #BBBBBB;
  1161. }
  1162. }
  1163. .title-text{
  1164. color: #fff;
  1165. background: #BBBBBB;
  1166. }
  1167. }
  1168. &::before {
  1169. border-right-color: #BBBBBB;
  1170. }
  1171. }
  1172. // 未来节气对应的农事卡片:跟随左侧物候期的“未开始”灰色样式
  1173. .arrange-card.future-card {
  1174. border-color: #e4e4e4;
  1175. .card-left {
  1176. .left-info {
  1177. .left-date {
  1178. color: #fff;
  1179. background: #e4e4e4;
  1180. border-color: #e4e4e4;
  1181. }
  1182. }
  1183. }
  1184. &::before {
  1185. border-right-color: #e4e4e4;
  1186. }
  1187. }
  1188. }
  1189. }
  1190. }
  1191. .reproductive-item+.reproductive-item {
  1192. padding-top: 3px;
  1193. }
  1194. .phenology-bar+.phenology-bar {
  1195. padding-top: 3px;
  1196. }
  1197. .timeline-term {
  1198. position: absolute;
  1199. width: 32px;
  1200. display: flex;
  1201. align-items: flex-start;
  1202. flex-direction: column;
  1203. z-index: 2;
  1204. /* 置于中线之上 */
  1205. color: rgba(174, 174, 174, 0.6);
  1206. .term-name {
  1207. display: inline-block;
  1208. width: 100%;
  1209. min-height: 20px;
  1210. line-height: 26px;
  1211. background: #fff;
  1212. font-size: 12px;
  1213. }
  1214. }
  1215. .empty-state {
  1216. display: flex;
  1217. justify-content: center;
  1218. align-items: center;
  1219. min-height: 200px;
  1220. width: 100%;
  1221. }
  1222. }
  1223. </style>
  1224. <style lang="scss" scoped>
  1225. .image-popup {
  1226. width: 327px;
  1227. border-radius: 8px;
  1228. .popup-content {
  1229. width: 100%;
  1230. }
  1231. }
  1232. </style>