PageSelfTest.qml 33 KB

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