import QtQuick import QtQuick.Layouts import QtQuick.Controls Item { id: materialexceptionfinish x: 290 y: 130 width: 1600 height: 920 // 主体区域 Rectangle { id: materialexceptionfinish_main x: 0 y: 0 width: parent.width; height: parent.height * 0.88 color: "#272b7ae9" radius: 10 Rectangle { x: 20 y: 20 width: 1560 height: 400 color: "#1a3782" radius: 10 Rectangle { x: 5 y: 5 width: 250 height: 52 color: "#ffffff" radius: 20 Text { anchors.centerIn: parent font.pixelSize: 25 // font.bold: true color: "#ff0000" text: "异常类型:物资错放" } } Rectangle { x: 5 y: 60 width: 412 height: 50 color: "#1a3782" Text { horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter anchors.fill: parent font.pixelSize: 20 color: "#ffffff" text: "以下物资不属于该柜子,请取出!" } } GridView { x: 25 y: 100 width: parent.width - 50 height: parent.height - 120 cellWidth: 250 cellHeight: 350 // model: materialexception_modelmaterialexception delegate: Rectangle{ width: 250 height: 350 color: "#00ffffff" Rectangle { x: 25 y: 25 width: 200 height: 200 color: "#8fffffff" Image { x: 0 y: 0 width: 200 height: 200 visible: true source: model.materialsTypePicture fillMode: Image.PreserveAspectFit } // Text { // x: 0 // y: 185 // width: parent.width // height: 50 // visible: true // text: model.materialsName // font.pixelSize: 30 // horizontalAlignment: Text.AlignHCenter // verticalAlignment: Text.AlignVCenter // color: "#ffffff" // } Text { x: 0 y: 200 width: parent.width height: 25 visible: true text: model.materialsRfid font.pixelSize: 12 horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter color: "#ffffff" } Rectangle { x: 25 y: 125 width: 150 height: 50 color: { if (model.status === "0") return "#00ff00"; // 正常 - 绿色 if (model.status === "1") return "#ff0000"; // 损坏 - 红色 if (model.status === "2") return "#ff9900"; // 过期 - 橙色 if (model.status === "3") return "#ff9900"; // 放错柜子 - 橙色 return "gray"; // 默认颜色 } visible: { return model.status !== "0"; } Text { anchors.centerIn: parent // text: "待还" text:{ if (model.status === "0") return "正常"; if (model.status === "1") return "损坏"; if (model.status === "2") return "过期"; if (model.status === "3") return "放错柜子"; return "未知状态"; // 默认值 } font.pixelSize: 30 horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter color: "#ffffff" } } } } } } } // 状态栏 Rectangle { id: materialexceptionfinish_stat x: 0 y: parent.height * 0.88 width: parent.width; height: parent.height * 0.12 color: "#00ffffff" radius: 10 // 右侧布局 Row { anchors.right: parent.right // 右对齐 spacing: 10 // 开柜按钮 Button { id: materialexceptionfinish_btn_return y: 25 width: 192 height: 75 background: Rectangle { color: "#ff0000" radius: 10 } text: qsTr("关闭") font.pixelSize: 30 palette.buttonText: "white" Connections { target: materialexceptionfinish_btn_return onClicked: { materialexceptionfinish.visible = false; saterialSelModel.visible = true; } } } } } }