import request from '@/utils/request'
import state from '@/store'
import router from '@/router'
export function getRole() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '菜单模块系统_项目角色_查询数据'
    }
  })
}

export function getModule(role_check, role) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '菜单模块系统_项目主模块列表_查询数据',
      param: `角色编号_check=${role_check}&角色编号=${role}=int`
    }
  })
}
export function addModule(module, role) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '菜单模块系统_项目角色模块列表_增加数据',
      param: `角色编号=${role}=int&主模块编号=${module}=int`
    }
  })
}
export function deleteModule(module, role) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '菜单模块系统_项目角色模块列表_删除数据',
      param: `角色编号=${role}=int&主模块编号=${module}=int`
    }
  })
}
// 周一从这里开始改！！！
export function getModelData(role) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '菜单模块系统_项目主模块列表_查询单个模块',
      param: `主模块编号=${role}=int`
    }
  })
}

export function addModelData(component, title, icons) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '菜单模块系统_项目主模块列表_增加单个模块',
      param: `父路径=/${icons}&子名称=${icons}&子组件=${component}&标题=${title}&图标=${icons}`
    }
  })
}

export function editModelData(modelNum, component, title, icons) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '菜单模块系统_项目主模块列表_修改单个模块',
      param: `主模块编号=${modelNum}&父路径=/${icons}&子名称=${icons}&子组件=${component}&标题=${title}&图标=${icons}`
    }
  })
}
