瀏覽代碼

切换添加提示信息。

jiaxiaoqiang 9 月之前
父節點
當前提交
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 { TitleStateComp } from '../common/component/TitleStateComp'
 import EquipmentRequest from '../common/util/request/EquipmentRequest'
 import EquipmentRequest from '../common/util/request/EquipmentRequest'
 import StorageRequest from '../common/util/request/StorageRequest'
 import StorageRequest from '../common/util/request/StorageRequest'
@@ -168,6 +169,37 @@ struct Warehousing {
   })
   })
   fourWidth: number = 290
   fourWidth: number = 290
   twoWidth: number = 150
   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() {
   build() {
     Column() {
     Column() {
@@ -220,7 +252,7 @@ struct Warehousing {
               .fontColor(this.inboundButton === 0 ? $r('app.color.black_90') : $r('app.color.black_60'))
               .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') : '')
               .backgroundColor(this.inboundButton === 0 ? $r('app.color.process_divider_white_color') : '')
               .onClick(() => {
               .onClick(() => {
-                this.inboundButton = 0
+                this.goingToChangeTab(0)
               })
               })
             Blank()
             Blank()
             Text('手动入库')
             Text('手动入库')
@@ -233,7 +265,7 @@ struct Warehousing {
               .fontColor(this.inboundButton === 1 ? $r('app.color.black_90') : $r('app.color.black_60'))
               .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') : '')
               .backgroundColor(this.inboundButton === 1 ? $r('app.color.process_divider_white_color') : '')
               .onClick(() => {
               .onClick(() => {
-                this.inboundButton = 1
+                this.goingToChangeTab(1)
               })
               })
             Blank()
             Blank()
             Text('统计')
             Text('统计')
@@ -246,7 +278,7 @@ struct Warehousing {
               .fontColor(this.inboundButton === 2 ? $r('app.color.black_90') : $r('app.color.black_60'))
               .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') : '')
               .backgroundColor(this.inboundButton === 2 ? $r('app.color.process_divider_white_color') : '')
               .onClick(() => {
               .onClick(() => {
-                this.inboundButton = 2
+                this.goingToChangeTab(2)
               })
               })
           }.width(px2vp(923))
           }.width(px2vp(923))
           .borderRadius(px2vp(15))
           .borderRadius(px2vp(15))