SetView.qml 63 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748
  1. import QtQuick 2.15
  2. import QtQuick.Controls 2.15
  3. import QtQuick.Layouts 1.15
  4. import com.InteractiveTask 1.0
  5. Item {
  6. id: setview
  7. x: 290
  8. y: 130
  9. width: 1600
  10. height: 920
  11. signal signal_saveConfig
  12. signal signal_addfinger(bool stat)
  13. // 存储两个 ComboBox 的当前选择
  14. property int rfidPortSelection: 0
  15. property int lockPortSelection: 1
  16. property string cardID : ""
  17. property int addfingercount : 0
  18. property int addfingerTimeout : 30
  19. property string addfingerImage : "qrc:/png/cardNotice.png"
  20. property string addfingerNotice : "请先刷员工卡"
  21. property bool fingerVisible : false
  22. property bool bIsPowerUser : false // 是否为授权用户
  23. property var userFace: [];
  24. property var userHand;
  25. onVisibleChanged:
  26. {
  27. if (visible === true)
  28. {
  29. proThread.moveCursorTo(0, 0);
  30. refresh_feature_view();
  31. }
  32. }
  33. Rectangle {
  34. id: setviewbackspace
  35. width: 1600
  36. height: 800
  37. color: "#272b7ae9"
  38. radius: 20
  39. clip: true
  40. GridLayout {
  41. id: grid
  42. x: 50
  43. y: 0
  44. width: 1500
  45. height: 800
  46. rows: 20
  47. columns: 10
  48. rowSpacing: 30
  49. columnSpacing: 20
  50. Rectangle {
  51. width: 200
  52. height: 50
  53. color: "#00ffffff"
  54. Layout.row: 0
  55. Layout.column: 0
  56. visible: bIsPowerUser
  57. Label {
  58. id: devTitle
  59. color: "#ffffff"
  60. text: qsTr("设备设置")
  61. font.pixelSize: 30
  62. horizontalAlignment: Text.AlignLeft
  63. verticalAlignment: Text.AlignVCenter
  64. font.underline: false
  65. }
  66. Canvas {
  67. anchors.fill: parent
  68. visible: true
  69. onPaint: {
  70. var ctx = getContext("2d");
  71. ctx.lineWidth = 10; // 设置线的宽度
  72. ctx.strokeStyle = "skyblue"; // 设置线的颜色为白色
  73. ctx.beginPath();
  74. ctx.moveTo(0, 45); // 直线的起点
  75. ctx.lineTo(devTitle.width, 45); // 直线的终点
  76. ctx.stroke(); // 绘制直线
  77. }
  78. }
  79. }
  80. Label {
  81. Layout.row: 1
  82. Layout.column: 0
  83. text: qsTr("设备Code:")
  84. horizontalAlignment: Text.AlignLeft
  85. verticalAlignment: Text.AlignVCenter
  86. color: "#ffffff"
  87. font.pixelSize: 25
  88. visible: bIsPowerUser
  89. }
  90. Rectangle {
  91. width: 400
  92. height: 50
  93. color: "#00ffffff"
  94. border.color: "#a3ffffff"
  95. border.width: 3
  96. radius: 10
  97. Layout.row: 1
  98. Layout.column: 1
  99. Layout.columnSpan: 2
  100. visible: bIsPowerUser
  101. TextField {
  102. id: devCode
  103. width: parent.width
  104. font.pixelSize: 25
  105. focus: false
  106. color: "#a3ffffff"
  107. background: Rectangle {
  108. color: "transparent" // 使TextField背景透明
  109. }
  110. placeholderText: qsTr("请输入设备Code")
  111. horizontalAlignment: Text.AlignLeft
  112. verticalAlignment: Text.AlignVCenter
  113. wrapMode: Text.NoWrap
  114. selectionColor: "#a300aaff"
  115. placeholderTextColor: "#60ffffff"
  116. bottomPadding: 10
  117. topPadding: 10
  118. rightPadding: 20
  119. leftPadding: 20
  120. renderType: Text.QtRendering
  121. font.styleName: "Regular"
  122. }
  123. }
  124. Item {
  125. Layout.row: 1
  126. Layout.column: 3
  127. Layout.columnSpan: 2
  128. Layout.fillWidth: true
  129. visible: bIsPowerUser
  130. }
  131. Label {
  132. Layout.row: 2
  133. Layout.column: 0
  134. text: qsTr("服务器地址:")
  135. horizontalAlignment: Text.AlignLeft
  136. verticalAlignment: Text.AlignVCenter
  137. color: "#ffffff"
  138. font.pixelSize: 25
  139. visible: bIsPowerUser
  140. }
  141. Rectangle {
  142. width: 400
  143. height: 50
  144. color: "#00ffffff"
  145. Layout.row: 2
  146. Layout.column: 1
  147. Layout.columnSpan: 2
  148. visible: bIsPowerUser
  149. Label {
  150. anchors.verticalCenter: parent.verticalCenter // 上下居中
  151. text: qsTr("http://")
  152. horizontalAlignment: Text.AlignLeft
  153. verticalAlignment: Text.AlignVCenter
  154. color: "#ffffff"
  155. font.pixelSize: 25
  156. }
  157. Rectangle {
  158. x: 80
  159. width: 320
  160. height: 50
  161. color: "#00ffffff"
  162. border.color: "#a3ffffff"
  163. border.width: 3
  164. radius: 10
  165. visible: bIsPowerUser
  166. TextField {
  167. id: serveraddr
  168. width: parent.width
  169. font.pixelSize: 25
  170. focus: false
  171. color: "#a3ffffff"
  172. background: Rectangle {
  173. color: "transparent" // 使TextField背景透明
  174. }
  175. placeholderText: qsTr("请输入域名或IP端口")
  176. horizontalAlignment: Text.AlignLeft
  177. verticalAlignment: Text.AlignVCenter
  178. wrapMode: Text.NoWrap
  179. selectionColor: "#a300aaff"
  180. placeholderTextColor: "#60ffffff"
  181. bottomPadding: 10
  182. topPadding: 10
  183. rightPadding: 20
  184. leftPadding: 20
  185. renderType: Text.QtRendering
  186. font.styleName: "Regular"
  187. }
  188. }
  189. }
  190. Label {
  191. Layout.row: 3
  192. Layout.column: 0
  193. text: qsTr("用户倒计时(s):")
  194. horizontalAlignment: Text.AlignLeft
  195. verticalAlignment: Text.AlignVCenter
  196. color: "#ffffff"
  197. font.pixelSize: 25
  198. visible: bIsPowerUser
  199. }
  200. Rectangle {
  201. width: 400
  202. height: 50
  203. color: "#00ffffff"
  204. border.color: "#a3ffffff"
  205. border.width: 3
  206. radius: 10
  207. Layout.row: 3
  208. Layout.column: 1
  209. Layout.columnSpan: 2
  210. visible: bIsPowerUser
  211. TextField {
  212. id: loginTimeout
  213. width: parent.width
  214. font.pixelSize: 25
  215. focus: false
  216. color: "#a3ffffff"
  217. background: Rectangle {
  218. color: "transparent" // 使TextField背景透明
  219. }
  220. horizontalAlignment: Text.AlignLeft
  221. verticalAlignment: Text.AlignVCenter
  222. wrapMode: Text.NoWrap
  223. selectionColor: "#a300aaff"
  224. placeholderTextColor: "#60ffffff"
  225. bottomPadding: 10
  226. topPadding: 10
  227. rightPadding: 20
  228. leftPadding: 20
  229. renderType: Text.QtRendering
  230. font.styleName: "Regular"
  231. placeholderText: "30-300"
  232. validator: IntValidator {
  233. bottom: 30 // 下限
  234. top: 300 // 上限
  235. }
  236. onTextChanged: {
  237. // 如果输入超出范围,清空输入
  238. if(loginTimeout.text && (parseInt(loginTimeout.text) > loginTimeout.validator.top))
  239. {
  240. loginTimeout.text = loginTimeout.validator.top.toString()
  241. }
  242. }
  243. // 监听焦点变化
  244. onFocusChanged: {
  245. if (!focus) { // 失去焦点时
  246. if(loginTimeout.text === "" || (parseInt(loginTimeout.text) < loginTimeout.validator.bottom))
  247. {
  248. loginTimeout.text = loginTimeout.validator.bottom.toString()
  249. }
  250. }
  251. }
  252. }
  253. }
  254. Label {
  255. Layout.row: 4
  256. Layout.column: 0
  257. text: qsTr("超时未关门报警(s):")
  258. horizontalAlignment: Text.AlignLeft
  259. verticalAlignment: Text.AlignVCenter
  260. color: "#ffffff"
  261. font.pixelSize: 25
  262. visible: bIsPowerUser
  263. }
  264. Rectangle {
  265. width: 400
  266. height: 50
  267. color: "#00ffffff"
  268. border.color: "#a3ffffff"
  269. border.width: 3
  270. radius: 10
  271. Layout.row: 4
  272. Layout.column: 1
  273. Layout.columnSpan: 2
  274. visible: bIsPowerUser
  275. TextField {
  276. id: lockTimeout
  277. width: parent.width
  278. font.pixelSize: 25
  279. focus: false
  280. color: "#a3ffffff"
  281. background: Rectangle {
  282. color: "transparent" // 使TextField背景透明
  283. }
  284. horizontalAlignment: Text.AlignLeft
  285. verticalAlignment: Text.AlignVCenter
  286. wrapMode: Text.NoWrap
  287. selectionColor: "#a300aaff"
  288. placeholderTextColor: "#60ffffff"
  289. bottomPadding: 10
  290. topPadding: 10
  291. rightPadding: 20
  292. leftPadding: 20
  293. renderType: Text.QtRendering
  294. font.styleName: "Regular"
  295. placeholderText: "30-300"
  296. validator: IntValidator {
  297. bottom: 10 // 下限 - FixMe: 600 10s为测试用
  298. top: 3600 // 上限
  299. }
  300. onTextChanged: {
  301. // 如果输入超出范围,清空输入
  302. if(lockTimeout.text && (parseInt(lockTimeout.text) > lockTimeout.validator.top))
  303. {
  304. lockTimeout.text = lockTimeout.validator.top.toString()
  305. }
  306. }
  307. // 监听焦点变化
  308. onFocusChanged: {
  309. if (!focus) { // 失去焦点时
  310. if(lockTimeout.text === "" || (parseInt(lockTimeout.text) < lockTimeout.validator.bottom))
  311. {
  312. lockTimeout.text = lockTimeout.validator.bottom.toString()
  313. }
  314. }
  315. }
  316. }
  317. }
  318. Item {
  319. Layout.row: 5
  320. Layout.column: 0
  321. height: 50
  322. visible: bIsPowerUser
  323. }
  324. Rectangle {
  325. width: 200
  326. height: 50
  327. color: "#00ffffff"
  328. Layout.row: 0
  329. Layout.column: 4
  330. visible: bIsPowerUser
  331. Label {
  332. id: rfidTitle
  333. color: "#ffffff"
  334. text: qsTr("RFID设置")
  335. font.pixelSize: 30
  336. horizontalAlignment: Text.AlignLeft
  337. verticalAlignment: Text.AlignVCenter
  338. font.underline: false
  339. visible: bIsPowerUser
  340. }
  341. Canvas {
  342. anchors.fill: parent
  343. visible: true
  344. onPaint: {
  345. var ctx = getContext("2d");
  346. ctx.lineWidth = 10; // 设置线的宽度
  347. ctx.strokeStyle = "skyblue"; // 设置线的颜色为白色
  348. ctx.beginPath();
  349. ctx.moveTo(0, 45); // 直线的起点
  350. ctx.lineTo(rfidTitle.width, 45); // 直线的终点
  351. ctx.stroke(); // 绘制直线
  352. }
  353. }
  354. }
  355. Label {
  356. Layout.row: 1
  357. Layout.column: 4
  358. text: qsTr("串口号:")
  359. horizontalAlignment: Text.AlignLeft
  360. verticalAlignment: Text.AlignVCenter
  361. color: "#ffffff"
  362. font.pixelSize: 25
  363. visible: bIsPowerUser
  364. }
  365. Rectangle {
  366. width: 400
  367. height: 50
  368. color: "#00ffffff"
  369. border.color: "#a3ffffff"
  370. border.width: 3
  371. radius: 10
  372. Layout.row: 1
  373. Layout.column: 5
  374. Layout.columnSpan: 2
  375. visible: bIsPowerUser
  376. ComboBox {
  377. id: rfidSerialPort
  378. width: 400
  379. height: 50
  380. model: pConfig.sserialPortList // 绑定到C++类的portList属性
  381. // 设置 ComboBox 的背景颜色
  382. background: Rectangle {
  383. color: "#002b7ae9" // 背景颜色
  384. border.color: "White"
  385. border.width: 1
  386. radius: 10 // 圆角
  387. }
  388. // 设置 ComboBox 的文本样式
  389. contentItem: Text {
  390. text: rfidSerialPort.displayText
  391. font.pixelSize: 25
  392. color: "white"
  393. verticalAlignment: Text.AlignVCenter
  394. }
  395. // 设置下拉箭头样式
  396. indicator: Image {
  397. x: rfidSerialPort.width - width - 10 // 箭头位置
  398. y: (rfidSerialPort.height - height) / 2
  399. width: 30
  400. height: 30
  401. source: "qrc:/png/down.png"
  402. }
  403. // 设置下拉框的样式
  404. popup: Popup {
  405. y: rfidSerialPort.height // 下拉框的位置
  406. width: rfidSerialPort.width // 下拉框的宽度
  407. implicitHeight: contentItem.implicitHeight // 自动高度
  408. padding: 1
  409. // 设置下拉框的背景颜色和透明度
  410. background: Rectangle {
  411. color: "#8a2b7ae9" // 下拉框背景颜色
  412. border.color: "White"
  413. border.width: 1
  414. radius: 10 // 圆角
  415. }
  416. // 设置下拉框的内容样式
  417. contentItem: ListView {
  418. clip: true
  419. implicitHeight: contentHeight
  420. model: rfidSerialPort.popup.visible ? rfidSerialPort.delegateModel : null
  421. currentIndex: rfidSerialPort.highlightedIndex
  422. }
  423. }
  424. // 设置下拉框每一项的样式
  425. delegate: ItemDelegate {
  426. width: rfidSerialPort.width
  427. text: modelData
  428. highlighted: rfidSerialPort.highlightedIndex === index
  429. font.pixelSize: 25
  430. // 设置每一项的背景颜色
  431. background: Rectangle {
  432. color: highlighted ? "skyblue" : "transparent" // 选中项的背景颜色
  433. opacity: 0.8 // 每一项的透明度
  434. }
  435. // 设置每一项的文本样式
  436. contentItem: Text {
  437. text: modelData
  438. color: highlighted ? "white" : "skyblue" // 选中项的文本颜色为白色
  439. font: parent.font
  440. verticalAlignment: Text.AlignVCenter
  441. }
  442. }
  443. // 当选择变化时
  444. onCurrentIndexChanged: {
  445. if (lockPortSelection === currentIndex) {
  446. rfidSerialPort.currentIndex = rfidPortSelection;
  447. } else {
  448. // 否则更新当前选择
  449. rfidPortSelection = currentIndex;
  450. }
  451. }
  452. }
  453. }
  454. Button {
  455. id: checkRfidSerialPort
  456. implicitWidth: 120
  457. height: 40
  458. Layout.row: 1
  459. Layout.column: 7
  460. visible: false
  461. background: Rectangle {
  462. color: "#00b2ff" // 设置背景为透明
  463. radius: 10 // 可选,设置圆角
  464. }
  465. text: qsTr("自动搜索")
  466. font.pixelSize: 25
  467. palette.buttonText: "white" // 设置字体颜色为绿色
  468. Connections {
  469. target: checkRfidSerialPort
  470. onClicked: {
  471. }
  472. }
  473. }
  474. Label {
  475. Layout.row: 2
  476. Layout.column: 4
  477. text: qsTr("发射功率:")
  478. horizontalAlignment: Text.AlignLeft
  479. verticalAlignment: Text.AlignVCenter
  480. color: "#ffffff"
  481. font.pixelSize: 25
  482. visible: bIsPowerUser
  483. }
  484. Rectangle {
  485. width: 400
  486. height: 50
  487. color: "#00ffffff"
  488. border.color: "#a3ffffff"
  489. border.width: 3
  490. radius: 10
  491. Layout.row: 2
  492. Layout.column: 5
  493. Layout.columnSpan: 2
  494. visible: bIsPowerUser
  495. TextField {
  496. id: rfidPower
  497. width: parent.width
  498. font.pixelSize: 25
  499. focus: false
  500. color: "#a3ffffff"
  501. background: Rectangle {
  502. color: "transparent" // 使TextField背景透明
  503. }
  504. horizontalAlignment: Text.AlignLeft
  505. verticalAlignment: Text.AlignVCenter
  506. wrapMode: Text.NoWrap
  507. selectionColor: "#a300aaff"
  508. placeholderTextColor: "#60ffffff"
  509. bottomPadding: 10
  510. topPadding: 10
  511. rightPadding: 20
  512. leftPadding: 20
  513. renderType: Text.QtRendering
  514. font.styleName: "Regular"
  515. placeholderText: "1000-2000"
  516. validator: IntValidator {
  517. bottom: 1000 // 下限
  518. top: 2000 // 上限
  519. }
  520. onTextChanged: {
  521. // 如果输入超出范围,清空输入
  522. if(rfidPower.text && (parseInt(rfidPower.text) > rfidPower.validator.top))
  523. {
  524. rfidPower.text = rfidPower.validator.top.toString()
  525. }
  526. }
  527. // 监听焦点变化
  528. onFocusChanged: {
  529. if (!focus) { // 失去焦点时
  530. if(rfidPower.text === "" || (parseInt(rfidPower.text) < rfidPower.validator.bottom))
  531. {
  532. rfidPower.text = rfidPower.validator.bottom.toString()
  533. }
  534. }
  535. }
  536. }
  537. }
  538. Label {
  539. Layout.row: 3
  540. Layout.column: 4
  541. text: qsTr("读取时间(ms):")
  542. horizontalAlignment: Text.AlignLeft
  543. verticalAlignment: Text.AlignVCenter
  544. color: "#ffffff"
  545. font.pixelSize: 25
  546. visible: bIsPowerUser
  547. }
  548. Rectangle {
  549. width: 400
  550. height: 50
  551. color: "#00ffffff"
  552. border.color: "#a3ffffff"
  553. border.width: 3
  554. radius: 10
  555. Layout.row: 3
  556. Layout.column: 5
  557. Layout.columnSpan: 2
  558. visible: bIsPowerUser
  559. TextField {
  560. id: rfidWorkTime
  561. width: parent.width
  562. font.pixelSize: 25
  563. focus: false
  564. color: "#a3ffffff"
  565. background: Rectangle {
  566. color: "transparent" // 使TextField背景透明
  567. }
  568. horizontalAlignment: Text.AlignLeft
  569. verticalAlignment: Text.AlignVCenter
  570. wrapMode: Text.NoWrap
  571. selectionColor: "#a300aaff"
  572. placeholderTextColor: "#60ffffff"
  573. bottomPadding: 10
  574. topPadding: 10
  575. rightPadding: 20
  576. leftPadding: 20
  577. renderType: Text.QtRendering
  578. font.styleName: "Regular"
  579. placeholderText: "5000-30000"
  580. validator: IntValidator {
  581. bottom: 5000 // 下限
  582. top: 30000 // 上限
  583. }
  584. onTextChanged: {
  585. // 如果输入超出范围,清空输入
  586. if(rfidWorkTime.text && (parseInt(rfidWorkTime.text) > rfidWorkTime.validator.top))
  587. {
  588. rfidWorkTime.text = rfidWorkTime.validator.top.toString()
  589. }
  590. }
  591. // 监听焦点变化
  592. onFocusChanged: {
  593. if (!focus) { // 失去焦点时
  594. if(rfidWorkTime.text === "" || (parseInt(rfidWorkTime.text) < rfidWorkTime.validator.bottom))
  595. {
  596. rfidWorkTime.text = rfidWorkTime.validator.bottom.toString()
  597. }
  598. }
  599. }
  600. }
  601. }
  602. Rectangle {
  603. id : addFingerRect
  604. width: 200
  605. height: 50
  606. color: "#00ffffff"
  607. Layout.row: 5
  608. Layout.column: 0
  609. visible: fingerVisible
  610. Label {
  611. id: fingerTitle
  612. color: "#ffffff"
  613. text: qsTr("指纹设置")
  614. font.pixelSize: 30
  615. horizontalAlignment: Text.AlignLeft
  616. verticalAlignment: Text.AlignVCenter
  617. font.underline: false
  618. }
  619. Canvas {
  620. anchors.fill: parent
  621. visible: fingerVisible
  622. onPaint: {
  623. var ctx = getContext("2d");
  624. ctx.lineWidth = 10; // 设置线的宽度
  625. ctx.strokeStyle = "skyblue"; // 设置线的颜色为白色
  626. ctx.beginPath();
  627. ctx.moveTo(0, 45); // 直线的起点
  628. ctx.lineTo(fingerTitle.width, 45); // 直线的终点
  629. ctx.stroke(); // 绘制直线
  630. }
  631. }
  632. }
  633. Label {
  634. id : addFingerLabel
  635. Layout.row: 6
  636. Layout.column: 0
  637. text: qsTr("指纹录入:")
  638. visible: false
  639. horizontalAlignment: Text.AlignLeft
  640. verticalAlignment: Text.AlignVCenter
  641. color: "#ffffff"
  642. font.pixelSize: 25
  643. }
  644. Button {
  645. id: addFingerButton
  646. implicitWidth: 120
  647. height: 40
  648. Layout.row: 6
  649. Layout.column: 1
  650. anchors.left: addFingerRect.left
  651. background: Rectangle {
  652. color: "#00b2ff" // 设置背景为透明
  653. radius: 10 // 可选,设置圆角
  654. }
  655. visible: fingerVisible
  656. text: qsTr("添加指纹")
  657. font.pixelSize: 25
  658. palette.buttonText: "white" // 设置字体颜色为绿色
  659. Connections {
  660. target: addFingerButton
  661. onClicked: {
  662. // if(pConfig.sfingerStat === true)
  663. // {
  664. // if(addfinger.visible === false)
  665. // {
  666. // set_addFinger_timeout(false);
  667. // addfingerImage = "qrc:/png/fingerNotice.png";
  668. // addfingerNotice = "请第1次按下指纹";
  669. // addfingercount = 0;
  670. // signal_addfinger(true);
  671. // addfinger.visible = true;
  672. // addfinger.focus = true;
  673. // }
  674. // }
  675. // else{
  676. // set_addFinger_timeout(true);
  677. // addfingerImage = "qrc:/png/error.png"
  678. // addfingerNotice = "指纹模组未连接"
  679. // addfinger.visible = true;
  680. // }
  681. if ( Object.keys(userHand).length >= 3)
  682. {
  683. infoPromptBox.title("提示");
  684. infoPromptBox.message("最多只能添加三个指纹数据");
  685. infoPromptBox.button_clear();
  686. infoPromptBox.button_push("#055eb3", "确定", null, null);
  687. infoPromptBox.show();
  688. }
  689. else
  690. {
  691. add_user_finger();
  692. }
  693. }
  694. }
  695. }
  696. Rectangle {
  697. Layout.row: 7
  698. Layout.column: 0
  699. Layout.rowSpan: 2
  700. Layout.columnSpan: 3
  701. ListModel {
  702. id: setview_itemModel
  703. }
  704. GridLayout {
  705. anchors.fill: parent
  706. rows: 3
  707. columns: 2
  708. rowSpacing: 20
  709. columnSpacing: 20
  710. Repeater {
  711. model: setview_itemModel
  712. Label {
  713. Layout.row: index
  714. Layout.column: 0
  715. anchors.right: addFingerRect.right
  716. text: model.title
  717. // horizontalAlignment: Text.AlignLeft
  718. verticalAlignment: Text.AlignVCenter
  719. color: "#ffffff"
  720. font.pixelSize: 25
  721. leftPadding: 0
  722. }
  723. }
  724. Repeater {
  725. model: setview_itemModel
  726. Button {
  727. implicitWidth: 80
  728. height: 40
  729. Layout.row: index
  730. Layout.column: 1
  731. anchors.left: addFingerRect.right
  732. background: Rectangle {
  733. color: "red"
  734. radius: 10
  735. }
  736. visible: fingerVisible
  737. text: qsTr("删除")
  738. font.pixelSize: 25
  739. palette.buttonText: "white"
  740. onClicked: {
  741. var groupCode = model.group;
  742. var groutArray = userHand[groupCode];
  743. var inText = groutArray.length > 0 ? "?recordIds=" : "";
  744. for (var i = 0; i < groutArray.length; ++i)
  745. {
  746. inText += groutArray[i];
  747. inText += (i !== groutArray.length - 1) ? "," : "";
  748. }
  749. interactiveCore.appendTask(
  750. InteractiveTask.TypeHttpPost_deleteSysUserCharacteristicByRecordIds, inText,
  751. (json)=>{
  752. var jsonObjData = JSON.parse(json);
  753. if (jsonObjData.code === 200) {
  754. infoPromptBox.title("提示");
  755. infoPromptBox.message("指纹特征删除成功");
  756. infoPromptBox.button_clear();
  757. infoPromptBox.button_push("#055eb3", "确定", null, null);
  758. infoPromptBox.show();
  759. refresh_feature_view();
  760. }
  761. else
  762. {
  763. infoPromptBox.title("提示");
  764. infoPromptBox.message(jsonObjData.msg);
  765. infoPromptBox.button_clear();
  766. infoPromptBox.button_push("#055eb3", "确定", null, null);
  767. infoPromptBox.show();
  768. }
  769. });
  770. }
  771. }
  772. }
  773. }
  774. }
  775. Rectangle {
  776. id: addFacialRect
  777. width: 200
  778. height: 50
  779. color: "#00ffffff"
  780. Layout.row: 5
  781. Layout.column: 2
  782. visible: fingerVisible
  783. Label {
  784. id: facialTitle
  785. color: "#ffffff"
  786. text: qsTr("人脸设置")
  787. font.pixelSize: 30
  788. horizontalAlignment: Text.AlignLeft
  789. verticalAlignment: Text.AlignVCenter
  790. font.underline: false
  791. }
  792. Canvas {
  793. anchors.fill: parent
  794. visible: fingerVisible
  795. onPaint: {
  796. var ctx = getContext("2d");
  797. ctx.lineWidth = 10; // 设置线的宽度
  798. ctx.strokeStyle = "skyblue"; // 设置线的颜色为白色
  799. ctx.beginPath();
  800. ctx.moveTo(0, 45); // 直线的起点
  801. ctx.lineTo(fingerTitle.width, 45); // 直线的终点
  802. ctx.stroke(); // 绘制直线
  803. }
  804. }
  805. }
  806. Label {
  807. id: addFacialLabel
  808. Layout.row: 6
  809. Layout.column: 2
  810. text: qsTr("人脸录入:")
  811. visible: false
  812. horizontalAlignment: Text.AlignLeft
  813. verticalAlignment: Text.AlignVCenter
  814. color: "#ffffff"
  815. font.pixelSize: 25
  816. }
  817. Button {
  818. id: addFacialButton
  819. implicitWidth: 120
  820. height: 40
  821. Layout.row: 6
  822. Layout.column: 3
  823. anchors.left: addFacialRect.left
  824. background: Rectangle {
  825. color: "#00b2ff" // 设置背景为透明
  826. radius: 10 // 可选,设置圆角
  827. }
  828. visible: fingerVisible
  829. text: qsTr("人脸录入")
  830. font.pixelSize: 25
  831. palette.buttonText: "white" // 设置字体颜色为绿色
  832. Connections {
  833. target: addFacialButton
  834. onClicked: {
  835. facialRecognition.visible = true;
  836. setView.visible = false;
  837. }
  838. }
  839. }
  840. Rectangle {
  841. width: 200
  842. height: 50
  843. color: "#00ffffff"
  844. Layout.row: 5
  845. Layout.column: 4
  846. visible: bIsPowerUser
  847. Label {
  848. id: lockTitle
  849. color: "#ffffff"
  850. text: qsTr("控制板设置")
  851. font.pixelSize: 30
  852. horizontalAlignment: Text.AlignLeft
  853. verticalAlignment: Text.AlignVCenter
  854. font.underline: false
  855. }
  856. Canvas {
  857. anchors.fill: parent
  858. visible: true
  859. onPaint: {
  860. var ctx = getContext("2d");
  861. ctx.lineWidth = 10; // 设置线的宽度
  862. ctx.strokeStyle = "skyblue"; // 设置线的颜色为白色
  863. ctx.beginPath();
  864. ctx.moveTo(0, 45); // 直线的起点
  865. ctx.lineTo(lockTitle.width, 45); // 直线的终点
  866. ctx.stroke(); // 绘制直线
  867. }
  868. }
  869. }
  870. Label {
  871. Layout.row: 6
  872. Layout.column: 4
  873. text: qsTr("串口号:")
  874. horizontalAlignment: Text.AlignLeft
  875. verticalAlignment: Text.AlignVCenter
  876. color: "#ffffff"
  877. font.pixelSize: 25
  878. visible: bIsPowerUser
  879. }
  880. Rectangle {
  881. width: 400
  882. height: 50
  883. color: "#00ffffff"
  884. border.color: "#a3ffffff"
  885. border.width: 3
  886. radius: 10
  887. Layout.row: 6
  888. Layout.column: 5
  889. Layout.columnSpan: 2
  890. visible: bIsPowerUser
  891. ComboBox {
  892. id: lockSerialPort
  893. width: 400
  894. height: 50
  895. model: pConfig.sserialPortList // 绑定到C++类的portList属性
  896. // 设置 ComboBox 的背景颜色
  897. background: Rectangle {
  898. color: "#002b7ae9" // 背景颜色
  899. border.color: "White"
  900. border.width: 1
  901. radius: 10 // 圆角
  902. }
  903. // 设置 ComboBox 的文本样式
  904. contentItem: Text {
  905. text: lockSerialPort.displayText
  906. font.pixelSize: 25
  907. color: "white"
  908. verticalAlignment: Text.AlignVCenter
  909. }
  910. // 设置下拉箭头样式
  911. indicator: Image {
  912. x: lockSerialPort.width - width - 10 // 箭头位置
  913. y: (lockSerialPort.height - height) / 2
  914. width: 30
  915. height: 30
  916. source: "qrc:/png/down.png"
  917. }
  918. // 设置下拉框的样式
  919. popup: Popup {
  920. y: lockSerialPort.height // 下拉框的位置
  921. width: lockSerialPort.width // 下拉框的宽度
  922. implicitHeight: contentItem.implicitHeight // 自动高度
  923. padding: 1
  924. // 设置下拉框的背景颜色和透明度
  925. background: Rectangle {
  926. color: "#8a2b7ae9" // 下拉框背景颜色
  927. border.color: "White"
  928. border.width: 1
  929. radius: 10 // 圆角
  930. }
  931. // 设置下拉框的内容样式
  932. contentItem: ListView {
  933. clip: true
  934. implicitHeight: contentHeight
  935. model: lockSerialPort.popup.visible ? lockSerialPort.delegateModel : null
  936. currentIndex: lockSerialPort.highlightedIndex
  937. }
  938. }
  939. // 设置下拉框每一项的样式
  940. delegate: ItemDelegate {
  941. width: lockSerialPort.width
  942. text: modelData
  943. highlighted: lockSerialPort.highlightedIndex === index
  944. font.pixelSize: 25
  945. // 设置每一项的背景颜色
  946. background: Rectangle {
  947. color: highlighted ? "skyblue" : "transparent" // 选中项的背景颜色
  948. opacity: 0.8 // 每一项的透明度
  949. }
  950. // 设置每一项的文本样式
  951. contentItem: Text {
  952. text: modelData
  953. color: highlighted ? "white" : "skyblue" // 选中项的文本颜色为白色
  954. font: parent.font
  955. verticalAlignment: Text.AlignVCenter
  956. }
  957. }
  958. // 当选择变化时
  959. onCurrentIndexChanged: {
  960. if (rfidPortSelection === currentIndex) {
  961. lockSerialPort.currentIndex = lockPortSelection;
  962. } else {
  963. // 否则更新当前选择
  964. lockPortSelection = currentIndex;
  965. }
  966. }
  967. }
  968. }
  969. Button {
  970. id: checkLockSerialPort
  971. implicitWidth: 120
  972. height: 40
  973. Layout.row: 7
  974. Layout.column: 7
  975. visible: false
  976. background: Rectangle {
  977. color: "#00b2ff" // 设置背景为透明
  978. radius: 10 // 可选,设置圆角
  979. }
  980. text: qsTr("自动搜索")
  981. font.pixelSize: 25
  982. palette.buttonText: "white" // 设置字体颜色为绿色
  983. Connections {
  984. target: checkLockSerialPort
  985. onClicked: {
  986. }
  987. }
  988. }
  989. Item {
  990. Layout.row: 1
  991. Layout.column: 8
  992. Layout.fillWidth: true // 填充可用高度
  993. }
  994. Item {
  995. Layout.row: 19
  996. Layout.column: 0
  997. Layout.fillHeight: true // 填充可用高度
  998. }
  999. }
  1000. }
  1001. Dialog {
  1002. id: dialog
  1003. title: "操作确认"
  1004. x: parent.width / 2 - width / 2
  1005. y: parent.height / 2 - height / 2
  1006. width: 600
  1007. height: 400
  1008. clip: true
  1009. modal: true
  1010. // 自定义背景(带圆角)
  1011. background: Rectangle {
  1012. color: "white"
  1013. clip: true
  1014. }
  1015. // 自定义标题栏
  1016. header: Rectangle {
  1017. x: 0
  1018. y: 0
  1019. width: parent.width
  1020. height: 50 // 设置标题栏高度
  1021. color: "#ff3968e9" // 设置标题栏背景色
  1022. // 标题文本
  1023. Text {
  1024. x: 20
  1025. y: 0
  1026. width: 80
  1027. height: 50 // 设置标题栏高度
  1028. text: dialog.title
  1029. font.pixelSize: 25
  1030. horizontalAlignment: Text.AlignLeft
  1031. verticalAlignment: Text.AlignVCenter
  1032. color: "white"
  1033. }
  1034. }
  1035. contentItem: Rectangle {
  1036. x: 0
  1037. y: 0
  1038. width: parent.width
  1039. height: 200
  1040. color: "white"
  1041. Text {
  1042. width: parent.width
  1043. height: 200
  1044. text: "确认保存已设置参数?"
  1045. font.pixelSize: 30
  1046. horizontalAlignment: Text.AlignHCenter
  1047. verticalAlignment: Text.AlignVCenter
  1048. }
  1049. }
  1050. // 自定义 DialogButtonBox
  1051. DialogButtonBox {
  1052. id: buttonBox
  1053. x: 0
  1054. y: 250
  1055. width: parent.width
  1056. height: 100
  1057. // 自定义按钮
  1058. Button {
  1059. implicitWidth: 120
  1060. implicitHeight: 50
  1061. text: "确认"
  1062. background: Rectangle {
  1063. color: "green"
  1064. radius: 5
  1065. }
  1066. contentItem: Text {
  1067. text: parent.text
  1068. font.pixelSize: 30
  1069. color: "white"
  1070. horizontalAlignment: Text.AlignHCenter
  1071. verticalAlignment: Text.AlignVCenter
  1072. }
  1073. onClicked: {
  1074. // if(button_return.visible === true)
  1075. // {
  1076. // setView.visible = false
  1077. // button_return.visible = false
  1078. // }
  1079. save_configParam()
  1080. console.log("Dialog accepted")
  1081. dialog.close()
  1082. }
  1083. }
  1084. Button {
  1085. implicitWidth: 120
  1086. implicitHeight: 50
  1087. text: "取消"
  1088. background: Rectangle {
  1089. color: "red"
  1090. radius: 5
  1091. }
  1092. contentItem: Text {
  1093. text: parent.text
  1094. font.pixelSize: 30
  1095. color: "white"
  1096. horizontalAlignment: Text.AlignHCenter
  1097. verticalAlignment: Text.AlignVCenter
  1098. }
  1099. onClicked: {
  1100. console.log("Dialog rejected")
  1101. dialog.reject()
  1102. }
  1103. }
  1104. }
  1105. }
  1106. Dialog {
  1107. id: setview_dialog_exit
  1108. title: "操作确认"
  1109. x: parent.width / 2 - width / 2
  1110. y: parent.height / 2 - height / 2
  1111. width: 600
  1112. height: 400
  1113. clip: true
  1114. modal: true
  1115. // 自定义背景(带圆角)
  1116. background: Rectangle {
  1117. color: "white"
  1118. clip: true
  1119. }
  1120. // 自定义标题栏
  1121. header: Rectangle {
  1122. x: 0
  1123. y: 0
  1124. width: parent.width
  1125. height: 50 // 设置标题栏高度
  1126. color: "#ff3968e9" // 设置标题栏背景色
  1127. // 标题文本
  1128. Text {
  1129. x: 20
  1130. y: 0
  1131. width: 80
  1132. height: 50 // 设置标题栏高度
  1133. text: setview_dialog_exit.title
  1134. font.pixelSize: 25
  1135. horizontalAlignment: Text.AlignLeft
  1136. verticalAlignment: Text.AlignVCenter
  1137. color: "white"
  1138. }
  1139. }
  1140. contentItem: Rectangle {
  1141. x: 0
  1142. y: 0
  1143. width: parent.width
  1144. height: 200
  1145. color: "white"
  1146. Text {
  1147. width: parent.width
  1148. height: 200
  1149. text: "确定要退出登录吗?"
  1150. font.pixelSize: 30
  1151. horizontalAlignment: Text.AlignHCenter
  1152. verticalAlignment: Text.AlignVCenter
  1153. }
  1154. }
  1155. // 自定义 DialogButtonBox
  1156. DialogButtonBox {
  1157. id: setview_dialog_buttonBox
  1158. x: 0
  1159. y: 250
  1160. width: parent.width
  1161. height: 100
  1162. // 自定义按钮
  1163. Button {
  1164. implicitWidth: 120
  1165. implicitHeight: 50
  1166. text: "确认"
  1167. background: Rectangle {
  1168. color: "green"
  1169. radius: 5
  1170. }
  1171. contentItem: Text {
  1172. text: parent.text
  1173. font.pixelSize: 30
  1174. color: "white"
  1175. horizontalAlignment: Text.AlignHCenter
  1176. verticalAlignment: Text.AlignVCenter
  1177. }
  1178. onClicked: {
  1179. // window.exitWork();
  1180. mainScreen.logout();
  1181. setview_dialog_exit.close();
  1182. }
  1183. }
  1184. Button {
  1185. implicitWidth: 120
  1186. implicitHeight: 50
  1187. text: "取消"
  1188. background: Rectangle {
  1189. color: "red"
  1190. radius: 5
  1191. }
  1192. contentItem: Text {
  1193. text: parent.text
  1194. font.pixelSize: 30
  1195. color: "white"
  1196. horizontalAlignment: Text.AlignHCenter
  1197. verticalAlignment: Text.AlignVCenter
  1198. }
  1199. onClicked: {
  1200. setview_dialog_exit.reject();
  1201. }
  1202. }
  1203. }
  1204. }
  1205. Rectangle {
  1206. id: addfinger
  1207. x: (mainScreen.width - width) / 2 - parent.x
  1208. y: (mainScreen.height - height) / 2 - parent.y
  1209. width: 350
  1210. height: 350
  1211. visible: false
  1212. color: "#980e57ea"
  1213. radius: 20
  1214. // property int currentIndex; // 当前录入次数
  1215. // property var currentGroup; // 当前组名称
  1216. // property var currentArray:[]; // 当前录入成功的指纹数组
  1217. // 强制保持焦点
  1218. onFocusChanged: {
  1219. if(addfinger.visible === true)
  1220. {
  1221. if (!focus) {
  1222. forceActiveFocus()
  1223. }
  1224. }
  1225. }
  1226. Column {
  1227. x: 0
  1228. y: 0
  1229. width: 350
  1230. height: 350
  1231. visible: true
  1232. spacing: 30
  1233. padding: 0
  1234. topPadding: 46
  1235. Image {
  1236. width: 200
  1237. height: 200
  1238. opacity: 0.5
  1239. anchors.horizontalCenter: parent.horizontalCenter
  1240. source: addfingerImage
  1241. }
  1242. Label {
  1243. id: errorNotice
  1244. anchors.horizontalCenter: parent.horizontalCenter
  1245. color: "#9affffff"
  1246. text: addfingerNotice
  1247. font.pixelSize: 30
  1248. horizontalAlignment: Text.AlignHCenter
  1249. verticalAlignment: Text.AlignVCenter
  1250. font.bold: true
  1251. }
  1252. }
  1253. }
  1254. // Button {
  1255. // id: button_return
  1256. // x: 1168
  1257. // y: 835
  1258. // visible: false
  1259. // width: 192
  1260. // height: 75
  1261. // background: Rectangle {
  1262. // color: "#055eb3" // 设置背景为透明
  1263. // radius: 10 // 可选,设置圆角
  1264. // }
  1265. // text: qsTr("返回")
  1266. // font.pixelSize: 30
  1267. // palette.buttonText: "white" // 设置字体颜色为绿色
  1268. // Connections {
  1269. // target: button_return
  1270. // onClicked: {
  1271. // setView.visible = false;
  1272. // button_return.visible = false
  1273. // }
  1274. // }
  1275. // }
  1276. Button {
  1277. id: button_save
  1278. x: 1168
  1279. y: 835
  1280. width: 192
  1281. height: 75
  1282. background: Rectangle {
  1283. color: "#ff0000" // 设置背景为透明
  1284. radius: 10 // 可选,设置圆角
  1285. }
  1286. text: qsTr("保存")
  1287. font.pixelSize: 30
  1288. palette.buttonText: "white" // 设置字体颜色为绿色
  1289. Connections {
  1290. target: button_save
  1291. onClicked: {
  1292. dialog.open()
  1293. }
  1294. }
  1295. }
  1296. // 退出
  1297. Button {
  1298. id: set_view_button_exit
  1299. x: 1408
  1300. y: 835
  1301. width: 192
  1302. height: 75
  1303. background: Rectangle {
  1304. color: "#055eb3" // 设置背景为透明
  1305. radius: 10 // 可选,设置圆角
  1306. }
  1307. text: qsTr("退出登录")
  1308. font.pixelSize: 30
  1309. palette.buttonText: "white" // 设置字体颜色为绿色
  1310. Connections {
  1311. target: set_view_button_exit
  1312. onClicked: {
  1313. setview_dialog_exit.open();
  1314. }
  1315. }
  1316. }
  1317. function load_configParam(stat)
  1318. {
  1319. devCode.text = pConfig.sdevUuid;
  1320. serveraddr.text = pConfig.shttpHost;
  1321. loginTimeout.text = pConfig.sloginTimeout.toString();
  1322. lockTimeout.text = pConfig.slockCloseTimeout.toString();
  1323. rfidPower.text = pConfig.srfidPower.toString();
  1324. rfidWorkTime.text = pConfig.srfidWorkTime.toString();
  1325. for (var i = 0; i < rfidSerialPort.model.length; i++) {
  1326. if (rfidSerialPort.model[i] === pConfig.srfidPort) {
  1327. // 如果值存在,设置选中项
  1328. rfidSerialPort.currentIndex = i;
  1329. rfidPortSelection = i;
  1330. }
  1331. }
  1332. for (i = 0; i < lockSerialPort.model.length; i++) {
  1333. if (lockSerialPort.model[i] === pConfig.slockPort) {
  1334. // 如果值存在,设置选中项
  1335. lockSerialPort.currentIndex = i;
  1336. lockPortSelection = i;
  1337. }
  1338. }
  1339. if(stat === true)
  1340. {
  1341. button_return.visible = true
  1342. }
  1343. }
  1344. function save_configParam()
  1345. {
  1346. pConfig.sdevUuid = devCode.text;
  1347. pConfig.shttpHost = serveraddr.text;
  1348. pConfig.sloginTimeout = parseInt(loginTimeout.text)
  1349. pConfig.slockCloseTimeout = parseInt(lockTimeout.text)
  1350. pConfig.srfidPower = parseInt(rfidPower.text)
  1351. pConfig.srfidWorkTime = parseInt(rfidWorkTime.text)
  1352. pConfig.srfidPort = rfidSerialPort.currentText;
  1353. pConfig.slockPort = lockSerialPort.currentText;
  1354. signal_saveConfig();
  1355. }
  1356. function slot_addFinger_act(stat)
  1357. {
  1358. if(stat === true)
  1359. {
  1360. if(addfingercount < 2)
  1361. {
  1362. set_addFinger_timeout(false);
  1363. addfingerImage = "qrc:/png/fingerNotice.png";
  1364. addfingercount++;
  1365. addfingerNotice = "请第" + (addfingercount + 1) + "次按下指纹";
  1366. signal_addfinger(true);
  1367. }
  1368. else{
  1369. set_addFinger_timeout(true);
  1370. addfingerImage = "qrc:/png/fingerNotice.png";
  1371. addfingerNotice = "指纹添加完成";
  1372. }
  1373. }
  1374. else{
  1375. set_addFinger_timeout(true);
  1376. addfingerImage = "qrc:/png/error.png";
  1377. addfingerNotice = "指纹添加失败";
  1378. }
  1379. }
  1380. function set_addFinger_timeout(finish)
  1381. {
  1382. if(finish === false)
  1383. {
  1384. addfingerTimeout = 30;
  1385. }
  1386. else{
  1387. addfingerTimeout = 3;
  1388. }
  1389. }
  1390. Timer {
  1391. interval: 1000
  1392. running: true
  1393. repeat: true
  1394. onTriggered: {
  1395. if(addfingerTimeout > 0)
  1396. {
  1397. addfingerTimeout--;
  1398. }
  1399. else{
  1400. if(addfinger.visible === true)
  1401. {
  1402. signal_addfinger(false);
  1403. addfinger.focus = false;
  1404. addfinger.visible = false;
  1405. addfingercount = 0;
  1406. cardID = "";
  1407. }
  1408. }
  1409. }
  1410. }
  1411. Label {
  1412. x: 400
  1413. id: setview_label_notice
  1414. anchors.bottom: setviewbackspace.bottom
  1415. anchors.bottomMargin: 100
  1416. color: "#ffffff"
  1417. text: qsTr("请连续按压采集三次,中途不要更换手指")
  1418. font.pixelSize: 30
  1419. horizontalAlignment: Text.AlignHCenter
  1420. verticalAlignment: Text.AlignVCenter
  1421. font.bold: true
  1422. visible: false
  1423. }
  1424. // 添加指纹
  1425. property int currentIndex: 0;
  1426. property var currentArray: [];
  1427. property var currentGroup: string("分组1");
  1428. function add_user_finger()
  1429. {
  1430. currentIndex = 0;
  1431. currentArray = [];
  1432. currentGroup = proThread.getUuid();
  1433. // 设置取消回调(确保录入中途取消可以正确删除指纹)
  1434. hangPromptBox.setCancelCallBack(
  1435. ()=>{
  1436. setview_label_notice.visible = false;
  1437. if (currentArray.length > 0 && currentIndex < 3)
  1438. {
  1439. var inText = currentArray.length > 0 ? "?recordIds=" : "";
  1440. for (var i = 0; i < currentArray.length; ++i)
  1441. {
  1442. inText += currentArray[i];
  1443. inText += (i !== currentArray.length - 1) ? "," : "";
  1444. }
  1445. interactiveCore.appendTask(
  1446. InteractiveTask.TypeHttpPost_deleteSysUserCharacteristicByRecordIds, inText,
  1447. (json)=>{
  1448. var jsonObjData = JSON.parse(json);
  1449. if (jsonObjData.code === 200) {
  1450. refresh_feature_view();
  1451. }
  1452. else
  1453. {
  1454. infoPromptBox.title("指纹特征删除失败");
  1455. infoPromptBox.message(jsonObjData.msg);
  1456. infoPromptBox.button_clear();
  1457. infoPromptBox.button_push("#055eb3", "确定", null, null);
  1458. infoPromptBox.show();
  1459. }
  1460. });
  1461. }
  1462. }, null);
  1463. setview_label_notice.visible = true;
  1464. // 显示
  1465. hangPromptBox.show();
  1466. hangPromptBox.message("请按下手指");
  1467. hangPromptBox.urlIcon("qrc:/png/fingerNotice.png");
  1468. interactiveHand.setFingerImageAppearCallBack(
  1469. (url)=>{
  1470. interactiveHand.fingerImageStop();
  1471. hangPromptBox.urlIcon("qrc:/png/fingerNotice.png");
  1472. interactiveCore.appendTask(
  1473. InteractiveTask.TypeHttpPost_insertUserFingerprintDat, currentGroup, (json)=>{
  1474. var jsonObjRoot = JSON.parse(json);
  1475. if (jsonObjRoot.code === 200)
  1476. {
  1477. currentIndex++;
  1478. currentArray.push(jsonObjRoot.data);
  1479. if (currentIndex === 1)
  1480. {
  1481. interactiveHand.fingerImagePlay();
  1482. hangPromptBox.message("您已采集1次");
  1483. }
  1484. else if (currentIndex === 2)
  1485. {
  1486. interactiveHand.fingerImagePlay();
  1487. hangPromptBox.message("您已采集2次");
  1488. }
  1489. else if (currentIndex >= 3) {
  1490. hangPromptBox.message("录入成功");
  1491. refresh_feature_view();
  1492. // 延时等待
  1493. interactiveCore.appendTask(
  1494. InteractiveTask.TypeViewWait, 3000, ()=>{
  1495. hangPromptBox.hide();
  1496. setview_label_notice.visible = false;
  1497. });
  1498. }
  1499. }
  1500. else {
  1501. hangPromptBox.urlIcon("qrc:/png/error.png");
  1502. hangPromptBox.message(jsonObjRoot.msg);
  1503. // 延时等待
  1504. interactiveCore.appendTask(
  1505. InteractiveTask.TypeViewWait, 3000, ()=>{
  1506. hangPromptBox.urlIcon("qrc:/png/error.png");
  1507. if (currentArray.length > 0)
  1508. {
  1509. var inText = currentArray.length > 0 ? "?recordIds=" : "";
  1510. for (var i = 0; i < currentArray.length; ++i)
  1511. {
  1512. inText += currentArray[i];
  1513. inText += (i !== currentArray.length - 1) ? "," : "";
  1514. }
  1515. interactiveCore.appendTask(
  1516. InteractiveTask.TypeHttpPost_deleteSysUserCharacteristicByRecordIds, inText,
  1517. (json)=>{
  1518. var jsonObjData = JSON.parse(json);
  1519. if (jsonObjData.code === 200) {
  1520. }
  1521. else
  1522. {
  1523. infoPromptBox.title("指纹特征删除失败");
  1524. infoPromptBox.message(jsonObjData.msg);
  1525. infoPromptBox.button_clear();
  1526. infoPromptBox.button_push("#055eb3", "确定", null, null);
  1527. infoPromptBox.show();
  1528. }
  1529. });
  1530. }
  1531. hangPromptBox.urlIcon("qrc:/png/fingerNotice.png");
  1532. hangPromptBox.message("请按下指纹");
  1533. interactiveHand.fingerImagePlay();
  1534. currentIndex = 0;
  1535. });
  1536. }
  1537. });
  1538. });
  1539. interactiveHand.fingerImagePlay();
  1540. }
  1541. // 刷新人员特征视图
  1542. function refresh_feature_view()
  1543. {
  1544. bIsPowerUser = interactiveData.isHavePower("iscs:set");
  1545. userFace = [];
  1546. userHand = {};
  1547. var taskType = InteractiveTask.TypeHttpGet_getSysUserCharacteristicPage;
  1548. interactiveCore.appendTask(
  1549. taskType, null, (json)=>{
  1550. setview_itemModel.clear();
  1551. var index = 0;
  1552. var jsonObjRoot = JSON.parse(json);
  1553. if (jsonObjRoot.code === 200)
  1554. {
  1555. var jsonObjData = jsonObjRoot.data;
  1556. var jsonArrRecords = jsonObjData.records;
  1557. for (var i = 0; i < jsonArrRecords.length; ++i)
  1558. {
  1559. var jsonObjRecords = jsonArrRecords[i];
  1560. var recordId = jsonObjRecords.recordId;
  1561. var type = jsonObjRecords.type;
  1562. if (type === "2")
  1563. {
  1564. userFace.push(recordId);
  1565. }
  1566. else if (type === "1")
  1567. {
  1568. var groupCode = jsonObjRecords.groupCode;
  1569. if (!userHand.hasOwnProperty(groupCode))
  1570. {
  1571. userHand[groupCode] = [];
  1572. var title = "用户指纹" + (++index);
  1573. setview_itemModel.append({title: title, group: groupCode});
  1574. }
  1575. userHand[groupCode].push(recordId);
  1576. }
  1577. }
  1578. }
  1579. else
  1580. {
  1581. infoPromptBox.title("获取人员特征失败");
  1582. infoPromptBox.message(jsonObjRoot.msg);
  1583. infoPromptBox.button_clear();
  1584. infoPromptBox.button_push("#055eb3", "确定", null, null);
  1585. infoPromptBox.show();
  1586. }
  1587. addFacialLabel.text = userFace.length > 0 ? "重新录入:" : "录入人脸:";
  1588. addFacialButton.text = userFace.length > 0 ? "重新录入" : "录入人脸";
  1589. });
  1590. }
  1591. }