MaterialExceptionReport.qml 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. import QtQuick
  2. import QtQuick.Layouts
  3. import QtQuick.Controls
  4. import com.InteractiveTask 1.0
  5. Item {
  6. id: materialexceptionreport
  7. x: 290
  8. y: 130
  9. width: 1600
  10. height: 920
  11. onVisibleChanged: {
  12. if (visible)
  13. {
  14. proThread.moveCursorTo(0, 0);
  15. interactiveCore.appendTask(
  16. InteractiveTask.TypeViewRefresh_AbnormalReport, null, (json)=>{
  17. var jsonObjRoot = JSON.parse(json);
  18. var jsonArrExceptionTypeDict = jsonObjRoot.ExceptionTypeDict;
  19. var jsonArrSeverityLevelDict = jsonObjRoot.SeverityLevelDict;
  20. materialexception_ExceptionTypeDict.model = jsonArrExceptionTypeDict;
  21. materialexception_SeverityLevelDict.model = jsonArrSeverityLevelDict;
  22. });
  23. }
  24. }
  25. // 提交
  26. Button {
  27. id: materialexceptionreport_btn_submit
  28. x: 1168
  29. y: 835
  30. width: 192
  31. height: 75
  32. background: Rectangle {
  33. color: "#ff0000"
  34. radius: 10
  35. }
  36. text: qsTr("提交")
  37. font.pixelSize: 30
  38. palette.buttonText: "white" // 设置字体颜色为绿色
  39. Connections {
  40. target: materialexceptionreport_btn_submit
  41. onClicked: {
  42. // materialexceptionreport_dialog_confirm.open();
  43. infoPromptBox.title("提示");
  44. infoPromptBox.message("确定要上报异常吗?");
  45. infoPromptBox.button_clear();
  46. infoPromptBox.button_push("red", "取消", null, null);
  47. infoPromptBox.button_push(
  48. "#055eb3", "确定", ()=>{
  49. var jsonObjRoot = {};
  50. jsonObjRoot["exceptionTypeName"] = materialexception_ExceptionTypeDict.currentText;
  51. jsonObjRoot["exceptionLevelName"] = materialexception_SeverityLevelDict.currentText;
  52. jsonObjRoot["exceptionDescription"] = materialexception_exceptionDescription.text;
  53. var strJson = JSON.stringify(jsonObjRoot);
  54. var taskType = InteractiveTask.TypeHttpPost_insertIsException;
  55. interactiveCore.appendTask(
  56. taskType, strJson, (json)=>{
  57. var jsonObjRoot = JSON.parse(json);
  58. if (jsonObjRoot.code === 200)
  59. {
  60. infoPromptBox.title("提交成功");
  61. infoPromptBox.message("提交成功");
  62. infoPromptBox.button_clear();
  63. infoPromptBox.button_push(
  64. "#055eb3", "确定", null, null);
  65. infoPromptBox.show();
  66. }
  67. else
  68. {
  69. infoPromptBox.title("提交失败");
  70. infoPromptBox.message(jsonObjRoot.msg);
  71. infoPromptBox.button_clear();
  72. infoPromptBox.button_push("#055eb3", "确定", null, null);
  73. infoPromptBox.show();
  74. }
  75. });
  76. });
  77. infoPromptBox.show();
  78. }
  79. }
  80. }
  81. // 返回按钮
  82. Button {
  83. id: materialexceptionreport_btn_return
  84. x: 1408
  85. y: 835
  86. width: 192
  87. height: 75
  88. background: Rectangle {
  89. color: "#055eb3"
  90. radius: 10
  91. }
  92. text: qsTr("返回")
  93. font.pixelSize: 30
  94. palette.buttonText: "white" // 设置字体颜色为绿色
  95. Connections {
  96. target: materialexceptionreport_btn_return
  97. onClicked: {
  98. materialexceptionreport.visible = false;
  99. materialException.visible = true;
  100. }
  101. }
  102. }
  103. // 主体区域
  104. Rectangle {
  105. id: materialexception_main
  106. x: 0
  107. y: 0
  108. width: parent.width;
  109. height: parent.height * 0.88
  110. color: "#272b7ae9"
  111. radius: 10
  112. Rectangle {
  113. x : 10
  114. y : 100
  115. width: 1488
  116. height: 77
  117. color: "#00ffffff"
  118. Rectangle {
  119. x : 20
  120. y : 15
  121. width: 232
  122. height: 48
  123. color: "#00ffffff"
  124. Text {
  125. anchors.fill: parent
  126. font.pixelSize: 30
  127. // font.bold: true
  128. color: "#ffffff"
  129. horizontalAlignment: Text.AlignRight
  130. verticalAlignment: Text.AlignVCenter
  131. text: "异常类型:*"
  132. }
  133. }
  134. Rectangle {
  135. x: 255
  136. y: 12
  137. width: 551
  138. height: 50
  139. color: "#ffffff"
  140. radius: 5
  141. ComboBox {
  142. id: materialexception_ExceptionTypeDict
  143. anchors.fill: parent
  144. focusPolicy: Qt.NoFocus
  145. anchors.margins: 2
  146. font.pointSize: 15
  147. focus: false
  148. background: Rectangle {
  149. color: "transparent"
  150. }
  151. font.pixelSize: 20
  152. padding:5
  153. font.styleName: "Regular"
  154. // model: [];
  155. // 当前选中项改变时触发
  156. onCurrentIndexChanged: {
  157. }
  158. }
  159. }
  160. }
  161. Rectangle {
  162. x : 10
  163. y : 200
  164. width: 1488
  165. height: 77
  166. color: "#00ffffff"
  167. Rectangle {
  168. x : 20
  169. y : 15
  170. width: 232
  171. height: 48
  172. color: "#00ffffff"
  173. Text {
  174. anchors.fill: parent
  175. font.pixelSize: 30
  176. // font.bold: true
  177. color: "#ffffff"
  178. horizontalAlignment: Text.AlignRight
  179. verticalAlignment: Text.AlignVCenter
  180. text: "严重等级:*"
  181. }
  182. }
  183. Rectangle {
  184. x: 255
  185. y: 12
  186. width: 551
  187. height: 50
  188. color: "#ffffff"
  189. radius: 5
  190. ComboBox {
  191. id: materialexception_SeverityLevelDict
  192. anchors.fill: parent
  193. focusPolicy: Qt.NoFocus
  194. anchors.margins: 2
  195. font.pointSize: 15
  196. focus: false
  197. background: Rectangle {
  198. color: "transparent"
  199. }
  200. font.pixelSize: 20
  201. padding:5
  202. font.styleName: "Regular"
  203. model: []
  204. // 当前选中项改变时触发
  205. onCurrentIndexChanged: {
  206. }
  207. }
  208. }
  209. }
  210. Rectangle {
  211. x : 10
  212. y : 300
  213. width: 1488
  214. height: 500
  215. color: "#00ffffff"
  216. Rectangle {
  217. x : 20
  218. y : 15
  219. width: 232
  220. height: 48
  221. color: "#00ffffff"
  222. Text {
  223. anchors.fill: parent
  224. font.pixelSize: 30
  225. // font.bold: true
  226. color: "#ffffff"
  227. horizontalAlignment: Text.AlignRight
  228. verticalAlignment: Text.AlignVCenter
  229. text: "异常描述: "
  230. }
  231. }
  232. Rectangle {
  233. x: 255
  234. y: 12
  235. width: 1174
  236. height: 437
  237. color: "#ffffff"
  238. radius: 5
  239. TextField {
  240. id: materialexception_exceptionDescription
  241. anchors.fill: parent
  242. anchors.margins: 2
  243. color: "#a3000000" // 70%透明度的黑色
  244. placeholderTextColor: "#60ffffff" // 40%透明度的白色
  245. // 字体设置
  246. font {
  247. pixelSize: 20
  248. styleName: "Regular"
  249. }
  250. // 背景设置
  251. background: Rectangle {
  252. color: "transparent"
  253. radius: parent.parent.radius - 1 // 使内圆角略小于外框
  254. }
  255. // 对齐和边距
  256. horizontalAlignment: Text.AlignLeft
  257. verticalAlignment: Text.AlignT3op
  258. padding: 5 // 统一设置四个方向的padding
  259. // 其他属性
  260. selectionColor: "#a300aaff" // 选中文本的背景色
  261. wrapMode: Text.NoWrap
  262. renderType: Text.QtRendering
  263. }
  264. }
  265. }
  266. }
  267. }