WorkInstructionsDialog.ets 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. //作业指导
  2. import ProcessRequest from '../common/util/request/ProcessRequest'
  3. import { DrawingInfo } from '../viewmodel/DrawingInfo'
  4. import RequestParamModel from '../viewmodel/RequestParamModel'
  5. import CommonConstants from'../common/constants/CommonConstants'
  6. @CustomDialog
  7. export struct WorkInstructionsDialog {
  8. private scrollerMaterial: Scroller = new Scroller()
  9. //作业图片列表
  10. @State drawingList: DrawingInfo[] = []
  11. materialCode: string = ''
  12. controller: CustomDialogController
  13. onConfirm: () => void = () => {
  14. }
  15. //加载所有作业
  16. loadWorkInstructions = async () => {
  17. this.drawingList = await ProcessRequest.post('/api/v1/base/drawing/list', {
  18. materialCode: this.materialCode!
  19. } as RequestParamModel) as DrawingInfo[];
  20. };
  21. aboutToAppear(): void {
  22. this.loadWorkInstructions();
  23. }
  24. build() {
  25. Column() {
  26. Column() {
  27. Text("作业指导")
  28. .fontColor($r('app.color.FFFFFF'))
  29. .fontSize($r('app.float.fontSize_30'))
  30. }.height('8%')
  31. .width('100%')
  32. .justifyContent(FlexAlign.Center)
  33. Column() {
  34. Grid(this.scrollerMaterial) {
  35. ForEach(this.drawingList, (item: DrawingInfo) => {
  36. GridItem() {
  37. Column(){
  38. Image(CommonConstants.PICTURE_URL_PREFIX+item.drawingPath)
  39. .width('100%')
  40. .height('65%')
  41. .objectFit(ImageFit.Fill)
  42. .borderRadius($r('app.float.virtualSize_24'))
  43. Column() {
  44. Text(`文件名称:${item.fileName}`)
  45. .fontSize($r('app.float.fontSize_16'))
  46. .fontColor($r('app.color.FFFFFF'))
  47. .textAlign(TextAlign.Start)
  48. .fontWeight(FontWeight.Lighter)
  49. Text(`文件编号: ${item.drawingCode}`)
  50. .fontColor($r('app.color.FFFFFF'))
  51. .fontSize($r('app.float.fontSize_16'))
  52. .fontWeight(FontWeight.Lighter)
  53. .textAlign(TextAlign.Start)
  54. Text(`版本号: ${item.drawingVersion} `)
  55. .fontColor($r('app.color.FFFFFF'))
  56. .fontSize($r('app.float.fontSize_16'))
  57. .fontWeight(FontWeight.Lighter)
  58. .textAlign(TextAlign.Start)
  59. Text(`上传时间: ${item.updated}`)
  60. .fontColor($r('app.color.FFFFFF'))
  61. .fontSize($r('app.float.fontSize_16'))
  62. .fontWeight(FontWeight.Lighter)
  63. .textAlign(TextAlign.Start)
  64. Text(`编辑人员: ${item.updator}`)
  65. .fontColor($r('app.color.FFFFFF'))
  66. .fontSize($r('app.float.fontSize_16'))
  67. .fontWeight(FontWeight.Lighter)
  68. .textAlign(TextAlign.Start)
  69. }
  70. .alignItems(HorizontalAlign.Start)
  71. .height('35%')
  72. .width('96%')
  73. .margin({left:'4%',top:"2%"})
  74. }
  75. }
  76. .height('50%')
  77. .backgroundColor( $r('app.color.20FFFFFF')) // 选中状态加深
  78. .borderRadius($r('app.float.virtualSize_24'))
  79. // .onClick(() => {
  80. // })
  81. })
  82. }
  83. .columnsTemplate('1fr 1fr 1fr')
  84. .columnsGap(10)
  85. .rowsGap(10)
  86. .width('100%')
  87. .height('97%')
  88. .padding(10)
  89. }
  90. .height('81%')
  91. .margin({left:'1%',right:'1%'})
  92. Column() {
  93. Divider()
  94. .vertical(false)
  95. .strokeWidth(1)
  96. .color($r('app.color.15FFFFFF'))
  97. Row() {
  98. Text('关闭')
  99. .fontColor($r('app.color.60FFFFFF'))
  100. .fontSize($r('app.float.fontSize_30'))
  101. }
  102. .width('100%')
  103. .justifyContent(FlexAlign.Center)
  104. .height('8%')
  105. .width('50%')
  106. .onClick(() => this.controller.close())
  107. }
  108. }
  109. .height('71%')
  110. .width('62%')
  111. .backgroundColor($r('app.color.2A2A2A'))
  112. .justifyContent(FlexAlign.End)
  113. .alignItems(HorizontalAlign.Start)
  114. .borderColor($r('app.color.000000'))
  115. .borderWidth(1)
  116. .borderRadius($r('app.float.virtualSize_16'))
  117. }
  118. }