import QtQuick 2.15 import QtQuick.Controls 2.15 Item { id: materialstatistics x: 290 y: 130 width: 1600 height: 920 property string takeDatetime : "2025-03-02 13:16:25" property string takeName : "张天乐" property string backDatetime : "2025-03-02 13:16:25" property string backName : "张天乐" property bool takestock : true property string takestocknotice : "物资盘点中,请耐心等待......" property int takestockviewcount : 1 property int stockcountdown : 5 property string stockcountdownstr : "倒计时:99秒" ListModel { id: materialtakelistModel } ListModel { id: materialbacklistModel } Rectangle { width: 1600 height: 800 color: "#272b7ae9" radius: 20 clip: true Rectangle { width: 1600 height: 100 // 减去顶部圆角矩形的高度 radius: 20 clip: true color: "#8f2b7ae9" Text { id: materialstatistics_text_title x: 50 y: 25 width: 500 height: 50 visible: true text: "本次物资取还记录如下:" font.pixelSize: 30 horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter font.bold: true color: "#ffffff" } } Rectangle { x: 0 y: 100 width: parent.width height: (parent.height - 100) / 2 color: "#002b7ae9" Text { id: materialstatistics_text_takeDateTime x: 50 y: 0 width: 260 height: 50 visible: true text: takeDatetime font.pixelSize: 25 horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter font.bold: true color: "#ffffff" } Text { id: materialstatistics_text_takeName x: 310 y: 0 width: 120 height: 50 visible: true text: takeName font.pixelSize: 25 horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter font.underline: true font.bold: true color: "#ffffff" } Text { id: materialstatistics_text_takeText x: 430 y: 0 width: 180 height: 50 visible: true text: "领取以下物资:" font.pixelSize: 25 horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter font.bold: true color: "#ffffff" } GridView { x: 25 y: 50 width: parent.width - 50 height: parent.height - 50 cellWidth: 250 // 每个单元格的宽度,这里是平均分配宽度给5列 cellHeight: 350 // 每个单元格的高度 model: materialtakelistModel delegate: Rectangle{ width: 250 height: 350 color: "#00ffffff" Rectangle { x: 25 y: 25 width: 200 height: 300 color: "#00ffffff" Image { x: 25 y: 25 width: 150 height: 150 visible: true source: model.png fillMode: Image.PreserveAspectFit } Text { x: 0 y: 185 width: parent.width height: 50 visible: true text: model.name font.pixelSize: 30 horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter color: "#ffffff" } Text { x: 0 y: 250 width: parent.width height: 25 visible: true text: model.rfid font.pixelSize: 12 horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter color: "#ffffff" } } } } } Rectangle { x: 0 y: (parent.height - 100) / 2 + 100 width: parent.width height: (parent.height - 100) / 2 color: "#002b7ae9" Text { id: materialstatistics_text_backDateTime x: 50 y: 0 width: 260 height: 50 visible: true text: backDatetime font.pixelSize: 25 horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter font.bold: true color: "#ffffff" } Text { id: materialstatistics_text_backName x: 310 y: 0 width: 120 height: 50 visible: true text: backName font.pixelSize: 25 horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter font.underline: true font.bold: true color: "#ffffff" } Text { id: materialstatistics_text_backText x: 430 y: 0 width: 180 height: 50 visible: true text: "归还以下物资:" font.pixelSize: 25 horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter font.bold: true color: "#ffffff" } GridView { x: 25 y: 50 width: parent.width - 50 height: parent.height - 50 cellWidth: 250 // 每个单元格的宽度,这里是平均分配宽度给5列 cellHeight: 350 // 每个单元格的高度 model: materialbacklistModel delegate: Rectangle{ width: 250 height: 350 color: "#00ffffff" Rectangle { x: 25 y: 25 width: 200 height: 300 color: "#00ffffff" Image { x: 25 y: 25 width: 150 height: 150 visible: true source: model.png fillMode: Image.PreserveAspectFit } Text { x: 0 y: 185 width: parent.width height: 50 visible: true text: model.name font.pixelSize: 30 horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter color: "#ffffff" } Text { x: 0 y: 250 width: parent.width height: 25 visible: true text: model.rfid font.pixelSize: 12 horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter color: "#ffffff" } } } } } Canvas { anchors.fill: parent onPaint: { var ctx = getContext("2d"); ctx.lineWidth = 5; // 设置线的宽度 ctx.strokeStyle = "skyblue"; // 设置线的颜色为白色 ctx.beginPath(); ctx.moveTo(5, (parent.height - 100) / 2 + 100); // 直线的起点 ctx.lineTo(parent.width - 5, (parent.height - 100) / 2 + 100); // 直线的终点 ctx.stroke(); // 绘制直线 } } } Button { id: button_return x: 1408 y: 835 width: 192 height: 75 background: Rectangle { color: "#055eb3" // 设置背景为透明 radius: 10 // 可选,设置圆角 } text: qsTr("返回") font.pixelSize: 30 palette.buttonText: "white" // 设置字体颜色为绿色 Connections { target: button_return onClicked: { materialStatistics.visible = false; materialTakeBack.visible = true; } } } Rectangle { id: delaymatrailstocknotice x: 0 y: 823 width: 300 height: 75 // 减去顶部圆角矩形的高度 color: "#00ffffff" visible: true Image { x: 0 y: 0 width: 75 height: 75 visible: true source: "qrc:/png/takeback.png" fillMode: Image.PreserveAspectFit } Text { x: 80 y: 0 width: 389 height: 75 visible: true text: takestocknotice font.pixelSize: 30 horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter color: "#ffffff" } } Text { x: 514 y: 823 width: 389 height: 75 visible: true font.pixelSize: 30 horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter color: "#ffffff" text: stockcountdownstr } Timer { interval: 100 running: true repeat: true onTriggered: { if(takestock == true) { materialstatistics_text_title.text = "请等待物资盘点结束"; materialstatistics_text_takeDateTime.visible = false; materialstatistics_text_takeName.visible = false; materialstatistics_text_takeText.visible = false; materialstatistics_text_backDateTime.visible = false; materialstatistics_text_backName.visible = false; materialstatistics_text_backText.visible = false; if(takestockviewcount > 0) { takestockviewcount--; } else{ takestockviewcount = 5; if(delaymatrailstocknotice.visible === true) { delaymatrailstocknotice.visible = false; } else{ delaymatrailstocknotice.visible = true; } } if(stockcountdown > 0) { stockcountdown--; stockcountdownstr = "倒计时:" + parseInt(stockcountdown / 10) +"秒" } else{ } } else{ materialstatistics_text_title.text = "本次物资取还记录如下:"; if (pConfig.stakeMaterialList.length === 0) { materialstatistics_text_takeDateTime.visible = true; materialstatistics_text_takeName.visible = false; materialstatistics_text_takeText.visible = false; materialstatistics_text_takeDateTime.text = "本次没有发现物资被领取"; } else { materialstatistics_text_takeDateTime.visible = true; materialstatistics_text_takeName.visible = true; materialstatistics_text_takeText.visible = true; materialstatistics_text_takeDateTime.text = takeDatetime; materialstatistics_text_takeText.text = "领取以下物资:"; } if (pConfig.sbackMaterialList.length === 0) { materialstatistics_text_backDateTime.visible = true; materialstatistics_text_backName.visible = false; materialstatistics_text_backText.visible = false; materialstatistics_text_backDateTime.text = "本次没有发现物资被归还"; } else { materialstatistics_text_backDateTime.visible = true; materialstatistics_text_backName.visible = true; materialstatistics_text_backText.visible = true; materialstatistics_text_backDateTime.text = backDatetime; materialstatistics_text_backText.text = "归还以下物资:"; } delaymatrailstocknotice.visible = true; } } } function set_userinfo() { takeDatetime = Qt.formatDateTime(new Date(), "yyyy-MM-dd hh:mm:ss"); backDatetime = takeDatetime; takeName = pConfig.susername; backName = pConfig.susername; stockcountdown = pConfig.srfidWorkTime / 100; takestocknotice = "物资盘点中,请耐心等待......"; stockcountdownstr = "倒计时:" + parseInt(stockcountdown / 10) +"秒" takestock = true; } function slot_updatetakebackMaterial() { takestock = false; takestocknotice = "物资盘点完成!"; stockcountdownstr = ""; delaymatrailstocknotice.visible = true; var takelist = pConfig.stakeMaterialList; var backlist = pConfig.sbackMaterialList; var materialname = pConfig.smaterialNameList; var materialpicture = pConfig.smaterialPictureList; for (var i = 0; i < takelist.length; i++) { materialtakelistModel.append({png:materialpicture[takelist[i]], name: materialname[takelist[i]], rfid: takelist[i]}); } for (var j = 0; j < backlist.length; j++) { materialbacklistModel.append({png:materialpicture[backlist[j]], name: materialname[backlist[j]], rfid: backlist[j]}); } } function materiallistclear() { materialtakelistModel.clear(); materialbacklistModel.clear(); } }