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

/**
 * 列表数据
 */
export const getTableListApi = (params: any) => {
  const data: any = [
    {
      organCode: 'C12345667',
      organName: '机构1',
      typeCode: 'R2022100101',
      systemCode: 'R2022100101',
      systemName: '一表通',
      actionAccount: 'V1.0',
      actionDate: 'YYYY-MM-DD',
      actionTime: 'HH:mm:ss',
      tableNum: '3',
      loggingTime: 'YYYY-MM-DD HH:mm:ss',
      tableEnName: 'ABC_TABLE1',
      tableName: '业务表2',
      dataPeriods: '5',
      actionType: '修改',
      actionIp: '192.168.1.1'
    },
    {
      organCode: 'C12345667',
      organName: '机构名称',
      typeCode: 'R2022100101',
      systemCode: 'R2022100101',
      systemName: '一表通',
      actionAccount: 'V1.0',
      actionDate: 'YYYY-MM-DD',
      actionTime: 'HH:mm:ss',
      tableNum: '2',
      loggingTime: 'YYYY-MM-DD HH:mm:ss',
      tableEnName: 'ABC_TABLE1',
      tableName: '业务表1',
      dataPeriods: '8',
      actionType: '修改',
      actionIp: '192.168.1.1'
    },
    {
      organCode: 'C12345667',
      organName: '机构名称',
      typeCode: 'R2022100101',
      systemCode: 'R2022100101',
      systemName: '一表通',
      actionAccount: 'V1.0',
      actionDate: 'YYYY-MM-DD',
      actionTime: 'HH:mm:ss',
      tableNum: '3',
      loggingTime: 'YYYY-MM-DD HH:mm:ss',
      tableEnName: 'ABC_TABLE1',
      tableName: '业务表1',
      dataPeriods: '5',
      actionType: '修改',
      actionIp: '192.168.1.1'
    },
    {
      organCode: 'C123456678',
      organName: '机构名称',
      typeCode: 'R2022100101',
      systemCode: 'R2022100101',
      systemName: '一表通',
      actionAccount: 'V1.0',
      actionDate: 'YYYY-MM-DD',
      actionTime: 'HH:mm:ss',
      tableNum: '1',
      loggingTime: 'YYYY-MM-DD HH:mm:ss',
      tableEnName: 'ABC_TABLE1',
      tableName: '业务表1',
      dataPeriods: '2',
      actionType: '修改',
      actionIp: '192.168.1.1'
    },
    {
      organCode: 'C123456678',
      organName: '机构名称',
      typeCode: 'R2022100101',
      systemCode: 'R2022100101',
      systemName: '一表通',
      actionAccount: 'V1.0',
      actionDate: 'YYYY-MM-DD',
      actionTime: 'HH:mm:ss',
      tableNum: '6',
      loggingTime: 'YYYY-MM-DD HH:mm:ss',
      tableEnName: 'ABC_TABLE1',
      tableName: '业务表12',
      dataPeriods: '2',
      actionType: '执行',
      actionIp: '192.168.1.1'
    },
    {
      organCode: 'C123456678',
      organName: '名称3',
      typeCode: 'R2022100101',
      systemCode: 'R2022100101',
      systemName: '一表通',
      actionAccount: 'V1.0',
      actionDate: 'YYYY-MM-DD',
      actionTime: 'HH:mm:ss',
      tableNum: '6',
      loggingTime: 'YYYY-MM-DD HH:mm:ss',
      tableEnName: 'ABC_TABLE1',
      tableName: '业务表12',
      dataPeriods: '2',
      actionType: '执行',
      actionIp: '192.168.1.1'
    },
    {
      organCode: 'C123456678',
      organName: '名称4',
      typeCode: 'R2022100101',
      systemCode: 'R2022100101',
      systemName: '一表通',
      actionAccount: 'V1.0',
      actionDate: 'YYYY-MM-DD',
      actionTime: 'HH:mm:ss',
      tableNum: '2',
      loggingTime: 'YYYY-MM-DD HH:mm:ss',
      tableEnName: 'ABC_TABLE1',
      tableName: '业务表12',
      dataPeriods: '9',
      actionType: '执行',
      actionIp: '192.168.1.1'
    },
    {
      organCode: 'C123456678',
      organName: '名称6',
      typeCode: 'R2022100101',
      systemCode: 'R2022100101',
      systemName: '一表通',
      actionAccount: 'V1.0',
      actionDate: 'YYYY-MM-DD',
      actionTime: 'HH:mm:ss',
      tableNum: '2',
      loggingTime: 'YYYY-MM-DD HH:mm:ss',
      tableEnName: 'ABC_TABLE1',
      tableName: '业务表12',
      dataPeriods: '9',
      actionType: '执行',
      actionIp: '192.168.1.1'
    },
    {
      organCode: 'C123456678',
      organName: '名称8',
      typeCode: 'R2022100101',
      systemCode: 'R2022100101',
      systemName: '一表通',
      actionAccount: 'V1.0',
      actionDate: 'YYYY-MM-DD',
      actionTime: 'HH:mm:ss',
      tableNum: '12',
      loggingTime: 'YYYY-MM-DD HH:mm:ss',
      tableEnName: 'ABC_TABLE1',
      tableName: '业务表12',
      dataPeriods: '23',
      actionType: '执行',
      actionIp: '192.168.1.1'
    },
    {
      organCode: 'C123456678',
      organName: '名称9',
      typeCode: 'R2022100101',
      systemCode: 'R2022100101',
      systemName: '一表通',
      actionAccount: 'V1.0',
      actionDate: 'YYYY-MM-DD',
      actionTime: 'HH:mm:ss',
      tableNum: '543',
      loggingTime: 'YYYY-MM-DD HH:mm:ss',
      tableEnName: 'ABC_TABLE1',
      tableName: '业务表12',
      dataPeriods: '11',
      actionType: '执行',
      actionIp: '192.168.1.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 } })
}
