list.vue 24 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052
  1. <template>
  2. <view class="container">
  3. <!-- 头部区域 -->
  4. <view class="header">
  5. <view class="back-button" @click="goBack">
  6. <text class="iconfont icon-back">&#xe60e;</text>
  7. </view>
  8. <text class="page-title">选择地块</text>
  9. </view>
  10. <!-- 搜索栏 -->
  11. <view class="search-box">
  12. <view class="search-input">
  13. <image src="@/static/icons/search.png" style="width: 40rpx; height: 40rpx; padding-right: 10rpx;"
  14. mode="widthFix" />
  15. <input type="text" v-model="searchKeyword" placeholder="搜索地块名称/编号/负责人/农场" confirm-type="search"
  16. @input="handleSearch" />
  17. <text v-if="searchKeyword" class="clear-icon" @click="clearSearch">×</text>
  18. </view>
  19. </view>
  20. <!-- 当前选中地块 -->
  21. <view class="current-block">
  22. <view class="block-header">
  23. <view class="left">
  24. <text class="icon-tag">当前</text>
  25. <text class="title">当前地块</text>
  26. </view>
  27. </view>
  28. <view class="current-block-card">
  29. <view class="current-tag">当前</view>
  30. <view class="block-content">
  31. <view class="block-icon">
  32. <image src="/static/icons/location.svg" class="location-icon" mode="aspectFit"></image>
  33. </view>
  34. <view class="block-info">
  35. <!-- 标题区域:显示地块名称 + 所属农场名称 -->
  36. <view class="block-name">{{ currentBlock.name }}</view>
  37. <view class="block-farm">{{ currentBlock.farmName }}</view>
  38. <!-- 次级信息区域:显示地块编号、负责人 -->
  39. <view class="block-meta">
  40. <text>编号:{{ currentBlock.code }}</text>
  41. <text class="separator">|</text>
  42. <text>负责人:{{ currentBlock.manager }}</text>
  43. </view>
  44. <!-- 已有信息:面积、类型、作物 -->
  45. <view class="block-details">
  46. <text>{{ currentBlock.area }}亩</text>
  47. <text class="separator">|</text>
  48. <text>{{ currentBlock.type }}</text>
  49. <text v-if="currentBlock.crop" class="separator">|</text>
  50. <text v-if="currentBlock.crop">{{ currentBlock.crop }}</text>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="block-stats">
  55. <view class="stat-item">
  56. <image src="/static/icons/device.svg" class="stat-icon" mode="aspectFit"></image>
  57. <text>设备:{{ currentBlock.deviceCount }}</text>
  58. </view>
  59. <view class="stat-item">
  60. <image src="/static/icons/online.svg" class="stat-icon online-icon" mode="aspectFit"></image>
  61. <text>在线:{{ currentBlock.onlineDevices }}</text>
  62. </view>
  63. <view class="stat-item" v-if="currentBlock.alerts > 0">
  64. <image src="/static/icons/alert.svg" class="stat-icon alert-icon" mode="aspectFit"></image>
  65. <text class="alert-text">告警:{{ currentBlock.alerts }}</text>
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. <!-- 地块列表 -->
  71. <view class="block-list">
  72. <view class="block-header">
  73. <view class="left">
  74. <text class="icon-tag">列表</text>
  75. <text class="title">可选地块列表</text>
  76. </view>
  77. <text class="count">共{{ filteredBlocks.length }}个地块</text>
  78. </view>
  79. <!-- 加载骨架屏 -->
  80. <template v-if="isLoading">
  81. <view class="skeleton-container">
  82. <view class="skeleton-box" v-for="i in 3" :key="i">
  83. <view class="skeleton-header">
  84. <view class="skeleton-icon"></view>
  85. <view class="skeleton-info">
  86. <view class="skeleton-title"></view>
  87. <view class="skeleton-detail"></view>
  88. </view>
  89. </view>
  90. <view class="skeleton-stats"></view>
  91. </view>
  92. </view>
  93. </template>
  94. <!-- 空状态 -->
  95. <template v-else-if="filteredBlocks.length === 0">
  96. <view class="empty-state">
  97. <image src="/static/images/empty.png" mode="aspectFit" class="empty-image"></image>
  98. <text class="empty-text">暂无可选地块</text>
  99. <text class="empty-subtext">请添加或关联地块后再试</text>
  100. </view>
  101. </template>
  102. <!-- 地块列表 -->
  103. <template v-else>
  104. <view class="block-cards">
  105. <view class="block-card" v-for="block in filteredBlocks" :key="block.id"
  106. :class="{'active-block': currentBlock.id === block.id, 'clickable': currentBlock.id !== block.id}"
  107. @click="handleBlockClick(block)">
  108. <view v-if="block.status === 'active'" class="status-badge status-active-badge">使用中</view>
  109. <view v-if="block.status === 'idle'" class="status-badge status-idle-badge">闲置</view>
  110. <view v-if="block.status === 'maintenance'" class="status-badge status-maintenance-badge">维护中
  111. </view>
  112. <view class="block-content">
  113. <view class="block-icon">
  114. <image src="/static/icons/location.svg" class="location-icon" mode="aspectFit"></image>
  115. </view>
  116. <view class="block-info">
  117. <!-- 标题区域:显示地块名称 + 所属农场名称 -->
  118. <view class="block-name">{{ block.name }}</view>
  119. <view class="block-farm">{{ block.farmName }}</view>
  120. <!-- 次级信息区域:显示地块编号、负责人 -->
  121. <view class="block-meta">
  122. <text>编号:{{ block.code }}</text>
  123. <text class="separator">|</text>
  124. <text>负责人:{{ block.manager }}</text>
  125. </view>
  126. <!-- 已有信息:面积、类型、作物 -->
  127. <view class="block-details">
  128. <text>{{ block.area }}亩</text>
  129. <text class="separator">|</text>
  130. <text>{{ block.type }}</text>
  131. <text v-if="block.crop" class="separator">|</text>
  132. <text v-if="block.crop">{{ block.crop }}</text>
  133. </view>
  134. </view>
  135. </view>
  136. <view class="block-stats">
  137. <view class="stat-item">
  138. <image src="/static/icons/device.svg" class="stat-icon" mode="aspectFit"></image>
  139. <text>设备:{{ block.deviceCount }}</text>
  140. </view>
  141. <view class="stat-item">
  142. <image src="/static/icons/online.svg" class="stat-icon online-icon" mode="aspectFit">
  143. </image>
  144. <text>在线:{{ block.onlineDevices }}</text>
  145. </view>
  146. <view class="stat-item" v-if="block.alerts > 0">
  147. <image src="/static/icons/alert.svg" class="stat-icon alert-icon" mode="aspectFit">
  148. </image>
  149. <text class="alert-text">告警:{{ block.alerts }}</text>
  150. </view>
  151. </view>
  152. </view>
  153. </view>
  154. </template>
  155. </view>
  156. <!-- 底部加载提示区域 -->
  157. <view class="loading-more" v-if="isLoadingTip || !hasMore">
  158. <view v-if="loadingMore" class="loading-text">
  159. <view class="loading-icon"></view>
  160. <text>正在加载更多地块...</text>
  161. </view>
  162. <text v-else-if="!hasMore && blocks.length > 0" class="no-more-text">没有更多地块了</text>
  163. </view>
  164. </view>
  165. </template>
  166. <script>
  167. import {
  168. fetchUserFieldList,
  169. getUserCurrentField,
  170. searchUserField
  171. } from '@/api/services/field.js';
  172. import storage from "@/utils/storage.js";
  173. export default {
  174. // 配置页面的下拉刷新
  175. onPullDownRefresh: true,
  176. data() {
  177. return {
  178. isLoading: true,
  179. searchKeyword: '',
  180. currentBlock: {
  181. id: '',
  182. code: '',
  183. name: '',
  184. farmName: '',
  185. manager: '',
  186. area: 0,
  187. type: '',
  188. crop: '',
  189. status: 'active',
  190. deviceCount: 0,
  191. onlineDevices: 0,
  192. alerts: 0
  193. },
  194. blocks: [],
  195. searchTimer: null,
  196. // 添加分页相关数据
  197. pageNum: 1, // 当前页码
  198. pageSize: 10, // 每页数量
  199. totalCount: 0, // 总记录数
  200. loadingMore: false, // 是否正在加载更多
  201. hasMore: true, // 是否还有更多数据
  202. isLoadingTip: false, // 是否显示底部加载提示
  203. refreshing: false // 是否正在下拉刷新
  204. }
  205. },
  206. computed: {
  207. filteredBlocks() {
  208. return this.blocks;
  209. }
  210. },
  211. mounted() {
  212. // 获取当前选中地块
  213. // this.fetchCurrentField();
  214. // 获取地块列表
  215. this.getFieldList(true);
  216. },
  217. // 添加页面触底事件处理函数
  218. onReachBottom() {
  219. this.loadMore();
  220. },
  221. // 下拉刷新
  222. onPullDownRefresh() {
  223. this.refreshing = true;
  224. // 重置页码并刷新列表
  225. this.getFieldList(true);
  226. // 延迟关闭刷新动画
  227. setTimeout(() => {
  228. this.refreshing = false;
  229. uni.stopPullDownRefresh();
  230. }, 1000);
  231. },
  232. methods: {
  233. // 获取当前选中的地块
  234. fetchCurrentField() {
  235. try {
  236. // 获取当前登录用户的默认地块
  237. getUserCurrentField().then((res) => {
  238. console.log("fetchCurrentField", res);
  239. if (res.data && res.data.code === 200 && res.data.data) {
  240. this.currentBlock = res.data.data;
  241. } else {
  242. // 如果没有当前选中地块,则在获取列表成功后设置第一个为当前地块
  243. console.log('未查询到当前地块,将使用列表第一个地块');
  244. }
  245. }).catch(err => {
  246. console.error('获取当前地块失败', err);
  247. });
  248. } catch (e) {
  249. console.log("fetchCurrentField 异常", e);
  250. }
  251. },
  252. // 获取地块列表
  253. getFieldList(isRefresh = false) {
  254. console.log("执行情况");
  255. // 刷新时重置页码
  256. if (isRefresh) {
  257. this.pageNum = 1;
  258. this.blocks = [];
  259. this.hasMore = true;
  260. }
  261. if (!this.hasMore && !isRefresh) {
  262. return; // 如果没有更多数据且不是刷新,则不请求
  263. }
  264. // 标记正在加载
  265. if (this.pageNum === 1) {
  266. this.isLoading = true;
  267. } else {
  268. this.loadingMore = true;
  269. this.isLoadingTip = true;
  270. }
  271. console.log("当前页码值:", this.pageNum);
  272. // 获取当前登录用户关联的地块列表
  273. fetchUserFieldList(
  274. this.pageNum,
  275. this.pageSize
  276. ).then((res) => {
  277. if (this.pageNum === 1) {
  278. this.isLoading = false;
  279. } else {
  280. this.loadingMore = false;
  281. }
  282. console.log("地块res", res);
  283. if (res.data && res.data.code === 200 && res.data.data) {
  284. // 获取总数
  285. this.totalCount = res.data.data.total || 0;
  286. // 追加数据,而不是替换
  287. if (this.pageNum === 1) {
  288. this.blocks = res.data.data.list;
  289. } else {
  290. this.blocks = [...this.blocks, ...res.data.data.list];
  291. }
  292. // 判断是否还有更多数据
  293. this.hasMore = this.blocks.length < this.totalCount;
  294. // 尝试从本地存储中读取上次选择的地块
  295. if (this.pageNum === 1) {
  296. this.loadSavedBlock();
  297. // 如果当前没有选中地块,则设置第一个为当前地块
  298. if (!this.currentBlock.id && this.blocks.length > 0) {
  299. this.currentBlock = this.blocks[0];
  300. // 保存当前选择的地块到本地存储
  301. this.saveCurrentBlockToStorage(this.currentBlock);
  302. }
  303. }
  304. // 页码加1,为下次加载做准备
  305. this.pageNum++;
  306. } else {
  307. this.isLoading = false;
  308. this.loadingMore = false;
  309. this.hasMore = false;
  310. console.error('获取地块列表失败', res);
  311. uni.showToast({
  312. title: '获取地块列表失败',
  313. icon: 'none'
  314. });
  315. }
  316. // 2秒后隐藏加载提示
  317. setTimeout(() => {
  318. this.isLoadingTip = false;
  319. }, 2000);
  320. }).catch(err => {
  321. this.isLoading = false;
  322. this.loadingMore = false;
  323. this.hasMore = false;
  324. console.error('获取地块列表失败', err);
  325. uni.showToast({
  326. title: '获取地块列表失败',
  327. icon: 'none'
  328. });
  329. // 隐藏加载提示
  330. this.isLoadingTip = false;
  331. });
  332. },
  333. // 根据关键字搜索地块
  334. searchFields(keyword) {
  335. console.log("keyword",keyword);
  336. if (!keyword) {
  337. this.getFieldList(true);
  338. return;
  339. }
  340. // 重置分页数据
  341. this.pageNum = 1;
  342. this.blocks = [];
  343. this.hasMore = true;
  344. this.isLoading = true;
  345. // 使用用户关联地块搜索接口
  346. searchUserField({
  347. keyword: keyword,
  348. pageNum: this.pageNum,
  349. pageSize: this.pageSize
  350. }).then((res) => {
  351. this.isLoading = false;
  352. if (res.data && res.data.code === 200 && res.data.data.list) {
  353. this.blocks = res.data.data.list;
  354. // 搜索结果可能没有总数信息,根据返回数据判断是否有更多
  355. this.hasMore = res.data.data.total >= this.pageSize;
  356. // 增加页码为下次加载做准备
  357. this.pageNum++;
  358. }
  359. }).catch(err => {
  360. this.isLoading = false;
  361. this.hasMore = false;
  362. console.error('搜索地块失败', err);
  363. });
  364. },
  365. goBack() {
  366. uni.navigateBack();
  367. },
  368. handleSearch() {
  369. // 防抖处理,避免频繁请求
  370. if (this.searchTimer) {
  371. clearTimeout(this.searchTimer);
  372. }
  373. this.searchTimer = setTimeout(() => {
  374. this.searchFields(this.searchKeyword);
  375. }, 500);
  376. },
  377. clearSearch() {
  378. this.searchKeyword = '';
  379. this.getFieldList(true);
  380. },
  381. handleBlockClick(block) {
  382. // 如果点击当前已选中的地块,不做任何操作
  383. if (this.currentBlock.id === block.id) return;
  384. // 弹出确认框
  385. uni.showModal({
  386. title: '切换地块',
  387. content: '是否切换到该地块?切换后将查看该地块的相关设备数据。',
  388. cancelText: '取消',
  389. confirmText: '确定',
  390. success: (res) => {
  391. if (res.confirm) {
  392. this.selectBlock(block);
  393. }
  394. }
  395. });
  396. },
  397. selectBlock(block) {
  398. this.currentBlock = block;
  399. // 保存当前选择的地块到本地存储
  400. this.saveCurrentBlockToStorage(block);
  401. // 触发选择事件,传递地块ID
  402. this.$emit('selectBlock', block.id);
  403. // 获取页面参数,检查是否需要返回
  404. const pages = getCurrentPages();
  405. const currentPage = pages[pages.length - 1];
  406. let eventChannel;
  407. // 尝试获取页面参数和事件通道
  408. let shouldReturn = true; // 默认行为是返回
  409. try {
  410. const options = currentPage.options || {};
  411. // 获取事件通道(如果存在)
  412. eventChannel = currentPage.getOpenerEventChannel && currentPage.getOpenerEventChannel();
  413. // 如果有redirect参数,则跳转到指定页面而不是返回
  414. if (options.redirect) {
  415. shouldReturn = false;
  416. uni.redirectTo({
  417. url: decodeURIComponent(options.redirect),
  418. success: () => {
  419. // 跳转成功后传递选中的地块数据
  420. if (eventChannel) {
  421. eventChannel.emit('selectBlockResult', {
  422. success: true,
  423. blockId: block.id,
  424. blockData: block
  425. });
  426. }
  427. }
  428. });
  429. } else if (options.noReturn === 'true') {
  430. // 如果设置了noReturn参数,则不执行返回操作
  431. shouldReturn = false;
  432. }
  433. } catch (e) {
  434. console.error('获取页面参数失败', e);
  435. }
  436. // 如果需要返回上一页,则执行返回操作
  437. if (shouldReturn) {
  438. setTimeout(() => {
  439. uni.navigateBack({
  440. success: () => {
  441. // 返回成功后传递选中的地块数据
  442. if (eventChannel) {
  443. eventChannel.emit('selectBlockResult', {
  444. success: true,
  445. blockId: block.id,
  446. blockData: block
  447. });
  448. }
  449. }
  450. });
  451. }, 300);
  452. }
  453. },
  454. // 保存当前选择的地块到本地存储
  455. saveCurrentBlockToStorage(block) {
  456. try {
  457. this.currentBlock = block
  458. console.log("this.currentBlock", this.currentBlock);
  459. console.log("block", block);
  460. storage.setPlots(JSON.stringify({
  461. id: block.id,
  462. code: block.code,
  463. name: block.name,
  464. timestamp: Date.now()
  465. }))
  466. } catch (e) {
  467. console.error('保存地块选择状态失败', e);
  468. }
  469. },
  470. // 从本地存储加载上次选择的地块
  471. loadSavedBlock() {
  472. try {
  473. const savedPlot = storage.getPlots();
  474. if (savedPlot) {
  475. const plotData = JSON.parse(savedPlot);
  476. // 如果存储的地块在当前地块列表中,则设置为当前选中地块
  477. const matchedBlock = this.blocks.find(block => block.id == plotData.id);
  478. if (matchedBlock) {
  479. this.currentBlock = matchedBlock;
  480. }
  481. }
  482. } catch (e) {
  483. console.error('读取保存的地块失败', e);
  484. }
  485. },
  486. getStatusClass(status) {
  487. const statusMap = {
  488. 'active': 'status-active',
  489. 'idle': 'status-idle',
  490. 'maintenance': 'status-maintenance'
  491. }
  492. return statusMap[status] || '';
  493. },
  494. getStatusText(status) {
  495. const statusMap = {
  496. 'active': '使用中',
  497. 'idle': '闲置',
  498. 'maintenance': '维护中'
  499. }
  500. return statusMap[status] || '未知';
  501. },
  502. // 可以被父组件调用的方法
  503. onBack(callback) {
  504. if (typeof callback === 'function') {
  505. callback(this.currentBlock.id);
  506. }
  507. },
  508. // 加载更多数据
  509. loadMore() {
  510. if (this.loadingMore || !this.hasMore) return;
  511. this.getFieldList();
  512. }
  513. }
  514. }
  515. </script>
  516. <style>
  517. .container {
  518. min-height: 100vh;
  519. background-color: #F5F7FA;
  520. padding-bottom: 30rpx;
  521. }
  522. /* 头部导航 */
  523. .header {
  524. display: none;
  525. /* 隐藏整个头部标题栏 */
  526. }
  527. .back-button {
  528. width: 60rpx;
  529. height: 60rpx;
  530. display: flex;
  531. align-items: center;
  532. justify-content: center;
  533. }
  534. .icon-back {
  535. font-size: 36rpx;
  536. color: #333;
  537. }
  538. .page-title {
  539. flex: 1;
  540. text-align: center;
  541. font-size: 32rpx;
  542. font-weight: bold;
  543. color: #333;
  544. margin-right: 60rpx;
  545. /* 平衡左侧返回按钮 */
  546. }
  547. /* 搜索框 */
  548. .search-box {
  549. padding: 20rpx 30rpx;
  550. background-color: #FFFFFF;
  551. border-bottom: 1px solid rgba(0, 0, 0, 0.03);
  552. margin-bottom: 20rpx;
  553. }
  554. .search-header {
  555. font-size: 28rpx;
  556. color: #333;
  557. font-weight: 500;
  558. margin-bottom: 15rpx;
  559. }
  560. .search-input {
  561. display: flex;
  562. align-items: center;
  563. height: 70rpx;
  564. background-color: #F5F7FA;
  565. border-radius: 35rpx;
  566. padding: 0 30rpx;
  567. box-shadow: inset 0 1rpx 3rpx rgba(0, 0, 0, 0.05);
  568. border: 1rpx solid rgba(0, 0, 0, 0.03);
  569. }
  570. .icon-search {
  571. font-size: 28rpx;
  572. color: #999;
  573. margin-right: 10rpx;
  574. }
  575. .search-input input {
  576. flex: 1;
  577. height: 70rpx;
  578. font-size: 28rpx;
  579. color: #333;
  580. }
  581. .clear-icon {
  582. width: 40rpx;
  583. height: 40rpx;
  584. display: flex;
  585. align-items: center;
  586. justify-content: center;
  587. font-size: 32rpx;
  588. color: #999;
  589. }
  590. /* 块区域通用样式 */
  591. .current-block,
  592. .block-list {
  593. margin: 0 30rpx 20rpx;
  594. background-color: #FFFFFF;
  595. padding: 24rpx;
  596. border-radius: 24rpx;
  597. box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
  598. }
  599. .block-header {
  600. display: flex;
  601. justify-content: space-between;
  602. align-items: center;
  603. margin-bottom: 20rpx;
  604. }
  605. .block-header .left {
  606. display: flex;
  607. align-items: center;
  608. }
  609. .icon-tag {
  610. font-size: 24rpx;
  611. color: #FFFFFF;
  612. background: linear-gradient(135deg, #66CC6A 0%, #3BB44A 100%);
  613. padding: 4rpx 16rpx;
  614. border-radius: 6rpx;
  615. margin-right: 16rpx;
  616. box-shadow: 0 2rpx 5rpx rgba(59, 180, 74, 0.2);
  617. }
  618. .block-header .title {
  619. font-size: 30rpx;
  620. font-weight: bold;
  621. color: #333;
  622. }
  623. .block-header .count {
  624. font-size: 24rpx;
  625. color: #999;
  626. background-color: #F5F7FA;
  627. padding: 4rpx 16rpx;
  628. border-radius: 20rpx;
  629. }
  630. /* 当前选中地块卡片 */
  631. .current-block-card {
  632. background: linear-gradient(to right, #F0F8F0, #E7F5E8);
  633. border-radius: 16rpx;
  634. padding: 30rpx;
  635. position: relative;
  636. border: 2rpx solid rgba(59, 180, 74, 0.2);
  637. box-shadow: 0 4rpx 16rpx rgba(59, 180, 74, 0.1);
  638. }
  639. .current-tag {
  640. position: absolute;
  641. top: 0;
  642. right: 20rpx;
  643. background: linear-gradient(135deg, #66CC6A 0%, #3BB44A 100%);
  644. color: white;
  645. font-size: 22rpx;
  646. padding: 6rpx 16rpx;
  647. border-radius: 0 0 12rpx 12rpx;
  648. font-weight: bold;
  649. }
  650. /* 地块列表卡片 */
  651. .block-cards {
  652. display: flex;
  653. flex-direction: column;
  654. gap: 20rpx;
  655. }
  656. .block-card {
  657. background-color: #FFFFFF;
  658. border-radius: 16rpx;
  659. padding: 30rpx;
  660. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
  661. position: relative;
  662. border: 1rpx solid rgba(0, 0, 0, 0.03);
  663. transition: all 0.3s ease;
  664. }
  665. .block-card:active {
  666. transform: scale(0.98);
  667. box-shadow: 0 1rpx 5rpx rgba(0, 0, 0, 0.03);
  668. }
  669. .block-card.active-block {
  670. border: 2rpx solid #3BB44A;
  671. background-color: #F0F8F0;
  672. box-shadow: 0 4rpx 16rpx rgba(59, 180, 74, 0.1);
  673. }
  674. .block-card.clickable {
  675. cursor: pointer;
  676. }
  677. .block-card.clickable:hover {
  678. box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.1);
  679. }
  680. .block-content {
  681. display: flex;
  682. align-items: flex-start;
  683. position: relative;
  684. margin-bottom: 20rpx;
  685. }
  686. .block-icon {
  687. width: 40rpx;
  688. margin-right: 15rpx;
  689. display: flex;
  690. align-items: center;
  691. justify-content: center;
  692. }
  693. .location-icon {
  694. width: 36rpx;
  695. height: 36rpx;
  696. }
  697. .block-info {
  698. flex: 1;
  699. }
  700. .block-name {
  701. font-size: 32rpx;
  702. font-weight: bold;
  703. color: #333;
  704. margin-bottom: 6rpx;
  705. }
  706. .block-farm {
  707. font-size: 26rpx;
  708. color: #666;
  709. margin-bottom: 10rpx;
  710. }
  711. .block-meta {
  712. font-size: 26rpx;
  713. color: #999;
  714. margin-bottom: 10rpx;
  715. }
  716. .block-details {
  717. font-size: 26rpx;
  718. color: #666;
  719. }
  720. .separator {
  721. margin: 0 10rpx;
  722. color: #ccc;
  723. }
  724. .check-mark {
  725. position: absolute;
  726. right: 0;
  727. top: 0;
  728. }
  729. .check-icon {
  730. width: 48rpx;
  731. height: 48rpx;
  732. }
  733. /* 状态标签 */
  734. .status-badge {
  735. position: absolute;
  736. top: 0;
  737. right: 0;
  738. font-size: 22rpx;
  739. padding: 4rpx 12rpx;
  740. border-radius: 0 16rpx 0 12rpx;
  741. font-weight: 500;
  742. z-index: 1;
  743. }
  744. .status-active-badge {
  745. background-color: #E6F7E6;
  746. color: #3BB44A;
  747. border-left: 1rpx solid rgba(59, 180, 74, 0.2);
  748. border-bottom: 1rpx solid rgba(59, 180, 74, 0.2);
  749. }
  750. .status-idle-badge {
  751. background-color: #F1F2F3;
  752. color: #909399;
  753. border-left: 1rpx solid rgba(144, 147, 153, 0.2);
  754. border-bottom: 1rpx solid rgba(144, 147, 153, 0.2);
  755. }
  756. .status-maintenance-badge {
  757. background-color: #FEF0F0;
  758. color: #F56C6C;
  759. border-left: 1rpx solid rgba(245, 108, 108, 0.2);
  760. border-bottom: 1rpx solid rgba(245, 108, 108, 0.2);
  761. }
  762. /* 地块统计信息 */
  763. .block-stats {
  764. display: flex;
  765. align-items: center;
  766. flex-wrap: wrap;
  767. border-top: 1rpx solid #F0F0F0;
  768. padding-top: 20rpx;
  769. }
  770. .stat-item {
  771. display: flex;
  772. align-items: center;
  773. margin-right: 24rpx;
  774. font-size: 26rpx;
  775. color: #666;
  776. }
  777. .stat-icon {
  778. width: 36rpx;
  779. height: 36rpx;
  780. margin-right: 8rpx;
  781. flex-shrink: 0;
  782. }
  783. .online-icon {
  784. /* 在线图标使用绿色 */
  785. filter: hue-rotate(120deg) saturate(1.2);
  786. }
  787. .alert-icon {
  788. /* 告警图标使用红色 */
  789. filter: hue-rotate(0deg) saturate(1.5);
  790. }
  791. .alert-text {
  792. color: #F56C6C;
  793. }
  794. /* 骨架屏 */
  795. .skeleton-container {
  796. display: flex;
  797. flex-direction: column;
  798. gap: 20rpx;
  799. }
  800. .skeleton-box {
  801. background-color: #FFFFFF;
  802. border-radius: 16rpx;
  803. padding: 20rpx;
  804. margin-bottom: 10rpx;
  805. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
  806. animation: skeleton-loading 1.5s infinite;
  807. }
  808. @keyframes skeleton-loading {
  809. 0% {
  810. opacity: 0.7;
  811. }
  812. 50% {
  813. opacity: 0.5;
  814. }
  815. 100% {
  816. opacity: 0.7;
  817. }
  818. }
  819. .skeleton-header {
  820. display: flex;
  821. align-items: flex-start;
  822. }
  823. .skeleton-icon {
  824. width: 40rpx;
  825. height: 40rpx;
  826. background-color: #EEEEEE;
  827. border-radius: 8rpx;
  828. margin-right: 15rpx;
  829. }
  830. .skeleton-info {
  831. flex: 1;
  832. }
  833. .skeleton-title {
  834. width: 200rpx;
  835. height: 32rpx;
  836. background-color: #EEEEEE;
  837. margin-bottom: 10rpx;
  838. border-radius: 4rpx;
  839. }
  840. .skeleton-detail {
  841. width: 300rpx;
  842. height: 24rpx;
  843. background-color: #EEEEEE;
  844. border-radius: 4rpx;
  845. }
  846. .skeleton-stats {
  847. margin-top: 16rpx;
  848. padding-top: 16rpx;
  849. border-top: 1rpx solid #F5F5F5;
  850. height: 30rpx;
  851. background-color: #EEEEEE;
  852. border-radius: 4rpx;
  853. }
  854. /* 空状态 */
  855. .empty-state {
  856. display: flex;
  857. flex-direction: column;
  858. align-items: center;
  859. justify-content: center;
  860. padding: 60rpx 0;
  861. }
  862. .empty-image {
  863. width: 240rpx;
  864. height: 240rpx;
  865. margin-bottom: 20rpx;
  866. opacity: 0.7;
  867. }
  868. .empty-text {
  869. font-size: 32rpx;
  870. color: #666;
  871. font-weight: 500;
  872. margin-bottom: 10rpx;
  873. }
  874. .empty-subtext {
  875. font-size: 26rpx;
  876. color: #999;
  877. }
  878. /* 基础图标样式 */
  879. .iconfont {
  880. font-family: "iconfont" !important;
  881. font-style: normal;
  882. -webkit-font-smoothing: antialiased;
  883. -moz-osx-font-smoothing: grayscale;
  884. }
  885. /* 底部加载提示区域 */
  886. .loading-more {
  887. display: flex;
  888. justify-content: center;
  889. align-items: center;
  890. padding: 20rpx 0;
  891. background-color: #FFFFFF;
  892. border-top: 1px solid rgba(0, 0, 0, 0.03);
  893. }
  894. .loading-text {
  895. display: flex;
  896. align-items: center;
  897. font-size: 28rpx;
  898. color: #666;
  899. }
  900. .loading-icon {
  901. width: 40rpx;
  902. height: 40rpx;
  903. margin-right: 10rpx;
  904. background-color: #3BB44A;
  905. border-radius: 50%;
  906. animation: spin 1s linear infinite;
  907. }
  908. @keyframes spin {
  909. 0% {
  910. transform: rotate(0deg);
  911. }
  912. 100% {
  913. transform: rotate(360deg);
  914. }
  915. }
  916. .no-more-text {
  917. font-size: 28rpx;
  918. color: #999;
  919. margin-left: 10rpx;
  920. }
  921. </style>