|
|
@@ -1,3 +1,7 @@
|
|
|
+import { Job } from '../../api/rsp/Job';
|
|
|
+import { Message } from '../../api/rsp/Message';
|
|
|
+import { Task } from '../../api/rsp/Task';
|
|
|
+import { CardContainer } from '../../components/CardContainer';
|
|
|
import { VMHome } from '../../vm/VMHome';
|
|
|
|
|
|
/**
|
|
|
@@ -53,7 +57,7 @@ export struct TabHome {
|
|
|
|
|
|
Stack() {
|
|
|
Image($r("app.media.bell")).width(19).height(19).fillColor(Color.White)
|
|
|
- Text("99")
|
|
|
+ Text(this.vm.messageUnreadCount > 99 ? "99+" : `${this.vm.messageUnreadCount}`)
|
|
|
.backgroundColor("#FF4500")
|
|
|
.borderRadius("50%")
|
|
|
.fontColor(Color.White)
|
|
|
@@ -61,19 +65,22 @@ export struct TabHome {
|
|
|
.position({ top: -5, left: "52%" })
|
|
|
.constraintSize({ minWidth: 15, minHeight: 15 })
|
|
|
.textAlign(TextAlign.Center)
|
|
|
+ .padding({ left: 2, right: 2 })
|
|
|
+ .visibility(this.vm.messageUnreadCount == 0 ? Visibility.Hidden : Visibility.Visible)
|
|
|
}.width(36).height(24).onClick(() => {
|
|
|
+ this.getUIContext().getRouter().pushUrl({ url: "pages/PageMessage" }).catch()
|
|
|
})
|
|
|
|
|
|
- Stack() {
|
|
|
- Image($r("app.media.settings")).width(18).height(18).fillColor(Color.White)
|
|
|
- }.width(36).height(24).onClick(() => {
|
|
|
- // const am = abilityAccessCtrl.createAtManager()
|
|
|
- // am.requestPermissionsFromUser(this.getUIContext().getHostContext(), ["ohos.permission.ACCESS_BLUETOOTH"]).then((data) => {
|
|
|
- // console.log("权限请求", JSON.stringify(data))
|
|
|
- // })
|
|
|
- // const bm = new BleManager("CC:BA:97:21:71:CA")
|
|
|
- // bm.connect()
|
|
|
- })
|
|
|
+ // Stack() {
|
|
|
+ // Image($r("app.media.settings")).width(18).height(18).fillColor(Color.White)
|
|
|
+ // }.width(36).height(24).onClick(() => {
|
|
|
+ // // const am = abilityAccessCtrl.createAtManager()
|
|
|
+ // // am.requestPermissionsFromUser(this.getUIContext().getHostContext(), ["ohos.permission.ACCESS_BLUETOOTH"]).then((data) => {
|
|
|
+ // // console.log("权限请求", JSON.stringify(data))
|
|
|
+ // // })
|
|
|
+ // // const bm = new BleManager("CC:BA:97:21:71:CA")
|
|
|
+ // // bm.connect()
|
|
|
+ // })
|
|
|
}
|
|
|
.width("100%")
|
|
|
.padding({
|
|
|
@@ -94,7 +101,7 @@ export struct TabHome {
|
|
|
@Builder
|
|
|
TODOStatus() {
|
|
|
Column() {
|
|
|
- Text("中午好,今天有2个待办任务")
|
|
|
+ Text(`今天有${this.vm.taskProgressCount}个待办任务`)
|
|
|
.width("100%")
|
|
|
.height(51)
|
|
|
.backgroundColor("#E6F7FF")
|
|
|
@@ -103,37 +110,29 @@ export struct TabHome {
|
|
|
.textAlign(TextAlign.Center)
|
|
|
Row() {
|
|
|
Column() {
|
|
|
- Text("2").fontSize(24).fontColor("#FF4500").fontWeight(FontWeight.Bold)
|
|
|
- Text("待处理").fontSize(12).fontColor("#333333").margin({ top: 10, bottom: 5 })
|
|
|
- Image($r("app.media.job_todo")).width(18).height(18).fillColor(Color.Black)
|
|
|
- }
|
|
|
- .margin(5)
|
|
|
- .layoutWeight(1)
|
|
|
- .aspectRatio(1)
|
|
|
- .backgroundColor("#FFF5EB")
|
|
|
- .borderRadius(12)
|
|
|
- .justifyContent(FlexAlign.Center)
|
|
|
-
|
|
|
- Column() {
|
|
|
- Text("5").fontSize(24).fontColor("#FFA500").fontWeight(FontWeight.Bold)
|
|
|
- Text("进行中").fontSize(12).fontColor("#333333").margin({ top: 10, bottom: 5 })
|
|
|
- Image($r("app.media.job_ing")).width(18).height(18).fillColor(Color.Black)
|
|
|
+ Text(`${this.vm.taskProgressCount}`).fontSize(24).fontColor("#FFA500").fontWeight(FontWeight.Bold)
|
|
|
+ Row() {
|
|
|
+ Image($r("app.media.job_ing")).width(18).height(18).fillColor(Color.Black)
|
|
|
+ Text("进行中").fontSize(14).fontColor($r("app.color.text")).fontWeight(FontWeight.Bold).margin({ left: 5 })
|
|
|
+ }.margin({ top: 8 })
|
|
|
}
|
|
|
.margin(5)
|
|
|
.layoutWeight(1)
|
|
|
- .aspectRatio(1)
|
|
|
+ .height(80)
|
|
|
.backgroundColor("#FFF5EB")
|
|
|
.borderRadius(12)
|
|
|
.justifyContent(FlexAlign.Center)
|
|
|
|
|
|
Column() {
|
|
|
- Text("10").fontSize(24).fontColor("#32CD32").fontWeight(FontWeight.Bold)
|
|
|
- Text("本月完成").fontSize(12).fontColor("#333333").margin({ top: 10, bottom: 5 })
|
|
|
- Image($r("app.media.job_finish")).width(18).height(18).fillColor(Color.Black)
|
|
|
+ Text(`${this.vm.taskFinishedCount}`).fontSize(24).fontColor("#32CD32").fontWeight(FontWeight.Bold)
|
|
|
+ Row() {
|
|
|
+ Image($r("app.media.job_finish")).width(18).height(18).fillColor(Color.Black)
|
|
|
+ Text("本月完成").fontSize(14).fontColor($r("app.color.text")).fontWeight(FontWeight.Bold).margin({ left: 5 })
|
|
|
+ }.margin({ top: 8 })
|
|
|
}
|
|
|
.margin(5)
|
|
|
.layoutWeight(1)
|
|
|
- .aspectRatio(1)
|
|
|
+ .height(80)
|
|
|
.backgroundColor("#FFF5EB")
|
|
|
.borderRadius(12)
|
|
|
.justifyContent(FlexAlign.Center)
|
|
|
@@ -152,75 +151,97 @@ export struct TabHome {
|
|
|
List() {
|
|
|
ListItem() {
|
|
|
Row() {
|
|
|
- Text("我的当前任务").fontSize(14).fontColor("#333333").fontWeight(FontWeight.Medium)
|
|
|
+ Text("当前任务").fontSize(14).fontColor("#333333").fontWeight(FontWeight.Medium)
|
|
|
Row().layoutWeight(1)
|
|
|
Text("查看全部").fontSize(14).fontColor("#1E90FF").fontWeight(FontWeight.Medium)
|
|
|
}.width("100%").height(46).onClick(() => {
|
|
|
- this.vm.updateTabIndex(1)
|
|
|
+ this.vm.updateTabIndex(2)
|
|
|
})
|
|
|
- }
|
|
|
+ }.padding({ left: 16, right: 16 })
|
|
|
|
|
|
- ForEach([1, 2], (item: number, index: number) => {
|
|
|
- ListItem() {
|
|
|
+ // 空数据提示
|
|
|
+ ListItem() {
|
|
|
+ CardContainer() {
|
|
|
Column() {
|
|
|
- Row() {
|
|
|
- Text("冷却水系统能量隔离作业").fontSize(15).fontColor("#333333").fontWeight(FontWeight.Medium)
|
|
|
- Row().layoutWeight(1)
|
|
|
- Text("待办")
|
|
|
- .fontSize(12)
|
|
|
- .fontColor("#333333")
|
|
|
- .backgroundColor("#FFD700")
|
|
|
- .borderRadius(20)
|
|
|
- .height(24)
|
|
|
- .padding({ left: 10, right: 10 })
|
|
|
- .textAlign(TextAlign.Center)
|
|
|
- }
|
|
|
+ Text("您当前暂无任务").fontSize(14).fontColor($r("app.color.text"))
|
|
|
+ }.width("100%").height(102).justifyContent(FlexAlign.Center)
|
|
|
+ }
|
|
|
+ }.padding({ left: 16, right: 16 })
|
|
|
+ .visibility(this.vm.homeTasks.length == 0 ? Visibility.Visible : Visibility.None)
|
|
|
|
|
|
- Flex({ wrap: FlexWrap.Wrap, alignItems: ItemAlign.Center, direction: FlexDirection.Row }) {
|
|
|
- Image($r("app.media.location")).width(12).height(12).fillColor("#1E90FF").margin({ right: 5 })
|
|
|
- Text("车间B区")
|
|
|
- .fontSize(13)
|
|
|
- .fontColor("#666666")
|
|
|
- .margin({ right: 12 })
|
|
|
- .height(24)
|
|
|
- .textAlign(TextAlign.Center)
|
|
|
- Image($r("app.media.user")).width(12).height(12).fillColor("#666666").margin({ right: 5 })
|
|
|
- Text("负责人:王主管哈哈哈哈")
|
|
|
- .fontSize(13)
|
|
|
- .fontColor("#666666")
|
|
|
- .margin({ right: 12 })
|
|
|
- .height(24)
|
|
|
- .textAlign(TextAlign.Center)
|
|
|
- Image($r("app.media.jobs")).width(12).height(12).fillColor("#666666").margin({ right: 5 })
|
|
|
- Text("WO-2025-005")
|
|
|
- .fontSize(13)
|
|
|
- .fontColor("#666666")
|
|
|
- .margin({ right: 12 })
|
|
|
- .height(24)
|
|
|
- .textAlign(TextAlign.Center)
|
|
|
- }.margin({ top: 10 })
|
|
|
+ ForEach(this.vm.homeTasks, (task: Task, idx: number) => {
|
|
|
+ ListItem() {
|
|
|
+ CardContainer({ paddings: 16 }) {
|
|
|
+ Column() {
|
|
|
+ Row() {
|
|
|
+ Text(task.name).fontSize(15).fontColor("#333333").fontWeight(FontWeight.Medium)
|
|
|
+ Row().layoutWeight(1)
|
|
|
+ // Text("待办")
|
|
|
+ // .fontSize(12)
|
|
|
+ // .fontColor("#333333")
|
|
|
+ // .backgroundColor("#FFD700")
|
|
|
+ // .borderRadius(20)
|
|
|
+ // .height(24)
|
|
|
+ // .padding({ left: 10, right: 10 })
|
|
|
+ // .textAlign(TextAlign.Center)
|
|
|
+ }
|
|
|
|
|
|
- Text("作业内容:上锁挂牌").fontSize(13).fontColor("#666666").height(24).textAlign(TextAlign.Center)
|
|
|
+ Flex({ wrap: FlexWrap.Wrap, alignItems: ItemAlign.Center, direction: FlexDirection.Row }) {
|
|
|
+ // Image($r("app.media.location")).width(12).height(12).fillColor("#1E90FF").margin({ right: 5 })
|
|
|
+ // Text("车间B区")
|
|
|
+ // .fontSize(13)
|
|
|
+ // .fontColor("#666666")
|
|
|
+ // .margin({ right: 12 })
|
|
|
+ // .height(24)
|
|
|
+ // .textAlign(TextAlign.Center)
|
|
|
+ // 编号
|
|
|
+ Image($r("app.media.jobs")).width(12).height(12).fillColor("#666666").margin({ right: 5 })
|
|
|
+ Text(`${task.orderNo}`)
|
|
|
+ .fontSize(13)
|
|
|
+ .fontColor("#666666")
|
|
|
+ .margin({ right: 12 })
|
|
|
+ .height(24)
|
|
|
+ .textAlign(TextAlign.Center)
|
|
|
+ // 负责人
|
|
|
+ Image($r("app.media.user")).width(12).height(12).fillColor("#666666").margin({ right: 5 })
|
|
|
+ Text(`负责人:${task.initiatorName}`)
|
|
|
+ .fontSize(13)
|
|
|
+ .fontColor("#666666")
|
|
|
+ .margin({ right: 12 })
|
|
|
+ .height(24)
|
|
|
+ .textAlign(TextAlign.Center)
|
|
|
+ }.margin({ top: 10 })
|
|
|
|
|
|
- Row() {
|
|
|
- Text("今天 14:00").layoutWeight(1).margin({ right: 10 }).fontColor("#999999").fontSize(12)
|
|
|
- Button("查看详情")
|
|
|
- .height(35)
|
|
|
- .padding({ left: 15, right: 15 })
|
|
|
- .backgroundColor("#4682B4")
|
|
|
- .borderRadius(4)
|
|
|
- .fontSize(13)
|
|
|
- .fontWeight(FontWeight.Medium)
|
|
|
- }.width("100%").layoutWeight(1)
|
|
|
- }.width("100%").height("100%").justifyContent(FlexAlign.Start).alignItems(HorizontalAlign.Start)
|
|
|
+ Row() {
|
|
|
+ Text(`当前任务:`)
|
|
|
+ .fontSize(13)
|
|
|
+ .fontColor("#666666")
|
|
|
+ .height(24)
|
|
|
+ Text(`${task.currentNodeName ?? '--'}`)
|
|
|
+ .backgroundColor("#1E90FF")
|
|
|
+ .borderRadius(4)
|
|
|
+ .padding({
|
|
|
+ left: 5,
|
|
|
+ top: 3,
|
|
|
+ right: 5,
|
|
|
+ bottom: 3
|
|
|
+ })
|
|
|
+ .fontSize(12)
|
|
|
+ .fontColor(Color.White)
|
|
|
+ Text("今天 14:00")
|
|
|
+ .margin({ left: 10 })
|
|
|
+ .fontColor("#999999")
|
|
|
+ .fontSize(12)
|
|
|
+ .layoutWeight(1)
|
|
|
+ .textAlign(TextAlign.End)
|
|
|
+ }.width("100%").margin({ bottom: -8 })
|
|
|
+ }.width("100%").justifyContent(FlexAlign.Start).alignItems(HorizontalAlign.Start)
|
|
|
+ }
|
|
|
}
|
|
|
.width("100%")
|
|
|
- .height(175)
|
|
|
- .backgroundColor("#F8F9FA")
|
|
|
- .borderRadius(12)
|
|
|
- .border({ width: 1, color: "#EEEEEE" })
|
|
|
- .margin({ bottom: index == 1 ? 0 : 15 })
|
|
|
- .padding(16)
|
|
|
+ .clip(false)
|
|
|
+ .padding({ left: 16, right: 16 })
|
|
|
+ .margin({ bottom: idx >= (this.vm.homeTasks.length - 1) ? 0 : 15 })
|
|
|
})
|
|
|
ListItem() {
|
|
|
Row() {
|
|
|
@@ -228,38 +249,38 @@ export struct TabHome {
|
|
|
Row().layoutWeight(1)
|
|
|
Text("全部消息").fontSize(14).fontColor("#1E90FF").fontWeight(FontWeight.Medium)
|
|
|
}.width("100%").height(46).onClick(() => {
|
|
|
- this.vm.updateTabIndex(2)
|
|
|
+ this.getUIContext().getRouter().pushUrl({ url: "pages/PageMessage" }).catch()
|
|
|
})
|
|
|
- }
|
|
|
+ }.padding({ left: 16, right: 16 })
|
|
|
|
|
|
- ForEach([1, 2], (item: number) => {
|
|
|
- ListItem() {
|
|
|
+ // 空数据提示
|
|
|
+ ListItem() {
|
|
|
+ CardContainer() {
|
|
|
Column() {
|
|
|
- Text("系统通知:您有新的作业任务待处理,请及时查看并执行操作,请及时查看并执行操作,请及时查看并执行操作,请及时查看并执行操作")
|
|
|
- .fontSize(14)
|
|
|
- .fontColor("#333333")
|
|
|
- .textOverflow({ overflow: TextOverflow.Ellipsis }).maxLines(2)
|
|
|
- Text("5分钟前")
|
|
|
- .layoutWeight(1)
|
|
|
- .width("100%")
|
|
|
- .textAlign(TextAlign.End)
|
|
|
- .fontSize(12)
|
|
|
- .fontColor("#999999")
|
|
|
+ Text("您当前暂无消息").fontSize(14).fontColor($r("app.color.text"))
|
|
|
+ }.width("100%").height(102).justifyContent(FlexAlign.Center)
|
|
|
+ }
|
|
|
+ }.padding({ left: 16, right: 16 })
|
|
|
+ .visibility(this.vm.homeMessages.length == 0 ? Visibility.Visible : Visibility.None)
|
|
|
+
|
|
|
+ ForEach(this.vm.homeMessages, (msg: Message) => {
|
|
|
+ ListItem() {
|
|
|
+ CardContainer({ paddings: 16 }) {
|
|
|
+ Column() {
|
|
|
+ Text(`${msg.title ?? "提醒"}`).fontSize(15).fontColor("#333333").fontWeight(FontWeight.Medium).margin({ bottom: 10 })
|
|
|
+ Text(`${msg.templateContent}`).fontSize(13).fontColor("#666666").lineHeight(18)
|
|
|
+ Row() {
|
|
|
+ Text("作业管理").fontSize(12).fontColor("#999999").layoutWeight(1)
|
|
|
+ Text("09:45").fontSize(12).fontColor("#999999")
|
|
|
+ }.margin({ top: 6, bottom: -5 })
|
|
|
+ }.width("100%").alignItems(HorizontalAlign.Start)
|
|
|
}
|
|
|
- .width("100%")
|
|
|
- .height("100%")
|
|
|
- .justifyContent(FlexAlign.Start)
|
|
|
- .alignItems(HorizontalAlign.Start)
|
|
|
- .padding(16)
|
|
|
}
|
|
|
.width("100%")
|
|
|
- .height(102)
|
|
|
- .backgroundColor("#F8F9FA")
|
|
|
- .borderRadius(12)
|
|
|
- .border({ width: 1, color: "#EEEEEE" })
|
|
|
.margin({ bottom: 15 })
|
|
|
+ .padding({ left: 16, right: 16 })
|
|
|
})
|
|
|
}
|
|
|
- .width("100%").layoutWeight(1).padding({ left: 16, right: 16 }).scrollBar(BarState.Off)
|
|
|
+ .width("100%").layoutWeight(1).scrollBar(BarState.Off)
|
|
|
}
|
|
|
}
|