import request from '@/config/axios'

export interface WorkCardVO {
  cardId?: number
  cardCode: string
  cardName: string
  userId?: number
  enableFlag?: string
  remark?: string
  createBy?: string
  createTime?: Date
  updateBy?: string
  updateTime?: Date
}

export interface PageParam {
  pageNo: number
  pageSize: number
  cardCode?: string
  cardName?: string
  userId?: number
  enableFlag?: string
}

// 查询工作卡分页
export const getWordCardList = async (params: PageParam) => {
  return await request.get({ url: '/iscs/job-card/getJobCardPage', params })
}

// 工卡详细信息
export const workCardInfo = async (id: number) => {
  return await request.get({
    url: '/iscs/job-card/selectJobCardById',
    params: { id }
  })
}

// 新增工卡
export const addWorkCard = async (data: WorkCardVO) => {
  return await request.post({ url: '/iscs/job-card/insertJobCard', data })
}

// 修改工卡信息
export const updateWorkCard = async (data: WorkCardVO) => {
  return await request.put({ url: '/iscs/job-card/updateJobCard', data })
}

// 删除工卡信息
export const delWorkCard = async (ids: number) => {
  return await request.delete({
    url: '/iscs/job-card/deleteJobCardList?ids='+ids,
  })
}

// 人员列表 selectAll:1 标识查询所有
export const getUserList = async (params: PageParam) => {
  return await request.get({ url: '/system/user/page', params })
}
