HomePage.qml 65 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571
  1. import QtQuick
  2. import QtQuick.Controls
  3. import Felgo 4.0
  4. import "../controls"
  5. import "../common"
  6. import "../model"
  7. AppPage {
  8. id: home_Page
  9. signal updatebv(string bv)
  10. property string originalString: ""
  11. property string iccidString: ""
  12. property string boxtemptureString: ""
  13. property string collectString: ""
  14. property string gps_state: "定位中..."
  15. property string jsonenable_String: "关闭"
  16. property string imagenable_String: "关闭"
  17. property bool connect_board: false
  18. property var tt
  19. property bool isonline: false
  20. property var net_list:[]
  21. property real tapeUsage: 0
  22. property real filterUsage: 0
  23. property bool tapeAlertShown: false
  24. property bool filterAlertShown: false
  25. property bool lowVoltageAlertShown: false
  26. property real freq_filter: 0
  27. property real worked_day: 0
  28. navigationBarHidden: true
  29. backgroundColor: app.theme_backgroundColor
  30. Component.onCompleted: {
  31. // 主题初始化已由Main.qml的onInitTheme统一处理
  32. // 此处不再重复读取主题配置,避免颜色闪烁
  33. console.log("HomePage loaded, current theme:", app.theme_select)
  34. }
  35. Connections {
  36. target: networkMonitor
  37. // 监听可达性变化(如从断开到连接)
  38. function onReachabilityChanged() {
  39. let status = ""
  40. if(networkMonitor.reachability===0)
  41. {
  42. status = "未知"
  43. net_sta.color = "red"
  44. }else if(networkMonitor.reachability===1){
  45. status = "离线"
  46. net_sta.color = "red"
  47. }else if(networkMonitor.reachability===2){
  48. status = "本地"
  49. }else if(networkMonitor.reachability===3){
  50. status = "局域网"
  51. }else if(networkMonitor.reachability===4){
  52. status = "在线"
  53. net_sta.color = "green"
  54. }
  55. console.log("onReachabilityChanged:",networkMonitor.reachability)
  56. net_sta.text = "网络状态:" + status
  57. }
  58. // 监听传输介质变化(如从 Wi-Fi 切换到 4G)
  59. function onTransportMediumChanged() {
  60. let nettype = "未知"
  61. console.log("onTransportMediumChanged:",networkMonitor.transportMedium)
  62. if(networkMonitor.transportMedium===0)
  63. {
  64. nettype = "未知"
  65. }else if(networkMonitor.transportMedium===1){
  66. nettype = "有线"
  67. }else if(networkMonitor.transportMedium===2){
  68. nettype = "移动网络"
  69. }else if(networkMonitor.transportMedium===3){
  70. nettype = "WIFI"
  71. }else if(networkMonitor.transportMedium===4){
  72. nettype = "蓝牙"
  73. }
  74. net_type.text = "网络类型:" + nettype
  75. }
  76. // 监听受限网络状态(如公共 Wi-Fi 登录页)
  77. function onIsBehindCaptivePortalChanged() {
  78. }
  79. // 监听计量网络状态(如移动数据流量限制)
  80. function onIsMeteredChanged() {
  81. }
  82. }
  83. // 接收并显示日志消息
  84. Connections {
  85. target: mqtt
  86. function onConnected() {
  87. console.log("mqtt connect")
  88. }
  89. function onDisconnected() {
  90. console.log("mqtt disconnect")
  91. //mqtt_text.detailText="MQTT已断开"
  92. }
  93. }
  94. // Connections{
  95. // target: myClass
  96. // }
  97. //串口
  98. Connections{
  99. target: serial
  100. function onDataReceived(data){
  101. var jsonData = JSON.parse(data)
  102. console.log("接收到主板数据:",data.toString())
  103. if(jsonData.ext.work_sta==="0"){
  104. text_devicesta.text = qsTr("<b>工作状态:</b> 待机")
  105. if(jsonData.ext.ds==="0"){
  106. }else{
  107. }
  108. }else if(jsonData.ext.work_sta==="1"){
  109. text_devicesta.text = qsTr("<b>工作状态:</b> 采集")
  110. }else if(jsonData.ext.work_sta==="2"){
  111. text_devicesta.text = qsTr("<b>工作状态:</b> 拍照")
  112. }else{
  113. text_devicesta.text = qsTr("<b>工作状态:</b>",jsonData.ext.work_sta)
  114. }
  115. if(jsonData.ext.gps==="1"){
  116. gps_state = "成功"
  117. }
  118. if(jsonData.ext.imei){
  119. originalString = jsonData.ext.imei
  120. }
  121. if(jsonData.ext.iccid){
  122. iccidString= jsonData.ext.iccid
  123. }
  124. if(jsonData.ext.coll_time&&jsonData.ext.coll_min){
  125. var sh1Arry = jsonData.ext.coll_time[0].split('-')
  126. var sh2Arry = jsonData.ext.coll_time[1].split('-')
  127. var sh3Arry = jsonData.ext.coll_time[2].split('-')
  128. var min_arry0 = jsonData.ext.coll_min[0].split('-')
  129. var min_arry1 = jsonData.ext.coll_min[1].split('-')
  130. var min_arry2 = jsonData.ext.coll_min[2].split('-')
  131. sh1.text = parseInt(sh1Arry[0])+ ":" + parseInt(min_arry0[0]) + " - " + parseInt(sh1Arry[1]) + ":" + parseInt(min_arry0[1])
  132. sh2.text = parseInt(sh2Arry[0])+ ":" + parseInt(min_arry1[0]) + " - " + parseInt(sh2Arry[1]) + ":" + parseInt(min_arry1[1])
  133. sh3.text = parseInt(sh3Arry[0])+ ":" + parseInt(min_arry2[0]) + " - " + parseInt(sh3Arry[1]) + ":" + parseInt(min_arry2[1])
  134. }
  135. if(jsonData.ext.dat_f){
  136. serial.update_dat_f_main(jsonData.ext.dat_f);
  137. }
  138. if(jsonData.ext.boxtem){
  139. text_tempture0.text = "箱内温度:" + jsonData.ext.boxtem + "℃"
  140. }
  141. text_tempture.text = "环境温度:" + jsonData.ext.at + "℃"
  142. text_humidity.text = "湿度:" + jsonData.ext.ah + "%RH"
  143. text_vbat.text = "电压:" + jsonData.ext.vbat + "V"
  144. // 电压低于10V时弹框提示电源断电
  145. if(Number(jsonData.ext.vbat) < 10 && !lowVoltageAlertShown){
  146. lowVoltageAlertShown = true
  147. nativeUtils.displayMessageBox("电源断电提醒", "检测到电压低于10V,电源可能断电,请检查供电!", 1)
  148. }
  149. if(Number(jsonData.ext.vbat) >= 10) lowVoltageAlertShown = false
  150. text_current.text = "负载电流:" + jsonData.ext.current + "mA"
  151. if(jsonData.ext.fan_current){
  152. text_fan_current.text = "风机电流:" + jsonData.ext.fan_current + "mA"
  153. }
  154. text_lat.text = "lat:" + jsonData.ext.lat
  155. text_lng.text = "lng:" + jsonData.ext.lng
  156. const x_init_dis = jsonData?.ext?.x_init_dis;
  157. const y_init_dis = jsonData?.ext?.y_init_dis;
  158. if(x_init_dis ===0 || y_init_dis ===0)
  159. {
  160. serial.recoverMcuParam();
  161. }
  162. if(!textInput_x.focus){
  163. textInput_x.text = x_init_dis.toString();
  164. }
  165. if(!textInput_y.focus){
  166. textInput_y.text = y_init_dis.toString();
  167. }
  168. if(jsonData.ext.tps){
  169. if("1"===jsonData.ext.tps){
  170. text_tempture_sta.text = "保护:" + "["+ jsonData.ext.tpl +"]"
  171. app.tempProtectionState = true
  172. }else{
  173. text_tempture_sta.text = "正常:" + "["+ jsonData.ext.tpl +"]"
  174. app.tempProtectionState = false
  175. }
  176. }
  177. if(jsonData.ext.tph&&temp_setting.visible===false){
  178. highTempSlider.value = jsonData.ext.tph
  179. }
  180. if(jsonData.ext.tpl&&temp_setting.visible===false){
  181. lowTempSlider.value = jsonData.ext.tpl
  182. }
  183. var dvs = jsonData.ext.dver
  184. dvs = dvs.split("-")
  185. app.bvReceived(dvs[0])
  186. app.appReceived(dvs[1])
  187. if(jsonData.ext.tape_used){
  188. // tape_used为已使用量, tape_max为总长度, 使用百分比 = 已使用/总长 * 100
  189. if(Number(jsonData.ext.tape_max) > 0){
  190. tapeUsage = Number(jsonData.ext.tape_used) / Number(jsonData.ext.tape_max) * 100
  191. }else{
  192. tapeUsage = 0
  193. }
  194. if(tapeUsage >= 100 && !tapeAlertShown){
  195. tapeAlertShown = true
  196. nativeUtils.displayMessageBox("胶带更换提醒", "胶带使用量已达到100%,请及时更换胶带!", 1)
  197. }
  198. if(tapeUsage < 100) tapeAlertShown = false
  199. }
  200. if(jsonData.ext.filter_used){
  201. // filter_used为已使用量, filter_max为总长度, 使用百分比 = 已使用/总长 * 100
  202. if(Number(jsonData.ext.filter_max) > 0){
  203. filterUsage = Number(jsonData.ext.filter_used) / Number(jsonData.ext.filter_max) * 100
  204. }else{
  205. filterUsage = 0
  206. }
  207. if(filterUsage >= 100 && !filterAlertShown){
  208. filterAlertShown = true
  209. nativeUtils.displayMessageBox("滤网更换提醒", "滤网使用量已达到100%,请及时更换滤网!", 1)
  210. }
  211. if(filterUsage < 100) filterAlertShown = false
  212. }
  213. if(jsonData.ext.freq_filter){
  214. freq_filter = jsonData.ext.freq_filter
  215. }
  216. if(jsonData.ext.worked_day){
  217. worked_day = jsonData.ext.worked_day
  218. }
  219. }
  220. function onDisconnect_485(){
  221. text_devicesta.text =qsTr("485未连接,读取数据失败");
  222. originalString =serial.getId()
  223. iccidString=serial.getIccid()
  224. app.appReceived(serial.get_app_version())
  225. }
  226. function onGpsSuccess(){
  227. gps_state = "成功"
  228. text_lat.text = serial.getlat()
  229. text_lng.text = serial.getlng()
  230. }
  231. }
  232. // 胶带/滤网重置输入对话框
  233. AppModal {
  234. id: tapeResetModal
  235. fullscreen: false
  236. modalHeight: dp(200)
  237. visible: false
  238. Column {
  239. anchors.fill: parent
  240. padding: dp(20)
  241. spacing: dp(15)
  242. AppText {
  243. anchors.horizontalCenter: parent.horizontalCenter
  244. text: "请输入胶带使用量:"
  245. fontSize: 16
  246. font.bold: true
  247. }
  248. TextField {
  249. id: tapeInput
  250. anchors.horizontalCenter: parent.horizontalCenter
  251. width: dp(200)
  252. height: dp(40)
  253. text: "50000"
  254. inputMethodHints: Qt.ImhDigitsOnly
  255. }
  256. Row {
  257. anchors.horizontalCenter: parent.horizontalCenter
  258. spacing: dp(30)
  259. AppButton {
  260. text: "确定"
  261. onClicked: {
  262. tapeResetModal.close()
  263. serial.makeJsonRpc("tape_reset", tapeInput.text)
  264. }
  265. }
  266. AppButton {
  267. text: "取消"
  268. onClicked: {
  269. tapeResetModal.close()
  270. }
  271. }
  272. }
  273. }
  274. }
  275. // 滤网重置输入对话框
  276. AppModal {
  277. id: filterResetModal
  278. fullscreen: false
  279. modalHeight: dp(200)
  280. visible: false
  281. Column {
  282. anchors.fill: parent
  283. padding: dp(20)
  284. spacing: dp(15)
  285. AppText {
  286. anchors.horizontalCenter: parent.horizontalCenter
  287. text: "请输入滤网使用量:"
  288. fontSize: 16
  289. font.bold: true
  290. }
  291. TextField {
  292. id: filterInput
  293. anchors.horizontalCenter: parent.horizontalCenter
  294. width: dp(200)
  295. height: dp(40)
  296. text: "1000"
  297. inputMethodHints: Qt.ImhDigitsOnly
  298. }
  299. Row {
  300. anchors.horizontalCenter: parent.horizontalCenter
  301. spacing: dp(30)
  302. AppButton {
  303. text: "确定"
  304. onClicked: {
  305. filterResetModal.close()
  306. serial.makeJsonRpc("filter_reset", filterInput.text)
  307. }
  308. }
  309. AppButton {
  310. text: "取消"
  311. onClicked: {
  312. filterResetModal.close()
  313. }
  314. }
  315. }
  316. }
  317. }
  318. Timer {
  319. interval: 100
  320. running: true
  321. repeat: true
  322. onTriggered: {
  323. text_stamp.text = getCurrentTime()
  324. }
  325. }
  326. function handleThemeChange(mode){
  327. theme_select = mode
  328. console.log("theme_select",theme_select)
  329. }
  330. function getCurrentTime() {
  331. var currentTime = new Date();
  332. var years = currentTime.getFullYear()
  333. var mon = currentTime.getMonth() + 1
  334. var dates = currentTime.getDate()
  335. var hours = currentTime.getHours()
  336. var mins = currentTime.getMinutes()
  337. var secs = currentTime.getSeconds()
  338. if(app.theme_md==="auto"){
  339. if(hours>=6&&hours<=18){
  340. app.theme_select = "day"
  341. }else{
  342. app.theme_select = "night"
  343. }
  344. }
  345. // 关键:将月、日、时、分、秒补到两位(不足补0)
  346. var formatNum = (num) => String(num).padStart(2, '0')
  347. return `${years}-${formatNum(mon)}-${formatNum(dates)} ${formatNum(hours)}:${formatNum(mins)}:${formatNum(secs)}`
  348. }
  349. Grid {
  350. anchors.fill: parent
  351. anchors.leftMargin: 5
  352. anchors.topMargin: 5
  353. //anchors.horizontalCenter: parent.horizontalCenter
  354. columns: 1
  355. rows: 3
  356. columnSpacing: 10
  357. rowSpacing: 5
  358. horizontalItemAlignment: Grid.AlignHCenter
  359. Row {
  360. width: parent.width *0.995
  361. height: parent.height*0.1
  362. Rectangle {
  363. width: parent.width
  364. height: parent.height
  365. color: app.cardColor
  366. radius: 2
  367. // 使用Item作为容器,设置固定位置和大小
  368. Item {
  369. anchors.fill: parent
  370. Row {
  371. anchors.verticalCenter: parent.verticalCenter
  372. width: parent.width
  373. height: parent.height
  374. spacing: dp(20)
  375. AppText{
  376. id: text_stamp
  377. verticalAlignment: Text.AlignVCenter
  378. height: parent.height
  379. text: ""
  380. fontSize: 20
  381. color: app.fontColor
  382. }
  383. AppText{
  384. id: text_imei
  385. verticalAlignment: Text.AlignVCenter
  386. height: parent.height
  387. text:"设备ID:" + originalString.toLowerCase()
  388. fontSize: 20
  389. color: app.fontColor
  390. }
  391. AppText{
  392. id: net_sta
  393. verticalAlignment: Text.AlignVCenter
  394. height: parent.height
  395. color: app.fontColor
  396. text: "联网状态:"
  397. fontSize: 20
  398. //font.bold: true
  399. }
  400. AppText{
  401. id: net_type
  402. verticalAlignment: Text.AlignVCenter
  403. height: parent.height
  404. color: app.fontColor
  405. text: "联网类型:"
  406. fontSize: 20
  407. //font.bold: true
  408. }
  409. AppText{
  410. id: text_gps
  411. verticalAlignment: Text.AlignVCenter
  412. height: parent.height
  413. text: "GPS状态:" + gps_state
  414. color: app.fontColor
  415. //font.bold: true
  416. fontSize: 20
  417. }
  418. }
  419. }
  420. }
  421. }
  422. Row{
  423. //anchors.fill: parent
  424. width: parent.width
  425. height: parent.height*0.5
  426. spacing:5
  427. Rectangle {
  428. id: container
  429. width: parent.width * 0.245
  430. height: parent.height
  431. color: app.cardColor
  432. radius: 5
  433. Rectangle {
  434. id: focus_setting
  435. anchors.fill: parent
  436. visible: false
  437. radius: 5
  438. color: app.cardColor
  439. // X坐标输入行(结构同优化前)
  440. Column {
  441. anchors.fill: parent
  442. spacing: 10
  443. Row {
  444. width: parent.width*0.6
  445. spacing: 5
  446. AppText {
  447. text: "X坐标:"
  448. color: app.fontColor
  449. font.pixelSize: 20
  450. }
  451. // 使用边框包裹
  452. ItemDelegate {
  453. width: parent.width
  454. height: 42
  455. padding: 0
  456. contentItem: AppTextInput {
  457. id: textInput_x
  458. width: parent.width
  459. height: parent.height
  460. placeholderText: "x_init_dis"
  461. text: "0"
  462. font.family: "Arial"
  463. font.pixelSize: 20
  464. inputMethodHints: Qt.ImhMultiLine
  465. // 使用验证器替代inputMask
  466. validator: DoubleValidator {
  467. decimals: 2
  468. }
  469. property real numericValue_x: Number(text) || 0
  470. Keys.onReturnPressed: {
  471. console.log("X坐标:", numericValue_x)
  472. serial.setHt_xy_dis(numericValue_x, textInput_y.numericValue_y)
  473. coordinateInputs.visible = false
  474. }
  475. }
  476. // 边框样式
  477. Rectangle {
  478. anchors.fill: parent
  479. color: "transparent"
  480. border.color: textInput_x.activeFocus ? "blue" : "gray"
  481. border.width: 1
  482. radius: 4
  483. }
  484. }
  485. }
  486. // Y坐标输入行(结构同优化前)
  487. Row {
  488. width: parent.width*0.6
  489. spacing: 5
  490. AppText {
  491. text: "Y坐标:"
  492. color: app.fontColor
  493. font.pixelSize: 20
  494. }
  495. // 使用边框包裹
  496. ItemDelegate {
  497. width: parent.width
  498. height: 42
  499. padding: 0
  500. contentItem: AppTextInput {
  501. id: textInput_y
  502. width: parent.width
  503. height: parent.height
  504. placeholderText: "y_init_dis"
  505. text: "0"
  506. font.family: "Arial"
  507. font.pixelSize: 20
  508. wrapMode: Text.NoWrap
  509. inputMethodHints: Qt.ImhMultiLine
  510. // 使用验证器替代inputMask
  511. validator: DoubleValidator {
  512. decimals: 0
  513. }
  514. property real numericValue_y: Number(text) || 0
  515. Keys.onReturnPressed: {
  516. console.log("Y坐标:", numericValue_y)
  517. serial.setHt_xy_dis(textInput_x.numericValue_x, numericValue_y)
  518. coordinateInputs.visible = false
  519. }
  520. }
  521. // 边框样式
  522. Rectangle {
  523. anchors.fill: parent
  524. color: "transparent"
  525. border.color: textInput_x.activeFocus ? "blue" : "gray"
  526. border.width: 1
  527. radius: 4
  528. }
  529. }
  530. }
  531. }
  532. }
  533. Column {
  534. anchors.centerIn: parent
  535. spacing: 8
  536. visible: true
  537. AppImage {
  538. id: image_01
  539. anchors.horizontalCenter: parent.horizontalCenter
  540. anchors.topMargin: 15
  541. source: "../../assets/a.svg"
  542. fillMode: Image.PreserveAspectFit
  543. }
  544. AppText {
  545. id: text_devicesta
  546. anchors.horizontalCenter: parent.horizontalCenter
  547. text: "工作状态:"
  548. color: app.fontColor
  549. font.bold: true
  550. font.pixelSize: 16
  551. }
  552. // 胶带使用量
  553. Column {
  554. anchors.horizontalCenter: parent.horizontalCenter
  555. spacing: 3
  556. width: dp(120)
  557. AppText {
  558. anchors.horizontalCenter: parent.horizontalCenter
  559. text: "胶带: " + tapeUsage.toFixed(2) + "%"
  560. color: tapeUsage >= 100 ? "#ff4444" : "#666666"
  561. fontSize: 12
  562. // 长按弹出重置确认对话框
  563. Timer {
  564. id: tapeLongPressTimer
  565. interval: 1000
  566. onTriggered: {
  567. tapeInput.text = "0"
  568. tapeResetModal.open()
  569. }
  570. }
  571. MouseArea {
  572. anchors.fill: parent
  573. onPressed: tapeLongPressTimer.start()
  574. onReleased: tapeLongPressTimer.stop()
  575. onCanceled: tapeLongPressTimer.stop()
  576. }
  577. }
  578. Rectangle {
  579. anchors.horizontalCenter: parent.horizontalCenter
  580. width: dp(100)
  581. height: dp(6)
  582. color: "#e8e8e8"
  583. radius: dp(3)
  584. Rectangle {
  585. width: parent.width * Math.min(tapeUsage, 100) / 100
  586. height: parent.height
  587. color: tapeUsage >= 100 ? "#ff4444" : "#28a779"
  588. radius: dp(3)
  589. }
  590. }
  591. }
  592. // 滤网使用量
  593. Column {
  594. anchors.horizontalCenter: parent.horizontalCenter
  595. spacing: 3
  596. width: dp(120)
  597. AppText {
  598. anchors.horizontalCenter: parent.horizontalCenter
  599. text: "滤网: " + filterUsage.toFixed(2) + "%"
  600. color: filterUsage >= 100 ? "#ff4444" : "#666666"
  601. fontSize: 12
  602. // 长按弹出重置确认对话框
  603. Timer {
  604. id: filterLongPressTimer
  605. interval: 1000
  606. onTriggered: {
  607. filterInput.text = "0"
  608. filterResetModal.open()
  609. }
  610. }
  611. MouseArea {
  612. anchors.fill: parent
  613. onPressed: filterLongPressTimer.start()
  614. onReleased: filterLongPressTimer.stop()
  615. onCanceled: filterLongPressTimer.stop()
  616. }
  617. }
  618. Rectangle {
  619. anchors.horizontalCenter: parent.horizontalCenter
  620. width: dp(100)
  621. height: dp(6)
  622. color: "#e8e8e8"
  623. radius: dp(3)
  624. Rectangle {
  625. width: parent.width * Math.min(filterUsage, 100) / 100
  626. height: parent.height
  627. color: filterUsage >= 100 ? "#ff4444" : "#28a779"
  628. radius: dp(3)
  629. }
  630. }
  631. }
  632. // 自清洁周期
  633. AppText {
  634. anchors.horizontalCenter: parent.horizontalCenter
  635. text: "自清洁周期: " + Number(worked_day).toString() + "/" + Number(freq_filter).toString()
  636. color: app.fontColor
  637. fontSize: 11
  638. }
  639. }
  640. }
  641. Rectangle {
  642. radius: 5
  643. width: parent.width*0.245
  644. height: parent.height
  645. color: app.cardColor
  646. Timer {
  647. interval: 500
  648. running: true
  649. repeat: true
  650. onTriggered: {
  651. if(mqtt.checkLink()){
  652. mqtt_text.text="MQTT已连接:" + net_list[5]
  653. }else{
  654. mqtt_text.text="MQTT已断开:" + net_list[5]
  655. }
  656. net_list = mqtt.netMessage()
  657. if(mqtt.cache_Json_enable()===1){
  658. jsonenable_String = "开启"
  659. }else{
  660. jsonenable_String = "关闭"
  661. }
  662. if(mqtt.cache_image_enable()===1){
  663. imagenable_String = "开启"
  664. }else{
  665. imagenable_String = "关闭"
  666. }
  667. cache_json_text.text= "数据缓存:" + mqtt.cache_json_num() +
  668. "("+ mqtt.cache_Json_Maxnum()+")" + jsonenable_String
  669. cache_image_text.text = "图片缓存:" + mqtt.cache_image_num()+
  670. "("+mqtt.cache_image_Maxnum()+")" + imagenable_String
  671. if(net_list){
  672. if(net_list[0]==="1"){isonline = true}else{isonline = false}
  673. net_sta.text = qsTr("<b>联网状态:</b> %1").arg(isonline? "已联网" : "未联网")
  674. net_sta.color = qsTr("%1").arg(isonline? "green" : "red")
  675. ipv4.text = qsTr("<b>[IPV4] </b> %1").arg(net_list[4])
  676. //mac.text = qsTr("<b>[MAC] </b> %1").arg(net_list[3])
  677. datt_text.text = "数据上传间隔:" + net_list[6] + "分钟"
  678. netxd_text.text = "下一次数据上传:" + net_list[7] + "秒"
  679. iccid_text.text = "SIM卡号:" + iccidString
  680. }
  681. }
  682. }
  683. Timer {
  684. id: longPressTimer
  685. interval: 1000 // 1秒
  686. onTriggered: {
  687. console.log("长按触发")
  688. serial.uploadData_Mqtt()
  689. }
  690. }
  691. MouseArea {
  692. anchors.fill: parent
  693. onPressed:{
  694. longPressTimer.start()
  695. }
  696. onReleased:{
  697. longPressTimer.stop()
  698. }
  699. }
  700. Column{
  701. anchors.centerIn: parent
  702. spacing: 5
  703. AppImage {
  704. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  705. anchors.topMargin: 30
  706. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  707. source: "../../assets/net.svg"
  708. }
  709. AppText{
  710. id: text_net_title
  711. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  712. text: "网络信息"
  713. color: app.fontColor
  714. font.bold: true
  715. }
  716. AppText{
  717. id: ipv4
  718. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  719. text:"IPv4:"
  720. fontSize: 10
  721. color: "gray"
  722. }
  723. AppText{
  724. id: mqtt_text
  725. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  726. text:"MQTT断开连接:"
  727. fontSize: 10
  728. color: "gray"
  729. }
  730. AppText{
  731. id: datt_text
  732. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  733. text:"数据上传间隔:"
  734. fontSize: 10
  735. color: "gray"
  736. }
  737. AppText{
  738. id: netxd_text
  739. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  740. text:"下一次数据传:"
  741. fontSize: 10
  742. color: "gray"
  743. }
  744. AppText{
  745. id: iccid_text
  746. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  747. text:"SIM卡号:"
  748. fontSize: 10
  749. color: "gray"
  750. }
  751. AppText{
  752. id: cache_json_text
  753. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  754. text:"数据缓存:"
  755. fontSize: 10
  756. color: "gray"
  757. }
  758. AppText{
  759. id: cache_image_text
  760. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  761. text:"图片缓存:"
  762. fontSize: 10
  763. color: "gray"
  764. }
  765. }
  766. }
  767. Rectangle {
  768. radius: 5
  769. width: parent.width*0.245
  770. height: parent.height
  771. color: app.cardColor
  772. Column{
  773. anchors.centerIn: parent
  774. spacing: 5
  775. AppImage {
  776. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  777. anchors.topMargin: 30
  778. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  779. source: "../../assets/gps.svg"
  780. }
  781. AppText{
  782. id: text_gps_title
  783. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  784. text: "定位信息"
  785. color: app.fontColor
  786. font.bold: true
  787. }
  788. AppText{
  789. id: text_lat
  790. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  791. text:"lat:"
  792. fontSize: 10
  793. color: "gray"
  794. }
  795. AppText{
  796. id: text_lng
  797. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  798. text:"lng:"
  799. fontSize: 10
  800. color: "gray"
  801. }
  802. }
  803. }
  804. Rectangle {
  805. radius: 5
  806. width: parent.width*0.245
  807. height: parent.height
  808. color: app.cardColor
  809. Rectangle{
  810. id: rec_seting
  811. anchors.fill: parent
  812. visible: false
  813. Column {
  814. anchors.fill: parent
  815. anchors.margins: 5
  816. spacing: 8
  817. AppText {
  818. anchors.horizontalCenter: parent.horizontalCenter
  819. text:"采集时间设置"
  820. color: app.fontColor
  821. font.bold: true
  822. }
  823. // 第一时间段
  824. Row {
  825. anchors.horizontalCenter: parent.horizontalCenter
  826. spacing: 2
  827. AppTextField {
  828. id: sh1_hour
  829. width: 35
  830. height: 28
  831. borderWidth: dp(1)
  832. radius: 3
  833. placeholderText: "时"
  834. inputMethodHints: Qt.ImhDigitsOnly
  835. validator: IntValidator {
  836. bottom: 0
  837. top: 23
  838. }
  839. }
  840. AppText {
  841. anchors.verticalCenter: parent.verticalCenter
  842. text: ":"
  843. color: app.fontColor
  844. fontSize: 14
  845. font.bold: true
  846. }
  847. AppTextField {
  848. id: sh1_min
  849. width: 35
  850. height: 28
  851. borderWidth: dp(1)
  852. radius: 3
  853. placeholderText: "分"
  854. inputMethodHints: Qt.ImhDigitsOnly
  855. validator: IntValidator {
  856. bottom: 0
  857. top: 59
  858. }
  859. }
  860. AppText {
  861. anchors.verticalCenter: parent.verticalCenter
  862. text: "-"
  863. color: app.fontColor
  864. fontSize: 14
  865. font.bold: true
  866. }
  867. AppTextField {
  868. id: sh2_hour
  869. width: 35
  870. height: 28
  871. borderWidth: dp(1)
  872. radius: 3
  873. placeholderText: "时"
  874. inputMethodHints: Qt.ImhDigitsOnly
  875. validator: IntValidator {
  876. bottom: 0
  877. top: 23
  878. }
  879. }
  880. AppText {
  881. anchors.verticalCenter: parent.verticalCenter
  882. text: ":"
  883. color: app.fontColor
  884. fontSize: 14
  885. font.bold: true
  886. }
  887. AppTextField {
  888. id: sh2_min
  889. width: 35
  890. height: 28
  891. borderWidth: dp(1)
  892. radius: 3
  893. placeholderText: "分"
  894. inputMethodHints: Qt.ImhDigitsOnly
  895. validator: IntValidator {
  896. bottom: 0
  897. top: 59
  898. }
  899. }
  900. }
  901. // 第二时间段
  902. Row {
  903. anchors.horizontalCenter: parent.horizontalCenter
  904. spacing: 2
  905. AppTextField {
  906. id: sh3_hour
  907. width: 35
  908. height: 28
  909. borderWidth: dp(1)
  910. radius: 3
  911. placeholderText: "时"
  912. inputMethodHints: Qt.ImhDigitsOnly
  913. validator: IntValidator {
  914. bottom: 0
  915. top: 23
  916. }
  917. }
  918. AppText {
  919. anchors.verticalCenter: parent.verticalCenter
  920. text: ":"
  921. color: app.fontColor
  922. fontSize: 14
  923. font.bold: true
  924. }
  925. AppTextField {
  926. id: sh3_min
  927. width: 35
  928. height: 28
  929. borderWidth: dp(1)
  930. radius: 3
  931. placeholderText: "分"
  932. inputMethodHints: Qt.ImhDigitsOnly
  933. validator: IntValidator {
  934. bottom: 0
  935. top: 59
  936. }
  937. }
  938. AppText {
  939. anchors.verticalCenter: parent.verticalCenter
  940. text: "-"
  941. color: app.fontColor
  942. fontSize: 14
  943. font.bold: true
  944. }
  945. AppTextField {
  946. id: sh4_hour
  947. width: 35
  948. height: 28
  949. borderWidth: dp(1)
  950. radius: 3
  951. placeholderText: "时"
  952. inputMethodHints: Qt.ImhDigitsOnly
  953. validator: IntValidator {
  954. bottom: 0
  955. top: 23
  956. }
  957. }
  958. AppText {
  959. anchors.verticalCenter: parent.verticalCenter
  960. text: ":"
  961. color: app.fontColor
  962. fontSize: 14
  963. font.bold: true
  964. }
  965. AppTextField {
  966. id: sh4_min
  967. width: 35
  968. height: 28
  969. borderWidth: dp(1)
  970. radius: 3
  971. placeholderText: "分"
  972. inputMethodHints: Qt.ImhDigitsOnly
  973. validator: IntValidator {
  974. bottom: 0
  975. top: 59
  976. }
  977. }
  978. }
  979. // 第三时间段
  980. Row {
  981. anchors.horizontalCenter: parent.horizontalCenter
  982. spacing: 2
  983. AppTextField {
  984. id: sh5_hour
  985. width: 35
  986. height: 28
  987. borderWidth: dp(1)
  988. radius: 3
  989. placeholderText: "时"
  990. inputMethodHints: Qt.ImhDigitsOnly
  991. validator: IntValidator {
  992. bottom: 0
  993. top: 23
  994. }
  995. }
  996. AppText {
  997. anchors.verticalCenter: parent.verticalCenter
  998. text: ":"
  999. color: app.fontColor
  1000. fontSize: 14
  1001. font.bold: true
  1002. }
  1003. AppTextField {
  1004. id: sh5_min
  1005. width: 35
  1006. height: 28
  1007. borderWidth: dp(1)
  1008. radius: 3
  1009. placeholderText: "分"
  1010. inputMethodHints: Qt.ImhDigitsOnly
  1011. validator: IntValidator {
  1012. bottom: 0
  1013. top: 59
  1014. }
  1015. }
  1016. AppText {
  1017. anchors.verticalCenter: parent.verticalCenter
  1018. text: "-"
  1019. color: app.fontColor
  1020. fontSize: 14
  1021. font.bold: true
  1022. }
  1023. AppTextField {
  1024. id: sh6_hour
  1025. width: 35
  1026. height: 28
  1027. borderWidth: dp(1)
  1028. radius: 3
  1029. placeholderText: "时"
  1030. inputMethodHints: Qt.ImhDigitsOnly
  1031. validator: IntValidator {
  1032. bottom: 0
  1033. top: 23
  1034. }
  1035. }
  1036. AppText {
  1037. anchors.verticalCenter: parent.verticalCenter
  1038. text: ":"
  1039. color: app.fontColor
  1040. fontSize: 14
  1041. font.bold: true
  1042. }
  1043. AppTextField {
  1044. id: sh6_min
  1045. width: 35
  1046. height: 28
  1047. borderWidth: dp(1)
  1048. radius: 3
  1049. placeholderText: "分"
  1050. inputMethodHints: Qt.ImhDigitsOnly
  1051. validator: IntValidator {
  1052. bottom: 0
  1053. top: 59
  1054. }
  1055. }
  1056. }
  1057. }
  1058. Row {
  1059. anchors.horizontalCenter: parent.horizontalCenter
  1060. anchors.bottom: parent.bottom
  1061. anchors.bottomMargin: 5
  1062. spacing: 10
  1063. AppButton {
  1064. minimumWidth: 45
  1065. minimumHeight: 20
  1066. textSize: 12
  1067. fontBold: false
  1068. text: "取消"
  1069. textColor: "black"
  1070. flat: false
  1071. backgroundColor: "#e9e9e9"
  1072. borderColor: "white"
  1073. onClicked: {
  1074. rec_seting.visible = false
  1075. column_colt.visible = true
  1076. appimage_set.visible = true
  1077. image_timesvg.visible = true
  1078. }
  1079. }
  1080. AppButton {
  1081. minimumWidth: 45
  1082. minimumHeight: 20
  1083. textSize: 12
  1084. text: "保存"
  1085. textColor: "white"
  1086. flat: false
  1087. backgroundColor: "#0aa26b"
  1088. borderColor: "white"
  1089. onClicked: {
  1090. var int_sh1 = parseInt(sh1_hour.text) || 0
  1091. var int_sh1_min = parseInt(sh1_min.text) || 0
  1092. var int_eh1 = parseInt(sh2_hour.text) || 0
  1093. var int_eh1_min = parseInt(sh2_min.text) || 0
  1094. var int_sh2 = parseInt(sh3_hour.text) || 0
  1095. var int_sh2_min = parseInt(sh3_min.text) || 0
  1096. var int_eh2 = parseInt(sh4_hour.text) || 0
  1097. var int_eh2_min = parseInt(sh4_min.text) || 0
  1098. var int_sh3 = parseInt(sh5_hour.text) || 0
  1099. var int_sh3_min = parseInt(sh5_min.text) || 0
  1100. var int_eh3 = parseInt(sh6_hour.text) || 0
  1101. var int_eh3_min = parseInt(sh6_min.text) || 0
  1102. // 格式化时间字符串
  1103. var time1 = (int_sh1 < 10 ? "0" + int_sh1 : int_sh1) + ":" + (int_sh1_min < 10 ? "0" + int_sh1_min : int_sh1_min) + "-" +
  1104. (int_eh1 < 10 ? "0" + int_eh1 : int_eh1) + ":" + (int_eh1_min < 10 ? "0" + int_eh1_min : int_eh1_min)
  1105. var time2 = (int_sh2 < 10 ? "0" + int_sh2 : int_sh2) + ":" + (int_sh2_min < 10 ? "0" + int_sh2_min : int_sh2_min) + "-" +
  1106. (int_eh2 < 10 ? "0" + int_eh2 : int_eh2) + ":" + (int_eh2_min < 10 ? "0" + int_eh2_min : int_eh2_min)
  1107. var time3 = (int_sh3 < 10 ? "0" + int_sh3 : int_sh3) + ":" + (int_sh3_min < 10 ? "0" + int_sh3_min : int_sh3_min) + "-" +
  1108. (int_eh3 < 10 ? "0" + int_eh3 : int_eh3) + ":" + (int_eh3_min < 10 ? "0" + int_eh3_min : int_eh3_min)
  1109. // 更新显示
  1110. sh1.text = time1
  1111. sh2.text = time2
  1112. sh3.text = time3
  1113. // 调用serial接口(注意:这里可能需要根据实际接口调整参数)
  1114. serial.setCollt(int_sh1, int_eh1, int_sh2, int_eh2, int_sh3, int_eh3)
  1115. serial.setCollt_min(int_sh1_min, int_eh1_min, int_sh2_min, int_eh2_min, int_sh3_min, int_eh3_min)
  1116. rec_seting.visible = false
  1117. column_colt.visible = true
  1118. appimage_set.visible = true
  1119. image_timesvg.visible = true
  1120. }
  1121. }
  1122. }
  1123. }
  1124. Column{
  1125. id: column_colt
  1126. anchors.centerIn: parent
  1127. spacing: 5
  1128. visible: true
  1129. AppImage {
  1130. id: image_timesvg
  1131. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1132. anchors.topMargin: 30
  1133. visible: true
  1134. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  1135. source: "../../assets/time.svg"
  1136. }
  1137. AppText{
  1138. id: text_coll
  1139. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1140. text: "采集时间"
  1141. color: app.fontColor
  1142. font.bold: true
  1143. }
  1144. AppText{
  1145. id: sh1
  1146. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1147. text:"09:00-10:00"
  1148. fontSize: 10
  1149. color: "gray"
  1150. }
  1151. AppText{
  1152. id: sh2
  1153. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1154. text:"14:00-16:00"
  1155. fontSize: 10
  1156. color: "gray"
  1157. }
  1158. AppText{
  1159. id: sh3
  1160. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1161. text:"17:00-19:00"
  1162. fontSize: 10
  1163. color: "gray"
  1164. }
  1165. AppImage {
  1166. id: appimage_set
  1167. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1168. visible: true
  1169. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  1170. source: "../../assets/set.svg"
  1171. AppButton{
  1172. id: settime
  1173. anchors.fill: parent
  1174. //text:" 修改"
  1175. textColor: "GRAY"
  1176. textSize: 10
  1177. flat: true
  1178. onClicked: {
  1179. var sh1Arry = sh1.text.split('-')
  1180. var sh2Arry = sh2.text.split('-')
  1181. var sh3Arry = sh3.text.split('-')
  1182. // 解析第一时间段
  1183. var time1_start = sh1Arry[0].split(':')
  1184. var time1_end = sh1Arry[1].split(':')
  1185. sh1_hour.text = parseInt(time1_start[0]) || 0
  1186. sh1_min.text = parseInt(time1_start[1]) || 0
  1187. sh2_hour.text = parseInt(time1_end[0]) || 0
  1188. sh2_min.text = parseInt(time1_end[1]) || 0
  1189. // 解析第二时间段
  1190. var time2_start = sh2Arry[0].split(':')
  1191. var time2_end = sh2Arry[1].split(':')
  1192. sh3_hour.text = parseInt(time2_start[0]) || 0
  1193. sh3_min.text = parseInt(time2_start[1]) || 0
  1194. sh4_hour.text = parseInt(time2_end[0]) || 0
  1195. sh4_min.text = parseInt(time2_end[1]) || 0
  1196. // 解析第三时间段
  1197. var time3_start = sh3Arry[0].split(':')
  1198. var time3_end = sh3Arry[1].split(':')
  1199. sh5_hour.text = parseInt(time3_start[0]) || 0
  1200. sh5_min.text = parseInt(time3_start[1]) || 0
  1201. sh6_hour.text = parseInt(time3_end[0]) || 0
  1202. sh6_min.text = parseInt(time3_end[1]) || 0
  1203. column_colt.visible = false
  1204. appimage_set.visible = false
  1205. image_timesvg.visible = false
  1206. rec_seting.visible = true
  1207. }
  1208. }
  1209. }
  1210. }
  1211. }
  1212. }
  1213. Row {
  1214. width: parent.width
  1215. height: parent.height*0.38
  1216. spacing: 5
  1217. Rectangle {
  1218. id: temp_card
  1219. radius: 5
  1220. width: parent.width*0.245
  1221. height: parent.height
  1222. color: app.cardColor
  1223. Rectangle {
  1224. id: temp_setting
  1225. anchors.fill: parent
  1226. visible: false
  1227. radius: 5
  1228. color: app.cardColor
  1229. Column {
  1230. anchors.fill: parent
  1231. anchors.margins: 8
  1232. spacing: 8
  1233. AppText {
  1234. anchors.horizontalCenter: parent.horizontalCenter
  1235. text: "温度保护设置"
  1236. color: app.fontColor
  1237. font.bold: true
  1238. fontSize: 14
  1239. }
  1240. // 高温保护阈值
  1241. Item {
  1242. width: parent.width
  1243. height: 50
  1244. Column {
  1245. anchors.fill: parent
  1246. spacing: 3
  1247. AppText {
  1248. text: "高温保护: " + highTempSlider.value + "℃"
  1249. color: app.fontColor
  1250. fontSize: 11
  1251. }
  1252. Slider {
  1253. id: highTempSlider
  1254. width: parent.width - 20
  1255. anchors.horizontalCenter: parent.horizontalCenter
  1256. from: 30
  1257. to: 70
  1258. value: 50
  1259. snapMode: Slider.SnapOnRelease
  1260. stepSize: 1
  1261. }
  1262. }
  1263. }
  1264. // 低温保护阈值
  1265. Item {
  1266. width: parent.width
  1267. height: 50
  1268. Column {
  1269. anchors.fill: parent
  1270. spacing: 3
  1271. AppText {
  1272. text: "低温保护: " + lowTempSlider.value + "℃"
  1273. color: app.fontColor
  1274. fontSize: 11
  1275. }
  1276. Slider {
  1277. id: lowTempSlider
  1278. width: parent.width - 20
  1279. anchors.horizontalCenter: parent.horizontalCenter
  1280. from: -40
  1281. to: 10
  1282. value: 20
  1283. snapMode: Slider.SnapOnRelease
  1284. stepSize: 1
  1285. }
  1286. }
  1287. }
  1288. Item {
  1289. width: parent.width
  1290. height: 40
  1291. Row {
  1292. anchors.centerIn: parent
  1293. spacing: 10
  1294. AppButton {
  1295. minimumWidth: 50
  1296. minimumHeight: 25
  1297. textSize: 10
  1298. text: "取消"
  1299. textColor: "black"
  1300. flat: false
  1301. backgroundColor: "#e9e9e9"
  1302. onClicked: {
  1303. temp_setting.visible = false
  1304. temp_display.visible = true
  1305. }
  1306. }
  1307. AppButton {
  1308. minimumWidth: 50
  1309. minimumHeight: 25
  1310. textSize: 10
  1311. text: "保存"
  1312. textColor: "white"
  1313. flat: false
  1314. backgroundColor: "#0aa26b"
  1315. onClicked: {
  1316. console.log("保存温度设置 - 高温:", highTempSlider.value, "低温:", lowTempSlider.value)
  1317. serial.setTempconf(lowTempSlider.value,highTempSlider.value);
  1318. // 这里可以添加保存设置的逻辑
  1319. temp_setting.visible = false
  1320. temp_display.visible = true
  1321. }
  1322. }
  1323. }
  1324. }
  1325. }
  1326. }
  1327. Column {
  1328. id: temp_display
  1329. anchors.centerIn: parent
  1330. spacing: 5
  1331. AppImage {
  1332. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1333. anchors.topMargin: 30
  1334. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  1335. source: "../../assets/tempture.svg"
  1336. }
  1337. AppText{
  1338. id: text_tempture
  1339. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1340. text: "环境温度:"
  1341. color: app.fontColor
  1342. font.bold: true
  1343. }
  1344. AppText{
  1345. id: text_tempture0
  1346. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1347. text: "箱内温度:"
  1348. color: app.fontColor
  1349. font.bold: true
  1350. }
  1351. AppText{
  1352. id: text_tempture_sta
  1353. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1354. text:"正常"
  1355. fontSize: 10
  1356. color: "gray"
  1357. }
  1358. AppImage {
  1359. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1360. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  1361. source: "../../assets/set.svg"
  1362. AppButton{
  1363. anchors.fill: parent
  1364. textColor: "GRAY"
  1365. textSize: 10
  1366. flat: true
  1367. onClicked: {
  1368. temp_display.visible = false
  1369. temp_setting.visible = true
  1370. }
  1371. }
  1372. }
  1373. }
  1374. }
  1375. Rectangle {
  1376. radius: 5
  1377. width: parent.width*0.245
  1378. height: parent.height
  1379. color: app.cardColor
  1380. Column {
  1381. anchors.centerIn: parent
  1382. spacing: 5
  1383. AppImage {
  1384. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1385. anchors.topMargin: 30
  1386. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  1387. source: "../../assets/humidity.svg"
  1388. }
  1389. AppText{
  1390. id: text_humidity
  1391. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1392. text: "湿度:"
  1393. color: app.fontColor
  1394. font.bold: true
  1395. }
  1396. }
  1397. }
  1398. Rectangle {
  1399. radius: 5
  1400. width: parent.width*0.245
  1401. height: parent.height
  1402. color: app.cardColor
  1403. Column {
  1404. anchors.centerIn: parent
  1405. spacing: 5
  1406. AppImage {
  1407. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1408. anchors.topMargin: 30
  1409. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  1410. source: "../../assets/vbat.svg"
  1411. }
  1412. AppText{
  1413. id: text_vbat
  1414. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1415. text: "电压:"
  1416. color: app.fontColor
  1417. font.bold: true
  1418. }
  1419. }
  1420. }
  1421. Rectangle {
  1422. radius: 5
  1423. width: parent.width*0.245
  1424. height: parent.height
  1425. color: app.cardColor
  1426. Column {
  1427. anchors.centerIn: parent
  1428. spacing: 5
  1429. AppImage {
  1430. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1431. anchors.topMargin: 30
  1432. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  1433. source: "../../assets/current.svg"
  1434. }
  1435. AppText{
  1436. id: text_current
  1437. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1438. text: "电流:"
  1439. color: app.fontColor
  1440. font.bold: true
  1441. }
  1442. AppText{
  1443. id: text_fan_current
  1444. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1445. text: "风机电流:"
  1446. color: app.fontColor
  1447. font.bold: true
  1448. }
  1449. }
  1450. }
  1451. }
  1452. }
  1453. } // page