import request from '@/config/axios'

// 瑞都日报 VO
export interface IotRdDailyReportVO {
  createTime: any
  id: number // 主键id
  deptId: number // 施工队伍id
  projectId: number // 项目id
  taskId: number // 任务id
  projectClassification: string // 项目类别(钻井 修井 注氮 酸化压裂... )
  techniqueIds: string // 施工工艺([123,233])
  deviceIds: string // 施工设备([123,233])
  startTime: string // 时间节点-开始
  endTime: string // 时间节点-结束
  cumulativeWorkingWell: number // 累计施工井
  cumulativeWorkingLayers: number // 累计施工层
  dailyPumpTrips: number // 当日泵车台次
  dailyToolsSand: number // 当日仪表/混砂
  runCount: number // 趟数
  bridgePlug: number // 桥塞
  waterVolume: number // 水方量
  hourCount: number // 时间H
  dailyFuel: number // 当日油耗(吨)
  dailyPowerUsage: number // 当日用电量(kWh)
  productionTime: number // 生产时间(H)
  nonProductionTime: number // 非生产时间(H)
  rdNptReason: string // 非生产时间原因
  constructionStartDate: Date // 施工开始日期
  constructionEndDate: Date // 施工结束日期
  productionStatus: string // 当日生产情况生产动态
  externalRental: string // 外租情况(可能有附件)
  nextPlan: string // 下步工作计划
  rdStatus: string // 施工状态(动迁上井/动迁下井/施工准备/施工...)
  malfunction: string // 故障情况
  faultDowntime: number // 故障误工h
  personnel: string // 人员情况
  totalStaffNum: number // 全员数量
  leaveStaffNum: number // 休假人员数量
  extProperty: string // 不同专业公司的扩展属性值
  sort: number // 排序值
  remark: string // 备注
  status: number // 状态(0启用 1禁用)
  processInstanceId: string // 流程实例id
  auditStatus: number // 审批状态 未提交、审批中、审批通过、审批不通过、已取消
  opinion: string // 审批意见
}

// 瑞都日报 API
export const IotRdDailyReportApi = {
  nptStatistics: async (params: any) => {
    return await request.get({ url: `/pms/iot-rd-daily-report/nptStatistics`, params })
  },
  // 查询瑞都日报分页
  getIotRdDailyReportPage: async (params: any) => {
    return await request.get({ url: `/pms/iot-rd-daily-report/page`, params })
  },

  getIotRdDailyReportTeamPage: async (params: any) => {
    return await request.get({ url: `/pms/iot-rd-daily-report/teamReports`, params })
  },

  getIotRdDailyReportWellPage: async (params: any) => {
    return await request.get({ url: `/pms/iot-rd-daily-report/wellReports`, params })
  },

  // 查询瑞都日报 汇总统计
  statistics: async (params: any) => {
    return await request.get({ url: `/pms/iot-rd-daily-report/statistics`, params })
  },

  // 查询瑞都日报详情
  getIotRdDailyReport: async (id: number) => {
    return await request.get({ url: `/pms/iot-rd-daily-report/get?id=` + id })
  },

  // 新增瑞都日报
  createIotRdDailyReport: async (data: any) => {
    return await request.post({ url: `/pms/iot-rd-daily-report/create`, data })
  },

  // 修改瑞都日报
  updateIotRdDailyReport: async (data: IotRdDailyReportVO) => {
    return await request.put({ url: `/pms/iot-rd-daily-report/update`, data })
  },

  // 批量更新瑞都日报 平台井
  saveBatch: async (data: any) => {
    return await request.post({ url: `/pms/iot-rd-daily-report/saveBatch`, data })
  },

  // 审批瑞都日报
  approveRdDailyReport: async (data: any) => {
    return await request.put({ url: `/pms/iot-rd-daily-report/approval`, data })
  },

  // 删除瑞都日报
  deleteIotRdDailyReport: async (id: number) => {
    return await request.delete({ url: `/pms/iot-rd-daily-report/delete?id=` + id })
  },

  // 导出瑞都日报 Excel
  exportIotRdDailyReport: async (params) => {
    return await request.download({ url: `/pms/iot-rd-daily-report/export-excel`, params })
  },

  exportIotRdDailyReportDetails: async (params) => {
    return await request.download({ url: `/pms/iot-rd-daily-report/export-detail`, params })
  },

  // 查询项目任务实际进度列表
  taskActualProgress: async (params: any) => {
    return await request.get({ url: `/pms/iot-rd-daily-report/taskActualProgress`, params })
  },

  totalWorkload: async (params: any) => {
    return await request.get({ url: `/pms/iot-rd-daily-report/totalWorkload`, params })
  },

  getIotRdDailyReportSummary: async (params: any) => {
    return await request.get({ url: `/pms/iot-rd-daily-report/summaryStatistics`, params })
  },
  getIotRdDailyReportSummaryPolyline: async (params: any) => {
    return await request.get({ url: `/pms/iot-rd-daily-report/polylineStatistics`, params })
  },

  exportRdDailyReportStatistics: async (params) => {
    return await request.download({ url: `/pms/iot-rd-daily-report/exportStatistics`, params })
  },
  exportIotRdDailyReportWell: async (params) => {
    return await request.download({ url: `/pms/iot-rd-daily-report/exportSingleWells`, params })
  },
  exportIotRdDailyReportTeam: async (params) => {
    return await request.download({ url: `/pms/iot-rd-daily-report/exportSingleTeams`, params })
  }
}
