detail-machine.vue 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661
  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.machineName }}</text>
  8. <view
  9. class="status-tag"
  10. :class="deviceInfo.onlineStatus == 1 ? 'status-online' : 'status-offline'"
  11. >
  12. <view class="status-dot" :class="{'offline-dot': deviceInfo.onlineStatus == 0}"></view>
  13. {{ deviceInfo.onlineStatus == 1 ? '在线' : '离线' }}
  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.machineCode }}</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.updateTime }}</text>
  41. </view>
  42. </view>
  43. </view>
  44. <!-- 作业任务列表(竖向排列) -->
  45. <view class="task-section">
  46. <view class="section-title task-title-row">
  47. <view class="task-title-left">
  48. <text class="task-title-text">作业任务列表</text>
  49. <text class="task-title-sub">配置并选择当前设备的作业</text>
  50. </view>
  51. <view class="task-add-btn" @click.stop="goToCreateJob">
  52. <text class="task-add-plus">+</text>
  53. </view>
  54. </view>
  55. <view v-if="taskList.length" class="task-list">
  56. <view
  57. v-for="task in taskList"
  58. :key="task.id"
  59. class="task-card"
  60. :class="{ active: task.id === selectedTaskId }"
  61. @click="selectTask(task)"
  62. >
  63. <view class="task-header">
  64. <view class="task-icon">
  65. <image src="/static/icons/task_icon.png" mode="aspectFit" class="task-icon-img"></image>
  66. </view>
  67. <view class="task-title-wrap">
  68. <text class="task-title">{{ task.name }}</text>
  69. <text class="task-sub">{{ task.fieldArea }}</text>
  70. </view>
  71. <view class="task-area-type">{{ task.areaTypeText }}</view>
  72. <view class="task-radio">
  73. <view class="radio-outer" :class="{ checked: task.id === selectedTaskId }">
  74. <view class="radio-inner"></view>
  75. </view>
  76. </view>
  77. </view>
  78. <view class="task-meta">
  79. <text class="task-time">计划时间:{{ task.planTime }}</text>
  80. <view class="task-meta-right">
  81. <text class="task-status">{{ task.statusText }}</text>
  82. <button class="task-delete-btn" @click.stop="confirmDeleteTask(task)">删除</button>
  83. </view>
  84. </view>
  85. </view>
  86. </view>
  87. <view v-else class="task-empty">
  88. <text class="task-empty-text">当前设备暂无作业任务</text>
  89. </view>
  90. </view>
  91. <!-- 设备状态信息区域 -->
  92. <!-- <view class="status-section">
  93. <view class="section-title">
  94. <text>设备状态</text>
  95. </view>
  96. <view class="status-grid">
  97. <!-- 作业状态
  98. <view class="status-item" hover-class="status-item-hover">
  99. <text class="status-label">作业状态</text>
  100. <view class="status-value-container">
  101. <text class="status-value" :class="{
  102. 'status-working': deviceInfo.workStatus === 'working',
  103. 'status-idle': deviceInfo.workStatus === 'idle',
  104. 'status-error': deviceInfo.workStatus === 'error'
  105. }">{{ getWorkStatusText(deviceInfo.workStatus) }}</text>
  106. </view>
  107. <text class="status-time">{{ deviceInfo.statusUpdateTime || '1分钟前' }}</text>
  108. </view>
  109. <!-- 电量状态
  110. <view class="status-item" hover-class="status-item-hover">
  111. <text class="status-label">电量</text>
  112. <view class="status-value-container">
  113. <text class="status-value" :class="{
  114. 'value-warning': deviceInfo.battery < 30,
  115. 'value-alert': deviceInfo.battery < 15
  116. }">{{ deviceInfo.battery || 85 }}</text>
  117. <text class="status-unit">%</text>
  118. </view>
  119. <text class="status-time">{{ deviceInfo.batteryUpdateTime || '30秒前' }}</text>
  120. </view>
  121. <!-- GPS信号
  122. <view class="status-item" hover-class="status-item-hover">
  123. <text class="status-label">GPS信号</text>
  124. <view class="status-value-container">
  125. <text class="status-value" :class="{
  126. 'status-good': deviceInfo.gpsSignal >= 80,
  127. 'status-normal': deviceInfo.gpsSignal >= 60 && deviceInfo.gpsSignal < 80,
  128. 'status-weak': deviceInfo.gpsSignal < 60
  129. }">{{ getGpsSignalText(deviceInfo.gpsSignal) }}</text>
  130. </view>
  131. <text class="status-time">{{ deviceInfo.gpsUpdateTime || '15秒前' }}</text>
  132. </view>
  133. <!-- 工作时长
  134. <view class="status-item" hover-class="status-item-hover">
  135. <text class="status-label">今日工作</text>
  136. <view class="status-value-container">
  137. <text class="status-value">{{ deviceInfo.workDuration || '2.5' }}</text>
  138. <text class="status-unit">小时</text>
  139. </view>
  140. <text class="status-time">累计时长</text>
  141. </view>
  142. <!-- 作业面积
  143. <view class="status-item" hover-class="status-item-hover">
  144. <text class="status-label">今日面积</text>
  145. <view class="status-value-container">
  146. <text class="status-value">{{ deviceInfo.workArea || '15.6' }}</text>
  147. <text class="status-unit">亩</text>
  148. </view>
  149. <text class="status-time">已完成</text>
  150. </view>
  151. <!-- 当前速度
  152. <view class="status-item" hover-class="status-item-hover">
  153. <text class="status-label">当前速度</text>
  154. <view class="status-value-container">
  155. <text class="status-value">{{ deviceInfo.currentSpeed || '0' }}</text>
  156. <text class="status-unit">km/h</text>
  157. </view>
  158. <text class="status-time">{{ deviceInfo.speedUpdateTime || '实时' }}</text>
  159. </view>
  160. </view>
  161. </view> -->
  162. <!-- 设备控制区域
  163. <view class="control-section">
  164. <view class="section-title">
  165. <text>设备控制</text>
  166. <view class="engine-status" :class="{'engine-on': isEngineOn}">
  167. <text>{{ isEngineOn ? '引擎开启' : '引擎关闭' }}</text>
  168. </view>
  169. </view>
  170. <view class="control-container">
  171. <!-- 启动/停止按钮
  172. <view class="engine-control">
  173. <view
  174. class="engine-button"
  175. :class="{'engine-on': isEngineOn, 'disabled': deviceInfo.status === 'offline'}"
  176. @click="toggleEngine"
  177. >
  178. <view class="engine-icon">
  179. <image
  180. :src="isEngineOn ? '/static/icons/engine_stop.svg' : '/static/icons/engine_start.svg'"
  181. mode="aspectFit"
  182. style="width: 28px; height: 28px;"
  183. ></image>
  184. </view>
  185. <text class="engine-text">{{ isEngineOn ? '停止' : '启动' }}</text>
  186. </view>
  187. </view>
  188. <!-- 方向控制
  189. <view class="direction-control">
  190. <!-- 前进按钮
  191. <view class="control-btn control-forward"
  192. :class="{'disabled': !isEngineOn || deviceInfo.status === 'offline', 'active': activeControl === 'forward'}"
  193. @touchstart="startControl('forward')"
  194. @touchend="stopControl">
  195. <image src="/static/icons/arrow_up.svg" mode="aspectFit" style="width: 24px; height: 24px;"></image>
  196. <text>前进</text>
  197. </view>
  198. <!-- 左右控制行
  199. <view class="control-row">
  200. <!-- 左转按钮
  201. <view class="control-btn control-left"
  202. :class="{'disabled': !isEngineOn || deviceInfo.status === 'offline', 'active': activeControl === 'left'}"
  203. @touchstart="startControl('left')"
  204. @touchend="stopControl">
  205. <image src="/static/icons/arrow_left.svg" mode="aspectFit" style="width: 24px; height: 24px;"></image>
  206. <text>左转</text>
  207. </view>
  208. <!-- 中心状态显示
  209. <view class="control-center">
  210. <view class="speed-display">
  211. <text class="speed-value">{{ currentSpeed }}</text>
  212. <text class="speed-unit">km/h</text>
  213. </view>
  214. </view>
  215. <!-- 右转按钮
  216. <view class="control-btn control-right"
  217. :class="{'disabled': !isEngineOn || deviceInfo.status === 'offline', 'active': activeControl === 'right'}"
  218. @touchstart="startControl('right')"
  219. @touchend="stopControl">
  220. <image src="/static/icons/arrow_right.svg" mode="aspectFit" style="width: 24px; height: 24px;"></image>
  221. <text>右转</text>
  222. </view>
  223. </view>
  224. <!-- 后退按钮
  225. <view class="control-btn control-backward"
  226. :class="{'disabled': !isEngineOn || deviceInfo.status === 'offline', 'active': activeControl === 'backward'}"
  227. @touchstart="startControl('backward')"
  228. @touchend="stopControl">
  229. <image src="/static/icons/arrow_down.svg" mode="aspectFit" style="width: 24px; height: 24px;"></image>
  230. <text>后退</text>
  231. </view>
  232. </view>
  233. <!-- 快捷操作按钮
  234. <view class="quick-controls">
  235. <view class="quick-control-btn"
  236. :class="{'disabled': deviceInfo.status === 'offline'}"
  237. @click="emergencyStop">
  238. <view class="quick-icon emergency">
  239. <image src="/static/icons/emergency_stop.svg" mode="aspectFit" style="width: 24px; height: 24px;"></image>
  240. </view>
  241. <text>紧急停止</text>
  242. </view>
  243. <view class="quick-control-btn"
  244. :class="{'disabled': deviceInfo.status === 'offline'}"
  245. @click="returnHome">
  246. <view class="quick-icon">
  247. <image src="/static/icons/home.svg" mode="aspectFit" style="width: 24px; height: 24px;"></image>
  248. </view>
  249. <text>返回充电</text>
  250. </view>
  251. <view class="quick-control-btn"
  252. :class="{'disabled': deviceInfo.status === 'offline'}"
  253. @click="autoMode">
  254. <view class="quick-icon">
  255. <image src="/static/icons/auto_mode.svg" mode="aspectFit" style="width: 24px; height: 24px;"></image>
  256. </view>
  257. <text>自动模式</text>
  258. </view>
  259. </view>
  260. </view>
  261. </view>-->
  262. <!-- 底部“开始作业”按钮 -->
  263. <view class="task-footer">
  264. <button
  265. class="start-btn"
  266. :class="{ disabled: !taskList.length || !selectedTaskId || deviceInfo.onlineStatus !== 1 }"
  267. @click="startWork"
  268. >
  269. 开始作业
  270. </button>
  271. </view>
  272. <!-- 告警信息列表 -->
  273. <view class="alerts-section">
  274. <view class="section-title">
  275. <text>告警信息</text>
  276. <view class="alert-badge" v-if="getUnhandledAlerts.length > 0">{{ getUnhandledAlerts.length }}</view>
  277. </view>
  278. <view class="alerts-list" v-if="getUnhandledAlerts.length > 0">
  279. <view
  280. v-for="(item, index) in getUnhandledAlerts"
  281. :key="index"
  282. class="alert-item"
  283. :class="{
  284. 'alert-urgent': item.level === 'high',
  285. 'alert-warning': item.level === 'medium',
  286. 'alert-info': item.level === 'low'
  287. }"
  288. @click="handleAlert(item)"
  289. >
  290. <view class="alert-item-icon">
  291. <image v-if="item.level === 'high'" src="/static/icons/warning_icon.png" mode="aspectFit" style="width: 24px; height: 24px;"></image>
  292. <image v-else-if="item.level === 'medium'" src="/static/icons/info_icon.png" mode="aspectFit" style="width: 24px; height: 24px;"></image>
  293. <image v-else src="/static/icons/success_icon.png" mode="aspectFit" style="width: 24px; height: 24px;"></image>
  294. </view>
  295. <view class="alert-item-info">
  296. <text class="alert-item-type">{{ item.title }}</text>
  297. <text class="alert-item-level">
  298. {{ item.level === 'high' ? '紧急' : item.level === 'medium' ? '警告' : '提示' }}
  299. </text>
  300. </view>
  301. <view class="alert-item-time">{{ item.time }}</view>
  302. </view>
  303. </view>
  304. <view v-else class="empty-alert">
  305. <text class="empty-text">暂无告警信息</text>
  306. </view>
  307. </view>
  308. </view>
  309. </template>
  310. <script>
  311. import { machineAlarmRecordsList } from '@/api/services/machineAlarmRecords';
  312. import { deviceTasksList, startTask, deleteTask } from '@/api/services/job';
  313. export default {
  314. data() {
  315. return {
  316. // 设备信息
  317. deviceInfo: {
  318. // id: '',
  319. // name: '智能播种机-001',
  320. // deviceId: 'AGM-001-2024',
  321. // location: '东区水稻田A块',
  322. // status: 'online', // online, offline
  323. // workStatus: 'idle', // working, idle, error
  324. // battery: 85,
  325. // gpsSignal: 92,
  326. // workDuration: '2.5',
  327. // workArea: '15.6',
  328. // currentSpeed: '0',
  329. // lastUpdate: '1分钟前',
  330. // statusUpdateTime: '1分钟前',
  331. // batteryUpdateTime: '30秒前',
  332. // gpsUpdateTime: '15秒前',
  333. // speedUpdateTime: '实时'
  334. },
  335. // 作业任务列表
  336. taskList: [],
  337. selectedTaskId: null,
  338. // 控制状态
  339. isEngineOn: false,
  340. activeControl: '', // forward, backward, left, right
  341. currentSpeed: 0,
  342. // 页面状态
  343. isRefreshing: false,
  344. alarmTypeMap: {
  345. 0: '其他',
  346. 1: '发动机',
  347. 2: '燃油',
  348. 3: '温度',
  349. 4: '压力',
  350. 5: '定位',
  351. },
  352. // 告警数据
  353. alerts: [
  354. // {
  355. // id: 1,
  356. // title: '电量不足警告',
  357. // description: '设备电量低于30%,建议及时充电',
  358. // level: 'medium',
  359. // time: '5分钟前',
  360. // handled: false
  361. // },
  362. // {
  363. // id: 2,
  364. // title: 'GPS信号弱',
  365. // description: '当前GPS信号较弱,可能影响导航精度',
  366. // level: 'low',
  367. // time: '10分钟前',
  368. // handled: false
  369. // },
  370. // {
  371. // id: 3,
  372. // title: '作业异常',
  373. // description: '检测到播种深度异常,请检查设备状态',
  374. // level: 'high',
  375. // time: '15分钟前',
  376. // handled: false
  377. // }
  378. ]
  379. }
  380. },
  381. computed: {
  382. // 未处理的告警
  383. getUnhandledAlerts() {
  384. return this.alerts.filter(alert => !alert.handled);
  385. }
  386. },
  387. onLoad(options) {
  388. this.deviceInfo.id = options.id;
  389. // 获取设备ID参数
  390. uni.$once('agriculturalMachinesData', (data) => {
  391. if (data ) {
  392. this.deviceInfo.machineCode = data.machineCode;
  393. this.deviceInfo.machineName = data.machineName;
  394. this.deviceInfo.onlineStatus = data.onlineStatus;
  395. this.deviceInfo.updateTime = data.updateTime;
  396. }
  397. });
  398. // 设置导航栏标题
  399. uni.setNavigationBarTitle({
  400. title: '农机设备详情'
  401. });
  402. // 加载设备数据
  403. this.loadDeviceData();
  404. // 默认加载当前设备的作业任务
  405. this.loadTaskList();
  406. // 加载设备告警数据
  407. this.loadDeviceAlarmData();
  408. },
  409. onShow() {
  410. // 页面显示时刷新数据
  411. this.refreshData();
  412. },
  413. onHide() {
  414. // 页面隐藏时停止所有控制操作
  415. this.stopAllControls();
  416. },
  417. methods: {
  418. // 加载设备告警数据
  419. loadDeviceAlarmData() {
  420. return machineAlarmRecordsList({
  421. machineId: this.deviceInfo.id
  422. }).then(res => {
  423. console.log('设备告警数据:', res);
  424. if (res.data.code === 200 && res.data.rows) {
  425. this.alerts = res.data.rows.map(item => ({
  426. id: item.id,
  427. // title: this.formatAlarmType(item.alarmType),
  428. title: item.alarmDesc,
  429. level: item.alarmLevel === 3 ? 'high' : item.alarmLevel === 2 ? 'medium' : 'low',
  430. time: item.alarmTime
  431. }));
  432. }
  433. });
  434. },
  435. formatAlarmType(level) {
  436. return this.alarmTypeMap[level] || '其他';
  437. },
  438. // 加载设备数据
  439. loadDeviceData() {
  440. // 这里可以调用API获取设备详细信息
  441. console.log('加载设备数据:', this.deviceInfo.deviceId);
  442. },
  443. // 加载当前设备的作业任务列表
  444. loadTaskList() {
  445. const params = {
  446. pageNum: 1,
  447. pageSize: 10,
  448. // 文档未声明 deviceId 过滤,但为了兼容后端如支持按设备筛选,这里传入
  449. deviceId: this.deviceInfo.id
  450. };
  451. return deviceTasksList(params)
  452. .then((res) => {
  453. console.log("res任务作业列表",res);
  454. const { data } = res || {};
  455. if (data && data.code === 200) {
  456. const list = (data.rows) ? data.rows : [];
  457. // 适配页面字段
  458. const areaTypeTextMap = {
  459. 1: '回字形',
  460. 2: '弓字形',
  461. 3: '自定义',
  462. 4: '垄沟'
  463. }
  464. this.taskList = list.map((item) => ({
  465. id: item.id,
  466. name: item.taskName,
  467. fieldArea: item.workArea ? item.workArea.areaName : '',
  468. planTime: item.createTime,
  469. status: item.taskStatus,
  470. statusText: item.taskStatusDesc,
  471. areaType: item.workAreas && item.workAreas.areaType,
  472. areaTypeText: areaTypeTextMap[item.workAreas && item.workAreas.areaType || 0] || '未知'
  473. }));
  474. console.log('taskList',this.taskList);
  475. // 默认选中第一条
  476. if (this.taskList.length) {
  477. // 若当前已选中且仍存在,则保持;否则选第一条
  478. const exists = this.selectedTaskId && this.taskList.some(t => t.id === this.selectedTaskId);
  479. this.selectedTaskId = exists ? this.selectedTaskId : this.taskList[0].id;
  480. } else {
  481. this.selectedTaskId = null;
  482. }
  483. } else {
  484. this.taskList = [];
  485. this.selectedTaskId = null;
  486. uni.showToast({
  487. title: (data && data.msg) ? data.msg : '获取作业任务失败',
  488. icon: 'none'
  489. });
  490. }
  491. })
  492. .catch((err) => {
  493. console.error('获取作业任务列表失败:', err);
  494. this.taskList = [];
  495. this.selectedTaskId = null;
  496. uni.showToast({
  497. title: '获取作业任务失败',
  498. icon: 'none'
  499. });
  500. });
  501. },
  502. // 刷新数据
  503. refreshData() {
  504. this.isRefreshing = true;
  505. Promise.all([
  506. this.loadTaskList(),
  507. this.loadDeviceAlarmData()
  508. ]).finally(() => {
  509. this.isRefreshing = false;
  510. // 更新最近更新时间
  511. this.deviceInfo.lastUpdate = '刚刚';
  512. uni.showToast({
  513. title: '刷新成功',
  514. icon: 'success',
  515. duration: 1500
  516. });
  517. });
  518. },
  519. // 获取工作状态文本
  520. getWorkStatusText(status) {
  521. const statusMap = {
  522. working: '工作中',
  523. idle: '空闲',
  524. error: '故障'
  525. };
  526. return statusMap[status] || '未知';
  527. },
  528. // 获取GPS信号文本
  529. getGpsSignalText(signal) {
  530. if (signal >= 80) return '强';
  531. if (signal >= 60) return '中等';
  532. if (signal >= 40) return '弱';
  533. return '无信号';
  534. },
  535. // 切换引擎状态
  536. toggleEngine() {
  537. if (this.deviceInfo.status === 'offline') {
  538. uni.showToast({
  539. title: '设备离线,无法操作',
  540. icon: 'none'
  541. });
  542. return;
  543. }
  544. this.isEngineOn = !this.isEngineOn;
  545. if (this.isEngineOn) {
  546. this.deviceInfo.workStatus = 'idle';
  547. uni.showToast({
  548. title: '引擎已启动',
  549. icon: 'success'
  550. });
  551. } else {
  552. this.deviceInfo.workStatus = 'idle';
  553. this.currentSpeed = 0;
  554. this.stopAllControls();
  555. uni.showToast({
  556. title: '引擎已关闭',
  557. icon: 'success'
  558. });
  559. }
  560. },
  561. // 开始控制
  562. startControl(direction) {
  563. if (!this.isEngineOn || this.deviceInfo.status === 'offline') {
  564. return;
  565. }
  566. this.activeControl = direction;
  567. this.deviceInfo.workStatus = 'working';
  568. // 模拟速度变化
  569. switch (direction) {
  570. case 'forward':
  571. this.currentSpeed = 5;
  572. break;
  573. case 'backward':
  574. this.currentSpeed = 2;
  575. break;
  576. case 'left':
  577. case 'right':
  578. this.currentSpeed = 3;
  579. break;
  580. }
  581. // 发送控制指令
  582. this.sendControlCommand(direction, true);
  583. },
  584. // 停止控制
  585. stopControl() {
  586. if (this.activeControl) {
  587. this.sendControlCommand(this.activeControl, false);
  588. }
  589. this.activeControl = '';
  590. this.currentSpeed = 0;
  591. this.deviceInfo.workStatus = 'idle';
  592. },
  593. // 停止所有控制
  594. stopAllControls() {
  595. this.activeControl = '';
  596. this.currentSpeed = 0;
  597. if (this.isEngineOn) {
  598. this.deviceInfo.workStatus = 'idle';
  599. }
  600. },
  601. // 发送控制指令
  602. sendControlCommand(direction, isStart) {
  603. console.log(`发送控制指令: ${direction}, 开始: ${isStart}`);
  604. // 这里可以调用API发送实际的控制指令
  605. },
  606. // 紧急停止
  607. emergencyStop() {
  608. if (this.deviceInfo.status === 'offline') {
  609. uni.showToast({
  610. title: '设备离线,无法操作',
  611. icon: 'none'
  612. });
  613. return;
  614. }
  615. uni.showModal({
  616. title: '紧急停止',
  617. content: '确定要执行紧急停止吗?设备将立即停止所有操作。',
  618. success: (res) => {
  619. if (res.confirm) {
  620. this.isEngineOn = false;
  621. this.stopAllControls();
  622. uni.showToast({
  623. title: '紧急停止已执行',
  624. icon: 'success'
  625. });
  626. }
  627. }
  628. });
  629. },
  630. // 返回充电
  631. returnHome() {
  632. if (this.deviceInfo.status === 'offline') {
  633. uni.showToast({
  634. title: '设备离线,无法操作',
  635. icon: 'none'
  636. });
  637. return;
  638. }
  639. uni.showToast({
  640. title: '设备正在返回充电站',
  641. icon: 'success'
  642. });
  643. },
  644. // 自动模式
  645. autoMode() {
  646. if (this.deviceInfo.status === 'offline') {
  647. uni.showToast({
  648. title: '设备离线,无法操作',
  649. icon: 'none'
  650. });
  651. return;
  652. }
  653. uni.showToast({
  654. title: '已切换到自动模式',
  655. icon: 'success'
  656. });
  657. },
  658. // 跳转到新增作业页面
  659. goToCreateJob() {
  660. uni.navigateTo({
  661. url: `/pages/device/job-create/index?machineCode=${this.deviceInfo.machineCode}&id=${this.deviceInfo.id}`
  662. });
  663. },
  664. // 选择作业任务
  665. selectTask(task) {
  666. this.selectedTaskId = task.id;
  667. },
  668. // 开始作业
  669. startWork() {
  670. if (!this.taskList.length) {
  671. uni.showToast({
  672. title: '暂无可执行的作业任务',
  673. icon: 'none'
  674. });
  675. return;
  676. }
  677. if (!this.selectedTaskId) {
  678. uni.showToast({
  679. title: '请先选择一个作业任务',
  680. icon: 'none'
  681. });
  682. return;
  683. }
  684. if (this.deviceInfo.onlineStatus !== 1) {
  685. uni.showToast({
  686. title: '设备未在线,无法开始作业',
  687. icon: 'none'
  688. });
  689. return;
  690. }
  691. const task = this.taskList.find(t => t.id === this.selectedTaskId);
  692. uni.showModal({
  693. title: '开始作业',
  694. content: `确定开始执行「${task.name}」吗?`,
  695. success: async (res) => {
  696. if (res.confirm) {
  697. try {
  698. uni.showLoading({ title: '启动中...' });
  699. const resp = await startTask(this.selectedTaskId);
  700. const { data } = resp || {};
  701. if (data && data.code === 200) {
  702. uni.showToast({
  703. title: '作业已启动',
  704. icon: 'success'
  705. });
  706. this.isEngineOn = true;
  707. this.deviceInfo.workStatus = 'working';
  708. // 跳转到作业详情页
  709. setTimeout(() => {
  710. uni.navigateTo({
  711. url: `/pages/device/job-detail/index?id=${this.selectedTaskId}&deviceId=${this.deviceInfo.machineCode}&deviceName=${this.deviceInfo.machineName}`
  712. });
  713. }, 300);
  714. } else {
  715. uni.showToast({
  716. title: (data && data.msg) ? data.msg : '启动失败',
  717. icon: 'none'
  718. });
  719. }
  720. } catch (e) {
  721. console.error('开始作业失败:', e);
  722. uni.showToast({
  723. title: '网络异常,启动失败',
  724. icon: 'none'
  725. });
  726. } finally {
  727. uni.hideLoading();
  728. }
  729. }
  730. }
  731. });
  732. },
  733. // 删除作业
  734. confirmDeleteTask(task) {
  735. if (!task || !task.id) return
  736. uni.showModal({
  737. title: '确认删除',
  738. content: `确定删除作业「${task.name}」吗?删除后不可恢复。`,
  739. confirmText: '删除',
  740. confirmColor: '#F56C6C',
  741. success: async (res) => {
  742. if (!res.confirm) return
  743. try {
  744. uni.showLoading({ title: '删除中...' })
  745. const resp = await deleteTask(task.id)
  746. const { data } = resp || {}
  747. if (data && data.code === 200) {
  748. uni.showToast({ title: '删除成功', icon: 'success' })
  749. // 若删除的是当前选中任务,清理选中态
  750. if (this.selectedTaskId === task.id) {
  751. this.selectedTaskId = null
  752. }
  753. // 重新拉取列表
  754. await this.loadTaskList()
  755. } else {
  756. uni.showToast({
  757. title: (data && data.msg) ? data.msg : '删除失败',
  758. icon: 'none'
  759. })
  760. }
  761. } catch (e) {
  762. console.error('删除作业失败:', e)
  763. uni.showToast({ title: '网络异常,删除失败', icon: 'none' })
  764. } finally {
  765. uni.hideLoading()
  766. }
  767. }
  768. })
  769. },
  770. // 处理告警
  771. handleAlert(alert) {
  772. uni.showModal({
  773. title: alert.title,
  774. content: alert.description + '\n\n是否标记为已处理?',
  775. success: (res) => {
  776. if (res.confirm) {
  777. const index = this.alerts.findIndex(item => item.id === alert.id);
  778. if (index !== -1) {
  779. this.alerts[index].handled = true;
  780. }
  781. uni.showToast({
  782. title: '已标记为处理',
  783. icon: 'success'
  784. });
  785. }
  786. }
  787. });
  788. }
  789. }
  790. }
  791. </script>
  792. <style scoped>
  793. .container {
  794. display: flex;
  795. flex-direction: column;
  796. min-height: 100vh;
  797. background-color: #F8FCF9;
  798. padding-bottom: 30rpx;
  799. }
  800. /* 设备头部信息 */
  801. .device-header {
  802. background-color: #FFFFFF;
  803. border-radius: 20rpx;
  804. padding: 30rpx;
  805. margin: 30rpx 30rpx 30rpx;
  806. box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
  807. border: 1rpx solid rgba(210, 237, 217, 0.5);
  808. }
  809. .device-info-row {
  810. display: flex;
  811. justify-content: space-between;
  812. align-items: center;
  813. margin-bottom: 28rpx;
  814. }
  815. .device-name-container {
  816. display: flex;
  817. flex-direction: column;
  818. align-items: flex-start;
  819. }
  820. .device-name {
  821. font-size: 36rpx;
  822. color: #333333;
  823. font-weight: 600;
  824. margin-bottom: 12rpx;
  825. }
  826. .status-tag {
  827. padding: 6rpx 16rpx 6rpx 28rpx;
  828. border-radius: 30rpx;
  829. font-size: 24rpx;
  830. font-weight: 500;
  831. flex-shrink: 0;
  832. position: relative;
  833. overflow: hidden;
  834. }
  835. .status-online {
  836. background-color: rgba(76, 175, 80, 0.1);
  837. color: #3BB44A;
  838. }
  839. .status-offline {
  840. background-color: rgba(245, 108, 108, 0.1);
  841. color: #F56C6C;
  842. padding-left: 28rpx;
  843. }
  844. .status-dot {
  845. position: absolute;
  846. width: 6rpx;
  847. height: 6rpx;
  848. background-color: #3BB44A;
  849. border-radius: 50%;
  850. top: 50%;
  851. left: 12rpx;
  852. transform: translateY(-50%);
  853. box-shadow: 0 0 4rpx rgba(76, 175, 80, 0.8);
  854. animation: blink 1.5s infinite;
  855. display: inline-block;
  856. }
  857. .status-dot.offline-dot {
  858. background-color: #F56C6C;
  859. box-shadow: 0 0 4rpx rgba(245, 108, 108, 0.8);
  860. }
  861. .refresh-btn {
  862. width: 48rpx;
  863. height: 48rpx;
  864. background-color: rgba(76, 175, 80, 0.1);
  865. border-radius: 50%;
  866. display: flex;
  867. align-items: center;
  868. justify-content: center;
  869. padding: 12rpx;
  870. transition: transform 0.3s ease;
  871. }
  872. .refresh-btn:active {
  873. transform: rotate(180deg);
  874. }
  875. .refresh-btn.refreshing {
  876. animation: spin 1.2s linear infinite;
  877. }
  878. @keyframes spin {
  879. 0% {
  880. transform: rotate(0deg);
  881. }
  882. 100% {
  883. transform: rotate(360deg);
  884. }
  885. }
  886. @keyframes blink {
  887. 0% {
  888. opacity: 0.4;
  889. }
  890. 50% {
  891. opacity: 1;
  892. }
  893. 100% {
  894. opacity: 0.4;
  895. }
  896. }
  897. .device-meta-row {
  898. display: flex;
  899. flex-direction: column;
  900. background-color: #F9FCFA;
  901. padding: 20rpx 24rpx;
  902. border-radius: 16rpx;
  903. border: 1rpx solid rgba(210, 237, 217, 0.8);
  904. }
  905. .device-meta-item {
  906. display: flex;
  907. align-items: center;
  908. font-size: 28rpx;
  909. margin-top: 18rpx;
  910. }
  911. .device-meta-item:first-child {
  912. margin-top: 0;
  913. }
  914. .meta-icon {
  915. width: 36rpx;
  916. height: 36rpx;
  917. display: flex;
  918. align-items: center;
  919. justify-content: center;
  920. margin-right: 12rpx;
  921. }
  922. .meta-label {
  923. color: #777777;
  924. min-width: 140rpx;
  925. font-size: 28rpx;
  926. }
  927. .meta-value {
  928. color: #333333;
  929. flex: 1;
  930. font-size: 28rpx;
  931. font-weight: 500;
  932. }
  933. /* 设备状态区域 */
  934. .status-section {
  935. background: #ffffff;
  936. margin: 0 24rpx 20rpx;
  937. padding: 32rpx 24rpx;
  938. border-radius: 20rpx;
  939. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.06);
  940. }
  941. .section-title {
  942. display: flex;
  943. justify-content: space-between;
  944. align-items: center;
  945. font-size: 32rpx;
  946. font-weight: 600;
  947. color: #333333;
  948. margin-bottom: 24rpx;
  949. padding-bottom: 16rpx;
  950. border-bottom: 2rpx solid #f0f0f0;
  951. }
  952. .status-grid {
  953. display: grid;
  954. grid-template-columns: repeat(2, 1fr);
  955. gap: 20rpx;
  956. }
  957. .status-item {
  958. background: #f8f9fa;
  959. padding: 24rpx;
  960. border-radius: 16rpx;
  961. border: 2rpx solid transparent;
  962. transition: all 0.3s ease;
  963. }
  964. .status-item-hover {
  965. border-color: #40a9ff;
  966. box-shadow: 0 4rpx 12rpx rgba(64, 169, 255, 0.15);
  967. }
  968. .status-label {
  969. font-size: 24rpx;
  970. color: #999999;
  971. margin-bottom: 8rpx;
  972. display: block;
  973. }
  974. .status-value-container {
  975. display: flex;
  976. align-items: baseline;
  977. margin-bottom: 8rpx;
  978. }
  979. .status-value {
  980. font-size: 36rpx;
  981. font-weight: 600;
  982. color: #333333;
  983. }
  984. .status-unit {
  985. font-size: 24rpx;
  986. color: #666666;
  987. margin-left: 4rpx;
  988. }
  989. .status-time {
  990. font-size: 20rpx;
  991. color: #cccccc;
  992. }
  993. /* 状态颜色 */
  994. .status-working {
  995. color: #52c41a;
  996. }
  997. .status-idle {
  998. color: #1890ff;
  999. }
  1000. .status-error {
  1001. color: #ff4d4f;
  1002. }
  1003. .status-good {
  1004. color: #52c41a;
  1005. }
  1006. .status-normal {
  1007. color: #faad14;
  1008. }
  1009. .status-weak {
  1010. color: #ff4d4f;
  1011. }
  1012. .value-warning {
  1013. color: #faad14;
  1014. }
  1015. .value-alert {
  1016. color: #ff4d4f;
  1017. }
  1018. /* 控制区域 */
  1019. .control-section {
  1020. background: #ffffff;
  1021. margin: 0 24rpx 20rpx;
  1022. padding: 32rpx 24rpx;
  1023. border-radius: 20rpx;
  1024. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.06);
  1025. }
  1026. .engine-status {
  1027. padding: 8rpx 16rpx;
  1028. border-radius: 20rpx;
  1029. font-size: 24rpx;
  1030. background-color: #fff1f0;
  1031. color: #ff4d4f;
  1032. }
  1033. .engine-status.engine-on {
  1034. background-color: #e8f5e8;
  1035. color: #52c41a;
  1036. }
  1037. .control-container {
  1038. display: flex;
  1039. flex-direction: column;
  1040. gap: 32rpx;
  1041. }
  1042. /* 引擎控制 */
  1043. .engine-control {
  1044. display: flex;
  1045. justify-content: center;
  1046. }
  1047. .engine-button {
  1048. display: flex;
  1049. flex-direction: column;
  1050. align-items: center;
  1051. padding: 24rpx;
  1052. background: #ffffff;
  1053. border-radius: 20rpx;
  1054. border: 3rpx solid #4CAF50;
  1055. transition: all 0.3s ease;
  1056. width: 160rpx;
  1057. box-shadow: 0 4rpx 12rpx rgba(76, 175, 80, 0.2);
  1058. }
  1059. .engine-button.engine-on {
  1060. background: #F44336;
  1061. border-color: #F44336;
  1062. color: white;
  1063. box-shadow: 0 4rpx 12rpx rgba(244, 67, 54, 0.3);
  1064. }
  1065. .engine-button:not(.engine-on) {
  1066. background: #4CAF50;
  1067. border-color: #4CAF50;
  1068. color: white;
  1069. }
  1070. .engine-button.disabled {
  1071. opacity: 0.3;
  1072. pointer-events: none;
  1073. background: #DDDDDD;
  1074. border-color: #DDDDDD;
  1075. }
  1076. .engine-button:active {
  1077. transform: scale(0.95);
  1078. }
  1079. .engine-icon {
  1080. margin-bottom: 12rpx;
  1081. }
  1082. .engine-text {
  1083. font-size: 28rpx;
  1084. font-weight: 600;
  1085. }
  1086. /* 方向控制 */
  1087. .direction-control {
  1088. display: flex;
  1089. flex-direction: column;
  1090. align-items: center;
  1091. gap: 20rpx;
  1092. }
  1093. .control-row {
  1094. display: flex;
  1095. align-items: center;
  1096. gap: 20rpx;
  1097. }
  1098. .control-btn {
  1099. display: flex;
  1100. flex-direction: column;
  1101. align-items: center;
  1102. justify-content: center;
  1103. width: 120rpx;
  1104. height: 120rpx;
  1105. background: #f8f9fa;
  1106. border-radius: 12rpx;
  1107. border: 2rpx solid #e0e0e0;
  1108. transition: all 0.3s ease;
  1109. font-size: 24rpx;
  1110. color: #999999;
  1111. gap: 8rpx;
  1112. }
  1113. .control-btn.active {
  1114. background: rgba(76, 175, 80, 0.1);
  1115. border-color: #4CAF50;
  1116. color: #4CAF50;
  1117. transform: scale(0.9);
  1118. box-shadow: 0 2rpx 8rpx rgba(76, 175, 80, 0.3);
  1119. }
  1120. .control-btn.disabled {
  1121. opacity: 0.3;
  1122. pointer-events: none;
  1123. background: #DDDDDD;
  1124. border-color: #DDDDDD;
  1125. }
  1126. .control-center {
  1127. width: 120rpx;
  1128. height: 120rpx;
  1129. display: flex;
  1130. flex-direction: column;
  1131. align-items: center;
  1132. justify-content: center;
  1133. background: #f0f0f0;
  1134. border-radius: 20rpx;
  1135. border: 2rpx solid #d0d0d0;
  1136. }
  1137. .speed-display {
  1138. display: flex;
  1139. flex-direction: column;
  1140. align-items: center;
  1141. }
  1142. .speed-value {
  1143. font-size: 32rpx;
  1144. font-weight: 600;
  1145. color: #333333;
  1146. }
  1147. .speed-unit {
  1148. font-size: 20rpx;
  1149. color: #999999;
  1150. }
  1151. /* 快捷控制 */
  1152. .quick-controls {
  1153. display: flex;
  1154. justify-content: space-around;
  1155. padding-top: 20rpx;
  1156. border-top: 2rpx solid #f0f0f0;
  1157. }
  1158. .quick-control-btn {
  1159. display: flex;
  1160. flex-direction: column;
  1161. align-items: center;
  1162. gap: 8rpx;
  1163. padding: 16rpx;
  1164. border-radius: 16rpx;
  1165. transition: all 0.3s ease;
  1166. }
  1167. .quick-control-btn.disabled {
  1168. opacity: 0.5;
  1169. pointer-events: none;
  1170. }
  1171. .quick-control-btn:active {
  1172. background: #f0f0f0;
  1173. }
  1174. .quick-icon {
  1175. width: 48rpx;
  1176. height: 48rpx;
  1177. background: #f8f9fa;
  1178. border-radius: 12rpx;
  1179. display: flex;
  1180. align-items: center;
  1181. justify-content: center;
  1182. border: 2rpx solid #e0e0e0;
  1183. }
  1184. .quick-icon.emergency {
  1185. background: rgba(245, 108, 108, 0.1);
  1186. border-color: #F56C6C;
  1187. }
  1188. .quick-control-btn text {
  1189. font-size: 24rpx;
  1190. color: #666666;
  1191. }
  1192. /* 告警信息 */
  1193. .alerts-section {
  1194. margin: 0 30rpx 30rpx;
  1195. background-color: #FFFFFF;
  1196. border-radius: 20rpx;
  1197. padding: 30rpx 24rpx;
  1198. box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
  1199. border: 1rpx solid rgba(210, 237, 217, 0.5);
  1200. }
  1201. .alert-badge {
  1202. background-color: #F56C6C;
  1203. color: #FFFFFF;
  1204. font-size: 22rpx;
  1205. border-radius: 30rpx;
  1206. padding: 2rpx 12rpx;
  1207. margin-left: 12rpx;
  1208. font-weight: normal;
  1209. min-width: 32rpx;
  1210. text-align: center;
  1211. }
  1212. .alerts-list {
  1213. display: flex;
  1214. flex-direction: column;
  1215. gap: 16rpx;
  1216. }
  1217. .alert-item {
  1218. display: flex;
  1219. align-items: center;
  1220. padding: 24rpx 20rpx;
  1221. border-radius: 12rpx;
  1222. margin-bottom: 16rpx;
  1223. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
  1224. position: relative;
  1225. border: 1rpx solid transparent;
  1226. transition: transform 0.2s ease;
  1227. }
  1228. .alert-item:active {
  1229. transform: scale(0.98);
  1230. }
  1231. .alert-urgent {
  1232. background-color: #FEF3F3;
  1233. border-left: 4rpx solid #F56C6C;
  1234. border-color: rgba(245, 108, 108, 0.2);
  1235. }
  1236. .alert-warning {
  1237. background-color: #FFF8E6;
  1238. border-left: 4rpx solid #E6A23C;
  1239. border-color: rgba(230, 162, 60, 0.2);
  1240. }
  1241. .alert-info {
  1242. background-color: #F2FAF5;
  1243. border-left: 4rpx solid #67C23A;
  1244. border-color: rgba(103, 194, 58, 0.2);
  1245. }
  1246. .alert-item-icon {
  1247. width: 50rpx;
  1248. height: 50rpx;
  1249. display: flex;
  1250. align-items: center;
  1251. justify-content: center;
  1252. margin-right: 16rpx;
  1253. }
  1254. .alert-item-info {
  1255. flex: 1;
  1256. display: flex;
  1257. flex-direction: column;
  1258. gap: 8rpx;
  1259. }
  1260. .alert-item-type {
  1261. font-size: 28rpx;
  1262. color: #333333;
  1263. font-weight: 500;
  1264. margin-bottom: 8rpx;
  1265. }
  1266. .alert-item-level {
  1267. font-size: 24rpx;
  1268. color: #999999;
  1269. }
  1270. .alert-item-time {
  1271. font-size: 24rpx;
  1272. color: #999999;
  1273. margin-left: 16rpx;
  1274. min-width: 100rpx;
  1275. text-align: right;
  1276. }
  1277. .empty-alert {
  1278. padding: 60rpx 0;
  1279. display: flex;
  1280. justify-content: center;
  1281. align-items: center;
  1282. }
  1283. .empty-text {
  1284. font-size: 28rpx;
  1285. color: #999999;
  1286. }
  1287. /* 作业任务列表 */
  1288. .task-section {
  1289. background: #ffffff;
  1290. margin: 0 24rpx 20rpx;
  1291. padding: 28rpx 24rpx 20rpx;
  1292. border-radius: 20rpx;
  1293. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.06);
  1294. }
  1295. .task-list {
  1296. margin-top: 8rpx;
  1297. }
  1298. .task-card {
  1299. background: #f9fbfa;
  1300. border-radius: 18rpx;
  1301. padding: 20rpx 18rpx;
  1302. margin-bottom: 16rpx;
  1303. border: 1rpx solid rgba(0, 0, 0, 0.03);
  1304. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.03);
  1305. }
  1306. .task-card.active {
  1307. border-color: #3bb44a;
  1308. background: #f2fff4;
  1309. box-shadow: 0 4rpx 14rpx rgba(59, 180, 74, 0.12);
  1310. }
  1311. .task-header {
  1312. display: flex;
  1313. align-items: center;
  1314. }
  1315. .task-icon {
  1316. width: 60rpx;
  1317. height: 60rpx;
  1318. border-radius: 16rpx;
  1319. background: linear-gradient(135deg, #66cc6a, #3bb44a);
  1320. display: flex;
  1321. align-items: center;
  1322. justify-content: center;
  1323. margin-right: 16rpx;
  1324. }
  1325. .task-icon-img {
  1326. width: 34rpx;
  1327. height: 34rpx;
  1328. }
  1329. .task-area-type {
  1330. font-size: 22rpx;
  1331. color: #888;
  1332. margin-left: 8rpx;
  1333. flex-shrink: 0;
  1334. }
  1335. .task-title-wrap {
  1336. flex: 1;
  1337. display: flex;
  1338. flex-direction: column;
  1339. }
  1340. .task-title {
  1341. font-size: 30rpx;
  1342. font-weight: 600;
  1343. color: #2c3e50;
  1344. }
  1345. .task-sub {
  1346. margin-top: 6rpx;
  1347. font-size: 24rpx;
  1348. color: #8c9396;
  1349. }
  1350. .task-radio {
  1351. margin-left: 12rpx;
  1352. }
  1353. .radio-outer {
  1354. width: 32rpx;
  1355. height: 32rpx;
  1356. border-radius: 16rpx;
  1357. border: 2rpx solid #c0c4cc;
  1358. display: flex;
  1359. align-items: center;
  1360. justify-content: center;
  1361. }
  1362. .radio-outer.checked {
  1363. border-color: #3bb44a;
  1364. background: rgba(59, 180, 74, 0.1);
  1365. }
  1366. .radio-inner {
  1367. width: 18rpx;
  1368. height: 18rpx;
  1369. border-radius: 9rpx;
  1370. background: #3bb44a;
  1371. opacity: 0;
  1372. }
  1373. .radio-outer.checked .radio-inner {
  1374. opacity: 1;
  1375. }
  1376. .task-meta {
  1377. margin-top: 12rpx;
  1378. display: flex;
  1379. justify-content: space-between;
  1380. align-items: center;
  1381. font-size: 24rpx;
  1382. }
  1383. .task-time {
  1384. color: #909399;
  1385. }
  1386. .task-meta-right {
  1387. display: flex;
  1388. align-items: center;
  1389. gap: 12rpx;
  1390. }
  1391. .task-status {
  1392. color: #3bb44a;
  1393. }
  1394. .task-delete-btn {
  1395. height: 52rpx;
  1396. line-height: 52rpx;
  1397. padding: 0 16rpx;
  1398. border-radius: 26rpx;
  1399. background-color: rgba(245, 108, 108, 0.12);
  1400. color: #F56C6C;
  1401. font-size: 22rpx;
  1402. }
  1403. .task-empty {
  1404. padding: 40rpx 0 10rpx;
  1405. display: flex;
  1406. justify-content: center;
  1407. }
  1408. .task-empty-text {
  1409. font-size: 26rpx;
  1410. color: #999999;
  1411. }
  1412. .task-footer {
  1413. padding: 12rpx 30rpx 24rpx;
  1414. background: #f8fcf9;
  1415. }
  1416. .start-btn {
  1417. width: 100%;
  1418. height: 88rpx;
  1419. line-height: 88rpx;
  1420. border-radius: 44rpx;
  1421. background: linear-gradient(135deg, #3bb44a, #66cc6a);
  1422. color: #ffffff;
  1423. font-size: 30rpx;
  1424. font-weight: 600;
  1425. }
  1426. .start-btn.disabled {
  1427. background: #dcdfe6;
  1428. color: #ffffff;
  1429. }
  1430. /* 作业标题行加号按钮(与新增作业页保持一致) */
  1431. .task-title-row {
  1432. display: flex;
  1433. justify-content: space-between;
  1434. align-items: center;
  1435. }
  1436. .task-title-left {
  1437. display: flex;
  1438. flex-direction: column;
  1439. }
  1440. .task-title-text {
  1441. font-size: 32rpx;
  1442. font-weight: 600;
  1443. color: #2c3e50;
  1444. }
  1445. .task-title-sub {
  1446. margin-top: 4rpx;
  1447. font-size: 22rpx;
  1448. color: #8c9396;
  1449. }
  1450. .task-add-btn {
  1451. width: 60rpx;
  1452. height: 60rpx;
  1453. border-radius: 30rpx;
  1454. background: linear-gradient(135deg, #3bb44a, #66cc6a);
  1455. display: flex;
  1456. align-items: center;
  1457. justify-content: center;
  1458. box-shadow: 0 4rpx 12rpx rgba(59, 180, 74, 0.3);
  1459. }
  1460. .task-add-plus {
  1461. font-size: 40rpx;
  1462. color: #ffffff;
  1463. line-height: 1;
  1464. }
  1465. </style>