import request from '@/utils/request'

/**
 * 获取经营异常录入审核人列表
 */
export function getAbnormalReviewerList() {
  return request({
    url: '/bizSpeList/getAbnormalReviewerList',
    method: 'get'
  })
}

/**
 * 保存异常经营名录受理
 * @param {string} toIncludeIds 主体pripid
 * @param {string} enterType 主体类型
 * @author lroyia
 * @since 2021年2月8日 11:05:09
 */
export function saveAbnormalAccept(ids, abnType, enterType) {
  const form = new FormData()
  form.append('ids', ids)
  form.append('entertype', enterType)
  form.append('abnType', abnType)
  return request({
    url: '/bizSpeList/saveAccept.do',
    method: 'post',
    data: form
  })
}

export function saveAcceptBatch(ids, enterType) {
  const form = new FormData()
  form.append('id', ids)
  form.append('entertype', enterType)
  return request({
    url: '/bizSpeList/saveAcceptBatch',
    method: 'post',
    data: form
  })
}

/**
 * 个案列异发起
 * @param ids
 * @param abnType
 * @param enterType
 * @returns {AxiosPromise}
 */
export function saveIvdAccept(pripid) {
  const form = new FormData()
  form.append('pripid', pripid)
  return request({
    url: '/bizSpeList/saveIvdAccept',
    method: 'post',
    data: form
  })
}

/**
 * 异常名录列入流程 下一步
 */
export function nextAbnormaInclusionProcess(data) {
  return request({
    url: '/bizSpeList/processControl',
    method: 'post',
    data
  })
}
// /**
//  * 下一个异常名录录入流程节点
//  * @param {object}} data 数据
//  * @author lroyia
//  * @since 2021年2月8日 14:03:18
//  */
// export function nextAbnormaInclusionProcess(data) {
//   const form = new FormData()
//   for (const key in data) {
//     form.append(key, data[key])
//   }
//   return request({
//     url: '/bizSpeList/exptnext.do',
//     method: 'post',
//     data: form
//   })
// }
/**
 * 下一个异常名录异议流程节点
 */
export function updatebizDissent(data) {
  const form = new FormData()
  for (const key in data) {
    form.append(key, data[key])
  }
  return request({
    url: '/bizDissent/updatebizDissent.do',
    method: 'post',
    data: form
  })
}

/**
 * 通过业务号查询列入原因及事实理由
 * @param {string} bizSeqId 业务号
 * @author Lee
 */
export function searchBizSpeByBizSeqId(bizSeqId) {
  return request({
    url: '/bizSpeList/searchBizSpeByBizSeqId?bizSeqId=' + bizSeqId,
    method: 'get'
  })
}
/**
 * 列异业务获取在办名单--分页
 * @param {data} 分页参数
 */
export function getBizSpeListPage(data) {
  return request({
    url: '/exptList/getBizSpeListPage',
    method: 'post',
    data
  })
}
/**
 * 通过业务号查询异常名录
 * @param {string} bizSeqId 业务号
 * @returns {array} 异常名录
 * @author lroyia
 * @since 2021年2月7日 16:18:20
 */
export function listAbnormalByBizSeq(bizSeqId) {
  const form = new FormData()
  form.append('bizSeqId', bizSeqId)
  return request({
    url: '/exptList/list_by_bizseqid',
    method: 'post',
    data: form
  })
}
export function listAbnormalByBizSeqAndEntName(bizSeqId, entName) {
  const form = new FormData()
  form.append('bizSeqId', bizSeqId)
  form.append('entName', entName)
  return request({
    url: '/exptList/list_by_bizseqidAndEntName',
    method: 'post',
    data: form
  })
}
// 获取异议业务表及其文书号
export function getBizDissentAndWrirsno(bizseq) {
  const form = new FormData()
  form.append('bizseq', bizseq)
  return request({
    url: '/bizDissent/getBizDissentAndWrirsno',
    method: 'post',
    data: form
  })
}
/**
 * 通过业务号id获取文书文号信息 决定书
 * @param {string} bizseq 业务号
 * @param {String } writstype 文书类型
 * @author Lee
 */
