MaterialCheckSave.qml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464
  1. import QtQuick
  2. import QtQuick.Controls
  3. import QtQuick.Layouts
  4. Item {
  5. id: materialchecksave
  6. x: 290
  7. y: 130
  8. width: 1600
  9. height: 920
  10. property int planId: 0
  11. property string strMaterialCheckPlanGet: ""
  12. Connections {
  13. target: materialchecksave
  14. onVisibleChanged: {
  15. if (materialchecksave.visible === true)
  16. {
  17. build_view();
  18. }
  19. }
  20. }
  21. ListModel {
  22. id: materialchecksave_tableModel
  23. }
  24. // 确认操作弹出框
  25. Dialog {
  26. id: materialchecksave_dialog_confirm
  27. title: "操作确认"
  28. x: parent.width / 2 - width / 2
  29. y: parent.height / 2 - height / 2
  30. width: 600
  31. height: 400
  32. clip: true
  33. modal: true
  34. // 自定义背景(带圆角)
  35. background: Rectangle {
  36. color: "white"
  37. clip: true
  38. }
  39. // 自定义标题栏
  40. header: Rectangle {
  41. x: 0
  42. y: 0
  43. width: parent.width
  44. height: 50 // 设置标题栏高度
  45. color: "#ff3968e9" // 设置标题栏背景色
  46. // 标题文本
  47. Text {
  48. x: 20
  49. y: 0
  50. width: 80
  51. height: 50 // 设置标题栏高度
  52. text: materialchecksave_dialog_confirm.title
  53. font.pixelSize: 25
  54. horizontalAlignment: Text.AlignLeft
  55. verticalAlignment: Text.AlignVCenter
  56. color: "white"
  57. }
  58. }
  59. contentItem: Rectangle {
  60. x: 0
  61. y: 0
  62. width: parent.width
  63. height: 200
  64. color: "white"
  65. Text {
  66. width: parent.width
  67. height: 200
  68. text: "确定要提交检查结果吗?"
  69. font.pixelSize: 30
  70. horizontalAlignment: Text.AlignHCenter
  71. verticalAlignment: Text.AlignVCenter
  72. }
  73. }
  74. // 自定义 DialogButtonBox
  75. DialogButtonBox {
  76. id: materialchecksave_buttonBox
  77. x: 0
  78. y: 250
  79. width: parent.width
  80. height: 100
  81. // 自定义按钮
  82. Button {
  83. implicitWidth: 120
  84. implicitHeight: 50
  85. text: "确认"
  86. background: Rectangle {
  87. color: "green"
  88. radius: 5
  89. }
  90. contentItem: Text {
  91. text: parent.text
  92. font.pixelSize: 30
  93. color: "white"
  94. horizontalAlignment: Text.AlignHCenter
  95. verticalAlignment: Text.AlignVCenter
  96. }
  97. onClicked: {
  98. mainScreen.changeModel_text("物资检查表");
  99. submit_check_result();
  100. materialCheckPlan.visible = true;
  101. // materialCheckSave.visible = false;
  102. materialchecksave_dialog_confirm.close()
  103. }
  104. }
  105. Button {
  106. implicitWidth: 120
  107. implicitHeight: 50
  108. text: "取消"
  109. background: Rectangle {
  110. color: "red"
  111. radius: 5
  112. }
  113. contentItem: Text {
  114. text: parent.text
  115. font.pixelSize: 30
  116. color: "white"
  117. horizontalAlignment: Text.AlignHCenter
  118. verticalAlignment: Text.AlignVCenter
  119. }
  120. onClicked: {
  121. materialchecksave_dialog_confirm.reject()
  122. }
  123. }
  124. }
  125. }
  126. // 提交结果
  127. Button {
  128. id: materialcheckform_btn_submit
  129. x: 928
  130. y: 835
  131. width: 192
  132. height: 75
  133. background: Rectangle {
  134. color: "#ff9900"
  135. radius: 10
  136. }
  137. text: qsTr("提交结果")
  138. font.pixelSize: 30
  139. palette.buttonText: "white"
  140. Connections {
  141. target: materialcheckform_btn_submit
  142. onClicked: {
  143. materialchecksave_dialog_confirm.open();
  144. }
  145. }
  146. }
  147. // 继续检查
  148. Button {
  149. id: materialchecksave_btn_proceed_check
  150. x: 1168
  151. y: 835
  152. width: 192
  153. height: 75
  154. background: Rectangle {
  155. color: "#ff0000" // 设置背景为透明
  156. radius: 10 // 可选,设置圆角
  157. }
  158. text: qsTr("继续检查")
  159. font.pixelSize: 30
  160. palette.buttonText: "white" // 设置字体颜色为绿色
  161. Connections {
  162. target: materialchecksave_btn_proceed_check
  163. onClicked: {
  164. // materialCheckSave.visible = false;
  165. materialCheckForm.visible = true;
  166. mainScreen.resetLogin_timeout();
  167. }
  168. }
  169. }
  170. // 返回按钮
  171. Button {
  172. id: materialchecksave_btn_return
  173. x: 1408
  174. y: 835
  175. width: 192
  176. height: 75
  177. background: Rectangle {
  178. color: "#055eb3"
  179. radius: 10
  180. }
  181. text: qsTr("返回")
  182. font.pixelSize: 30
  183. palette.buttonText: "white"
  184. Connections {
  185. target: button_return_instructions
  186. onClicked: {
  187. // materialCheckSave.visible = false;
  188. materialSelmodel.visible = true;
  189. mainScreen.resetLogin_timeout();
  190. }
  191. }
  192. }
  193. // 主体区域
  194. Rectangle {
  195. id: materialchecksave_rect_main
  196. width: 1600
  197. height: 800
  198. color: "#272b7ae9"
  199. radius: 20
  200. clip: true
  201. // 签名
  202. Rectangle {
  203. id: materialchecksave_btn_sign
  204. x: 1400
  205. y: 25
  206. width: 180
  207. height: 50
  208. color: "#008000"
  209. radius: 10
  210. Text
  211. {
  212. id: materialchecksave_text_sign
  213. // anchors.fill: parent
  214. anchors.centerIn: parent
  215. text: qsTr("签名")
  216. font.pixelSize: 30
  217. color: "#ffffff"
  218. }
  219. Image {
  220. id: materialchecksave_image_sign;
  221. anchors.fill: parent
  222. }
  223. MouseArea
  224. {
  225. anchors.fill: parent
  226. onClicked: {
  227. // materialCheckSave.visible = false;
  228. materialCheckSign.visible = true;
  229. mainScreen.resetLogin_timeout();
  230. }
  231. }
  232. }
  233. // 计划日期区域
  234. Text {
  235. id: materialchecksave_text_plan_date
  236. x: 0
  237. y: 0
  238. width: 1600
  239. height: 90
  240. text: "计划日期:"
  241. font.pixelSize: 30
  242. color: "#d7d7d2"
  243. horizontalAlignment: Text.AlignLeft
  244. verticalAlignment: Text.AlignVCenter
  245. leftPadding: 20 // 添加左边距使文本不紧贴边缘
  246. }
  247. // 计划状态区域
  248. Text {
  249. id: materialchecksave_text_plan_stat
  250. x: 0
  251. y: 0
  252. width: 1600
  253. height: 90
  254. text: "计划状态:"
  255. font.pixelSize: 30
  256. color: "#d7d7d2"
  257. horizontalAlignment: Text.AlignLeft
  258. verticalAlignment: Text.AlignVCenter
  259. leftPadding: 360 // 添加左边距使文本不紧贴边缘
  260. }
  261. // 表格区域
  262. Rectangle {
  263. x: 10
  264. y: 90
  265. width: 1580
  266. height: 700
  267. color: "#272b7ae9"
  268. radius: 20
  269. // 表格
  270. Column {
  271. anchors.fill: parent
  272. spacing: 0
  273. // 表头
  274. Row {
  275. id: materialchecksave_header
  276. width: parent.width
  277. height: 100
  278. spacing: 0
  279. Repeater {
  280. model: ["物资类型", "总数量", "借出数量", "待检数量", "正常数量", "过期数量", "损坏数量"]
  281. Rectangle {
  282. width: parent.width / 7
  283. height: parent.height
  284. color: "#33ffffff"
  285. border.color: "#47bfff"
  286. clip: true
  287. Text {
  288. anchors.centerIn: parent
  289. text: modelData
  290. font.pixelSize: 25
  291. color: "#d7d7d2"
  292. font.bold: true
  293. }
  294. }
  295. }
  296. }
  297. // 表格内容
  298. ListView {
  299. width: parent.width
  300. height: parent.height - materialchecksave_header.height
  301. clip: true
  302. model: materialchecksave_tableModel
  303. delegate: Row {
  304. width: 1580
  305. height: 100
  306. spacing: 0
  307. property var rowData: [mainNumber, lendNumber, waitNumber, normalNumber, expireNumber, damageNumber]
  308. Rectangle {
  309. width: parent.width / 7
  310. height: parent.height
  311. color: "#272b7ae9"
  312. border.color: "#47bfff"
  313. ToolButton
  314. {
  315. anchors.centerIn: parent
  316. enabled: false // 不可点击
  317. display: AbstractButton.TextBesideIcon // 文字在图标旁边
  318. icon.source: model.materialIcon
  319. icon.width: 36
  320. icon.height: 30
  321. text: model.materialType
  322. palette.buttonText: "#d7d7d2"
  323. font {
  324. pixelSize: 25
  325. }
  326. }
  327. }
  328. Repeater {
  329. model: 6
  330. Rectangle {
  331. width: parent.width / 7
  332. height: parent.height
  333. color: "#272b7ae9"
  334. border.color: "#47bfff"
  335. Text {
  336. anchors.centerIn: parent
  337. font.pixelSize: 25
  338. color: "#d7d7d2"
  339. text: parent.parent.rowData[index]
  340. }
  341. }
  342. }
  343. }
  344. }
  345. }
  346. }
  347. }
  348. function build_view()
  349. {
  350. materialchecksave_tableModel.clear();
  351. var jsonObjRoot = JSON.parse(materialCheckPlan.strMaterialCheckPlanGet);
  352. if (jsonObjRoot.code === 200)
  353. {
  354. var jsonObjData = jsonObjRoot.data;
  355. planId = jsonObjData.planId;
  356. var planDate = jsonObjData.planDate;
  357. var planStat = jsonObjData.status;
  358. planStat = (planStat === "0" ? "进行中" : planStat === "1" ? "已完成" : "未定义");
  359. materialchecksave_text_plan_date.text = "计划日期:" + planDate;
  360. materialchecksave_text_plan_stat.text = "计划状态:" + planStat;
  361. var jsonArrList = jsonObjData.list;
  362. for (var i = 0; i < jsonArrList.length; ++i)
  363. {
  364. var jsonObjList = jsonArrList[i];
  365. var materialType = jsonObjList.materialsTypeName;
  366. var materialIcon = jsonObjList.materialsTypeIcon;
  367. var mainNumber = jsonObjList.allNumber;
  368. var lendNumber = jsonObjList.badNumber;
  369. var waitNumber = jsonObjList.checkNumber;
  370. var normalNumber = jsonObjList.loanNumber;
  371. var expireNumber = jsonObjList.normalNumber;
  372. var damageNumber = jsonObjList.timeoutNumber;
  373. materialchecksave_tableModel.append({
  374. materialType: materialType,
  375. materialIcon: materialIcon,
  376. mainNumber: mainNumber,
  377. lendNumber: lendNumber,
  378. waitNumber: waitNumber,
  379. normalNumber: normalNumber,
  380. expireNumber: expireNumber,
  381. damageNumber: damageNumber,
  382. });
  383. }
  384. }
  385. }
  386. function image_show(fileUrl)
  387. {
  388. if (fileUrl === "")
  389. {
  390. materialchecksave_text_sign.visible = true;
  391. materialchecksave_image_sign.visible = false;
  392. }
  393. else
  394. {
  395. materialchecksave_text_sign.visible = false;
  396. materialchecksave_image_sign.visible = true;
  397. materialchecksave_image_sign.source = fileUrl;
  398. }
  399. }
  400. function submit_check_result()
  401. {
  402. // var jsonObjRoot;
  403. // jsonObjRoot["list"] = materialCheckForm.ret_check_result();
  404. // var strJson = JSON.stringify(jsonObjRoot);
  405. // console.log(jsonObjRoot);
  406. }
  407. }
  408. http://192.168.0.10:9191/dev-api/iscs/hardware/material-api/getLastCheckPlanByCabinetCode?cabinetCode=CABINET_006
  409. http://192.168.0.10:9191/dev-api/iscs/hardware/material-api/getCheckMaterialsByCabinetCode?cabinetCode=CABINET_006&planId=85