MaterialExceptionFinish.qml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. import QtQuick
  2. import QtQuick.Layouts
  3. import QtQuick.Controls
  4. Item {
  5. id: materialexceptionfinish
  6. x: 290
  7. y: 130
  8. width: 1600
  9. height: 920
  10. // 主体区域
  11. Rectangle {
  12. id: materialexceptionfinish_main
  13. x: 0
  14. y: 0
  15. width: parent.width;
  16. height: parent.height * 0.88
  17. color: "#272b7ae9"
  18. radius: 10
  19. Rectangle {
  20. x: 20
  21. y: 20
  22. width: 1560
  23. height: 400
  24. color: "#1a3782"
  25. radius: 10
  26. Rectangle {
  27. x: 5
  28. y: 5
  29. width: 250
  30. height: 52
  31. color: "#ffffff"
  32. radius: 20
  33. Text {
  34. anchors.centerIn: parent
  35. font.pixelSize: 25
  36. // font.bold: true
  37. color: "#ff0000"
  38. text: "异常类型:物资错放"
  39. }
  40. }
  41. Rectangle {
  42. x: 5
  43. y: 60
  44. width: 412
  45. height: 50
  46. color: "#1a3782"
  47. Text {
  48. horizontalAlignment: Text.AlignLeft
  49. verticalAlignment: Text.AlignVCenter
  50. anchors.fill: parent
  51. font.pixelSize: 20
  52. color: "#ffffff"
  53. text: "以下物资不属于该柜子,请取出!"
  54. }
  55. }
  56. GridView {
  57. x: 25
  58. y: 100
  59. width: parent.width - 50
  60. height: parent.height - 120
  61. cellWidth: 250
  62. cellHeight: 350
  63. // model: materialexception_modelmaterialexception
  64. delegate: Rectangle{
  65. width: 250
  66. height: 350
  67. color: "#00ffffff"
  68. Rectangle {
  69. x: 25
  70. y: 25
  71. width: 200
  72. height: 200
  73. color: "#8fffffff"
  74. Image {
  75. x: 0
  76. y: 0
  77. width: 200
  78. height: 200
  79. visible: true
  80. source: model.materialsTypePicture
  81. fillMode: Image.PreserveAspectFit
  82. }
  83. // Text {
  84. // x: 0
  85. // y: 185
  86. // width: parent.width
  87. // height: 50
  88. // visible: true
  89. // text: model.materialsName
  90. // font.pixelSize: 30
  91. // horizontalAlignment: Text.AlignHCenter
  92. // verticalAlignment: Text.AlignVCenter
  93. // color: "#ffffff"
  94. // }
  95. Text {
  96. x: 0
  97. y: 200
  98. width: parent.width
  99. height: 25
  100. visible: true
  101. text: model.materialsRfid
  102. font.pixelSize: 12
  103. horizontalAlignment: Text.AlignHCenter
  104. verticalAlignment: Text.AlignVCenter
  105. color: "#ffffff"
  106. }
  107. Rectangle {
  108. x: 25
  109. y: 125
  110. width: 150
  111. height: 50
  112. color: {
  113. if (model.status === "0") return "#00ff00"; // 正常 - 绿色
  114. if (model.status === "1") return "#ff0000"; // 损坏 - 红色
  115. if (model.status === "2") return "#ff9900"; // 过期 - 橙色
  116. if (model.status === "3") return "#ff9900"; // 放错柜子 - 橙色
  117. return "gray"; // 默认颜色
  118. }
  119. visible: {
  120. return model.status !== "0";
  121. }
  122. Text {
  123. anchors.centerIn: parent
  124. // text: "待还"
  125. text:{
  126. if (model.status === "0") return "正常";
  127. if (model.status === "1") return "损坏";
  128. if (model.status === "2") return "过期";
  129. if (model.status === "3") return "放错柜子";
  130. return "未知状态"; // 默认值
  131. }
  132. font.pixelSize: 30
  133. horizontalAlignment: Text.AlignHCenter
  134. verticalAlignment: Text.AlignVCenter
  135. color: "#ffffff"
  136. }
  137. }
  138. }
  139. }
  140. }
  141. }
  142. }
  143. // 状态栏
  144. Rectangle {
  145. id: materialexceptionfinish_stat
  146. x: 0
  147. y: parent.height * 0.88
  148. width: parent.width;
  149. height: parent.height * 0.12
  150. color: "#00ffffff"
  151. radius: 10
  152. // 右侧布局
  153. Row {
  154. anchors.right: parent.right // 右对齐
  155. spacing: 10
  156. // 开柜按钮
  157. Button {
  158. id: materialexceptionfinish_btn_return
  159. y: 25
  160. width: 192
  161. height: 75
  162. background: Rectangle {
  163. color: "#ff0000"
  164. radius: 10
  165. }
  166. text: qsTr("关闭")
  167. font.pixelSize: 30
  168. palette.buttonText: "white"
  169. Connections {
  170. target: materialexceptionfinish_btn_return
  171. onClicked: {
  172. materialexceptionfinish.visible = false;
  173. saterialSelModel.visible = true;
  174. }
  175. }
  176. }
  177. }
  178. }
  179. }