import request from '@/config/axios'
import type { TableData } from './types'

/** 规则配置列表 */
export const getRuleConfigList = (params: any) => {
  // return request.get({ url: '/datadetail/list', params })
  const data = [
    {
      ruleCode: 'IN_EAST_GRXDYWJJB-HKZH-7-2',
      reportCode: 'IN_JS101_JRJGFZ',
      dataSetCode: 'IN_JS101_JRJGFZ',
      indexCode: 'HKZH',
      indexName: '还款账号',
      ruleType: '0',
      ruleDesc: '【软性】50340_2_填还款的实际账户，不能填系统内的中间账户账号及过渡账户账号',
      ruleStrength: '1',
      ruleState: '1'
    },
    {
      ruleCode: 'IN_EAST_GRXDYWJJB-HKZH-7-2',
      reportCode: 'IN_JS101_JRJGFZ',
      dataSetCode: 'IN_JS101_JRJGFZ',
      indexCode: 'SFSNDK',
      indexName: '是否涉农贷款',
      ruleType: '0',
      ruleDesc: '【硬性】是否涉农贷款非空时应填是、否',
      ruleStrength: '1',
      ruleState: '1'
    },
    {
      ruleCode: 'IN_EAST_GRXDYWJJB-HKZH-7-2',
      reportCode: 'IN_JS101_JRJGFZ',
      dataSetCode: 'IN_JS101_JRJGFZ',
      indexCode: 'HKZH',
      indexName: '还款账号',
      ruleType: '7',
      ruleDesc: '【软性】50438_3_填还款的实际账户，不能填系统内的中间账户账号及过渡账户账号',
      ruleStrength: '1',
      ruleState: '1'
    },
    {
      ruleCode: 'IN_EAST_GRXDYWJJB-HKZH-7-2',
      reportCode: 'IN_JS101_JRJGFZ',
      dataSetCode: 'IN_JS101_JRJGFZ',
      indexCode: 'JXFS',
      indexName: '计息方式',
      ruleType: '7',
      ruleDesc:
        '【硬性】计息方式非空时应为按月结息，按季结息，按半年结息，按年结息，不定期结息，不记利息，利随本清，其他-XX。其中“XX”为银行自定义类型。',
      ruleStrength: '1',
      ruleState: '1'
    },
    {
      ruleCode: 'IN_EAST_GRXDYWJJB-HKZH-7-2',
      reportCode: 'IN_JS101_JRJGFZ',
      dataSetCode: 'IN_JS101_JRJGFZ',
      indexCode: 'ZJRQ',
      indexName: '终结日期',
      ruleType: '5',
      ruleDesc: '【硬性】终结日期必须满足日期格式YYYYMMDD',
      ruleStrength: '1',
      ruleState: '1'
    },
    {
      ruleCode: 'IN_EAST_GRXDYWJJB-HKZH-7-2',
      reportCode: 'IN_JS101_JRJGFZ',
      dataSetCode: 'IN_JS101_JRJGFZ',
      indexCode: 'DKWJFL',
      indexName: '贷款五级分类',
      ruleType: '5',
      ruleDesc: '【硬性】信贷业务种类不包含委托贷款时，贷款五级分类不允许为空',
      ruleStrength: '1',
      ruleState: '1'
    },
    {
      ruleCode: 'IN_EAST_GRXDYWJJB-HKZH-7-2',
      reportCode: 'IN_JS101_JRJGFZ',
      dataSetCode: 'IN_JS101_JRJGFZ',
      indexCode: 'SJLL',
      indexName: '实际利率',
      ruleType: '0',
      ruleDesc:
        '【软性】实际利率应大于等于0软性】50340_2_填还款的实际账户，不能填系统内的中间账户账号及过渡账户账',
      ruleStrength: '1',
      ruleState: '0'
    },
    {
      ruleCode: 'IN_EAST_GRXDYWJJB-HKZH-7-2',
      reportCode: 'IN_JS101_JRJGFZ',
      dataSetCode: 'IN_JS101_JRJGFZ',
      indexCode: 'DKFFRQ',
      indexName: '贷款发放日期',
      ruleType: '0',
      ruleDesc: '【软性】贷款发放日期不为空且不为99991231时，应当晚于19490101且小于等于采集日期',
      ruleStrength: '1',
      ruleState: '0'
    },
    {
      ruleCode: 'IN_EAST_GRXDYWJJB-HKZH-7-2',
      reportCode: 'IN_JS101_JRJGFZ',
      dataSetCode: 'IN_JS101_JRJGFZ',
      indexCode: 'SJLL',
      indexName: '实际利率',
      ruleType: '0',
      ruleDesc:
        '【硬性】成员客户统一编号非空时，必须在对公客户表中存在,关联数据项：对公客户.客户统一编号',
      ruleStrength: '1',
      ruleState: '1'
    }
  ]
  // list: [
  //   {
  //     modelId: 'IN_EAST_1',
  //     reportName: '表内外业务担保合同表',
  //     typeName: '表内外担类',
  //     reportType: '006',
  //     rtypesText: 'EAST补录',
  //     rtypes: '006'
  //   }
  // ],
  return {
    data: {
      list: data,
      total: data.length
    }
  }
}

export const getTreeTableListApi = (params: any) => {
  return request.get({ url: '/example/treeList', params })
}

export const saveTableApi = (data: Partial<TableData>): Promise<IResponse> => {
  return request.post({ url: '/example/save', data })
}

export const getTableDetApi = (id: string): Promise<IResponse<TableData>> => {
  return request.get({ url: '/example/detail', params: { id } })
}

export const delTableListApi = (ids: string[] | number[]): Promise<IResponse> => {
  return request.post({ url: '/example/delete', data: { ids } })
}

/** 导入 */
export const importExcelApiUrl = '/krm-job/fileup/job/RepJobImport'

/** 导出 */
export const exportExcelApi = (params: any) => {
  return request.doExport({ url: '/export/spi/krmJob/filedown/job/RepJobExport', params })
}
