|
|
@@ -1,4 +1,4 @@
|
|
|
-import { YTHeader, yTRouter, yTToast, YTToast } from 'basic'
|
|
|
+import { IBestToast, YTHeader, yTRouter, yTToast, YTToast } from 'basic'
|
|
|
import { MainViewModel } from '../viewmodels/MainViewModel'
|
|
|
import { SwiperCom } from '../components/maincomponent/SwiperCom'
|
|
|
import { BuilderHeader } from '../components/maincomponent/BuilderHeader'
|
|
|
@@ -16,6 +16,7 @@ import { ClockTaskApi, ClockTaskIcon, ClockTaskItem,
|
|
|
import { SelectIcon } from '../components/maincomponent/BindSheetTask/SelectIcon'
|
|
|
import dayjs from "dayjs"
|
|
|
import { promptAction } from '@kit.ArkUI'
|
|
|
+import { ButtonCom } from '../components/maincomponent/ButtonCom'
|
|
|
|
|
|
@ComponentV2
|
|
|
export struct MainView {
|
|
|
@@ -86,7 +87,6 @@ export struct MainView {
|
|
|
List({ space: 16 }) {
|
|
|
ForEach(this.greenPlantList, (item:GreenPlants,index:number) => {
|
|
|
ListItem() {
|
|
|
- Row() {
|
|
|
Row() {
|
|
|
Column() {
|
|
|
Image(item.plantsPicture).width(55).height(79)
|
|
|
@@ -113,10 +113,18 @@ export struct MainView {
|
|
|
}.justifyContent(FlexAlign.Start).alignItems(HorizontalAlign.Start)
|
|
|
|
|
|
Blank()
|
|
|
- this.MaintenanceClockTextBuilder()
|
|
|
+ ButtonCom({
|
|
|
+ text:"养护打卡",
|
|
|
+ isShowBuilder:()=>{
|
|
|
+ this.isShowMaintenanceBuilder=true
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
.width('100%')
|
|
|
+ .height(115)
|
|
|
.backgroundColor('#fff')
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
+ .alignItems(VerticalAlign.Center)
|
|
|
.borderRadius(12)
|
|
|
.padding({
|
|
|
left: 17,
|
|
|
@@ -124,7 +132,7 @@ export struct MainView {
|
|
|
right: 20,
|
|
|
bottom: 17
|
|
|
})
|
|
|
- }.width('100%').onClick(()=>{
|
|
|
+ .onClick(()=>{
|
|
|
yTRouter.pushPathByName("EditGreenPlantPage",item.plantsId,(result:PopInfo)=>{
|
|
|
let ans=result.result as string
|
|
|
if(ans&&ans=='true'){
|
|
|
@@ -148,7 +156,7 @@ export struct MainView {
|
|
|
})
|
|
|
}.width('100%').height('100%')
|
|
|
Column() {
|
|
|
- Image($r('app.media.startIcon')).width(30).height(30)
|
|
|
+ Image($r('app.media.main_icon_add_green_plants')).width(30).height(30)
|
|
|
}
|
|
|
.width(60)
|
|
|
.height(60)
|
|
|
@@ -223,28 +231,6 @@ export struct MainView {
|
|
|
|
|
|
})
|
|
|
}
|
|
|
- //养护打卡文字按钮builder
|
|
|
- @Builder
|
|
|
- MaintenanceClockTextBuilder(){
|
|
|
- Column() {
|
|
|
- Text('养护').fontColor('#498552')
|
|
|
- Text('打卡').fontColor('#498552')
|
|
|
- }.backgroundColor('#EAFFED')
|
|
|
- .padding({
|
|
|
- left: 12,
|
|
|
- right: 12,
|
|
|
- top: 10,
|
|
|
- bottom: 9
|
|
|
- })
|
|
|
- .border({
|
|
|
- width: 2,
|
|
|
- color: '#81B433'
|
|
|
- })
|
|
|
- .borderRadius('50%')
|
|
|
- .onClick(()=>{
|
|
|
- this.isShowMaintenanceBuilder=!this.isShowMaintenanceBuilder
|
|
|
- })
|
|
|
- }
|
|
|
@Builder
|
|
|
MaintenanceClockBindSheetBuilder(){
|
|
|
Column(){
|
|
|
@@ -259,12 +245,25 @@ export struct MainView {
|
|
|
this.isShowMaintenanceBuilder=false
|
|
|
},
|
|
|
rightClick:()=>{
|
|
|
+ if(this.vm.plantsId==0||this.vm.taskItemId==0||this.vm.clockDate==""||this.vm.clockTime==""){
|
|
|
+ IBestToast.show({
|
|
|
+ message:"请检查打卡项或打卡植物日期"
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if(dayjs(this.vm.clockDate+" "+this.vm.clockTime).valueOf()>dayjs(new Date()).valueOf()){
|
|
|
+ IBestToast.show({
|
|
|
+ message:"打卡不得超过当前时间"
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
this.isShowMaintenanceBuilder=false
|
|
|
const params:InsertClockParam={
|
|
|
plantsId:this.vm.plantsId,
|
|
|
itemId:this.vm.taskItemId,
|
|
|
clockDate:this.vm.clockDate+" 00:00:00",
|
|
|
- clockTime:this.vm.clockDate+" "+this.vm.clockTime
|
|
|
+ clockTime:this.vm.clockDate+" "+this.vm.clockTime+":00"
|
|
|
}
|
|
|
this.insertClockLog(params)
|
|
|
}
|
|
|
@@ -334,7 +333,6 @@ export struct MainView {
|
|
|
swiperBuilder3: () => { this.AddClockTaskAndSelectIcon() },
|
|
|
swiperComController:this.vm.swiperComController[0]
|
|
|
})
|
|
|
-
|
|
|
SwiperCom({
|
|
|
swiperBuilder1:()=>{
|
|
|
//选择打卡植物
|