import {HttpClient} from '@angular/common/http';
import {Observable} from 'rxjs/Rx';
import {Injectable} from '@angular/core';
import {SERVER_API_URL} from '../app.constants';
import {CommonService} from '../shared/common/common.service';
import {LocalStorageService, SessionStorageService} from 'ngx-webstorage';

@Injectable()
export class InfomationService {

    headers;
    options;

    constructor(private http: HttpClient, private commonSer: CommonService,
                private localStorage: LocalStorageService, private sessionStorage: SessionStorageService) {
    }

    //分页查询
    propertyPage(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/property/page', data);
    }

    //数据导入
    importE(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/property/importE', data);
    }

    //数据导出
    propertyExport(): Observable<any> {
        return this.http.get(SERVER_API_URL + '/property/export',{responseType: 'blob'});
    }

    //根据id查询详情
    propertyFind(params): Observable<any> {
        return this.http.get(SERVER_API_URL + '/property/find/' + params);
    }

    //删除
    propertyDelete(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/property/delete', data);
    }

    //新增
    propertyAdd(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/property/add', data);
    }

    //更新
    propertyUpdate(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/property/update', data);
    }

    //根据id查询详情
    propertyFindById(params): Observable<any> {
        return this.http.get(SERVER_API_URL + '/property/find/'+ params);
    }
}
