HomePage.qml 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035
  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. wrapMode: Text.NoWrap
  325. inputMethodHints: Qt.ImhMultiLine
  326. // 使用验证器替代inputMask
  327. validator: DoubleValidator {
  328. decimals: 0
  329. notation: DoubleValidator.StandardNotation
  330. }
  331. property real numericValue_x: Number(text) || 0
  332. Keys.onReturnPressed: {
  333. console.log("X坐标:", numericValue_x)
  334. serial.setHt_xy_dis(numericValue_x, textInput_y.numericValue_y)
  335. coordinateInputs.visible = false
  336. }
  337. }
  338. // 边框样式
  339. Rectangle {
  340. anchors.fill: parent
  341. color: "transparent"
  342. border.color: textInput_x.activeFocus ? "blue" : "gray"
  343. border.width: 1
  344. radius: 4
  345. }
  346. }
  347. }
  348. // Y坐标输入行(结构同优化前)
  349. Row {
  350. width: parent.width*0.6
  351. spacing: 5
  352. AppText {
  353. text: "Y坐标:"
  354. color: app.fontColor
  355. font.pixelSize: 20
  356. }
  357. // 使用边框包裹
  358. ItemDelegate {
  359. width: parent.width
  360. height: 42
  361. padding: 0
  362. contentItem: AppTextInput {
  363. id: textInput_y
  364. width: parent.width
  365. height: parent.height
  366. placeholderText: "y_init_dis"
  367. text: "0"
  368. font.family: "Arial"
  369. font.pixelSize: 20
  370. wrapMode: Text.NoWrap
  371. inputMethodHints: Qt.ImhMultiLine
  372. // 使用验证器替代inputMask
  373. validator: DoubleValidator {
  374. decimals: 0
  375. }
  376. property real numericValue_y: Number(text) || 0
  377. Keys.onReturnPressed: {
  378. console.log("Y坐标:", numericValue_y)
  379. serial.setHt_xy_dis(textInput_x.numericValue_x, numericValue_y)
  380. coordinateInputs.visible = false
  381. }
  382. }
  383. // 边框样式
  384. Rectangle {
  385. anchors.fill: parent
  386. color: "transparent"
  387. border.color: textInput_x.activeFocus ? "blue" : "gray"
  388. border.width: 1
  389. radius: 4
  390. }
  391. }
  392. }
  393. }
  394. }
  395. Column {
  396. anchors.centerIn: parent
  397. spacing: 12
  398. visible: true
  399. AppImage {
  400. id: image_01
  401. anchors.horizontalCenter: parent.horizontalCenter
  402. anchors.topMargin: 30
  403. source: "../../assets/a.svg"
  404. fillMode: Image.PreserveAspectFit
  405. }
  406. AppText {
  407. id: text_devicesta
  408. anchors.horizontalCenter: parent.horizontalCenter
  409. text: "工作状态:"
  410. color: app.fontColor
  411. font.bold: true
  412. font.pixelSize: 16
  413. }
  414. AppImage {
  415. id: focus_xy_set
  416. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  417. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  418. source: "../../assets/set.svg"
  419. AppButton{
  420. anchors.fill: parent
  421. //text:" 修改"
  422. textColor: "GRAY"
  423. textSize: 10
  424. flat: true
  425. onClicked: {
  426. focus_setting.visible = !focus_setting.visible
  427. text_devicesta.visible = !text_devicesta.visible
  428. image_01.visible = !image_01.visible
  429. }
  430. }
  431. }
  432. }
  433. }
  434. Rectangle {
  435. radius: 5
  436. width: parent.width*0.245
  437. height: parent.height
  438. color: app.cardColor
  439. Timer {
  440. interval: 500
  441. running: true
  442. repeat: true
  443. onTriggered: {
  444. if(mqtt.checkLink()){
  445. mqtt_text.text="MQTT已连接:" + net_list[5]
  446. }else{
  447. mqtt_text.text="MQTT已断开:" + net_list[5]
  448. }
  449. net_list = mqtt.netMessage()
  450. if(mqtt.cache_Json_enable()===1){
  451. jsonenable_String = "开启"
  452. }else{
  453. jsonenable_String = "关闭"
  454. }
  455. if(mqtt.cache_image_enable()===1){
  456. imagenable_String = "开启"
  457. }else{
  458. imagenable_String = "关闭"
  459. }
  460. cache_json_text.text= "数据缓存:" + mqtt.cache_json_num() +
  461. "("+ mqtt.cache_Json_Maxnum()+")" + jsonenable_String
  462. cache_image_text.text = "图片缓存:" + mqtt.cache_image_num()+
  463. "("+mqtt.cache_image_Maxnum()+")" + imagenable_String
  464. if(net_list){
  465. if(net_list[0]==="1"){isonline = true}else{isonline = false}
  466. net_sta.text = qsTr("<b>联网状态:</b> %1").arg(isonline? "已联网" : "未联网")
  467. net_sta.color = qsTr("%1").arg(isonline? "green" : "red")
  468. ipv4.text = qsTr("<b>[IPV4] </b> %1").arg(net_list[4])
  469. mac.text = qsTr("<b>[MAC] </b> %1").arg(net_list[3])
  470. datt_text.text = "数据上传间隔:" + net_list[6] + "分钟"
  471. netxd_text.text = "下一次数据上传:" + net_list[7] + "秒"
  472. iccid_text.text = "SIM卡号:" + iccidString
  473. }
  474. }
  475. }
  476. Timer {
  477. id: longPressTimer
  478. interval: 1000 // 1秒
  479. onTriggered: {
  480. console.log("长按触发")
  481. serial.uploadData_Mqtt()
  482. }
  483. }
  484. MouseArea {
  485. anchors.fill: parent
  486. onPressed:{
  487. longPressTimer.start()
  488. }
  489. onReleased:{
  490. longPressTimer.stop()
  491. }
  492. }
  493. Column{
  494. anchors.centerIn: parent
  495. spacing: 5
  496. AppImage {
  497. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  498. anchors.topMargin: 30
  499. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  500. source: "../../assets/net.svg"
  501. }
  502. AppText{
  503. id: text_net_title
  504. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  505. text: "网络信息"
  506. color: app.fontColor
  507. font.bold: true
  508. }
  509. AppText{
  510. id: ipv4
  511. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  512. text:"IPv4:"
  513. fontSize: 10
  514. color: "gray"
  515. }
  516. AppText{
  517. id: mac
  518. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  519. text:"MAC:"
  520. fontSize: 10
  521. color: "gray"
  522. }
  523. AppText{
  524. id: mqtt_text
  525. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  526. text:"MQTT断开连接:"
  527. fontSize: 10
  528. color: "gray"
  529. }
  530. AppText{
  531. id: datt_text
  532. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  533. text:"数据上传间隔:"
  534. fontSize: 10
  535. color: "gray"
  536. }
  537. AppText{
  538. id: netxd_text
  539. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  540. text:"下一次数据传:"
  541. fontSize: 10
  542. color: "gray"
  543. }
  544. AppText{
  545. id: iccid_text
  546. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  547. text:"SIM卡号:"
  548. fontSize: 10
  549. color: "gray"
  550. }
  551. AppText{
  552. id: cache_json_text
  553. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  554. text:"数据缓存:"
  555. fontSize: 10
  556. color: "gray"
  557. }
  558. AppText{
  559. id: cache_image_text
  560. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  561. text:"图片缓存:"
  562. fontSize: 10
  563. color: "gray"
  564. }
  565. }
  566. }
  567. Rectangle {
  568. radius: 5
  569. width: parent.width*0.245
  570. height: parent.height
  571. color: app.cardColor
  572. Column{
  573. anchors.centerIn: parent
  574. spacing: 5
  575. AppImage {
  576. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  577. anchors.topMargin: 30
  578. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  579. source: "../../assets/gps.svg"
  580. }
  581. AppText{
  582. id: text_gps_title
  583. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  584. text: "定位信息"
  585. color: app.fontColor
  586. font.bold: true
  587. }
  588. AppText{
  589. id: text_lat
  590. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  591. text:"lat:"
  592. fontSize: 10
  593. color: "gray"
  594. }
  595. AppText{
  596. id: text_lng
  597. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  598. text:"lng:"
  599. fontSize: 10
  600. color: "gray"
  601. }
  602. }
  603. }
  604. Rectangle {
  605. radius: 5
  606. width: parent.width*0.245
  607. height: parent.height
  608. color: app.cardColor
  609. Rectangle{
  610. id: rec_seting
  611. anchors.fill: parent
  612. visible: false
  613. AppText {
  614. //anchors.top: parent
  615. //anchors.topMargin:10
  616. text:"采集时间设置"
  617. anchors.horizontalCenter: parent.horizontalCenter
  618. font.bold: true
  619. }
  620. Grid {
  621. anchors.centerIn: parent
  622. //anchors.horizontalCenter: parent.horizontalCenter
  623. columns: 2
  624. rows: 3
  625. rowSpacing: 5
  626. columnSpacing: 20
  627. AppTextField {
  628. id: sh1_textfield
  629. width: 60
  630. height: 30
  631. borderWidth: dp(1)
  632. radius: 5
  633. // Displays a number only keyboard on mobiles
  634. inputMethodHints: Qt.ImhDigitsOnly
  635. validator: IntValidator {
  636. bottom: 0
  637. top: 23
  638. }
  639. }
  640. AppTextField {
  641. id: sh2_textfield
  642. width: 60
  643. height: 30
  644. borderWidth: dp(1)
  645. radius: 5
  646. // Displays a number only keyboard on mobiles
  647. inputMethodHints: Qt.ImhDigitsOnly
  648. validator: IntValidator {
  649. bottom: 0
  650. top: 23
  651. }
  652. }
  653. AppTextField {
  654. id: sh3_textfield
  655. width: 60
  656. height: 30
  657. borderWidth: dp(1)
  658. radius: 5
  659. // Displays a number only keyboard on mobiles
  660. inputMethodHints: Qt.ImhDigitsOnly
  661. validator: IntValidator {
  662. bottom: 0
  663. top: 23
  664. }
  665. }
  666. AppTextField {
  667. id: sh4_textfield
  668. width: 60
  669. height: 30
  670. borderWidth: dp(1)
  671. radius: 5
  672. // Displays a number only keyboard on mobiles
  673. inputMethodHints: Qt.ImhDigitsOnly
  674. validator: IntValidator {
  675. bottom: 0
  676. top: 23
  677. }
  678. }
  679. AppTextField {
  680. id: sh5_textfield
  681. width: 60
  682. height: 30
  683. borderWidth: dp(1)
  684. radius: 5
  685. // Displays a number only keyboard on mobiles
  686. inputMethodHints: Qt.ImhDigitsOnly
  687. validator: IntValidator {
  688. bottom: 0
  689. top: 23
  690. }
  691. }
  692. AppTextField {
  693. id: sh6_textfield
  694. width: 60
  695. height: 30
  696. borderWidth: dp(1)
  697. radius: 5
  698. // Displays a number only keyboard on mobiles
  699. inputMethodHints: Qt.ImhDigitsOnly
  700. validator: IntValidator {
  701. bottom: 0
  702. top: 23
  703. }
  704. }
  705. }
  706. Row {
  707. anchors.horizontalCenter: parent.horizontalCenter
  708. anchors.bottom: parent.bottom
  709. anchors.bottomMargin: 5
  710. //spacing: -15
  711. AppButton {
  712. minimumWidth: 30
  713. minimumHeight: 15
  714. textSize: 15
  715. fontBold: false
  716. iconSize: 10
  717. text: "取消"
  718. textColor: "black"
  719. flat: false
  720. backgroundColor: "#e9e9e9"
  721. borderColor: "white"
  722. onClicked: {
  723. rec_seting.visible = false
  724. column_colt.visible = true
  725. appimage_set.visible = true
  726. image_timesvg.visible = true
  727. }
  728. }
  729. AppButton {
  730. minimumWidth: 30
  731. minimumHeight: 15
  732. textSize: 15
  733. text: "保存"
  734. textColor: "white"
  735. flat: false
  736. backgroundColor: "#0aa26b"
  737. borderColor: "white"
  738. onClicked: {
  739. var int_sh1 = parseInt(sh1_textfield.text)
  740. var int_eh1 = parseInt(sh2_textfield.text)
  741. var int_sh2 = parseInt(sh3_textfield.text)
  742. var int_eh2 = parseInt(sh4_textfield.text)
  743. var int_sh3 = parseInt(sh5_textfield.text)
  744. var int_eh3 = parseInt(sh6_textfield.text)
  745. serial.setCollt(int_sh1,int_eh1,int_sh2,int_eh2,int_sh3,int_eh3)
  746. rec_seting.visible = false
  747. column_colt.visible = true
  748. appimage_set.visible = true
  749. image_timesvg.visible = true
  750. }
  751. }
  752. }
  753. }
  754. Column{
  755. id: column_colt
  756. anchors.centerIn: parent
  757. spacing: 5
  758. AppImage {
  759. id: image_timesvg
  760. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  761. anchors.topMargin: 30
  762. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  763. source: "../../assets/time.svg"
  764. }
  765. AppText{
  766. id: text_coll
  767. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  768. text: "采集时间"
  769. color: app.fontColor
  770. font.bold: true
  771. }
  772. AppText{
  773. id: sh1
  774. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  775. text:"09:00-10:00"
  776. fontSize: 10
  777. color: "gray"
  778. }
  779. AppText{
  780. id: sh2
  781. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  782. text:"14:00-16:00"
  783. fontSize: 10
  784. color: "gray"
  785. }
  786. AppText{
  787. id: sh3
  788. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  789. text:"17:00-19:00"
  790. fontSize: 10
  791. color: "gray"
  792. }
  793. AppImage {
  794. id: appimage_set
  795. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  796. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  797. source: "../../assets/set.svg"
  798. AppButton{
  799. id: settime
  800. anchors.fill: parent
  801. //text:" 修改"
  802. textColor: "GRAY"
  803. textSize: 10
  804. flat: true
  805. onClicked: {
  806. var sh1Arry = sh1.text.split('-')
  807. var sh2Arry = sh2.text.split('-')
  808. var sh3Arry = sh3.text.split('-')
  809. sh1_textfield.text = parseInt(sh1Arry[0]);
  810. sh2_textfield.text= parseInt(sh1Arry[1]);
  811. sh3_textfield.text = parseInt(sh2Arry[0]);
  812. sh4_textfield.text = parseInt(sh2Arry[1]);
  813. sh5_textfield.text = parseInt(sh3Arry[0]);
  814. sh6_textfield.text = parseInt(sh3Arry[1]);
  815. column_colt.visible = false
  816. appimage_set.visible = false
  817. image_timesvg.visible = false
  818. rec_seting.visible = true
  819. }
  820. }
  821. }
  822. }
  823. }
  824. }
  825. Row {
  826. width: parent.width
  827. height: parent.height*0.38
  828. spacing: 5
  829. Rectangle {
  830. radius: 5
  831. width: parent.width*0.245
  832. height: parent.height
  833. color: app.cardColor
  834. Column {
  835. anchors.centerIn: parent
  836. spacing: 5
  837. AppImage {
  838. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  839. anchors.topMargin: 30
  840. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  841. source: "../../assets/tempture.svg"
  842. }
  843. AppText{
  844. id: text_tempture
  845. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  846. text: "环境温度:"
  847. color: app.fontColor
  848. font.bold: true
  849. }
  850. AppText{
  851. id: text_tempture0
  852. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  853. text: "箱内温度:"
  854. color: app.fontColor
  855. font.bold: true
  856. }
  857. AppText{
  858. id: text_tempture_sta
  859. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  860. text:"正常"
  861. fontSize: 10
  862. color: "gray"
  863. }
  864. }
  865. }
  866. Rectangle {
  867. radius: 5
  868. width: parent.width*0.245
  869. height: parent.height
  870. color: app.cardColor
  871. Column {
  872. anchors.centerIn: parent
  873. spacing: 5
  874. AppImage {
  875. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  876. anchors.topMargin: 30
  877. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  878. source: "../../assets/humidity.svg"
  879. }
  880. AppText{
  881. id: text_humidity
  882. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  883. text: "湿度:"
  884. color: app.fontColor
  885. font.bold: true
  886. }
  887. }
  888. }
  889. Rectangle {
  890. radius: 5
  891. width: parent.width*0.245
  892. height: parent.height
  893. color: app.cardColor
  894. Column {
  895. anchors.centerIn: parent
  896. spacing: 5
  897. AppImage {
  898. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  899. anchors.topMargin: 30
  900. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  901. source: "../../assets/vbat.svg"
  902. }
  903. AppText{
  904. id: text_vbat
  905. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  906. text: "电压:"
  907. color: app.fontColor
  908. font.bold: true
  909. }
  910. }
  911. }
  912. Rectangle {
  913. radius: 5
  914. width: parent.width*0.245
  915. height: parent.height
  916. color: app.cardColor
  917. Column {
  918. anchors.centerIn: parent
  919. spacing: 5
  920. AppImage {
  921. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  922. anchors.topMargin: 30
  923. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  924. source: "../../assets/current.svg"
  925. }
  926. AppText{
  927. id: text_current
  928. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  929. text: "电流:"
  930. color: app.fontColor
  931. font.bold: true
  932. }
  933. }
  934. }
  935. }
  936. }
  937. } // page