import request from "@/utils/request";
import {parseStrEmpty} from "@/utils/yanfan";

// 查询用户列表
export function listUser(query) {
    return request({
        url: "energyBuild/findBindDeviceEnergy",
        method: "get",
        params: query,
    });
}

// 查询用户详细
export function getUser(userId) {
    return request({
        url: "/system/user/" + parseStrEmpty(userId),
        method: "get",
    });
}

// 新增用户
export function addData(data) {
    return request({
        url: "/energyBuild/addBindDeviceEnergy",
        method: "post",
        data: data,
    });
}

// 修改用户
export function updateUser(data) {
    return request({
        url: "/energyBuild/updateBindDeviceEnergy",
        method: "post",
        data: data,
    });
}

// 删除用户
export function delUser(query) {
    return request({
        url: "/energyBuild/deleteBindDeviceEnergy",
        method: "delete",
        params: query,
    });
}

// 查询部门下拉树结构
export function deptTreeSelect() {
    return request({
        url: "/energyBuild/deviceLocationDeptTree",
        // url: "/system/user/deptTree",
        method: "get",
    });
}

// 设备下拉框
export function listsByDeviceComboBox() {
    return request({
        url: "/energy/listsByDeviceComboBox",
        method: "get",
    });
}

// 能源下拉框
export function findPurchasing() {
    return request({
        url: "/energy/findPurchasing",
        method: "get",
    });
}

// 模型下拉框
export function findIotThingsByDeviceId(query) {
    return request({
        url: "/energyBuild/findIotThingsByDeviceId",
        method: "get",
        params: query,
    });
}
