PageSelfTest.qml 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890
  1. import QtQuick 2.15
  2. import QtQuick.Layouts 1.3
  3. import QtQuick.Controls 1.2
  4. import QtQuick.Controls.Styles 1.4
  5. import Qt.labs.qmlmodels 1.0
  6. import QtQuick.LocalStorage 2.0
  7. //import io.qt.DataBaseModel 1.0
  8. import Qt.labs.platform 1.1
  9. import TService 1.0
  10. import "selftest_db.js" as SelfDB
  11. Item {
  12. id: selftest_root
  13. property string title_str:"系统自测"
  14. property string background: "#d7e3bc"
  15. property string alterBackground: "white"
  16. property string highlight: "#e4f7d6"
  17. property string headerBkgnd: "#F0F0F0"
  18. property var allArray: []
  19. //property string state
  20. property string pressure:"0.00"
  21. property int pressureCnt:0
  22. property int test_direction:0
  23. property bool bStart: false
  24. property real m_maxY: 0.0
  25. property real m_minY: 0.0
  26. property string report_record_str:"null"
  27. property string test_state_str:"未开始"
  28. property string test_result_str:"未知"
  29. //var selftest_info = new Object
  30. property var normalG: Gradient {
  31. GradientStop { position: 0.0; color: "#c7d3ac" }
  32. GradientStop { position: 1.0; color: "#F0F0F0" }
  33. }
  34. property var hoverG: Gradient {
  35. GradientStop { position: 0.0; color: "white"; }
  36. GradientStop { position: 1.0; color: "#d7e3bc"; }
  37. }
  38. property var pressG: Gradient {
  39. GradientStop { position: 0.0; color: "#d7e3bc"; }
  40. GradientStop { position: 1.0; color: "white"; }
  41. }
  42. function qmlProcessState(id, str1, str2){
  43. if(id === 0){
  44. test_state_str = str1
  45. }
  46. }
  47. function qmlProcessResult(id, str, bPassed){
  48. if(id === 0){
  49. if(bPassed){
  50. test_result_str = "合格"
  51. }else{
  52. test_result_str = "超标"
  53. }
  54. var selftest_info = new Object
  55. var jsontmp = testService.get_selftest_info()
  56. selftest_info.target = jsontmp.target
  57. selftest_info.interval = jsontmp.interval
  58. selftest_info.threshold = jsontmp.threshold
  59. selftest_info.begin = jsontmp.begin
  60. selftest_info.end = jsontmp.end
  61. selftest_info.delta = jsontmp.delta
  62. selftest_info.passed = jsontmp.pass
  63. //pagetest.show_selftestDetail(str)
  64. }
  65. }
  66. function qmlProcessStop(id){
  67. if(id === 0){
  68. //pagetest.selftestStop()
  69. startStopButton.running = false;
  70. database_add()
  71. tableview_refresh()
  72. //console.log("qmlProcessStop pagetest ",id )
  73. }
  74. }
  75. function database_add(){
  76. //var record = new Object
  77. //record.target = selftest_info.target
  78. //record.interval = selftest_info.interval
  79. //record.threshold = selftest_info.threshold
  80. //record.begin = selftest_info.begin
  81. //record.end = selftest_info.end
  82. //record.passed = selftest_info.passed
  83. var selftest_info = new Object
  84. var jsontmp = testService.get_selftest_info()
  85. selftest_info.target = jsontmp.target
  86. selftest_info.interval = jsontmp.interval
  87. selftest_info.threshold = jsontmp.threshold
  88. selftest_info.begin = jsontmp.begin
  89. selftest_info.end = jsontmp.end
  90. selftest_info.delta = jsontmp.delta
  91. selftest_info.passed = jsontmp.passed
  92. SelfDB.insertRecord(selftest_info)
  93. SelfDB.insertData(allArray)
  94. }
  95. function curveDisplay_refresh(date){
  96. curveDisplay.spline.clear()
  97. pressureCnt =0
  98. let table_name = 'data_'+date
  99. var records = SelfDB.readData(table_name)
  100. if(records){
  101. if(records.rows.length > 0){
  102. var index = 0
  103. while(index < records.rows.length){
  104. var item = records.rows.item(index)
  105. curveDisplay_show(item)
  106. index++;
  107. }
  108. }
  109. }else{
  110. console.log("tableview_refresh records is null:" )
  111. }
  112. }
  113. function tableview_refresh(){
  114. selttest_Model.clear()
  115. var records = SelfDB.readData("test_table")
  116. if(records){
  117. console.log("tableview_refresh records.rows.length:"+records.rows.length )
  118. if(records.rows.length > 0){
  119. var index = records.rows.length-1
  120. var tmp_id = 0;
  121. while(index >= 0){
  122. var item = records.rows.item(index)
  123. /*
  124. selttest_Model.append({
  125. "idx":tmp_id,
  126. "date":item.dt,
  127. "time":item.time,
  128. "target":item.target.toString(),
  129. "interval":item.interval.toString(),
  130. "threshold":item.threshold.toString(),
  131. "start":item.begin.toString(),
  132. "end":item.end.toString(),
  133. "delta":item.delta.toString(),
  134. "result":item.passed === 1? "合格":"超标" })
  135. */
  136. selttest_Model.append({
  137. "idx":tmp_id,
  138. "date":item.dt,
  139. "time":item.time,
  140. "target":item.target,
  141. "interval":item.interval,
  142. "threshold":item.threshold,
  143. "start":item.begin,
  144. "end":item.end,
  145. "delta":item.delta,
  146. "result":item.passed === 1? "合格":"超标" })
  147. index--
  148. tmp_id++
  149. }
  150. }
  151. }else{
  152. console.log("tableview_refresh records is null:" )
  153. }
  154. }
  155. function qmlProcessReportProgress_self(str){
  156. console.log("main.qml tservice qmlProcessReportProgress:", str )
  157. if(str === "close"){
  158. genreportprogress_self.exit()
  159. }else{
  160. genreportprogress_self.show(str)
  161. }
  162. }
  163. function qmlProcessPressure(id, map){
  164. //console.log("main.qml qmlProcessPressure ",id )
  165. //log.show2(str)
  166. //var textstring = ''
  167. //var varmap = map
  168. //textstring += map.pressure+":"
  169. //textstring += map.direction.toString()+":"
  170. //textstring += map.stage.toString()+":"
  171. //textstring += map.step.toString()+":"
  172. //console.log("main.qml qmlProcessPressure :",textstring.toString() )
  173. if(id === 0){
  174. pressure = map.pressure
  175. //pressureDisplayInput(Number(pressure_map.pressure))
  176. var data = new Object
  177. data.step = map.step
  178. data.pressure = Number(map.pressure)
  179. curveDisplay_show(data)
  180. allArray.push(data)
  181. }
  182. }
  183. function curveDisplay_show(value){
  184. pressureCnt++
  185. var number = value.pressure
  186. m_maxY = (m_maxY < number)? number:m_maxY
  187. m_minY = (m_minY > number)? number:m_minY
  188. curveDisplay.setRange_Y(m_minY-2.0, m_maxY+2.0)
  189. if(pressureCnt <= 180){
  190. curveDisplay.spline.append(pressureCnt-1,number)
  191. }
  192. else{
  193. curveDisplay.setRange_X(0, pressureCnt-1)
  194. curveDisplay.spline.append(pressureCnt-1,number)
  195. }
  196. }
  197. function cleardata(){
  198. allArray = []
  199. curveDisplay.spline.clear()
  200. pressureCnt =0
  201. pressure = "0.00"
  202. test_state_str="未开始"
  203. test_result_str="未知"
  204. }
  205. function pad_with_zeroes(number, length) {
  206. var my_string = '' + number;
  207. while (my_string.length < length) {
  208. my_string = '0' + my_string;
  209. }
  210. return my_string;
  211. }
  212. function getWordSaveFileName( para){
  213. var date = new Date;
  214. var year = date.getFullYear()
  215. var month = pad_with_zeroes(date.getMonth()+1,2)
  216. var day = pad_with_zeroes(date.getDate(),2)
  217. var hour = pad_with_zeroes(date.getHours(),2)
  218. var minute = pad_with_zeroes(date.getMinutes(),2)
  219. var second = pad_with_zeroes(date.getSeconds(),2)
  220. var time = year+month+day+hour+minute+second
  221. return "file:///"+time+"_"+para
  222. }
  223. DynamicGroupBox{
  224. id:groupbox_all
  225. anchors.centerIn: parent
  226. anchors.fill: parent
  227. title: title_str
  228. Column{
  229. anchors.left: parent.left
  230. anchors.leftMargin: 3
  231. anchors.top: parent.top
  232. anchors.topMargin: 10
  233. spacing: 0
  234. FileDialog {
  235. id: saveWordDialog
  236. title: "保存为"
  237. //nameFilters: [ "Word files (*.doc)"]
  238. //nameFilters: [ "Word files (*.doc)", "Text files (*.pdf)"]
  239. nameFilters: ["Text files (*.pdf)"]
  240. fileMode: FileDialog.SaveFile
  241. onAccepted: {
  242. var fileName = "D:/tmp/selftest.jpg"
  243. rect_display.grabToImage(function(result) {
  244. result.saveToFile(fileName);
  245. });
  246. var savePath = file.toString().substring(8)
  247. console.log("saveWordDialog savePath:")
  248. console.log(savePath)
  249. if("null" == report_record_str){
  250. testService.genReport_Self(savePath, "D:/tmp/")
  251. }else{
  252. testService.genReport_Self2(report_record_str, savePath, "D:/tmp/")
  253. }
  254. //reportWord.generateBreatheValveWord(savePath,para,obj1,obj2,obj3)
  255. // testService.genReport(savePath, "D:/tmp/")
  256. }
  257. }
  258. Row{
  259. //x:-10
  260. y:-10
  261. //width: 900
  262. //height: parent.height
  263. Rectangle{
  264. id:rect_display
  265. //anchors.verticalCenter: parent.verticalCenter
  266. width: 900
  267. height: 460
  268. CurveDisplay{
  269. id:curveDisplay
  270. anchors.fill: parent
  271. axisxMax:180
  272. axisxMin:0
  273. axisyMax:14
  274. axisyMin:0
  275. name:"横轴时间(秒) 纵轴压力(kPa)"
  276. }
  277. }
  278. Item {
  279. id:button_root
  280. width: 360
  281. height: 460
  282. Column{
  283. id:button_column
  284. spacing: 10
  285. Rectangle{
  286. id:buttonWindow
  287. //anchors.fill: parent
  288. width: 350
  289. height: 70
  290. color: "white"
  291. radius: 6
  292. border.color: "black"
  293. Row{
  294. anchors.verticalCenter: parent.verticalCenter
  295. anchors.horizontalCenter: parent.horizontalCenter
  296. spacing: 50
  297. StartStopButton{
  298. id:startStopButton
  299. width: 50
  300. height: 50
  301. anchors.verticalCenter: parent.verticalCenter
  302. onRunningChanged: {
  303. if(running){
  304. //clearCurveDisplay()
  305. cleardata()
  306. bStart = testService.tstart(0, 0)
  307. if(!bStart){
  308. running=false;
  309. }
  310. }else{
  311. if(bStart){
  312. testService.tstop(0)
  313. bStart=false
  314. }
  315. }
  316. }
  317. }
  318. ReportButton{
  319. id:reportButton
  320. width: 50
  321. height: 50
  322. anchors.verticalCenter: parent.verticalCenter
  323. onUserClicked:{
  324. //database_add()
  325. //tableview_refresh()
  326. if(false == startStopButton.running){
  327. //var fileName = "D:/tmp/selftest.jpg"
  328. //rect_display.grabToImage(function(result) {
  329. // result.saveToFile(fileName);
  330. //});
  331. var date = new Date;
  332. var year = date.getFullYear()
  333. var month = pad_with_zeroes(date.getMonth()+1,2)
  334. var day = pad_with_zeroes(date.getDate(),2)
  335. var time = year+month+day
  336. saveWordDialog.currentFile = "file:///"+time+"_VRST2000"
  337. report_record_str = "null"
  338. saveWordDialog.open()
  339. }
  340. }
  341. }
  342. ReturnButton{
  343. id: return_button
  344. width: 50
  345. height: 50
  346. anchors.verticalCenter: parent.verticalCenter
  347. onUserClicked: {
  348. if(false == startStopButton.running){
  349. selftest_root.destroy()
  350. }
  351. }
  352. }
  353. }
  354. }
  355. Rectangle{
  356. id:test_selrect
  357. //anchors.fill: parent
  358. anchors.margins: 10
  359. width: 350
  360. height: 50
  361. color: "white"
  362. radius: 6
  363. border.color: "black"
  364. UserComboBox{
  365. id:test_comboBox
  366. //anchors.fill:parent
  367. implicitWidth:350
  368. implicitHeight:50
  369. bgColor:"#D2D5D9"
  370. model: ["正压系统自测","负压系统自测"]
  371. onCurrentTextChanged: {
  372. //root.standard_name = currentText
  373. test_direction = currentIndex
  374. console.log("choose test direction : "+test_direction)
  375. }
  376. }
  377. }
  378. Rectangle{
  379. id:pressureWindow
  380. //anchors.fill: parent
  381. anchors.margins: 10
  382. width: 350
  383. height: 100
  384. color: "white"
  385. radius: 6
  386. border.color: "black"
  387. Text {
  388. id: pressurekpa
  389. anchors.right: pressureWindow.right
  390. anchors.verticalCenter: parent.verticalCenter
  391. text: qsTr("kPa ")
  392. //font: 40
  393. font.bold: true
  394. font.pixelSize: 35
  395. }
  396. Rectangle{
  397. id:pressure_rect
  398. anchors.verticalCenter: parent.verticalCenter
  399. anchors.right: pressurekpa.left;
  400. width: 250
  401. height: 80
  402. LCDNumber{
  403. id:lcd_pressure
  404. anchors.centerIn: parent
  405. text: selftest_root.pressure
  406. }
  407. }
  408. }
  409. Rectangle{
  410. id:resultWindow
  411. //anchors.fill: parent
  412. anchors.margins: 5
  413. width: 350
  414. height: 80
  415. color: "white"
  416. radius: 6
  417. border.color: "black"
  418. Column{
  419. anchors.margins: 10
  420. anchors.fill: parent
  421. spacing: 5
  422. ResultDisplayText{
  423. id: result_title
  424. width: parent.width
  425. height: 25
  426. color: "white"
  427. //paraName_fontColor:"red"
  428. paraName: "自身密闭性检测:"
  429. paraResult:""
  430. paraUnit:""
  431. }
  432. ResultDisplayText{
  433. id:result_dis
  434. width: parent.width
  435. height: 25
  436. color: "#D2D5D9"
  437. paraName_fontColor:"green"
  438. paraName: "检测结果:"
  439. paraResult_fontColor:"#272727"
  440. paraResult:test_result_str
  441. paraUnit:""
  442. }
  443. }
  444. }
  445. Rectangle{
  446. id:progressWindow
  447. //anchors.fill: parent
  448. anchors.margins: 5
  449. width: 350
  450. height: 110
  451. color: "white"
  452. radius: 6
  453. border.color: "black"
  454. Column{
  455. anchors.margins: 10
  456. anchors.fill: parent
  457. spacing: 5
  458. ResultDisplayText{
  459. id: state_title
  460. width: parent.width
  461. height: 25
  462. color: "white"
  463. //paraName_fontColor:"red"
  464. paraName: "检测进度:"
  465. paraResult:""
  466. paraUnit:""
  467. }
  468. /*
  469. TNormalProgress {
  470. id:test_progress
  471. width: parent.width
  472. backgroundColor: "#D2D5D9"
  473. //barType: TNormalProgress.BarType.SucceedOrFailed
  474. percent: 100
  475. //NumberAnimation on percent { from: 0; to: 100; duration: 5000; running: true; loops: Animation.Infinite}
  476. }
  477. */
  478. ResultDisplayText{
  479. id:state_dis
  480. width: parent.width
  481. height: 25
  482. color: "#D2D5D9"
  483. paraName_fontColor:"green"
  484. paraName: "检测状态:"
  485. paraResult_fontColor:"#272727"
  486. paraResult:test_state_str
  487. paraUnit:""
  488. }
  489. }
  490. }
  491. }
  492. }
  493. }
  494. Rectangle{
  495. id:records_rect
  496. //x:-10
  497. width: 1250
  498. height: 240
  499. color: "white"
  500. radius: 6
  501. border.color: "black"
  502. Text{
  503. id:text_title
  504. anchors.top: parent.top
  505. anchors.topMargin: 10
  506. anchors.horizontalCenter: parent.horizontalCenter
  507. font.bold: true
  508. font.pixelSize: 24
  509. text: "系统自测历史记录"
  510. }
  511. Component{
  512. id:itemDelegateText
  513. Text {
  514. anchors.verticalCenter: parent.verticalCenter
  515. color: styleData.selected?"#1E90FF":"#000000"
  516. elide: styleData.elideMode
  517. text: styleData.value
  518. font.pointSize: 10
  519. //font.pixelSize: 24
  520. //font.bold: true
  521. horizontalAlignment: Text.AlignHCenter
  522. verticalAlignment: Text.AlignVCenter
  523. anchors.fill: parent
  524. }
  525. }
  526. Component{
  527. id:itemDelegateButton
  528. Row{
  529. anchors.fill: parent
  530. anchors.centerIn: parent
  531. spacing: 10
  532. Button {
  533. anchors.verticalCenter: parent.verticalCenter
  534. //color: styleData.selected?"#1E90FF":"#000000"
  535. //elide: styleData.elideMode
  536. //anchors.centerIn: parent
  537. text: "报告"
  538. width: 60
  539. onClicked: {
  540. console.log("index ==="+styleData.row);
  541. console.log("tableView.currentRow ==="+tableView.currentRow);
  542. console.log("select date:"+selttest_Model.get(styleData.row).date);
  543. var today = new Date(selttest_Model.get(styleData.row).date);
  544. var DD = String(today.getDate()).padStart(2, '0'); // 获取日
  545. var MM = String(today.getMonth()+1).padStart(2, '0'); //获取月份,1 月为 0
  546. var yyyy = today.getFullYear(); // 获取年
  547. let date = yyyy + MM + DD;
  548. curveDisplay_refresh(date)
  549. //var fileName = "D:/tmp/selftest.jpg"
  550. //rect_display.grabToImage(function(result) {
  551. // result.saveToFile(fileName);
  552. //});
  553. //生成测试结果 JSON 字符串
  554. var recordJson={}
  555. recordJson.target = Number(selttest_Model.get(styleData.row).target)
  556. recordJson.interval = Number(selttest_Model.get(styleData.row).interval)
  557. recordJson.threshold = Number(selttest_Model.get(styleData.row).threshold)
  558. recordJson.begin = Number(selttest_Model.get(styleData.row).start)
  559. recordJson.end = Number(selttest_Model.get(styleData.row).end)
  560. recordJson.delta = Number(selttest_Model.get(styleData.row).delta)
  561. if("合格" === selttest_Model.get(styleData.row).result){
  562. recordJson.passed = 1
  563. }else{
  564. recordJson.passed = 0
  565. }
  566. report_record_str = JSON.stringify(recordJson)
  567. saveWordDialog.currentFile = "file:///"+date+"_VRST2000"
  568. saveWordDialog.open()
  569. }
  570. }
  571. Button {
  572. anchors.verticalCenter: parent.verticalCenter
  573. //color: styleData.selected?"#1E90FF":"#000000"
  574. //elide: styleData.elideMode
  575. //anchors.centerIn: parent
  576. text: "删除"
  577. width: 60
  578. onClicked: {
  579. //curveDisplay.spline.clear()
  580. // pressureCnt =0
  581. SelfDB.deleteRecord(selttest_Model.get(styleData.row).date)
  582. tableview_refresh()
  583. }
  584. }
  585. }
  586. }
  587. TableView{
  588. id:tableView
  589. //frameVisible: true
  590. width: parent.width
  591. focus: true
  592. //height: parent.height - 50
  593. anchors.top: text_title.bottom
  594. anchors.bottom: parent.bottom
  595. anchors.topMargin: 10
  596. TableViewColumn{role: "idx"; title: "ID"; width: 40;delegate: itemDelegateText}
  597. TableViewColumn{role: "date"; title: "自检日期"; width: 120;delegate: itemDelegateText}
  598. TableViewColumn{role: "time"; title: "完成时间"; width: 120;delegate: itemDelegateText}
  599. TableViewColumn{role: "target"; title: "目标压力(Kpa)"; width: 120;delegate: itemDelegateText}
  600. TableViewColumn{role: "interval"; title: "检测时间(秒)"; width: 120;delegate: itemDelegateText}
  601. TableViewColumn{role: "threshold"; title: "变化限值(Kpa)"; width: 120;delegate: itemDelegateText}
  602. TableViewColumn{role: "start"; title: "开始压力(Kpa)"; width: 120;delegate: itemDelegateText}
  603. TableViewColumn{role: "end"; title: "结束压力(Kpa)"; width: 120;delegate: itemDelegateText}
  604. TableViewColumn{role: "delta"; title: "压力变化(Kpa)"; width: 120;delegate: itemDelegateText}
  605. TableViewColumn{role: "result"; title: "自测结果"; width: 80;delegate: itemDelegateText}
  606. TableViewColumn{role: "detail"; title: "操作"; width: 130;delegate: itemDelegateButton}
  607. //model: modelItems
  608. headerDelegate: Rectangle{
  609. implicitWidth: 16
  610. implicitHeight: 24
  611. gradient: styleData.pressed ? selftest_root.pressG : (styleData.containsMouse ? selftest_root.hoverG: selftest_root.normalG)
  612. border.color: "gray"
  613. border.width: 1
  614. Text{
  615. anchors.verticalCenter: parent.verticalCenter
  616. anchors.left: parent.left
  617. anchors.leftMargin: 4
  618. anchors.right: parent.right
  619. anchors.rightMargin: 4
  620. text: styleData.value
  621. color: styleData.pressed ?"red" : "blue"
  622. horizontalAlignment: Text.AlignHCenter
  623. verticalAlignment: Text.AlignVCenter
  624. font.bold: true
  625. }
  626. }
  627. rowDelegate: Rectangle{
  628. height: 28
  629. //border.color: "gray"
  630. //color: styleData.selected?"#f0b0b0af":(styleData.alternate?"#c3c3c0":"#c0c0c3")
  631. color: styleData.selected ? selftest_root.highlight : selftest_root.alterBackground
  632. }
  633. itemDelegate: Rectangle {
  634. height: 24
  635. //border.color: "gray"
  636. color: "transparent"
  637. Text {
  638. //anchors.centerIn: parent
  639. //anchors.left: parent.left
  640. anchors.leftMargin: 6
  641. anchors.verticalCenter: parent.verticalCenter
  642. //color: styleData.textColor
  643. color: styleData.selected ? "red" : styleData.textColor
  644. text: styleData.value
  645. verticalAlignment: Text.AlignVCenter
  646. font.pointSize: 13
  647. }
  648. }
  649. onClicked:{
  650. console.log("onClicked index ==="+ row);
  651. console.log("select date:"+selttest_Model.get(row).date);
  652. var today = new Date(selttest_Model.get(row).date);
  653. var DD = String(today.getDate()).padStart(2, '0'); // 获取日
  654. var MM = String(today.getMonth()+1).padStart(2, '0'); //获取月份,1 月为 0
  655. var yyyy = today.getFullYear(); // 获取年
  656. let date = yyyy + MM + DD;
  657. curveDisplay_refresh(date)
  658. }
  659. model:ListModel{
  660. id: selttest_Model
  661. }
  662. }
  663. }
  664. }
  665. }
  666. Log{
  667. id:genreportprogress_self
  668. z:30
  669. width: 300
  670. height: 50
  671. //anchors.centerIn: parent
  672. anchors.top: parent.top
  673. anchors.topMargin: 100
  674. anchors.left: parent.left
  675. anchors.leftMargin: 480
  676. }
  677. Component.onCompleted: {
  678. testService.sigPressure.connect(qmlProcessPressure);
  679. testService.sigState.connect(qmlProcessState);
  680. //testService.sigSystemResult.connect(qmlProcessSystemResult);
  681. //testService.sigValveResult.connect(qmlProcessValveResult);
  682. testService.sigSelfTestResult.connect(qmlProcessResult);
  683. testService.onGenreportProgress.connect(qmlProcessReportProgress_self);
  684. testService.sigStop.connect(qmlProcessStop);
  685. SelfDB.initDatabase()
  686. tableview_refresh()
  687. }
  688. }
  689. /*##^##
  690. Designer {
  691. D{i:0;autoSize:true;height:480;width:640}
  692. }
  693. ##^##*/