MaterialDialogMisplace.qml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. import QtQuick
  2. import QtQuick.Controls
  3. import QtQuick.Layouts
  4. Window {
  5. id: materialdialogmisplace
  6. minimumWidth: 800
  7. maximumWidth: 800
  8. minimumHeight: 600
  9. maximumHeight: 600
  10. flags: Qt.Dialog | Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint
  11. modality: Qt.ApplicationModal
  12. title: ""
  13. color: "white"
  14. visible: true
  15. ListModel {
  16. id: materialdialogmisplace_materialtakelistModel
  17. // ListElement { rfid: "0000000000" }
  18. // ListElement { rfid: "11111111" }
  19. // ListElement { rfid: "11111111" }
  20. // ListElement { rfid: "11111111" }
  21. }
  22. ListModel {
  23. id: materialdialogmisplace_materialbacklistModel
  24. ListElement { rfid: "0000000000" }
  25. ListElement { rfid: "222222222" }
  26. ListElement { rfid: "3333333" }
  27. ListElement { rfid: "44444444" }
  28. }
  29. Rectangle {
  30. x: 0
  31. y: 0
  32. width: parent.width
  33. height: 50 // 设置标题栏高度
  34. color: "#ff3968e9" // 设置标题栏背景色
  35. Text {
  36. x: 20
  37. y: 0
  38. width: 80
  39. height: 50 // 设置标题栏高度
  40. text: "物资错放提醒"
  41. font.pixelSize: 25
  42. horizontalAlignment: Text.AlignLeft
  43. verticalAlignment: Text.AlignVCenter
  44. color: "white"
  45. }
  46. }
  47. Rectangle {
  48. x: 0
  49. y: 75
  50. width: parent.width
  51. height: 400
  52. color: "white"
  53. Rectangle {
  54. x: 0
  55. y: 0
  56. width: parent.width
  57. height: (parent.height) / 2
  58. color: "#002b7ae9"
  59. Text {
  60. x: 50
  61. y: 0
  62. width: 260
  63. height: 50
  64. visible: true
  65. text: "不是本柜子的物资"
  66. font.pixelSize: 25
  67. horizontalAlignment: Text.AlignLeft
  68. verticalAlignment: Text.AlignVCenter
  69. font.bold: true
  70. color: "#000000"
  71. }
  72. GridView {
  73. x: 25
  74. y: 50
  75. width: parent.width - 50
  76. height: parent.height - 50
  77. cellWidth: 250 // 每个单元格的宽度,这里是平均分配宽度给5列
  78. cellHeight: 350 // 每个单元格的高度
  79. model: materialdialogmisplace_materialtakelistModel
  80. delegate: Rectangle{
  81. width: 250
  82. height: 50
  83. color: "#00ffffff"
  84. Rectangle {
  85. x: 0
  86. y: 0
  87. width: 250
  88. height: 50
  89. color: "#00ffffff"
  90. Text {
  91. x: 0
  92. y: 0
  93. width: parent.width
  94. height: 50
  95. visible: true
  96. text: model.rfid
  97. font.pixelSize: 12
  98. horizontalAlignment: Text.AlignHCenter
  99. verticalAlignment: Text.AlignVCenter
  100. color: "#000000"
  101. }
  102. }
  103. }
  104. }
  105. }
  106. Rectangle {
  107. x: 0
  108. y: (parent.height) / 2
  109. width: parent.width
  110. height: (parent.height) / 2
  111. color: "#002b7ae9"
  112. Text {
  113. x: 50
  114. y: 0
  115. width: 260
  116. height: 50
  117. visible: true
  118. text: "不是本柜子的物资"
  119. font.pixelSize: 25
  120. horizontalAlignment: Text.AlignLeft
  121. verticalAlignment: Text.AlignVCenter
  122. font.bold: true
  123. color: "#000000"
  124. }
  125. GridView {
  126. x: 25
  127. y: 50
  128. width: parent.width - 50
  129. height: parent.height - 50
  130. cellWidth: 250 // 每个单元格的宽度,这里是平均分配宽度给5列
  131. cellHeight: 350 // 每个单元格的高度
  132. model: materialdialogmisplace_materialbacklistModel
  133. delegate: Rectangle{
  134. width: 250
  135. height: 50
  136. color: "#00ffffff"
  137. Rectangle {
  138. x: 0
  139. y: 0
  140. width: 250
  141. height: 50
  142. color: "#00ffffff"
  143. Text {
  144. x: 0
  145. y: 0
  146. width: parent.width
  147. height: 50
  148. visible: true
  149. text: model.rfid
  150. font.pixelSize: 12
  151. horizontalAlignment: Text.AlignHCenter
  152. verticalAlignment: Text.AlignVCenter
  153. color: "#000000"
  154. }
  155. }
  156. }
  157. }
  158. }
  159. Canvas {
  160. anchors.fill: parent
  161. onPaint: {
  162. var ctx = getContext("2d");
  163. ctx.lineWidth = 5; // 设置线的宽度
  164. ctx.strokeStyle = "skyblue"; // 设置线的颜色为白色
  165. ctx.beginPath();
  166. ctx.moveTo(5, (parent.height) / 2 ); // 直线的起点
  167. ctx.lineTo(parent.width - 5, (parent.height) / 2); // 直线的终点
  168. ctx.stroke(); // 绘制直线
  169. }
  170. }
  171. }
  172. DialogButtonBox {
  173. id: materialdialogmisplace_buttonBox
  174. x: 0
  175. y: 500
  176. width: parent.width
  177. height: 100
  178. // 自定义按钮
  179. Button {
  180. implicitWidth: 120
  181. implicitHeight: 50
  182. text: "关闭"
  183. background: Rectangle {
  184. color: "green"
  185. radius: 5
  186. }
  187. contentItem: Text {
  188. text: parent.text
  189. font.pixelSize: 30
  190. color: "white"
  191. horizontalAlignment: Text.AlignHCenter
  192. verticalAlignment: Text.AlignVCenter
  193. }
  194. onClicked: {
  195. materialdialogmisplace.hide();
  196. }
  197. }
  198. }
  199. function slot_misplaceRefresh()
  200. {
  201. materialdialogmisplace_materialtakelistModel.clear();
  202. materialdialogmisplace_materialbacklistModel.clear()
  203. var takelist = pConfig.stakeElseMaterialList;
  204. var backlist = pConfig.sbackElseMaterialList;
  205. var materialname = pConfig.smaterialNameList;
  206. var materialpicture = pConfig.smaterialPictureList;
  207. for (var i = 0; i < takelist.length; i++) {
  208. materialdialogmisplace_materialtakelistModel.append({png:materialpicture[takelist[i]], name: materialname[takelist[i]], rfid: takelist[i]});
  209. }
  210. for (var j = 0; j < backlist.length; j++) {
  211. materialdialogmisplace_materialbacklistModel.append({png:materialpicture[backlist[j]], name: materialname[backlist[j]], rfid: backlist[j]});
  212. }
  213. }
  214. }