fix(operations): 替换围栏停用的本地模拟逻辑为真实API调用
为updateFenceStatus接口定义严格参数类型并调整请求方法,在运营工作台页面接入真实接口,成功后刷新列表
| | |
| | | } |
| | | |
| | | // 更新围栏状态 |
| | | export function updateFenceStatus(params: any) { |
| | | return request.Put<Service.ResponseResult<any>>('/map/api/v1/electronicFence/updateStatus', params) |
| | | export function updateFenceStatus(params: { |
| | | id: number | string; |
| | | // 区域状态:1=启用,2=禁用。 |
| | | status: 1 | 2; |
| | | }) { |
| | | return request.Post<Service.ResponseResult<any>>('/map/api/v1/electronicFence/updateStatus', params) |
| | | } |
| | | |
| | | // 获取所有运营中的区域 |
| | |
| | | import SearchPanel from '@/components/custom/SearchPanel.vue' |
| | | import OperationLogModal from '@/components/custom/OperationLogModal.vue' |
| | | import { useBoolean, usePermission } from '@/hooks' |
| | | import { fetchEnabledOpenCityList, getFenceList } from '@/service/api/operations' |
| | | import { fetchEnabledOpenCityList, getFenceList, updateFenceStatus } from '@/service/api/operations' |
| | | import { deletePoint, enableDisablePoint, exportPointExcel, fetchFenceAndStationAreaList, fetchPointPageList } from '@/service/api/point' |
| | | import { deleteStation, exportStationExcel, fetchStationListByElectronicId, fetchStationPageList, updateStationStatus } from '@/service/api/station' |
| | | import { useWorkbenchStore } from '@/store' |
| | |
| | | negativeText: '取消', |
| | | maskClosable: false, |
| | | autoFocus: false, |
| | | onPositiveClick: () => { |
| | | // 正式工作台暂未接入围栏停用接口,先做本地状态切换以承接页面交互。 |
| | | listData.value = listData.value.map(item => |
| | | String(item.id) === String(row.id) |
| | | ? { ...item, status: 3 } |
| | | : item, |
| | | ) |
| | | message.success('停用成功') |
| | | onPositiveClick: async () => { |
| | | const res = await updateFenceStatus({ |
| | | id: row.id, |
| | | status: 2, |
| | | }) |
| | | if (res.code === 200) { |
| | | message.success('停用成功') |
| | | getList() |
| | | return |
| | | } |
| | | // message.error(res.msg || '停用失败') |
| | | }, |
| | | }) |
| | | } |