import { Injectable } from '@angular/core';
import {Observable} from 'rxjs/Rx';
import {SERVER_API_URL} from '../app.constants';
import {HttpClient} from '@angular/common/http';

@Injectable()
export class WorkService {

    constructor(private http: HttpClient) {
    }

    //事件转派
    transfer(data): Observable<any>{
        return this.http.post(SERVER_API_URL + '/sysevent/transfer' ,data);
    }

    //修改事件
    update(data): Observable<any>{
        return this.http.post(SERVER_API_URL + '/sysevent/update' ,data);
    }

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

    //查找事件列表
    find(data): Observable<any>{
        return this.http.post(SERVER_API_URL + '/sysevent/find' ,data);
    }

    //根据事件编号查询
    findByNo(params): Observable<any>{
        return this.http.get(SERVER_API_URL + '/sysevent/find/' +params);
    }

    //添加事件
    create(data): Observable<any>{
        return this.http.post(SERVER_API_URL + '/sysevent/create' ,data);
    }

    //事件信息流转记录查询接口
    transferInfo(params): Observable<any>{
        return this.http.get(SERVER_API_URL + '/sysevent/transferInfo/' +params);
    }

    //处理事件
    deal(data): Observable<any>{
        return this.http.post(SERVER_API_URL + '/sysevent/deal' ,data);
    }

}
