| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207 |
- import { http } from '@/utils/http/axios';
- /** 场景标签信息 */
- export type SceneLabelOrModuleItem = {
- /** 标签id */
- id: number;
- /** 标签代码 */
- code: string;
- /** 创建时间 */
- createdAt: string;
- /** 0-未删除,大于0-已删除 */
- isDeleted: number;
- /** 标签名称 */
- name: string;
- /** 说明 */
- remark: string;
- /** 状态: 0-正常,1-不正常 */
- status: number;
- /** 更新时间 */
- updatedAt: string;
- };
- /** 工位信息 */
- export type WorkSpaceInfoItem = {
- /** 工位id */
- id: number;
- /** 所属工厂id */
- workshopId: number;
- /** 工位名称 */
- name: string;
- /** 工位code */
- code: string;
- /** 工位描述 */
- remark: string;
- /** 状态: 0-启用, 1-禁用 */
- status: number;
- /** 创建时间 */
- createdAt: string;
- /** 更新时间 */
- updatedAt: string;
- /** 0-未删除,大于0-已删除 */
- isDeleted: number;
- /** 工位负责人 */
- principal: string;
- /** 排序序号 */
- serial: number;
- };
- /** 工厂信息 */
- export type WorkShopInfoItem = {
- /** 工厂id */
- id: number;
- /** 所属公司id */
- companyId: number;
- /** 1-生产安全 2-安全环保 */
- type: number;
- /** 工厂名称 */
- name: string;
- /** 工厂code */
- code: string;
- /** 工厂描述 */
- remark: string;
- /** 状态: 0-启用, 1-禁用 */
- status: number;
- /** 创建时间 */
- createdAt: string;
- /** 更新时间 */
- updatedAt: string;
- /** 0-未删除,大于0-已删除 */
- isDeleted: number;
- /** 下属工位列表 */
- children: WorkSpaceInfoItem[];
- /** 场景标签 */
- labelName: string;
- /** 场景标签id */
- sceneLabelId: number;
- /** 排序序号 */
- serial: number;
- /** 车间模板 */
- workshopModule: SceneLabelOrModuleItem;
- };
- /** 公司信息 */
- export type CompanyInfoItem = {
- /** 公司id */
- id: number;
- /** 上级公司ID, 无上级为0 */
- parentId: number;
- /** 公司名称 */
- name: string;
- /** 公司code */
- code: string;
- /** 公司描述 */
- remark: string;
- /** 状态: 0-启用, 1-禁用 */
- status: number;
- /** 创建时间 */
- createdAt: string;
- /** 更新时间 */
- updatedAt: string;
- /** 排序序号 */
- serial: number;
- /** 0-未删除,大于0-已删除 */
- isDeleted: number;
- /** 下属工厂列表 */
- children: WorkShopInfoItem[];
- /** 场景标签列表 */
- labelList: SceneLabelOrModuleItem[];
- /** 场景模板列表 */
- moduleList: SceneLabelOrModuleItem[];
- };
- /** 获取公司-工厂-工位数据 */
- export const getShopSpaceList = () => {
- return http.request<CompanyInfoItem[]>({
- url: '/scene/getList',
- method: 'get',
- headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
- });
- };
- interface LayoutResp {
- /** 创建时间 */
- createdAt: string;
- /** 自增主键 */
- id: number;
- /** 页面布局json */
- layout: string;
- /** 目标id: 对应公司ID/车间ID */
- targetId: number;
- viewType: ViewType;
- }
- /** 查询地图布局 */
- export const getLayoutApi = (param: { workshopId: string; viewType: ViewType }) => {
- return http.request<LayoutResp[]>(
- {
- url: `/api/layout/getWorkshopLayout?viewType=${param.viewType}&workshopId=${param.workshopId}`,
- method: 'get',
- headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
- },
- {
- urlPrefix: 'temp',
- },
- );
- };
- /** 查询车间小地图布局 */
- export const getWorkshopMiniMapLayoutApi = (workshopId: string) => {
- return getLayoutApi({ viewType: ViewType.minMap, workshopId }).then((res) => res[0]);
- };
- enum ViewType {
- safety = 1,
- minMap = 2,
- }
- interface UpdateViewLayoutParam {
- layout: string;
- targetId: string;
- viewType: ViewType;
- }
- /** 更新-新增小地图页面布局 */
- export const updateLayoutApi = (data: UpdateViewLayoutParam) => {
- return http.request<LayoutResp[]>(
- {
- url: `/api/layout/updateViewLayout`,
- method: 'post',
- data: new URLSearchParams(data as any).toString(),
- headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
- },
- {
- urlPrefix: 'temp',
- },
- );
- };
- /** 更新-新增小地图页面布局 */
- export const updateMinMapViewLayoutApi = (
- param: Pick<UpdateViewLayoutParam, 'layout' | 'targetId'>,
- ) => {
- return updateLayoutApi({ viewType: ViewType.minMap, ...param });
- };
- export type CameraItem = {
- /** 相机名称 */
- name: string;
- /** 相机code */
- code: string;
- /** 相机IP地址 */
- cameraIp: string;
- /** 相机描述 */
- remark: string;
- /** 状态: 0-启用, 1-禁用 */
- status: number;
- };
- export type WorkSpaceCameraRelative = WorkSpaceInfoItem & { cameraList: CameraItem[] };
- export const getCamerasByWorkSpace = (params: { workshopId: number }) => {
- return http.request<WorkSpaceCameraRelative[]>({
- url: '/api/workshop/getWorkspaceCameraList',
- method: 'get',
- params,
- headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
- });
- };
|