export function getWritByBizseq(bizseq, writstype) {
  return request({
    url: '/writ/getWritByBizseq?bizseq=' + bizseq + '&writstype=' + writstype,
    method: 'get'
  })
}
/**
 * 通过业务号id获取文书号及主体信息 通知书
 * @param {string} bizseq 业务号
 * @param {String } writstype 文书类型
 * @author Lee
 */
export function getNoticePrintInfo(bizseq, writstype) {
  return request({
    url: '/writ/getNoticePrintInfo?bizseq=' + bizseq + '&writstype=' + writstype,
    method: 'get'
  })
}

/**
 * 通过业务id获取异常移出审批表信息
 * @param {string} bizseq 业务号
 * @author Lee
 */
export function getBizRemListPrintInfo(bizseq) {
  return request({
    url: '/bizRemList/getBizRemListPrintInfo?bizseq=' + bizseq,
    method: 'get'
  })
}
/**
 * 获取列入经营异常名录异议申请表信息
 * @param {string} bizseq 业务号
 * @author Lee
 */
export function getAbnDissentApplyTabInfo(bizseq, type) {
  return request({
    url: '/writ/abnormal/getAbnDissentApplyTabInfo?bizseq=' + bizseq + '&type=' + type,
    method: 'get'
  })
}

/**
 * 通过业务号id删除异常业务表主体
 * @param {string} spelistids 业务号
 * @author Lee
 */
export function removeBySpelistid(spelistids, removeReason, bizseq) {
  const form = new FormData()
  form.append('spelistids', spelistids)
  form.append('removeReason', removeReason)
  form.append('bizseq', bizseq)
  return request({
    url: '/exptList/remove_by_spelistid',
    method: 'post',
    data: form
  })
}
/**
 * 获取异常主体列表分页
 * @param {data} 分页参数
 */
export function commonPage(data) {
  return request({
    url: '/bizDissent/common_page',
    method: 'post',
    data
  })
}

/**
 * 获取移出异议主体列表分页
 * @param {data} 分页参数
 */
export function dissentList(data) {
  return request({
    url: '/bizDissent/dissentList',
    method: 'post',
    data
  })
}

/**
 * 异常名录异议 启动待办
 * @param {string} abnlistid
 * @param {string} entertype
 * @param {string} isOnlyRem
 */
export function startbizDissent(abnlistid, entertype, isOnlyRem) {
  const formData = new FormData()
  formData.append('abnlistid', abnlistid)
  formData.append('entertype', entertype)
  formData.append('isOnlyRem', isOnlyRem)
  return request({
    url: '/bizDissent/startbizDissent.do',
    method: 'post',
    data: formData
  })
}
/**
 * 异常名录移出 启动待办
 */
export function startBizRemove(tasklistid, abnlistids, entertype) {
  const form = new FormData()
  form.append('tasklistid', tasklistid)
  form.append('abnlistids', abnlistids)
  form.append('entertype', entertype)
  return request({
    url: '/bizRemList/next.do',
    method: 'post',
    data: form
  })
}
/**
 * 异常名录移出 校验
 */
export function removeCheck(abnlistid, specause) {
  const form = new FormData()
  form.append('abnlistid', abnlistid)
  form.append('specause', specause)
  return request({
    url: '/bizRemList/removeCheck',
    method: 'post',
    data: form
  })
}
/**
 * 异常名录移出审核流程 下一步
 */
export function bizRemoveNext(data) {
  const form = new FormData()
  for (const key in data) {
    form.append(key, data[key])
  }
  return request({
    url: '/bizRemList/bizRemoveNext',
    method: 'post',
    data: form
  })
}

// 查看待移出企业名单
export function getBizRemInfo(bizseq) {
  const form = new FormData()
  form.append('bizseq', bizseq)
  return request({
    url: '/bizRemList/getBizRemInfo',
    method: 'post',
    data: form
  })
}
/**
 * 通过业务号id企业id删除业务表中待移出主体
 * @param {string} spelistids 业务号
 * @author Lee
 */
export function removeBizRemListBySplistid(tasklistid, bizseq, pripids) {
  const form = new FormData()
  form.append('tasklistid', tasklistid)
  form.append('bizseq', bizseq)
  form.append('pripids', pripids)
  return request({
    url: '/bizRemList/remove_bizRemList_by_splistid',
    method: 'post',
    data: form
  })
}

