MaterialCheckForm.qml 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387
  1. import QtQuick
  2. import QtQuick.Controls
  3. import QtQuick.Layouts
  4. import com.InteractiveTask 1.0
  5. Item {
  6. id: materialcheckform
  7. x: 290
  8. y: 130
  9. width: 1600
  10. height: 920
  11. property string strMaterialCheckFormGet: ""
  12. signal signal_getMaterialCheckForm(int planId);
  13. signal signal_postSaveForm(string data);
  14. onVisibleChanged: {
  15. if (visible === true)
  16. {
  17. proThread.moveCursorTo(0, 0);
  18. }
  19. if (visible === false)
  20. materialcheckform_dialog_confirm.close();
  21. }
  22. PromptInfo
  23. {
  24. id: materialcheckform_prompt_info;
  25. }
  26. Connections {
  27. target: materialcheckform
  28. onVisibleChanged: {
  29. if (materialcheckform.visible === true)
  30. {
  31. waitPromptBox.show();
  32. signal_getMaterialCheckForm(materialCheckPlan.planId);
  33. }
  34. else
  35. {
  36. materialcheckform_tableModel.clear();
  37. materialcheckform_tableModel_standard.clear();
  38. }
  39. }
  40. }
  41. ListModel {
  42. id: materialcheckform_tableModel
  43. // 物资标志
  44. // materialFlag: 0 = 未定义、 1 = 正常、 2 = 损坏、 3 = 过期
  45. // onDataChanged: {
  46. // // build_model_view()
  47. // }
  48. }
  49. ListModel {
  50. id: materialcheckform_tableModel_standard
  51. }
  52. Dialog {
  53. id: materialcheckform_dialog_confirm
  54. title: "操作确认"
  55. x: parent.width / 2 - width / 2
  56. y: parent.height / 2 - height / 2
  57. width: 600
  58. height: 400
  59. clip: true
  60. modal: true
  61. property int flag: 0;
  62. // 自定义背景(带圆角)
  63. background: Rectangle {
  64. color: "white"
  65. clip: true
  66. }
  67. // 自定义标题栏
  68. header: Rectangle {
  69. x: 0
  70. y: 0
  71. width: parent.width
  72. height: 50 // 设置标题栏高度
  73. color: "#ff3968e9" // 设置标题栏背景色
  74. // 标题文本
  75. Text {
  76. x: 20
  77. y: 0
  78. width: 80
  79. height: 50 // 设置标题栏高度
  80. text: materialcheckform_dialog_confirm.title
  81. font.pixelSize: 25
  82. horizontalAlignment: Text.AlignLeft
  83. verticalAlignment: Text.AlignVCenter
  84. color: "white"
  85. }
  86. }
  87. contentItem: Rectangle {
  88. x: 0
  89. y: 0
  90. width: parent.width
  91. height: 200
  92. color: "white"
  93. Text {
  94. id: materialcheckform_text_dialog_item;
  95. width: parent.width
  96. height: 100
  97. text: ""
  98. font.pixelSize: 30
  99. horizontalAlignment: Text.AlignHCenter
  100. verticalAlignment: Text.AlignVCenter
  101. }
  102. }
  103. // 单选按钮
  104. Item {
  105. id: materialcheckform_item_check
  106. x: 0
  107. y: 150
  108. width: parent.width
  109. height: 100
  110. Row {
  111. anchors.horizontalCenter: parent.horizontalCenter
  112. spacing: 20
  113. // 正常单选按钮
  114. Rectangle {
  115. id: materialcheckform_btn_normal
  116. width: 164
  117. height: 61
  118. color: "#33008000"
  119. radius: 20
  120. clip: true
  121. ToolButton
  122. {
  123. anchors.centerIn: parent
  124. enabled: false // 不可点击
  125. display: AbstractButton.TextBesideIcon // 文字在图标旁边
  126. icon.source: ""
  127. icon.width: 36
  128. icon.height: 30
  129. text: "正常"
  130. palette.buttonText: "#ffffff"
  131. font {
  132. pixelSize: 25
  133. }
  134. }
  135. MouseArea {
  136. anchors.fill: parent
  137. onClicked: {
  138. materialcheckform_dialog_confirm.flag =
  139. (materialcheckform_dialog_confirm.flag === 1 ? 0 : 1);
  140. }
  141. }
  142. }
  143. Rectangle {
  144. id: materialcheckform_btn_expire;
  145. width: 164
  146. height: 61
  147. color: "#33ff9900"
  148. radius: 20
  149. clip: true
  150. ToolButton
  151. {
  152. anchors.centerIn: parent
  153. enabled: false // 不可点击
  154. display: AbstractButton.TextBesideIcon // 文字在图标旁边
  155. icon.source: ""
  156. icon.width: 36
  157. icon.height: 30
  158. text: "过期"
  159. palette.buttonText: "#ffffff"
  160. font {
  161. pixelSize: 25
  162. }
  163. }
  164. MouseArea {
  165. anchors.fill: parent
  166. onClicked: {
  167. materialcheckform_dialog_confirm.flag =
  168. (materialcheckform_dialog_confirm.flag === 2 ? 0 : 2);
  169. }
  170. }
  171. }
  172. Rectangle {
  173. id: materialcheckform_btn_damage;
  174. width: 164
  175. height: 61
  176. color: "#33ff0000"
  177. radius: 20
  178. clip: true
  179. ToolButton
  180. {
  181. anchors.centerIn: parent
  182. enabled: false // 不可点击
  183. display: AbstractButton.TextBesideIcon // 文字在图标旁边
  184. icon.source: ""
  185. icon.width: 36
  186. icon.height: 30
  187. text: "损坏"
  188. palette.buttonText: "#ffffff"
  189. font {
  190. pixelSize: 25
  191. }
  192. }
  193. MouseArea {
  194. anchors.fill: parent
  195. onClicked: {
  196. materialcheckform_dialog_confirm.flag =
  197. (materialcheckform_dialog_confirm.flag === 3 ? 0 : 3);
  198. }
  199. }
  200. }
  201. }
  202. }
  203. // 自定义 DialogButtonBox
  204. DialogButtonBox {
  205. id: materialcheckform_buttonBox
  206. x: 0
  207. y: 250
  208. width: parent.width
  209. height: 100
  210. // 自定义按钮
  211. Button {
  212. implicitWidth: 120
  213. implicitHeight: 50
  214. text: "确认"
  215. background: Rectangle {
  216. color: "green"
  217. radius: 5
  218. }
  219. contentItem: Text {
  220. text: parent.text
  221. font.pixelSize: 30
  222. color: "white"
  223. horizontalAlignment: Text.AlignHCenter
  224. verticalAlignment: Text.AlignVCenter
  225. }
  226. onClicked: {
  227. if (materialcheckform_dialog_confirm.flag != 0)
  228. {
  229. for (var i = 0; i < materialcheckform_tableModel.count; i++)
  230. {
  231. var item = materialcheckform_tableModel.get(i);
  232. if (item.materialFlag === 0)
  233. {
  234. item.materialFlag = materialcheckform_dialog_confirm.flag;
  235. }
  236. }
  237. }
  238. materialcheckform_dialog_confirm.close()
  239. }
  240. }
  241. Button {
  242. implicitWidth: 120
  243. implicitHeight: 50
  244. text: "取消"
  245. background: Rectangle {
  246. color: "red"
  247. radius: 5
  248. }
  249. contentItem: Text {
  250. text: parent.text
  251. font.pixelSize: 30
  252. color: "white"
  253. horizontalAlignment: Text.AlignHCenter
  254. verticalAlignment: Text.AlignVCenter
  255. }
  256. onClicked: {
  257. materialcheckform_dialog_confirm.reject()
  258. }
  259. }
  260. }
  261. onFlagChanged: {
  262. materialcheckform_btn_normal.color= "#33008000";
  263. materialcheckform_btn_expire.color= "#33FF9900";
  264. materialcheckform_btn_damage.color= "#33FF0000";
  265. switch (materialcheckform_dialog_confirm.flag)
  266. {
  267. case 1:{
  268. materialcheckform_btn_normal.color= "#008000";
  269. }break;
  270. case 2:{
  271. materialcheckform_btn_expire.color= "#FF9900";
  272. }break;
  273. case 3:{
  274. materialcheckform_btn_damage.color= "#FF0000";
  275. }break;
  276. }
  277. }
  278. }
  279. Dialog {
  280. id: materialcheckform_dialog_confirm_prompt
  281. title: "操作确认"
  282. x: parent.width / 2 - width / 2
  283. y: parent.height / 2 - height / 2
  284. width: 600
  285. height: 400
  286. clip: true
  287. modal: true
  288. property int flag: 0;
  289. // 自定义背景(带圆角)
  290. background: Rectangle {
  291. color: "white"
  292. clip: true
  293. }
  294. // 自定义标题栏
  295. header: Rectangle {
  296. x: 0
  297. y: 0
  298. width: parent.width
  299. height: 50 // 设置标题栏高度
  300. color: "#ff3968e9" // 设置标题栏背景色
  301. // 标题文本
  302. Text {
  303. x: 20
  304. y: 0
  305. width: 80
  306. height: 50 // 设置标题栏高度
  307. text: materialcheckform_dialog_confirm_prompt.title
  308. font.pixelSize: 25
  309. horizontalAlignment: Text.AlignLeft
  310. verticalAlignment: Text.AlignVCenter
  311. color: "white"
  312. }
  313. }
  314. contentItem: Rectangle {
  315. x: 0
  316. y: 0
  317. width: parent.width
  318. height: 200
  319. color: "white"
  320. Text {
  321. id: materialcheckform_text_dialog_prompt;
  322. width: parent.width
  323. height: 100
  324. text: ""
  325. font.pixelSize: 30
  326. horizontalAlignment: Text.AlignHCenter
  327. verticalAlignment: Text.AlignVCenter
  328. }
  329. }
  330. // 自定义 DialogButtonBox
  331. DialogButtonBox {
  332. x: 0
  333. y: 250
  334. width: parent.width
  335. height: 100
  336. // 自定义按钮
  337. Button {
  338. implicitWidth: 120
  339. implicitHeight: 50
  340. text: "确认"
  341. background: Rectangle {
  342. color: "green"
  343. radius: 5
  344. }
  345. contentItem: Text {
  346. text: parent.text
  347. font.pixelSize: 30
  348. color: "white"
  349. horizontalAlignment: Text.AlignHCenter
  350. verticalAlignment: Text.AlignVCenter
  351. }
  352. onClicked: {
  353. materialcheckform_dialog_confirm_prompt.close();
  354. }
  355. }
  356. Button {
  357. implicitWidth: 120
  358. implicitHeight: 50
  359. text: "取消"
  360. background: Rectangle {
  361. color: "red"
  362. radius: 5
  363. }
  364. contentItem: Text {
  365. text: parent.text
  366. font.pixelSize: 30
  367. color: "white"
  368. horizontalAlignment: Text.AlignHCenter
  369. verticalAlignment: Text.AlignVCenter
  370. }
  371. onClicked: {
  372. materialcheckform_dialog_confirm_prompt.reject()
  373. }
  374. }
  375. }
  376. }
  377. // 一键检查
  378. Button {
  379. id: materialcheckform_btn_onekey_check
  380. x: 928
  381. y: 835
  382. width: 192
  383. height: 75
  384. background: Rectangle {
  385. color: "#ff9900" // 设置背景为透明
  386. radius: 10 // 可选,设置圆角
  387. }
  388. text: qsTr("一键检查")
  389. font.pixelSize: 30
  390. palette.buttonText: "white" // 设置字体颜色为绿色
  391. Connections {
  392. target: materialcheckform_btn_onekey_check
  393. onClicked: {
  394. var iCount = 0;
  395. for (var i = 0; i < materialcheckform_tableModel.count; i++)
  396. {
  397. var item = materialcheckform_tableModel.get(i);
  398. if (item.materialFlag === 0)
  399. {
  400. iCount++;
  401. }
  402. }
  403. var strText;
  404. if (iCount > 0)
  405. {
  406. strText = "将待检查的" + iCount + "件物资,全部标注为:";
  407. materialcheckform_item_check.visible = true;
  408. }
  409. else
  410. {
  411. strText = "没有待检查的物资";
  412. materialcheckform_item_check.visible = false;
  413. }
  414. materialcheckform_text_dialog_item.text = strText;
  415. materialcheckform_dialog_confirm.open();
  416. }
  417. }
  418. }
  419. // 保存
  420. Button {
  421. id: materialcheckform_btn_save
  422. x: 1168
  423. y: 835
  424. width: 192
  425. height: 75
  426. background: Rectangle {
  427. color: "#ff0000" // 设置背景为透明
  428. radius: 10 // 可选,设置圆角
  429. }
  430. text: qsTr("保存")
  431. font.pixelSize: 30
  432. palette.buttonText: "white" // 设置字体颜色为绿色
  433. Connections {
  434. target: materialcheckform_btn_save
  435. onClicked: {
  436. infoPromptBox.title("操作确认");
  437. infoPromptBox.message("确定要保存检查结果吗?");
  438. infoPromptBox.button_clear();
  439. infoPromptBox.button_push("red", "取消", null, null);
  440. infoPromptBox.button_push(
  441. "#055eb3", "确定", ()=>{
  442. var taskType = InteractiveTask.TypeHttpPost_insertCheckRecord;
  443. var jsonObjRoot = {};
  444. var jsonArrList = [];
  445. for (var i = 0; i < materialcheckform_tableModel.count; i++)
  446. {
  447. var item = materialcheckform_tableModel.get(i);
  448. var jsonObjList = item.materialJson;
  449. if (item.materialFlag === 0)
  450. {
  451. jsonObjList["status"] = "";
  452. jsonObjList["reason"] = "";
  453. }
  454. else if (item.materialFlag === 1)
  455. {
  456. jsonObjList["status"] = "0";
  457. jsonObjList["reason"] = "";
  458. }
  459. else if (item.materialFlag === 2)
  460. {
  461. jsonObjList["status"] = "1";
  462. jsonObjList["reason"] = "2";
  463. }
  464. else if (item.materialFlag === 3)
  465. {
  466. jsonObjList["status"] = "1";
  467. jsonObjList["reason"] = "1";
  468. }
  469. jsonArrList.push(jsonObjList);
  470. }
  471. jsonObjRoot["list"] = jsonArrList;
  472. var strJson = JSON.stringify(jsonObjRoot);
  473. // 添加提交任务
  474. interactiveCore.appendTask(
  475. taskType, strJson, (json)=>{
  476. var jsonObjRoot = JSON.parse(json);
  477. if (jsonObjRoot.code === 200)
  478. {
  479. var iWait = 0;
  480. var iNormal = 0;
  481. var iExpire = 0;
  482. var iDamage = 0;
  483. var text = "";
  484. for (var i = 0; i < materialcheckform_tableModel.count; i++)
  485. {
  486. var item = materialcheckform_tableModel.get(i);
  487. switch (item.materialFlag)
  488. {
  489. case 0: iWait++; break;
  490. case 1: iNormal++; break;
  491. case 2: iExpire++; break;
  492. case 3: iDamage++; break;
  493. }
  494. }
  495. materialcheckform_text_wait_check.text = "待检查:" + iWait
  496. materialcheckform_text_normal_check.text = "正常:" + iNormal
  497. materialcheckform_text_expire_check.text = "过期:" + iExpire
  498. materialcheckform_text_damage_check.text = "损坏:" + iDamage
  499. if (iWait > 0)
  500. {
  501. text = "保存成功,还有" + iWait + "件物资待检查";
  502. }
  503. else
  504. {
  505. text = "保存成功,没有物资待检查";
  506. }
  507. infoPromptBox.title("保存成功");
  508. infoPromptBox.message(text);
  509. infoPromptBox.button_clear();
  510. infoPromptBox.button_push("#055eb3", "确定", null, null);
  511. infoPromptBox.show();
  512. }
  513. else
  514. {
  515. infoPromptBox.title("保存失败");
  516. infoPromptBox.message(jsonObjRoot.msg);
  517. infoPromptBox.button_clear();
  518. infoPromptBox.button_push("#055eb3", "确定", null, null);
  519. infoPromptBox.show();
  520. }
  521. });
  522. }, null);
  523. infoPromptBox.show();
  524. }
  525. }
  526. }
  527. // 返回按钮
  528. Button {
  529. id: materialcheckform_btn_return
  530. x: 1408
  531. y: 835
  532. width: 192
  533. height: 75
  534. background: Rectangle {
  535. color: "#055eb3" // 设置背景为透明
  536. radius: 10 // 可选,设置圆角
  537. }
  538. text: qsTr("返回")
  539. font.pixelSize: 30
  540. palette.buttonText: "white" // 设置字体颜色为绿色
  541. Connections {
  542. target: materialcheckform_btn_return
  543. onClicked: {
  544. if (pConfig.sopenDoor)
  545. {
  546. infoPromptBox.title("提示");
  547. infoPromptBox.message("开柜状态下不允许该操作");
  548. infoPromptBox.button_clear();
  549. infoPromptBox.button_push("#055eb3", "确定", null, null);
  550. infoPromptBox.show();
  551. }
  552. else
  553. {
  554. materialcheckform.visible = false;
  555. materialCheckPlan.visible = true;
  556. mainScreen.changeModel_text("物资检查");
  557. mainScreen.resetLogin_timeout();
  558. }
  559. }
  560. }
  561. }
  562. // 待检查 文字区域
  563. Text {
  564. id: materialcheckform_text_wait_check
  565. x: 0
  566. y: 810
  567. width: 1600
  568. height: 90
  569. text: "待检查:0"
  570. font.pixelSize: 30
  571. color: "#d7d7d2"
  572. horizontalAlignment: Text.AlignLeft
  573. verticalAlignment: Text.AlignVCenter
  574. leftPadding: 20 // 添加左边距使文本不紧贴边缘
  575. }
  576. // 正常 文字区域
  577. Text {
  578. id: materialcheckform_text_normal_check
  579. x: 0
  580. y: 810
  581. width: 1600
  582. height: 90
  583. text: "正常:0"
  584. font.pixelSize: 30
  585. color: "#d7d7d2"
  586. horizontalAlignment: Text.AlignLeft
  587. verticalAlignment: Text.AlignVCenter
  588. leftPadding: 250 // 添加左边距使文本不紧贴边缘
  589. }
  590. // 过期 文字区域
  591. Text {
  592. id: materialcheckform_text_expire_check
  593. x: 0
  594. y: 810
  595. width: 1600
  596. height: 90
  597. text: "过期:0"
  598. font.pixelSize: 30
  599. color: "#d7d7d2"
  600. horizontalAlignment: Text.AlignLeft
  601. verticalAlignment: Text.AlignVCenter
  602. leftPadding: 450 // 添加左边距使文本不紧贴边缘
  603. }
  604. // 损坏 文字区域
  605. Text {
  606. id: materialcheckform_text_damage_check
  607. x: 0
  608. y: 810
  609. width: 1600
  610. height: 90
  611. text: "损坏:0"
  612. font.pixelSize: 30
  613. color: "#d7d7d2"
  614. horizontalAlignment: Text.AlignLeft
  615. verticalAlignment: Text.AlignVCenter
  616. leftPadding: 650 // 添加左边距使文本不紧贴边缘
  617. }
  618. // 主体区域
  619. Rectangle {
  620. id: materialcheckform_rect_main
  621. width: 1600
  622. height: 800
  623. color: "#272b7ae9"
  624. radius: 20
  625. clip: true
  626. // 表格区域
  627. Rectangle {
  628. x: 0
  629. y: 0
  630. width: 1110
  631. height: 800
  632. color: "#272b7ae9"
  633. radius: 20
  634. // 表格
  635. Column {
  636. anchors.fill: parent
  637. spacing: 0
  638. // 表头
  639. Row {
  640. id: materialcheckform_header
  641. width: parent.width
  642. height: 100
  643. spacing: 0
  644. // 编号
  645. Rectangle {
  646. width: 100
  647. height: parent.height
  648. color: "#33ffffff"
  649. border.color: "#47bfff"
  650. Text {
  651. anchors.centerIn: parent
  652. text: "编号"
  653. font.pixelSize: 25
  654. color: "#d7d7d2"
  655. font.bold: true
  656. }
  657. }
  658. // 物资类型
  659. Rectangle {
  660. width: 140
  661. height: parent.height
  662. color: "#33ffffff"
  663. border.color: "#47bfff"
  664. Text {
  665. anchors.centerIn: parent
  666. text: "物资类型"
  667. font.pixelSize: 25
  668. color: "#d7d7d2"
  669. font.bold: true
  670. }
  671. }
  672. // 物资名称
  673. Rectangle {
  674. width: 180
  675. height: parent.height
  676. color: "#33ffffff"
  677. border.color: "#47bfff"
  678. Text {
  679. anchors.centerIn: parent
  680. text: "物资名称"
  681. font.pixelSize: 25
  682. color: "#d7d7d2"
  683. font.bold: true
  684. }
  685. }
  686. // RFID
  687. Rectangle {
  688. width: 220
  689. height: parent.height
  690. color: "#33ffffff"
  691. border.color: "#47bfff"
  692. Text {
  693. anchors.centerIn: parent
  694. text: "RFID"
  695. font.pixelSize: 25
  696. color: "#d7d7d2"
  697. font.bold: true
  698. }
  699. }
  700. // 正常
  701. Rectangle {
  702. width: 80
  703. height: parent.height
  704. color: "#33ffffff"
  705. border.color: "#47bfff"
  706. Image {
  707. anchors.centerIn: parent
  708. visible: true
  709. source: "qrc:/png/title_normal.png"
  710. fillMode: Image.PreserveAspectFit
  711. }
  712. }
  713. // 过期
  714. Rectangle {
  715. width: 80
  716. height: parent.height
  717. color: "#33ffffff"
  718. border.color: "#47bfff"
  719. Image {
  720. anchors.centerIn: parent
  721. visible: true
  722. source: "qrc:/png/title_expire.png"
  723. fillMode: Image.PreserveAspectFit
  724. }
  725. }
  726. // 损坏
  727. Rectangle {
  728. width: 80
  729. height: parent.height
  730. color: "#33ffffff"
  731. border.color: "#47bfff"
  732. Image {
  733. anchors.centerIn: parent
  734. visible: true
  735. source: "qrc:/png/title_damage.png"
  736. fillMode: Image.PreserveAspectFit
  737. }
  738. }
  739. // 措施
  740. Rectangle {
  741. width: 230
  742. height: parent.height
  743. color: "#33ffffff"
  744. border.color: "#47bfff"
  745. Text {
  746. anchors.centerIn: parent
  747. text: "措施"
  748. font.pixelSize: 25
  749. color: "#d7d7d2"
  750. font.bold: true
  751. }
  752. }
  753. }
  754. // 表格内容
  755. ListView {
  756. width: parent.width
  757. height: parent.height - materialcheckform_header.height
  758. clip: true
  759. model: materialcheckform_tableModel
  760. property var _materialTextArr: [];
  761. delegate: Row {
  762. width: 1110
  763. height: Math.max(materialNameRfid.implicitHeight, 100)
  764. spacing: 0
  765. QtObject {
  766. id: itemData
  767. property int flag: model.materialFlag
  768. onFlagChanged: {
  769. materialcheckform_rect_normal.color= "#272b7ae9";
  770. materialcheckform_rect_expire.color= "#272b7ae9";
  771. materialcheckform_rect_damage.color= "#272b7ae9";
  772. switch (flag)
  773. {
  774. case 1:{
  775. materialcheckform_rect_normal.color= "#008000";
  776. }break;
  777. case 2:{
  778. materialcheckform_rect_expire.color= "#FF9900";
  779. }break;
  780. case 3:{
  781. materialcheckform_rect_damage.color= "#FF0000";
  782. }break;
  783. }
  784. }
  785. }
  786. // 编号
  787. Rectangle {
  788. width: 100
  789. height: parent.height
  790. color: "#272b7ae9"
  791. border.color: "#47bfff"
  792. clip: true
  793. Text {
  794. anchors.centerIn: parent
  795. font.pixelSize: 20
  796. color: "#d7d7d2"
  797. text: model.materialCode
  798. wrapMode: Text.WordWrap
  799. }
  800. }
  801. // 物资类型
  802. Rectangle {
  803. width: 140
  804. height: parent.height
  805. color: "#272b7ae9"
  806. border.color: "#47bfff"
  807. clip: true
  808. ToolButton
  809. {
  810. anchors.centerIn: parent
  811. enabled: false // 不可点击
  812. display: AbstractButton.TextUnderIcon
  813. icon.source: model.materialIcon
  814. icon.width: 36
  815. icon.height: 30
  816. text: model.materialType
  817. palette.buttonText: "#d7d7d2"
  818. font {
  819. pixelSize: 20
  820. }
  821. }
  822. }
  823. // 物资名称
  824. Rectangle {
  825. width: 180
  826. height: parent.height
  827. color: "#272b7ae9"
  828. border.color: "#47bfff"
  829. clip: true
  830. Text {
  831. anchors.centerIn: parent
  832. font.pixelSize: 20
  833. color: "#d7d7d2"
  834. text: model.materialName
  835. wrapMode: Text.WordWrap
  836. }
  837. }
  838. // RFID
  839. Rectangle {
  840. width: 220
  841. height: parent.height
  842. color: "#272b7ae9"
  843. border.color: "#47bfff"
  844. clip: true
  845. Text {
  846. id: materialNameRfid
  847. width: parent.width - 10 // 留点边距
  848. anchors.horizontalCenter: parent.horizontalCenter
  849. anchors.verticalCenter: parent.verticalCenter
  850. horizontalAlignment: Text.AlignHCenter
  851. verticalAlignment: Text.AlignVCenter
  852. wrapMode: Text.WordWrap
  853. font.pixelSize: 20
  854. color: "#d7d7d2"
  855. text: model.materialRfid
  856. elide: Text.ElideRight
  857. ToolTip {
  858. visible: materialNameRfid.truncated && textHoverArea.containsMouse
  859. delay: 500
  860. text: materialNameRfid.text
  861. }
  862. MouseArea {
  863. id: textHoverArea
  864. anchors.fill: parent
  865. hoverEnabled: true
  866. }
  867. }
  868. }
  869. // 正常
  870. Rectangle {
  871. id: materialcheckform_rect_normal
  872. width: 80
  873. height: parent.height
  874. color: "#272b7ae9"
  875. border.color: "#47bfff"
  876. Image {
  877. anchors.centerIn: parent
  878. visible: true
  879. source: "qrc:/png/title_normal.png"
  880. fillMode: Image.PreserveAspectFit
  881. }
  882. MouseArea {
  883. anchors.fill: parent // 让MouseArea覆盖整个Image区域
  884. onClicked: {
  885. model.materialFlag = (model.materialFlag === 1 ? 0 : 1);
  886. model.materialText = (model.materialFlag === 1 ? "" : "")
  887. }
  888. }
  889. }
  890. // 过期
  891. Rectangle {
  892. id: materialcheckform_rect_expire
  893. width: 80
  894. height: parent.height
  895. color: "#272b7ae9"
  896. border.color: "#47bfff"
  897. Image {
  898. anchors.centerIn: parent
  899. visible: true
  900. source: "qrc:/png/title_expire.png"
  901. fillMode: Image.PreserveAspectFit
  902. }
  903. MouseArea {
  904. anchors.fill: parent // 让MouseArea覆盖整个Image区域
  905. onClicked: {
  906. model.materialFlag = (model.materialFlag === 2 ? 0 : 2);
  907. model.materialText = (model.materialFlag === 2 ? "更换" : "")
  908. }
  909. }
  910. }
  911. // 损坏
  912. Rectangle {
  913. id: materialcheckform_rect_damage
  914. width: 80
  915. height: parent.height
  916. color: "#272b7ae9"
  917. border.color: "#47bfff"
  918. Image {
  919. anchors.centerIn: parent
  920. visible: true
  921. source: "qrc:/png/title_damage.png"
  922. fillMode: Image.PreserveAspectFit
  923. }
  924. MouseArea {
  925. anchors.fill: parent // 让MouseArea覆盖整个Image区域
  926. onClicked: {
  927. model.materialFlag = (model.materialFlag === 3 ? 0 : 3);
  928. model.materialText = (model.materialFlag === 3 ? "更换或维修" : "")
  929. }
  930. }
  931. }
  932. // 措施
  933. Rectangle {
  934. width: 230
  935. height: parent.height
  936. color: "#272b7ae9"
  937. border.color: "#47bfff"
  938. clip: true
  939. Text {
  940. anchors.centerIn: parent
  941. font.pixelSize: 20
  942. color: "#d7d7d2"
  943. font.bold: true
  944. text: model.materialText
  945. wrapMode: Text.WordWrap
  946. }
  947. }
  948. }
  949. }
  950. }
  951. }
  952. // 检查标准
  953. Rectangle {
  954. x: 1140
  955. y: 0
  956. width: 460
  957. height: 800
  958. color: "#272b7ae9"
  959. radius: 20
  960. //
  961. Column {
  962. anchors.fill: parent
  963. spacing: 0
  964. //
  965. Row {
  966. id: materialcheckform_header_standard
  967. width: parent.width
  968. height: 100
  969. spacing: 0
  970. // 编号
  971. Rectangle {
  972. width: 460
  973. height: parent.height
  974. color: "#33ffffff"
  975. border.color: "#47bfff"
  976. Text {
  977. anchors.centerIn: parent
  978. text: "检查标准"
  979. font.pixelSize: 25
  980. color: "#d7d7d2"
  981. font.bold: true
  982. }
  983. }
  984. }
  985. // 表格内容
  986. ListView {
  987. width: parent.width
  988. height: parent.height - materialcheckform_header_standard.height
  989. clip: true
  990. model: materialcheckform_tableModel_standard
  991. delegate: Row {
  992. id: materialcheckform_content_row;
  993. width: parent.width
  994. spacing: 0
  995. // 文本内容
  996. Rectangle {
  997. width: parent.width
  998. height: parent.height
  999. color: "#272b7ae9"
  1000. border.color: "#47bfff"
  1001. ToolButton
  1002. {
  1003. id : materialcheckform_content_head
  1004. anchors.centerIn: parent
  1005. enabled: false // 不可点击
  1006. display: AbstractButton.TextBesideIcon // 文字在图标旁边
  1007. icon.source: model.standardIcon
  1008. icon.width: 45
  1009. icon.height: 37
  1010. text: model.standardType
  1011. palette.buttonText: "#d7d7d2"
  1012. font {
  1013. pixelSize: 30
  1014. }
  1015. }
  1016. Text {
  1017. id : materialcheckform_content_text
  1018. width: parent.width;
  1019. anchors.centerIn: parent
  1020. font.pixelSize: 20
  1021. color: "#d7d7d2"
  1022. font.bold: true
  1023. wrapMode: Text.WordWrap
  1024. text: model.standardText
  1025. }
  1026. Component.onCompleted: {
  1027. if (model.standardHead)
  1028. {
  1029. materialcheckform_content_row.height = 100;
  1030. materialcheckform_content_head.visible = true;
  1031. materialcheckform_content_text.visible = false;
  1032. }
  1033. else
  1034. {
  1035. materialcheckform_content_row.height =
  1036. materialcheckform_content_text.implicitHeight;
  1037. materialcheckform_content_head.visible = false;
  1038. materialcheckform_content_text.visible = true;
  1039. }
  1040. }
  1041. }
  1042. }
  1043. }
  1044. }
  1045. }
  1046. }
  1047. function slot_getMaterialCheckForm(data)
  1048. {
  1049. slot_postSaveForm(data);
  1050. strMaterialCheckFormGet = data;
  1051. materialcheckform_tableModel.clear();
  1052. materialcheckform_tableModel_standard.clear();
  1053. var jsonObjRoot = JSON.parse(data);
  1054. if (jsonObjRoot.code === 200)
  1055. {
  1056. var jsonObjData = jsonObjRoot.data;
  1057. // 物资检查列表
  1058. var jsonArrList = jsonObjData.list;
  1059. for (var i = 0; i < jsonArrList.length; ++i)
  1060. {
  1061. var jsonObjList = jsonArrList[i];
  1062. var materialCode = jsonObjList.materialsId;
  1063. var materialType = jsonObjList.materialsTypeName;
  1064. var materialIcon = jsonObjList.materialsTypeIcon;
  1065. var materialName = jsonObjList.materialsName;
  1066. var materialRfid = jsonObjList.materialsRfid;
  1067. var materialText = jsonObjList.measure;
  1068. materialRfid = (materialRfid === null ? "" : materialRfid);
  1069. materialText = (materialText === null ? "" : materialText);
  1070. var materialFlag = 0;
  1071. if(jsonObjList.status === "0")
  1072. {
  1073. materialFlag = 1;
  1074. }
  1075. else if (jsonObjList.status === "1")
  1076. {
  1077. if (jsonObjList.reason === "2")
  1078. {
  1079. materialFlag = 2;
  1080. }
  1081. else if (jsonObjList.reason === "1")
  1082. {
  1083. materialFlag = 3;
  1084. }
  1085. }
  1086. materialcheckform_tableModel.append({
  1087. materialFlag: materialFlag,
  1088. materialCode: materialCode,
  1089. materialType: materialType,
  1090. materialIcon: materialIcon,
  1091. materialName: materialName,
  1092. materialRfid: materialRfid,
  1093. materialText: materialText,
  1094. materialJson: jsonObjList,
  1095. });
  1096. }
  1097. // 物资检查标准
  1098. var jsonArrStandards = jsonObjData.standards;
  1099. for (var j = 0; j < jsonArrStandards.length; ++j)
  1100. {
  1101. var jsonObjStandard = jsonArrStandards[j];
  1102. var standardType = jsonObjStandard.materialsTypeName;
  1103. var standardIcon = jsonObjStandard.materialsTypeIcon;
  1104. var standardText = jsonObjStandard.checkStandard;
  1105. materialcheckform_tableModel_standard.append({
  1106. standardHead: true,
  1107. standardType: standardType,
  1108. standardIcon: standardIcon,
  1109. });
  1110. materialcheckform_tableModel_standard.append({
  1111. standardHead: false,
  1112. standardText: standardText,
  1113. });
  1114. }
  1115. }
  1116. build_model_view()
  1117. waitPromptBox.hide();
  1118. }
  1119. function build_model_view()
  1120. {
  1121. var iWait = 0;
  1122. var iNormal = 0;
  1123. var iExpire = 0;
  1124. var iDamage = 0;
  1125. for (var i = 0; i < materialcheckform_tableModel.count; i++)
  1126. {
  1127. var item = materialcheckform_tableModel.get(i);
  1128. switch (item.materialFlag)
  1129. {
  1130. case 0: iWait++; break;
  1131. case 1: iNormal++; break;
  1132. case 2: iExpire++; break;
  1133. case 3: iDamage++; break;
  1134. }
  1135. }
  1136. materialcheckform_text_wait_check.text = "待检查:" + iWait
  1137. materialcheckform_text_normal_check.text = "正常:" + iNormal
  1138. materialcheckform_text_expire_check.text = "过期:" + iExpire
  1139. materialcheckform_text_damage_check.text = "损坏:" + iDamage
  1140. }
  1141. function show_dialog()
  1142. {
  1143. var iWait = 0;
  1144. for (var i = 0; i < materialcheckform_tableModel.count; i++)
  1145. {
  1146. var item = materialcheckform_tableModel.get(i);
  1147. switch (item.materialFlag)
  1148. {
  1149. case 0: iWait++; break;
  1150. }
  1151. }
  1152. if (iWait > 0)
  1153. {
  1154. materialcheckform_text_dialog_prompt.text = "保存成功,还有" + iWait + "件物资待检查";
  1155. materialcheckform_dialog_confirm_prompt.open();
  1156. }
  1157. else
  1158. {
  1159. materialcheckform_text_dialog_prompt.text = "保存成功,没有物资待检查";
  1160. materialcheckform_dialog_confirm_prompt.open();
  1161. }
  1162. }
  1163. // 返回检查结果
  1164. function save_check_result()
  1165. {
  1166. var jsonObjRoot = {};
  1167. var jsonArrList = [];
  1168. for (var i = 0; i < materialcheckform_tableModel.count; i++)
  1169. {
  1170. var item = materialcheckform_tableModel.get(i);
  1171. var jsonObjList = item.materialJson;
  1172. if (item.materialFlag === 0)
  1173. {
  1174. jsonObjList["status"] = "";
  1175. jsonObjList["reason"] = "";
  1176. }
  1177. else if (item.materialFlag === 1)
  1178. {
  1179. jsonObjList["status"] = "0";
  1180. jsonObjList["reason"] = "";
  1181. }
  1182. else if (item.materialFlag === 2)
  1183. {
  1184. jsonObjList["status"] = "1";
  1185. jsonObjList["reason"] = "2";
  1186. }
  1187. else if (item.materialFlag === 3)
  1188. {
  1189. jsonObjList["status"] = "1";
  1190. jsonObjList["reason"] = "1";
  1191. }
  1192. jsonArrList.push(jsonObjList);
  1193. }
  1194. jsonObjRoot["list"] = jsonArrList;
  1195. var strJson = JSON.stringify(jsonObjRoot);
  1196. console.log(jsonObjRoot);
  1197. signal_postSaveForm(strJson);
  1198. }
  1199. function slot_postSaveForm(data)
  1200. {
  1201. var jsonObjRoot = JSON.parse(data);
  1202. if (jsonObjRoot.code === 200)
  1203. {
  1204. // materialcheckform_prompt_info.promptInfoTimeout = 3;
  1205. // materialcheckform_prompt_info.promptInfoText = jsonObjRoot.msg;
  1206. // materialcheckform_prompt_info.promptInfoIcon = "qrc:/png/error.png"
  1207. // materialcheckform_prompt_info.promptInfoColor = "#6600ff00"
  1208. }
  1209. else
  1210. {
  1211. materialcheckform_prompt_info.promptInfoTimeout = 3;
  1212. materialcheckform_prompt_info.promptInfoText = jsonObjRoot.msg;
  1213. materialcheckform_prompt_info.promptInfoIcon = "qrc:/png/error.png"
  1214. materialcheckform_prompt_info.promptInfoColor = "#66ea3a0e"
  1215. }
  1216. }
  1217. }