接口交互

This commit is contained in:
2025-07-14 09:28:21 +08:00
parent beb227f6b1
commit c0351508c5
9 changed files with 515 additions and 480 deletions

42
src/config/getData.js Normal file
View File

@@ -0,0 +1,42 @@
import {post} from '@config/http.js'
// 登录
export const authlogin = (username, password) => post('auth/login', {
username: username,
password: password
})
// 建图
export const startMapping = (na) => post('teaching/startMapping', {
mapName: na
})
export const setStation = (sn) => post('teaching/setStation', {
stationName: sn
})
export const stopMapping = () => post('teaching/stopMapping', {})
export const getLocalMaps = () => post('teaching/getLocalMaps', {})
export const synchronzieMap = (map) => post('teaching/synchronzieMap', {
mapName: map
})
export const restart = () => post('teaching/restart', {})
export const relocate = (x, y, angle) => post('teaching/relocate', {
x: x,
y: x,
angle: angle
})
// 操作
export const queryStation = () => post('api/operate/queryStation', {})
export const queryTaskChain = () => post('api/operate/queryTaskChain', {})
export const sendTask = (data) => post('api/operate/sendTask', {
data: data
})
export const saveTask = (data) => post('api/operate/saveTask', {
data: data
})
export const cancelTask = () => post('api/operate/cancelTask', {})
export const deleteTaskChain = (id) => post('api/operate/deleteTaskChain', {
chain_id: id
})
export const updateStation = (code, st) => post('api/operate/updateStation', {
station_code: code,
station_name: st
})

View File

