import request from '@/config/axios'

// 瑞鹰日报 VO
export interface IotRyDailyReportVO {
  createTime: number
  transitTime: any
  totalStaffNum: any
  offDutyStaffNum: any
  id: number // 主键id
  deptId: number // 施工队伍id
  projectId: number // 项目id
  taskId: number // 任务id
  projectClassification: string // 项目类别(钻井 修井 注氮 酸化压裂... )
  relocationDays: number // 搬迁安装天数(D)
  latestWellDoneTime: Date // 上井次完井时间
  currentDepth: number // 当前井深(m)
  dailyFootage: number // 日进尺(m)
  monthlyFootage: number // 月进尺(m)
  annualFootage: number // 年累计进尺(m)
  dailyPowerUsage: number // 当日用电量(kWh)
  monthlyPowerUsage: number // 当月用电量(kWh)
  dailyFuel: number // 当日油耗(吨)
  monthlyFuel: number // 当月油耗(吨)
  nonProductionTime: number // 非生产时间(H)
  nptReason: string // 非生产时间原因
  drillingWorkingTime: number
  otherProductionTime: number
  accidentTime: number
  repairTime: number
  selfStopTime: number
  complexityTime: number
  relocationTime: number
  rectificationTime: number
  waitingStopTime: number
  winterBreakTime: number
  constructionStartDate: Date // 施工开始日期
  constructionEndDate: Date // 施工结束日期
  productionStatus: string // 当日生产情况生产动态
  nextPlan: string // 下步工作计划
  rigStatus: number // 施工状态(动迁 准备 施工 完工)
  personnel: string // 人员情况
  mudDensity: number // 泥浆性能-密度(g/cm³)
  mudViscosity: number // 泥浆性能-粘度(S)
  lateralLength: number // 水平段长度(m) 适用于水平井
  wellInclination: number // 井斜(°)
  azimuth: number // 方位(°)
  extProperty: string // 不同专业公司的扩展属性值
  sort: number // 排序值
  remark: string // 备注
  status: number // 状态(0启用 1禁用)
  processInstanceId: string // 流程实例id
  auditStatus: number // 审批状态 未提交、审批中、审批通过、审批不通过、已取消
}

// 瑞鹰日报 API
export const IotRyDailyReportApi = {
  exportRyDailyReportStatistics: async (params: any) => {
    return await request.download({
      url: `/pms/iot-ry-daily-report/exportStatistics`,
      params
    })
  },

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

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

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

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

  // 查询瑞鹰日报分页
  getIotRyDailyReportPage: async (params: any) => {
    return await request.get({ url: `/pms/iot-ry-daily-report/page`, params })
  },

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

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

  // 累计工作量统计
  totalWorkload: async (params: any) => {
    return await request.get({ url: `/pms/iot-ry-daily-report/totalWorkload`, params })
  },

  // 按照日期查询瑞恒日报统计数据 已填报 未填报 数量
  ryDailyReportStatistics: async (params: any) => {
    return await request.get({ url: `/pms/iot-ry-daily-report/ryDailyReportStatistics`, params })
  },

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

  // 新增瑞鹰日报
  createIotRyDailyReport: async (data: IotRyDailyReportVO) => {
    return await request.post({ url: `/pms/iot-ry-daily-report/create`, data })
  },

  // 修改瑞鹰日报
  updateIotRyDailyReport: async (data: IotRyDailyReportVO) => {
    return await request.put({ url: `/pms/iot-ry-daily-report/update`, data })
  },

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

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

  approvalIotRyDailyReport: async (data: {
    id: number
    auditStatus: 20 | 30
    opinion: string
    constructionBrief?: string
  }) => {
    return await request.put({ url: `/pms/iot-ry-daily-report/approval`, data })
  },
  exportIotRyDailyReportWell: async (params) => {
    return await request.download({ url: `/pms/iot-ry-daily-report/exportSingleWells`, params })
  },
  exportIotRyDailyReportTeam: async (params) => {
    return await request.download({ url: `/pms/iot-ry-daily-report/exportSingleTeams`, params })
  }
}
