import { axios } from '@/utils/request'

export class HousekeepingApi {

    /**
     * 获取锁房记录列表
     * @returns 
     */
    static getAllData(){
        return axios({
            url: '/fw/fwRoomRepair/list',
            method: 'get',
        })
    }

    /**
     * 获取今日锁房总数
     * @returns 
     */
    static getLockedRoom(){
        let str = new Date().toLocaleDateString()
        //后一天
        let end = new Date(new Date().getTime() + 24 * 60 * 60 * 1000).toLocaleDateString()
        str = str.replace(/\//g, '-')
        end = end.replace(/\//g, '-')
        return axios({
            url: `/fw/fwRoomLock/list?startTime=${str}&endTime=${end}`,
            method: 'get',
        })
    }

    /**
     * 获取今日完成维修总数
     * @returns
     */
    static getRepairRoom(){
        let str = new Date().toLocaleDateString()
        //后一天
        let end = new Date(new Date().getTime() + 24 * 60 * 60 * 1000).toLocaleDateString()
        str = str.replace(/\//g, '-')
        end = end.replace(/\//g, '-')
        return axios({
            url: `/fw/fwRoomRepair/list?status=2&createTime=${str}&endTime=${end}`,
            method: 'get',
        })
    }

    /**
     * 获取正在维修中总数 
     * @returns 
     */
    static getInRepair(){
        let str = new Date().toLocaleDateString()
        //后一天
        let end = new Date(new Date().getTime() + 24 * 60 * 60 * 1000).toLocaleDateString()
        str = str.replace(/\//g, '-')
        end = end.replace(/\//g, '-')
        return axios({
            url: `/fw/fwRoomRepair/list?status=1`,
            method: 'get',
        })
    }

}