@@ -1,413 +0,0 @@
/* eslint-disable */
import {post} from '@config/http.js'
// import store from '../vuex/store'
// 开发者选项
export const getIP = () => post('api/developer/getIP', {})
export const getLogList = () => post('api/developer/getLogList', {})
export const getROSNodeList = () => post('api/developer/getROSNodeList', {})
export const temperature = () => post('api/developer/temperature', {})
export const debugInfo = () => post('api/developer/debugInfo', {})
export const softwareVersion = () => post('api/developer/softwareVersion', {})
export const parameterSetting = (num, word) => post('api/developer/parameterSetting', {
maxTaskNun: num,
password: word
})
// new
// 登录
export const authlogin = (username, password) => post('auth/login', {
username: username,
password: password
})
export const queryHead = () => post('api/home/queryHead', {
})
// 车辆状态
// 1.1查询车辆状态
export const queryVehicleStatus = (username, password) => post('api/vehicle/queryVehicleStatus', {
})
// 1.2查询传感器状态
export const querrySensor = () => post('api/vehicle/querrySensor', {})
// 1.3软启动
export const softStart = () => post('api/vehicle/softStart', {})
// 1.4跳过起点
export const skipStartPoint = () => post('api/vehicle/skipStartPoint', {})
// 1.5关机显示屏控制、TCS控制、RC控制、Joy控制
export const ShutDown = (type, bool) => post('api/vehicle/Shut_down', {
type: type,
bool: bool
})
// 1.6查询初始化坐标
export const queryRestPoint = () => post('api/vehicle/queryRestPoint', {})
// 1.7初始化坐标确定
export const restCoordinate = (code, name, x, y, t) => post('api/vehicle/restCoordinate', {
point_code: code,
point_name: name,
x: x,
y: y,
t: t
})
// 1.8查询agv的状态
export const queryAgvStatus = () => post('api/vehicle/queryAgv_Status', {})
// 1.9退出
export const quitNow = () => post('api/vehicle/quitNow', {})
// 系统管理
// 1.1 用户列表
export const usersQuery = (page, size) => post('api/users/query', {
page: page,
size: size
})
// 1.2 添加用户
export const usersAdd = (username, personName, gender, phone, rolesIds, password) => post('api/users/add', {
username: username,
personName: personName,
gender: gender,
phone: phone,
rolesIds: rolesIds,
password: password
})
// 1.3 修改用户、重置密码
export const usersEdit = (obj) => post('api/users/edit', obj)
// 1.4 删除用户
export const usersDelete = (userId) => post('api/users/delete', userId)
// 角色管理
// 1.1 角色列表
export const sysRoleQuery = (page, size) => post('api/sysRole/query', {
page: page,
size: size
})
// 1.2 添加角色
export const sysRoleAdd = (name, remark) => post('api/sysRole/add', {
name: name,
remark: remark
})
// 1.3 修改角色
export const sysRoleEdit = (roleId, name, remark) => post('api/sysRole/edit', {
roleId: roleId,
name: name,
remark: remark
})
// 1.4 删除角色
export const sysRoleDelete = (roleId) => post('api/sysRole/delete', roleId)
// 1.5 保存菜单
export const sysRoleMenu = (roleId, menus, menus1) => post('api/sysRole/menu', {
roleId: roleId,
menus: menus,
menus1: menus1
})
// 1.6 查询菜单树
export const menuQuery = (roleId, menus) => post('api/sysRole/menuQuery', {
})
// 系统参数
// 1.1 参数列表
export const paramQuery = (page, size) => post('api/param/query', {
page: page,
size: size
})
// 1.2 添加参数
export const paramAdd = (code, name, value, remark) => post('api/param/add', {
code: code,
name: name,
value: value,
remark: remark
})
// 1.3 修改参数
export const paramEdit = (id, code, name, value, remark) => post('api/param/edit', {
id: id,
code: code,
name: name,
value: value,
remark: remark
})
// 1.4 删除参数
export const paramDelete = (paramsIds) => post('api/param/delete', paramsIds)
// 修改密码
export const updatePass = (newPass, oldPass) => post('api/users/updatePass', {
newPass: newPass,
oldPass: oldPass
})
// 用户登录获取菜单
export const sysMenuBuild = () => post('api/sysMenu/build', {
})
// export const sysMenuBuild = () => {
// let res = [
// {
// "menuId": "1654807438270009344",
// "pid": "1324783485328",
// "label": "首页",
// "router": "",
// "index": "1",
// "children": [
// {
// "menuId": "1654807784312672256",
// "pid": "1654807438270009344",
// "label": "首页",
// "router": "/index/home",
// "index": "1",
// "children": null,
// "title": "首页",
// "zhTitle": "首页",
// "enTitle": "Index",
// "inTitle": null,
// "zh_title": "首页",
// "en_title": "Index",
// "in_title": null
// }
// ],
// "title": "首页",
// "zhTitle": "首页",
// "enTitle": "Index",
// "inTitle": null,
// "zh_title": "首页",
// "en_title": "Index",
// "in_title": null
// },
// {
// "menuId": "1654808014131171328",
// "pid": "1324783485328",
// "label": "任务",
// "router": "",
// "index": "2",
// "children": [
// {
// "menuId": "1654808296076480512",
// "pid": "1654808014131171328",
// "label": "搬运起点",
// "router": "/index/carrypoint",
// "index": "1",
// "children": null,
// "title": "搬运起点",
// "zhTitle": "搬运起点",
// "enTitle": "Carry Point",
// "inTitle": null,
// "zh_title": "搬运起点",
// "en_title": "Carry\nPoint",
// "in_title": null
// }
// ],
// "title": "任务",
// "zhTitle": "任务",
// "enTitle": "Task",
// "inTitle": null,
// "zh_title": "任务",
// "en_title": "Task",
// "in_title": null
// },
// {
// "menuId": "1654808791742550016",
// "pid": "1324783485328",
// "label": "车辆",
// "router": "",
// "index": "4",
// "children": [
// {
// "menuId": "1654808864970903552",
// "pid": "1654808791742550016",
// "label": "车辆状态",
// "router": "/index/vehiclestatus",
// "index": "1",
// "children": null,
// "title": "车辆状态",
// "zhTitle": "车辆状态",
// "enTitle": "Vehicle State ",
// "inTitle": null,
// "zh_title": "车辆状态",
// "en_title": "Vehicle\nState",
// "in_title": null
// },
// {
// "menuId": "1654808966481448960",
// "pid": "1654808791742550016",
// "label": "车辆控制",
// "router": "/index/vehiclecontrol",
// "index": "2",
// "children": null,
// "title": "车辆控制",
// "zhTitle": "车辆控制",
// "enTitle": "Vehicle Control",
// "inTitle": null,
// "zh_title": "车辆控制",
// "en_title": "Vehicle\nControl",
// "in_title": null
// },
// {
// "menuId": "1654808966481448961",
// "pid": "1654808791742550016",
// "label": "恢复定位",
// "router": "/index/slam",
// "index": "3",
// "children": null,
// "title": "恢复定位",
// "zhTitle": "恢复定位",
// "enTitle": "Vehicle Control",
// "inTitle": null,
// "zh_title": "恢复定位",
// "en_title": "Vehicle\nControl",
// "in_title": null
// }
// ],
// "title": "车辆",
// "zhTitle": "车辆",
// "enTitle": "Vehicle",
// "inTitle": null,
// "zh_title": "车辆",
// "en_title": "Vehicle",
// "in_title": null
// },
// {
// "menuId": "1654808657013116928",
// "pid": "1324783485328",
// "label": "故障",
// "router": "",
// "index": "3",
// "children": [
// {
// "menuId": "1654808721102082048",
// "pid": "1654808657013116928",
// "label": "故障信息",
// "router": "/index/errorinfo",
// "index": "1",
// "children": null,
// "title": "故障信息",
// "zhTitle": "故障信息",
// "enTitle": "Fault Information",
// "inTitle": null,
// "zh_title": "故障信息",
// "en_title": "Fault\nInformation",
// "in_title": null
// }
// ],
// "title": "故障",
// "zhTitle": "故障",
// "enTitle": "Fault ",
// "inTitle": null,
// "zh_title": "故障",
// "en_title": "Fault",
// "in_title": null
// },
// {
// "menuId": "1654809097821884416",
// "pid": "1324783485328",
// "label": "示教",
// "router": "/index/teach",
// "index": "5",
// "children": null,
// "title": "示教",
// "zhTitle": "示教",
// "enTitle": "Teach",
// "inTitle": null,
// "zh_title": "示教",
// "en_title": "Teach",
// "in_title": null
// },
// {
// "menuId": "1664808014131171329",
// "pid": "1324783485328",
// "label": "系统",
// "router": "",
// "index": "6",
// "children": [
// {
// "menuId": "1664808014131171330",
// "pid": "1664808014131171329",
// "label": "用户管理",
// "router": "/index/user",
// "index": "1",
// "children": null,
// "title": "用户管理",
// "zhTitle": "用户管理",
// "enTitle": "User Management",
// "inTitle": null,
// "zh_title": "用户管理",
// "en_title": "User\nManagement",
// "in_title": null
// },
// {
// "menuId": "1664808014131171331",
// "pid": "1664808014131171329",
// "label": "角色管理",
// "router": "/index/role",
// "index": "2",
// "children": null,
// "title": "角色管理",
// "zhTitle": "角色管理",
// "enTitle": "Role Management",
// "inTitle": null,
// "zh_title": "角色管理",
// "en_title": "Role\nManagement",
// "in_title": null
// },
// {
// "menuId": "1664808014131171335",
// "pid": "1664808014131171329",
// "label": "系统管理",
// "router": "/index/system",
// "index": "3",
// "children": null,
// "title": "系统管理",
// "zhTitle": "系统管理",
// "enTitle": "System Param",
// "inTitle": null,
// "zh_title": "系统管理",
// "en_title": "System\nParam",
// "in_title": null
// },
// {
// "menuId": "1664808014131171334",
// "pid": "1664808014131171329",
// "label": "开发者选项",
// "router": "/index/developer",
// "index": "4",
// "children": null,
// "title": "开发者选项",
// "zhTitle": "开发者选项",
// "enTitle": "Developer Param",
// "inTitle": null,
// "zh_title": "开发者选项",
// "en_title": "Developer\nParam",
// "in_title": null
// },
// {
// "menuId": "1664808014131171336",
// "pid": "1664808014131171329",
// "label": "远程支持",
// "router": "/index/remote",
// "index": "5",
// "children": null,
// "title": "远程支持",
// "zhTitle": "远程支持",
// "enTitle": "Remote Support",
// "inTitle": null,
// "zh_title": "远程支持",
// "en_title": "Remote\nSupport",
// "in_title": null
// }
// ],
// "title": "系统",
// "zhTitle": "系统",
// "enTitle": "System",
// "inTitle": null,
// "zh_title": "系统",
// "en_title": "System",
// "in_title": null
// }
// ]
// return res
// }
// 用户退出
export const authLogout = () => post('auth/logout', {
})
/**
* 远程支持
*/
// 获取远程码接口
export const queryRemotelnfo = () => post('api/developer/queryRemoteInfo', {
})

