PageSelfTest.qml 32 KB

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