/**
 * 判断是否经过异议申请审核环节
 * @param {String} bustype 异议类型才判断
 * @param {String} bizseq 业务号，查询是否生成通知书文书号
 * @returns
 */
export function isPassDissentApply(bustype, bizseq) {
  return request({
    url: '/bizDissent/isPassDissentApply?bustype=' + bustype + '&bizseq=' + bizseq,
    method: 'get'
  })
}
/**
 * 获取主体移出记录
 * @param {String} bizseq 业务号
 * @returns
 */
export function getBizRemoveRecordList(bizseq) {
  return request({
    url: '/abnList/getBizRemoveRecordList?bizseq=' + bizseq,
    method: 'get'
  })
}

/**
 *
 * @param {object} pageRequestDto
 * @returns 分页结果
 * @author lroyia
 * @since 2021年3月17日 10:22:16
 */
export function getAbnListPage(pageRequestDto) {
  return request({
    url: '/exptList/abnList/page',
    method: 'post',
    data: pageRequestDto
  })
}

/**
 * 按列入原因与主体类型分类，统计我的待办数量
 * @returns 统计结果
 * @author lroyia
 * @since 2021年4月20日 13:48:12
 */
export function statisticMyTaskGroupBySpeCause() {
  return request({
    url: '/abnList/statisticMyTaskGroupBySpeCause',
    method: 'post'
  })
}

/**
 * 按列入原因与主体类型分类，统计我的待办数量
 * @returns 统计结果
 * @author lroyia
 * @since 2021年4月20日 13:48:12
 */
export function statisticAbnormalTaskCount() {
  return request({
    url: '/abnList/statisticAbnormalTaskCount',
    method: 'post'
  })
}

/**
 * 获取异常名录待办分页
 * @returns 统计结果
 * @author lroyia
 * @since 2021年4月20日 13:48:12
 */
export function getAbnormalTaskListPage(pageRequestDto) {
  return request({
    url: '/abnList/getAbnormalTaskListPage',
    method: 'post',
    data: pageRequestDto
  })
}

/**
 * 获取异常名录待办分页
 * @returns 统计结果
 * @author lroyia
 * @since 2021年4月20日 13:48:12
 */
export function listAbnormalRecord(pripid) {
  return request({
    url: `/abnList/listAbnormalRecord?pripid=${pripid}`,
    method: 'get'
  })
}

export function getRegulatory() {
  return request({
    url: '/eBaseinfo/queryRegulatory',
    method: 'post'
    // data: pageRequestDto
  })
}

/**
 * 删除列严多余的待办
 * @param {string} bizseq
 */
export function deleTaskAndillRem(bizseq) {
  const form = new FormData()
  form.append('bizSeq', bizseq)
  return request({
    url: '/bizSerIllegalRem/deleTaskAndillRem',
    method: 'post',
    data: form
  })
}

/**
 * 删除经营异常多余的待办
 * @param {string} bizseq
 */
export function deleAbnTaskAndillRem(bizseq) {
  const form = new FormData()
  form.append('bizSeq', bizseq)
  return request({
    url: '/bizSerIllegalRem/deleAbnTaskAndillRem',
    method: 'post',
    data: form
  })
}

/**
 * 退回移动端后撤销业务---严重违法
 * @param {string} bizseq
 */
 export function illRemCancelBusiness(bizseq) {
  const form = new FormData()
  form.append('bizSeq', bizseq)
  return request({
    url: '/bizSerIllegalRem/cancelBusiness',
    method: 'post',
    data: form
  })
}
/**
 * 未开启待办，废弃线索
 */
export function removeClue(toIncludeId) {
  const form = new FormData()
  form.append('toIncludeId', toIncludeId)
  return request({
    url: '/toincludeabn/deleteClue',
    method: 'post',
    data: form
  })
}

/**
 * 异常名录异议 启动待办前校验
 */
export function validateBizDissent(abnlistid) {
  const form = new FormData()
  form.append('abnlistid', abnlistid)
  return request({
    url: '/bizDissent/validateBizDissent',
    method: 'post',
    data: form
  })
}
/**
 * 列入前监管主体信息验证
 */
