RemindApi.ets 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. import { YTRequest } from "basic"
  2. import { ApiUrl } from "./ApiUrl"
  3. import { ResponseResult } from "./GreenPlantApi"
  4. //查询提醒设置参数
  5. export interface GetRemindParams{
  6. oaid?: number
  7. page: number,
  8. pageSizes: number,
  9. plantsId?: number,
  10. remindDate?:string
  11. }
  12. export interface InsertEditRemindParams{
  13. oaid?:string
  14. plantsId?: number
  15. settingId?:number,
  16. itemId?: number,
  17. isOpen?:boolean,
  18. itemIcon?: string,
  19. itemName?: string
  20. repeatType?: string
  21. remindDate?: string
  22. remindTime?: string
  23. weeklyWeekday?:number
  24. monthlyDay?:number
  25. intervalDays?:number
  26. }
  27. //设置数据接口
  28. export interface RemindItem{
  29. oaid?:string,
  30. settingId:number,
  31. plantsId:number,
  32. itemId:number, // 养护事项ID
  33. itemName:string,
  34. itemIcon: string,
  35. remindDate:string, // 首次提醒日期
  36. remindTime:string, //提醒时间(HH:mm:ss)
  37. repeatType:string, // 周期类型: once, daily, weekly, monthly, custom
  38. intervalDays:string // 自定义间隔天数(仅当 repeat_type=custom 时有效)
  39. weeklyWeekday:string, //每周几(1=周一, 7=周日),仅 weekly 使用
  40. monthlyDay:string, //每月几号(1~31),仅 monthly 使用
  41. isOpen:boolean // 是否开启提醒:0=否,1=是"plantsName": "",
  42. plantsPicture: string,
  43. plantsName: string,
  44. }
  45. @ObservedV2
  46. export class RemindItemClass{
  47. plantsPicture: string
  48. plantsName: string
  49. settingId:number
  50. plantsId:number
  51. itemId:number // 养护事项ID
  52. itemName:string
  53. itemIcon: string
  54. remindDate:string// 首次提醒日期
  55. remindTime:string //提醒时间(HH:mm:ss)
  56. repeatType:string // 周期类型: once, daily, weekly, monthly, custom
  57. intervalDays:string // 自定义间隔天数(仅当 repeat_type=custom 时有效)
  58. weeklyWeekday:string //每周几(1=周一, 7=周日),仅 weekly 使用
  59. monthlyDay:string //每月几号(1~31),仅 monthly 使用
  60. @Trace
  61. isOpen:boolean // 是否开启提醒:0=否,1=是
  62. constructor(item:RemindItem) {
  63. this.settingId=item.settingId
  64. this.plantsId=item.plantsId
  65. this.itemId=item.itemId
  66. this.itemName=item.itemName
  67. this.itemIcon=item.itemIcon
  68. this.remindDate=item.remindDate
  69. this.remindTime=item.remindTime
  70. this.repeatType=item.repeatType
  71. this.intervalDays=item.intervalDays
  72. this.weeklyWeekday=item.weeklyWeekday
  73. this.monthlyDay=item.monthlyDay
  74. this.isOpen=item.isOpen
  75. this.plantsName=item.plantsName
  76. this.plantsPicture=item.plantsPicture
  77. }
  78. }
  79. export class RemindApi{
  80. //更具植物id获取植物提醒设置列表
  81. static async getRemindList(params:GetRemindParams){
  82. return await YTRequest.post<ResponseResult<RemindItem[]>,GetRemindParams>(ApiUrl.GET_REMIND_LIST,params)
  83. }
  84. //新增提醒设置
  85. /**
  86. * {
  87. "oaid": "814d1a21-c082-4faf-9cec-f84cb3d05512",
  88. "plantsId": 6,
  89. "itemId": 4,
  90. "itemName": "浇水",
  91. "remindDate": "2025-10-18",
  92. "remindTime": "08:30:00",
  93. "repeatType": "daily"
  94. }
  95. */
  96. static async insertRemind(params:InsertEditRemindParams){
  97. return await YTRequest.post<boolean,InsertEditRemindParams>(ApiUrl.INSERT_REMIND_ITEM,params)
  98. }
  99. //修改提醒事项
  100. static async updateRemind(params:InsertEditRemindParams){
  101. return await YTRequest.post<boolean,InsertEditRemindParams>(ApiUrl.UPDATE_REMIND_ITEM,params)
  102. }
  103. //删除
  104. static async deleteRemind(id:number){
  105. return await YTRequest.post<boolean,number>(ApiUrl.DELETE_REMIND_ITEM,{} as ESObject,id)
  106. }
  107. //红点
  108. static async getRed(yearMonth:string,odid:string){
  109. return await YTRequest.get<string[]>(ApiUrl.GET_UNCOMPELTE_RED,{yearMonth:yearMonth,odid:odid})
  110. }
  111. }