OrderMaterialsStorageView.ets 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747
  1. import {DemandMaterial,OrderParams,MaterialItem,MaterialBox,EmptyBox} from "../params/OrderMaterialsStorageParams"
  2. import WorkOrderInfo from '../viewmodel/wms/WorkOrderInfo'
  3. import WorkOrderMaterialInfo from "../viewmodel/wms/WorkOrderMaterialInfo"
  4. import {MaterialBoxInfo} from '../params/MaterialInformationParam'
  5. import WmsRequest from '../common/util/request/WmsRequest'
  6. import RequestParamModel from '../viewmodel/wms/RequestParamModel'
  7. @Component
  8. export struct ProcessFlow {
  9. @Prop currentStep:number =0
  10. @Prop firstStepTitle:string = ''
  11. @Prop secondStepTitle:string = ''
  12. @Prop thirdStepTitle:string = ''
  13. build() {
  14. Row() {
  15. // 步骤1
  16. FlowStep({
  17. stepNumber: 1,
  18. title: this.firstStepTitle,
  19. showConnector: true,
  20. isChoose:this.currentStep === 1
  21. })
  22. // 步骤2
  23. FlowStep({
  24. stepNumber: 2,
  25. title: this.secondStepTitle,
  26. showConnector: this.thirdStepTitle!='',
  27. isChoose:this.currentStep === 2
  28. })
  29. // 步骤3
  30. if(this.thirdStepTitle!='')
  31. {
  32. FlowStep({
  33. stepNumber: 3,
  34. title: this.thirdStepTitle,
  35. showConnector: false,
  36. isChoose:this.currentStep === 3
  37. })
  38. }
  39. }
  40. .justifyContent(FlexAlign.Center)
  41. .width('100%')
  42. }
  43. }
  44. @Component
  45. struct FlowStep {
  46. @Prop stepNumber: number
  47. @Prop title: string
  48. @Prop showConnector: boolean
  49. @Prop isChoose : boolean
  50. build() {
  51. Row() {
  52. Column() {
  53. // 步骤圆圈
  54. Column() {
  55. Text(this.stepNumber.toString())
  56. .fontColor(this.isChoose? $r('app.color.FFFFFF'):$r('app.color.60FFFFFF'))
  57. .fontSize($r('app.float.fontSize_15_2'))
  58. }
  59. .width($r('app.float.virtualSize_23'))
  60. .height($r('app.float.virtualSize_23'))
  61. .borderRadius(20) // 圆形
  62. .backgroundColor(this.isChoose? $r('app.color.0A84FF'):$r('app.color.20FFFFFF'))
  63. .justifyContent(FlexAlign.Center)
  64. .alignItems(HorizontalAlign.Center)
  65. // 步骤文字
  66. Text(this.title)
  67. .fontColor(this.isChoose? $r('app.color.FFFFFF'):$r('app.color.60FFFFFF'))
  68. .fontSize($r('app.float.fontSize_9_6'))
  69. .margin({ top: 8 })
  70. }
  71. .justifyContent(FlexAlign.Center)
  72. .alignItems(HorizontalAlign.Center)
  73. if (this.showConnector) {
  74. Divider()
  75. .vertical(false)
  76. .strokeWidth(1)
  77. .color($r('app.color.15FFFFFF'))
  78. .margin({
  79. left: '-3%',
  80. right: '-3%',// 向左延伸至圆心
  81. //
  82. })
  83. .width('30%') // 自适
  84. }
  85. }
  86. }
  87. }
  88. @Component
  89. export struct OrderListComponent {
  90. private scrollerForList: Scroller = new Scroller()
  91. @Prop workOrders: WorkOrderInfo[] = []
  92. @Link selectWorkOrder: WorkOrderInfo
  93. @Link materialData:WorkOrderMaterialInfo[]
  94. @State selectedIndex: number = -1 // 添加选中索引状态
  95. queryDemandMaterial=async(workOrderCode:string)=>{
  96. this.materialData = await WmsRequest.post('/api/v1/wms/workOrderMaterial/list', {
  97. workOrderCode: workOrderCode,
  98. } as RequestParamModel) as WorkOrderMaterialInfo[]
  99. }
  100. // 选中回调函数
  101. private onSelect(index: number): void {
  102. this.selectedIndex = index
  103. this.selectWorkOrder = this.workOrders[index]
  104. }
  105. build() {
  106. Column() { // 订单列表
  107. List({ space: 8,scroller:this.scrollerForList }) {
  108. ForEach(this.workOrders, (item: WorkOrderInfo, index) => {
  109. ListItem() {
  110. Column() {
  111. // 订单标题(带订单号)
  112. Text(`${item.orderName}${item.orderCode}`)
  113. .fontSize($r('app.float.fontSize_12'))
  114. .fontColor($r('app.color.FFFFFF'))
  115. .width('100%')
  116. .textAlign(TextAlign.Start)
  117. // 订单详情
  118. Column({ space: 3 }) {
  119. Text(`工单编号: ${item.workOrderCode}`)
  120. .fontColor($r('app.color.FFFFFF'))
  121. .fontSize($r('app.float.fontSize_8'))
  122. .fontWeight(FontWeight.Lighter)
  123. Text(`下发时间: ${item.planStartWhen}`)
  124. .fontColor($r('app.color.FFFFFF'))
  125. .fontSize($r('app.float.fontSize_8'))
  126. .fontWeight(FontWeight.Lighter)
  127. Row() {
  128. Text('入库比例:')
  129. .fontColor($r('app.color.FFFFFF'))
  130. .fontSize($r('app.float.fontSize_8'))
  131. .fontWeight(FontWeight.Lighter)
  132. Text(`${(Number(item.inventoryNum) / Number(item.planNum) * 100).toFixed(0)}%`)
  133. .fontColor($r('app.color.FFFFFF'))
  134. .fontSize($r('app.float.fontSize_8'))
  135. .margin({ left: 4 })
  136. .fontWeight(FontWeight.Lighter)
  137. }
  138. .width('100%')
  139. .justifyContent(FlexAlign.Start)
  140. }
  141. .margin({ top: 6 })
  142. .alignItems(HorizontalAlign.Start)
  143. }.backgroundColor(index === this.selectedIndex ? $r('app.color.2030D158') : $r('app.color.20FFFFFF')) // 选中状态加深
  144. .borderRadius($r('app.float.virtualSize_9_6'))
  145. .padding(13)
  146. .border({width:2,color:index === this.selectedIndex ? $r('app.color.2030D158'):$r('app.color.20FFFFFF')})
  147. .onClick(() => {
  148. this.onSelect(index)
  149. this.queryDemandMaterial(this.selectWorkOrder.workOrderCode)
  150. })
  151. }
  152. })
  153. }
  154. .width('100%')
  155. .flexGrow(1)
  156. }
  157. .width('100%')
  158. .height('100%')
  159. }
  160. }
  161. @Component
  162. export struct SingleOrder {
  163. @Prop selectWorkOrder: WorkOrderInfo = {}
  164. build() {
  165. Column() {
  166. // 订单标题(带订单号)
  167. Text(`${this.selectWorkOrder.orderName}${this.selectWorkOrder.orderCode}`)
  168. .fontSize($r('app.float.fontSize_12'))
  169. .fontColor($r('app.color.FFFFFF'))
  170. .width('100%')
  171. .textAlign(TextAlign.Start)
  172. // 订单详情
  173. Column({ space: 3 }) {
  174. Text(`工单编号: ${this.selectWorkOrder.workOrderCode}`)
  175. .fontColor($r('app.color.FFFFFF'))
  176. .fontSize($r('app.float.fontSize_8'))
  177. .fontWeight(FontWeight.Lighter)
  178. Text(`下发时间: ${this.selectWorkOrder.planStartWhen}`)
  179. .fontColor($r('app.color.FFFFFF'))
  180. .fontSize($r('app.float.fontSize_8'))
  181. .fontWeight(FontWeight.Lighter)
  182. Row() {
  183. Text('入库比例:')
  184. .fontColor($r('app.color.FFFFFF'))
  185. .fontSize($r('app.float.fontSize_8'))
  186. .fontWeight(FontWeight.Lighter)
  187. Text(`${(Number(this.selectWorkOrder.inventoryNum) / Number(this.selectWorkOrder.planNum) * 100).toFixed(0)}%`)
  188. .fontColor($r('app.color.FFFFFF'))
  189. .fontSize($r('app.float.fontSize_8'))
  190. .margin({ left: 4 })
  191. .fontWeight(FontWeight.Lighter)
  192. }
  193. .width('100%')
  194. .justifyContent(FlexAlign.Start)
  195. }
  196. .margin({ top: 6 })
  197. .alignItems(HorizontalAlign.Start)
  198. Divider()
  199. .strokeWidth(1)
  200. .color($r('app.color.15FFFFFF'))
  201. .margin({top:'2%'})
  202. }//.backgroundColor(index === this.selectedIndex ? $r('app.color.30D158') : $r('app.color.20FFFFFF')) // 选中状态加深
  203. .borderRadius($r('app.float.virtualSize_9_6'))
  204. .padding(13)
  205. }
  206. }
  207. @Component
  208. export struct BoxGrid {
  209. private scrollerMaterial: Scroller = new Scroller()
  210. private scrollerEmpty: Scroller = new Scroller()
  211. // 拆分两个独立的状态变量
  212. @State selectedMaterialIndex: number = -1 // 物料箱选中索引
  213. @State selectedEmptyIndex: number = -1 // 空箱选中索引
  214. @Link isQueryMaterial : boolean
  215. @Link selectedMaterialBox : MaterialBoxInfo
  216. // 独立的选择回调
  217. private onSelectMaterial(index: number) {
  218. this.selectedMaterialIndex =
  219. (this.selectedMaterialIndex === index) ? -1 : index
  220. this.selectedEmptyIndex = -1
  221. }
  222. private onSelectEmpty(index: number) {
  223. this.selectedEmptyIndex =
  224. (this.selectedEmptyIndex === index) ? -1 : index
  225. this.selectedMaterialIndex = -1
  226. }
  227. @Link materialBoxes: MaterialBoxInfo[] ;
  228. @Link emptyBoxes: MaterialBoxInfo[]
  229. build() {
  230. Column() {
  231. if(this.isQueryMaterial){
  232. Grid(this.scrollerMaterial) {
  233. ForEach(this.materialBoxes, (box: MaterialBoxInfo, index) => {
  234. GridItem() {
  235. Column() {
  236. // 订单标题(带订单号)
  237. Text(`${box.materials?box.materials[0].materialName:''}`)
  238. .fontSize($r('app.float.fontSize_12'))
  239. .fontColor($r('app.color.FFFFFF'))
  240. .width('100%')
  241. .textAlign(TextAlign.Start)
  242. .margin({ bottom: '2%',left:'2%' })
  243. // 订单详情
  244. Column({ space: 3 }) {
  245. Text(`料箱编号: ${box.vehicleCode}`)
  246. .fontColor($r('app.color.FFFFFF'))
  247. .fontSize($r('app.float.fontSize_8'))
  248. .fontWeight(FontWeight.Lighter)
  249. .textAlign(TextAlign.Start)
  250. // Text(`料箱类型: ${box.materials?box.materials[0].materialNo:''}`)
  251. // .fontColor($r('app.color.FFFFFF'))
  252. // .fontSize($r('app.float.fontSize_8'))
  253. // .fontWeight(FontWeight.Lighter)
  254. // .textAlign(TextAlign.Start)
  255. Text(`所属订单: ${box.taskNo}`)
  256. .fontColor($r('app.color.FFFFFF'))
  257. .fontSize($r('app.float.fontSize_8'))
  258. .fontWeight(FontWeight.Lighter)
  259. .textAlign(TextAlign.Start)
  260. Text(`数量: ${box.materials?box.materials[0].num:''}${box.materials?box.materials[0].unit:''}`)
  261. .fontColor($r('app.color.FFFFFF'))
  262. .fontSize($r('app.float.fontSize_8'))
  263. .fontWeight(FontWeight.Lighter)
  264. .textAlign(TextAlign.Start)
  265. Text(`层数: ${box.position}`)
  266. .fontColor($r('app.color.FFFFFF'))
  267. .fontSize($r('app.float.fontSize_8'))
  268. .fontWeight(FontWeight.Lighter)
  269. .textAlign(TextAlign.Start)
  270. Text(`坐标: ${box.locationNo}`)
  271. .fontColor($r('app.color.FFFFFF'))
  272. .fontSize($r('app.float.fontSize_8'))
  273. .textAlign(TextAlign.Start)
  274. .fontWeight(FontWeight.Lighter)
  275. }
  276. .width('100%')
  277. .margin({left:'2%'})
  278. .justifyContent(FlexAlign.Start)
  279. .alignItems(HorizontalAlign.Start)
  280. }
  281. //.margin({ top: 6 })
  282. .alignItems(HorizontalAlign.Start)
  283. }
  284. .backgroundColor(index === this.selectedMaterialIndex ? $r('app.color.2030D158') : $r('app.color.20FFFFFF')) // 选中状态加深
  285. .borderRadius($r('app.float.virtualSize_9_6'))
  286. .padding(8)
  287. .border({
  288. width: 2,
  289. color: index === this.selectedMaterialIndex ? $r('app.color.2030D158') : $r('app.color.20FFFFFF')
  290. })
  291. .onClick(() => {
  292. this.onSelectMaterial(index)
  293. this.selectedMaterialBox = box
  294. //this.selectedMaterialBox = box.id
  295. })
  296. })
  297. }
  298. .columnsTemplate('1fr 1fr 1fr')
  299. // .rowsTemplate('1fr 1fr')
  300. .columnsGap(10) // 移除网格内部列间距
  301. .rowsGap(10) // 移除网格内部行间距
  302. .width('100%') // 确保填满父容器
  303. .height('48%')
  304. .padding(10)
  305. Divider()
  306. .strokeWidth(1)
  307. .color($r('app.color.15FFFFFF'))
  308. .margin({top:'1%'})
  309. //.margin({top:'2%'})
  310. }
  311. Grid(this.scrollerEmpty) {
  312. ForEach(this.emptyBoxes, (box: MaterialBoxInfo, index) => {
  313. GridItem() {
  314. Row() {
  315. Column(){
  316. // 订单标题(带订单号)
  317. Text(`空箱`)
  318. .fontSize($r('app.float.fontSize_12'))
  319. .fontColor($r('app.color.FFFFFF'))
  320. .width('100%')
  321. .textAlign(TextAlign.Start)
  322. .margin({ top: '2%',left:'2%' })
  323. Text(`料箱编号: ${box.vehicleCode}`)
  324. .fontColor($r('app.color.FFFFFF'))
  325. .fontSize($r('app.float.fontSize_8'))
  326. .fontWeight(FontWeight.Lighter)
  327. .textAlign(TextAlign.Start)
  328. .margin({ top: '40%',left:'2%' })
  329. Text(`层数: ${box.position}`)
  330. .fontColor($r('app.color.FFFFFF'))
  331. .fontSize($r('app.float.fontSize_8'))
  332. .fontWeight(FontWeight.Lighter)
  333. .textAlign(TextAlign.Start)
  334. .margin({ left:'2%' })
  335. Text(`坐标: ${box.coordinate}`)
  336. .fontColor($r('app.color.FFFFFF'))
  337. .fontSize($r('app.float.fontSize_8'))
  338. .textAlign(TextAlign.Start)
  339. .fontWeight(FontWeight.Lighter)
  340. .margin({ left:'2%' })
  341. }.width('40%').alignItems(HorizontalAlign.Start).justifyContent(FlexAlign.Start)
  342. Row(){
  343. Image($r('app.media.empty_box'))
  344. .width('100%')
  345. .height('100%')
  346. .objectFit(ImageFit.Contain)
  347. }.width('60%')
  348. }
  349. //.margin({ top: 6 })
  350. }
  351. .backgroundColor(index === this.selectedEmptyIndex ? $r('app.color.2030D158') : $r('app.color.20FFFFFF')) // 选中状态加深
  352. .borderRadius($r('app.float.virtualSize_9_6'))
  353. .padding(8)
  354. .height(this.isQueryMaterial?'50%':'25%')
  355. .border({
  356. width: 2,
  357. color: index === this.selectedEmptyIndex ? $r('app.color.2030D158') : $r('app.color.20FFFFFF')
  358. })
  359. .onClick(() => {
  360. this.onSelectEmpty(index)
  361. this.selectedMaterialBox = box
  362. })
  363. })
  364. }
  365. .columnsTemplate('1fr 1fr 1fr')
  366. .columnsGap(10) // 移除网格内部列间距
  367. .rowsGap(10) // 移除网格内部行间距
  368. .width('100%') // 确保填满父容器
  369. .height(this.isQueryMaterial?'48%':'96%')
  370. .padding(10)
  371. .margin({top:'1%'})
  372. }
  373. }
  374. }
  375. @Component
  376. export struct MaterialBoxGrid {
  377. private scrollerMaterial: Scroller = new Scroller()
  378. @State selectedMaterialIndex: number = -1 // 物料箱选中索引
  379. private onSelectMaterial(index: number) {
  380. this.selectedMaterialIndex = index
  381. }
  382. @Prop materialBoxes: MaterialBox[] = [];
  383. @Prop emptyBoxes: EmptyBox[] = [];
  384. build() {
  385. Column() {
  386. Grid(this.scrollerMaterial) {
  387. ForEach(this.materialBoxes, (box: MaterialBox, index) => {
  388. GridItem() {
  389. Column() {
  390. // 订单标题(带订单号)
  391. Text(`${box.name}`)
  392. .fontSize($r('app.float.fontSize_12'))
  393. .fontColor($r('app.color.FFFFFF'))
  394. .width('100%')
  395. .textAlign(TextAlign.Start)
  396. .margin({ bottom: '2%',left:'2%' })
  397. // 订单详情
  398. Column({ space: 3 }) {
  399. Text(`料箱编号: ${box.id}`)
  400. .fontColor($r('app.color.FFFFFF'))
  401. .fontWeight(FontWeight.Lighter)
  402. .fontSize($r('app.float.fontSize_8'))
  403. .textAlign(TextAlign.Start)
  404. Text(`料箱类型: ${box.boxType}`)
  405. .fontColor($r('app.color.FFFFFF'))
  406. .fontSize($r('app.float.fontSize_8'))
  407. .fontWeight(FontWeight.Lighter)
  408. .textAlign(TextAlign.Start)
  409. Text(`所属订单: ${box.order}`)
  410. .fontColor($r('app.color.FFFFFF'))
  411. .fontWeight(FontWeight.Lighter)
  412. .fontSize($r('app.float.fontSize_8'))
  413. .textAlign(TextAlign.Start)
  414. Text(`数量: ${box.boxNumber}`)
  415. .fontColor($r('app.color.FFFFFF'))
  416. .fontSize($r('app.float.fontSize_8'))
  417. .fontWeight(FontWeight.Lighter)
  418. .textAlign(TextAlign.Start)
  419. Text(`位置: ${box.position}`)
  420. .fontColor($r('app.color.FFFFFF'))
  421. .fontSize($r('app.float.fontSize_8'))
  422. .textAlign(TextAlign.Start)
  423. .fontWeight(FontWeight.Lighter)
  424. }
  425. .width('100%')
  426. .margin({left:'2%'})
  427. .justifyContent(FlexAlign.Start)
  428. .alignItems(HorizontalAlign.Start)
  429. }
  430. //.margin({ top: 6 })
  431. .alignItems(HorizontalAlign.Start)
  432. }
  433. .backgroundColor(index === this.selectedMaterialIndex ? $r('app.color.2030D158') : $r('app.color.20FFFFFF')) // 选中状态加深
  434. .borderRadius($r('app.float.virtualSize_9_6'))
  435. .padding(8)
  436. .border({
  437. width: 2,
  438. color: index === this.selectedMaterialIndex ? $r('app.color.2030D158') : $r('app.color.20FFFFFF')
  439. })
  440. .onClick(() => {
  441. this.onSelectMaterial(index)
  442. })
  443. })
  444. }
  445. .columnsTemplate('1fr 1fr 1fr')
  446. // .rowsTemplate('1fr 1fr')
  447. .columnsGap(10) // 移除网格内部列间距
  448. .rowsGap(10) // 移除网格内部行间距
  449. .width('100%') // 确保填满父容器
  450. .height('97%')
  451. .padding(10)
  452. }
  453. }
  454. }
  455. @Component
  456. export struct MaterialList {
  457. private scrollerForList: Scroller = new Scroller()
  458. @Prop MaterialData: WorkOrderMaterialInfo[] = []
  459. build() {
  460. Column() {
  461. List({scroller:this.scrollerForList}) {
  462. ForEach(this.MaterialData, (item:WorkOrderMaterialInfo) => {
  463. ListItem() {
  464. Column() {
  465. Row(){
  466. Text(item.itemName)
  467. .fontSize($r('app.float.fontSize_12'))
  468. .fontColor($r('app.color.FFFFFF'))
  469. .width('90%')
  470. .textAlign(TextAlign.Start)
  471. Text(`${item.storageNum}/${item.num}`)
  472. .fontSize($r('app.float.fontSize_12'))
  473. .fontColor($r('app.color.FFFFFF'))
  474. .width('10%')
  475. .textAlign(TextAlign.End)
  476. }.margin({top:'1%'})
  477. Row(){
  478. Text(`型号: ${item.itemCode}`)
  479. .fontSize($r('app.float.fontSize_8'))
  480. .fontColor($r('app.color.FFFFFF'))
  481. .width('90%')
  482. .fontWeight(FontWeight.Lighter)
  483. .textAlign(TextAlign.Start)
  484. Text('入库/计划数量')
  485. .fontSize($r('app.float.fontSize_7'))
  486. .fontColor($r('app.color.60FFFFFF'))
  487. .width('10%')
  488. .textAlign(TextAlign.End)
  489. .fontWeight(FontWeight.Lighter)
  490. }.margin({bottom:'1%'})
  491. }.width('100%').alignItems(HorizontalAlign.Start).justifyContent(FlexAlign.SpaceEvenly).height('12%')
  492. }
  493. })
  494. }
  495. .width('100%')
  496. .height('100%')
  497. .divider({
  498. strokeWidth: 1,
  499. color: $r('app.color.20FFFFFF')
  500. })
  501. }
  502. .height('100%')
  503. .justifyContent(FlexAlign.Start)
  504. }
  505. }
  506. @Component
  507. export struct MaterialListComponent {
  508. private scrollerForList: Scroller = new Scroller()
  509. @Link ScanMaterialList: WorkOrderInfo[]
  510. @Link materialNum :number
  511. // 选中回调函数
  512. build() {
  513. Column() { // 订单列表
  514. List({ space: 8,scroller:this.scrollerForList }) {
  515. ForEach(this.ScanMaterialList, (item: WorkOrderInfo, index) => {
  516. ListItem() {
  517. Row() {
  518. Column(){
  519. // 订单标题(带订单号)
  520. Text(`${item.materialName}`)
  521. .fontSize($r('app.float.fontSize_12'))
  522. .fontColor($r('app.color.FFFFFF'))
  523. .width('100%')
  524. .textAlign(TextAlign.Start)
  525. // 订单详情
  526. Column({ space: 3 }) {
  527. Text(`型号: ${item.materialCode}`)
  528. .fontColor($r('app.color.FFFFFF'))
  529. .fontSize($r('app.float.fontSize_8'))
  530. .width('100%')
  531. .fontWeight(FontWeight.Lighter)
  532. .textAlign(TextAlign.Start)
  533. Text(`序列号: ${item.batchNo}`)
  534. .fontColor($r('app.color.FFFFFF'))
  535. .fontSize($r('app.float.fontSize_8'))
  536. .width('100%')
  537. .fontWeight(FontWeight.Lighter)
  538. .textAlign(TextAlign.Start)
  539. // Text(`所属订单: ${item.date}`)
  540. // .fontColor($r('app.color.FFFFFF'))
  541. // .fontSize($r('app.float.fontSize_8'))
  542. // .width('100%')
  543. // .fontWeight(FontWeight.Lighter)
  544. // .textAlign(TextAlign.Start)
  545. Text(`数量: ${item.num}${item.unitDictLabel}`)
  546. .fontColor($r('app.color.FFFFFF'))
  547. .fontSize($r('app.float.fontSize_8'))
  548. .width('100%')
  549. .fontWeight(FontWeight.Lighter)
  550. .textAlign(TextAlign.Start)
  551. }
  552. .margin({ top: 4 })
  553. .alignItems(HorizontalAlign.Start)
  554. }.width('90%')
  555. Row(){
  556. Image($r('app.media.material_delete'))
  557. .width($r('app.float.virtualSize_23'))
  558. .height($r('app.float.virtualSize_23'))
  559. .fillColor($r('app.color.FF453A'))
  560. .onClick(()=>{
  561. this.ScanMaterialList.splice(index, 1);
  562. this.materialNum--
  563. })
  564. }.width('10%')
  565. }
  566. .backgroundColor($r('app.color.20FFFFFF')) // 选中状态加深
  567. .borderRadius($r('app.float.virtualSize_9_6'))
  568. .padding(13)
  569. //.border({width:2,color:index === this.selectedIndex ? $r('app.color.2030D158'):$r('app.color.20FFFFFF')})
  570. }
  571. })
  572. }
  573. .width('100%')
  574. .flexGrow(1)
  575. }
  576. .width('100%')
  577. .height('100%')
  578. }
  579. }
  580. @Component
  581. export struct MaterialButton {
  582. @State scaleValue : number = 1
  583. @Prop icon: Resource = $r('app.media.rgv_turn_off')
  584. onButtonClick: () => void = () => {}
  585. build() {
  586. Row() {
  587. Button({ type: ButtonType.Normal }) {
  588. Image(this.icon)
  589. .width('50%')
  590. .height('50%')
  591. .objectFit(ImageFit.Contain)
  592. .fillColor($r('app.color.FFFFFF'))
  593. }
  594. .width('100%')
  595. .height('100%')
  596. .backgroundColor($r('app.color.20FFFFFF'))
  597. .borderRadius($r('app.float.virtualSize_6_4'))
  598. .scale({ x: this.scaleValue, y: this.scaleValue })
  599. .animation({
  600. duration: 200,
  601. curve: Curve.Linear // 弹性曲线更生动
  602. })
  603. .onClick(() => {
  604. this.scaleValue = 0.9; // 点击时缩小
  605. setTimeout(() => {
  606. this.scaleValue = 1; // 0.2秒后恢复
  607. }, 200);
  608. if (this.onButtonClick) {
  609. this.onButtonClick()
  610. }
  611. })
  612. }
  613. }
  614. }
  615. @CustomDialog
  616. export struct RemindDialog {
  617. controller: CustomDialogController
  618. @Link remind: string
  619. build() {
  620. Column() {
  621. Text(this.remind)
  622. .fontColor($r('app.color.FFFFFF'))
  623. .fontSize($r('app.float.fontSize_12'))
  624. }
  625. .backgroundColor($r('app.color.2A2A2A'))
  626. .borderRadius($r('app.float.virtualSize_11_6'))
  627. .justifyContent(FlexAlign.Center)
  628. .width(300)
  629. .height(50)
  630. }
  631. }
  632. @CustomDialog
  633. export struct CommonConfirmDialog {
  634. @State title: string = '提示'
  635. @State message: string = '确定要执行此操作吗?'
  636. @State confirmText: string = '确定'
  637. @State cancelText: string = '取消'
  638. controller: CustomDialogController
  639. onConfirm: () => void = () => {}
  640. build() {
  641. Column() {
  642. // 标题
  643. Column(){
  644. Text(this.title)
  645. .fontColor($r('app.color.FFFFFF'))
  646. .fontSize($r('app.float.fontSize_15_2'))
  647. }.height('30%')
  648. .justifyContent(FlexAlign.Center)
  649. Column(){
  650. Text(this.message)
  651. .fontColor($r('app.color.30FFFFFF'))
  652. .fontSize($r('app.float.fontSize_12'))
  653. }.height('30%')
  654. .justifyContent(FlexAlign.Center)
  655. Column(){
  656. Divider()
  657. .vertical(false)
  658. .strokeWidth(1)
  659. .color($r('app.color.15FFFFFF'))
  660. Row(){
  661. Row(){
  662. Text('取消')
  663. .fontColor($r('app.color.60FFFFFF'))
  664. .fontSize($r('app.float.fontSize_12'))
  665. }
  666. .justifyContent(FlexAlign.Center)
  667. .width('50%')
  668. .onClick(() => this.controller.close())
  669. Divider()
  670. .vertical(true)
  671. .strokeWidth(1)
  672. .color($r('app.color.15FFFFFF'))
  673. Row(){
  674. Text('确认')
  675. .fontColor($r('app.color.007AFF'))
  676. .fontSize($r('app.float.fontSize_12'))
  677. }
  678. .justifyContent(FlexAlign.Center)
  679. .width('50%')
  680. .onClick(() => {
  681. this.onConfirm();
  682. this.controller.close();
  683. })
  684. }
  685. }
  686. .width('100%')
  687. .height('30%')
  688. }
  689. .height(200)
  690. .width(400)
  691. .backgroundColor($r('app.color.2A2A2A'))
  692. .justifyContent(FlexAlign.End)
  693. .borderRadius(16)
  694. }
  695. }