import { Http,Util } from '@/utils';
import EntityService from '../entity-service';



/**
 * 请假管理服务对象基类
 *
 * @export
 * @class VacLeaveManageServiceBase
 * @extends {EntityServie}
 */
export default class VacLeaveManageServiceBase extends EntityService {

    /**
     * Creates an instance of  VacLeaveManageServiceBase.
     * 
     * @param {*} [opts={}]
     * @memberof  VacLeaveManageServiceBase
     */
    constructor(opts: any = {}) {
        super(opts);
    }

    /**
     * 初始化基础数据
     *
     * @memberof VacLeaveManageServiceBase
     */
    public initBasicData(){
        this.APPLYDEKEY ='vacleavemanage';
        this.APPDEKEY = 'vacleavemanageid';
        this.APPDENAME = 'vacleavemanages';
        this.APPDETEXT = 'pimpersonname';
        this.APPNAME = 'ehratt';
        this.SYSTEMNAME = 'ehr_practice05';
    }

// 实体接口

    /**
     * Select接口方法
     *
     * @param {*} [context={}]
     * @param {*} [data={}]
     * @param {boolean} [isloading]
     * @returns {Promise<any>}
     * @memberof VacLeaveManageServiceBase
     */
    public async Select(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        if(context.pimperson && context.vacleavemanage){
            let res:any = Http.getInstance().get(`/pimpeople/${context.pimperson}/vacleavemanages/${context.vacleavemanage}/select`,isloading);
            
            return res;
        }
            let res:any = Http.getInstance().get(`/vacleavemanages/${context.vacleavemanage}/select`,isloading);
            
            return res;
    }

    /**
     * Create接口方法
     *
     * @param {*} [context={}]
     * @param {*} [data={}]
     * @param {boolean} [isloading]
     * @returns {Promise<any>}
     * @memberof VacLeaveManageServiceBase
     */
    public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        if(context.pimperson && true){
            let masterData:any = {};
            Object.assign(data,masterData);
            if(!data.srffrontuf || data.srffrontuf !== "1"){
                data[this.APPDEKEY] = null;
            }
            if(data.srffrontuf){
                delete data.srffrontuf;
            }
            let tempContext:any = JSON.parse(JSON.stringify(context));
            let res:any = await Http.getInstance().post(`/pimpeople/${context.pimperson}/vacleavemanages`,data,isloading);
            
            return res;
        }
        let masterData:any = {};
        Object.assign(data,masterData);
        if(!data.srffrontuf || data.srffrontuf !== "1"){
            data[this.APPDEKEY] = null;
        }
        if(data.srffrontuf){
            delete data.srffrontuf;
        }
        let tempContext:any = JSON.parse(JSON.stringify(context));
        let res:any = await Http.getInstance().post(`/vacleavemanages`,data,isloading);
        
