import request from '@/utils/request'

//验证码
export const getCaptcha = () =>
  request({
    url: '/api/blade-auth/oauth/captcha',
    method: 'get'
  })
// 用户登录
export function login(username, password, tenantId, type, code, key) {
  return request({
    url: '/api/blade-auth/oauth/token',
    method: 'post',
    headers: {
      'Tenant-Id': tenantId,
      'Captcha-Key': key,
      'Captcha-Code': code
    },
    params: {
      tenantId,
      username,
      password,
      type,
      grant_type: 'captcha',
      scope: 'all'
    }
  })
}

// 获取当前用户信息
export const getInfo = () => {
  return request({
    url: '/visual-api/paas/permission/Users/CurrentUser',
    method: 'get',
    headers: {
      'Tenant-Id': '000000'
    }
  })
}

// 退出登录
export function logout() {
  return request({
    url: '/api/oauth/Logout',
    method: 'get'
  })
}

// 锁屏解锁登录
export function unlock(data) {
  return request({
    url: '/api/oauth/LockScreen',
    method: 'post',
    data
  })
}

export function userInfo() {
  return request.get('/api/blade-user/info')
}
;('{"formRef":"elForm","formModel":"dataForm","size":"small","labelPosition":"right","labelWidth":100,"formRules":"rules","popupType":"general","generalWidth":"60%","fullScreenWidth":"100%","gutter":15,"disabled":false,"span":24,"formBtns":false,"cancelButtonText":"取 消","confirmButtonText":"确 定","formStyle":"","idGlobal":30,"fields":[{"__config__":{"jnpfKey":"comInput","label":"表名称","showLabel":true,"tag":"el-input","tagIcon":"icon-ym icon-ym-generator-input","required":false,"layout":"colFormItem","span":24,"dragDisabled":false,"regList":[],"trigger":"blur","inputType":"","viewDataType":"STRING","formId":23,"renderKey":1714029852258,"isRequiredType":false},"defaultVarType":[],"cascaderType":"","defaultValueExp":null,"__slot__":{"prepend":"","append":""},"displayNone":false,"placeholder":"请输入","style":{"width":"100%"},"clearable":true,"prefix-icon":"","suffix-icon":"","maxlength":null,"show-word-limit":false,"show-password":false,"readonly":false,"disabled":false,"allVar":false,"relationData":{"itemRelationTable":"b7cbc7c1f0554bd8504062a0550fbc1d","RelationTableCubeId":"2599","showTitle":[{"value":2233,"label":"表名称"},{"value":2211,"label":"表性质"},{"value":2213,"label":"表状态"},{"value":2210,"label":"表编号"},{"value":2202,"label":"id"}],"isCheck":false,"itemRelationList":[{"columnId":2233,"label":"表名称","drawId":3718},{"columnId":2211,"label":"表性质","drawId":""},{"columnId":2213,"label":"表状态","drawId":""},{"columnId":2210,"label":"表编号","drawId":""},{"columnId":2202,"label":"id","drawId":""}],"PrimaryId":2202},"__vModel__":3718,"__vModelName__":"db"},{"__config__":{"jnpfKey":"comInput","label":"所属楼栋","showLabel":true,"tag":"el-input","tagIcon":"icon-ym icon-ym-generator-input","required":false,"layout":"colFormItem","span":24,"dragDisabled":false,"regList":[],"trigger":"blur","inputType":"","viewDataType":"STRING","formId":22,"renderKey":1714029852258,"isRequiredType":false},"defaultVarType":[],"cascaderType":"","defaultValueExp":null,"__slot__":{"prepend":"","append":""},"displayNone":false,"placeholder":"请输入","style":{"width":"100%"},"clearable":true,"prefix-icon":"","suffix-icon":"","maxlength":null,"show-word-limit":false,"show-password":false,"readonly":false,"disabled":false,"allVar":false,"relationData":{"itemRelationTable":"8b86019e47604c21fef0c59709743616","RelationTableCubeId":"2472","showTitle":[{"value":157,"label":"房产性质"},{"value":161,"label":"简称"},{"value":165,"label":"上一级"},{"value":156,"label":"全称"},{"value":163,"label":"启用"},{"value":150,"label":"id"}],"isCheck":false,"itemRelationList":[{"columnId":157,"label":"房产性质","drawId":""},{"columnId":161,"label":"简称","drawId":3717},{"columnId":165,"label":"上一级","drawId":""},{"columnId":156,"label":"全称","drawId":""},{"columnId":163,"label":"启用","drawId":""},{"columnId":150,"label":"id","drawId":""}],"PrimaryId":150,"associationSeparator":";"},"__vModel__":3717,"__vModelName__":"ssld"},{"__config__":{"jnpfKey":"numInput","label":"抽风分摊","showLabel":true,"tag":"el-input-number","tagIcon":"icon-ym icon-ym-generator-number","required":false,"layout":"colFormItem","span":24,"dragDisabled":false,"regList":[],"trigger":["blur","change"],"inputType":"","viewDataType":"NUMBER","formId":8,"renderKey":1714029852257,"isRequiredType":false},"defaultVarType":[],"defaultValueExp":null,"placeholder":"数字文本","step":1,"step-strictly":false,"controls-position":"right","displayNone":false,"disabled":false,"relationData":{"itemRelationTable":"","RelationTableCubeId":"","showTitle":[],"isCheck":false,"itemRelationList":[],"PrimaryId":""},"__vModel__":3703,"__vModelName__":"cfft"},{"__config__":{"jnpfKey":"numInput","label":"厂总电分摊","showLabel":true,"tag":"el-input-number","tagIcon":"icon-ym icon-ym-generator-number","required":false,"layout":"colFormItem","span":24,"dragDisabled":false,"regList":[],"trigger":["blur","change"],"inputType":"","viewDataType":"NUMBER","formId":9,"renderKey":1714029852257,"isRequiredType":false},"defaultVarType":[],"defaultValueExp":null,"placeholder":"数字文本","step":1,"step-strictly":false,"controls-position":"right","displayNone":false,"disabled":false,"relationData":{"itemRelationTable":"","RelationTableCubeId":"","showTitle":[],"isCheck":false,"itemRelationList":[],"PrimaryId":""},"__vModel__":3704,"__vModelName__":"czdft"},{"__config__":{"jnpfKey":"numInput","label":"环保分摊","showLabel":true,"tag":"el-input-number","tagIcon":"icon-ym icon-ym-generator-number","required":false,"layout":"colFormItem","span":24,"dragDisabled":false,"regList":[],"trigger":["blur","change"],"inputType":"","viewDataType":"NUMBER","formId":10,"renderKey":1714029852257,"isRequiredType":false},"defaultVarType":[],"defaultValueExp":null,"placeholder":"数字文本","step":1,"step-strictly":false,"controls-position":"right","displayNone":false,"disabled":false,"relationData":{"itemRelationTable":"","RelationTableCubeId":"","showTitle":[],"isCheck":false,"itemRelationList":[],"PrimaryId":""},"__vModel__":3705,"__vModelName__":"hbft"},{"__config__":{"jnpfKey":"numInput","label":"租户分摊","showLabel":true,"tag":"el-input-number","tagIcon":"icon-ym icon-ym-generator-number","required":false,"layout":"colFormItem","span":24,"dragDisabled":false,"regList":[],"trigger":["blur","change"],"inputType":"","viewDataType":"NUMBER","formId":11,"renderKey":1714029852257,"isRequiredType":false},"defaultVarType":[],"defaultValueExp":null,"placeholder":"数字文本","step":1,"step-strictly":false,"controls-position":"right","displayNone":false,"disabled":false,"relationData":{"itemRelationTable":"","RelationTableCubeId":"","showTitle":[],"isCheck":false,"itemRelationList":[],"PrimaryId":""},"__vModel__":3706,"__vModelName__":"zhft"},{"__config__":{"jnpfKey":"numInput","label":"租户合计","showLabel":true,"tag":"el-input-number","tagIcon":"icon-ym icon-ym-generator-number","required":false,"layout":"colFormItem","span":24,"dragDisabled":false,"regList":[],"trigger":["blur","change"],"inputType":"","viewDataType":"NUMBER","formId":12,"renderKey":1714029852257,"isRequiredType":false},"defaultVarType":[],"defaultValueExp":null,"placeholder":"数字文本","step":1,"step-strictly":false,"controls-position":"right","displayNone":false,"disabled":false,"relationData":{"itemRelationTable":"","RelationTableCubeId":"","showTitle":[],"isCheck":false,"itemRelationList":[],"PrimaryId":""},"__vModel__":3707,"__vModelName__":"zhhj"},{"__config__":{"jnpfKey":"numInput","label":"调整度数","showLabel":true,"tag":"el-input-number","tagIcon":"icon-ym icon-ym-generator-number","required":false,"layout":"colFormItem","span":24,"dragDisabled":false,"regList":[],"trigger":["blur","change"],"inputType":"","viewDataType":"NUMBER","formId":13,"renderKey":1714029852257,"isRequiredType":false},"defaultVarType":[],"defaultValueExp":null,"placeholder":"数字文本","step":1,"step-strictly":false,"controls-position":"right","displayNone":false,"disabled":false,"relationData":{"itemRelationTable":"","RelationTableCubeId":"","showTitle":[],"isCheck":false,"itemRelationList":[],"PrimaryId":""},"__vModel__":3708,"__vModelName__":"tzds"},{"__config__":{"jnpfKey":"numInput","label":"本月计度","showLabel":true,"tag":"el-input-number","tagIcon":"icon-ym icon-ym-generator-number","required":false,"layout":"colFormItem","span":24,"dragDisabled":false,"regList":[],"trigger":["blur","change"],"inputType":"","viewDataType":"NUMBER","formId":14,"renderKey":1714029852258,"isRequiredType":false},"defaultVarType":[],"defaultValueExp":null,"placeholder":"数字文本","step":1,"step-strictly":false,"controls-position":"right","displayNone":false,"disabled":false,"relationData":{"itemRelationTable":"","RelationTableCubeId":"","showTitle":[],"isCheck":false,"itemRelationList":[],"PrimaryId":""},"__vModel__":3709,"__vModelName__":"byjd"},{"__config__":{"jnpfKey":"numInput","label":"倍率","showLabel":true,"tag":"el-input-number","tagIcon":"icon-ym icon-ym-generator-number","required":false,"layout":"colFormItem","span":24,"dragDisabled":false,"regList":[],"trigger":["blur","change"],"inputType":"","viewDataType":"NUMBER","formId":15,"renderKey":1714029852258,"isRequiredType":false},"defaultVarType":[],"defaultValueExp":null,"placeholder":"数字文本","step":1,"step-strictly":false,"controls-position":"right","displayNone":false,"disabled":false,"relationData":{"itemRelationTable":"","RelationTableCubeId":"","showTitle":[],"isCheck":false,"itemRelationList":[],"PrimaryId":""},"__vModel__":3710,"__vModelName__":"bl"},{"__config__":{"jnpfKey":"numInput","label":"本次度数","showLabel":true,"tag":"el-input-number","tagIcon":"icon-ym icon-ym-generator-number","required":false,"layout":"colFormItem","span":24,"dragDisabled":false,"regList":[],"trigger":["blur","change"],"inputType":"","viewDataType":"NUMBER","formId":16,"renderKey":1714029852258,"isRequiredType":false},"defaultVarType":[],"defaultValueExp":null,"placeholder":"数字文本","step":1,"step-strictly":false,"controls-position":"right","displayNone":false,"disabled":false,"relationData":{"itemRelationTable":"","RelationTableCubeId":"","showTitle":[],"isCheck":false,"itemRelationList":[],"PrimaryId":""},"__vModel__":3711,"__vModelName__":"ds"},{"__config__":{"jnpfKey":"numInput","label":"差度分摊","showLabel":true,"tag":"el-input-number","tagIcon":"icon-ym icon-ym-generator-number","required":false,"layout":"colFormItem","span":24,"dragDisabled":false,"regList":[],"trigger":["blur","change"],"inputType":"","viewDataType":"NUMBER","formId":17,"renderKey":1714029852258,"isRequiredType":false},"defaultVarType":[],"defaultValueExp":null,"placeholder":"数字文本","step":1,"step-strictly":false,"controls-position":"right","displayNone":false,"disabled":false,"relationData":{"itemRelationTable":"","RelationTableCubeId":"","showTitle":[],"isCheck":false,"itemRelationList":[],"PrimaryId":""},"__vModel__":3712,"__vModelName__":"ftds"},{"__config__":{"jnpfKey":"numInput","label":"总计度数","showLabel":true,"tag":"el-input-number","tagIcon":"icon-ym icon-ym-generator-number","required":false,"layout":"colFormItem","span":24,"dragDisabled":false,"regList":[],"trigger":["blur","change"],"inputType":"","viewDataType":"NUMBER","formId":18,"renderKey":1714029852258,"isRequiredType":false},"defaultVarType":[],"defaultValueExp":null,"placeholder":"数字文本","step":1,"step-strictly":false,"controls-position":"right","displayNone":false,"disabled":false,"relationData":{"itemRelationTable":"","RelationTableCubeId":"","showTitle":[],"isCheck":false,"itemRelationList":[],"PrimaryId":""},"__vModel__":3713,"__vModelName__":"zjds"},{"__config__":{"jnpfKey":"numInput","label":"空调分摊","showLabel":true,"tag":"el-input-number","tagIcon":"icon-ym icon-ym-generator-number","required":false,"layout":"colFormItem","span":24,"dragDisabled":false,"regList":[],"trigger":["blur","change"],"inputType":"","viewDataType":"NUMBER","formId":19,"renderKey":1714029852258,"isRequiredType":false},"defaultVarType":[],"defaultValueExp":null,"placeholder":"数字文本","step":1,"step-strictly":false,"controls-position":"right","displayNone":false,"disabled":false,"relationData":{"itemRelationTable":"","RelationTableCubeId":"","showTitle":[],"isCheck":false,"itemRelationList":[],"PrimaryId":""},"__vModel__":3714,"__vModelName__":"ktft"},{"__config__":{"jnpfKey":"comInput","label":"关联能耗分析","showLabel":true,"tag":"el-input","tagIcon":"icon-ym icon-ym-generator-input","required":false,"layout":"colFormItem","span":24,"dragDisabled":false,"regList":[],"trigger":"blur","inputType":"","viewDataType":"STRING","formId":21,"renderKey":1714029852258,"isRequiredType":false},"defaultVarType":[],"cascaderType":"","defaultValueExp":null,"__slot__":{"prepend":"","append":""},"displayNone":false,"placeholder":"请输入","style":{"width":"100%"},"clearable":true,"prefix-icon":"","suffix-icon":"","maxlength":null,"show-word-limit":false,"show-password":false,"readonly":false,"disabled":false,"allVar":false,"relationData":{"itemRelationTable":"781be433681e4285fd95a2dbd8469e1d","RelationTableCubeId":"2634","showTitle":[{"value":2857,"label":"标题"},{"value":2860,"label":"记录编码"},{"value":2861,"label":"能耗类型"},{"value":2849,"label":"id"}],"isCheck":false,"itemRelationList":[{"columnId":2857,"label":"标题","drawId":3716},{"columnId":2860,"label":"记录编码","drawId":""},{"columnId":2861,"label":"能耗类型","drawId":""},{"columnId":2849,"label":"id","drawId":""}],"PrimaryId":2849,"associationSeparator":";"},"__vModel__":3716,"__vModelName__":"dfd"},{"__config__":{"jnpfKey":"numInput","label":"上月抄表数","showLabel":true,"tag":"el-input-number","tagIcon":"icon-ym icon-ym-generator-number","required":false,"layout":"colFormItem","span":24,"dragDisabled":false,"regList":[],"trigger":["blur","change"],"inputType":"","viewDataType":"NUMBER","formId":24,"renderKey":1714029852258,"isRequiredType":false},"defaultVarType":[],"defaultValueExp":null,"placeholder":"数字文本","step":1,"step-strictly":false,"controls-position":"right","displayNone":false,"disabled":false,"relationData":{"itemRelationTable":"","RelationTableCubeId":"","showTitle":[],"isCheck":false,"itemRelationList":[],"PrimaryId":""},"__vModel__":3719,"__vModelName__":"sycbs"},{"__config__":{"jnpfKey":"numInput","label":"本月抄表数","showLabel":true,"tag":"el-input-number","tagIcon":"icon-ym icon-ym-generator-number","required":false,"layout":"colFormItem","span":24,"dragDisabled":false,"regList":[],"trigger":["blur","change"],"inputType":"","viewDataType":"NUMBER","formId":25,"renderKey":1714029852258,"isRequiredType":false},"defaultVarType":[],"defaultValueExp":null,"placeholder":"数字文本","step":1,"step-strictly":false,"controls-position":"right","displayNone":false,"disabled":false,"relationData":{"itemRelationTable":"","RelationTableCubeId":"","showTitle":[],"isCheck":false,"itemRelationList":[],"PrimaryId":""},"__vModel__":3720,"__vModelName__":"bycbs"},{"__config__":{"jnpfKey":"divider","label":"分割线","showLabel":false,"tag":"el-divider","tagIcon":"icon-ym icon-ym-generator-divider","defaultValue":null,"required":false,"layout":"colFormItem","span":24,"dragDisabled":false,"formId":26,"renderKey":1714029956680},"__slot__":{"default":"系统组件"},"content-position":"left"},{"__config__":{"jnpfKey":"comInput","label":"部门","showLabel":true,"tag":"el-input","tagIcon":"icon-ym icon-ym-generator-input","required":false,"layout":"colFormItem","span":24,"dragDisabled":false,"regList":[],"trigger":"blur","inputType":"","viewDataType":"STRING","formId":7,"renderKey":1714029852257,"isRequiredType":false},"defaultVarType":[],"cascaderType":"","defaultValueExp":null,"__slot__":{"prepend":"","append":""},"displayNone":false,"placeholder":"请输入","style":{"width":"100%"},"clearable":true,"prefix-icon":"","suffix-icon":"","maxlength":null,"show-word-limit":false,"show-password":false,"readonly":false,"disabled":false,"allVar":false,"relationData":{"itemRelationTable":"0cfca8615c02456bff5c235d40029b9e","RelationTableCubeId":"2577","showTitle":[{"value":1856,"label":"部门id"},{"value":1876,"label":"简称"},{"value":1872,"label":"上一级"},{"value":1861,"label":"全称"},{"value":1867,"label":"别名"}],"isCheck":false,"itemRelationList":[{"columnId":1856,"label":"部门id","drawId":""},{"columnId":1876,"label":"简称","drawId":3702},{"columnId":1872,"label":"上一级","drawId":""},{"columnId":1861,"label":"全称","drawId":""},{"columnId":1867,"label":"别名","drawId":""}],"PrimaryId":1856},"__vModel__":3702,"__vModelName__":"iddep"},{"__config__":{"jnpfKey":"comInput","label":"负责人","showLabel":true,"tag":"el-input","tagIcon":"icon-ym icon-ym-generator-input","required":false,"layout":"colFormItem","span":24,"dragDisabled":false,"regList":[],"trigger":"blur","inputType":"","viewDataType":"STRING","formId":20,"renderKey":1714029852258,"isRequiredType":false},"defaultVarType":[],"cascaderType":"","defaultValueExp":null,"__slot__":{"prepend":"","append":""},"displayNone":false,"placeholder":"请输入","style":{"width":"100%"},"clearable":true,"prefix-icon":"","suffix-icon":"","maxlength":null,"show-word-limit":false,"show-password":false,"readonly":false,"disabled":false,"allVar":false,"relationData":{"itemRelationTable":"04fddfeb8848496d22173403821ac45f","RelationTableCubeId":"2576","showTitle":[{"value":1799,"label":"用户ID"},{"value":1845,"label":"用户简称"},{"value":1839,"label":"用户名"},{"value":1831,"label":"工号"}],"isCheck":false,"itemRelationList":[{"columnId":1799,"label":"用户ID","drawId":""},{"columnId":1845,"label":"用户简称","drawId":3715},{"columnId":1839,"label":"用户名","drawId":""},{"columnId":1831,"label":"工号","drawId":""}],"PrimaryId":1799},"__vModel__":3715,"__vModelName__":"idowner"},{"__config__":{"jnpfKey":"createUserId","label":"新建人","showLabel":true,"tag":"el-input","tagIcon":"icon-ym icon-ym-generator-founder","defaultValue":"","required":false,"layout":"colFormItem","span":24,"dragDisabled":false,"noShow":false,"formId":27,"renderKey":1714030118482,"viewDataType":"STRING","isRequiredType":false},"displayNone":false,"readonly":true,"placeholder":"系统自动生成","__vModel__":3700,"__vModelName__":"createdby"},{"__config__":{"jnpfKey":"createTime","label":"新建时间","showLabel":true,"tag":"el-date-picker","tagIcon":"icon-ym icon-ym-generator-createtime","defaultValue":"","layout":"colFormItem","required":false,"span":24,"dragDisabled":false,"noShow":false,"formId":28,"renderKey":1714030121249,"viewDataType":"DATETIME","isRequiredType":false},"style":{"width":"100%"},"displayNone":false,"format":"yyyy-MM-dd","readonly":true,"placeholder":"系统自动生成","__vModel__":3698,"__vModelName__":"created"},{"__config__":{"jnpfKey":"modifyUserId","label":"更新人","showLabel":true,"tag":"el-input","tagIcon":"icon-ym icon-ym-generator-founder","defaultValue":"","required":false,"layout":"colFormItem","span":24,"dragDisabled":false,"noShow":false,"formId":29,"renderKey":1714030122799,"viewDataType":"STRING","isRequiredType":false},"displayNone":false,"readonly":true,"placeholder":"系统自动生成","__vModel__":3701,"__vModelName__":"updatedby"},{"__config__":{"jnpfKey":"modifyTime","label":"更新时间","showLabel":true,"tag":"el-date-picker","tagIcon":"icon-ym icon-ym-generator-modifytime","defaultValue":"","required":false,"layout":"colFormItem","span":24,"dragDisabled":false,"noShow":false,"formId":30,"renderKey":1714030124250,"viewDataType":"DATETIME","isRequiredType":false},"style":{"width":"100%"},"displayNone":false,"format":"yyyy-MM-dd","readonly":true,"placeholder":"系统自动生成","__vModel__":3699,"__vModelName__":"updated"},{"__config__":{"jnpfKey":"comInput","label":"id","showLabel":true,"tag":"el-input","tagIcon":"icon-ym icon-ym-generator-input","required":false,"layout":"colFormItem","span":24,"dragDisabled":false,"regList":[],"trigger":"blur","inputType":"","viewDataType":"STRING","formId":2,"renderKey":1714029852256,"isRequiredType":true},"defaultVarType":[],"cascaderType":"","defaultValueExp":null,"__slot__":{"prepend":"","append":""},"displayNone":false,"placeholder":"请输入","style":{"width":"100%"},"clearable":true,"prefix-icon":"","suffix-icon":"","maxlength":null,"show-word-limit":false,"show-password":false,"readonly":true,"disabled":true,"allVar":false,"relationData":{"itemRelationTable":"","RelationTableCubeId":"","showTitle":[],"isCheck":false,"itemRelationList":[],"PrimaryId":""},"__vModel__":3697,"__vModelName__":"id"}]}')
