diff --git a/src/api/inspection/inspectionPlanApi.js b/src/api/inspection/inspectionPlanApi.js index 01b63493d..b126384bb 100644 --- a/src/api/inspection/inspectionPlanApi.js +++ b/src/api/inspection/inspectionPlanApi.js @@ -3,102 +3,167 @@ import { getCommunityId } from '@/api/community/communityApi' // 获取字典数据 export function getDict(dictType, state) { - return request({ - url: '/dict.listDict', - method: 'get', - params: { dictType, state } - }).then(res => res.data) + return new Promise((resolve, reject) => { + request({ + url: '/dict.listDict', + method: 'get', + params: { dictType, state } + }).then(response => { + const res = response.data + resolve(res) + }).catch(error => { + reject(error) + }) + }) } // 查询巡检计划列表 export function listInspectionPlans(params) { - return request({ - url: '/inspectionPlan.listInspectionPlans', - method: 'get', - params: { - communityId: getCommunityId(), - ...params - } - }).then(res => res.data) + return new Promise((resolve, reject) => { + request({ + url: '/inspectionPlan.listInspectionPlans', + method: 'get', + params: { + ...params, + communityId: getCommunityId() + } + }).then(response => { + const res = response.data + resolve(res) + }).catch(error => { + reject(error) + }) + }) } // 更新巡检计划状态 export function updateInspectionPlanState(data) { - return request({ - url: '/inspectionPlan.updateInspectionPlanState', - method: 'post', - data: { - communityId: getCommunityId(), - ...data - } - }).then(res => res.data) + return new Promise((resolve, reject) => { + request({ + url: '/inspectionPlan.updateInspectionPlanState', + method: 'post', + data: { + ...data, + communityId: getCommunityId() + } + }).then(response => { + const res = response.data + resolve(res) + }).catch(error => { + reject(error) + }) + }) } // 删除巡检计划 export function deleteInspectionPlan(data) { - return request({ - url: '/inspectionPlan.deleteInspectionPlan', - method: 'post', - data: { - communityId: getCommunityId(), - ...data - } - }).then(res => res.data) + return new Promise((resolve, reject) => { + request({ + url: '/inspectionPlan.deleteInspectionPlan', + method: 'post', + data: { + ...data, + communityId: getCommunityId() + } + }).then(response => { + const res = response.data + resolve(res) + }).catch(error => { + reject(error) + }) + }) } // 更新巡检计划 export function updateInspectionPlan(data) { - return request({ - url: '/inspectionPlan.updateInspectionPlan', - method: 'post', - data: { - communityId: getCommunityId(), - ...data - } - }).then(res => res.data) + return new Promise((resolve, reject) => { + request({ + url: '/inspectionPlan.updateInspectionPlan', + method: 'post', + data: { + ...data, + communityId: getCommunityId() + } + }).then(response => { + const res = response.data + resolve(res) + }).catch(error => { + reject(error) + }) + }) } // 查询巡检路线列表 export function listInspectionRoutes(params) { - return request({ - url: '/inspectionRoute.listInspectionRoutes', - method: 'get', - params: { - communityId: getCommunityId(), - ...params - } - }).then(res => res.data) + return new Promise((resolve, reject) => { + request({ + url: '/inspectionRoute.listInspectionRoutes', + method: 'get', + params: { + ...params, + communityId: getCommunityId() + } + }).then(response => { + const res = response.data + resolve(res) + }).catch(error => { + reject(error) + }) + }) } // 查询巡检计划员工 export function listInspectionPlanStaffs(params) { - return request({ - url: '/inspection.listInspectionPlanStaffs', - method: 'get', - params: { - communityId: getCommunityId(), - ...params - } - }).then(res => res.data) + return new Promise((resolve, reject) => { + request({ + url: '/inspection.listInspectionPlanStaffs', + method: 'get', + params: { + ...params, + communityId: getCommunityId() + } + }).then(response => { + const res = response.data + resolve(res) + }).catch(error => { + reject(error) + }) + }) } // 查询组织树 export function listOrgTree() { - return request({ - url: '/org.listOrgTree', - method: 'get', - params: { communityId: getCommunityId() } - }).then(res => res.data) + return new Promise((resolve, reject) => { + request({ + url: '/org.listOrgTree', + method: 'get', + params: { + communityId: getCommunityId() + } + }).then(response => { + const res = response.data + resolve(res) + }).catch(error => { + reject(error) + }) + }) } // 根据组织ID查询员工 export function listStaffsByOrgId(params) { - return request({ - url: '/query.staff.infos', - method: 'get', - params: { - communityId: getCommunityId(), - ...params - } - }).then(res => res.data) + return new Promise((resolve, reject) => { + request({ + url: '/query.staff.infos', + method: 'get', + params: { + ...params, + communityId: getCommunityId() + } + }).then(response => { + const res = response.data + resolve(res) + }).catch(error => { + reject(error) + }) + }) } \ No newline at end of file diff --git a/src/components/inspection/DeleteInspectionRoutePoint.vue b/src/components/inspection/DeleteInspectionRoutePoint.vue index ac100ae0f..02dd509e1 100644 --- a/src/components/inspection/DeleteInspectionRoutePoint.vue +++ b/src/components/inspection/DeleteInspectionRoutePoint.vue @@ -1,6 +1,6 @@