1
0
jiaxiaoqiang 9 месяцев назад
Родитель
Сommit
189a683eec
1 измененных файлов с 35 добавлено и 3 удалено
  1. 35 3
      entry/src/main/ets/pages/Warehousing.ets

+ 35 - 3
entry/src/main/ets/pages/Warehousing.ets

@@ -1,3 +1,4 @@
+import { SureToDoDialog } from '../common/component/SureToDoDialog'
 import { TitleStateComp } from '../common/component/TitleStateComp'
 import EquipmentRequest from '../common/util/request/EquipmentRequest'
 import StorageRequest from '../common/util/request/StorageRequest'
@@ -168,6 +169,37 @@ struct Warehousing {
   })
   fourWidth: number = 290
   twoWidth: number = 150
+  // 切换tab添加提示
+  goingToChangeTabIndex: number = 0
+  goingToChangeTab = (tabIndex: number) => {
+
+    if (this.inboundButton == 2) {
+      this.inboundButton = tabIndex
+    }
+    else {
+      this.goingToChangeTabIndex = tabIndex
+      this.changeTabController.open()
+    }
+  }
+  sureToChangeTab = () => {
+    this.inboundButton = this.goingToChangeTabIndex
+  }
+  cancel = () => {
+    this.changeTabController.close()
+  }
+  changeTabController: CustomDialogController = new CustomDialogController({
+    builder: SureToDoDialog(
+      {
+        cancel: this.cancel,
+        confirm: this.sureToChangeTab,
+        title: "提示",
+        info: '切换会中断当前的操作'
+      }
+    ),
+    alignment: DialogAlignment.Center,
+    customStyle: true,
+    autoCancel: false,
+  })
 
   build() {
     Column() {
@@ -220,7 +252,7 @@ struct Warehousing {
               .fontColor(this.inboundButton === 0 ? $r('app.color.black_90') : $r('app.color.black_60'))
               .backgroundColor(this.inboundButton === 0 ? $r('app.color.process_divider_white_color') : '')
               .onClick(() => {
-                this.inboundButton = 0
+                this.goingToChangeTab(0)
               })
             Blank()
             Text('手动入库')
@@ -233,7 +265,7 @@ struct Warehousing {
               .fontColor(this.inboundButton === 1 ? $r('app.color.black_90') : $r('app.color.black_60'))
               .backgroundColor(this.inboundButton === 1 ? $r('app.color.process_divider_white_color') : '')
               .onClick(() => {
-                this.inboundButton = 1
+                this.goingToChangeTab(1)
               })
             Blank()
             Text('统计')
@@ -246,7 +278,7 @@ struct Warehousing {
               .fontColor(this.inboundButton === 2 ? $r('app.color.black_90') : $r('app.color.black_60'))
               .backgroundColor(this.inboundButton === 2 ? $r('app.color.process_divider_white_color') : '')
               .onClick(() => {
-                this.inboundButton = 2
+                this.goingToChangeTab(2)
               })
           }.width(px2vp(923))
           .borderRadius(px2vp(15))