originalRecords.ets 5.0 KB
import https from './request'
import { RecordsList, QueryParams, addParamsType, equipmentTest, LatestProjectTest,
  companyPersonTest, reportDetailTest, MalfunctionListTest, MalfunctionListRow,
  InitTest, realNameTest, orderTest,configTest,
  recordTest, orderParams, recordParams, editType
} from './recordsType'
import { quarterTest } from './options/optionsType'
// 获取维保记录列表
export const getRecordsList = (data: QueryParams) => {
  return https<RecordsList>({
    url: '/maintenance/report/list',
    method: 'get',
    params: data
  })
}

// 新增维保记录
export const addRecords = (data: addParamsType) => {
  return https({
    url: '/maintenance/report',
    method: 'post',
    data
  })
}

// 修改维保记录
export const updateRecords = (data: addParamsType) => {
  return https({
    url: '/maintenance/report',
    method: 'put',
    data
  })
}
interface deleteType{
  reportId: number,
  state: string
}

// 操作维保记录信息
export const deleteRecords = (data: deleteType) => {
  return https({
    url: '/maintenance/report/updateInfo',
    method: 'post',
    data
  })
}


// 获取仪器设备列表
export const getEquipmentList = (data: QueryParams) => {
  return https<equipmentTest>({
    url: '/system/equipment/list',
    method: 'get',
    params: data
  })
}

// 获取主要消防措施列表
export const getLatestProjectList = (type: string) => {
  return https<LatestProjectTest>({
    url: '/maintenance/project/latestProject',
    method: 'get',
    params: {
      type
    }
  })
}

// 获取记录类型列表
export const getMaintenanceType = () => {
  return https<quarterTest>({
    url: '/system/dict/data/type/maintenance_system_type',
    method: 'get'
  })
}

// 获取记录状态列表
export const getMaintenanceState = () => {
  return https<quarterTest>({
    url: '/system/dict/data/type/report_state',
    method: 'get'
  })
}

// 获取公司维保人员人员列表
export const getCompanyPersonList = (data: QueryParams) => {
  return https<companyPersonTest>({
    url: '/system/companyPerson/list',
    method: 'get',
    params: data
  })
}

// 获取维保详情
export const getReportDetail = (reportId: number) => {
  return https<reportDetailTest>({
    url: `/maintenance/report/view/${reportId}`,
    method: 'get'
  })
}
export  interface downloadUrl {
  code: number
  data: string
  msg: string
}

// 获取图片视频地址链接
export const getDownloadUrl = (cosKey: string, type: number) => {
  return https<downloadUrl>({
    url: `/system/COS/getDownloadUrl`,
    method: 'get',
    params: {
      cosKey,
      type
    }
  })
}

interface MalfunctionListType{
  pageNum: number,
  pageSize: number,
  reportId: number
}
// 获取消防设施故障处理单
export const getMalfunctionList = (data: MalfunctionListType) => {
  return https<MalfunctionListTest>({
    url: `/maintenance/malfunction/list`,
    method: 'get',
    params: data
  })
}

// 修改消防设施故障处理单
export const updateMalfunctionList = (data:editType) => {
  return https({
    url: `/maintenance/malfunction/updateList`,
    method: 'post',
    data
  })
}

// 获取原始记录详情及签名
export const getInitDetail = (reportId: number) => {
  return https<InitTest>({
    url: `/maintenance/report/view/${reportId}`,
    method: 'get'
  })
}

// 根据报告编号获取实名信息
export const getSelectByReportNo = (reportNo: string) => {
  return https<realNameTest>({
    url: `/maintenance/verification/selectByReportNo`,
    method: 'get',
    params: {
      reportNo
    }
  })
}

// 查询订单记录
export const getOrderList = (data: orderParams) => {
  return https<orderTest>({
    url: `/system/order/list`,
    method: 'get',
    params: data
  })
}

// 查询消耗记录
export const getRecordList = (data: recordParams) => {
  return https<recordTest>({
    url: `/system/record/list`,
    method: 'get',
    params: data
  })
}

// 查询支付来源
export const getOrderSource = () => {
  return https<quarterTest>({
    url: `/system/dict/data/type/pay_source`,
    method: 'get'
  })
}

// 查询订单状态
export const getOrderState = () => {
  return https<quarterTest>({
    url: `/system/dict/data/type/orders_state`,
    method: 'get'
  })
}

// 获取参数详情
export const getConfigDetail = (configId: number) => {
  return https<configTest>({
    url: `/system/config/${configId}`,
    method: 'get'
  })
}

// 完成签名
export const successReport = (reportId: number) => {
  return https<configTest>({
    url: `/maintenance/report/validReport`,
    method: 'post',
    data: {
      reportId
    }
  })
}

// 退回签名
export const returnSing = (reportId: number) => {
  return https<configTest>({
    url: `/maintenance/report/backToEdit`,
    method: 'post',
    data: {
      reportId
    }
  })
}

// 导入月度记录
export const importRecord = (fromReportId: number, toReportId:number) => {
  return https({
    url: `/maintenance/malfunction/importMalfunction`,
    method: 'get',
    params: {
      fromReportId,
      toReportId
    }
  })
}