Prechádzať zdrojové kódy

chore(api): 添加组织相关接口

wangshun 3 týždňov pred
rodič
commit
652a8c4484
3 zmenil súbory, kde vykonal 90 pridanie a 6 odobranie
  1. 26 4
      src/api/index.ts
  2. 1 0
      src/constants/index.ts
  3. 63 2
      src/types/index.ts

+ 26 - 4
src/api/index.ts

@@ -58,6 +58,7 @@ import type {
   GroupModuleInfo,
   GroupModuleQuery,
   GroupRegions,
+  InfoListByOrg,
   InterfaceData,
   InterfaceLsit,
   LimitForm,
@@ -97,6 +98,8 @@ import type {
   SubmitDeviceGroup,
   SubmitSorting,
   TempHumidityControlSettings,
+  TreeStructure,
+  UploadLogo,
   VerificationAgreement,
   VerificationEquipment,
   WarningItem,
@@ -161,9 +164,23 @@ export const getDictTypeData = async (params: DictTypeDataParams) => {
   return data;
 };
 
+// 菜单权限表
+export const getSubPermList = async (id: number) => {
+  const data = await request<TreeStructure[]>(apiSys(`/sysPermission/subPermList/${id}`));
+  return data;
+};
+
 // 组织表
 export const addOrganization = async (params: OrganizationItem) => {
-  await request(apiSys('/sysOrg/add'), {
+  const data = await request<number>(apiSys('/sysOrg/add'), {
+    method: 'POST',
+    body: JSON.stringify(params),
+  });
+  return data;
+};
+
+export const updateOrganization = async (params: OrganizationItem) => {
+  request<number>(apiSys('/sysOrg/update'), {
     method: 'POST',
     body: JSON.stringify(params),
   });
@@ -172,10 +189,11 @@ export const addOrganization = async (params: OrganizationItem) => {
 export const addUploadLogo = async (file: Blob) => {
   const formData = new FormData();
   formData.append('file', file);
-  await request(apiSys('/sysOrg/uploadLogo'), {
+  const data = await request<UploadLogo>(apiSys('/sysOrg/uploadLogo'), {
     method: 'POST',
     body: formData,
   });
+  return data;
 };
 
 // ----- 业务服务 -----
@@ -453,12 +471,11 @@ export const getDeviceListSimple = async (deviceId: number) => {
   return data;
 };
 
-export const getDeviceParams = async (deviceId: number, isProcessData: boolean) => {
+export const getDeviceParams = async (deviceId: number) => {
   const data = await request<DeviceParamGroup[]>(apiBiz('/device/protocolParamVerify'), {
     method: 'POST',
     body: JSON.stringify({
       deviceId,
-      isProcessData,
     }),
   });
 
@@ -989,6 +1006,11 @@ export const getGroupModuleInfo = async (params: GroupModuleQuery) => {
     method: 'POST',
     body: JSON.stringify(params),
   });
+  return data;
+};
 
+// 组织与设备限制
+export const getInfoListByOrgId = async (orgId: number) => {
+  const data = await request<InfoListByOrg[]>(apiBiz(`/orgDeviceLimit/infoListByOrgId/${orgId}`));
   return data;
 };

+ 1 - 0
src/constants/index.ts

@@ -67,6 +67,7 @@ export const enum DictCode {
   DcCsCoolingType = 'dc_cs_cooling_type',
   DcVfdType = 'dc_vfd_type',
   ParamAlgOperator = 'param_alg_operator',
+  DataValidityPeriod = 'data_validity_period',
 }
 
 /**

+ 63 - 2
src/types/index.ts

@@ -690,6 +690,19 @@ export interface ListEquipmentParametersItem {
   linkId: number;
 }
 
+export interface GatewayDataItem extends ListEquipmentParametersItem {
+  id: number;
+  platformParamCode: string;
+  platformParamName: string;
+  gatewayParamCode: string;
+  gatewayParamName: string;
+  unit: string;
+  readWriteType: string;
+  readWriteTypeCode: string;
+  parsingType?: number;
+  paramGroupName: string;
+}
+
 export interface EquipmentUpdateForm {
   deviceId: number;
   gatewayId: number;
@@ -2064,8 +2077,15 @@ export interface OrganizationItem {
   orgDeviceLimits?: OrgDeviceLimit[];
 }
 export interface CreateCustomer {
-  organizationName: string;
-  color: string;
+  orgName: string;
+  logo: string;
+  themeColor: string;
+  id?: number;
+  imageUrl: string;
+  selectedColor: string;
+  leaseTerm: [Dayjs, Dayjs];
+  stationsNumber: number;
+  dataValidityPeriod?: number;
 }
 
 export interface CharacterItem {
@@ -2104,3 +2124,44 @@ export interface GroupModuleInfo {
   orgId: number;
   deviceIds: string;
 }
+
+export interface UploadLogo {
+  etag: string;
+  versionId: string;
+  bucket: string;
+  region: string;
+  object: string;
+  headers: Record<string, string>;
+  fileName: string;
+}
+
+export interface TreeStructure {
+  id: number;
+  menuName: string;
+  parentId: number;
+  orderNum: number;
+  path: string;
+  component: string;
+  isLink: string;
+  menuType: string;
+  perms: string;
+  icon: string;
+  enabled: string;
+  subPermissions: TreeStructure[];
+}
+
+export interface EquipmentLimitationsItem {
+  deviceGlobalId?: number;
+  upperLimit: number;
+}
+
+export interface InfoListByOrg {
+  id: number;
+  createTime: string;
+  updateTime: string;
+  createUserId: number;
+  updateUserId: number;
+  orgId: number;
+  deviceGlobalId: number;
+  upperLimit: number;
+}