FarmWorkPlanTimeline.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769
  1. <template>
  2. <div class="timeline-container" ref="timelineContainerRef">
  3. <div class="timeline-list" ref="timelineListRef">
  4. <div class="timeline-middle-line"></div>
  5. <div
  6. v-for="(t, tIdx) in solarTerms"
  7. :key="`term-${uniqueTimestamp}-${tIdx}`"
  8. class="timeline-term"
  9. :style="getTermStyle(t, tIdx)"
  10. >
  11. <span class="term-name">{{ t.displayName }}</span>
  12. </div>
  13. <div v-for="(p, idx) in phenologyList" :key="`phenology-${uniqueTimestamp}-${idx}`" class="phenology-bar">
  14. <div
  15. v-for="(r, rIdx) in Array.isArray(p.reproductiveList) ? p.reproductiveList : []"
  16. :key="`reproductive-${uniqueTimestamp}-${idx}-${rIdx}`"
  17. class="reproductive-item"
  18. >
  19. <div class="arranges">
  20. <div
  21. v-for="(fw, aIdx) in Array.isArray(r.farmWorkArrangeList) ? r.farmWorkArrangeList : []"
  22. :key="`arrange-${uniqueTimestamp}-${idx}-${rIdx}-${aIdx}`"
  23. class="arrange-card"
  24. :style="
  25. shouldShowIncompleteStatus(fw.farmWorkId)
  26. ? 'padding-bottom: 18px;'
  27. : 'padding-bottom: 10px'
  28. "
  29. :class="getArrangeStatusClass(fw)"
  30. @click="handleRowClick(fw)"
  31. >
  32. <div class="card-header">
  33. <div class="header-left">
  34. <span class="farm-work-name">{{ fw.farmWorkName || "--" }}</span>
  35. <span class="tag-standard">{{ farmWorkType[fw.type] }}</span>
  36. </div>
  37. <div class="header-right" v-if="!isStandard">
  38. {{ fw.isFollow == 1 ? "已关注" : fw.isFollow == 2 ? "托管农事" : "" }}
  39. </div>
  40. </div>
  41. <div class="card-content">
  42. <span>{{ fw.interactionQuestion || "暂无提示" }}</span>
  43. <span
  44. v-if="!disableClick"
  45. :class="shouldShowIncompleteStatus(fw.farmWorkId) ? 'link-warning' : 'edit-link'"
  46. @click.stop="handleEdit(fw)"
  47. >点击编辑</span
  48. >
  49. </div>
  50. <div class="card-status" v-if="shouldShowIncompleteStatus(fw.farmWorkId)">
  51. <el-icon color="#FF953D" size="13"><WarningFilled /></el-icon>
  52. <span>未完善</span>
  53. </div>
  54. </div>
  55. </div>
  56. <div class="phenology-name">{{ r.name }}</div>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. <!-- 互动设置弹窗 -->
  62. <interact-popup ref="interactPopupRef" @handleSaveSuccess="updateFarmWorkPlan"></interact-popup>
  63. </template>
  64. <script setup>
  65. import { ref, nextTick, watch, onMounted, onUnmounted } from "vue";
  66. import interactPopup from "@/components/popup/interactPopup.vue";
  67. import { ElMessage } from "element-plus";
  68. import { WarningFilled } from "@element-plus/icons-vue";
  69. const props = defineProps({
  70. // 农场 ID,用于请求农事规划数据
  71. farmId: {
  72. type: [String, Number],
  73. default: null,
  74. },
  75. // 页面类型:种植方案 / 农事规划,用来控制高度样式
  76. pageType: {
  77. type: String,
  78. default: "",
  79. },
  80. // 是否禁用所有点击事件(用于只读展示)
  81. disableClick: {
  82. type: Boolean,
  83. default: false,
  84. },
  85. containerId: {
  86. type: [Number, String],
  87. default: null,
  88. },
  89. // 是否是标准农事
  90. isStandard: {
  91. type: Boolean,
  92. default: false,
  93. },
  94. // 方案ID
  95. schemeId: {
  96. type: [Number, String],
  97. default: null,
  98. },
  99. });
  100. const farmWorkType = {
  101. 0: "预警农事",
  102. 1: "标准农事",
  103. 2: "建议农事",
  104. 3: "自建农事",
  105. };
  106. const emits = defineEmits(["row-click"]);
  107. const solarTerms = ref([]);
  108. const phenologyList = ref([]);
  109. const timelineContainerRef = ref(null);
  110. const timelineListRef = ref(null);
  111. // 标记是否为首次加载
  112. const isInitialLoad = ref(true);
  113. // 存储timeline-list的实际渲染高度
  114. const timelineListHeight = ref(0);
  115. // 生成唯一的时间戳,用于确保key的唯一性
  116. const uniqueTimestamp = ref(Date.now());
  117. // ResizeObserver 实例,用于监听高度变化
  118. let resizeObserver = null;
  119. // 获取当前季节
  120. const getCurrentSeason = () => {
  121. const month = new Date().getMonth() + 1; // 1-12
  122. if (month >= 3 && month <= 5) {
  123. return "spring"; // 春季:3-5月
  124. } else if (month >= 6 && month <= 8) {
  125. return "summer"; // 夏季:6-8月
  126. } else if (month >= 9 && month <= 10) {
  127. return "autumn"; // 秋季:9-10月
  128. } else {
  129. return "winter"; // 冬季:11-2月
  130. }
  131. };
  132. // 安全解析时间到时间戳(ms)
  133. const safeParseDate = (val) => {
  134. if (!val) return NaN;
  135. if (val instanceof Date) return val.getTime();
  136. if (typeof val === "number") return val;
  137. if (typeof val === "string") {
  138. // 兼容 "YYYY-MM-DD HH:mm:ss" -> Safari
  139. const s = val.replace(/-/g, "/").replace("T", " ");
  140. const d = new Date(s);
  141. return isNaN(d.getTime()) ? NaN : d.getTime();
  142. }
  143. return NaN;
  144. };
  145. const batchValidateData = ref({});
  146. const allTrue = ref(false);
  147. const invalidIds = ref([]);
  148. const invalidArr = ref([]);
  149. // 验证农事卡片药肥报价信息是否完整
  150. const batchValidatePesticideFertilizerQuotes = (ids, items) => {
  151. if (props.isStandard) {
  152. return;
  153. }
  154. VE_API.monitor
  155. .batchValidatePesticideFertilizerQuotes({ ids, schemeId: props.schemeId })
  156. .then(({ data, code }) => {
  157. if (code === 0) {
  158. batchValidateData.value = data || {};
  159. allTrue.value = Object.values(data).every((value) => value === true);
  160. invalidIds.value = Object.keys(data).filter((key) => data[key] !== true);
  161. // 清空之前的arrangeIds
  162. invalidArr.value = [];
  163. // 遍历items,判断farmWorkId是否在invalidIds中,如果对应上了就把item.id push进去
  164. items.forEach((item) => {
  165. // 判断item.farmWorkId是否在invalidIds数组中(需要转换为字符串进行比较)
  166. const farmWorkIdStr = String(item.farmWorkId);
  167. if (invalidIds.value.includes(farmWorkIdStr)) {
  168. invalidArr.value.push({
  169. arrangeId: item.id,
  170. farmWorkId: item.farmWorkId,
  171. });
  172. }
  173. });
  174. }
  175. })
  176. .catch(() => {});
  177. };
  178. // 判断是否应该显示"未完善"状态
  179. // 如果batchValidateData中对应的farmWorkId验证结果为true(已完善),则不显示
  180. // 如果验证结果为false(未完善)或不存在,则显示
  181. const shouldShowIncompleteStatus = (farmWorkId) => {
  182. if (!farmWorkId || !batchValidateData.value || typeof batchValidateData.value !== "object") {
  183. // 如果没有验证数据,默认不显示
  184. return false;
  185. }
  186. // 从对象中直接获取验证结果,支持字符串和数字类型的key
  187. const isValid =
  188. batchValidateData.value[farmWorkId] !== undefined
  189. ? batchValidateData.value[farmWorkId]
  190. : batchValidateData.value[String(farmWorkId)] !== undefined
  191. ? batchValidateData.value[String(farmWorkId)]
  192. : undefined;
  193. // 如果找到了验证结果
  194. if (isValid !== undefined) {
  195. // 如果验证结果为true(已完善),返回false(不显示)
  196. // 如果验证结果为false(未完善),返回true(显示)
  197. return !isValid;
  198. }
  199. // 如果没有找到验证结果,默认不显示
  200. return false;
  201. };
  202. // 计算物候期需要的实际高度(基于农事数量)
  203. const getPhenologyRequiredHeight = (item) => {
  204. // 统计该物候期内的农事数量
  205. let farmWorkCount = 0;
  206. if (Array.isArray(item.reproductiveList)) {
  207. item.reproductiveList.forEach((reproductive) => {
  208. if (Array.isArray(reproductive.farmWorkArrangeList)) {
  209. farmWorkCount += reproductive.farmWorkArrangeList.length;
  210. }
  211. });
  212. }
  213. // 如果没有农事,给一个最小高度
  214. if (farmWorkCount === 0) {
  215. return 50; // 最小50px
  216. }
  217. // 每个农事卡片的高度(根据实际内容,卡片高度可能因内容而异)
  218. // 卡片包含:padding(8px*2) + header(约25px) + content margin(4px+2px) + content(约25-30px) = 约72-77px
  219. // 考虑到内容可能换行,实际高度可能更高,设置为120px更安全,避免卡片重叠
  220. const farmWorkCardHeight = 120; // 卡片高度估算,确保能容纳内容且不重叠
  221. // 卡片之间的间距(与CSS中的gap保持一致)
  222. const cardGap = 12;
  223. // 计算总高度:卡片数量 * 卡片高度 + (卡片数量 - 1) * 间距
  224. // 如果有多个卡片,需要加上它们之间的间距
  225. const totalHeight = farmWorkCount * farmWorkCardHeight + (farmWorkCount > 1 ? (farmWorkCount - 1) * cardGap : 0);
  226. // 返回精确的总高度,只保留最小高度限制,不添加额外余量
  227. return Math.max(totalHeight, 50); // 最小50px,精确匹配农事卡片高度
  228. };
  229. // 计算所有物候期的累积位置和总高度
  230. const calculatePhenologyPositions = () => {
  231. let currentTop = 10; // 起始位置,留出顶部间距
  232. const positions = new Map();
  233. // 按progress排序物候期,确保按时间顺序排列
  234. const sortedPhenologyList = [...phenologyList.value].sort((a, b) => {
  235. const aProgress = Math.min(Number(a?.progress) || 0, Number(a?.progress2) || 0);
  236. const bProgress = Math.min(Number(b?.progress) || 0, Number(b?.progress2) || 0);
  237. return aProgress - bProgress;
  238. });
  239. sortedPhenologyList.forEach((phenology) => {
  240. const height = getPhenologyRequiredHeight(phenology);
  241. // 使用与数据生成时相同的ID生成逻辑
  242. const itemId =
  243. phenology.id ?? phenology.phenologyId ?? phenology.name ?? `${phenology.progress}-${phenology.progress2}`;
  244. positions.set(itemId, {
  245. top: currentTop,
  246. height: height,
  247. });
  248. currentTop += height; // 紧挨着下一个物候期,不留间距
  249. });
  250. return {
  251. positions,
  252. totalHeight: currentTop, // 总高度 = 最后一个物候期的底部位置,不添加额外间距
  253. };
  254. };
  255. // 计算所有农事的总高度(基于物候期紧挨排列)
  256. const calculateTotalHeightByFarmWorks = () => {
  257. const { totalHeight } = calculatePhenologyPositions();
  258. // 如果有物候期数据,直接使用计算出的总高度
  259. // totalHeight 已经包含了从 10 开始的起始位置和所有物候期的高度
  260. if (totalHeight > 10) {
  261. // 确保总高度至少能容纳所有节气(每个节气至少50px)
  262. const baseHeight = (solarTerms.value?.length || 0) * 50;
  263. // 返回物候期总高度和基础高度的较大值,确保节气能正常显示
  264. return Math.max(totalHeight, baseHeight);
  265. }
  266. // 如果没有物候期数据,返回基础高度
  267. const baseHeight = (solarTerms.value?.length || 0) * 50;
  268. return baseHeight || 100; // 至少返回100px,避免为0
  269. };
  270. const getTermStyle = (t, index) => {
  271. // 优先使用实际测量的timeline-list高度,如果没有测量到则使用计算值作为后备
  272. const totalHeight = timelineListHeight.value > 0 ? timelineListHeight.value : calculateTotalHeightByFarmWorks();
  273. // 获取节气总数
  274. const termCount = solarTerms.value?.length || 1;
  275. // 等分高度:总高度 / 节气数量
  276. const termHeight = totalHeight / termCount;
  277. // 计算top位置:索引 * 每个节气的高度
  278. const top = index * termHeight;
  279. return {
  280. position: "absolute",
  281. top: `${top}px`,
  282. left: 0,
  283. width: "30px",
  284. height: `${termHeight}px`, // 高度等分,使用实际测量的高度
  285. display: "flex",
  286. alignItems: "center",
  287. };
  288. };
  289. // 点击季节 → 滚动到对应节气(立春/立夏/立秋/立冬)
  290. const handleSeasonClick = (seasonValue) => {
  291. const mapping = {
  292. spring: "立春",
  293. summer: "立夏",
  294. autumn: "立秋",
  295. winter: "立冬",
  296. };
  297. const targetName = mapping[seasonValue];
  298. if (!targetName) return;
  299. // 查找对应的节气
  300. const targetIndex = solarTerms.value.findIndex((t) => (t?.displayName || "") === targetName);
  301. if (targetIndex === -1) return;
  302. // 计算目标节气的top位置
  303. const totalHeight = timelineListHeight.value > 0 ? timelineListHeight.value : calculateTotalHeightByFarmWorks();
  304. const termCount = solarTerms.value?.length || 1;
  305. const termHeight = totalHeight / termCount;
  306. const targetTop = targetIndex * termHeight;
  307. // 滚动到目标位置
  308. const wrap = timelineContainerRef.value;
  309. if (!wrap) return;
  310. const viewH = wrap.clientHeight || 0;
  311. const maxScroll = Math.max(0, wrap.scrollHeight - viewH);
  312. // 将目标位置稍微靠上(使用 0.1 视口高度做偏移)
  313. let scrollTop = Math.max(0, targetTop - viewH * 0.1);
  314. if (scrollTop > maxScroll) scrollTop = maxScroll;
  315. wrap.scrollTo({ top: scrollTop, behavior: "smooth" });
  316. };
  317. // 农事状态样式映射(0:取消关注,1:关注,2:托管农事,)
  318. const getArrangeStatusClass = (fw) => {
  319. const t = fw?.isFollow;
  320. const warningStatus = shouldShowIncompleteStatus(fw.farmWorkId);
  321. if (t == 0) return "normal-style";
  322. if (warningStatus) return "status-warning";
  323. // if (t >= 0 && t <= 4) return "status-normal";
  324. // if (t === 5) return "status-complete";
  325. return "status-normal";
  326. };
  327. const handleRowClick = (item) => {
  328. item.isEdit = shouldShowIncompleteStatus(item.farmWorkId);
  329. item.invalidIds = invalidIds.value;
  330. item.invalidArr = invalidArr.value;
  331. emits("row-click", item);
  332. };
  333. const interactPopupRef = ref(null);
  334. const handleEdit = (item) => {
  335. if (props.disableClick) return;
  336. if (interactPopupRef.value) {
  337. interactPopupRef.value.showPopup(item);
  338. }
  339. };
  340. // 获取农事规划数据
  341. const getFarmWorkPlan = () => {
  342. if (!props.farmId && !props.containerId) return;
  343. // 更新时间戳,确保key变化,触发DOM重新渲染
  344. uniqueTimestamp.value = Date.now();
  345. // 重置测量高度,等待重新测量
  346. timelineListHeight.value = 0;
  347. let savedScrollTop = 0;
  348. if (!isInitialLoad.value && timelineContainerRef.value) {
  349. savedScrollTop = timelineContainerRef.value.scrollTop || 0;
  350. }
  351. VE_API.monitor
  352. .farmWorkPlan({ farmId: props.farmId, containerId: props.containerId, schemeId: props.schemeId })
  353. .then(({ data, code }) => {
  354. if (code === 0) {
  355. const list = Array.isArray(data?.solarTermsList) ? data.solarTermsList : [];
  356. const filtered = list
  357. .filter((t) => t && t.type === 1)
  358. .map((t) => ({
  359. id:
  360. t.id ??
  361. t.solarTermsId ??
  362. t.termId ??
  363. `${t.name || t.solarTermsName || t.termName || "term"}-${t.createDate || ""}`,
  364. displayName: t.name || t.solarTermsName || t.termName || "节气",
  365. createDate: t.createDate || null,
  366. progress: Number(t.progress) || 0,
  367. }));
  368. solarTerms.value = filtered;
  369. // 物候期数据
  370. phenologyList.value = Array.isArray(data?.phenologyList)
  371. ? data.phenologyList.map((it) => {
  372. const reproductiveList = Array.isArray(it.reproductiveList)
  373. ? it.reproductiveList.map((r) => {
  374. const farmWorkArrangeList = Array.isArray(r.farmWorkArrangeList)
  375. ? r.farmWorkArrangeList.map((fw) => ({
  376. ...fw,
  377. containerSpaceTimeId: it.containerSpaceTimeId,
  378. }))
  379. : [];
  380. return {
  381. ...r,
  382. farmWorkArrangeList,
  383. };
  384. })
  385. : [];
  386. return {
  387. id: it.id ?? it.phenologyId ?? it.name ?? `${it.progress}-${it.progress2}`,
  388. progress: Number(it.progress) || 0, // 起点 %
  389. progress2: Number(it.progress2) || 0, // 终点 %
  390. startTimeMs: safeParseDate(
  391. it.startDate || it.beginDate || it.startTime || it.start || it.start_at
  392. ),
  393. reproductiveList,
  394. };
  395. })
  396. : [];
  397. // 使用多次 nextTick 和 requestAnimationFrame 确保DOM完全渲染
  398. nextTick(() => {
  399. requestAnimationFrame(() => {
  400. nextTick(() => {
  401. requestAnimationFrame(() => {
  402. // 测量timeline-list的实际渲染高度
  403. if (timelineListRef.value) {
  404. const height =
  405. timelineListRef.value.offsetHeight || timelineListRef.value.clientHeight;
  406. if (height > 0) {
  407. timelineListHeight.value = height;
  408. // 如果是首次加载,滚动到当前季节对应的节气
  409. if (isInitialLoad.value) {
  410. const currentSeason = getCurrentSeason();
  411. handleSeasonClick(currentSeason);
  412. isInitialLoad.value = false;
  413. }
  414. }
  415. }
  416. if (isInitialLoad.value) {
  417. // 如果测量失败,延迟一下再尝试滚动
  418. setTimeout(() => {
  419. if (timelineListRef.value) {
  420. const height =
  421. timelineListRef.value.offsetHeight ||
  422. timelineListRef.value.clientHeight;
  423. if (height > 0) {
  424. timelineListHeight.value = height;
  425. }
  426. }
  427. const currentSeason = getCurrentSeason();
  428. handleSeasonClick(currentSeason);
  429. isInitialLoad.value = false;
  430. }, 200);
  431. } else if (timelineContainerRef.value && savedScrollTop > 0) {
  432. timelineContainerRef.value.scrollTop = savedScrollTop;
  433. }
  434. });
  435. });
  436. });
  437. });
  438. // 收集所有farmWorkId
  439. const farmWorkIds = [];
  440. const farmWorks = [];
  441. phenologyList.value.forEach((phenology) => {
  442. if (Array.isArray(phenology.reproductiveList)) {
  443. phenology.reproductiveList.forEach((reproductive) => {
  444. if (Array.isArray(reproductive.farmWorkArrangeList)) {
  445. reproductive.farmWorkArrangeList.forEach((farmWork) => {
  446. if (farmWork.farmWorkId && farmWork.isFollow !== 0) {
  447. farmWorkIds.push(farmWork.farmWorkId);
  448. farmWorks.push(farmWork);
  449. }
  450. });
  451. }
  452. });
  453. }
  454. });
  455. // 调用验证方法,传入所有ids
  456. if (farmWorkIds.length > 0) {
  457. batchValidatePesticideFertilizerQuotes(farmWorkIds, farmWorks);
  458. }
  459. }
  460. })
  461. .catch((error) => {
  462. console.error("获取农事规划数据失败:", error);
  463. ElMessage.error("获取农事规划数据失败");
  464. });
  465. };
  466. const updateFarmWorkPlan = () => {
  467. solarTerms.value = [];
  468. phenologyList.value = [];
  469. getFarmWorkPlan();
  470. };
  471. watch(
  472. () => props.farmId || props.containerId,
  473. (val) => {
  474. if (val) {
  475. isInitialLoad.value = true;
  476. updateFarmWorkPlan();
  477. }
  478. },
  479. { immediate: true }
  480. );
  481. watch(
  482. () => props.schemeId,
  483. (val) => {
  484. if (val) {
  485. updateFarmWorkPlan();
  486. }
  487. }
  488. );
  489. // 使用 ResizeObserver 监听高度变化,确保在DOM完全渲染后获取准确高度
  490. const setupResizeObserver = () => {
  491. if (!timelineListRef.value || typeof ResizeObserver === "undefined") {
  492. return;
  493. }
  494. // 如果已经存在观察者,先断开
  495. if (resizeObserver) {
  496. resizeObserver.disconnect();
  497. }
  498. // 创建新的观察者
  499. resizeObserver = new ResizeObserver((entries) => {
  500. for (const entry of entries) {
  501. const height = entry.contentRect.height;
  502. if (height > 0 && height !== timelineListHeight.value) {
  503. timelineListHeight.value = height;
  504. }
  505. }
  506. });
  507. // 开始观察
  508. resizeObserver.observe(timelineListRef.value);
  509. };
  510. // 组件挂载后设置 ResizeObserver
  511. onMounted(() => {
  512. nextTick(() => {
  513. requestAnimationFrame(() => {
  514. setupResizeObserver();
  515. });
  516. });
  517. });
  518. // 组件卸载前清理 ResizeObserver
  519. onUnmounted(() => {
  520. if (resizeObserver) {
  521. resizeObserver.disconnect();
  522. resizeObserver = null;
  523. }
  524. });
  525. // 在数据更新后重新设置 ResizeObserver
  526. watch(
  527. () => phenologyList.value.length,
  528. () => {
  529. nextTick(() => {
  530. requestAnimationFrame(() => {
  531. setupResizeObserver();
  532. });
  533. });
  534. }
  535. );
  536. </script>
  537. <style scoped lang="scss">
  538. .timeline-container {
  539. height: 100%;
  540. overflow: auto;
  541. position: relative;
  542. box-sizing: border-box;
  543. .timeline-list {
  544. position: relative;
  545. }
  546. .timeline-middle-line {
  547. position: absolute;
  548. left: 15px; /* 位于节气文字列中间(列宽约30px) */
  549. top: 0;
  550. bottom: 0;
  551. width: 2px;
  552. background: #e8e8e8;
  553. z-index: 1;
  554. }
  555. .phenology-bar {
  556. align-items: stretch;
  557. justify-content: center;
  558. box-sizing: border-box;
  559. .reproductive-item {
  560. font-size: 12px;
  561. text-align: center;
  562. word-break: break-all;
  563. writing-mode: vertical-rl;
  564. text-orientation: upright;
  565. letter-spacing: 3px;
  566. width: 100%;
  567. line-height: 23px;
  568. color: inherit;
  569. position: relative;
  570. .phenology-name {
  571. width: 26px;
  572. height: 100%;
  573. background: #2199f8;
  574. color: #fff;
  575. border-radius: 2px;
  576. padding: 5px 0;
  577. }
  578. .arranges {
  579. display: flex;
  580. max-width: calc(100vw - 84px);
  581. min-width: calc(100vw - 84px);
  582. gap: 10px;
  583. letter-spacing: 0px;
  584. .arrange-card {
  585. width: 93%;
  586. border: 0.5px solid #2199f8;
  587. border-radius: 8px;
  588. background: #fff;
  589. box-sizing: border-box;
  590. position: relative;
  591. padding: 8px;
  592. writing-mode: horizontal-tb;
  593. .card-header {
  594. display: flex;
  595. justify-content: space-between;
  596. align-items: center;
  597. .header-left {
  598. display: flex;
  599. align-items: center;
  600. gap: 8px;
  601. .farm-work-name {
  602. font-size: 14px;
  603. font-weight: 500;
  604. color: #1d2129;
  605. }
  606. .tag-standard {
  607. padding: 0 8px;
  608. background: rgba(119, 119, 119, 0.1);
  609. border-radius: 25px;
  610. font-weight: 400;
  611. font-size: 12px;
  612. color: #000;
  613. }
  614. }
  615. .header-right {
  616. font-size: 12px;
  617. color: #808080;
  618. padding: 0 8px;
  619. border-radius: 25px;
  620. }
  621. }
  622. .card-content {
  623. color: #909090;
  624. text-align: left;
  625. line-height: 1.55;
  626. margin: 4px 0 2px 0;
  627. .edit-link {
  628. color: #2199f8;
  629. margin-left: 5px;
  630. }
  631. .link-warning {
  632. color: #ff953d;
  633. margin-left: 5px;
  634. }
  635. }
  636. .card-status {
  637. position: absolute;
  638. bottom: 0;
  639. right: 0;
  640. background: rgba(255, 149, 61, 0.1);
  641. border-radius: 3px;
  642. color: #ff953d;
  643. padding: 0 6px;
  644. display: flex;
  645. align-items: center;
  646. gap: 4px;
  647. font-size: 12px;
  648. }
  649. &::before {
  650. content: "";
  651. position: absolute;
  652. left: -5px;
  653. top: 50%;
  654. transform: translateY(-50%);
  655. width: 0;
  656. height: 0;
  657. border-top: 5px solid transparent;
  658. border-bottom: 5px solid transparent;
  659. border-right: 5px solid #2199f8;
  660. }
  661. }
  662. .arrange-card.normal-style {
  663. opacity: 0.3;
  664. }
  665. .arrange-card.status-warning {
  666. border-color: #ff953d;
  667. &::before {
  668. border-right-color: #ff953d;
  669. }
  670. }
  671. .arrange-card.status-complete {
  672. border-color: #1ca900;
  673. &::before {
  674. border-right-color: #1ca900;
  675. }
  676. }
  677. .arrange-card.status-normal {
  678. border-color: #2199f8;
  679. &::before {
  680. border-right-color: #2199f8;
  681. }
  682. }
  683. }
  684. }
  685. }
  686. .reproductive-item + .reproductive-item {
  687. padding-top: 3px;
  688. }
  689. .phenology-bar + .phenology-bar {
  690. padding-top: 3px;
  691. }
  692. .timeline-term {
  693. position: absolute;
  694. width: 30px;
  695. padding-right: 16px;
  696. display: flex;
  697. align-items: flex-start;
  698. z-index: 2; /* 置于中线之上 */
  699. .term-name {
  700. display: inline-block;
  701. width: 100%;
  702. min-height: 35px;
  703. line-height: 30px;
  704. background: #f5f7fb;
  705. font-size: 13px;
  706. word-break: break-all;
  707. writing-mode: vertical-rl;
  708. text-orientation: upright;
  709. color: rgba(174, 174, 174, 0.6);
  710. text-align: center;
  711. }
  712. }
  713. }
  714. </style>