list.vue 21 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004
  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 setup>
  167. import { ref, reactive, computed, onMounted } from 'vue'
  168. import {
  169. fetchUserFieldList,
  170. searchUserField
  171. } from '@/api/services/field.js'
  172. import storage from "@/utils/storage.js"
  173. // 响应式数据
  174. const isLoading = ref(true)
  175. const searchKeyword = ref('')
  176. const currentBlock = reactive({
  177. id: '',
  178. code: '',
  179. name: '',
  180. farmName: '',
  181. manager: '',
  182. area: 0,
  183. type: '',
  184. crop: '',
  185. status: 'active',
  186. deviceCount: 0,
  187. onlineDevices: 0,
  188. alerts: 0
  189. })
  190. const blocks = ref([])
  191. const searchTimer = ref(null)
  192. const pageNum = ref(1)
  193. const pageSize = ref(10)
  194. const totalCount = ref(0)
  195. const loadingMore = ref(false)
  196. const hasMore = ref(true)
  197. const isLoadingTip = ref(false)
  198. const refreshing = ref(false)
  199. // 计算属性
  200. const filteredBlocks = computed(() => {
  201. return blocks.value
  202. })
  203. // 获取当前选中的地块
  204. const fetchCurrentField = () => {
  205. try {
  206. getUserCurrentField().then((res) => {
  207. console.log("fetchCurrentField", res)
  208. if (res.data && res.data.code === 200 && res.data.data) {
  209. Object.assign(currentBlock, res.data.data)
  210. } else {
  211. console.log('未查询到当前地块,将使用列表第一个地块')
  212. }
  213. }).catch(err => {
  214. console.error('获取当前地块失败', err)
  215. })
  216. } catch (e) {
  217. console.log("fetchCurrentField 异常", e)
  218. }
  219. }
  220. // 获取地块列表
  221. const getFieldList = (isRefresh = false) => {
  222. console.log("执行情况")
  223. if (isRefresh) {
  224. pageNum.value = 1
  225. blocks.value = []
  226. hasMore.value = true
  227. }
  228. if (!hasMore.value && !isRefresh) {
  229. return
  230. }
  231. if (pageNum.value === 1) {
  232. isLoading.value = true
  233. } else {
  234. loadingMore.value = true
  235. isLoadingTip.value = true
  236. }
  237. console.log("当前页码值:", pageNum.value)
  238. fetchUserFieldList(
  239. pageNum.value,
  240. pageSize.value
  241. ).then((res) => {
  242. if (pageNum.value === 1) {
  243. isLoading.value = false
  244. } else {
  245. loadingMore.value = false
  246. }
  247. console.log("地块res", res)
  248. if (res.data && res.data.code === 200 && res.data.data) {
  249. totalCount.value = res.data.data.total || 0
  250. if (pageNum.value === 1) {
  251. blocks.value = res.data.data.list
  252. } else {
  253. blocks.value = [...blocks.value, ...res.data.data.list]
  254. }
  255. hasMore.value = blocks.value.length < totalCount.value
  256. if (pageNum.value === 1) {
  257. loadSavedBlock()
  258. if (!currentBlock.id && blocks.value.length > 0) {
  259. Object.assign(currentBlock, blocks.value[0])
  260. saveCurrentBlockToStorage(currentBlock)
  261. }
  262. }
  263. pageNum.value++
  264. } else {
  265. isLoading.value = false
  266. loadingMore.value = false
  267. hasMore.value = false
  268. console.error('获取地块列表失败', res)
  269. uni.showToast({
  270. title: '获取地块列表失败',
  271. icon: 'none'
  272. })
  273. }
  274. setTimeout(() => {
  275. isLoadingTip.value = false
  276. }, 2000)
  277. }).catch(err => {
  278. isLoading.value = false
  279. loadingMore.value = false
  280. hasMore.value = false
  281. console.error('获取地块列表失败', err)
  282. uni.showToast({
  283. title: '获取地块列表失败',
  284. icon: 'none'
  285. })
  286. isLoadingTip.value = false
  287. })
  288. }
  289. // 根据关键字搜索地块
  290. const searchFields = (keyword) => {
  291. console.log("keyword", keyword)
  292. if (!keyword) {
  293. getFieldList(true)
  294. return
  295. }
  296. pageNum.value = 1
  297. blocks.value = []
  298. hasMore.value = true
  299. isLoading.value = true
  300. searchUserField({
  301. keyword: keyword,
  302. pageNum: pageNum.value,
  303. pageSize: pageSize.value
  304. }).then((res) => {
  305. isLoading.value = false
  306. if (res.data && res.data.code === 200 && res.data.data.list) {
  307. blocks.value = res.data.data.list
  308. hasMore.value = res.data.data.total >= pageSize.value
  309. pageNum.value++
  310. }
  311. }).catch(err => {
  312. isLoading.value = false
  313. hasMore.value = false
  314. console.error('搜索地块失败', err)
  315. })
  316. }
  317. const goBack = () => {
  318. uni.navigateBack()
  319. }
  320. const handleSearch = () => {
  321. if (searchTimer.value) {
  322. clearTimeout(searchTimer.value)
  323. }
  324. searchTimer.value = setTimeout(() => {
  325. searchFields(searchKeyword.value)
  326. }, 500)
  327. }
  328. const clearSearch = () => {
  329. searchKeyword.value = ''
  330. getFieldList(true)
  331. }
  332. const handleBlockClick = (block) => {
  333. if (currentBlock.id === block.id) return
  334. uni.showModal({
  335. title: '切换地块',
  336. content: '是否切换到该地块?切换后将查看该地块的相关设备数据。',
  337. cancelText: '取消',
  338. confirmText: '确定',
  339. success: (res) => {
  340. if (res.confirm) {
  341. selectBlock(block)
  342. }
  343. }
  344. })
  345. }
  346. const selectBlock = (block) => {
  347. Object.assign(currentBlock, block)
  348. console.log("选择地块信息:", block)
  349. saveCurrentBlockToStorage(block)
  350. const pages = getCurrentPages()
  351. const currentPage = pages[pages.length - 1]
  352. let eventChannel
  353. let shouldReturn = true
  354. try {
  355. const options = currentPage.options || {}
  356. eventChannel = currentPage.getOpenerEventChannel && currentPage.getOpenerEventChannel()
  357. if (options.redirect) {
  358. shouldReturn = false
  359. uni.redirectTo({
  360. url: decodeURIComponent(options.redirect),
  361. success: () => {
  362. if (eventChannel) {
  363. eventChannel.emit('selectBlockResult', {
  364. success: true,
  365. blockId: block.id,
  366. blockData: block
  367. })
  368. }
  369. }
  370. })
  371. } else if (options.noReturn === 'true') {
  372. shouldReturn = false
  373. }
  374. } catch (e) {
  375. console.error('获取页面参数失败', e)
  376. }
  377. if (shouldReturn) {
  378. setTimeout(() => {
  379. uni.navigateBack({
  380. success: () => {
  381. if (eventChannel) {
  382. eventChannel.emit('selectBlockResult', {
  383. success: true,
  384. blockId: block.id,
  385. blockData: block
  386. })
  387. }
  388. }
  389. })
  390. }, 300)
  391. }
  392. }
  393. const saveCurrentBlockToStorage = (block) => {
  394. try {
  395. Object.assign(currentBlock, block)
  396. console.log("this.currentBlock", currentBlock)
  397. console.log("block", block)
  398. storage.setPlots(JSON.stringify({
  399. id: block.id,
  400. code: block.code,
  401. name: block.name,
  402. growCrops: block.crop,
  403. managerName: block.manager,
  404. size: block.area,
  405. farmId: block.farmId,
  406. timestamp: Date.now()
  407. }))
  408. } catch (e) {
  409. console.error('保存地块选择状态失败', e)
  410. }
  411. }
  412. const loadSavedBlock = () => {
  413. try {
  414. const savedPlot = storage.getPlots()
  415. if (savedPlot) {
  416. const plotData = JSON.parse(savedPlot)
  417. const matchedBlock = blocks.value.find(block => block.id == plotData.id)
  418. if (matchedBlock) {
  419. Object.assign(currentBlock, matchedBlock)
  420. }
  421. }
  422. } catch (e) {
  423. console.error('读取保存的地块失败', e)
  424. }
  425. }
  426. const getStatusClass = (status) => {
  427. const statusMap = {
  428. 'active': 'status-active',
  429. 'idle': 'status-idle',
  430. 'maintenance': 'status-maintenance'
  431. }
  432. return statusMap[status] || ''
  433. }
  434. const getStatusText = (status) => {
  435. const statusMap = {
  436. 'active': '使用中',
  437. 'idle': '闲置',
  438. 'maintenance': '维护中'
  439. }
  440. return statusMap[status] || '未知'
  441. }
  442. const onBack = (callback) => {
  443. if (typeof callback === 'function') {
  444. callback(currentBlock.id)
  445. }
  446. }
  447. const loadMore = () => {
  448. if (loadingMore.value || !hasMore.value) return
  449. getFieldList()
  450. }
  451. // uni-app 生命周期
  452. onMounted(() => {
  453. getFieldList(true)
  454. })
  455. // uni-app 页面生命周期
  456. const onReachBottom = () => {
  457. loadMore()
  458. }
  459. const onPullDownRefresh = () => {
  460. refreshing.value = true
  461. getFieldList(true)
  462. setTimeout(() => {
  463. refreshing.value = false
  464. uni.stopPullDownRefresh()
  465. }, 1000)
  466. }
  467. // 导出页面生命周期方法供 uni-app 调用
  468. defineExpose({
  469. onReachBottom,
  470. onPullDownRefresh
  471. })
  472. </script>
  473. <style>
  474. .container {
  475. min-height: 100vh;
  476. background-color: #F5F7FA;
  477. padding-bottom: 30rpx;
  478. }
  479. /* 头部导航 */
  480. .header {
  481. display: none;
  482. /* 隐藏整个头部标题栏 */
  483. }
  484. .back-button {
  485. width: 60rpx;
  486. height: 60rpx;
  487. display: flex;
  488. align-items: center;
  489. justify-content: center;
  490. }
  491. .icon-back {
  492. font-size: 36rpx;
  493. color: #333;
  494. }
  495. .page-title {
  496. flex: 1;
  497. text-align: center;
  498. font-size: 32rpx;
  499. font-weight: bold;
  500. color: #333;
  501. margin-right: 60rpx;
  502. /* 平衡左侧返回按钮 */
  503. }
  504. /* 搜索框 */
  505. .search-box {
  506. padding: 20rpx 30rpx;
  507. background-color: #FFFFFF;
  508. border-bottom: 1px solid rgba(0, 0, 0, 0.03);
  509. margin-bottom: 20rpx;
  510. }
  511. .search-header {
  512. font-size: 28rpx;
  513. color: #333;
  514. font-weight: 500;
  515. margin-bottom: 15rpx;
  516. }
  517. .search-input {
  518. display: flex;
  519. align-items: center;
  520. height: 70rpx;
  521. background-color: #F5F7FA;
  522. border-radius: 35rpx;
  523. padding: 0 30rpx;
  524. box-shadow: inset 0 1rpx 3rpx rgba(0, 0, 0, 0.05);
  525. border: 1rpx solid rgba(0, 0, 0, 0.03);
  526. }
  527. .icon-search {
  528. font-size: 28rpx;
  529. color: #999;
  530. margin-right: 10rpx;
  531. }
  532. .search-input input {
  533. flex: 1;
  534. height: 70rpx;
  535. font-size: 28rpx;
  536. color: #333;
  537. }
  538. .clear-icon {
  539. width: 40rpx;
  540. height: 40rpx;
  541. display: flex;
  542. align-items: center;
  543. justify-content: center;
  544. font-size: 32rpx;
  545. color: #999;
  546. }
  547. /* 块区域通用样式 */
  548. .current-block,
  549. .block-list {
  550. margin: 0 30rpx 20rpx;
  551. background-color: #FFFFFF;
  552. padding: 24rpx;
  553. border-radius: 24rpx;
  554. box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
  555. }
  556. .block-header {
  557. display: flex;
  558. justify-content: space-between;
  559. align-items: center;
  560. margin-bottom: 20rpx;
  561. }
  562. .block-header .left {
  563. display: flex;
  564. align-items: center;
  565. }
  566. .icon-tag {
  567. font-size: 24rpx;
  568. color: #FFFFFF;
  569. background: linear-gradient(135deg, #66CC6A 0%, #3BB44A 100%);
  570. padding: 4rpx 16rpx;
  571. border-radius: 6rpx;
  572. margin-right: 16rpx;
  573. box-shadow: 0 2rpx 5rpx rgba(59, 180, 74, 0.2);
  574. }
  575. .block-header .title {
  576. font-size: 30rpx;
  577. font-weight: bold;
  578. color: #333;
  579. }
  580. .block-header .count {
  581. font-size: 24rpx;
  582. color: #999;
  583. background-color: #F5F7FA;
  584. padding: 4rpx 16rpx;
  585. border-radius: 20rpx;
  586. }
  587. /* 当前选中地块卡片 */
  588. .current-block-card {
  589. background: linear-gradient(to right, #F0F8F0, #E7F5E8);
  590. border-radius: 16rpx;
  591. padding: 30rpx;
  592. position: relative;
  593. border: 2rpx solid rgba(59, 180, 74, 0.2);
  594. box-shadow: 0 4rpx 16rpx rgba(59, 180, 74, 0.1);
  595. }
  596. .current-tag {
  597. position: absolute;
  598. top: 0;
  599. right: 20rpx;
  600. background: linear-gradient(135deg, #66CC6A 0%, #3BB44A 100%);
  601. color: white;
  602. font-size: 22rpx;
  603. padding: 6rpx 16rpx;
  604. border-radius: 0 0 12rpx 12rpx;
  605. font-weight: bold;
  606. }
  607. /* 地块列表卡片 */
  608. .block-cards {
  609. display: flex;
  610. flex-direction: column;
  611. gap: 20rpx;
  612. }
  613. .block-card {
  614. background-color: #FFFFFF;
  615. border-radius: 16rpx;
  616. padding: 30rpx;
  617. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
  618. position: relative;
  619. border: 1rpx solid rgba(0, 0, 0, 0.03);
  620. transition: all 0.3s ease;
  621. }
  622. .block-card:active {
  623. transform: scale(0.98);
  624. box-shadow: 0 1rpx 5rpx rgba(0, 0, 0, 0.03);
  625. }
  626. .block-card.active-block {
  627. border: 2rpx solid #3BB44A;
  628. background-color: #F0F8F0;
  629. box-shadow: 0 4rpx 16rpx rgba(59, 180, 74, 0.1);
  630. }
  631. .block-card.clickable {
  632. cursor: pointer;
  633. }
  634. .block-card.clickable:hover {
  635. box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.1);
  636. }
  637. .block-content {
  638. display: flex;
  639. align-items: flex-start;
  640. position: relative;
  641. margin-bottom: 20rpx;
  642. }
  643. .block-icon {
  644. width: 40rpx;
  645. margin-right: 15rpx;
  646. display: flex;
  647. align-items: center;
  648. justify-content: center;
  649. }
  650. .location-icon {
  651. width: 36rpx;
  652. height: 36rpx;
  653. }
  654. .block-info {
  655. flex: 1;
  656. }
  657. .block-name {
  658. font-size: 32rpx;
  659. font-weight: bold;
  660. color: #333;
  661. margin-bottom: 6rpx;
  662. }
  663. .block-farm {
  664. font-size: 26rpx;
  665. color: #666;
  666. margin-bottom: 10rpx;
  667. }
  668. .block-meta {
  669. font-size: 26rpx;
  670. color: #999;
  671. margin-bottom: 10rpx;
  672. }
  673. .block-details {
  674. font-size: 26rpx;
  675. color: #666;
  676. }
  677. .separator {
  678. margin: 0 10rpx;
  679. color: #ccc;
  680. }
  681. .check-mark {
  682. position: absolute;
  683. right: 0;
  684. top: 0;
  685. }
  686. .check-icon {
  687. width: 48rpx;
  688. height: 48rpx;
  689. }
  690. /* 状态标签 */
  691. .status-badge {
  692. position: absolute;
  693. top: 0;
  694. right: 0;
  695. font-size: 22rpx;
  696. padding: 4rpx 12rpx;
  697. border-radius: 0 16rpx 0 12rpx;
  698. font-weight: 500;
  699. z-index: 1;
  700. }
  701. .status-active-badge {
  702. background-color: #E6F7E6;
  703. color: #3BB44A;
  704. border-left: 1rpx solid rgba(59, 180, 74, 0.2);
  705. border-bottom: 1rpx solid rgba(59, 180, 74, 0.2);
  706. }
  707. .status-idle-badge {
  708. background-color: #F1F2F3;
  709. color: #909399;
  710. border-left: 1rpx solid rgba(144, 147, 153, 0.2);
  711. border-bottom: 1rpx solid rgba(144, 147, 153, 0.2);
  712. }
  713. .status-maintenance-badge {
  714. background-color: #FEF0F0;
  715. color: #F56C6C;
  716. border-left: 1rpx solid rgba(245, 108, 108, 0.2);
  717. border-bottom: 1rpx solid rgba(245, 108, 108, 0.2);
  718. }
  719. /* 地块统计信息 */
  720. .block-stats {
  721. display: flex;
  722. align-items: center;
  723. flex-wrap: wrap;
  724. border-top: 1rpx solid #F0F0F0;
  725. padding-top: 20rpx;
  726. }
  727. .stat-item {
  728. display: flex;
  729. align-items: center;
  730. margin-right: 24rpx;
  731. font-size: 26rpx;
  732. color: #666;
  733. }
  734. .stat-icon {
  735. width: 36rpx;
  736. height: 36rpx;
  737. margin-right: 8rpx;
  738. flex-shrink: 0;
  739. }
  740. .online-icon {
  741. /* 在线图标使用绿色 */
  742. filter: hue-rotate(120deg) saturate(1.2);
  743. }
  744. .alert-icon {
  745. /* 告警图标使用红色 */
  746. filter: hue-rotate(0deg) saturate(1.5);
  747. }
  748. .alert-text {
  749. color: #F56C6C;
  750. }
  751. /* 骨架屏 */
  752. .skeleton-container {
  753. display: flex;
  754. flex-direction: column;
  755. gap: 20rpx;
  756. }
  757. .skeleton-box {
  758. background-color: #FFFFFF;
  759. border-radius: 16rpx;
  760. padding: 20rpx;
  761. margin-bottom: 10rpx;
  762. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
  763. animation: skeleton-loading 1.5s infinite;
  764. }
  765. @keyframes skeleton-loading {
  766. 0% {
  767. opacity: 0.7;
  768. }
  769. 50% {
  770. opacity: 0.5;
  771. }
  772. 100% {
  773. opacity: 0.7;
  774. }
  775. }
  776. .skeleton-header {
  777. display: flex;
  778. align-items: flex-start;
  779. }
  780. .skeleton-icon {
  781. width: 40rpx;
  782. height: 40rpx;
  783. background-color: #EEEEEE;
  784. border-radius: 8rpx;
  785. margin-right: 15rpx;
  786. }
  787. .skeleton-info {
  788. flex: 1;
  789. }
  790. .skeleton-title {
  791. width: 200rpx;
  792. height: 32rpx;
  793. background-color: #EEEEEE;
  794. margin-bottom: 10rpx;
  795. border-radius: 4rpx;
  796. }
  797. .skeleton-detail {
  798. width: 300rpx;
  799. height: 24rpx;
  800. background-color: #EEEEEE;
  801. border-radius: 4rpx;
  802. }
  803. .skeleton-stats {
  804. margin-top: 16rpx;
  805. padding-top: 16rpx;
  806. border-top: 1rpx solid #F5F5F5;
  807. height: 30rpx;
  808. background-color: #EEEEEE;
  809. border-radius: 4rpx;
  810. }
  811. /* 空状态 */
  812. .empty-state {
  813. display: flex;
  814. flex-direction: column;
  815. align-items: center;
  816. justify-content: center;
  817. padding: 60rpx 0;
  818. }
  819. .empty-image {
  820. width: 240rpx;
  821. height: 240rpx;
  822. margin-bottom: 20rpx;
  823. opacity: 0.7;
  824. }
  825. .empty-text {
  826. font-size: 32rpx;
  827. color: #666;
  828. font-weight: 500;
  829. margin-bottom: 10rpx;
  830. }
  831. .empty-subtext {
  832. font-size: 26rpx;
  833. color: #999;
  834. }
  835. /* 基础图标样式 */
  836. .iconfont {
  837. font-family: "iconfont" !important;
  838. font-style: normal;
  839. -webkit-font-smoothing: antialiased;
  840. -moz-osx-font-smoothing: grayscale;
  841. }
  842. /* 底部加载提示区域 */
  843. .loading-more {
  844. display: flex;
  845. justify-content: center;
  846. align-items: center;
  847. padding: 20rpx 0;
  848. background-color: #FFFFFF;
  849. border-top: 1px solid rgba(0, 0, 0, 0.03);
  850. }
  851. .loading-text {
  852. display: flex;
  853. align-items: center;
  854. font-size: 28rpx;
  855. color: #666;
  856. }
  857. .loading-icon {
  858. width: 40rpx;
  859. height: 40rpx;
  860. margin-right: 10rpx;
  861. background-color: #3BB44A;
  862. border-radius: 50%;
  863. animation: spin 1s linear infinite;
  864. }
  865. @keyframes spin {
  866. 0% {
  867. transform: rotate(0deg);
  868. }
  869. 100% {
  870. transform: rotate(360deg);
  871. }
  872. }
  873. .no-more-text {
  874. font-size: 28rpx;
  875. color: #999;
  876. margin-left: 10rpx;
  877. }
  878. </style>