| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748 |
- import QtQuick 2.15
- import QtQuick.Controls 2.15
- import QtQuick.Layouts 1.15
- import com.InteractiveTask 1.0
- Item {
- id: setview
- x: 290
- y: 130
- width: 1600
- height: 920
- signal signal_saveConfig
- signal signal_addfinger(bool stat)
- // 存储两个 ComboBox 的当前选择
- property int rfidPortSelection: 0
- property int lockPortSelection: 1
- property string cardID : ""
- property int addfingercount : 0
- property int addfingerTimeout : 30
- property string addfingerImage : "qrc:/png/cardNotice.png"
- property string addfingerNotice : "请先刷员工卡"
- property bool fingerVisible : false
- property bool bIsPowerUser : false // 是否为授权用户
- property var userFace: [];
- property var userHand;
- onVisibleChanged:
- {
- if (visible === true)
- {
- proThread.moveCursorTo(0, 0);
- refresh_feature_view();
- }
- }
- Rectangle {
- id: setviewbackspace
- width: 1600
- height: 800
- color: "#272b7ae9"
- radius: 20
- clip: true
- GridLayout {
- id: grid
- x: 50
- y: 0
- width: 1500
- height: 800
- rows: 20
- columns: 10
- rowSpacing: 30
- columnSpacing: 20
- Rectangle {
- width: 200
- height: 50
- color: "#00ffffff"
- Layout.row: 0
- Layout.column: 0
- visible: bIsPowerUser
- Label {
- id: devTitle
- color: "#ffffff"
- text: qsTr("设备设置")
- font.pixelSize: 30
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- font.underline: false
- }
- Canvas {
- anchors.fill: parent
- visible: true
- onPaint: {
- var ctx = getContext("2d");
- ctx.lineWidth = 10; // 设置线的宽度
- ctx.strokeStyle = "skyblue"; // 设置线的颜色为白色
- ctx.beginPath();
- ctx.moveTo(0, 45); // 直线的起点
- ctx.lineTo(devTitle.width, 45); // 直线的终点
- ctx.stroke(); // 绘制直线
- }
- }
- }
- Label {
- Layout.row: 1
- Layout.column: 0
- text: qsTr("设备Code:")
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- color: "#ffffff"
- font.pixelSize: 25
- visible: bIsPowerUser
- }
- Rectangle {
- width: 400
- height: 50
- color: "#00ffffff"
- border.color: "#a3ffffff"
- border.width: 3
- radius: 10
- Layout.row: 1
- Layout.column: 1
- Layout.columnSpan: 2
- visible: bIsPowerUser
- TextField {
- id: devCode
- width: parent.width
- font.pixelSize: 25
- focus: false
- color: "#a3ffffff"
- background: Rectangle {
- color: "transparent" // 使TextField背景透明
- }
- placeholderText: qsTr("请输入设备Code")
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- wrapMode: Text.NoWrap
- selectionColor: "#a300aaff"
- placeholderTextColor: "#60ffffff"
- bottomPadding: 10
- topPadding: 10
- rightPadding: 20
- leftPadding: 20
- renderType: Text.QtRendering
- font.styleName: "Regular"
- }
- }
- Item {
- Layout.row: 1
- Layout.column: 3
- Layout.columnSpan: 2
- Layout.fillWidth: true
- visible: bIsPowerUser
- }
- Label {
- Layout.row: 2
- Layout.column: 0
- text: qsTr("服务器地址:")
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- color: "#ffffff"
- font.pixelSize: 25
- visible: bIsPowerUser
- }
- Rectangle {
- width: 400
- height: 50
- color: "#00ffffff"
- Layout.row: 2
- Layout.column: 1
- Layout.columnSpan: 2
- visible: bIsPowerUser
- Label {
- anchors.verticalCenter: parent.verticalCenter // 上下居中
- text: qsTr("http://")
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- color: "#ffffff"
- font.pixelSize: 25
- }
- Rectangle {
- x: 80
- width: 320
- height: 50
- color: "#00ffffff"
- border.color: "#a3ffffff"
- border.width: 3
- radius: 10
- visible: bIsPowerUser
- TextField {
- id: serveraddr
- width: parent.width
- font.pixelSize: 25
- focus: false
- color: "#a3ffffff"
- background: Rectangle {
- color: "transparent" // 使TextField背景透明
- }
- placeholderText: qsTr("请输入域名或IP端口")
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- wrapMode: Text.NoWrap
- selectionColor: "#a300aaff"
- placeholderTextColor: "#60ffffff"
- bottomPadding: 10
- topPadding: 10
- rightPadding: 20
- leftPadding: 20
- renderType: Text.QtRendering
- font.styleName: "Regular"
- }
- }
- }
- Label {
- Layout.row: 3
- Layout.column: 0
- text: qsTr("用户倒计时(s):")
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- color: "#ffffff"
- font.pixelSize: 25
- visible: bIsPowerUser
- }
- Rectangle {
- width: 400
- height: 50
- color: "#00ffffff"
- border.color: "#a3ffffff"
- border.width: 3
- radius: 10
- Layout.row: 3
- Layout.column: 1
- Layout.columnSpan: 2
- visible: bIsPowerUser
- TextField {
- id: loginTimeout
- width: parent.width
- font.pixelSize: 25
- focus: false
- color: "#a3ffffff"
- background: Rectangle {
- color: "transparent" // 使TextField背景透明
- }
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- wrapMode: Text.NoWrap
- selectionColor: "#a300aaff"
- placeholderTextColor: "#60ffffff"
- bottomPadding: 10
- topPadding: 10
- rightPadding: 20
- leftPadding: 20
- renderType: Text.QtRendering
- font.styleName: "Regular"
- placeholderText: "30-300"
- validator: IntValidator {
- bottom: 30 // 下限
- top: 300 // 上限
- }
- onTextChanged: {
- // 如果输入超出范围,清空输入
- if(loginTimeout.text && (parseInt(loginTimeout.text) > loginTimeout.validator.top))
- {
- loginTimeout.text = loginTimeout.validator.top.toString()
- }
- }
- // 监听焦点变化
- onFocusChanged: {
- if (!focus) { // 失去焦点时
- if(loginTimeout.text === "" || (parseInt(loginTimeout.text) < loginTimeout.validator.bottom))
- {
- loginTimeout.text = loginTimeout.validator.bottom.toString()
- }
- }
- }
- }
- }
- Label {
- Layout.row: 4
- Layout.column: 0
- text: qsTr("超时未关门报警(s):")
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- color: "#ffffff"
- font.pixelSize: 25
- visible: bIsPowerUser
- }
- Rectangle {
- width: 400
- height: 50
- color: "#00ffffff"
- border.color: "#a3ffffff"
- border.width: 3
- radius: 10
- Layout.row: 4
- Layout.column: 1
- Layout.columnSpan: 2
- visible: bIsPowerUser
- TextField {
- id: lockTimeout
- width: parent.width
- font.pixelSize: 25
- focus: false
- color: "#a3ffffff"
- background: Rectangle {
- color: "transparent" // 使TextField背景透明
- }
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- wrapMode: Text.NoWrap
- selectionColor: "#a300aaff"
- placeholderTextColor: "#60ffffff"
- bottomPadding: 10
- topPadding: 10
- rightPadding: 20
- leftPadding: 20
- renderType: Text.QtRendering
- font.styleName: "Regular"
- placeholderText: "30-300"
- validator: IntValidator {
- bottom: 10 // 下限 - FixMe: 600 10s为测试用
- top: 3600 // 上限
- }
- onTextChanged: {
- // 如果输入超出范围,清空输入
- if(lockTimeout.text && (parseInt(lockTimeout.text) > lockTimeout.validator.top))
- {
- lockTimeout.text = lockTimeout.validator.top.toString()
- }
- }
- // 监听焦点变化
- onFocusChanged: {
- if (!focus) { // 失去焦点时
- if(lockTimeout.text === "" || (parseInt(lockTimeout.text) < lockTimeout.validator.bottom))
- {
- lockTimeout.text = lockTimeout.validator.bottom.toString()
- }
- }
- }
- }
- }
- Item {
- Layout.row: 5
- Layout.column: 0
- height: 50
- visible: bIsPowerUser
- }
- Rectangle {
- width: 200
- height: 50
- color: "#00ffffff"
- Layout.row: 0
- Layout.column: 4
- visible: bIsPowerUser
- Label {
- id: rfidTitle
- color: "#ffffff"
- text: qsTr("RFID设置")
- font.pixelSize: 30
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- font.underline: false
- visible: bIsPowerUser
- }
- Canvas {
- anchors.fill: parent
- visible: true
- onPaint: {
- var ctx = getContext("2d");
- ctx.lineWidth = 10; // 设置线的宽度
- ctx.strokeStyle = "skyblue"; // 设置线的颜色为白色
- ctx.beginPath();
- ctx.moveTo(0, 45); // 直线的起点
- ctx.lineTo(rfidTitle.width, 45); // 直线的终点
- ctx.stroke(); // 绘制直线
- }
- }
- }
- Label {
- Layout.row: 1
- Layout.column: 4
- text: qsTr("串口号:")
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- color: "#ffffff"
- font.pixelSize: 25
- visible: bIsPowerUser
- }
- Rectangle {
- width: 400
- height: 50
- color: "#00ffffff"
- border.color: "#a3ffffff"
- border.width: 3
- radius: 10
- Layout.row: 1
- Layout.column: 5
- Layout.columnSpan: 2
- visible: bIsPowerUser
- ComboBox {
- id: rfidSerialPort
- width: 400
- height: 50
- model: pConfig.sserialPortList // 绑定到C++类的portList属性
- // 设置 ComboBox 的背景颜色
- background: Rectangle {
- color: "#002b7ae9" // 背景颜色
- border.color: "White"
- border.width: 1
- radius: 10 // 圆角
- }
- // 设置 ComboBox 的文本样式
- contentItem: Text {
- text: rfidSerialPort.displayText
- font.pixelSize: 25
- color: "white"
- verticalAlignment: Text.AlignVCenter
- }
- // 设置下拉箭头样式
- indicator: Image {
- x: rfidSerialPort.width - width - 10 // 箭头位置
- y: (rfidSerialPort.height - height) / 2
- width: 30
- height: 30
- source: "qrc:/png/down.png"
- }
- // 设置下拉框的样式
- popup: Popup {
- y: rfidSerialPort.height // 下拉框的位置
- width: rfidSerialPort.width // 下拉框的宽度
- implicitHeight: contentItem.implicitHeight // 自动高度
- padding: 1
- // 设置下拉框的背景颜色和透明度
- background: Rectangle {
- color: "#8a2b7ae9" // 下拉框背景颜色
- border.color: "White"
- border.width: 1
- radius: 10 // 圆角
- }
- // 设置下拉框的内容样式
- contentItem: ListView {
- clip: true
- implicitHeight: contentHeight
- model: rfidSerialPort.popup.visible ? rfidSerialPort.delegateModel : null
- currentIndex: rfidSerialPort.highlightedIndex
- }
- }
- // 设置下拉框每一项的样式
- delegate: ItemDelegate {
- width: rfidSerialPort.width
- text: modelData
- highlighted: rfidSerialPort.highlightedIndex === index
- font.pixelSize: 25
- // 设置每一项的背景颜色
- background: Rectangle {
- color: highlighted ? "skyblue" : "transparent" // 选中项的背景颜色
- opacity: 0.8 // 每一项的透明度
- }
- // 设置每一项的文本样式
- contentItem: Text {
- text: modelData
- color: highlighted ? "white" : "skyblue" // 选中项的文本颜色为白色
- font: parent.font
- verticalAlignment: Text.AlignVCenter
- }
- }
- // 当选择变化时
- onCurrentIndexChanged: {
- if (lockPortSelection === currentIndex) {
- rfidSerialPort.currentIndex = rfidPortSelection;
- } else {
- // 否则更新当前选择
- rfidPortSelection = currentIndex;
- }
- }
- }
- }
- Button {
- id: checkRfidSerialPort
- implicitWidth: 120
- height: 40
- Layout.row: 1
- Layout.column: 7
- visible: false
- background: Rectangle {
- color: "#00b2ff" // 设置背景为透明
- radius: 10 // 可选,设置圆角
- }
- text: qsTr("自动搜索")
- font.pixelSize: 25
- palette.buttonText: "white" // 设置字体颜色为绿色
- Connections {
- target: checkRfidSerialPort
- onClicked: {
- }
- }
- }
- Label {
- Layout.row: 2
- Layout.column: 4
- text: qsTr("发射功率:")
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- color: "#ffffff"
- font.pixelSize: 25
- visible: bIsPowerUser
- }
- Rectangle {
- width: 400
- height: 50
- color: "#00ffffff"
- border.color: "#a3ffffff"
- border.width: 3
- radius: 10
- Layout.row: 2
- Layout.column: 5
- Layout.columnSpan: 2
- visible: bIsPowerUser
- TextField {
- id: rfidPower
- width: parent.width
- font.pixelSize: 25
- focus: false
- color: "#a3ffffff"
- background: Rectangle {
- color: "transparent" // 使TextField背景透明
- }
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- wrapMode: Text.NoWrap
- selectionColor: "#a300aaff"
- placeholderTextColor: "#60ffffff"
- bottomPadding: 10
- topPadding: 10
- rightPadding: 20
- leftPadding: 20
- renderType: Text.QtRendering
- font.styleName: "Regular"
- placeholderText: "1000-2000"
- validator: IntValidator {
- bottom: 1000 // 下限
- top: 2000 // 上限
- }
- onTextChanged: {
- // 如果输入超出范围,清空输入
- if(rfidPower.text && (parseInt(rfidPower.text) > rfidPower.validator.top))
- {
- rfidPower.text = rfidPower.validator.top.toString()
- }
- }
- // 监听焦点变化
- onFocusChanged: {
- if (!focus) { // 失去焦点时
- if(rfidPower.text === "" || (parseInt(rfidPower.text) < rfidPower.validator.bottom))
- {
- rfidPower.text = rfidPower.validator.bottom.toString()
- }
- }
- }
- }
- }
- Label {
- Layout.row: 3
- Layout.column: 4
- text: qsTr("读取时间(ms):")
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- color: "#ffffff"
- font.pixelSize: 25
- visible: bIsPowerUser
- }
- Rectangle {
- width: 400
- height: 50
- color: "#00ffffff"
- border.color: "#a3ffffff"
- border.width: 3
- radius: 10
- Layout.row: 3
- Layout.column: 5
- Layout.columnSpan: 2
- visible: bIsPowerUser
- TextField {
- id: rfidWorkTime
- width: parent.width
- font.pixelSize: 25
- focus: false
- color: "#a3ffffff"
- background: Rectangle {
- color: "transparent" // 使TextField背景透明
- }
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- wrapMode: Text.NoWrap
- selectionColor: "#a300aaff"
- placeholderTextColor: "#60ffffff"
- bottomPadding: 10
- topPadding: 10
- rightPadding: 20
- leftPadding: 20
- renderType: Text.QtRendering
- font.styleName: "Regular"
- placeholderText: "5000-30000"
- validator: IntValidator {
- bottom: 5000 // 下限
- top: 30000 // 上限
- }
- onTextChanged: {
- // 如果输入超出范围,清空输入
- if(rfidWorkTime.text && (parseInt(rfidWorkTime.text) > rfidWorkTime.validator.top))
- {
- rfidWorkTime.text = rfidWorkTime.validator.top.toString()
- }
- }
- // 监听焦点变化
- onFocusChanged: {
- if (!focus) { // 失去焦点时
- if(rfidWorkTime.text === "" || (parseInt(rfidWorkTime.text) < rfidWorkTime.validator.bottom))
- {
- rfidWorkTime.text = rfidWorkTime.validator.bottom.toString()
- }
- }
- }
- }
- }
- Rectangle {
- id : addFingerRect
- width: 200
- height: 50
- color: "#00ffffff"
- Layout.row: 5
- Layout.column: 0
- visible: fingerVisible
- Label {
- id: fingerTitle
- color: "#ffffff"
- text: qsTr("指纹设置")
- font.pixelSize: 30
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- font.underline: false
- }
- Canvas {
- anchors.fill: parent
- visible: fingerVisible
- onPaint: {
- var ctx = getContext("2d");
- ctx.lineWidth = 10; // 设置线的宽度
- ctx.strokeStyle = "skyblue"; // 设置线的颜色为白色
- ctx.beginPath();
- ctx.moveTo(0, 45); // 直线的起点
- ctx.lineTo(fingerTitle.width, 45); // 直线的终点
- ctx.stroke(); // 绘制直线
- }
- }
- }
- Label {
- id : addFingerLabel
- Layout.row: 6
- Layout.column: 0
- text: qsTr("指纹录入:")
- visible: false
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- color: "#ffffff"
- font.pixelSize: 25
- }
- Button {
- id: addFingerButton
- implicitWidth: 120
- height: 40
- Layout.row: 6
- Layout.column: 1
- anchors.left: addFingerRect.left
- background: Rectangle {
- color: "#00b2ff" // 设置背景为透明
- radius: 10 // 可选,设置圆角
- }
- visible: fingerVisible
- text: qsTr("添加指纹")
- font.pixelSize: 25
- palette.buttonText: "white" // 设置字体颜色为绿色
- Connections {
- target: addFingerButton
- onClicked: {
- // if(pConfig.sfingerStat === true)
- // {
- // if(addfinger.visible === false)
- // {
- // set_addFinger_timeout(false);
- // addfingerImage = "qrc:/png/fingerNotice.png";
- // addfingerNotice = "请第1次按下指纹";
- // addfingercount = 0;
- // signal_addfinger(true);
- // addfinger.visible = true;
- // addfinger.focus = true;
- // }
- // }
- // else{
- // set_addFinger_timeout(true);
- // addfingerImage = "qrc:/png/error.png"
- // addfingerNotice = "指纹模组未连接"
- // addfinger.visible = true;
- // }
- if ( Object.keys(userHand).length >= 3)
- {
- infoPromptBox.title("提示");
- infoPromptBox.message("最多只能添加三个指纹数据");
- infoPromptBox.button_clear();
- infoPromptBox.button_push("#055eb3", "确定", null, null);
- infoPromptBox.show();
- }
- else
- {
- add_user_finger();
- }
- }
- }
- }
- Rectangle {
- Layout.row: 7
- Layout.column: 0
- Layout.rowSpan: 2
- Layout.columnSpan: 3
- ListModel {
- id: setview_itemModel
- }
- GridLayout {
- anchors.fill: parent
- rows: 3
- columns: 2
- rowSpacing: 20
- columnSpacing: 20
- Repeater {
- model: setview_itemModel
- Label {
- Layout.row: index
- Layout.column: 0
- anchors.right: addFingerRect.right
- text: model.title
- // horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- color: "#ffffff"
- font.pixelSize: 25
- leftPadding: 0
- }
- }
- Repeater {
- model: setview_itemModel
- Button {
- implicitWidth: 80
- height: 40
- Layout.row: index
- Layout.column: 1
- anchors.left: addFingerRect.right
- background: Rectangle {
- color: "red"
- radius: 10
- }
- visible: fingerVisible
- text: qsTr("删除")
- font.pixelSize: 25
- palette.buttonText: "white"
- onClicked: {
- var groupCode = model.group;
- var groutArray = userHand[groupCode];
- var inText = groutArray.length > 0 ? "?recordIds=" : "";
- for (var i = 0; i < groutArray.length; ++i)
- {
- inText += groutArray[i];
- inText += (i !== groutArray.length - 1) ? "," : "";
- }
- interactiveCore.appendTask(
- InteractiveTask.TypeHttpPost_deleteSysUserCharacteristicByRecordIds, inText,
- (json)=>{
- var jsonObjData = JSON.parse(json);
- if (jsonObjData.code === 200) {
- infoPromptBox.title("提示");
- infoPromptBox.message("指纹特征删除成功");
- infoPromptBox.button_clear();
- infoPromptBox.button_push("#055eb3", "确定", null, null);
- infoPromptBox.show();
- refresh_feature_view();
- }
- else
- {
- infoPromptBox.title("提示");
- infoPromptBox.message(jsonObjData.msg);
- infoPromptBox.button_clear();
- infoPromptBox.button_push("#055eb3", "确定", null, null);
- infoPromptBox.show();
- }
- });
- }
- }
- }
- }
- }
- Rectangle {
- id: addFacialRect
- width: 200
- height: 50
- color: "#00ffffff"
- Layout.row: 5
- Layout.column: 2
- visible: fingerVisible
- Label {
- id: facialTitle
- color: "#ffffff"
- text: qsTr("人脸设置")
- font.pixelSize: 30
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- font.underline: false
- }
- Canvas {
- anchors.fill: parent
- visible: fingerVisible
- onPaint: {
- var ctx = getContext("2d");
- ctx.lineWidth = 10; // 设置线的宽度
- ctx.strokeStyle = "skyblue"; // 设置线的颜色为白色
- ctx.beginPath();
- ctx.moveTo(0, 45); // 直线的起点
- ctx.lineTo(fingerTitle.width, 45); // 直线的终点
- ctx.stroke(); // 绘制直线
- }
- }
- }
- Label {
- id: addFacialLabel
- Layout.row: 6
- Layout.column: 2
- text: qsTr("人脸录入:")
- visible: false
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- color: "#ffffff"
- font.pixelSize: 25
- }
- Button {
- id: addFacialButton
- implicitWidth: 120
- height: 40
- Layout.row: 6
- Layout.column: 3
- anchors.left: addFacialRect.left
- background: Rectangle {
- color: "#00b2ff" // 设置背景为透明
- radius: 10 // 可选,设置圆角
- }
- visible: fingerVisible
- text: qsTr("人脸录入")
- font.pixelSize: 25
- palette.buttonText: "white" // 设置字体颜色为绿色
- Connections {
- target: addFacialButton
- onClicked: {
- facialRecognition.visible = true;
- setView.visible = false;
- }
- }
- }
- Rectangle {
- width: 200
- height: 50
- color: "#00ffffff"
- Layout.row: 5
- Layout.column: 4
- visible: bIsPowerUser
- Label {
- id: lockTitle
- color: "#ffffff"
- text: qsTr("控制板设置")
- font.pixelSize: 30
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- font.underline: false
- }
- Canvas {
- anchors.fill: parent
- visible: true
- onPaint: {
- var ctx = getContext("2d");
- ctx.lineWidth = 10; // 设置线的宽度
- ctx.strokeStyle = "skyblue"; // 设置线的颜色为白色
- ctx.beginPath();
- ctx.moveTo(0, 45); // 直线的起点
- ctx.lineTo(lockTitle.width, 45); // 直线的终点
- ctx.stroke(); // 绘制直线
- }
- }
- }
- Label {
- Layout.row: 6
- Layout.column: 4
- text: qsTr("串口号:")
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- color: "#ffffff"
- font.pixelSize: 25
- visible: bIsPowerUser
- }
- Rectangle {
- width: 400
- height: 50
- color: "#00ffffff"
- border.color: "#a3ffffff"
- border.width: 3
- radius: 10
- Layout.row: 6
- Layout.column: 5
- Layout.columnSpan: 2
- visible: bIsPowerUser
- ComboBox {
- id: lockSerialPort
- width: 400
- height: 50
- model: pConfig.sserialPortList // 绑定到C++类的portList属性
- // 设置 ComboBox 的背景颜色
- background: Rectangle {
- color: "#002b7ae9" // 背景颜色
- border.color: "White"
- border.width: 1
- radius: 10 // 圆角
- }
- // 设置 ComboBox 的文本样式
- contentItem: Text {
- text: lockSerialPort.displayText
- font.pixelSize: 25
- color: "white"
- verticalAlignment: Text.AlignVCenter
- }
- // 设置下拉箭头样式
- indicator: Image {
- x: lockSerialPort.width - width - 10 // 箭头位置
- y: (lockSerialPort.height - height) / 2
- width: 30
- height: 30
- source: "qrc:/png/down.png"
- }
- // 设置下拉框的样式
- popup: Popup {
- y: lockSerialPort.height // 下拉框的位置
- width: lockSerialPort.width // 下拉框的宽度
- implicitHeight: contentItem.implicitHeight // 自动高度
- padding: 1
- // 设置下拉框的背景颜色和透明度
- background: Rectangle {
- color: "#8a2b7ae9" // 下拉框背景颜色
- border.color: "White"
- border.width: 1
- radius: 10 // 圆角
- }
- // 设置下拉框的内容样式
- contentItem: ListView {
- clip: true
- implicitHeight: contentHeight
- model: lockSerialPort.popup.visible ? lockSerialPort.delegateModel : null
- currentIndex: lockSerialPort.highlightedIndex
- }
- }
- // 设置下拉框每一项的样式
- delegate: ItemDelegate {
- width: lockSerialPort.width
- text: modelData
- highlighted: lockSerialPort.highlightedIndex === index
- font.pixelSize: 25
- // 设置每一项的背景颜色
- background: Rectangle {
- color: highlighted ? "skyblue" : "transparent" // 选中项的背景颜色
- opacity: 0.8 // 每一项的透明度
- }
- // 设置每一项的文本样式
- contentItem: Text {
- text: modelData
- color: highlighted ? "white" : "skyblue" // 选中项的文本颜色为白色
- font: parent.font
- verticalAlignment: Text.AlignVCenter
- }
- }
- // 当选择变化时
- onCurrentIndexChanged: {
- if (rfidPortSelection === currentIndex) {
- lockSerialPort.currentIndex = lockPortSelection;
- } else {
- // 否则更新当前选择
- lockPortSelection = currentIndex;
- }
- }
- }
- }
- Button {
- id: checkLockSerialPort
- implicitWidth: 120
- height: 40
- Layout.row: 7
- Layout.column: 7
- visible: false
- background: Rectangle {
- color: "#00b2ff" // 设置背景为透明
- radius: 10 // 可选,设置圆角
- }
- text: qsTr("自动搜索")
- font.pixelSize: 25
- palette.buttonText: "white" // 设置字体颜色为绿色
- Connections {
- target: checkLockSerialPort
- onClicked: {
- }
- }
- }
- Item {
- Layout.row: 1
- Layout.column: 8
- Layout.fillWidth: true // 填充可用高度
- }
- Item {
- Layout.row: 19
- Layout.column: 0
- Layout.fillHeight: true // 填充可用高度
- }
- }
- }
- Dialog {
- id: dialog
- title: "操作确认"
- x: parent.width / 2 - width / 2
- y: parent.height / 2 - height / 2
- width: 600
- height: 400
- clip: true
- modal: true
- // 自定义背景(带圆角)
- background: Rectangle {
- color: "white"
- clip: true
- }
- // 自定义标题栏
- header: Rectangle {
- x: 0
- y: 0
- width: parent.width
- height: 50 // 设置标题栏高度
- color: "#ff3968e9" // 设置标题栏背景色
- // 标题文本
- Text {
- x: 20
- y: 0
- width: 80
- height: 50 // 设置标题栏高度
- text: dialog.title
- font.pixelSize: 25
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- color: "white"
- }
- }
- contentItem: Rectangle {
- x: 0
- y: 0
- width: parent.width
- height: 200
- color: "white"
- Text {
- width: parent.width
- height: 200
- text: "确认保存已设置参数?"
- font.pixelSize: 30
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- }
- }
- // 自定义 DialogButtonBox
- DialogButtonBox {
- id: buttonBox
- x: 0
- y: 250
- width: parent.width
- height: 100
- // 自定义按钮
- Button {
- implicitWidth: 120
- implicitHeight: 50
- text: "确认"
- background: Rectangle {
- color: "green"
- radius: 5
- }
- contentItem: Text {
- text: parent.text
- font.pixelSize: 30
- color: "white"
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- }
- onClicked: {
- // if(button_return.visible === true)
- // {
- // setView.visible = false
- // button_return.visible = false
- // }
- save_configParam()
- console.log("Dialog accepted")
- dialog.close()
- }
- }
- Button {
- implicitWidth: 120
- implicitHeight: 50
- text: "取消"
- background: Rectangle {
- color: "red"
- radius: 5
- }
- contentItem: Text {
- text: parent.text
- font.pixelSize: 30
- color: "white"
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- }
- onClicked: {
- console.log("Dialog rejected")
- dialog.reject()
- }
- }
- }
- }
- Dialog {
- id: setview_dialog_exit
- title: "操作确认"
- x: parent.width / 2 - width / 2
- y: parent.height / 2 - height / 2
- width: 600
- height: 400
- clip: true
- modal: true
- // 自定义背景(带圆角)
- background: Rectangle {
- color: "white"
- clip: true
- }
- // 自定义标题栏
- header: Rectangle {
- x: 0
- y: 0
- width: parent.width
- height: 50 // 设置标题栏高度
- color: "#ff3968e9" // 设置标题栏背景色
- // 标题文本
- Text {
- x: 20
- y: 0
- width: 80
- height: 50 // 设置标题栏高度
- text: setview_dialog_exit.title
- font.pixelSize: 25
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- color: "white"
- }
- }
- contentItem: Rectangle {
- x: 0
- y: 0
- width: parent.width
- height: 200
- color: "white"
- Text {
- width: parent.width
- height: 200
- text: "确定要退出登录吗?"
- font.pixelSize: 30
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- }
- }
- // 自定义 DialogButtonBox
- DialogButtonBox {
- id: setview_dialog_buttonBox
- x: 0
- y: 250
- width: parent.width
- height: 100
- // 自定义按钮
- Button {
- implicitWidth: 120
- implicitHeight: 50
- text: "确认"
- background: Rectangle {
- color: "green"
- radius: 5
- }
- contentItem: Text {
- text: parent.text
- font.pixelSize: 30
- color: "white"
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- }
- onClicked: {
- // window.exitWork();
- mainScreen.logout();
- setview_dialog_exit.close();
- }
- }
- Button {
- implicitWidth: 120
- implicitHeight: 50
- text: "取消"
- background: Rectangle {
- color: "red"
- radius: 5
- }
- contentItem: Text {
- text: parent.text
- font.pixelSize: 30
- color: "white"
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- }
- onClicked: {
- setview_dialog_exit.reject();
- }
- }
- }
- }
- Rectangle {
- id: addfinger
- x: (mainScreen.width - width) / 2 - parent.x
- y: (mainScreen.height - height) / 2 - parent.y
- width: 350
- height: 350
- visible: false
- color: "#980e57ea"
- radius: 20
- // property int currentIndex; // 当前录入次数
- // property var currentGroup; // 当前组名称
- // property var currentArray:[]; // 当前录入成功的指纹数组
- // 强制保持焦点
- onFocusChanged: {
- if(addfinger.visible === true)
- {
- if (!focus) {
- forceActiveFocus()
- }
- }
- }
- Column {
- x: 0
- y: 0
- width: 350
- height: 350
- visible: true
- spacing: 30
- padding: 0
- topPadding: 46
- Image {
- width: 200
- height: 200
- opacity: 0.5
- anchors.horizontalCenter: parent.horizontalCenter
- source: addfingerImage
- }
- Label {
- id: errorNotice
- anchors.horizontalCenter: parent.horizontalCenter
- color: "#9affffff"
- text: addfingerNotice
- font.pixelSize: 30
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- font.bold: true
- }
- }
- }
- // Button {
- // id: button_return
- // x: 1168
- // y: 835
- // visible: false
- // width: 192
- // height: 75
- // background: Rectangle {
- // color: "#055eb3" // 设置背景为透明
- // radius: 10 // 可选,设置圆角
- // }
- // text: qsTr("返回")
- // font.pixelSize: 30
- // palette.buttonText: "white" // 设置字体颜色为绿色
- // Connections {
- // target: button_return
- // onClicked: {
- // setView.visible = false;
- // button_return.visible = false
- // }
- // }
- // }
- Button {
- id: button_save
- x: 1168
- y: 835
- width: 192
- height: 75
- background: Rectangle {
- color: "#ff0000" // 设置背景为透明
- radius: 10 // 可选,设置圆角
- }
- text: qsTr("保存")
- font.pixelSize: 30
- palette.buttonText: "white" // 设置字体颜色为绿色
- Connections {
- target: button_save
- onClicked: {
- dialog.open()
- }
- }
- }
- // 退出
- Button {
- id: set_view_button_exit
- x: 1408
- y: 835
- width: 192
- height: 75
- background: Rectangle {
- color: "#055eb3" // 设置背景为透明
- radius: 10 // 可选,设置圆角
- }
- text: qsTr("退出登录")
- font.pixelSize: 30
- palette.buttonText: "white" // 设置字体颜色为绿色
- Connections {
- target: set_view_button_exit
- onClicked: {
- setview_dialog_exit.open();
- }
- }
- }
- function load_configParam(stat)
- {
- devCode.text = pConfig.sdevUuid;
- serveraddr.text = pConfig.shttpHost;
- loginTimeout.text = pConfig.sloginTimeout.toString();
- lockTimeout.text = pConfig.slockCloseTimeout.toString();
- rfidPower.text = pConfig.srfidPower.toString();
- rfidWorkTime.text = pConfig.srfidWorkTime.toString();
- for (var i = 0; i < rfidSerialPort.model.length; i++) {
- if (rfidSerialPort.model[i] === pConfig.srfidPort) {
- // 如果值存在,设置选中项
- rfidSerialPort.currentIndex = i;
- rfidPortSelection = i;
- }
- }
- for (i = 0; i < lockSerialPort.model.length; i++) {
- if (lockSerialPort.model[i] === pConfig.slockPort) {
- // 如果值存在,设置选中项
- lockSerialPort.currentIndex = i;
- lockPortSelection = i;
- }
- }
- if(stat === true)
- {
- button_return.visible = true
- }
- }
- function save_configParam()
- {
- pConfig.sdevUuid = devCode.text;
- pConfig.shttpHost = serveraddr.text;
- pConfig.sloginTimeout = parseInt(loginTimeout.text)
- pConfig.slockCloseTimeout = parseInt(lockTimeout.text)
- pConfig.srfidPower = parseInt(rfidPower.text)
- pConfig.srfidWorkTime = parseInt(rfidWorkTime.text)
- pConfig.srfidPort = rfidSerialPort.currentText;
- pConfig.slockPort = lockSerialPort.currentText;
- signal_saveConfig();
- }
- function slot_addFinger_act(stat)
- {
- if(stat === true)
- {
- if(addfingercount < 2)
- {
- set_addFinger_timeout(false);
- addfingerImage = "qrc:/png/fingerNotice.png";
- addfingercount++;
- addfingerNotice = "请第" + (addfingercount + 1) + "次按下指纹";
- signal_addfinger(true);
- }
- else{
- set_addFinger_timeout(true);
- addfingerImage = "qrc:/png/fingerNotice.png";
- addfingerNotice = "指纹添加完成";
- }
- }
- else{
- set_addFinger_timeout(true);
- addfingerImage = "qrc:/png/error.png";
- addfingerNotice = "指纹添加失败";
- }
- }
- function set_addFinger_timeout(finish)
- {
- if(finish === false)
- {
- addfingerTimeout = 30;
- }
- else{
- addfingerTimeout = 3;
- }
- }
- Timer {
- interval: 1000
- running: true
- repeat: true
- onTriggered: {
- if(addfingerTimeout > 0)
- {
- addfingerTimeout--;
- }
- else{
- if(addfinger.visible === true)
- {
- signal_addfinger(false);
- addfinger.focus = false;
- addfinger.visible = false;
- addfingercount = 0;
- cardID = "";
- }
- }
- }
- }
- Label {
- x: 400
- id: setview_label_notice
- anchors.bottom: setviewbackspace.bottom
- anchors.bottomMargin: 100
- color: "#ffffff"
- text: qsTr("请连续按压采集三次,中途不要更换手指")
- font.pixelSize: 30
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- font.bold: true
- visible: false
- }
- // 添加指纹
- property int currentIndex: 0;
- property var currentArray: [];
- property var currentGroup: string("分组1");
- function add_user_finger()
- {
- currentIndex = 0;
- currentArray = [];
- currentGroup = proThread.getUuid();
- // 设置取消回调(确保录入中途取消可以正确删除指纹)
- hangPromptBox.setCancelCallBack(
- ()=>{
- setview_label_notice.visible = false;
- if (currentArray.length > 0 && currentIndex < 3)
- {
- var inText = currentArray.length > 0 ? "?recordIds=" : "";
- for (var i = 0; i < currentArray.length; ++i)
- {
- inText += currentArray[i];
- inText += (i !== currentArray.length - 1) ? "," : "";
- }
- interactiveCore.appendTask(
- InteractiveTask.TypeHttpPost_deleteSysUserCharacteristicByRecordIds, inText,
- (json)=>{
- var jsonObjData = JSON.parse(json);
- if (jsonObjData.code === 200) {
- refresh_feature_view();
- }
- else
- {
- infoPromptBox.title("指纹特征删除失败");
- infoPromptBox.message(jsonObjData.msg);
- infoPromptBox.button_clear();
- infoPromptBox.button_push("#055eb3", "确定", null, null);
- infoPromptBox.show();
- }
- });
- }
- }, null);
- setview_label_notice.visible = true;
- // 显示
- hangPromptBox.show();
- hangPromptBox.message("请按下手指");
- hangPromptBox.urlIcon("qrc:/png/fingerNotice.png");
- interactiveHand.setFingerImageAppearCallBack(
- (url)=>{
- interactiveHand.fingerImageStop();
- hangPromptBox.urlIcon("qrc:/png/fingerNotice.png");
- interactiveCore.appendTask(
- InteractiveTask.TypeHttpPost_insertUserFingerprintDat, currentGroup, (json)=>{
- var jsonObjRoot = JSON.parse(json);
- if (jsonObjRoot.code === 200)
- {
- currentIndex++;
- currentArray.push(jsonObjRoot.data);
- if (currentIndex === 1)
- {
- interactiveHand.fingerImagePlay();
- hangPromptBox.message("您已采集1次");
- }
- else if (currentIndex === 2)
- {
- interactiveHand.fingerImagePlay();
- hangPromptBox.message("您已采集2次");
- }
- else if (currentIndex >= 3) {
- hangPromptBox.message("录入成功");
- refresh_feature_view();
- // 延时等待
- interactiveCore.appendTask(
- InteractiveTask.TypeViewWait, 3000, ()=>{
- hangPromptBox.hide();
- setview_label_notice.visible = false;
- });
- }
- }
- else {
- hangPromptBox.urlIcon("qrc:/png/error.png");
- hangPromptBox.message(jsonObjRoot.msg);
- // 延时等待
- interactiveCore.appendTask(
- InteractiveTask.TypeViewWait, 3000, ()=>{
- hangPromptBox.urlIcon("qrc:/png/error.png");
- if (currentArray.length > 0)
- {
- var inText = currentArray.length > 0 ? "?recordIds=" : "";
- for (var i = 0; i < currentArray.length; ++i)
- {
- inText += currentArray[i];
- inText += (i !== currentArray.length - 1) ? "," : "";
- }
- interactiveCore.appendTask(
- InteractiveTask.TypeHttpPost_deleteSysUserCharacteristicByRecordIds, inText,
- (json)=>{
- var jsonObjData = JSON.parse(json);
- if (jsonObjData.code === 200) {
- }
- else
- {
- infoPromptBox.title("指纹特征删除失败");
- infoPromptBox.message(jsonObjData.msg);
- infoPromptBox.button_clear();
- infoPromptBox.button_push("#055eb3", "确定", null, null);
- infoPromptBox.show();
- }
- });
- }
- hangPromptBox.urlIcon("qrc:/png/fingerNotice.png");
- hangPromptBox.message("请按下指纹");
- interactiveHand.fingerImagePlay();
- currentIndex = 0;
- });
- }
- });
- });
- interactiveHand.fingerImagePlay();
- }
- // 刷新人员特征视图
- function refresh_feature_view()
- {
- bIsPowerUser = interactiveData.isHavePower("iscs:set");
- userFace = [];
- userHand = {};
- var taskType = InteractiveTask.TypeHttpGet_getSysUserCharacteristicPage;
- interactiveCore.appendTask(
- taskType, null, (json)=>{
- setview_itemModel.clear();
- var index = 0;
- var jsonObjRoot = JSON.parse(json);
- if (jsonObjRoot.code === 200)
- {
- var jsonObjData = jsonObjRoot.data;
- var jsonArrRecords = jsonObjData.records;
- for (var i = 0; i < jsonArrRecords.length; ++i)
- {
- var jsonObjRecords = jsonArrRecords[i];
- var recordId = jsonObjRecords.recordId;
- var type = jsonObjRecords.type;
- if (type === "2")
- {
- userFace.push(recordId);
- }
- else if (type === "1")
- {
- var groupCode = jsonObjRecords.groupCode;
- if (!userHand.hasOwnProperty(groupCode))
- {
- userHand[groupCode] = [];
- var title = "用户指纹" + (++index);
- setview_itemModel.append({title: title, group: groupCode});
- }
- userHand[groupCode].push(recordId);
- }
- }
- }
- else
- {
- infoPromptBox.title("获取人员特征失败");
- infoPromptBox.message(jsonObjRoot.msg);
- infoPromptBox.button_clear();
- infoPromptBox.button_push("#055eb3", "确定", null, null);
- infoPromptBox.show();
- }
- addFacialLabel.text = userFace.length > 0 ? "重新录入:" : "录入人脸:";
- addFacialButton.text = userFace.length > 0 ? "重新录入" : "录入人脸";
- });
- }
- }
|