import { YTRequest } from "basic" import { ApiUrl } from "./ApiUrl" import { ResponseResult } from "./GreenPlantApi" //查询提醒设置参数 export interface GetRemindParams{ oaid?: number page: number, pageSizes: number, plantsId?: number, remindDate?:string } export interface InsertEditRemindParams{ oaid?:string plantsId?: number settingId?:number, itemId?: number, isOpen?:boolean, itemIcon?: string, itemName?: string repeatType?: string remindDate?: string remindTime?: string weeklyWeekday?:number monthlyDay?:number intervalDays?:number } //设置数据接口 export interface RemindItem{ oaid?:string, settingId:number, plantsId:number, itemId:number, // 养护事项ID itemName:string, itemIcon: string, remindDate:string, // 首次提醒日期 remindTime:string, //提醒时间(HH:mm:ss) repeatType:string, // 周期类型: once, daily, weekly, monthly, custom intervalDays:string // 自定义间隔天数(仅当 repeat_type=custom 时有效) weeklyWeekday:string, //每周几(1=周一, 7=周日),仅 weekly 使用 monthlyDay:string, //每月几号(1~31),仅 monthly 使用 isOpen:boolean // 是否开启提醒:0=否,1=是"plantsName": "", plantsPicture: string, plantsName: string, } @ObservedV2 export class RemindItemClass{ plantsPicture: string plantsName: string settingId:number plantsId:number itemId:number // 养护事项ID itemName:string itemIcon: string remindDate:string// 首次提醒日期 remindTime:string //提醒时间(HH:mm:ss) repeatType:string // 周期类型: once, daily, weekly, monthly, custom intervalDays:string // 自定义间隔天数(仅当 repeat_type=custom 时有效) weeklyWeekday:string //每周几(1=周一, 7=周日),仅 weekly 使用 monthlyDay:string //每月几号(1~31),仅 monthly 使用 @Trace isOpen:boolean // 是否开启提醒:0=否,1=是 constructor(item:RemindItem) { this.settingId=item.settingId this.plantsId=item.plantsId this.itemId=item.itemId this.itemName=item.itemName this.itemIcon=item.itemIcon this.remindDate=item.remindDate this.remindTime=item.remindTime this.repeatType=item.repeatType this.intervalDays=item.intervalDays this.weeklyWeekday=item.weeklyWeekday this.monthlyDay=item.monthlyDay this.isOpen=item.isOpen this.plantsName=item.plantsName this.plantsPicture=item.plantsPicture } } export class RemindApi{ //更具植物id获取植物提醒设置列表 static async getRemindList(params:GetRemindParams){ return await YTRequest.post,GetRemindParams>(ApiUrl.GET_REMIND_LIST,params) } //新增提醒设置 /** * { "oaid": "814d1a21-c082-4faf-9cec-f84cb3d05512", "plantsId": 6, "itemId": 4, "itemName": "浇水", "remindDate": "2025-10-18", "remindTime": "08:30:00", "repeatType": "daily" } */ static async insertRemind(params:InsertEditRemindParams){ return await YTRequest.post(ApiUrl.INSERT_REMIND_ITEM,params) } //修改提醒事项 static async updateRemind(params:InsertEditRemindParams){ return await YTRequest.post(ApiUrl.UPDATE_REMIND_ITEM,params) } //删除 static async deleteRemind(id:number){ return await YTRequest.post(ApiUrl.DELETE_REMIND_ITEM,{} as ESObject,id) } //红点 static async getRed(yearMonth:string,odid:string){ return await YTRequest.get(ApiUrl.GET_UNCOMPELTE_RED,{yearMonth:yearMonth,odid:odid}) } }