detail-machine.vue 28 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163
  1. <template>
  2. <view class="container">
  3. <!-- 设备头部信息区域 -->
  4. <view class="device-header">
  5. <view class="device-info-row">
  6. <view class="device-name-container">
  7. <text class="device-name">{{ deviceInfo.name }}</text>
  8. <view
  9. class="status-tag"
  10. :class="deviceInfo.status === 'online' ? 'status-online' : 'status-offline'"
  11. >
  12. <view class="status-dot" :class="{'offline-dot': deviceInfo.status === 'offline'}"></view>
  13. {{ deviceInfo.status === 'online' ? '在线' : '离线' }}
  14. </view>
  15. </view>
  16. <view class="refresh-btn" :class="{'refreshing': isRefreshing}" @tap="refreshData">
  17. <image src="/static/icons/refresh_icon.png" mode="aspectFit" style="width: 22px; height: 22px;"></image>
  18. </view>
  19. </view>
  20. <view class="device-meta-row">
  21. <view class="device-meta-item">
  22. <view class="meta-icon">
  23. <image src="/static/icons/device_icon.png" mode="aspectFit" style="width: 36rpx; height: 36rpx;"></image>
  24. </view>
  25. <text class="meta-label">设备编号:</text>
  26. <text class="meta-value">{{ deviceInfo.deviceId }}</text>
  27. </view>
  28. <view class="device-meta-item">
  29. <view class="meta-icon">
  30. <image src="/static/icons/location_icon.png" mode="aspectFit" style="width: 36rpx; height: 36rpx;"></image>
  31. </view>
  32. <text class="meta-label">工作区域:</text>
  33. <text class="meta-value">{{ deviceInfo.location }}</text>
  34. </view>
  35. <view class="device-meta-item">
  36. <view class="meta-icon">
  37. <image src="/static/icons/clock_icon.png" mode="aspectFit" style="width: 36rpx; height: 36rpx;"></image>
  38. </view>
  39. <text class="meta-label">最近更新:</text>
  40. <text class="meta-value">{{ deviceInfo.lastUpdate }}</text>
  41. </view>
  42. </view>
  43. </view>
  44. <!-- 设备状态信息区域 -->
  45. <view class="status-section">
  46. <view class="section-title">
  47. <text>设备状态</text>
  48. </view>
  49. <view class="status-grid">
  50. <!-- 作业状态 -->
  51. <view class="status-item" hover-class="status-item-hover">
  52. <text class="status-label">作业状态</text>
  53. <view class="status-value-container">
  54. <text class="status-value" :class="{
  55. 'status-working': deviceInfo.workStatus === 'working',
  56. 'status-idle': deviceInfo.workStatus === 'idle',
  57. 'status-error': deviceInfo.workStatus === 'error'
  58. }">{{ getWorkStatusText(deviceInfo.workStatus) }}</text>
  59. </view>
  60. <text class="status-time">{{ deviceInfo.statusUpdateTime || '1分钟前' }}</text>
  61. </view>
  62. <!-- 电量状态 -->
  63. <view class="status-item" hover-class="status-item-hover">
  64. <text class="status-label">电量</text>
  65. <view class="status-value-container">
  66. <text class="status-value" :class="{
  67. 'value-warning': deviceInfo.battery < 30,
  68. 'value-alert': deviceInfo.battery < 15
  69. }">{{ deviceInfo.battery || 85 }}</text>
  70. <text class="status-unit">%</text>
  71. </view>
  72. <text class="status-time">{{ deviceInfo.batteryUpdateTime || '30秒前' }}</text>
  73. </view>
  74. <!-- GPS信号 -->
  75. <view class="status-item" hover-class="status-item-hover">
  76. <text class="status-label">GPS信号</text>
  77. <view class="status-value-container">
  78. <text class="status-value" :class="{
  79. 'status-good': deviceInfo.gpsSignal >= 80,
  80. 'status-normal': deviceInfo.gpsSignal >= 60 && deviceInfo.gpsSignal < 80,
  81. 'status-weak': deviceInfo.gpsSignal < 60
  82. }">{{ getGpsSignalText(deviceInfo.gpsSignal) }}</text>
  83. </view>
  84. <text class="status-time">{{ deviceInfo.gpsUpdateTime || '15秒前' }}</text>
  85. </view>
  86. <!-- 工作时长 -->
  87. <view class="status-item" hover-class="status-item-hover">
  88. <text class="status-label">今日工作</text>
  89. <view class="status-value-container">
  90. <text class="status-value">{{ deviceInfo.workDuration || '2.5' }}</text>
  91. <text class="status-unit">小时</text>
  92. </view>
  93. <text class="status-time">累计时长</text>
  94. </view>
  95. <!-- 作业面积 -->
  96. <view class="status-item" hover-class="status-item-hover">
  97. <text class="status-label">今日面积</text>
  98. <view class="status-value-container">
  99. <text class="status-value">{{ deviceInfo.workArea || '15.6' }}</text>
  100. <text class="status-unit">亩</text>
  101. </view>
  102. <text class="status-time">已完成</text>
  103. </view>
  104. <!-- 当前速度 -->
  105. <view class="status-item" hover-class="status-item-hover">
  106. <text class="status-label">当前速度</text>
  107. <view class="status-value-container">
  108. <text class="status-value">{{ deviceInfo.currentSpeed || '0' }}</text>
  109. <text class="status-unit">km/h</text>
  110. </view>
  111. <text class="status-time">{{ deviceInfo.speedUpdateTime || '实时' }}</text>
  112. </view>
  113. </view>
  114. </view>
  115. <!-- 设备控制区域 -->
  116. <view class="control-section">
  117. <view class="section-title">
  118. <text>设备控制</text>
  119. <view class="engine-status" :class="{'engine-on': isEngineOn}">
  120. <text>{{ isEngineOn ? '引擎开启' : '引擎关闭' }}</text>
  121. </view>
  122. </view>
  123. <view class="control-container">
  124. <!-- 启动/停止按钮 -->
  125. <view class="engine-control">
  126. <view
  127. class="engine-button"
  128. :class="{'engine-on': isEngineOn, 'disabled': deviceInfo.status === 'offline'}"
  129. @click="toggleEngine"
  130. >
  131. <view class="engine-icon">
  132. <image
  133. :src="isEngineOn ? '/static/icons/engine_stop.svg' : '/static/icons/engine_start.svg'"
  134. mode="aspectFit"
  135. style="width: 28px; height: 28px;"
  136. ></image>
  137. </view>
  138. <text class="engine-text">{{ isEngineOn ? '停止' : '启动' }}</text>
  139. </view>
  140. </view>
  141. <!-- 方向控制 -->
  142. <view class="direction-control">
  143. <!-- 前进按钮 -->
  144. <view class="control-btn control-forward"
  145. :class="{'disabled': !isEngineOn || deviceInfo.status === 'offline', 'active': activeControl === 'forward'}"
  146. @touchstart="startControl('forward')"
  147. @touchend="stopControl">
  148. <image src="/static/icons/arrow_up.svg" mode="aspectFit" style="width: 24px; height: 24px;"></image>
  149. <text>前进</text>
  150. </view>
  151. <!-- 左右控制行 -->
  152. <view class="control-row">
  153. <!-- 左转按钮 -->
  154. <view class="control-btn control-left"
  155. :class="{'disabled': !isEngineOn || deviceInfo.status === 'offline', 'active': activeControl === 'left'}"
  156. @touchstart="startControl('left')"
  157. @touchend="stopControl">
  158. <image src="/static/icons/arrow_left.svg" mode="aspectFit" style="width: 24px; height: 24px;"></image>
  159. <text>左转</text>
  160. </view>
  161. <!-- 中心状态显示 -->
  162. <view class="control-center">
  163. <view class="speed-display">
  164. <text class="speed-value">{{ currentSpeed }}</text>
  165. <text class="speed-unit">km/h</text>
  166. </view>
  167. </view>
  168. <!-- 右转按钮 -->
  169. <view class="control-btn control-right"
  170. :class="{'disabled': !isEngineOn || deviceInfo.status === 'offline', 'active': activeControl === 'right'}"
  171. @touchstart="startControl('right')"
  172. @touchend="stopControl">
  173. <image src="/static/icons/arrow_right.svg" mode="aspectFit" style="width: 24px; height: 24px;"></image>
  174. <text>右转</text>
  175. </view>
  176. </view>
  177. <!-- 后退按钮 -->
  178. <view class="control-btn control-backward"
  179. :class="{'disabled': !isEngineOn || deviceInfo.status === 'offline', 'active': activeControl === 'backward'}"
  180. @touchstart="startControl('backward')"
  181. @touchend="stopControl">
  182. <image src="/static/icons/arrow_down.svg" mode="aspectFit" style="width: 24px; height: 24px;"></image>
  183. <text>后退</text>
  184. </view>
  185. </view>
  186. <!-- 快捷操作按钮 -->
  187. <view class="quick-controls">
  188. <view class="quick-control-btn"
  189. :class="{'disabled': deviceInfo.status === 'offline'}"
  190. @click="emergencyStop">
  191. <view class="quick-icon emergency">
  192. <image src="/static/icons/emergency_stop.svg" mode="aspectFit" style="width: 24px; height: 24px;"></image>
  193. </view>
  194. <text>紧急停止</text>
  195. </view>
  196. <view class="quick-control-btn"
  197. :class="{'disabled': deviceInfo.status === 'offline'}"
  198. @click="returnHome">
  199. <view class="quick-icon">
  200. <image src="/static/icons/home.svg" mode="aspectFit" style="width: 24px; height: 24px;"></image>
  201. </view>
  202. <text>返回充电</text>
  203. </view>
  204. <view class="quick-control-btn"
  205. :class="{'disabled': deviceInfo.status === 'offline'}"
  206. @click="autoMode">
  207. <view class="quick-icon">
  208. <image src="/static/icons/auto_mode.svg" mode="aspectFit" style="width: 24px; height: 24px;"></image>
  209. </view>
  210. <text>自动模式</text>
  211. </view>
  212. </view>
  213. </view>
  214. </view>
  215. <!-- 告警信息列表 -->
  216. <view class="alerts-section">
  217. <view class="section-title">
  218. <text>告警信息</text>
  219. <view class="alert-badge" v-if="getUnhandledAlerts.length > 0">{{ getUnhandledAlerts.length }}</view>
  220. </view>
  221. <view class="alerts-list" v-if="getUnhandledAlerts.length > 0">
  222. <view
  223. v-for="(item, index) in getUnhandledAlerts"
  224. :key="index"
  225. class="alert-item"
  226. :class="{
  227. 'alert-urgent': item.level === 'high',
  228. 'alert-warning': item.level === 'medium',
  229. 'alert-info': item.level === 'low'
  230. }"
  231. @click="handleAlert(item)"
  232. >
  233. <view class="alert-item-icon">
  234. <image v-if="item.level === 'high'" src="/static/icons/warning_icon.png" mode="aspectFit" style="width: 24px; height: 24px;"></image>
  235. <image v-else-if="item.level === 'medium'" src="/static/icons/info_icon.png" mode="aspectFit" style="width: 24px; height: 24px;"></image>
  236. <image v-else src="/static/icons/success_icon.png" mode="aspectFit" style="width: 24px; height: 24px;"></image>
  237. </view>
  238. <view class="alert-item-info">
  239. <text class="alert-item-type">{{ item.title }}</text>
  240. <text class="alert-item-level">
  241. {{ item.level === 'high' ? '紧急' : item.level === 'medium' ? '警告' : '提示' }}
  242. </text>
  243. </view>
  244. <view class="alert-item-time">{{ item.time }}</view>
  245. </view>
  246. </view>
  247. <view v-else class="empty-alert">
  248. <text class="empty-text">暂无告警信息</text>
  249. </view>
  250. </view>
  251. </view>
  252. </template>
  253. <script>
  254. export default {
  255. data() {
  256. return {
  257. // 设备信息
  258. deviceInfo: {
  259. id: '',
  260. name: '智能播种机-001',
  261. deviceId: 'AGM-001-2024',
  262. location: '东区水稻田A块',
  263. status: 'online', // online, offline
  264. workStatus: 'idle', // working, idle, error
  265. battery: 85,
  266. gpsSignal: 92,
  267. workDuration: '2.5',
  268. workArea: '15.6',
  269. currentSpeed: '0',
  270. lastUpdate: '1分钟前',
  271. statusUpdateTime: '1分钟前',
  272. batteryUpdateTime: '30秒前',
  273. gpsUpdateTime: '15秒前',
  274. speedUpdateTime: '实时'
  275. },
  276. // 控制状态
  277. isEngineOn: false,
  278. activeControl: '', // forward, backward, left, right
  279. currentSpeed: 0,
  280. // 页面状态
  281. isRefreshing: false,
  282. // 告警数据
  283. alerts: [
  284. {
  285. id: 1,
  286. title: '电量不足警告',
  287. description: '设备电量低于30%,建议及时充电',
  288. level: 'medium',
  289. time: '5分钟前',
  290. handled: false
  291. },
  292. {
  293. id: 2,
  294. title: 'GPS信号弱',
  295. description: '当前GPS信号较弱,可能影响导航精度',
  296. level: 'low',
  297. time: '10分钟前',
  298. handled: false
  299. },
  300. {
  301. id: 3,
  302. title: '作业异常',
  303. description: '检测到播种深度异常,请检查设备状态',
  304. level: 'high',
  305. time: '15分钟前',
  306. handled: false
  307. }
  308. ]
  309. }
  310. },
  311. computed: {
  312. // 未处理的告警
  313. getUnhandledAlerts() {
  314. return this.alerts.filter(alert => !alert.handled);
  315. }
  316. },
  317. onLoad(options) {
  318. // 获取设备ID参数
  319. if (options.deviceId) {
  320. this.deviceInfo.deviceId = options.deviceId;
  321. }
  322. // 获取设备ID参数(兼容不同参数名)
  323. if (options.id) {
  324. this.deviceInfo.id = options.id;
  325. }
  326. // 设置导航栏标题
  327. uni.setNavigationBarTitle({
  328. title: '农机设备详情'
  329. });
  330. // 加载设备数据
  331. this.loadDeviceData();
  332. },
  333. onShow() {
  334. // 页面显示时刷新数据
  335. this.refreshData();
  336. },
  337. onHide() {
  338. // 页面隐藏时停止所有控制操作
  339. this.stopAllControls();
  340. },
  341. methods: {
  342. // 加载设备数据
  343. loadDeviceData() {
  344. // 这里可以调用API获取设备详细信息
  345. console.log('加载设备数据:', this.deviceInfo.deviceId);
  346. },
  347. // 刷新数据
  348. refreshData() {
  349. this.isRefreshing = true;
  350. // 模拟刷新延迟
  351. setTimeout(() => {
  352. this.isRefreshing = false;
  353. // 更新最近更新时间
  354. this.deviceInfo.lastUpdate = '刚刚';
  355. uni.showToast({
  356. title: '刷新成功',
  357. icon: 'success',
  358. duration: 1500
  359. });
  360. }, 1000);
  361. },
  362. // 获取工作状态文本
  363. getWorkStatusText(status) {
  364. const statusMap = {
  365. working: '工作中',
  366. idle: '空闲',
  367. error: '故障'
  368. };
  369. return statusMap[status] || '未知';
  370. },
  371. // 获取GPS信号文本
  372. getGpsSignalText(signal) {
  373. if (signal >= 80) return '强';
  374. if (signal >= 60) return '中等';
  375. if (signal >= 40) return '弱';
  376. return '无信号';
  377. },
  378. // 切换引擎状态
  379. toggleEngine() {
  380. if (this.deviceInfo.status === 'offline') {
  381. uni.showToast({
  382. title: '设备离线,无法操作',
  383. icon: 'none'
  384. });
  385. return;
  386. }
  387. this.isEngineOn = !this.isEngineOn;
  388. if (this.isEngineOn) {
  389. this.deviceInfo.workStatus = 'idle';
  390. uni.showToast({
  391. title: '引擎已启动',
  392. icon: 'success'
  393. });
  394. } else {
  395. this.deviceInfo.workStatus = 'idle';
  396. this.currentSpeed = 0;
  397. this.stopAllControls();
  398. uni.showToast({
  399. title: '引擎已关闭',
  400. icon: 'success'
  401. });
  402. }
  403. },
  404. // 开始控制
  405. startControl(direction) {
  406. if (!this.isEngineOn || this.deviceInfo.status === 'offline') {
  407. return;
  408. }
  409. this.activeControl = direction;
  410. this.deviceInfo.workStatus = 'working';
  411. // 模拟速度变化
  412. switch (direction) {
  413. case 'forward':
  414. this.currentSpeed = 5;
  415. break;
  416. case 'backward':
  417. this.currentSpeed = 2;
  418. break;
  419. case 'left':
  420. case 'right':
  421. this.currentSpeed = 3;
  422. break;
  423. }
  424. // 发送控制指令
  425. this.sendControlCommand(direction, true);
  426. },
  427. // 停止控制
  428. stopControl() {
  429. if (this.activeControl) {
  430. this.sendControlCommand(this.activeControl, false);
  431. }
  432. this.activeControl = '';
  433. this.currentSpeed = 0;
  434. this.deviceInfo.workStatus = 'idle';
  435. },
  436. // 停止所有控制
  437. stopAllControls() {
  438. this.activeControl = '';
  439. this.currentSpeed = 0;
  440. if (this.isEngineOn) {
  441. this.deviceInfo.workStatus = 'idle';
  442. }
  443. },
  444. // 发送控制指令
  445. sendControlCommand(direction, isStart) {
  446. console.log(`发送控制指令: ${direction}, 开始: ${isStart}`);
  447. // 这里可以调用API发送实际的控制指令
  448. },
  449. // 紧急停止
  450. emergencyStop() {
  451. if (this.deviceInfo.status === 'offline') {
  452. uni.showToast({
  453. title: '设备离线,无法操作',
  454. icon: 'none'
  455. });
  456. return;
  457. }
  458. uni.showModal({
  459. title: '紧急停止',
  460. content: '确定要执行紧急停止吗?设备将立即停止所有操作。',
  461. success: (res) => {
  462. if (res.confirm) {
  463. this.isEngineOn = false;
  464. this.stopAllControls();
  465. uni.showToast({
  466. title: '紧急停止已执行',
  467. icon: 'success'
  468. });
  469. }
  470. }
  471. });
  472. },
  473. // 返回充电
  474. returnHome() {
  475. if (this.deviceInfo.status === 'offline') {
  476. uni.showToast({
  477. title: '设备离线,无法操作',
  478. icon: 'none'
  479. });
  480. return;
  481. }
  482. uni.showToast({
  483. title: '设备正在返回充电站',
  484. icon: 'success'
  485. });
  486. },
  487. // 自动模式
  488. autoMode() {
  489. if (this.deviceInfo.status === 'offline') {
  490. uni.showToast({
  491. title: '设备离线,无法操作',
  492. icon: 'none'
  493. });
  494. return;
  495. }
  496. uni.showToast({
  497. title: '已切换到自动模式',
  498. icon: 'success'
  499. });
  500. },
  501. // 处理告警
  502. handleAlert(alert) {
  503. uni.showModal({
  504. title: alert.title,
  505. content: alert.description + '\n\n是否标记为已处理?',
  506. success: (res) => {
  507. if (res.confirm) {
  508. const index = this.alerts.findIndex(item => item.id === alert.id);
  509. if (index !== -1) {
  510. this.alerts[index].handled = true;
  511. }
  512. uni.showToast({
  513. title: '已标记为处理',
  514. icon: 'success'
  515. });
  516. }
  517. }
  518. });
  519. }
  520. }
  521. }
  522. </script>
  523. <style scoped>
  524. .container {
  525. display: flex;
  526. flex-direction: column;
  527. min-height: 100vh;
  528. background-color: #F8FCF9;
  529. padding-bottom: 30rpx;
  530. }
  531. /* 设备头部信息 */
  532. .device-header {
  533. background-color: #FFFFFF;
  534. border-radius: 20rpx;
  535. padding: 30rpx;
  536. margin: 30rpx 30rpx 30rpx;
  537. box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
  538. border: 1rpx solid rgba(210, 237, 217, 0.5);
  539. }
  540. .device-info-row {
  541. display: flex;
  542. justify-content: space-between;
  543. align-items: center;
  544. margin-bottom: 28rpx;
  545. }
  546. .device-name-container {
  547. display: flex;
  548. flex-direction: column;
  549. align-items: flex-start;
  550. }
  551. .device-name {
  552. font-size: 36rpx;
  553. color: #333333;
  554. font-weight: 600;
  555. margin-bottom: 12rpx;
  556. }
  557. .status-tag {
  558. padding: 6rpx 16rpx 6rpx 28rpx;
  559. border-radius: 30rpx;
  560. font-size: 24rpx;
  561. font-weight: 500;
  562. flex-shrink: 0;
  563. position: relative;
  564. overflow: hidden;
  565. }
  566. .status-online {
  567. background-color: rgba(76, 175, 80, 0.1);
  568. color: #3BB44A;
  569. }
  570. .status-offline {
  571. background-color: rgba(245, 108, 108, 0.1);
  572. color: #F56C6C;
  573. padding-left: 28rpx;
  574. }
  575. .status-dot {
  576. position: absolute;
  577. width: 6rpx;
  578. height: 6rpx;
  579. background-color: #3BB44A;
  580. border-radius: 50%;
  581. top: 50%;
  582. left: 12rpx;
  583. transform: translateY(-50%);
  584. box-shadow: 0 0 4rpx rgba(76, 175, 80, 0.8);
  585. animation: blink 1.5s infinite;
  586. display: inline-block;
  587. }
  588. .status-dot.offline-dot {
  589. background-color: #F56C6C;
  590. box-shadow: 0 0 4rpx rgba(245, 108, 108, 0.8);
  591. }
  592. .refresh-btn {
  593. width: 48rpx;
  594. height: 48rpx;
  595. background-color: rgba(76, 175, 80, 0.1);
  596. border-radius: 50%;
  597. display: flex;
  598. align-items: center;
  599. justify-content: center;
  600. padding: 12rpx;
  601. transition: transform 0.3s ease;
  602. }
  603. .refresh-btn:active {
  604. transform: rotate(180deg);
  605. }
  606. .refresh-btn.refreshing {
  607. animation: spin 1.2s linear infinite;
  608. }
  609. @keyframes spin {
  610. 0% {
  611. transform: rotate(0deg);
  612. }
  613. 100% {
  614. transform: rotate(360deg);
  615. }
  616. }
  617. @keyframes blink {
  618. 0% {
  619. opacity: 0.4;
  620. }
  621. 50% {
  622. opacity: 1;
  623. }
  624. 100% {
  625. opacity: 0.4;
  626. }
  627. }
  628. .device-meta-row {
  629. display: flex;
  630. flex-direction: column;
  631. background-color: #F9FCFA;
  632. padding: 20rpx 24rpx;
  633. border-radius: 16rpx;
  634. border: 1rpx solid rgba(210, 237, 217, 0.8);
  635. }
  636. .device-meta-item {
  637. display: flex;
  638. align-items: center;
  639. font-size: 28rpx;
  640. margin-top: 18rpx;
  641. }
  642. .device-meta-item:first-child {
  643. margin-top: 0;
  644. }
  645. .meta-icon {
  646. width: 36rpx;
  647. height: 36rpx;
  648. display: flex;
  649. align-items: center;
  650. justify-content: center;
  651. margin-right: 12rpx;
  652. }
  653. .meta-label {
  654. color: #777777;
  655. min-width: 140rpx;
  656. font-size: 28rpx;
  657. }
  658. .meta-value {
  659. color: #333333;
  660. flex: 1;
  661. font-size: 28rpx;
  662. font-weight: 500;
  663. }
  664. /* 设备状态区域 */
  665. .status-section {
  666. background: #ffffff;
  667. margin: 0 24rpx 20rpx;
  668. padding: 32rpx 24rpx;
  669. border-radius: 20rpx;
  670. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.06);
  671. }
  672. .section-title {
  673. display: flex;
  674. justify-content: space-between;
  675. align-items: center;
  676. font-size: 32rpx;
  677. font-weight: 600;
  678. color: #333333;
  679. margin-bottom: 24rpx;
  680. padding-bottom: 16rpx;
  681. border-bottom: 2rpx solid #f0f0f0;
  682. }
  683. .status-grid {
  684. display: grid;
  685. grid-template-columns: repeat(2, 1fr);
  686. gap: 20rpx;
  687. }
  688. .status-item {
  689. background: #f8f9fa;
  690. padding: 24rpx;
  691. border-radius: 16rpx;
  692. border: 2rpx solid transparent;
  693. transition: all 0.3s ease;
  694. }
  695. .status-item-hover {
  696. border-color: #40a9ff;
  697. box-shadow: 0 4rpx 12rpx rgba(64, 169, 255, 0.15);
  698. }
  699. .status-label {
  700. font-size: 24rpx;
  701. color: #999999;
  702. margin-bottom: 8rpx;
  703. display: block;
  704. }
  705. .status-value-container {
  706. display: flex;
  707. align-items: baseline;
  708. margin-bottom: 8rpx;
  709. }
  710. .status-value {
  711. font-size: 36rpx;
  712. font-weight: 600;
  713. color: #333333;
  714. }
  715. .status-unit {
  716. font-size: 24rpx;
  717. color: #666666;
  718. margin-left: 4rpx;
  719. }
  720. .status-time {
  721. font-size: 20rpx;
  722. color: #cccccc;
  723. }
  724. /* 状态颜色 */
  725. .status-working {
  726. color: #52c41a;
  727. }
  728. .status-idle {
  729. color: #1890ff;
  730. }
  731. .status-error {
  732. color: #ff4d4f;
  733. }
  734. .status-good {
  735. color: #52c41a;
  736. }
  737. .status-normal {
  738. color: #faad14;
  739. }
  740. .status-weak {
  741. color: #ff4d4f;
  742. }
  743. .value-warning {
  744. color: #faad14;
  745. }
  746. .value-alert {
  747. color: #ff4d4f;
  748. }
  749. /* 控制区域 */
  750. .control-section {
  751. background: #ffffff;
  752. margin: 0 24rpx 20rpx;
  753. padding: 32rpx 24rpx;
  754. border-radius: 20rpx;
  755. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.06);
  756. }
  757. .engine-status {
  758. padding: 8rpx 16rpx;
  759. border-radius: 20rpx;
  760. font-size: 24rpx;
  761. background-color: #fff1f0;
  762. color: #ff4d4f;
  763. }
  764. .engine-status.engine-on {
  765. background-color: #e8f5e8;
  766. color: #52c41a;
  767. }
  768. .control-container {
  769. display: flex;
  770. flex-direction: column;
  771. gap: 32rpx;
  772. }
  773. /* 引擎控制 */
  774. .engine-control {
  775. display: flex;
  776. justify-content: center;
  777. }
  778. .engine-button {
  779. display: flex;
  780. flex-direction: column;
  781. align-items: center;
  782. padding: 24rpx;
  783. background: #ffffff;
  784. border-radius: 20rpx;
  785. border: 3rpx solid #4CAF50;
  786. transition: all 0.3s ease;
  787. width: 160rpx;
  788. box-shadow: 0 4rpx 12rpx rgba(76, 175, 80, 0.2);
  789. }
  790. .engine-button.engine-on {
  791. background: #F44336;
  792. border-color: #F44336;
  793. color: white;
  794. box-shadow: 0 4rpx 12rpx rgba(244, 67, 54, 0.3);
  795. }
  796. .engine-button:not(.engine-on) {
  797. background: #4CAF50;
  798. border-color: #4CAF50;
  799. color: white;
  800. }
  801. .engine-button.disabled {
  802. opacity: 0.3;
  803. pointer-events: none;
  804. background: #DDDDDD;
  805. border-color: #DDDDDD;
  806. }
  807. .engine-button:active {
  808. transform: scale(0.95);
  809. }
  810. .engine-icon {
  811. margin-bottom: 12rpx;
  812. }
  813. .engine-text {
  814. font-size: 28rpx;
  815. font-weight: 600;
  816. }
  817. /* 方向控制 */
  818. .direction-control {
  819. display: flex;
  820. flex-direction: column;
  821. align-items: center;
  822. gap: 20rpx;
  823. }
  824. .control-row {
  825. display: flex;
  826. align-items: center;
  827. gap: 20rpx;
  828. }
  829. .control-btn {
  830. display: flex;
  831. flex-direction: column;
  832. align-items: center;
  833. justify-content: center;
  834. width: 120rpx;
  835. height: 120rpx;
  836. background: #f8f9fa;
  837. border-radius: 12rpx;
  838. border: 2rpx solid #e0e0e0;
  839. transition: all 0.3s ease;
  840. font-size: 24rpx;
  841. color: #999999;
  842. gap: 8rpx;
  843. }
  844. .control-btn.active {
  845. background: rgba(76, 175, 80, 0.1);
  846. border-color: #4CAF50;
  847. color: #4CAF50;
  848. transform: scale(0.9);
  849. box-shadow: 0 2rpx 8rpx rgba(76, 175, 80, 0.3);
  850. }
  851. .control-btn.disabled {
  852. opacity: 0.3;
  853. pointer-events: none;
  854. background: #DDDDDD;
  855. border-color: #DDDDDD;
  856. }
  857. .control-center {
  858. width: 120rpx;
  859. height: 120rpx;
  860. display: flex;
  861. flex-direction: column;
  862. align-items: center;
  863. justify-content: center;
  864. background: #f0f0f0;
  865. border-radius: 20rpx;
  866. border: 2rpx solid #d0d0d0;
  867. }
  868. .speed-display {
  869. display: flex;
  870. flex-direction: column;
  871. align-items: center;
  872. }
  873. .speed-value {
  874. font-size: 32rpx;
  875. font-weight: 600;
  876. color: #333333;
  877. }
  878. .speed-unit {
  879. font-size: 20rpx;
  880. color: #999999;
  881. }
  882. /* 快捷控制 */
  883. .quick-controls {
  884. display: flex;
  885. justify-content: space-around;
  886. padding-top: 20rpx;
  887. border-top: 2rpx solid #f0f0f0;
  888. }
  889. .quick-control-btn {
  890. display: flex;
  891. flex-direction: column;
  892. align-items: center;
  893. gap: 8rpx;
  894. padding: 16rpx;
  895. border-radius: 16rpx;
  896. transition: all 0.3s ease;
  897. }
  898. .quick-control-btn.disabled {
  899. opacity: 0.5;
  900. pointer-events: none;
  901. }
  902. .quick-control-btn:active {
  903. background: #f0f0f0;
  904. }
  905. .quick-icon {
  906. width: 48rpx;
  907. height: 48rpx;
  908. background: #f8f9fa;
  909. border-radius: 12rpx;
  910. display: flex;
  911. align-items: center;
  912. justify-content: center;
  913. border: 2rpx solid #e0e0e0;
  914. }
  915. .quick-icon.emergency {
  916. background: rgba(245, 108, 108, 0.1);
  917. border-color: #F56C6C;
  918. }
  919. .quick-control-btn text {
  920. font-size: 24rpx;
  921. color: #666666;
  922. }
  923. /* 告警信息 */
  924. .alerts-section {
  925. margin: 0 30rpx 30rpx;
  926. background-color: #FFFFFF;
  927. border-radius: 20rpx;
  928. padding: 30rpx 24rpx;
  929. box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
  930. border: 1rpx solid rgba(210, 237, 217, 0.5);
  931. }
  932. .alert-badge {
  933. background-color: #F56C6C;
  934. color: #FFFFFF;
  935. font-size: 22rpx;
  936. border-radius: 30rpx;
  937. padding: 2rpx 12rpx;
  938. margin-left: 12rpx;
  939. font-weight: normal;
  940. min-width: 32rpx;
  941. text-align: center;
  942. }
  943. .alerts-list {
  944. display: flex;
  945. flex-direction: column;
  946. gap: 16rpx;
  947. }
  948. .alert-item {
  949. display: flex;
  950. align-items: center;
  951. padding: 24rpx 20rpx;
  952. border-radius: 12rpx;
  953. margin-bottom: 16rpx;
  954. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
  955. position: relative;
  956. border: 1rpx solid transparent;
  957. transition: transform 0.2s ease;
  958. }
  959. .alert-item:active {
  960. transform: scale(0.98);
  961. }
  962. .alert-urgent {
  963. background-color: #FEF3F3;
  964. border-left: 4rpx solid #F56C6C;
  965. border-color: rgba(245, 108, 108, 0.2);
  966. }
  967. .alert-warning {
  968. background-color: #FFF8E6;
  969. border-left: 4rpx solid #E6A23C;
  970. border-color: rgba(230, 162, 60, 0.2);
  971. }
  972. .alert-info {
  973. background-color: #F2FAF5;
  974. border-left: 4rpx solid #67C23A;
  975. border-color: rgba(103, 194, 58, 0.2);
  976. }
  977. .alert-item-icon {
  978. width: 50rpx;
  979. height: 50rpx;
  980. display: flex;
  981. align-items: center;
  982. justify-content: center;
  983. margin-right: 16rpx;
  984. }
  985. .alert-item-info {
  986. flex: 1;
  987. display: flex;
  988. flex-direction: column;
  989. gap: 8rpx;
  990. }
  991. .alert-item-type {
  992. font-size: 28rpx;
  993. color: #333333;
  994. font-weight: 500;
  995. margin-bottom: 8rpx;
  996. }
  997. .alert-item-level {
  998. font-size: 24rpx;
  999. color: #999999;
  1000. }
  1001. .alert-item-time {
  1002. font-size: 24rpx;
  1003. color: #999999;
  1004. margin-left: 16rpx;
  1005. min-width: 100rpx;
  1006. text-align: right;
  1007. }
  1008. .empty-alert {
  1009. padding: 60rpx 0;
  1010. display: flex;
  1011. justify-content: center;
  1012. align-items: center;
  1013. }
  1014. .empty-text {
  1015. font-size: 28rpx;
  1016. color: #999999;
  1017. }
  1018. </style>