import { loginUrl, User, root, dict } from '@/api/index'
import fetch from '@/utils/require'

//单位树
export function orgainztionTree(orgCode) {
	return fetch({
		url: `${loginUrl}/org/tree?orgCode=${orgCode}`,
		method: 'post'
	})
}

//根据configCode获取参数信息
export function getParaConfigList(paraCode) {
	return fetch({
		url: `${User}/config/fingParaConfigList/${paraCode}`,
		method: 'get'
	})
}

export function areaProvince() {
	return fetch({
		url: `${User}/area/findProvince`,
		method: 'get'
	})
}

export function areaCity(code) {
	return fetch({
		url: `${User}/area/findCity?code=${code}`,
		method: 'get'
	})
}

export function areaCounty(code) {
	return fetch({
		url: `${User}/area/findCounty?code=${code}`,
		method: 'get'
	})
}

//获取组织部门信息
export function departByCode(data) {
	return fetch({
		url: `${User}/department/findByOrgCode?orgCode=${data}`,
		method: 'get'
	})
}

export function orgAndDepartTreeNew(orgCode) {
	return fetch({
		url: `${User}/org/orgAndDepartTreeNew?orgCode=${orgCode}`,
		method: 'post'
	})
}

// user

//查询所有列表
export function getUserInfo(query, condition) {
	return fetch({
		url: `${User}/user/findByPage/${query.page}/${query.size}`,
		method: 'post',
		data: condition
	})
}

//修改数据回显

export function editUserInfo(id) {
	return fetch({
		url: `${User}/user/getUserinfo/${id}`,
		method: 'get'
	})
}

//查询所有列表
export function saveUserInfoNew(type, condition) {
	return fetch({
		url: `${User}/user/saveUserinfo/${type}`,
		method: 'post',
		data: condition
	})
}

//重置密码
export function reportPassWord(userCode) {
	return fetch({
		url: `${User}/user/resetPassword/${userCode}`,
		method: 'post'
	})
}

//查询所有列表
export function getUserInfoNew(userCode) {
	return fetch({
		url: `${User}/user/findByCode`,
		method: 'post',
		data: userCode
	})
}

//查询所有列表
export function deleteUserInfoNew(data) {
	return fetch({
		url: `${User}/user/deletes`,
		method: 'delete',
		data: data
	})
}

export function getRoleList() {
	return fetch({
		url: `${User}/role/fingRoleList`,
		method: 'get'
	})
}

export function updateUserRoles(form) {
	return fetch({
		url: `${User}/user/updateUserRoles`,
		method: 'put',
		data: form
	})
}
