| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- 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<ResponseResult<RemindItem[]>,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<boolean,InsertEditRemindParams>(ApiUrl.INSERT_REMIND_ITEM,params)
- }
- //修改提醒事项
- static async updateRemind(params:InsertEditRemindParams){
- return await YTRequest.post<boolean,InsertEditRemindParams>(ApiUrl.UPDATE_REMIND_ITEM,params)
- }
- //删除
- static async deleteRemind(id:number){
- return await YTRequest.post<boolean,number>(ApiUrl.DELETE_REMIND_ITEM,{} as ESObject,id)
- }
- //红点
- static async getRed(yearMonth:string,odid:string){
- return await YTRequest.get<string[]>(ApiUrl.GET_UNCOMPELTE_RED,{yearMonth:yearMonth,odid:odid})
- }
- }
|