import request from '@/utils/httpRequest'

export default class ProjectRecordsService {
  list (params) {
    return request({
      url: '/cwProjectRecords/list',
      method: 'get',
      params: params
    })
  }
  list2 (params) {
    return request({
      url: '/cwProjectRecords/list2',
      method: 'get',
      params: params
    })
  }
  queryById (id) {
    return request({
      url: '/cwProjectRecords/queryById',
      method: 'get',
      params: {id: id}
    })
  }
  save (inputForm) {
    return request({
      url: `/cwProjectRecords/save`,
      method: 'post',
      data: inputForm
    })
  }
  saveForm (inputForm) {
    return request({
      url: `/cwProjectRecords/saveForm`,
      method: 'post',
      data: inputForm
    })
  }
  delete (ids) {
    return request({
      url: '/cwProjectRecords/delete',
      method: 'delete',
      params: {ids: ids}
    })
  }
  updateStatusById (data) {
    return request({
      url: '/cwProjectRecords/updateStatusById',
      method: 'post',
      data: data
    })
  }
  exportFile (params) {
    return request({
      url: '/cwProjectRecords/export',
      method: 'get',
      params: params,
      responseType: 'blob'
    })
  }
  getByClientId (id, projectForm) {
    return request({
      url: '/cwProjectRecords/getByClientId',
      method: 'get',
      params: {clientId: id, ...projectForm}
    })
  }
  getByContractId (id, projectForm) {
    return request({
      url: '/cwProjectRecords/getByContractId',
      method: 'get',
      params: {contractId: id, ...projectForm}
    })
  }
  updateMembers (inputForm) {
    return request({
      url: `/cwProjectRecords/updateMembers`,
      method: 'post',
      data: inputForm
    })
  }
  getHaveProjectIds () {
    return request({
      url: '/cwProjectRecords/getHaveProjectIds',
      method: 'get'
    })
  }
  getContractClientList (params) {
    return request({
      url: '/cw_work_client/info/getContractClientList',
      method: 'get',
      params: params
    })
  }
}
