HomePage.qml 68 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629
  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. // 状态源:serial 3秒一次后台枚举海康相机,枚举数量>0=已连接,=0=未连接
  420. AppText{
  421. id: text_cam_sta
  422. verticalAlignment: Text.AlignVCenter
  423. height: parent.height
  424. text: "相机状态:" + (serial.cameraConnected ? "已连接" : "未连接")
  425. color: serial.cameraConnected ? "#28a779" : "#e74c3c"
  426. fontSize: 20
  427. }
  428. }
  429. }
  430. }
  431. }
  432. Row{
  433. //anchors.fill: parent
  434. width: parent.width
  435. height: parent.height*0.5
  436. spacing:5
  437. Rectangle {
  438. id: container
  439. width: parent.width * 0.245
  440. height: parent.height
  441. color: app.cardColor
  442. radius: 5
  443. Rectangle {
  444. id: focus_setting
  445. anchors.fill: parent
  446. visible: false
  447. radius: 5
  448. color: app.cardColor
  449. // X坐标输入行(结构同优化前)
  450. Column {
  451. anchors.fill: parent
  452. spacing: 10
  453. Row {
  454. width: parent.width*0.6
  455. spacing: 5
  456. AppText {
  457. text: "X坐标:"
  458. color: app.fontColor
  459. font.pixelSize: 20
  460. }
  461. // 使用边框包裹
  462. ItemDelegate {
  463. width: parent.width
  464. height: 42
  465. padding: 0
  466. contentItem: AppTextInput {
  467. id: textInput_x
  468. width: parent.width
  469. height: parent.height
  470. placeholderText: "x_init_dis"
  471. text: "0"
  472. font.family: "Arial"
  473. font.pixelSize: 20
  474. inputMethodHints: Qt.ImhMultiLine
  475. // 使用验证器替代inputMask
  476. validator: DoubleValidator {
  477. decimals: 2
  478. }
  479. property real numericValue_x: Number(text) || 0
  480. Keys.onReturnPressed: {
  481. console.log("X坐标:", numericValue_x)
  482. serial.setHt_xy_dis(numericValue_x, textInput_y.numericValue_y)
  483. coordinateInputs.visible = false
  484. }
  485. }
  486. // 边框样式
  487. Rectangle {
  488. anchors.fill: parent
  489. color: "transparent"
  490. border.color: textInput_x.activeFocus ? "blue" : "gray"
  491. border.width: 1
  492. radius: 4
  493. }
  494. }
  495. }
  496. // Y坐标输入行(结构同优化前)
  497. Row {
  498. width: parent.width*0.6
  499. spacing: 5
  500. AppText {
  501. text: "Y坐标:"
  502. color: app.fontColor
  503. font.pixelSize: 20
  504. }
  505. // 使用边框包裹
  506. ItemDelegate {
  507. width: parent.width
  508. height: 42
  509. padding: 0
  510. contentItem: AppTextInput {
  511. id: textInput_y
  512. width: parent.width
  513. height: parent.height
  514. placeholderText: "y_init_dis"
  515. text: "0"
  516. font.family: "Arial"
  517. font.pixelSize: 20
  518. wrapMode: Text.NoWrap
  519. inputMethodHints: Qt.ImhMultiLine
  520. // 使用验证器替代inputMask
  521. validator: DoubleValidator {
  522. decimals: 0
  523. }
  524. property real numericValue_y: Number(text) || 0
  525. Keys.onReturnPressed: {
  526. console.log("Y坐标:", numericValue_y)
  527. serial.setHt_xy_dis(textInput_x.numericValue_x, numericValue_y)
  528. coordinateInputs.visible = false
  529. }
  530. }
  531. // 边框样式
  532. Rectangle {
  533. anchors.fill: parent
  534. color: "transparent"
  535. border.color: textInput_x.activeFocus ? "blue" : "gray"
  536. border.width: 1
  537. radius: 4
  538. }
  539. }
  540. }
  541. }
  542. }
  543. Column {
  544. anchors.centerIn: parent
  545. spacing: 8
  546. visible: true
  547. AppImage {
  548. id: image_01
  549. anchors.horizontalCenter: parent.horizontalCenter
  550. anchors.topMargin: 15
  551. source: "../../assets/a.svg"
  552. fillMode: Image.PreserveAspectFit
  553. }
  554. AppText {
  555. id: text_devicesta
  556. anchors.horizontalCenter: parent.horizontalCenter
  557. text: "工作状态:"
  558. color: app.fontColor
  559. font.bold: true
  560. font.pixelSize: 16
  561. }
  562. // 胶带使用量
  563. Column {
  564. anchors.horizontalCenter: parent.horizontalCenter
  565. spacing: 3
  566. width: dp(120)
  567. AppText {
  568. anchors.horizontalCenter: parent.horizontalCenter
  569. text: "胶带: " + tapeUsage.toFixed(2) + "%"
  570. color: tapeUsage >= 100 ? "#ff4444" : "#666666"
  571. fontSize: 12
  572. // 长按弹出重置确认对话框
  573. Timer {
  574. id: tapeLongPressTimer
  575. interval: 1000
  576. onTriggered: {
  577. tapeInput.text = "0"
  578. tapeResetModal.open()
  579. }
  580. }
  581. MouseArea {
  582. anchors.fill: parent
  583. onPressed: tapeLongPressTimer.start()
  584. onReleased: tapeLongPressTimer.stop()
  585. onCanceled: tapeLongPressTimer.stop()
  586. }
  587. }
  588. Rectangle {
  589. anchors.horizontalCenter: parent.horizontalCenter
  590. width: dp(100)
  591. height: dp(6)
  592. color: "#e8e8e8"
  593. radius: dp(3)
  594. Rectangle {
  595. width: parent.width * Math.min(tapeUsage, 100) / 100
  596. height: parent.height
  597. color: tapeUsage >= 100 ? "#ff4444" : "#28a779"
  598. radius: dp(3)
  599. }
  600. }
  601. }
  602. // 滤网使用量
  603. Column {
  604. anchors.horizontalCenter: parent.horizontalCenter
  605. spacing: 3
  606. width: dp(120)
  607. AppText {
  608. anchors.horizontalCenter: parent.horizontalCenter
  609. text: "滤网: " + filterUsage.toFixed(2) + "%"
  610. color: filterUsage >= 100 ? "#ff4444" : "#666666"
  611. fontSize: 12
  612. // 长按弹出重置确认对话框
  613. Timer {
  614. id: filterLongPressTimer
  615. interval: 1000
  616. onTriggered: {
  617. filterInput.text = "0"
  618. filterResetModal.open()
  619. }
  620. }
  621. MouseArea {
  622. anchors.fill: parent
  623. onPressed: filterLongPressTimer.start()
  624. onReleased: filterLongPressTimer.stop()
  625. onCanceled: filterLongPressTimer.stop()
  626. }
  627. }
  628. Rectangle {
  629. anchors.horizontalCenter: parent.horizontalCenter
  630. width: dp(100)
  631. height: dp(6)
  632. color: "#e8e8e8"
  633. radius: dp(3)
  634. Rectangle {
  635. width: parent.width * Math.min(filterUsage, 100) / 100
  636. height: parent.height
  637. color: filterUsage >= 100 ? "#ff4444" : "#28a779"
  638. radius: dp(3)
  639. }
  640. }
  641. }
  642. // 自清洁周期
  643. AppText {
  644. anchors.horizontalCenter: parent.horizontalCenter
  645. text: "自清洁周期: " + Number(worked_day).toString() + "/" + Number(freq_filter).toString()
  646. color: app.fontColor
  647. fontSize: 11
  648. }
  649. }
  650. }
  651. Rectangle {
  652. radius: 5
  653. width: parent.width*0.245
  654. height: parent.height
  655. color: app.cardColor
  656. Timer {
  657. interval: 500
  658. running: true
  659. repeat: true
  660. onTriggered: {
  661. if(mqtt.checkLink()){
  662. mqtt_text.text="MQTT已连接:" + net_list[5]
  663. }else{
  664. mqtt_text.text="MQTT已断开:" + net_list[5]
  665. }
  666. net_list = mqtt.netMessage()
  667. if(mqtt.cache_Json_enable()===1){
  668. jsonenable_String = "开启"
  669. }else{
  670. jsonenable_String = "关闭"
  671. }
  672. if(mqtt.cache_image_enable()===1){
  673. imagenable_String = "开启"
  674. }else{
  675. imagenable_String = "关闭"
  676. }
  677. cache_json_text.text= "数据缓存:" + mqtt.cache_json_num() +
  678. "("+ mqtt.cache_Json_Maxnum()+")" + jsonenable_String
  679. cache_image_text.text = "图片缓存:" + mqtt.cache_image_num()+
  680. "("+mqtt.cache_image_Maxnum()+")" + imagenable_String
  681. if(net_list){
  682. if(net_list[0]==="1"){isonline = true}else{isonline = false}
  683. net_sta.text = qsTr("<b>联网状态:</b> %1").arg(isonline? "已联网" : "未联网")
  684. net_sta.color = qsTr("%1").arg(isonline? "green" : "red")
  685. ipv4.text = qsTr("<b>[IPV4] </b> %1").arg(net_list[4])
  686. //mac.text = qsTr("<b>[MAC] </b> %1").arg(net_list[3])
  687. datt_text.text = "数据上传间隔:" + net_list[6] + "分钟"
  688. netxd_text.text = "下一次数据上传:" + net_list[7] + "秒"
  689. iccid_text.text = "SIM卡号:" + iccidString
  690. }
  691. }
  692. }
  693. Timer {
  694. id: longPressTimer
  695. interval: 1000 // 1秒
  696. onTriggered: {
  697. console.log("长按触发")
  698. serial.uploadData_Mqtt()
  699. }
  700. }
  701. MouseArea {
  702. anchors.fill: parent
  703. onPressed:{
  704. longPressTimer.start()
  705. }
  706. onReleased:{
  707. longPressTimer.stop()
  708. }
  709. }
  710. Column{
  711. anchors.centerIn: parent
  712. spacing: 5
  713. AppImage {
  714. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  715. anchors.topMargin: 30
  716. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  717. source: "../../assets/net.svg"
  718. }
  719. AppText{
  720. id: text_net_title
  721. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  722. text: "网络信息"
  723. color: app.fontColor
  724. font.bold: true
  725. }
  726. AppText{
  727. id: ipv4
  728. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  729. text:"IPv4:"
  730. fontSize: 10
  731. color: "gray"
  732. }
  733. AppText{
  734. id: mqtt_text
  735. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  736. text:"MQTT断开连接:"
  737. fontSize: 10
  738. color: "gray"
  739. }
  740. AppText{
  741. id: datt_text
  742. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  743. text:"数据上传间隔:"
  744. fontSize: 10
  745. color: "gray"
  746. }
  747. AppText{
  748. id: netxd_text
  749. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  750. text:"下一次数据传:"
  751. fontSize: 10
  752. color: "gray"
  753. }
  754. AppText{
  755. id: iccid_text
  756. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  757. text:"SIM卡号:"
  758. fontSize: 10
  759. color: "gray"
  760. }
  761. AppText{
  762. id: cache_json_text
  763. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  764. text:"数据缓存:"
  765. fontSize: 10
  766. color: "gray"
  767. }
  768. AppText{
  769. id: cache_image_text
  770. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  771. text:"图片缓存:"
  772. fontSize: 10
  773. color: "gray"
  774. }
  775. }
  776. }
  777. Rectangle {
  778. radius: 5
  779. width: parent.width*0.245
  780. height: parent.height
  781. color: app.cardColor
  782. Column{
  783. anchors.centerIn: parent
  784. spacing: 5
  785. AppImage {
  786. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  787. anchors.topMargin: 30
  788. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  789. source: "../../assets/gps.svg"
  790. }
  791. AppText{
  792. id: text_gps_title
  793. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  794. text: "定位信息"
  795. color: app.fontColor
  796. font.bold: true
  797. }
  798. AppText{
  799. id: text_lat
  800. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  801. text:"lat:"
  802. fontSize: 10
  803. color: "gray"
  804. }
  805. AppText{
  806. id: text_lng
  807. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  808. text:"lng:"
  809. fontSize: 10
  810. color: "gray"
  811. }
  812. AppText{
  813. id: text_alt
  814. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  815. text:"海拔:--"
  816. fontSize: 10
  817. color: "gray"
  818. }
  819. AppText{
  820. id: text_sat
  821. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  822. text:"卫星:可视--/已用--"
  823. fontSize: 10
  824. color: "gray"
  825. }
  826. }
  827. // 海拔/卫星数来自面板自身GNSS(main.cpp GPSInfo写入param),定时刷新
  828. // 注:MCU的data报文目前只有lat/lng,海拔与卫星数取自面板GNSS
  829. Timer {
  830. interval: 1000
  831. running: true
  832. repeat: true
  833. onTriggered: {
  834. var alt = serial.getElevation()
  835. var view = serial.getSatView()
  836. var used = serial.getSatUsed()
  837. text_alt.text = "海拔:" + (alt !== "" ? alt + "m" : "--")
  838. text_sat.text = "卫星:可视" + (view !== "" ? view : "--") + "/已用" + (used !== "" ? used : "--")
  839. }
  840. }
  841. }
  842. Rectangle {
  843. radius: 5
  844. width: parent.width*0.245
  845. height: parent.height
  846. color: app.cardColor
  847. Rectangle{
  848. id: rec_seting
  849. anchors.fill: parent
  850. visible: false
  851. Column {
  852. anchors.fill: parent
  853. anchors.margins: dp(8)
  854. spacing: dp(6)
  855. AppText {
  856. anchors.horizontalCenter: parent.horizontalCenter
  857. text:"采集时间设置"
  858. color: app.fontColor
  859. font.bold: true
  860. }
  861. // 第一时间段
  862. Row {
  863. width: parent.width
  864. spacing: dp(2)
  865. AppTextField {
  866. id: sh1_hour
  867. width: (parent.width - dp(48)) / 4
  868. height: dp(38)
  869. borderWidth: dp(1)
  870. radius: 3
  871. placeholderText: "时"
  872. inputMethodHints: Qt.ImhDigitsOnly
  873. validator: IntValidator {
  874. bottom: 0
  875. top: 23
  876. }
  877. }
  878. AppText {
  879. anchors.verticalCenter: parent.verticalCenter
  880. width: dp(12)
  881. horizontalAlignment: Text.AlignHCenter
  882. text: ":"
  883. color: app.fontColor
  884. fontSize: 14
  885. font.bold: true
  886. }
  887. AppTextField {
  888. id: sh1_min
  889. width: (parent.width - dp(48)) / 4
  890. height: dp(38)
  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. AppText {
  901. anchors.verticalCenter: parent.verticalCenter
  902. width: dp(12)
  903. horizontalAlignment: Text.AlignHCenter
  904. text: "-"
  905. color: app.fontColor
  906. fontSize: 14
  907. font.bold: true
  908. }
  909. AppTextField {
  910. id: sh2_hour
  911. width: (parent.width - dp(48)) / 4
  912. height: dp(38)
  913. borderWidth: dp(1)
  914. radius: 3
  915. placeholderText: "时"
  916. inputMethodHints: Qt.ImhDigitsOnly
  917. validator: IntValidator {
  918. bottom: 0
  919. top: 23
  920. }
  921. }
  922. AppText {
  923. anchors.verticalCenter: parent.verticalCenter
  924. width: dp(12)
  925. horizontalAlignment: Text.AlignHCenter
  926. text: ":"
  927. color: app.fontColor
  928. fontSize: 14
  929. font.bold: true
  930. }
  931. AppTextField {
  932. id: sh2_min
  933. width: (parent.width - dp(48)) / 4
  934. height: dp(38)
  935. borderWidth: dp(1)
  936. radius: 3
  937. placeholderText: "分"
  938. inputMethodHints: Qt.ImhDigitsOnly
  939. validator: IntValidator {
  940. bottom: 0
  941. top: 59
  942. }
  943. }
  944. }
  945. // 第二时间段
  946. Row {
  947. width: parent.width
  948. spacing: dp(2)
  949. AppTextField {
  950. id: sh3_hour
  951. width: (parent.width - dp(48)) / 4
  952. height: dp(38)
  953. borderWidth: dp(1)
  954. radius: 3
  955. placeholderText: "时"
  956. inputMethodHints: Qt.ImhDigitsOnly
  957. validator: IntValidator {
  958. bottom: 0
  959. top: 23
  960. }
  961. }
  962. AppText {
  963. anchors.verticalCenter: parent.verticalCenter
  964. width: dp(12)
  965. horizontalAlignment: Text.AlignHCenter
  966. text: ":"
  967. color: app.fontColor
  968. fontSize: 14
  969. font.bold: true
  970. }
  971. AppTextField {
  972. id: sh3_min
  973. width: (parent.width - dp(48)) / 4
  974. height: dp(38)
  975. borderWidth: dp(1)
  976. radius: 3
  977. placeholderText: "分"
  978. inputMethodHints: Qt.ImhDigitsOnly
  979. validator: IntValidator {
  980. bottom: 0
  981. top: 59
  982. }
  983. }
  984. AppText {
  985. anchors.verticalCenter: parent.verticalCenter
  986. width: dp(12)
  987. horizontalAlignment: Text.AlignHCenter
  988. text: "-"
  989. color: app.fontColor
  990. fontSize: 14
  991. font.bold: true
  992. }
  993. AppTextField {
  994. id: sh4_hour
  995. width: (parent.width - dp(48)) / 4
  996. height: dp(38)
  997. borderWidth: dp(1)
  998. radius: 3
  999. placeholderText: "时"
  1000. inputMethodHints: Qt.ImhDigitsOnly
  1001. validator: IntValidator {
  1002. bottom: 0
  1003. top: 23
  1004. }
  1005. }
  1006. AppText {
  1007. anchors.verticalCenter: parent.verticalCenter
  1008. width: dp(12)
  1009. horizontalAlignment: Text.AlignHCenter
  1010. text: ":"
  1011. color: app.fontColor
  1012. fontSize: 14
  1013. font.bold: true
  1014. }
  1015. AppTextField {
  1016. id: sh4_min
  1017. width: (parent.width - dp(48)) / 4
  1018. height: dp(38)
  1019. borderWidth: dp(1)
  1020. radius: 3
  1021. placeholderText: "分"
  1022. inputMethodHints: Qt.ImhDigitsOnly
  1023. validator: IntValidator {
  1024. bottom: 0
  1025. top: 59
  1026. }
  1027. }
  1028. }
  1029. // 第三时间段
  1030. Row {
  1031. width: parent.width
  1032. spacing: dp(2)
  1033. AppTextField {
  1034. id: sh5_hour
  1035. width: (parent.width - dp(48)) / 4
  1036. height: dp(38)
  1037. borderWidth: dp(1)
  1038. radius: 3
  1039. placeholderText: "时"
  1040. inputMethodHints: Qt.ImhDigitsOnly
  1041. validator: IntValidator {
  1042. bottom: 0
  1043. top: 23
  1044. }
  1045. }
  1046. AppText {
  1047. anchors.verticalCenter: parent.verticalCenter
  1048. width: dp(12)
  1049. horizontalAlignment: Text.AlignHCenter
  1050. text: ":"
  1051. color: app.fontColor
  1052. fontSize: 14
  1053. font.bold: true
  1054. }
  1055. AppTextField {
  1056. id: sh5_min
  1057. width: (parent.width - dp(48)) / 4
  1058. height: dp(38)
  1059. borderWidth: dp(1)
  1060. radius: 3
  1061. placeholderText: "分"
  1062. inputMethodHints: Qt.ImhDigitsOnly
  1063. validator: IntValidator {
  1064. bottom: 0
  1065. top: 59
  1066. }
  1067. }
  1068. AppText {
  1069. anchors.verticalCenter: parent.verticalCenter
  1070. width: dp(12)
  1071. horizontalAlignment: Text.AlignHCenter
  1072. text: "-"
  1073. color: app.fontColor
  1074. fontSize: 14
  1075. font.bold: true
  1076. }
  1077. AppTextField {
  1078. id: sh6_hour
  1079. width: (parent.width - dp(48)) / 4
  1080. height: dp(38)
  1081. borderWidth: dp(1)
  1082. radius: 3
  1083. placeholderText: "时"
  1084. inputMethodHints: Qt.ImhDigitsOnly
  1085. validator: IntValidator {
  1086. bottom: 0
  1087. top: 23
  1088. }
  1089. }
  1090. AppText {
  1091. anchors.verticalCenter: parent.verticalCenter
  1092. width: dp(12)
  1093. horizontalAlignment: Text.AlignHCenter
  1094. text: ":"
  1095. color: app.fontColor
  1096. fontSize: 14
  1097. font.bold: true
  1098. }
  1099. AppTextField {
  1100. id: sh6_min
  1101. width: (parent.width - dp(48)) / 4
  1102. height: dp(38)
  1103. borderWidth: dp(1)
  1104. radius: 3
  1105. placeholderText: "分"
  1106. inputMethodHints: Qt.ImhDigitsOnly
  1107. validator: IntValidator {
  1108. bottom: 0
  1109. top: 59
  1110. }
  1111. }
  1112. }
  1113. }
  1114. Row {
  1115. anchors.horizontalCenter: parent.horizontalCenter
  1116. anchors.bottom: parent.bottom
  1117. anchors.bottomMargin: 5
  1118. spacing: 10
  1119. AppButton {
  1120. minimumWidth: dp(70)
  1121. minimumHeight: dp(34)
  1122. textSize: 12
  1123. fontBold: false
  1124. text: "取消"
  1125. textColor: "black"
  1126. flat: false
  1127. backgroundColor: "#e9e9e9"
  1128. borderColor: "white"
  1129. onClicked: {
  1130. rec_seting.visible = false
  1131. column_colt.visible = true
  1132. appimage_set.visible = true
  1133. image_timesvg.visible = true
  1134. }
  1135. }
  1136. AppButton {
  1137. minimumWidth: dp(70)
  1138. minimumHeight: dp(34)
  1139. textSize: 12
  1140. text: "保存"
  1141. textColor: "white"
  1142. flat: false
  1143. backgroundColor: "#0aa26b"
  1144. borderColor: "white"
  1145. onClicked: {
  1146. var int_sh1 = parseInt(sh1_hour.text) || 0
  1147. var int_sh1_min = parseInt(sh1_min.text) || 0
  1148. var int_eh1 = parseInt(sh2_hour.text) || 0
  1149. var int_eh1_min = parseInt(sh2_min.text) || 0
  1150. var int_sh2 = parseInt(sh3_hour.text) || 0
  1151. var int_sh2_min = parseInt(sh3_min.text) || 0
  1152. var int_eh2 = parseInt(sh4_hour.text) || 0
  1153. var int_eh2_min = parseInt(sh4_min.text) || 0
  1154. var int_sh3 = parseInt(sh5_hour.text) || 0
  1155. var int_sh3_min = parseInt(sh5_min.text) || 0
  1156. var int_eh3 = parseInt(sh6_hour.text) || 0
  1157. var int_eh3_min = parseInt(sh6_min.text) || 0
  1158. // 格式化时间字符串
  1159. var time1 = (int_sh1 < 10 ? "0" + int_sh1 : int_sh1) + ":" + (int_sh1_min < 10 ? "0" + int_sh1_min : int_sh1_min) + "-" +
  1160. (int_eh1 < 10 ? "0" + int_eh1 : int_eh1) + ":" + (int_eh1_min < 10 ? "0" + int_eh1_min : int_eh1_min)
  1161. var time2 = (int_sh2 < 10 ? "0" + int_sh2 : int_sh2) + ":" + (int_sh2_min < 10 ? "0" + int_sh2_min : int_sh2_min) + "-" +
  1162. (int_eh2 < 10 ? "0" + int_eh2 : int_eh2) + ":" + (int_eh2_min < 10 ? "0" + int_eh2_min : int_eh2_min)
  1163. var time3 = (int_sh3 < 10 ? "0" + int_sh3 : int_sh3) + ":" + (int_sh3_min < 10 ? "0" + int_sh3_min : int_sh3_min) + "-" +
  1164. (int_eh3 < 10 ? "0" + int_eh3 : int_eh3) + ":" + (int_eh3_min < 10 ? "0" + int_eh3_min : int_eh3_min)
  1165. // 更新显示
  1166. sh1.text = time1
  1167. sh2.text = time2
  1168. sh3.text = time3
  1169. // 调用serial接口(注意:这里可能需要根据实际接口调整参数)
  1170. serial.setCollt(int_sh1, int_eh1, int_sh2, int_eh2, int_sh3, int_eh3)
  1171. serial.setCollt_min(int_sh1_min, int_eh1_min, int_sh2_min, int_eh2_min, int_sh3_min, int_eh3_min)
  1172. rec_seting.visible = false
  1173. column_colt.visible = true
  1174. appimage_set.visible = true
  1175. image_timesvg.visible = true
  1176. }
  1177. }
  1178. }
  1179. }
  1180. Column{
  1181. id: column_colt
  1182. anchors.centerIn: parent
  1183. spacing: 5
  1184. visible: true
  1185. AppImage {
  1186. id: image_timesvg
  1187. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1188. anchors.topMargin: 30
  1189. visible: true
  1190. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  1191. source: "../../assets/time.svg"
  1192. }
  1193. AppText{
  1194. id: text_coll
  1195. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1196. text: "采集时间"
  1197. color: app.fontColor
  1198. font.bold: true
  1199. }
  1200. AppText{
  1201. id: sh1
  1202. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1203. text:"09:00-10:00"
  1204. fontSize: 10
  1205. color: "gray"
  1206. }
  1207. AppText{
  1208. id: sh2
  1209. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1210. text:"14:00-16:00"
  1211. fontSize: 10
  1212. color: "gray"
  1213. }
  1214. AppText{
  1215. id: sh3
  1216. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1217. text:"17:00-19:00"
  1218. fontSize: 10
  1219. color: "gray"
  1220. }
  1221. AppImage {
  1222. id: appimage_set
  1223. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1224. visible: true
  1225. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  1226. source: "../../assets/set.svg"
  1227. AppButton{
  1228. id: settime
  1229. anchors.fill: parent
  1230. //text:" 修改"
  1231. textColor: "GRAY"
  1232. textSize: 10
  1233. flat: true
  1234. onClicked: {
  1235. var sh1Arry = sh1.text.split('-')
  1236. var sh2Arry = sh2.text.split('-')
  1237. var sh3Arry = sh3.text.split('-')
  1238. // 解析第一时间段
  1239. var time1_start = sh1Arry[0].split(':')
  1240. var time1_end = sh1Arry[1].split(':')
  1241. sh1_hour.text = parseInt(time1_start[0]) || 0
  1242. sh1_min.text = parseInt(time1_start[1]) || 0
  1243. sh2_hour.text = parseInt(time1_end[0]) || 0
  1244. sh2_min.text = parseInt(time1_end[1]) || 0
  1245. // 解析第二时间段
  1246. var time2_start = sh2Arry[0].split(':')
  1247. var time2_end = sh2Arry[1].split(':')
  1248. sh3_hour.text = parseInt(time2_start[0]) || 0
  1249. sh3_min.text = parseInt(time2_start[1]) || 0
  1250. sh4_hour.text = parseInt(time2_end[0]) || 0
  1251. sh4_min.text = parseInt(time2_end[1]) || 0
  1252. // 解析第三时间段
  1253. var time3_start = sh3Arry[0].split(':')
  1254. var time3_end = sh3Arry[1].split(':')
  1255. sh5_hour.text = parseInt(time3_start[0]) || 0
  1256. sh5_min.text = parseInt(time3_start[1]) || 0
  1257. sh6_hour.text = parseInt(time3_end[0]) || 0
  1258. sh6_min.text = parseInt(time3_end[1]) || 0
  1259. column_colt.visible = false
  1260. appimage_set.visible = false
  1261. image_timesvg.visible = false
  1262. rec_seting.visible = true
  1263. }
  1264. }
  1265. }
  1266. }
  1267. }
  1268. }
  1269. Row {
  1270. width: parent.width
  1271. height: parent.height*0.38
  1272. spacing: 5
  1273. Rectangle {
  1274. id: temp_card
  1275. radius: 5
  1276. width: parent.width*0.245
  1277. height: parent.height
  1278. color: app.cardColor
  1279. Rectangle {
  1280. id: temp_setting
  1281. anchors.fill: parent
  1282. visible: false
  1283. radius: 5
  1284. color: app.cardColor
  1285. Column {
  1286. anchors.fill: parent
  1287. anchors.margins: 8
  1288. spacing: 8
  1289. AppText {
  1290. anchors.horizontalCenter: parent.horizontalCenter
  1291. text: "温度保护设置"
  1292. color: app.fontColor
  1293. font.bold: true
  1294. fontSize: 14
  1295. }
  1296. // 高温保护阈值
  1297. Item {
  1298. width: parent.width
  1299. height: 50
  1300. Column {
  1301. anchors.fill: parent
  1302. spacing: 3
  1303. AppText {
  1304. text: "高温保护: " + highTempSlider.value + "℃"
  1305. color: app.fontColor
  1306. fontSize: 11
  1307. }
  1308. Slider {
  1309. id: highTempSlider
  1310. width: parent.width - 20
  1311. anchors.horizontalCenter: parent.horizontalCenter
  1312. from: 30
  1313. to: 70
  1314. value: 50
  1315. snapMode: Slider.SnapOnRelease
  1316. stepSize: 1
  1317. }
  1318. }
  1319. }
  1320. // 低温保护阈值
  1321. Item {
  1322. width: parent.width
  1323. height: 50
  1324. Column {
  1325. anchors.fill: parent
  1326. spacing: 3
  1327. AppText {
  1328. text: "低温保护: " + lowTempSlider.value + "℃"
  1329. color: app.fontColor
  1330. fontSize: 11
  1331. }
  1332. Slider {
  1333. id: lowTempSlider
  1334. width: parent.width - 20
  1335. anchors.horizontalCenter: parent.horizontalCenter
  1336. from: -40
  1337. to: 10
  1338. value: 20
  1339. snapMode: Slider.SnapOnRelease
  1340. stepSize: 1
  1341. }
  1342. }
  1343. }
  1344. Item {
  1345. width: parent.width
  1346. height: 40
  1347. Row {
  1348. anchors.centerIn: parent
  1349. spacing: 10
  1350. AppButton {
  1351. minimumWidth: 50
  1352. minimumHeight: 25
  1353. textSize: 10
  1354. text: "取消"
  1355. textColor: "black"
  1356. flat: false
  1357. backgroundColor: "#e9e9e9"
  1358. onClicked: {
  1359. temp_setting.visible = false
  1360. temp_display.visible = true
  1361. }
  1362. }
  1363. AppButton {
  1364. minimumWidth: 50
  1365. minimumHeight: 25
  1366. textSize: 10
  1367. text: "保存"
  1368. textColor: "white"
  1369. flat: false
  1370. backgroundColor: "#0aa26b"
  1371. onClicked: {
  1372. console.log("保存温度设置 - 高温:", highTempSlider.value, "低温:", lowTempSlider.value)
  1373. serial.setTempconf(lowTempSlider.value,highTempSlider.value);
  1374. // 这里可以添加保存设置的逻辑
  1375. temp_setting.visible = false
  1376. temp_display.visible = true
  1377. }
  1378. }
  1379. }
  1380. }
  1381. }
  1382. }
  1383. Column {
  1384. id: temp_display
  1385. anchors.centerIn: parent
  1386. spacing: 5
  1387. AppImage {
  1388. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1389. anchors.topMargin: 30
  1390. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  1391. source: "../../assets/tempture.svg"
  1392. }
  1393. AppText{
  1394. id: text_tempture
  1395. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1396. text: "环境温度:"
  1397. color: app.fontColor
  1398. font.bold: true
  1399. }
  1400. AppText{
  1401. id: text_tempture0
  1402. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1403. text: "箱内温度:"
  1404. color: app.fontColor
  1405. font.bold: true
  1406. }
  1407. AppText{
  1408. id: text_tempture_sta
  1409. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1410. text:"正常"
  1411. fontSize: 10
  1412. color: "gray"
  1413. }
  1414. AppImage {
  1415. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1416. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  1417. source: "../../assets/set.svg"
  1418. AppButton{
  1419. anchors.fill: parent
  1420. textColor: "GRAY"
  1421. textSize: 10
  1422. flat: true
  1423. onClicked: {
  1424. temp_display.visible = false
  1425. temp_setting.visible = true
  1426. }
  1427. }
  1428. }
  1429. }
  1430. }
  1431. Rectangle {
  1432. radius: 5
  1433. width: parent.width*0.245
  1434. height: parent.height
  1435. color: app.cardColor
  1436. Column {
  1437. anchors.centerIn: parent
  1438. spacing: 5
  1439. AppImage {
  1440. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1441. anchors.topMargin: 30
  1442. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  1443. source: "../../assets/humidity.svg"
  1444. }
  1445. AppText{
  1446. id: text_humidity
  1447. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1448. text: "湿度:"
  1449. color: app.fontColor
  1450. font.bold: true
  1451. }
  1452. }
  1453. }
  1454. Rectangle {
  1455. radius: 5
  1456. width: parent.width*0.245
  1457. height: parent.height
  1458. color: app.cardColor
  1459. Column {
  1460. anchors.centerIn: parent
  1461. spacing: 5
  1462. AppImage {
  1463. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1464. anchors.topMargin: 30
  1465. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  1466. source: "../../assets/vbat.svg"
  1467. }
  1468. AppText{
  1469. id: text_vbat
  1470. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1471. text: "电压:"
  1472. color: app.fontColor
  1473. font.bold: true
  1474. }
  1475. }
  1476. }
  1477. Rectangle {
  1478. radius: 5
  1479. width: parent.width*0.245
  1480. height: parent.height
  1481. color: app.cardColor
  1482. Column {
  1483. anchors.centerIn: parent
  1484. spacing: 5
  1485. AppImage {
  1486. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1487. anchors.topMargin: 30
  1488. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  1489. source: "../../assets/current.svg"
  1490. }
  1491. AppText{
  1492. id: text_current
  1493. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1494. text: "电流:"
  1495. color: app.fontColor
  1496. font.bold: true
  1497. }
  1498. AppText{
  1499. id: text_fan_current
  1500. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  1501. text: "风机电流:"
  1502. color: app.fontColor
  1503. font.bold: true
  1504. }
  1505. }
  1506. }
  1507. }
  1508. }
  1509. } // page