        return res;
    }

    /**
     * Update接口方法
     *
     * @param {*} [context={}]
     * @param {*} [data={}]
     * @param {boolean} [isloading]
     * @returns {Promise<any>}
     * @memberof VacLeaveManageServiceBase
     */
    public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        if(context.pimperson && context.vacleavemanage){
            let masterData:any = {};
            Object.assign(data,masterData);
            let res:any = await Http.getInstance().put(`/pimpeople/${context.pimperson}/vacleavemanages/${context.vacleavemanage}`,data,isloading);
            
            return res;
        }
        let masterData:any = {};
        Object.assign(data,masterData);
            let res:any = await  Http.getInstance().put(`/vacleavemanages/${context.vacleavemanage}`,data,isloading);
            
            return res;
    }

    /**
     * Remove接口方法
     *
     * @param {*} [context={}]
     * @param {*} [data={}]
     * @param {boolean} [isloading]
     * @returns {Promise<any>}
     * @memberof VacLeaveManageServiceBase
     */
    public async Remove(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        if(context.pimperson && context.vacleavemanage){
            let res:any = Http.getInstance().delete(`/pimpeople/${context.pimperson}/vacleavemanages/${context.vacleavemanage}`,isloading);
            return res;
        }
            let res:any = Http.getInstance().delete(`/vacleavemanages/${context.vacleavemanage}`,isloading);
            return res;
    }

    /**
     * Get接口方法
     *
     * @param {*} [context={}]
     * @param {*} [data={}]
     * @param {boolean} [isloading]
     * @returns {Promise<any>}
     * @memberof VacLeaveManageServiceBase
     */
    public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        if(context.pimperson && context.vacleavemanage){
            let res:any = await Http.getInstance().get(`/pimpeople/${context.pimperson}/vacleavemanages/${context.vacleavemanage}`,isloading);
            
            return res;
        }
            let res:any = await Http.getInstance().get(`/vacleavemanages/${context.vacleavemanage}`,isloading);
            
            return res;
    }

    /**
     * GetDraft接口方法
     *
     * @param {*} [context={}]
     * @param {*} [data={}]
     * @param {boolean} [isloading]
     * @returns {Promise<any>}
     * @memberof VacLeaveManageServiceBase
     */
    public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        if(context.pimperson && true){
            let res:any = await Http.getInstance().get(`/pimpeople/${context.pimperson}/vacleavemanages/getdraft`,isloading);
            res.data.vacleavemanage = data.vacleavemanage;
            
            return res;
        }
        let res:any = await  Http.getInstance().get(`/vacleavemanages/getdraft`,isloading);
        res.data.vacleavemanage = data.vacleavemanage;
        
        return res;
    }

    /**
     * CB接口方法
     *
     * @param {*} [context={}]
     * @param {*} [data={}]
     * @param {boolean} [isloading]
     * @returns {Promise<any>}
     * @memberof VacLeaveManageServiceBase
     */
    public async CB(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        if(context.pimperson && context.vacleavemanage){
            let masterData:any = {};
            Object.assign(data,masterData);
            let res:any = await Http.getInstance().post(`/pimpeople/${context.pimperson}/vacleavemanages/${context.vacleavemanage}/cb`,data,isloading);
            
            return res;
        }
            let res:any = Http.getInstance().post(`/vacleavemanages/${context.vacleavemanage}/cb`,data,isloading);
            return res;
    }

    /**
     * CX接口方法
     *
     * @param {*} [context={}]
     * @param {*} [data={}]
     * @param {boolean} [isloading]
     * @returns {Promise<any>}
     * @memberof VacLeaveManageServiceBase
     */
    public async CX(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        if(context.pimperson && context.vacleavemanage){
            let masterData:any = {};
            Object.assign(data,masterData);
            let res:any = await Http.getInstance().post(`/pimpeople/${context.pimperson}/vacleavemanages/${context.vacleavemanage}/cx`,data,isloading);
            
            return res;
        }
            let res:any = Http.getInstance().post(`/vacleavemanages/${context.vacleavemanage}/cx`,data,isloading);
            return res;
    }

    /**
     * CheckKey接口方法
     *
     * @param {*} [context={}]
     * @param {*} [data={}]
     * @param {boolean} [isloading]
     * @returns {Promise<any>}
     * @memberof VacLeaveManageServiceBase
     */
    public async CheckKey(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        if(context.pimperson && context.vacleavemanage){
            let masterData:any = {};
            Object.assign(data,masterData);
            let res:any = await Http.getInstance().post(`/pimpeople/${context.pimperson}/vacleavemanages/${context.vacleavemanage}/checkkey`,data,isloading);
            
            return res;
        }
            let res:any = Http.getInstance().post(`/vacleavemanages/${context.vacleavemanage}/checkkey`,data,isloading);
            return res;
    }

    /**
     * GetFJSJofPerson接口方法
     *
     * @param {*} [context={}]
     * @param {*} [data={}]
     * @param {boolean} [isloading]
     * @returns {Promise<any>}
     * @memberof VacLeaveManageServiceBase
     */
    public async GetFJSJofPerson(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        if(context.pimperson && context.vacleavemanage){
            let res:any = await Http.getInstance().get(`/pimpeople/${context.pimperson}/vacleavemanages/${context.vacleavemanage}/getfjsjofperson`,isloading);
            
            return res;
        }
            let res:any = await Http.getInstance().get(`/vacleavemanages/${context.vacleavemanage}/getfjsjofperson`,isloading);
            
            return res;
    }

    /**
     * MobStart接口方法
     *
     * @param {*} [context={}]
     * @param {*} [data={}]
     * @param {boolean} [isloading]
     * @returns {Promise<any>}
     * @memberof VacLeaveManageServiceBase
     */
    public async MobStart(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        if(context.pimperson && context.vacleavemanage){
            let masterData:any = {};
            Object.assign(data,masterData);
            let res:any = await Http.getInstance().post(`/pimpeople/${context.pimperson}/vacleavemanages/${context.vacleavemanage}/mobstart`,data,isloading);
            
            return res;
        }
            let res:any = Http.getInstance().post(`/vacleavemanages/${context.vacleavemanage}/mobstart`,data,isloading);
            return res;
    }

    /**
     * Save接口方法
     *
     * @param {*} [context={}]
     * @param {*} [data={}]
     * @param {boolean} [isloading]
     * @returns {Promise<any>}
     * @memberof VacLeaveManageServiceBase
     */
    public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        if(context.pimperson && context.vacleavemanage){
            let masterData:any = {};
            Object.assign(data,masterData);
            let res:any = await Http.getInstance().post(`/pimpeople/${context.pimperson}/vacleavemanages/${context.vacleavemanage}/save`,data,isloading);
            
            return res;
        }
        let masterData:any = {};
        Object.assign(data,masterData);
            let res:any = await  Http.getInstance().post(`/vacleavemanages/${context.vacleavemanage}/save`,data,isloading);
            
            return res;
    }

    /**
     * UpdateQJMX接口方法
     *
     * @param {*} [context={}]
     * @param {*} [data={}]
     * @param {boolean} [isloading]
     * @returns {Promise<any>}
     * @memberof VacLeaveManageServiceBase
     */
    public async UpdateQJMX(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        if(context.pimperson && context.vacleavemanage){
            let masterData:any = {};
            Object.assign(data,masterData);
            let res:any = await Http.getInstance().put(`/pimpeople/${context.pimperson}/vacleavemanages/${context.vacleavemanage}/updateqjmx`,data,isloading);
            
            return res;
        }
            let res:any = Http.getInstance().put(`/vacleavemanages/${context.vacleavemanage}/updateqjmx`,data,isloading);
            return res;
    }

    /**
     * FetchDefault接口方法
     *
     * @param {*} [context={}]
     * @param {*} [data={}]
     * @param {boolean} [isloading]
     * @returns {Promise<any>}
     * @memberof VacLeaveManageServiceBase
     */
    public async FetchDefault(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        if(context.pimperson && true){
            let tempData:any = JSON.parse(JSON.stringify(data));
            let res:any = Http.getInstance().get(`/pimpeople/${context.pimperson}/vacleavemanages/fetchdefault`,tempData,isloading);
            return res;
        }
        let tempData:any = JSON.parse(JSON.stringify(data));
        let res:any = Http.getInstance().get(`/vacleavemanages/fetchdefault`,tempData,isloading);
        return res;
    }

    /**
     * FetchFormType接口方法
     *
     * @param {*} [context={}]
     * @param {*} [data={}]
     * @param {boolean} [isloading]
     * @returns {Promise<any>}
     * @memberof VacLeaveManageServiceBase
     */
    public async FetchFormType(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        if(context.pimperson && true){
            let tempData:any = JSON.parse(JSON.stringify(data));
            let res:any = Http.getInstance().get(`/pimpeople/${context.pimperson}/vacleavemanages/fetchformtype`,tempData,isloading);
            return res;
        }
        let tempData:any = JSON.parse(JSON.stringify(data));
        let res:any = Http.getInstance().get(`/vacleavemanages/fetchformtype`,tempData,isloading);
        return res;
    }

    /**
     * FetchGR接口方法
     *
     * @param {*} [context={}]
     * @param {*} [data={}]
     * @param {boolean} [isloading]
     * @returns {Promise<any>}
     * @memberof VacLeaveManageServiceBase
     */
    public async FetchGR(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        if(context.pimperson && true){
            let tempData:any = JSON.parse(JSON.stringify(data));
            let res:any = Http.getInstance().get(`/pimpeople/${context.pimperson}/vacleavemanages/fetchgr`,tempData,isloading);
            return res;
        }
        let tempData:any = JSON.parse(JSON.stringify(data));
        let res:any = Http.getInstance().get(`/vacleavemanages/fetchgr`,tempData,isloading);
        return res;
    }

    /**
     * FetchJLSS接口方法
     *
     * @param {*} [context={}]
     * @param {*} [data={}]
     * @param {boolean} [isloading]
     * @returns {Promise<any>}
     * @memberof VacLeaveManageServiceBase
     */
    public async FetchJLSS(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        if(context.pimperson && true){
            let tempData:any = JSON.parse(JSON.stringify(data));
            let res:any = Http.getInstance().get(`/pimpeople/${context.pimperson}/vacleavemanages/fetchjlss`,tempData,isloading);
            return res;
        }
        let tempData:any = JSON.parse(JSON.stringify(data));
        let res:any = Http.getInstance().get(`/vacleavemanages/fetchjlss`,tempData,isloading);
        return res;
    }

    /**
     * FetchMOBJLSS接口方法
     *
     * @param {*} [context={}]
     * @param {*} [data={}]
     * @param {boolean} [isloading]
     * @returns {Promise<any>}
     * @memberof VacLeaveManageServiceBase
     */
    public async FetchMOBJLSS(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        if(context.pimperson && true){
            let tempData:any = JSON.parse(JSON.stringify(data));
            let res:any = Http.getInstance().get(`/pimpeople/${context.pimperson}/vacleavemanages/fetchmobjlss`,tempData,isloading);
            return res;
        }
        let tempData:any = JSON.parse(JSON.stringify(data));
        let res:any = Http.getInstance().get(`/vacleavemanages/fetchmobjlss`,tempData,isloading);
        return res;
    }

    /**
     * FetchOnlySPTY接口方法
     *
     * @param {*} [context={}]
     * @param {*} [data={}]
     * @param {boolean} [isloading]
     * @returns {Promise<any>}
     * @memberof VacLeaveManageServiceBase
     */
    public async FetchOnlySPTY(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        if(context.pimperson && true){
            let tempData:any = JSON.parse(JSON.stringify(data));
            let res:any = Http.getInstance().get(`/pimpeople/${context.pimperson}/vacleavemanages/fetchonlyspty`,tempData,isloading);
            return res;
        }
        let tempData:any = JSON.parse(JSON.stringify(data));
        let res:any = Http.getInstance().get(`/vacleavemanages/fetchonlyspty`,tempData,isloading);
        return res;
    }
}