ArchivesFarmTimeLine.vue 53 KB

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