HomePage.qml 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030
  1. import QtQuick 2.5
  2. import QtQuick.Controls 2.0
  3. import Qt.labs.settings 1.0 as QtLabs
  4. import QtQuick.Controls.Material 2.0
  5. import QtLocation 5.5
  6. import QtPositioning 5.5
  7. import QtMultimedia 5.5
  8. import Qt5Compat.GraphicalEffects
  9. import Felgo 4.0
  10. import "../controls"
  11. import "../common"
  12. import "../model"
  13. AppPage {
  14. id: home_Page
  15. signal updatebv(string bv)
  16. property string originalString: ""
  17. property string iccidString: ""
  18. property string boxtemptureString: ""
  19. property string collectString: ""
  20. property string gps_state: "定位中..."
  21. property string jsonenable_String: "关闭"
  22. property string imagenable_String: "关闭"
  23. property bool connect_board: false
  24. property var tt
  25. property bool isonline: false
  26. property var net_list:[]
  27. navigationBarHidden: true
  28. backgroundColor: app.theme_backgroundColor
  29. Component.onCompleted: {
  30. var theme_m = settings.getValue("theme_mode")
  31. if (theme_m === undefined) {
  32. theme_m = "day"
  33. app.theme_select = "day"
  34. settings.setValue("theme_mode","day")
  35. }else{
  36. theme_md = theme_m
  37. if(theme_m!=="auto"){
  38. app.theme_select = theme_m
  39. }
  40. console.log("读取到配置主题模式:",app.theme_select,theme_m)
  41. Theme.navigationTabBar.titlePressedColor= "green"
  42. Theme.navigationTabBar.backgroundColor= app.cardColor
  43. Theme.navigationTabBar.titleColor = app.fontColor
  44. }
  45. }
  46. Connections {
  47. target: networkMonitor
  48. // 监听可达性变化(如从断开到连接)
  49. onReachabilityChanged: {
  50. let status = ""
  51. if(networkMonitor.reachability===0)
  52. {
  53. status = "未知"
  54. net_sta.color = "red"
  55. }else if(networkMonitor.reachability===1){
  56. status = "离线"
  57. net_sta.color = "red"
  58. }else if(networkMonitor.reachability===2){
  59. status = "本地"
  60. }else if(networkMonitor.reachability===3){
  61. status = "局域网"
  62. }else if(networkMonitor.reachability===4){
  63. status = "在线"
  64. net_sta.color = "green"
  65. }
  66. console.log("onReachabilityChanged:",networkMonitor.reachability)
  67. net_sta.text = "网络状态:" + status
  68. }
  69. // 监听传输介质变化(如从 Wi-Fi 切换到 4G)
  70. onTransportMediumChanged: {
  71. let nettype = "未知"
  72. console.log("onTransportMediumChanged:",networkMonitor.transportMedium)
  73. if(networkMonitor.transportMedium===0)
  74. {
  75. nettype = "未知"
  76. }else if(networkMonitor.transportMedium===1){
  77. nettype = "有线"
  78. }else if(networkMonitor.transportMedium===2){
  79. nettype = "移动网络"
  80. }else if(networkMonitor.transportMedium===3){
  81. nettype = "WIFI"
  82. }else if(networkMonitor.transportMedium===4){
  83. nettype = "蓝牙"
  84. }
  85. net_type.text = "网络类型:" + nettype
  86. }
  87. // 监听受限网络状态(如公共 Wi-Fi 登录页)
  88. onIsBehindCaptivePortalChanged: {
  89. }
  90. // 监听计量网络状态(如移动数据流量限制)
  91. onIsMeteredChanged: {
  92. }
  93. }
  94. // 接收并显示日志消息
  95. Connections {
  96. target: mqtt
  97. onConnected: {
  98. console.log("mqtt connect")
  99. }
  100. onDisconnected: {
  101. console.log("mqtt disconnect")
  102. //mqtt_text.detailText="MQTT已断开"
  103. }
  104. }
  105. // Connections{
  106. // target: myClass
  107. // }
  108. //串口
  109. Connections{
  110. target: serial
  111. onDataReceived:{
  112. var jsonData = JSON.parse(data)
  113. console.log("接收到主板数据:",data.toString())
  114. if(jsonData.ext.work_sta==="0"){
  115. text_devicesta.text = qsTr("<b>工作状态:</b> 待机")
  116. if(jsonData.ext.ds==="0"){
  117. }else{
  118. }
  119. }else if(jsonData.ext.work_sta==="1"){
  120. text_devicesta.text = qsTr("<b>工作状态:</b> 采集")
  121. }else if(jsonData.ext.work_sta==="2"){
  122. text_devicesta.text = qsTr("<b>工作状态:</b> 拍照")
  123. }else{
  124. text_devicesta.text = qsTr("<b>工作状态:</b>",jsonData.ext.work_sta)
  125. }
  126. if(jsonData.ext.gps==="1"){
  127. gps_state = "成功"
  128. }
  129. if(jsonData.ext.imei){
  130. originalString = jsonData.ext.imei
  131. }
  132. if(jsonData.ext.iccid){
  133. iccidString= jsonData.ext.iccid
  134. }
  135. if(jsonData.ext.coll_time&&jsonData.ext.coll_min){
  136. var sh1Arry = jsonData.ext.coll_time[0].split('-')
  137. var sh2Arry = jsonData.ext.coll_time[1].split('-')
  138. var sh3Arry = jsonData.ext.coll_time[2].split('-')
  139. var min_arry0 = jsonData.ext.coll_min[0].split('-')
  140. var min_arry1 = jsonData.ext.coll_min[1].split('-')
  141. var min_arry2 = jsonData.ext.coll_min[2].split('-')
  142. sh1.text = parseInt(sh1Arry[0])+ ":" + parseInt(min_arry0[0]) + " - " + parseInt(sh1Arry[1]) + ":" + parseInt(min_arry0[1])
  143. sh2.text = parseInt(sh2Arry[0])+ ":" + parseInt(min_arry1[0]) + " - " + parseInt(sh2Arry[1]) + ":" + parseInt(min_arry1[1])
  144. sh3.text = parseInt(sh3Arry[0])+ ":" + parseInt(min_arry2[0]) + " - " + parseInt(sh3Arry[1]) + ":" + parseInt(min_arry2[1])
  145. }
  146. if(jsonData.ext.dat_f){
  147. serial.update_dat_f_main(jsonData.ext.dat_f);
  148. }
  149. if(jsonData.ext.boxtem){
  150. text_tempture0.text = "箱内温度:" + jsonData.ext.boxtem + "℃"
  151. }
  152. text_tempture.text = "温度:" + jsonData.ext.at + "℃"
  153. text_humidity.text = "湿度:" + jsonData.ext.ah + "%RH"
  154. text_vbat.text = "电压:" + jsonData.ext.vbat + "V"
  155. text_current.text = "电流:" + jsonData.ext.current + "mA"
  156. text_lat.text = "lat:" + jsonData.ext.lat
  157. text_lng.text = "lng:" + jsonData.ext.lng
  158. var x_init_dis = jsonData.ext.x_init_dis
  159. var y_init_dis = jsonData.ext.y_init_dis
  160. if(!textInput_x.focus){
  161. textInput_x.text = x_init_dis.toString();
  162. }
  163. if(!textInput_y.focus){
  164. textInput_y.text = y_init_dis.toString();
  165. }
  166. if(jsonData.ext.tps){
  167. if("1"===jsonData.ext.tps){
  168. text_tempture_sta.text = "保护:" + "["+ jsonData.ext.tpl +"]"
  169. }else{
  170. text_tempture_sta.text = "正常:" + "["+ jsonData.ext.tpl +"]"
  171. }
  172. }
  173. var dvs = jsonData.ext.dver
  174. dvs = dvs.split("-")
  175. app.bvReceived(dvs[0])
  176. app.appReceived(dvs[1])
  177. }
  178. onDisconnect_485:{
  179. text_devicesta.text =qsTr("485未连接,读取数据失败");
  180. originalString =serial.getId()
  181. iccidString=serial.getIccid()
  182. app.appReceived(serial.get_app_version())
  183. }
  184. onGpsSuccess:{
  185. gps_state = "成功"
  186. text_lat.text = serial.getlat()
  187. text_lng.text = serial.getlng()
  188. }
  189. }
  190. Timer {
  191. interval: 100
  192. running: true
  193. repeat: true
  194. onTriggered: {
  195. text_stamp.text = getCurrentTime()
  196. }
  197. }
  198. function handleThemeChange(mode){
  199. theme_select = mode
  200. console.log("theme_select",theme_select)
  201. }
  202. function getCurrentTime() {
  203. var currentTime = new Date();
  204. var years = currentTime.getFullYear()
  205. var mon = currentTime.getMonth() + 1
  206. var dates = currentTime.getDate()
  207. var hours = currentTime.getHours()
  208. var mins = currentTime.getMinutes()
  209. var secs = currentTime.getSeconds()
  210. if(app.theme_md==="auto"){
  211. if(hours>=6&&hours<=18){
  212. app.theme_select = "day"
  213. }else{
  214. app.theme_select = "night"
  215. }
  216. }
  217. // 关键:将月、日、时、分、秒补到两位(不足补0)
  218. var formatNum = (num) => String(num).padStart(2, '0')
  219. return `${years}-${formatNum(mon)}-${formatNum(dates)} ${formatNum(hours)}:${formatNum(mins)}:${formatNum(secs)}`
  220. }
  221. Grid {
  222. anchors.fill: parent
  223. anchors.leftMargin: 5
  224. anchors.topMargin: 5
  225. //anchors.horizontalCenter: parent.horizontalCenter
  226. columns: 1
  227. rows: 3
  228. columnSpacing: 10
  229. rowSpacing: 5
  230. horizontalItemAlignment: Grid.AlignHCenter
  231. Row {
  232. width: parent.width *0.995
  233. height: parent.height*0.1
  234. Rectangle {
  235. anchors.fill: parent
  236. color: app.cardColor
  237. radius: 2
  238. Row {
  239. anchors.fill: parent
  240. spacing: dp(20)
  241. AppText{
  242. id: text_stamp
  243. anchors.verticalCenter: parent.verticalCenter
  244. text: ""
  245. fontSize: 20
  246. color: app.fontColor
  247. }
  248. AppText{
  249. id: text_imei
  250. anchors.verticalCenter: parent.verticalCenter
  251. text:"设备ID:" + originalString.toLowerCase()
  252. fontSize: 20
  253. color: app.fontColor
  254. }
  255. AppText{
  256. id: net_sta
  257. anchors.verticalCenter: parent.verticalCenter
  258. color: app.fontColor
  259. text: "联网状态:"
  260. fontSize: 20
  261. //font.bold: true
  262. }
  263. AppText{
  264. id: net_type
  265. anchors.verticalCenter: parent.verticalCenter
  266. color: app.fontColor
  267. text: "联网类型:"
  268. fontSize: 20
  269. //font.bold: true
  270. }
  271. AppText{
  272. id: text_gps
  273. anchors.verticalCenter: parent.verticalCenter
  274. text: "GPS状态:" + gps_state
  275. color: app.fontColor
  276. //font.bold: true
  277. fontSize: 20
  278. }
  279. }
  280. }
  281. }
  282. Row{
  283. //anchors.fill: parent
  284. width: parent.width
  285. height: parent.height*0.5
  286. spacing:5
  287. Rectangle {
  288. id: container
  289. width: parent.width * 0.245
  290. height: parent.height
  291. color: app.cardColor
  292. radius: 5
  293. Rectangle {
  294. id: focus_setting
  295. anchors.fill: parent
  296. visible: false
  297. radius: 5
  298. color: app.cardColor
  299. // X坐标输入行(结构同优化前)
  300. Column {
  301. anchors.fill: parent
  302. spacing: 10
  303. Row {
  304. width: parent.width*0.6
  305. spacing: 5
  306. AppText {
  307. text: "X坐标:"
  308. color: app.fontColor
  309. font.pixelSize: 20
  310. }
  311. // 使用边框包裹
  312. ItemDelegate {
  313. width: parent.width
  314. height: 42
  315. padding: 0
  316. contentItem: AppTextInput {
  317. id: textInput_x
  318. width: parent.width
  319. height: parent.height
  320. placeholderText: "x_init_dis"
  321. text: "0"
  322. font.family: "Arial"
  323. font.pixelSize: 20
  324. // 使用验证器替代inputMask
  325. validator: DoubleValidator {
  326. decimals: 2
  327. }
  328. property real numericValue_x: Number(text) || 0
  329. onAccepted: {
  330. console.log("X坐标:", numericValue_x)
  331. serial.setHt_xy_dis(numericValue_x, textInput_y.numericValue_y)
  332. coordinateInputs.visible = false
  333. }
  334. }
  335. // 边框样式
  336. Rectangle {
  337. anchors.fill: parent
  338. color: "transparent"
  339. border.color: textInput_x.activeFocus ? "blue" : "gray"
  340. border.width: 1
  341. radius: 4
  342. }
  343. }
  344. }
  345. // Y坐标输入行(结构同优化前)
  346. Row {
  347. width: parent.width*0.6
  348. spacing: 5
  349. AppText {
  350. text: "Y坐标:"
  351. color: app.fontColor
  352. font.pixelSize: 20
  353. }
  354. // 使用边框包裹
  355. ItemDelegate {
  356. width: parent.width
  357. height: 42
  358. padding: 0
  359. contentItem: AppTextInput {
  360. id: textInput_y
  361. width: parent.width
  362. height: parent.height
  363. placeholderText: "y_init_dis"
  364. text: "0"
  365. font.family: "Arial"
  366. font.pixelSize: 20
  367. // 使用验证器替代inputMask
  368. validator: DoubleValidator {
  369. decimals: 2
  370. }
  371. property real numericValue_y: Number(text) || 0
  372. onAccepted: {
  373. console.log("Y坐标:", numericValue_y)
  374. serial.setHt_xy_dis(textInput_x.numericValue_x, numericValue_y)
  375. coordinateInputs.visible = false
  376. }
  377. }
  378. // 边框样式
  379. Rectangle {
  380. anchors.fill: parent
  381. color: "transparent"
  382. border.color: textInput_x.activeFocus ? "blue" : "gray"
  383. border.width: 1
  384. radius: 4
  385. }
  386. }
  387. }
  388. }
  389. }
  390. Column {
  391. anchors.centerIn: parent
  392. spacing: 12
  393. visible: true
  394. AppImage {
  395. id: image_01
  396. anchors.horizontalCenter: parent.horizontalCenter
  397. anchors.topMargin: 30
  398. source: "../../assets/a.svg"
  399. fillMode: Image.PreserveAspectFit
  400. }
  401. AppText {
  402. id: text_devicesta
  403. anchors.horizontalCenter: parent.horizontalCenter
  404. text: "工作状态:"
  405. color: app.fontColor
  406. font.bold: true
  407. font.pixelSize: 16
  408. }
  409. AppImage {
  410. id: focus_xy_set
  411. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  412. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  413. source: "../../assets/set.svg"
  414. AppButton{
  415. anchors.fill: parent
  416. //text:" 修改"
  417. textColor: "GRAY"
  418. textSize: 10
  419. flat: true
  420. onClicked: {
  421. focus_setting.visible = !focus_setting.visible
  422. text_devicesta.visible = !text_devicesta.visible
  423. image_01.visible = !image_01.visible
  424. }
  425. }
  426. }
  427. }
  428. }
  429. Rectangle {
  430. radius: 5
  431. width: parent.width*0.245
  432. height: parent.height
  433. color: app.cardColor
  434. Timer {
  435. interval: 500
  436. running: true
  437. repeat: true
  438. onTriggered: {
  439. if(mqtt.checkLink()){
  440. mqtt_text.text="MQTT已连接:" + net_list[5]
  441. }else{
  442. mqtt_text.text="MQTT已断开:" + net_list[5]
  443. }
  444. net_list = mqtt.netMessage()
  445. if(mqtt.cache_Json_enable()===1){
  446. jsonenable_String = "开启"
  447. }else{
  448. jsonenable_String = "关闭"
  449. }
  450. if(mqtt.cache_image_enable()===1){
  451. imagenable_String = "开启"
  452. }else{
  453. imagenable_String = "关闭"
  454. }
  455. cache_json_text.text= "数据缓存:" + mqtt.cache_json_num() +
  456. "("+ mqtt.cache_Json_Maxnum()+")" + jsonenable_String
  457. cache_image_text.text = "图片缓存:" + mqtt.cache_image_num()+
  458. "("+mqtt.cache_image_Maxnum()+")" + imagenable_String
  459. if(net_list){
  460. if(net_list[0]==="1"){isonline = true}else{isonline = false}
  461. net_sta.text = qsTr("<b>联网状态:</b> %1").arg(isonline? "已联网" : "未联网")
  462. net_sta.color = qsTr("%1").arg(isonline? "green" : "red")
  463. ipv4.text = qsTr("<b>[IPV4] </b> %1").arg(net_list[4])
  464. mac.text = qsTr("<b>[MAC] </b> %1").arg(net_list[3])
  465. datt_text.text = "数据上传间隔:" + net_list[6] + "分钟"
  466. netxd_text.text = "下一次数据上传:" + net_list[7] + "秒"
  467. iccid_text.text = "SIM卡号:" + iccidString
  468. }
  469. }
  470. }
  471. Timer {
  472. id: longPressTimer
  473. interval: 1000 // 1秒
  474. onTriggered: {
  475. console.log("长按触发")
  476. serial.uploadData_Mqtt()
  477. }
  478. }
  479. MouseArea {
  480. anchors.fill: parent
  481. onPressed:{
  482. longPressTimer.start()
  483. }
  484. onReleased:{
  485. longPressTimer.stop()
  486. }
  487. }
  488. Column{
  489. anchors.centerIn: parent
  490. spacing: 5
  491. AppImage {
  492. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  493. anchors.topMargin: 30
  494. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  495. source: "../../assets/net.svg"
  496. }
  497. AppText{
  498. id: text_net_title
  499. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  500. text: "网络信息"
  501. color: app.fontColor
  502. font.bold: true
  503. }
  504. AppText{
  505. id: ipv4
  506. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  507. text:"IPv4:"
  508. fontSize: 10
  509. color: "gray"
  510. }
  511. AppText{
  512. id: mac
  513. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  514. text:"MAC:"
  515. fontSize: 10
  516. color: "gray"
  517. }
  518. AppText{
  519. id: mqtt_text
  520. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  521. text:"MQTT断开连接:"
  522. fontSize: 10
  523. color: "gray"
  524. }
  525. AppText{
  526. id: datt_text
  527. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  528. text:"数据上传间隔:"
  529. fontSize: 10
  530. color: "gray"
  531. }
  532. AppText{
  533. id: netxd_text
  534. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  535. text:"下一次数据传:"
  536. fontSize: 10
  537. color: "gray"
  538. }
  539. AppText{
  540. id: iccid_text
  541. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  542. text:"SIM卡号:"
  543. fontSize: 10
  544. color: "gray"
  545. }
  546. AppText{
  547. id: cache_json_text
  548. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  549. text:"数据缓存:"
  550. fontSize: 10
  551. color: "gray"
  552. }
  553. AppText{
  554. id: cache_image_text
  555. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  556. text:"图片缓存:"
  557. fontSize: 10
  558. color: "gray"
  559. }
  560. }
  561. }
  562. Rectangle {
  563. radius: 5
  564. width: parent.width*0.245
  565. height: parent.height
  566. color: app.cardColor
  567. Column{
  568. anchors.centerIn: parent
  569. spacing: 5
  570. AppImage {
  571. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  572. anchors.topMargin: 30
  573. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  574. source: "../../assets/gps.svg"
  575. }
  576. AppText{
  577. id: text_gps_title
  578. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  579. text: "定位信息"
  580. color: app.fontColor
  581. font.bold: true
  582. }
  583. AppText{
  584. id: text_lat
  585. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  586. text:"lat:"
  587. fontSize: 10
  588. color: "gray"
  589. }
  590. AppText{
  591. id: text_lng
  592. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  593. text:"lng:"
  594. fontSize: 10
  595. color: "gray"
  596. }
  597. }
  598. }
  599. Rectangle {
  600. radius: 5
  601. width: parent.width*0.245
  602. height: parent.height
  603. color: app.cardColor
  604. Rectangle{
  605. id: rec_seting
  606. anchors.fill: parent
  607. visible: false
  608. AppText {
  609. //anchors.top: parent
  610. //anchors.topMargin:10
  611. text:"采集时间设置"
  612. anchors.horizontalCenter: parent.horizontalCenter
  613. font.bold: true
  614. }
  615. Grid {
  616. anchors.centerIn: parent
  617. //anchors.horizontalCenter: parent.horizontalCenter
  618. columns: 2
  619. rows: 3
  620. rowSpacing: 5
  621. columnSpacing: 20
  622. AppTextField {
  623. id: sh1_textfield
  624. width: 60
  625. height: 30
  626. borderWidth: dp(1)
  627. radius: 5
  628. // Displays a number only keyboard on mobiles
  629. inputMethodHints: Qt.ImhDigitsOnly
  630. validator: IntValidator {
  631. bottom: 0
  632. top: 23
  633. }
  634. }
  635. AppTextField {
  636. id: sh2_textfield
  637. width: 60
  638. height: 30
  639. borderWidth: dp(1)
  640. radius: 5
  641. // Displays a number only keyboard on mobiles
  642. inputMethodHints: Qt.ImhDigitsOnly
  643. validator: IntValidator {
  644. bottom: 0
  645. top: 23
  646. }
  647. }
  648. AppTextField {
  649. id: sh3_textfield
  650. width: 60
  651. height: 30
  652. borderWidth: dp(1)
  653. radius: 5
  654. // Displays a number only keyboard on mobiles
  655. inputMethodHints: Qt.ImhDigitsOnly
  656. validator: IntValidator {
  657. bottom: 0
  658. top: 23
  659. }
  660. }
  661. AppTextField {
  662. id: sh4_textfield
  663. width: 60
  664. height: 30
  665. borderWidth: dp(1)
  666. radius: 5
  667. // Displays a number only keyboard on mobiles
  668. inputMethodHints: Qt.ImhDigitsOnly
  669. validator: IntValidator {
  670. bottom: 0
  671. top: 23
  672. }
  673. }
  674. AppTextField {
  675. id: sh5_textfield
  676. width: 60
  677. height: 30
  678. borderWidth: dp(1)
  679. radius: 5
  680. // Displays a number only keyboard on mobiles
  681. inputMethodHints: Qt.ImhDigitsOnly
  682. validator: IntValidator {
  683. bottom: 0
  684. top: 23
  685. }
  686. }
  687. AppTextField {
  688. id: sh6_textfield
  689. width: 60
  690. height: 30
  691. borderWidth: dp(1)
  692. radius: 5
  693. // Displays a number only keyboard on mobiles
  694. inputMethodHints: Qt.ImhDigitsOnly
  695. validator: IntValidator {
  696. bottom: 0
  697. top: 23
  698. }
  699. }
  700. }
  701. Row {
  702. anchors.horizontalCenter: parent.horizontalCenter
  703. anchors.bottom: parent.bottom
  704. anchors.bottomMargin: 5
  705. //spacing: -15
  706. AppButton {
  707. minimumWidth: 30
  708. minimumHeight: 15
  709. textSize: 15
  710. fontBold: false
  711. iconSize: 10
  712. text: "取消"
  713. textColor: "black"
  714. flat: false
  715. backgroundColor: "#e9e9e9"
  716. borderColor: "white"
  717. onClicked: {
  718. rec_seting.visible = false
  719. column_colt.visible = true
  720. appimage_set.visible = true
  721. image_timesvg.visible = true
  722. }
  723. }
  724. AppButton {
  725. minimumWidth: 30
  726. minimumHeight: 15
  727. textSize: 15
  728. text: "保存"
  729. textColor: "white"
  730. flat: false
  731. backgroundColor: "#0aa26b"
  732. borderColor: "white"
  733. onClicked: {
  734. var int_sh1 = parseInt(sh1_textfield.text)
  735. var int_eh1 = parseInt(sh2_textfield.text)
  736. var int_sh2 = parseInt(sh3_textfield.text)
  737. var int_eh2 = parseInt(sh4_textfield.text)
  738. var int_sh3 = parseInt(sh5_textfield.text)
  739. var int_eh3 = parseInt(sh6_textfield.text)
  740. serial.setCollt(int_sh1,int_eh1,int_sh2,int_eh2,int_sh3,int_eh3)
  741. rec_seting.visible = false
  742. column_colt.visible = true
  743. appimage_set.visible = true
  744. image_timesvg.visible = true
  745. }
  746. }
  747. }
  748. }
  749. Column{
  750. id: column_colt
  751. anchors.centerIn: parent
  752. spacing: 5
  753. AppImage {
  754. id: image_timesvg
  755. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  756. anchors.topMargin: 30
  757. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  758. source: "../../assets/time.svg"
  759. }
  760. AppText{
  761. id: text_coll
  762. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  763. text: "采集时间"
  764. color: app.fontColor
  765. font.bold: true
  766. }
  767. AppText{
  768. id: sh1
  769. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  770. text:"09:00-10:00"
  771. fontSize: 10
  772. color: "gray"
  773. }
  774. AppText{
  775. id: sh2
  776. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  777. text:"14:00-16:00"
  778. fontSize: 10
  779. color: "gray"
  780. }
  781. AppText{
  782. id: sh3
  783. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  784. text:"17:00-19:00"
  785. fontSize: 10
  786. color: "gray"
  787. }
  788. AppImage {
  789. id: appimage_set
  790. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  791. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  792. source: "../../assets/set.svg"
  793. AppButton{
  794. id: settime
  795. anchors.fill: parent
  796. //text:" 修改"
  797. textColor: "GRAY"
  798. textSize: 10
  799. flat: true
  800. onClicked: {
  801. var sh1Arry = sh1.text.split('-')
  802. var sh2Arry = sh2.text.split('-')
  803. var sh3Arry = sh3.text.split('-')
  804. sh1_textfield.text = parseInt(sh1Arry[0]);
  805. sh2_textfield.text= parseInt(sh1Arry[1]);
  806. sh3_textfield.text = parseInt(sh2Arry[0]);
  807. sh4_textfield.text = parseInt(sh2Arry[1]);
  808. sh5_textfield.text = parseInt(sh3Arry[0]);
  809. sh6_textfield.text = parseInt(sh3Arry[1]);
  810. column_colt.visible = false
  811. appimage_set.visible = false
  812. image_timesvg.visible = false
  813. rec_seting.visible = true
  814. }
  815. }
  816. }
  817. }
  818. }
  819. }
  820. Row {
  821. width: parent.width
  822. height: parent.height*0.38
  823. spacing: 5
  824. Rectangle {
  825. radius: 5
  826. width: parent.width*0.245
  827. height: parent.height
  828. color: app.cardColor
  829. Column {
  830. anchors.centerIn: parent
  831. spacing: 5
  832. AppImage {
  833. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  834. anchors.topMargin: 30
  835. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  836. source: "../../assets/tempture.svg"
  837. }
  838. AppText{
  839. id: text_tempture
  840. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  841. text: "环境温度:"
  842. color: app.fontColor
  843. font.bold: true
  844. }
  845. AppText{
  846. id: text_tempture0
  847. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  848. text: "箱内温度:"
  849. color: app.fontColor
  850. font.bold: true
  851. }
  852. AppText{
  853. id: text_tempture_sta
  854. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  855. text:"正常"
  856. fontSize: 10
  857. color: "gray"
  858. }
  859. }
  860. }
  861. Rectangle {
  862. radius: 5
  863. width: parent.width*0.245
  864. height: parent.height
  865. color: app.cardColor
  866. Column {
  867. anchors.centerIn: parent
  868. spacing: 5
  869. AppImage {
  870. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  871. anchors.topMargin: 30
  872. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  873. source: "../../assets/humidity.svg"
  874. }
  875. AppText{
  876. id: text_humidity
  877. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  878. text: "湿度:"
  879. color: app.fontColor
  880. font.bold: true
  881. }
  882. }
  883. }
  884. Rectangle {
  885. radius: 5
  886. width: parent.width*0.245
  887. height: parent.height
  888. color: app.cardColor
  889. Column {
  890. anchors.centerIn: parent
  891. spacing: 5
  892. AppImage {
  893. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  894. anchors.topMargin: 30
  895. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  896. source: "../../assets/vbat.svg"
  897. }
  898. AppText{
  899. id: text_vbat
  900. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  901. text: "电压:"
  902. color: app.fontColor
  903. font.bold: true
  904. }
  905. }
  906. }
  907. Rectangle {
  908. radius: 5
  909. width: parent.width*0.245
  910. height: parent.height
  911. color: app.cardColor
  912. Column {
  913. anchors.centerIn: parent
  914. spacing: 5
  915. AppImage {
  916. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  917. anchors.topMargin: 30
  918. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  919. source: "../../assets/current.svg"
  920. }
  921. AppText{
  922. id: text_current
  923. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  924. text: "电流:"
  925. color: app.fontColor
  926. font.bold: true
  927. }
  928. }
  929. }
  930. }
  931. }
  932. } // page