import request from '@/config/axios'
import { encryptAES } from '@/components/LowDesign/src/utils/aes'

//获取多模块组合列表
export const getModuleList = (data) => {
  const url = `/lideeyunji/tab/page?pageNo=${data.pageNo}&pageSize=${data.pageSize}`
  delete data.pageNo
  delete data.pageSize
  return request.post({ url, data })
}

//新增多模块组合配置
export const saveModuleData = (data) => {
  return request.post({ url: '/lideeyunji/tab/save', data })
}

//修改多模块组合配置
export const updateModuleData = (data) => {
  return request.put({ url: '/lideeyunji/tab/update', data })
}

//删除多模块组合配置
export const deleteModuleData = (ids) => {
  return request.delete({ url: '/lideeyunji/tab/delete', data: ids })
}

/**
 * 获取多模块组合详情数据
 * @param id 
 */
export const getModuleDetail = (id) => {
  return request.post({ url: `/lideeyunji/tab/detail?id=${id}` })
}


//获取多模块组合分组数据
export const getGroupData = (params) => {
  return request.get({ url: `/lideeyunji/group/tab/list`, params })
}
//新增多模块组合分组
export const saveGroupData = (data) => {
  return request.post({ url: `/lideeyunji/group/tab/save`, data })
}
//修改多模块组合分组
export const updateGroupData = (data) => {
  return request.put({ url: `/lideeyunji/group/tab/update`, data })
}
//删除多模块组合分组
export const deleteGroupData = (ids) => {
  return request.delete({ url: '/lideeyunji/group/tab/delete', data: ids })
}

//新增Js增强
export const saveJsData = (data) => {
  data = encryptAES(JSON.stringify(data))
  return request.post({ url: '/lideeyunji/tab/js/save', data })
}

//修改Js增强
export const updateJsData = (data) => {
  data = encryptAES(JSON.stringify(data))
  return request.put({ url: '/lideeyunji/tab/js/update', data })
}

//获取Js增强详情数据
export const getJsDetail = (params) => {
  return request.get({ url: `/lideeyunji/tab/js/detail`, params })
}

//解除Js增强锁定
export const unlockJs = (moduleId, type) => {
  return request.post({ url: `/lideeyunji/tab/js/unlock/${moduleId}?type=${type}` })
}

//获取显示配置
export const getModelViewData = (moduleId) => {
  return request.get({ url: `/lideeyunji/tab/get/web-config?tabId=${moduleId}` })
}





