Pārlūkot izejas kodu

chore(api): 添加用户管理模块相关接口

wangshun 2 nedēļas atpakaļ
vecāks
revīzija
fa98ed9d98
2 mainītis faili ar 61 papildinājumiem un 0 dzēšanām
  1. 28 0
      src/api/index.ts
  2. 33 0
      src/types/index.ts

+ 28 - 0
src/api/index.ts

@@ -3,6 +3,7 @@ import qs from 'qs';
 import { request } from '@/utils';
 
 import type {
+  AccountParams,
   AddInterface,
   AgreementUpdate,
   AIAdvancedParamItem,
@@ -20,6 +21,7 @@ import type {
   AutomaticMatching,
   BatchUpdate,
   ChangeState,
+  CharacterPageItem,
   CharacterPageItemData,
   CoolingHistoryDataQuery,
   CoolingHistoryDataResult,
@@ -111,6 +113,7 @@ import type {
   TempHumidityControlSettings,
   TreeStructure,
   UploadLogo,
+  UserPageParams,
   VerificationAgreement,
   VerificationEquipment,
   WarningItem,
@@ -181,6 +184,15 @@ export const getSubPermList = async (id: number) => {
   return data;
 };
 
+// 角色和组织关联表
+export const getFindRolesByOrgIds = async (params: number[]) => {
+  const data = await request<CharacterPageItem[]>(apiSys('/sysRoleOrg/findRolesByOrgIds'), {
+    method: 'POST',
+    body: JSON.stringify(params),
+  });
+  return data;
+};
+
 // 角色信息表
 export const getCharacterPageList = async (params: PageParams) => {
   const data = await request<CharacterPageItemData>(apiSys('/sysRole/getPageList'), {
@@ -221,6 +233,22 @@ export const getSubOrgsByToken = async () => {
   return data;
 };
 
+// 用户信息表
+export const addAccount = async (params: AccountParams) => {
+  request(apiSys('/sysUser/add'), {
+    method: 'POST',
+    body: JSON.stringify(params),
+  });
+};
+
+export const getUserPageList = async (params: UserPageParams) => {
+  const data = await request<number>(apiSys('/sysUser/getPageList'), {
+    method: 'POST',
+    body: JSON.stringify(params),
+  });
+  return data;
+};
+
 // ----- 业务服务 -----
 
 // 报警事件

+ 33 - 0
src/types/index.ts

@@ -2358,3 +2358,36 @@ export interface NoticePageItem {
   deviceName: string;
   parentDevGroupId: number;
 }
+
+export interface UserPageParams {
+  pageIndex: number;
+  pageSize: number;
+  userName: string;
+  mobile: string;
+  startTenancy: string;
+  endTenancy: string;
+  enabled?: string;
+  orgId: number;
+  roleId?: number;
+}
+
+export interface AccountParams {
+  id?: number;
+  userName: string;
+  mobile: string;
+  password: string;
+  startTenancy: string;
+  endTenancy: string;
+  enabled: string;
+  orgId: number;
+  roleId: number;
+}
+
+export interface AccountForm {
+  userName: string;
+  mobile: string;
+  password: string;
+  enabled: boolean;
+  roleId?: number;
+  accountTerm: [Dayjs, Dayjs];
+}