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 ? "重新录入" : "录入人脸"; }); } }