ranger.js 4.27 KB
Newer Older
1
import { getReq, postReq, putReq } from '@/utils/requestUtil';
水落(YangLei)'s avatar
水落(YangLei) committed
2 3 4 5 6 7 8 9

export function getXunJianDownloadUrlApi(idList) {
    return getReq('/ranger/inspection/api/v1/jobs/export', { jobIdList: idList.join(',') });
}

export function addXunJianTaskApi(data) {
    return postReq('/ranger/inspection/api/v1/jobs/temporary', data);
}
10 11 12 13 14 15 16 17 18 19 20 21

export function getRegionInfoApi(id) {
    return getReq(`/ranger/inspection/api/v1/region/${id}`);
}

export function addRegionApi(data) {
    return postReq('/ranger/inspection/api/v1/region', data);
}

export function editRegionApi(data) {
    return putReq(`ranger/inspection/api/v1/region`, data);
}
陈浩玮's avatar
地点  
陈浩玮 committed
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37

export function getPlaceInfoApi(id) {
    return getReq(`/ranger/inspection/api/v1/place/${id}`);
}

export function addPlaceApi(data) {
    return postReq('/ranger/inspection/api/v1/place', data);
}

export function editPlaceApi(data) {
    return putReq('/ranger/inspection/api/v1/place', data);
}

export function getExemptionsListApi(data) {
    return getReq(`/ranger/inspection/api/v1/exemptions/valid`, data);
}
陈浩玮's avatar
陈浩玮 committed
38

水落(YangLei)'s avatar
水落(YangLei) committed
39 40 41 42 43 44 45 46 47 48 49
export function addUnitApi(data) {
    return postReq('/ranger/inspection/api/v1/units', data);
}

export function editUnitApi(data) {
    return putReq('/ranger/inspection/api/v1/units', data);
}

export function getUnitInfoApi(id) {
    return getReq(`/ranger/inspection/api/v1/units/${id}`);
}
陈浩玮's avatar
陈浩玮 committed
50 51 52 53 54 55 56 57 58 59 60 61

export function getItemsInfoApi(id) {
    return getReq(`/ranger/inspection/api/v1/items/${id}`);
}

export function addItemsApi(data) {
    return postReq('/ranger/inspection/api/v1/items', data);
}

export function editItemsApi(data) {
    return putReq('/ranger/inspection/api/v1/items', data);
}
水落(YangLei)'s avatar
水落(YangLei) committed
62 63 64 65 66 67 68 69 70 71 72
export function addExemptionApi(data) {
    return postReq('/ranger/inspection/api/v1/exemptions', data);
}

export function getExemptionApi(id) {
    return getReq(`ranger/inspection/api/v1/exemptions/${id}`);
}

export function updateExemptionApi(data) {
    return putReq(`/ranger/inspection/api/v1/exemptions`, data);
}
73 74 75 76 77 78 79 80 81 82 83

export function addMajorApi(data) {
    return postReq(`/ranger/inspection/api/v1/specialities`, data);
}
export function updateMajorApi(data) {
    return putReq('/ranger/inspection/api/v1/specialities', data);
}

export function getMajorInfoApi(id) {
    return getReq(`/ranger/inspection/api/v1/specialities/${id}`);
}
水落(YangLei)'s avatar
水落(YangLei) committed
84 85 86 87 88 89 90 91

export function getOrganizationUserApi(id) {
    return getReq(`/api/v1/users/organizations/${id}`);
}

export function addSpecialitiesStaffsApi(data) {
    return postReq(`/ranger/inspection/api/v1/specialities/staffs`, data);
}
陈浩玮's avatar
tijiao  
陈浩玮 committed
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147

export function getRouteInfoApi(id) {
    return getReq(`/ranger/inspection/api/v1/routes/${id}`);
}
export function addRouteInfoApi(data) {
    return postReq(`/ranger/inspection/api/v1/routes`, data);
}
export function updateRouteInfoApi(data) {
    return putReq(`/ranger/inspection/api/v1/routes`, data);
}

export function getTemplateApi() {
    return getReq(
        `/ranger/inspection/api/v1/routes/downLoadRouteImportTemplate`,
        {},
        { responseType: 'blob' },
    );
}

export function exportRouteData(data) {
    return getReq(`/ranger/inspection/api/v1/routes/exportRouteData`, data, { responseType: 'blob' });
}

export function updateRouteStateApi(data) {
    return putReq(`/ranger/inspection/api/v1/routes/routeState`, data);
}

/**
 * 上传文件
 */
export function uploadFileRouteApi(data = {}, file) {
    const formData = new FormData();
    Object.keys(data).forEach((key) => {
        formData.append(key, data[key]);
    });
    formData.append('file', file);
    return postReq('/ranger/inspection/api/v1/routes/upload', formData);
}
export function getRouteSchedulesListApi(data) {
    return getReq(`/ranger/inspection/api/v1/route/schedules`, data);
}
export function updateRouteSchedulesStateApi({ id, state }) {
    return putReq(`/ranger/inspection/api/v1/route/schedules/${id}?shiftState=${state}`);
}
export function addRouteSchedulesApi(data) {
    return postReq(`/ranger/inspection/api/v1/route/schedules`, data);
}
export function updateRouteSchedulesApi(data) {
    return postReq(`/ranger/inspection/api/v1/route/schedules`, data);
}
export function getRouteAssemblesApi(data) {
    return getReq(`/ranger/inspection/api/v1/route/assembles`, data);
}
export function getRouteAssemblesListApi(data) {
    return getReq(`/ranger/inspection/api/v1/route/assembles/assembleList`, data);
}