cellsysBase/cellsysUtil.js

887 lines
33 KiB
JavaScript
Raw Normal View History

2024-12-26 11:21:07 +08:00
import * as http from './utils/axios.js';
2024-08-14 16:20:56 +08:00
const BASE_URL = location.origin;
const IMAGE_URL = '/resources/basePic/cellsysApp';
// 查询类接口
const QueryType = {
Config: '/rpc/view_default_data',
//项目部署版本
ServerVersion: '/rpc/view_service_version',
//获取边缘组织信息
EdgeOrgList: '/rpc/view_edge_org_list',
//查询成员类型列表(边缘)
EdgeMemberTypeList: '/rpc/view_edge_member_type_list',
//查询群组列表(边缘)
EdgeGroupList: '/rpc/view_edge_group_list',
// 门户列表
Org: '/rpc/view_org_basic',
// 获取行业列表
Industry: '/rpc/view_org_industry',
// 获取用户信息
User: '/rpc/cellsysUserInfoSelect',
// 查询专题列表
LayerGroup: '/rpc/view_org_layer_group',
// 专题图层列表
LayerBasic: '/rpc/view_org_layer_basic',
// 专题与图层的关联列表
Layer: '/rpc/view_org_layer_group_res',
// 获取组织成员
OrgMember: '/rpc/view_org_user',
//获取联合组织成员
UnionOrgMember: '/rpc/view_org_union_user',
// 查询申请加入组织的用户列表
OrgJoinMember: '/rpc/view_org_user_record',
//查询用户申请组织记录
UserApplyOrgRecord: '/rpc/view_org_record',
// 门户组织的群组
Group: '/rpc/view_org_group',
//查询组织联合群组
UinonGroup: '/rpc/view_org_union_group',
// 群组基本信息
GroupBasic: '/rpc/view_group_basic',
// 组织群组成员
Member: '/rpc/view_org_group_member',
//查询组织联合的群组成员列表
UnionMember: '/rpc/view_org_union_group_member',
// 组织成员类型
MemberType: '/rpc/view_org_member_type',
//查询组织联合成员类型列表
UnionMemberType: '/rpc/view_org_union_member_type',
// 组织成员类型的群组成员
MemberTypeUser: '/rpc/view_org_member_type_user',
//查询组织联合的成员身份列表
UnionMemberTypeUser: '/rpc/view_org_union_member_type_user',
// 门户中App的列表
App: '/rpc/view_org_app_basic', //查询应用基础列表2含原始应用idview_app_basic不含
2025-03-28 16:22:29 +08:00
//查询组织联合的u应用列表
UnionApp: '/rpc/view_org_union_app',
2024-08-14 16:20:56 +08:00
// 应用模板
AppModel: '/rpc/view_app_model',
AppModelType: '/rpc/view_app_model_type',
Marker: '/rpc/view_org_fence_point',
MarkerType: '/rpc/view_org_fence_point_type_basic',
Line: '/rpc/view_org_fence_line',
LineType: '/rpc/view_org_fence_line_type_basic',
Polygon: '/rpc/view_org_fence',
PolygonType: '/rpc/view_org_fence_type_basic',
Event: '/rpc/view_org_event_report',
UnionEvent: '/rpc/view_org_union_event_report', //联合后的事件列表
EventType: '/rpc/view_org_event_type',
UnionEventType: '/rpc/view_org_union_event_type', //联合后的事件类型
FenceEvent: '/rpc/view_org_fence_event',
UnionFenceEvent: '/rpc/view_org_union_fence_event',
// 查询群组用户位置
UserLocal: '/rpc/view_user_local',
// 查询联合组织群组用户位置
UnionUserLocal: '/rpc/view_org_union_user_local',
// 查询所有用户的位置
UserLocalBasic: '/rpc/view_user_local_basic',
// 设备列表
Equipment: '/rpc/view_org_equipment',
UnionEquipment: '/rpc/view_org_union_equipment',
// 绑定设备的用户列表
EquipmentUser: '/rpc/view_org_equipment_user',
UnionEquipmentUser: '/rpc/view_org_union_equipment_user',
EquipmentType: '/rpc/view_equipment_type', //系统设备类型数据字典
EquipmentTypeMonitors: '/rpc/view_equipment_type_monitors', //设备类型监控量
EquipmentMonitors: '/rpc/view_equipment_monitor', //设备监控量
OrgEquipmentType: '/rpc/view_org_equipment_type', //门户自定义设备类型
UnionOrgEquipmentType: '/rpc/view_org_union_equipment_type',
// 查询用户申请开通组织和申请加入组织的状态此逻辑已屏蔽与1.5.0版本超过1.7.0版本可以删除
//OrgApplyStatus: '/rpc/view_org_apply_info',
OrgRecord: '/rpc/view_org_record',
Notice: '/rpc/view_notice_basic',
MqWs: '/rpc/cellsysConfigMqWsSelect',
MqWss: '/rpc/cellsysConfigMqWssSelect',
// 系统MQ配置
SystemBroker: '/rpc/view_push_config_system',
EquipmentBroker: '/rpc/view_push_config_equipment',
LocationBroker: '/rpc/view_push_config_location',
ChatBroker: '/rpc/view_push_config_chat',
// 漂流球历史数据
FloatBall: 'rpc/view_float_ball_data',
// 查询最近五分钟的历史轨迹
Trajectory5Minute: '/rpc/view_user_event_5minute',
UnionTrajectory5Minute: '/rpc/view_org_union_user_event_5minute',
Trajectory15Minute: '/rpc/view_user_event_15minute',
UnionTrajectory15Minute: '/rpc/view_org_union_user_event_15minute',
Trajectory30Minute: '/rpc/view_user_event_30minute',
UnionTrajectory30Minute: '/rpc/view_org_union_user_event_30minute',
// 查询最近一小时的历史轨迹
Trajectory1Hour: '/rpc/view_user_event_1hour',
UnionTrajectory1Hour: '/rpc/view_org_union_user_event_1hour',
Trajectory2Hour: '/rpc/view_user_event_2hour',
UnionTrajectory2Hour: '/rpc/view_org_union_user_event_2hour',
Trajectory4Hour: '/rpc/view_user_event_4hour',
UnionTrajectory4Hour: '/rpc/view_org_union_user_event_4hour',
// 查询今天的历史轨迹
TrajectoryToday: '/rpc/view_user_event_today',
UnionTrajectoryToday: '/rpc/view_org_union_user_event_today',
// 查询昨天的历史轨迹
TrajectoryYesterday: '/rpc/view_user_event_yesterday',
UnionTrajectoryYesterday: '/rpc/view_org_union_user_event_yesterday',
// 查询前天的历史轨迹
TrajectoryAnteayer: '/rpc/view_user_event_anteayer',
UnionTrajectoryAnteayer: '/rpc/view_org_union_user_event_anteayer',
// 查询指定时间段的历史轨迹
TrajectoryDatePath: '/rpc/view_user_event_his',
UnionTrajectoryDatePath: '/rpc/view_org_union_user_event_his',
Task: '/rpc/view_org_task',
TaskGeom: '/rpc/view_org_task_geom',
TaskUser: '/rpc/view_org_task_user',
TaskType: '/rpc/view_org_task_type_custom',
TaskGeomRel: '/rpc/view_org_task_geom_rel',
// 离线区域
OfflinePolygon: '/rpc/view_org_offline_fence',
OfflinePolygonType: '/rpc/view_org_offline_fence_type_basic',
//统计点数量
StatsPointCount: '/rpc/view_stats_fence_point_type_count',
//统计线数量
StatsLineCount: '/rpc/view_stats_fence_line_type_count',
//统计区域数量
StatsFenceCount: '/rpc/view_stats_fence_type_count',
//统计事件数量
StatsEventCount: '/rpc/view_stats_event_type_count',
Icon: '/rpc/view_icon',
IconType: '/rpc/view_icon_type',
2025-02-20 10:46:46 +08:00
2024-08-14 16:20:56 +08:00
QRCodeList: '/rpc/view_qr_code', //查询二维码列表
BannerType: '/rpc/view_banner_type',
BannerList: '/rpc/view_banner',
//RDMessage: '/rpc/view_org_rd_message', //北斗盒子轨迹信息屏蔽于1.5.0版本,此逻辑已失效
CheckToken: '/rpc/view_org_user_token', //查询用户token授权列表
ThirdpartyList: '/rpc/view_org_thirdparty_api', //查询(数据库)第三方列表
ThirdpartyTypeRel: '/rpc/view_org_thirdparty_type_rel', //查询类型API
//查询组织联合列表
OrgUnion: '/rpc/view_org_union',
//查询联合记录列表
UnionRecord: '/rpc/view_org_union_record',
//查询联合记录详情列表
UnionRecordDetail: '/rpc/view_org_union_record_detail',
//查询组织列表
orgList: '/rpc/view_org_list',
//求救信息列表
sosLecord: '/rpc/view_sos_record',
//查询通知记录
noticeMessage: '/rpc/view_org_notice_message',
//查询协同数据审核列表
syneryData: '/rpc/view_org_synergy_data_audit',
//查询协同数据发布记录列表
synergyDataPublishRecord: '/rpc/view_org_synergy_data_publish_record',
//查询系统字典
sysDictData: '/rpc/view_sys_dict_data',
//查询系统分类字典
sysCategoryData: '/rpc/view_sys_dict_category',
//查询标签
Tag: '/rpc/view_tag',
TagModelRel: '/rpc/view_tag_model_rel',
//查询聊天记录
MessageRecord: '/rpc/view_chat_private',
//测试外部访问连通状态
testChannel: '/rpc/view_default_data',
//查询边缘服务器移动热点信息
WifiHotspot: '/cellsys/api/edgeWorkStation/getWiFiHotspotInfo',
EdgeInfo: '/rpc/view_edge_details',
};
/**
* 芒果
* @type {{Equipment_Historical: string}}
*/
const QueryMG = {
Equipment_Historical: 'cellsys/api/equipment/data/list', //设备历史数据
Equipment_Historical_Object: 'cellsys/api/equipment/data/object/list', //设备监控量历史数据(对象形式)
Union_Equipment_Historical: 'cellsys/api/equipment/orgUnion/data/list', //联合组织设备历史数据
};
// 编辑类接口
const EditType = {
OrgAppModelSelect: '/rpc/cellsysOrgAppModelSelect', //模板在创建/修改/进入前,需要调用鉴权接口
Org_Update: '/rpc/cellsysOrganizationUpdate',
Org_Options_Update: '/rpc/cellsysOrganizationOptionsUpdate',
User_Create: '',
User_Delete: '',
User_Update: '/rpc/cellsysUserInfoUpdate',
User_Pwd: '/rpc/cellsysUserPasswordUpdate', //密码修改
User_Unbind: '/rpc/cellsysUserAuthUnbind', //第三方账号解绑
Map_Create: '/rpc/cellsysOrgLayerGroupInsert',
Map_Delete: '/rpc/cellsysOrgLayerGroupDelete',
Map_Update: '/rpc/cellsysOrgLayerGroupUpdate',
LayerGroup_Create: '/rpc/cellsysOrgLayerGroupInsert',
LayerGroup_Delete: '/rpc/cellsysOrgLayerGroupDelete',
LayerGroup_Update: '/rpc/cellsysOrgLayerGroupUpdate',
Layer_Create: '/rpc/cellsysOrgLayerInsert',
Layer_BatchCreate: '/rpc/cellsysOrgLayersInsert', //批量新增图层 20200708 yw
Layer_Delete: '/rpc/cellsysOrgLayerDelete',
Layer_Update: '/rpc/cellsysOrgLayerUpdate',
LayerOrder_Update: '/rpc/cellsysOrgLayerOrderUpdate',
LayerRelation_Update: '/rpc/cellsysOrgLayerGroupRelationUpdate', //更新专题里图层信息
Group_Create: '/rpc/cellsysOrgGroupInsert',
Group_Delete: '/rpc/cellsysOrgGroupDelete',
Group_Update: '/rpc/cellsysOrgGroupUpdate',
GroupMember_Update: '/rpc/cellsysOrgGroupMembersUpdate',
Member_Create: '/rpc/cellsysOrgMemberInsert',
Member_Delete: '/rpc/cellsysOrgMemberDelete',
Member_Update: '/rpc/cellsysOrgMemberUpdate',
Member_Batch_Create: '/rpc/cellsysOrgMembersInsert',
MemberType_Create: '/rpc/cellsysOrgMemberTypeInsert',
MemberType_Delete: '/rpc/cellsysOrgMemberTypeDelete',
MemberType_Update: '/rpc/cellsysOrgMemberTypeUpdate',
MembersType_Update: '/rpc/cellsysOrgMembersTypeUpdate',
App_Create: '/rpc/cellsysOrgAppInsert',
App_Delete: '/rpc/cellsysOrgAppDelete',
App_Update: '/rpc/cellsysOrgAppUpdate',
AppModel_Create: '',
AppModel_Delete: '',
AppModel_Update: '',
Marker_Create: '/rpc/cellsysOrgFencePointInsert',
Markers_Create: '/rpc/cellsysOrgFencePointsInsert',
Marker_Delete: '/rpc/cellsysOrgFencePointDelete',
Marker_Update_Geometry: '/rpc/cellsysOrgFencePointGeomUpdate',
Marker_Update_Property: '/rpc/cellsysOrgFencePointUpdate',
MarkersType_Delete: '/rpc/cellsysOrgFencePointsTypeDelete',
MarkerType_Create: '/rpc/cellsysOrgFencePointTypeInsert',
MarkerType_Delete: '/rpc/cellsysOrgFencePointTypeDelete',
MarkerType_Update: '/rpc/cellsysOrgFencePointTypeUpdate',
Line_Create: '/rpc/cellsysOrgFenceLineInsert',
Line_Creates: '/rpc/cellsysOrgFenceLinesInsert',
Line_Delete: '/rpc/cellsysOrgFenceLineDelete',
Line_Update_Geometry: '/rpc/cellsysOrgFenceLineGeomUpdate',
Line_Update_Property: '/rpc/cellsysOrgFenceLineUpdate',
LinesType_Delete: '/rpc/cellsysOrgFenceLinesTypeDelete',
LineType_Create: '/rpc/cellsysOrgFenceLineTypeInsert',
LineType_Delete: '/rpc/cellsysOrgFenceLineTypeDelete',
LineType_Update: '/rpc/cellsysOrgFenceLineTypeUpdate',
Polygon_Create: '/rpc/cellsysOrgFenceInsert',
Polygon_Creates: '/rpc/cellsysOrgFencesInsert',
Polygon_Delete: '/rpc/cellsysOrgFenceDelete',
Polygon_Update_Geometry: '/rpc/cellsysOrgFenceGeomUpdate',
Polygon_Update_Property: '/rpc/cellsysOrgFenceUpdate',
PolygonsType_Delete: '/rpc/cellsysOrgFencesTypeDelete',
PolygonType_Create: '/rpc/cellsysOrgFenceTypeInsert',
PolygonType_Delete: '/rpc/cellsysOrgFenceTypeDelete',
PolygonType_Update: '/rpc/cellsysOrgFenceTypeUpdate',
Event_Create: '/rpc/cellsysOrgEventReportInsert',
Event_Delete: '/rpc/cellsysOrgEventReportDelete',
Event_Update: '/rpc/cellsysOrgEventReportUpdate',
EventType_Create: '/rpc/cellsysOrgEventTypeInsert',
EventType_Delete: '/rpc/cellsysOrgEventTypeDelete',
EventType_Update: '/rpc/cellsysOrgEventTypeUpdate',
OrgMember_Update: '/rpc/cellsysOrgUserRecordUpdate',
OrgMember_Remove: '/rpc/cellsysOrganizationUserRemove',
Org_Quit: '/rpc/cellsysOrganizationQuit',
Org_MarkOver: '/rpc/cellsysOrganizationTransfer',
Equipment_Create: '/rpc/cellsysOrgEquipmentInsert',
Equipment_Delete: '/rpc/cellsysOrgEquipmentDelete',
Equipment_Update: '/rpc/cellsysOrgEquipmentUpdate',
EquipmentUser_Create: '/rpc/cellsysOrgEquipmentBind',
EquipmentUser_Delete: '/rpc/cellsysOrgEquipmentUnbind',
EquipmentType_Create: '/rpc/cellsysOrgEquipmentTypeInsert',
EquipmentType_Update: '/rpc/cellsysOrgEquipmentTypeUpdate',
EquipmentType_Delete: '/rpc/cellsysOrgEquipmentTypeDelete',
AppNotice_Create: '/rpc/cellsysOrgAppNoticeInsert',
Task_Create: '/rpc/cellsysOrgTaskInsert',
Task_Update: '/rpc/cellsysOrgTaskUpdate',
Task_Delete: '/rpc/cellsysOrgTaskDelete',
TaskGeom_Create: '/rpc/cellsysOrgTaskGeomInsert',
TaskGeom_Update: '/rpc/cellsysOrgTaskGeomUpdate',
TaskGeom_Delete: '/rpc/cellsysOrgTaskGeomDelete',
TaskGeom_Import: '/rpc/cellsysOrgTaskGeomImport',
TaskType_Create: '/rpc/cellsysOrgTaskTypeInsert',
TaskType_Update: '/rpc/cellsysOrgTaskTypeUpdate',
TaskType_Delete: '/rpc/cellsysOrgTaskTypeDelete',
OfflinePolygon_Create: '/rpc/cellsysOrgOfflineFenceInsert',
OfflinePolygon_Creates: '/rpc/cellsysOrgOfflineFencesInsert',
OfflinePolygon_Delete: '/rpc/cellsysOrgOfflineFenceDelete',
OfflinePolygon_Update_Geometry: '/rpc/cellsysOrgOfflineFenceGeomUpdate',
OfflinePolygon_Update_Property: '/rpc/cellsysOrgOfflineFenceUpdate',
OfflinePolygon_Create_MapTile: '/rpc/cellsysOrgOfflineFenceTileInsert',
OfflinePolygonType_Create: '/rpc/cellsysOrgOfflineFenceTypeInsert',
OfflinePolygonType_Update: '/rpc/cellsysOrgOfflineFenceTypeUpdate',
OfflinePolygonType_Delete: '/rpc/cellsysOrgOfflineFenceTypeDelete',
OfflinePolygonsType_Delete: '/rpc/cellsysOrgOfflineFencesTypeDelete',
//二维码
QRCode_Create: '/rpc/cellsysUserInviteCodeInsert',
QRCode_Update: '/rpc/cellsysUserInviteCodeUpdate',
QRCode_BatchUpdate: '/rpc/cellsysUserInviteCodesUpdate',
QRCode_Delete: '/rpc/cellsysUserInviteCodeDelete',
TokenEidt: '/rpc/cellsysOrgUserTokenUpdate', //用户编辑token授权
TokenCreate: '/rpc/cellsysOrgUserTokenInsert', //用户创建token授权
TokenDelete: '/rpc/cellsysOrgUserTokenDelete', //用户删除token授权
TypeAddAPI: '/rpc/cellsysOrgThirdpartyTypeRelInsert', //新增类型API
TypeUpdateAPI: '/rpc/cellsysOrgThirdpartyTypeRelUpdate', //修改类型API
TypeDeleteAPI: '/rpc/cellsysOrgThirdpartyTypeRelDelete', //修改类型API
//发起组织联合的邀请
UnionInvite: '/rpc/cellsysOrgUnionRecordInsert',
//审核组织联合
UnionAudit: '/rpc/cellsysOrgUnionRecordUpdate',
//主动解除组织关联(退出)
UnionExit: '/rpc/cellsysOrgUnionExit',
//解除组织关联(移出)
UnionRemove: '/rpc/cellsysOrgUnionRemove',
//取消组织联合的申请或邀请
CloseUnionAudit: '/rpc/cellsysOrgUnionRecordDelete',
//绑定北斗卡号
EquipmentRdNumberBind: '/rpc/cellsysOrgEquipmentRdNumberBind',
//处理求救消息
sosStatusUpdate: '/rpc/cellsysOrgSosRecordStatusUpdate',
//区域发布及取消发布功能相关
PolygonPublish: '/rpc/cellsysOrgFenceTypePublish',
//标记发布及取消发布功能相关
MarkerPublish: '/rpc/cellsysOrgFencePointTypePublish',
//路线发布及取消发布功能相关
LinePublish: '/rpc/cellsysOrgFenceLineTypePublish',
//离线影像发布及取消发布功能相关
OfflinePublish: '/rpc/cellsysOrgOfflineFenceTypePublish',
//事件发布及取消发布功能相关
EventPublish: '/rpc/cellsysOrgEventTypePublish',
// APP发布及取消发布功能相关
AppPublish: '/rpc/cellsysOrgAppPublish',
// 专题发布及取消发布功能相关
LayerGroupPublish: '/rpc/cellsysOrgLayerGroupPublish',
// 设备发布及取消发布功能相关
EquipmentTypePublish: '/rpc/cellsysOrgEquipmentTypePublish',
//更新协同数据审核状态
synergyUpdata: '/rpc/cellsysOrgSynergyDataAuditUpdate',
//锁定/解锁事件类型
eventTypeLock: '/rpc/cellsysOrgEventTypeLock',
//锁定/解锁APP类型
appLock: '/rpc/cellsysOrgAppLock',
//锁定/解锁区域类型
PolygonLock: '/rpc/cellsysOrgFenceTypeLock',
//锁定/解锁标记类型
MarkerLock: '/rpc/cellsysOrgFencePointTypeLock',
//锁定/解锁路线类型
LineLock: '/rpc/cellsysOrgFenceLineTypeLock',
//锁定/解锁离线影像类型
OfflineLock: '/rpc/cellsysOrgOfflineFenceTypeLock',
//锁定/解锁专题
LayerGroupLock: '/rpc/cellsysOrgLayerGroupLock',
//批量更新发布状态
SynergyDatasPublishUpdate: '/rpc/cellsysOrgSynergyDatasPublishUpdate',
//创建标签分类
TagGroup_Insert: '/rpc/cellsysTagGroupInsert',
//创建标签
Tag_Insert: '/rpc/cellsysTagInsert',
//批量创建标签
Tags_Insert: '/rpc/cellsysTagsInsert',
//更新标签
Tag_Update: '/rpc/cellsysTagUpdate',
//删除标签
Tag_Delete: '/rpc/cellsysTagDelete',
//更新标签与数据关联
// TagModelRel_Update: '/rpc/cellsysTagModelRelUpdate',
//修改标签与模块组的关联
TagModeleGroupUpdate: '/rpc/cellsysTagModelesUpdate',
//修改标签组与模块的关联
TagsGroupModeleUpdate: '/rpc/cellsysTagsModeleUpdate',
//修改边缘工作站名字
EdgeNameUpdate: '/rpc/UpdateEdgeName',
//更改用户聊天记录已读状态
ChatPrivateRead: '/rpc/cellsysChatPrivateRead',
2025-02-20 10:46:46 +08:00
//图标
importIcons: '/rpc/cellsysIconsInsert',
saveIcon: '/rpc/cellsysIconInsert',
updateIcon: '/rpc/cellsysIconUpdate',
deleteIcon: '/rpc/cellsysIconDelete',
sortIcon: '/rpc/cellsysIconSortUpdate',
saveIconType: '/rpc/cellsysIconTypeInsert',
updateIconType: '/rpc/cellsysIconTypeUpdate',
deleteIconType: '/rpc/cellsysIconTypeDelete',
sortIconType: '/rpc/cellsysIconTypeSortUpdate',
2024-08-14 16:20:56 +08:00
};
// 提交类接口
const SubmitType = {
// 登录接口
Login: '/rpc/cellsysUserLogin',
// 创建组织申请
OrgApply: '/rpc/cellsysOrgRecordInsert',
// 申请加入组织
OrgJoin: '/rpc/cellsysOrgUserRecordInsert',
//取消申请(创建和加入)
OrgCancelApply: '/rpc/cellsysOrganizationCancel',
// 移除组织成员
OrgUserRemove: '/rpc/cellsysOrganizationUserRemove',
//注册接口
Register: '/rpc/cellsysUserRegister',
// 微信绑定
// WxBind: '/rpc/cellsysUserBindWechat',
//微信绑定用户
AuthBind: '/rpc/cellsysUserAuthBind',
ErrorAppInsert: '/rpc/cellsysLogErrorAppInsert', //上传错误信息
SendMessageBySatellite: '/cellsys/api/equipment/rd/down/chat', //通过卫星网络发送聊天消息
//发送通知
sendNoticeMessage: '/cellsys/api/noticeMessage/send',
//导出群组二维码
exportWordGroupQrCode: '/cellsys/api/file/exportWord/groupQrCode',
//开启外部访问
openChannel: '/cellsys/api/edge/openChannel',
//使用蓝牙扫码cell智能通讯盒子
scanEquipments: '/cellsys/api/edgeCommander/discover',
edgeEquipmentStatus: '/cellsys/api/edgeCommander/status',
edgeEquipmentConnect: '/cellsys/api/edgeCommander/connect',
edgeEquipmentDisconnect: '/cellsys/api/edgeCommander/disconnect',
switchHotspotStatus: '/cellsys/api/edgeWorkStation/switchHotspotStatus',
RemoveEdgeEquipment: '/rpc/RemoveEdgeEquipment', //从云端移除边缘工作站
};
//必须用到管理员token的查询接口集合
const AdminQueryType = [
'/v2' + QueryType.Group,
'/v2' + QueryType.UinonGroup,
'/v2' + QueryType.Member,
'/v2' + QueryType.UnionMember,
'/v2' + QueryType.MessageRecord,
'/v2' + EditType.Member_Batch_Create,
'/v2' + EditType.MemberType_Create,
'/v2' + EditType.MemberType_Update,
'/v2' + EditType.MemberType_Delete,
'/v2' + EditType.MembersType_Update,
'/v2' + EditType.Group_Create,
'/v2' + EditType.Group_Update,
'/v2' + EditType.Group_Delete,
'/v2' + EditType.Member_Create,
2024-12-26 11:21:07 +08:00
'/v2' + EditType.EquipmentUser_Create,
'/v2' + EditType.EquipmentUser_Delete,
2024-08-14 16:20:56 +08:00
SubmitType.edgeEquipmentConnect,
QueryType.WifiHotspot,
SubmitType.switchHotspotStatus,
];
// 操作符
const Operator = {
Equals: '=',
Like: 'like',
In: 'in',
NotEquals: '!=',
LessThan: '<',
LTE: '<=',
GreaterThan: '>',
GTE: '>=',
Intersects: 'ST_Intersects', //图形相关
Contains: 'ST_Contains',
JsonTextEqu: 'Json_Text_Equ',
JsonTextlike: 'Json_Text_like',
};
// cellsys对象类型
const CellsysType = {
Org: 'Org',
App: 'App',
User: 'User',
LayerGroup: 'LayerGroup',
Layer: 'Layer',
Group: 'Group',
Member: 'Member',
MemberType: 'MemberType',
AppModel: 'AppModel',
Marker: 'Marker',
MarkerType: 'MarkerType',
Line: 'Line',
LineType: 'LineType',
Polygon: 'Polygon',
PolygonType: 'PolygonType',
FenceEvent: 'FenceEvent',
Event: 'Event',
EventType: 'EventType',
Equipment: 'Equipment',
EquipmentType: 'EquipmentType',
Style: 'Style',
Task: 'Task',
TaskGeom: 'TaskGeom',
TaskType: 'TaskType',
Icon: 'Icon',
IconType: 'IconType',
OfflinePolygon: 'OfflinePolygon',
OfflinePolygonType: 'OfflinePolygonType',
Tag: 'Tag',
};
const CellsysTypeLabel = {
LayerGroup: '专题',
Layer: '图层',
Group: '群组',
Member: '成员',
MemberType: '成员类型',
Marker: '标记',
MarkerType: '标记类型',
Line: '路线',
LineType: '路线类型',
Polygon: '区域',
PolygonType: '区域类型',
Event: '事件',
EventType: '事件类型',
Equipment: '设备',
EquipmentType: '设备类型',
OfflinePolygon: '离线影像',
OfflinePolygonType: '离线影像类型',
Tag: '标签',
};
//第三方APIobject_type对应类型
const ThirdpartyObjectType = {
Event: 1,
EventType: 1,
Task: 2,
TaskType: 2,
Polygon: 3,
PolygonType: 3,
Line: 4,
LineType: 4,
Marker: 5,
MarkerType: 5,
};
class Query {
2024-12-26 11:21:07 +08:00
static bodyParams = true; //设置请求体里需不需要传body
2024-08-14 16:20:56 +08:00
constructor(params) {
if (!params) {
params = {};
}
this.filters = params.filters || [];
this.fields = params.fields || null;
this.currPage = params.currPage >= 1 ? params.currPage : 1;
this.pageSize = params.pageSize >= 0 ? params.pageSize : 0;
this.order = params.order || null;
this.httpConfig = null; //针对需要传不同请求头的情况
this._type = 'cellsys'; //默认查询结果为cellsys
}
setHttpConfig(httpConfig) {
this.httpConfig = httpConfig;
}
setType(type) {
if (type) {
this._type = type;
}
}
getType() {
return this._type;
}
addFilter(fieldName, operator, value, type) {
let fieldObj = {
field: fieldName,
operator: operator,
value: value,
type: type,
};
this.filters.push(fieldObj);
}
setFields(fields) {
//数组
this.fields = fields;
}
setCurrPage(currPage) {
this.currPage = currPage;
}
setPageSize(pageSize) {
this.pageSize = pageSize;
}
setOrder(orderObj) {
this.order = orderObj;
}
getQuery() {
let param = this._getParam();
let content = null;
2024-12-26 11:21:07 +08:00
let cellsysContent = param;
if (Query.bodyParams) {
cellsysContent = { body: param };
}
2024-08-14 16:20:56 +08:00
switch (this._type.toLocaleLowerCase()) {
default:
case 'cellsys':
2024-12-26 11:21:07 +08:00
content = cellsysContent;
2024-08-14 16:20:56 +08:00
break;
case 'mongodb':
content = param;
break;
}
return content;
}
_getParam() {
let params = {};
// let params = {'body': null}
if (this.filters.length > 0) {
params['filter'] = this.filters;
}
if (this.fields) {
params['fields'] = this.fields;
}
if (this.currPage || this.currPage === 0) {
params['currPage'] = this.currPage;
} else {
params['currPage'] = 1;
}
if (this.pageSize || this.pageSize === 0) {
params['pageSize'] = this.pageSize;
} else {
params['pageSize'] = 0;
}
if (this.order) {
params['order'] = this.order;
}
return params;
}
}
class QueryTask {
2024-12-26 11:21:07 +08:00
static hostName = '';
2024-08-14 16:20:56 +08:00
constructor(url, getPageInfo) {
//过滤java接口
if (url.indexOf('cellsys/api') !== -1) {
this.url = url;
} else if (url.indexOf('https') !== -1) {
//过滤应用模板部分调用的完整接口地址
this.url = url;
} else {
//接口版本改为V2版本
this.url = '/v2' + url;
}
2024-12-26 11:21:07 +08:00
this.url = QueryTask.hostName + this.url;
2024-08-14 16:20:56 +08:00
this.getPageInfo = getPageInfo; //是否返回分页信息
}
execute(query) {
let params = null;
if (query) {
params = query.getQuery();
} else {
query = new Query();
}
2024-12-26 11:21:07 +08:00
// this.getPageInfo = query.pageSize !== 0;
2024-08-14 16:20:56 +08:00
let type = query.getType();
let httpConfig = query.httpConfig;
switch (type.toLocaleLowerCase()) {
default:
case 'cellsys':
return this._queryByCellsys(params, httpConfig);
case 'mongodb':
return this._queryByMongoDB(params);
}
}
_queryByCellsys(param, httpConfig) {
return new Promise((resolve, reject) => {
if (param) {
http.post(this.url, param, httpConfig)
.then((res) => {
if (res) {
let result;
if (this.url.indexOf('v2/rpc') === -1) {
result = res[0];
} else {
//兼容v2版本的api返回的数据不是数组而是对象
result = res;
}
if (this.getPageInfo) {
resolve({
currPage: result.currPage,
pageSize: result.pageSize,
totalCount: result.totalCount,
totalPage: result.totalPage,
data: result.data ? result.data : [],
});
} else {
resolve(result.data ? result.data : []);
}
} else {
console.log('返回格式有误', res);
}
})
.catch((e) => {
reject(e);
});
} else {
http.post(this.url)
.then((res) => {
resolve(res || null);
})
.catch((e) => {
reject(e);
});
}
});
}
_queryByMongoDB(param) {
return new Promise((resolve, reject) => {
let baseURL = BASE_URL;
if (param) {
http.post(this.url, param, { baseURL: baseURL })
.then((res) => {
if (res) {
if (this.getPageInfo) {
resolve(res);
} else {
resolve(res.data ? res.data : []);
}
} else {
console.log('返回格式有误', res);
}
})
.catch((e) => {
reject(e);
});
} else {
http.post(this.url, null, { baseURL: baseURL })
.then((res) => {
resolve(res || null);
})
.catch((e) => {
reject(e);
});
}
});
}
}
class EditTask {
constructor(url) {
//过滤java接口
if (url.indexOf('cellsys/api') !== -1) {
this.url = url;
} else if (url.indexOf('https') !== -1) {
//过滤应用模板部分调用的完整接口地址
this.url = url;
} else {
//接口版本改为V2版本
this.url = '/v2' + url;
}
this.params = { body: {} };
this.httpConfig = null; //针对需要传不同请求头的情况
}
addParam(param_name, param_value) {
if (param_name) {
this.params['body'][param_name] = param_value;
}
}
setHttpConfig(httpConfig) {
this.httpConfig = httpConfig;
}
execute() {
return new Promise((resolve, reject) => {
let params = this.params,
body = params['body'];
if (!(Object.keys(body).length > 0)) {
body = null;
}
http.post(this.url, params, this.httpConfig)
.then((res) => {
// if (res && res.length > 0 && res[0].code === 200) {
// resolve({ data: res[0].data, message: res[0].message });
// } else {
// console.log('返回格式有误', res);
// }
if (res) {
let result;
if (this.url.indexOf('v2/rpc') === -1) {
result = res[0];
} else {
//兼容v2版本的api返回的数据不是数组而是对象
result = res;
}
if (result.code === 200) {
resolve({ data: result.data, message: result.message });
}
} else {
console.log('返回格式有误', res);
}
})
.catch((err) => {
console.log(err);
reject(err);
});
});
}
}
class SubmitTask {
constructor(url) {
//过滤java接口
if (url.indexOf('cellsys/api') !== -1) {
this.url = url;
} else if (url.indexOf('https') !== -1) {
//过滤应用模板部分调用的完整接口地址
this.url = url;
} else {
//接口版本改为V2版本
this.url = '/v2' + url;
}
this.params = { body: {} };
}
addParam(param_name, param_value) {
if (param_name) {
this.params['body'][param_name] = param_value;
}
}
execute() {
return new Promise((resolve, reject) => {
let params = this.params,
body = params['body'];
if (!(Object.keys(body).length > 0)) {
body = null;
}
http.post(this.url, params)
.then((res) => {
// if (res.length > 0 && res[0].code === 200) {
// resolve({ data: res[0].data, message: res[0].message });
// } else {
// console.log('返回格式有误', res);
// }
if (res) {
let result;
if (this.url.indexOf('v2/rpc') === -1) {
result = res[0];
} else {
//兼容v2版本的api返回的数据不是数组而是对象
result = res;
}
if (result.code === 200) {
resolve({ data: result.data, message: result.message });
}
} else {
console.log('返回格式有误', res);
}
})
.catch((err) => {
console.log(err);
reject(err);
});
});
}
}
export {
Query,
QueryTask,
EditTask,
QueryType,
AdminQueryType,
QueryMG,
EditType,
SubmitTask,
SubmitType,
Operator,
CellsysType,
CellsysTypeLabel,
ThirdpartyObjectType,
BASE_URL,
IMAGE_URL,
};