import request from '@/utils/request'
import { business,User } from '@/api/index'
// -----------------------信息简报--------------------
//列表
export function infoManagerList(data, page) {
    return request({
        url: `${business}msgNotice/findByPage/${page.page}/${page.size}`,
        method: 'post',
        data: data
    })
}
//状态
export function statusData(id) {
    return request({
        url: `${business}msgNotice/findByStatus`,
        method: 'get'
    })
}
//删除
export function infoDelete(data) {
    return request({
        url: `${business}msgNotice/deletes`,
        method: 'delete',
        data: data
    })
}
//采用和不采用
export function reportInfo(data) {
    return request({
        url: `${business}msgNotice/publish`,
        method: 'post',
        data: data
    })
}
//批量采用和批量不采用
export function batchIsUsing(data) {
    return request({
        url: `${business}msgNotice/publishALL`,
        method: 'post',
        data: data
    })
}
//查看
export function seeInfoDetail(id) {
    return request({
        url: `${business}msgNotice/findById/${id}`,
        method: 'get'
    })
}
//保存
export function saveInfo(data) {
    return request({
        url: `${business}msgNotice/save`,
        method: 'post',
        data: data
    })
}
//修改
export function upDateInfo(data) {
    return request({
        url: `${business}msgNotice/update`,
        method: 'post',
        data: data
    })
}
//获取报送单位(粮食安全省长责任制--获取省市所有部门信息--树)
export function departmentInfo() {
    return request({
        url: `${business}respUser/findByDeptTree`,
        method: 'get'
    })
}
//获取机构
export function getOrg(orgId){
    return request({
        url: `${business}respUser/getAllOrgDescendantsTree?orgCode=${orgId}`,
        method: 'get'
    })
}
// -----------------------外部单位用户管理--------------------
//查询所有用户
export function userManagerList(data, page) {
    return request({
        url: `${User}/user/findByPage/${page.page}/${page.size}`,
        method: 'post',
        data: data
    })
}
// 新增时：根据登录帐号获取用户信息(判断输入帐号是否重复用)
export function getUserInfo(userLoginName){
    return request({
        url: `${User}/user/findByUserloginname/${userLoginName}`,
        method: 'get'
    })
}
//修改时：根据userCode查询输入帐号是否重复
export function editGetUserInfo(data){
    return request({
        url: `${business}respUser/findByUserCode`,
        method: 'post',
        data: data
    })
}
//获取省市
export function getAllArea(){
    return request({
        url: `${business}respUser/findDataShiTree`,
        method: 'get'
    })
}
// 根据组织名称查询组织信息(判断输入单位名称是否重复用)
export function getOrgInfo(orgName){
    return request({
        url: `${User}/org/findByOrgName/${orgName}`,
        method: 'post'
    })
}
//根据orgCode查询orgName(判断输入单位名称是否重复用)
export function editGetOrg(data){
    return request({
        url: `${business}respUser/orgNameByCode`,
        method: 'post',
        data: data
    })
}
//用户管理:市区保存
export function saveCity(data){
    return request({
        url: `${business}respUser/saveOrg`,
        method: 'post',
        data: data
    })
}
//根据code查询用户
export function getDetailInfo(data){
    return request({
        url: `${User}/user/findByCode`,
        method: 'post',
        data: data
    })
}
// 冻结用户
export function freezeSelUser(userCode){
    return request({
        url: `${User}/user/freezeUser?userCode=${userCode}`,
        method: 'post'
    })
}
// 密码重置
export function resetPwd(userCode){
    return request({
        url: `${User}/user/resetPassword/${userCode}`,
        method: 'post'
    })
}
// 所有机构树
export function allOrg(){
    return request({
        url: `${business}respUser/findByOrgTree`,
        method: 'post'
    })
}