/**
 * 系统管理的api管理
 */
import { getAction, postAction,postFormAction } from '@/api/manage'
let prefix = 'auth/ciop'

//忘记密码
let register = (params) => postAction(prefix+"/forgerpw/changePwd", params);
let registercode = (params) => postAction(prefix+"/forgerpw/verificationCode", params);
// 用户管理
let getList = (params) => getAction(prefix+"/dept/tree", params);
let tabList = (params) => getAction(prefix+"/mgr/list", params);
let getUserInfo = (params) => getAction(prefix+"/mgr/user_info/"+params["userId"], params);
let getAddUser = (params) => postAction(prefix+"/mgr/add", params);
let getEditUser = (params) => postAction(prefix+"/mgr/edit", params);
let deleteList = (params) => postAction(prefix+"/mgr/delete", params);
let resetPass = (params) => postAction(prefix+"/mgr/reset", params);
let roleTreeList = (params) => postAction(prefix+"/role/roleTreeListByUserId", params);
let roleTreeList2 = (params) => postAction(prefix+"/role/roleTreeListByUserId/"+params["id"], {});
let userFreeze= (params) => postAction(prefix+"/mgr/freeze", params);
let userUnFreeze= (params) => postAction(prefix+"/mgr/unfreeze", params);
let changeOtherPwd= (params) => postAction(prefix+"/mgr/changeOtherPwd", params);//修改密码
//部门管理
const departmentList = (params) => getAction(prefix+"/dept/departmentList", params);
let deptAdd = (params) => postAction(prefix+"/dept/add", params);
let deptDetail = (params) => getAction(prefix+"/dept/dept_update/"+params);
let deptUpdate = (params) => postAction(prefix+"/dept/update", params);
let deptDelete= (params) => postAction(prefix+"/dept/delete", params);


// 角色管理
const userManage = (params) => getAction(prefix+"/role/list", params);
const userRoleTreeList = (params) => getAction(prefix+"/role/roleTreeList", params);
const userdetail= (params) => getAction(prefix+"/role/role_info/"+params['roleId'], {});
const userAdd = (params) => postAction(prefix+"/role/add", params);
const userUpdate = (params) => postAction(prefix+"/role/edit", params);
const userDelete = (params) => postAction(prefix+"/role/remove", params);
const userMenuTreeList= (params) => getActimenuManageon(prefix+"/menu/menuTreeListByRoleId/"+params['roleId'], {});
const findSyhList = () => postAction("jyyy/ciop/manager/didParameter/findSyhList");

// 菜单管理
const menuManage = (params) => getAction(prefix+"/menu/list", params);
const menuEdit2 = (params) => getAction(prefix+"/menu/menu_info/"+params['menuId'], params);
const menuEdit = (params) => postAction(prefix+"/menu/edit", params);
const menuAdd = (params) => postAction(prefix+"/menu/add", params);
const selectMenuTreeList = (params) => getAction(prefix+"/menu/selectMenuTreeList", params);
const menuRemove = (params) => postAction(prefix+"/menu/remove", params);
const getMenus = (params) => getAction(prefix+"/menu/getMenus", params);//获取菜单
const freeze = (params) => postAction(prefix+"/menu/freeze", params); //冻结菜单
const unfreeze = (params) => postAction(prefix+"/menu/unfreeze", params); //解冻菜单

//报表配置
const reportGetTable = () => getAction(prefix+"/report/getTable?database=card"); //获取数据库下面的数据表
const reportGetColmun = (params) => getAction(`${prefix}/report/getColmun?table=${params['table']}`); //	获取数据表下的字段
const saveReportConfigure = (params) =>postFormAction(prefix+"/report/saveReportConfigure", params); //	存储报表配置
const updateReportConfigure = (params) =>postFormAction(prefix+"/report/updateReportConfigure", params); //	存储报表配置
const getReportData = (params) =>getAction(prefix+"/report/getReportData/"+params); //获取当前菜单下报表的配置信息
const excuteSql = (params) =>postFormAction(prefix+"/report/excuteSql", params); //	存储报表配置
const reportList = (params) =>getAction(prefix+"/report/list",params); //获取配置列表
const reportDelete = (params) =>getAction(prefix+"/report/deleteReportConfigure",params); //获取配置列表

export {
    //忘记密码
    register,
    registercode,
    // 用户管理
    getList,
    tabList,
    getUserInfo,
    getAddUser,
    deleteList,
    resetPass,
    roleTreeList,
    roleTreeList2,
    getEditUser,
    userFreeze,
    userUnFreeze,
    changeOtherPwd,
    // 角色管理
    userManage,
    userRoleTreeList,
    userdetail,
    userAdd,
    userUpdate,
    userDelete,
    userMenuTreeList,
    findSyhList,

    // 菜单管理
    menuManage,
    menuEdit2,
    menuEdit,
    menuAdd,
    selectMenuTreeList,
    menuRemove,
    getMenus,
    freeze,
    unfreeze,

    //报表配置
    reportGetTable,
    reportGetColmun,
    saveReportConfigure,
    getReportData,
    excuteSql,
    reportList,
  reportDelete,
    updateReportConfigure,

    //部门管理
    departmentList,
    deptAdd,
    deptDetail,
    deptUpdate,
    deptDelete

}
