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

/**
 * 列表数据
 */
export const getTableListApi = (params: any) => {
  const data: any = [
    {
      financialLicense: 'C12345667',
      organName: '机构1',
      typeCode: 'R2022100101',
      systemCode: 'R2022100101',
      systemName: '一表通',
      systemVersion: 'V1.0',
      dataDate: 'YYYY-MM-DD',
      tableNum: '3',
      submitDate: 'YYYY-MM-DD HH:mm:ss',
      tableEnName: 'ABC_TABLE1',
      tableName: '业务表2',
      dataPeriods: '5',
      submitState: '未上报',
      dataItemCode: 'field1',
      dataItemName: '字段1'
    },
    {
      financialLicense: 'C12345667',
      organName: '机构名称',
      typeCode: 'R2022100101',
      systemCode: 'R2022100101',
      systemName: '一表通',
      systemVersion: 'V1.0',
      dataDate: 'YYYY-MM-DD',
      tableNum: '2',
      submitDate: 'YYYY-MM-DD HH:mm:ss',
      tableEnName: 'ABC_TABLE1',
      tableName: '业务表1',
      dataPeriods: '8',
      submitState: '未上报',
      dataItemCode: 'field1',
      dataItemName: '字段1'
    },
    {
      financialLicense: 'C12345667',
      organName: '机构名称',
      typeCode: 'R2022100101',
      systemCode: 'R2022100101',
      systemName: '一表通',
      systemVersion: 'V1.0',
      dataDate: 'YYYY-MM-DD',
      tableNum: '3',
      submitDate: 'YYYY-MM-DD HH:mm:ss',
      tableEnName: 'ABC_TABLE1',
      tableName: '业务表1',
      dataPeriods: '5',
      submitState: '未上报',
      dataItemCode: 'field1',
      dataItemName: '字段1'
    },
    {
      financialLicense: 'C123456678',
      organName: '机构名称',
      typeCode: 'R2022100101',
      systemCode: 'R2022100101',
      systemName: '一表通',
      systemVersion: 'V1.0',
      dataDate: 'YYYY-MM-DD',
      tableNum: '1',
      submitDate: 'YYYY-MM-DD HH:mm:ss',
      tableEnName: 'ABC_TABLE1',
      tableName: '业务表1',
      dataPeriods: '2',
      submitState: '未上报',
      dataItemCode: 'field1',
      dataItemName: '字段1'
    },
    {
      financialLicense: 'C123456678',
      organName: '机构名称',
      typeCode: 'R2022100101',
      systemCode: 'R2022100101',
      systemName: '一表通',
      systemVersion: 'V1.0',
      dataDate: 'YYYY-MM-DD',
      tableNum: '6',
      submitDate: 'YYYY-MM-DD HH:mm:ss',
      tableEnName: 'ABC_TABLE1',
      tableName: '业务表12',
      dataPeriods: '2',
      submitState: '已上报',
      dataItemCode: 'field1',
      dataItemName: '字段1'
    },
    {
      financialLicense: 'C123456678',
      organName: '机构名称',
      typeCode: 'R2022100101',
      systemCode: 'R2022100101',
      systemName: '一表通',
      systemVersion: 'V1.0',
      dataDate: 'YYYY-MM-DD',
      tableNum: '6',
      submitDate: 'YYYY-MM-DD HH:mm:ss',
      tableEnName: 'ABC_TABLE1',
      tableName: '业务表12',
      dataPeriods: '2',
      submitState: '已上报',
      dataItemCode: 'field1',
      dataItemName: '字段1'
    },
    {
      financialLicense: 'C123456678',
      organName: '机构名称',
      typeCode: 'R2022100101',
      systemCode: 'R2022100101',
      systemName: '一表通',
      systemVersion: 'V1.0',
      dataDate: 'YYYY-MM-DD',
      tableNum: '2',
      submitDate: 'YYYY-MM-DD HH:mm:ss',
      tableEnName: 'ABC_TABLE1',
      tableName: '业务表12',
      dataPeriods: '9',
      submitState: '已上报',
      dataItemCode: 'field1',
      dataItemName: '字段1'
    },
    {
      financialLicense: 'C123456678',
      organName: '机构名称',
      typeCode: 'R2022100101',
      systemCode: 'R2022100101',
      systemName: '一表通',
      systemVersion: 'V1.0',
      dataDate: 'YYYY-MM-DD',
      tableNum: '2',
      submitDate: 'YYYY-MM-DD HH:mm:ss',
      tableEnName: 'ABC_TABLE1',
      tableName: '业务表12',
      dataPeriods: '9',
      submitState: '已上报',
      dataItemCode: 'field1',
      dataItemName: '字段1'
    },
    {
      financialLicense: 'C123456678',
      organName: '机构名称',
      typeCode: 'R2022100101',
      systemCode: 'R2022100101',
      systemName: '一表通',
      systemVersion: 'V1.0',
      dataDate: 'YYYY-MM-DD',
      tableNum: '12',
      submitDate: 'YYYY-MM-DD HH:mm:ss',
      tableEnName: 'ABC_TABLE1',
      tableName: '业务表12',
      dataPeriods: '23',
      submitState: '已上报',
      dataItemCode: 'field1',
      dataItemName: '字段1'
    },
    {
      financialLicense: 'C123456678',
      organName: '机构名称',
      typeCode: 'R2022100101',
      systemCode: 'R2022100101',
      systemName: '一表通',
      systemVersion: 'V1.0',
      dataDate: 'YYYY-MM-DD',
      tableNum: '543',
      submitDate: 'YYYY-MM-DD HH:mm:ss',
      tableEnName: 'ABC_TABLE1',
      tableName: '业务表12',
      dataPeriods: '11',
      submitState: '已上报',
      dataItemCode: 'field1',
      dataItemName: '字段1'
    }
  ]
  return {
    data: {
      list: data,
      total: data.length
    }
  }
}

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 } })
}
