/*
 * @Author: 半生瓜 1515706227@qq.com
 * @Date: 2024-05-07 10:39:27
 * @LastEditors: 半生瓜 1515706227@qq.com
 * @LastEditTime: 2024-05-11 20:56:53
 * @FilePath: \vue-element-plus-admin-mini\src\api\table\index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import request from '@/axios'
import type { TableData } from './types'

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

export const getCardTableListApi = (params: any) => {
  return request.get({ url: '/mock/card/list', params })
}

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

//模板管理分页接口
export const getTemplate = (params: any) => {
  params.page = params.page - 1
  return request.post({ url: '/zone/template/pageQuery', params })
}

//模板上传接口
export const upTemplate = (params: any) => {
  return request.post({ url: '/zone/template/uploadTemplateZip', params })
}

//保存模板接口
export const saveTemplate = (params: any) => {
  return request.post({ url: '/zone/template/save', data: params })
}
//删除模板接口
export const deleteTemplate = (params: any) => {
  return request.post({ url: '/zone/template/delete', params })
}

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

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

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