View File

@@ -1,7 +1,5 @@
import axios from 'axios'
// import { Dialog } from './utils.js'
import store from '../vuex/store'
import router from '@/router'
import i18n from '../i18n/i18n'
axios.defaults.timeout = 50000
@@ -37,11 +35,8 @@ axios.interceptors.response.use(
if (error && error.response) {
switch (error.response.status) {
case 400:
// Dialog(error.message)
break
case 401:
store.dispatch('setSignOut')
router.push('/login')
break
}
return Promise.reject(error.response.data)
@@ -57,8 +52,7 @@ export const post = (sevmethod, params) => {
.then(response => {
resolve(response.data)
}, error => {
// Dialog(error.message)
reject(error)
reject(error.message)
})
.catch((error) => {
reject(error)

20
src/config/mork.js Normal file
View File

@@ -0,0 +1,20 @@
export const queryStation = () => {
let res = {
message: 'ok',
data: [{station_code: 'B1', station_name: 'B1', x: '10', Y: '10', angle: '90'}, {station_code: 'B2', station_name: 'B2', x: '10', Y: '10', angle: '90'}, {station_code: 'B3', station_name: 'B3', x: '10', Y: '10', angle: '90'}]
}
return res
}
export const queryTaskChain = () => {
let res = {
message: 'ok',
data: [{chain_id: '1', chain_point: 'A-B-C', chain_name: 'A-B-C', action_type: 'Ascend-Descend-Move'}]
}
return res
}
export const updateStation = () => {
let res = {
message: 'ok'
}
return res
}