export function validateBiz(params) {
  return request({
    url: '/bizSpeList/validateBiz',
    method: 'post',
    params
  })
}
/**
 * 异议核实结果告知书，内容保存
 */
export function updateResultNotice(params) {
  return request({
    url: '/bizDissent/updateResultNotice',
    method: 'post',
    params
  })
}
/**
 * 根据列异原因获取决定书模板内容
 */
export function getDecContent(params) {
  return request({
    url: '/bizSpeList/getDecContent',
    method: 'get',
    params
  })
}
/**
 * 列入前监管主体信息验证
 */
export function checkoutToincludeabn(params) {
  return request({
    url: '/bizSpeList/checkoutToincludeabn',
    method: 'get',
    params
  })
}
/**
 * Excel地址批量列入生成待办
 * @param {string} bizseq
 */
export function saveBatchAbnListAccept(enableListId, bizseq, entertype) {
  const form = new FormData()
  form.append('enableListId', enableListId)
  form.append('bizseq', bizseq)
  form.append('entertype', entertype)
  return request({
    url: '/bizSpeList/saveBatchAbnListAccept',
    method: 'post',
    data: form
  })
}
/**
 * Excel年报批量列入生成待办
 * @param {string} bizseq
 */
export function saveBatchAbnListAcceptByNB(enableListId, bizseq, entertype) {
  const form = new FormData()
  form.append('enableListId', enableListId)
  form.append('bizseq', bizseq)
  form.append('entertype', entertype)
  return request({
    url: '/bizSpeList/saveBatchAbnListAcceptByNB',
    method: 'post',
    data: form
  })
}
/**
 * 列异线索回退
 * @since 2021年12月18日 15点23分
 */
export function returnClue(data) {
  const form = new FormData()
  for (const key in data) {
    form.append(key, data[key])
  }
  return request({
    url: '/bizSpeList/returnClue',
    method: 'post',
    data: form
  })
}
/**
 * 列异线索回退
 * @since 2021年12月18日 15点23分
 */
export function deleteClue(data) {
  const form = new FormData()
  for (const key in data) {
    form.append(key, data[key])
  }
  return request({
    url: '/bizSpeList/deleteClue',
    method: 'post',
    data: form
  })
}
/**
 * 批量审核
 */
export function batchReviewAndExamine(data) {
  return request({
    url: '/bizSpeList/batchReviewAndExamine',
    method: 'post',
    data
  })
}

export function down(attachmentid) {
  return request({
    url: '/toincludeabn/downLoad?attachmentid=' + attachmentid,
    method: 'get',
    responseType: 'blob'
  })
}

export function queryOldabnInfo(bizSeqId) {
  const form = new FormData()
  form.append('SAPPROVECODE', bizSeqId)
  return request({
    url: '/bizSpeList/queryOldabnInfo',
    method: 'post',
    data: form
  })
}
export function getOldBizSpeListPage(data) {
  return request({
    url: '/bizSpeList/getOldBizSpeListPage',
    method: 'post',
    data
  })
}

export function downLoadHistoryFile(attachmentid) {
  return request({
    url: '/bizSpeList/downLoad?attachmentid=' + attachmentid,
    method: 'get',
    responseType: 'blob'
  })
}

export function exportExcelOldBizSpeList(bizseq) {
  return request({
    url: '/bizSpeList/exportExcelOldBizSpeList?SAPPROVECODE=' + bizseq,
    method: 'get',
    responseType: 'blob'
  })
}

export function selectHistorybizRemlist(bizseq) {
  const form = new FormData()
  form.append('bizseq', bizseq)
  return request({
    url: '/bizRemList/selectHistorybizRemlist',
    method: 'post',
    data: form
  })
}

/**
 * 退回移动端后撤销业务---经营异常
 * @param {string} bizseq
 */
 export function bizRemCancelBusiness(bizseq) {
  const form = new FormData()
  form.append('bizSeq', bizseq)
  return request({
    url: '/bizRemList/cancelBusiness',
    method: 'post',
    data: form
  })
}
/**
 * 检查是否批量年报列异
 */
export function checkIsBatchNB(params) {
  return request({
    url: '/bizSpeList/checkIsBatchNB',
    method: 'get',
    params
  })
}
