diff --git a/src/api/modules/district.js b/src/api/modules/district.js new file mode 100644 index 0000000..5abf902 --- /dev/null +++ b/src/api/modules/district.js @@ -0,0 +1,73 @@ +import request from '@/utils/axios' + +/** + * 获取所有省级数据 + */ +export function getProvinces() { + return request({ + url: '/district/provinces', + method: 'get' + }) +} + +/** + * 根据省份ID获取城市列表 + */ +export function getCitiesByProvinceId(provinceId) { + return request({ + url: `/district/cities/${provinceId}`, + method: 'get' + }) +} + +/** + * 根据城市ID获取区县列表 + */ +export function getDistrictsByCityId(cityId) { + return request({ + url: `/district/districts/${cityId}`, + method: 'get' + }) +} + +/** + * 获取省级市级树形结构 + */ +export function getDistrictTree() { + return request({ + url: '/district/getDistrictTree', + method: 'get' + }) +} + +/** + * 新增物流模板 + */ +export function createTemplate(data) { + return request({ + url: '/logistics/logistics', + method: 'post', + data: data + }) +} + +/** + * 获取运费信息 + */ +export function getFreInfo(id) { + return request({ + url: '/logistics/logistics/' + id, + method: 'get' + }) +} + +/** + * 更新物流模板 + */ +export function UpdateTemplate(data) { + return request({ + url: '/logistics/logistics', + method: 'put', + data: data + }) +} diff --git a/src/api/modules/logistics.js b/src/api/modules/logistics.js new file mode 100644 index 0000000..e4a1415 --- /dev/null +++ b/src/api/modules/logistics.js @@ -0,0 +1,65 @@ +import request from '@/utils/axios' + +/** + * 查询物流管理列表 + */ +export function listLogistics(query) { + return request({ + url: '/logistics/list', + method: 'get', + params: query + }) +} + +/** + * 查询物流管理详细 + */ +export function getLogistics(id) { + return request({ + url: '/logistics/' + id, + method: 'get' + }) +} + +/** + * 新增物流管理 + */ +export function addLogistics(data) { + return request({ + url: '/logistics', + method: 'post', + data: data + }) +} + +/** + * 修改物流管理 + */ +export function updateLogistics(data) { + return request({ + url: '/logistics', + method: 'put', + data: data + }) +} + +/** + * 删除物流管理 + */ +export function delLogistics(id) { + return request({ + url: '/logistics/' + id, + method: 'delete' + }) +} + +/** + * 导出物流管理 + */ +export function exportLogistics(query) { + return request({ + url: '/logistics/export', + method: 'get', + params: query + }) +} diff --git a/src/api/modules/shelves.js b/src/api/modules/shelves.js new file mode 100644 index 0000000..0202ea2 --- /dev/null +++ b/src/api/modules/shelves.js @@ -0,0 +1,64 @@ +import request from '@/utils/axios' + +/** + * 获取货区名称列表 + */ +export function depotNameList() { + return request({ + url: '/depot/nameList', + method: 'get' + }) +} + +/** + * 查询货架列表 + */ +export function listShelves(query) { + return request({ + url: '/shelves/list', + method: 'get', + params: query + }) +} + +/** + * 查询货架详细 + */ +export function getShelves(id) { + return request({ + url: '/shelves/' + id, + method: 'get' + }) +} + +/** + * 新增货架 + */ +export function addShelves(data) { + return request({ + url: '/shelves', + method: 'post', + data: data + }) +} + +/** + * 修改货架 + */ +export function updateShelves(data) { + return request({ + url: '/shelves', + method: 'put', + data: data + }) +} + +/** + * 删除货架 + */ +export function delShelves(id) { + return request({ + url: '/shelves/' + id, + method: 'delete' + }) +} diff --git a/src/api/modules/userLogin.js b/src/api/modules/userLogin.js new file mode 100644 index 0000000..07af4a5 --- /dev/null +++ b/src/api/modules/userLogin.js @@ -0,0 +1,16 @@ +import instance from '../../utils/axios.js' + +// 用户登录相关API +const userLoginApi = { + // 用户登录 - 直接发送FormData + userLogin: (data) => { + return instance.post('/userLogin/login', data); + }, + // 获取用户信息 + getUserInfo: (accessToken) => instance.get('/userLogin/getUserInfo', { + params: { accessToken } + }) +}; + +// 导出模块 +export { userLoginApi }; \ No newline at end of file diff --git a/src/config/api.js b/src/config/api.js new file mode 100644 index 0000000..2306576 --- /dev/null +++ b/src/config/api.js @@ -0,0 +1,19 @@ +// API配置 +const config = { + // 从环境变量获取API基础URL + baseURL: import.meta.env.VITE_API_BASE_URL || '', + timeout: 10000 +} + +// 获取当前环境配置 +export const getApiConfig = () => { + return config +} + +// 获取完整的API URL +export const getApiUrl = (path) => { + const { baseURL } = getApiConfig() + return `${baseURL}${path}` +} + +export default config diff --git a/src/directives/permission.js b/src/directives/permission.js new file mode 100644 index 0000000..eb52975 --- /dev/null +++ b/src/directives/permission.js @@ -0,0 +1,44 @@ +import { hasPermission, hasAnyPermission } from '@/utils/permission' + +/** + * 权限指令 + * v-permission="'system:user:add'" 单个权限 + * v-permission="['system:user:add', 'system:user:update']" 多个权限(任意一个) + */ +export const permission = { + mounted(el, binding) { + const { value } = binding + + if (value) { + let hasAuth = false + + if (Array.isArray(value)) { + hasAuth = hasAnyPermission(value) + } else { + hasAuth = hasPermission(value) + } + + if (!hasAuth) { + el.parentNode && el.parentNode.removeChild(el) + } + } + } +} + +/** + * 权限指令(所有权限都需要) + * v-permission-all="['system:user:add', 'system:user:update']" + */ +export const permissionAll = { + mounted(el, binding) { + const { value } = binding + + if (value && Array.isArray(value)) { + const hasAuth = value.every(code => hasPermission(code)) + + if (!hasAuth) { + el.parentNode && el.parentNode.removeChild(el) + } + } + } +} \ No newline at end of file diff --git a/src/layout/DynamicSidebar.vue b/src/layout/DynamicSidebar.vue new file mode 100644 index 0000000..bcd2e96 --- /dev/null +++ b/src/layout/DynamicSidebar.vue @@ -0,0 +1,198 @@ + + + + + \ No newline at end of file diff --git a/src/utils/permission.js b/src/utils/permission.js new file mode 100644 index 0000000..6688197 --- /dev/null +++ b/src/utils/permission.js @@ -0,0 +1,48 @@ +import { getUserPermissionCodes } from '@/api/permission' + +let userPermissions = [] + +/** + * 初始化用户权限 + */ +export async function initUserPermissions() { + try { + const res = await getUserPermissionCodes() + if (res.code === 200) { + userPermissions = res.data.filter(code => code && code.trim() !== '') + } + } catch (error) { + console.error('获取用户权限失败:', error) + } +} + +/** + * 检查用户是否有指定权限 + */ +export function hasPermission(permissionCode) { + if (!permissionCode) return true + return userPermissions.includes(permissionCode) +} + +/** + * 检查用户是否有任意一个权限 + */ +export function hasAnyPermission(permissionCodes) { + if (!permissionCodes || permissionCodes.length === 0) return true + return permissionCodes.some(code => hasPermission(code)) +} + +/** + * 检查用户是否有所有权限 + */ +export function hasAllPermissions(permissionCodes) { + if (!permissionCodes || permissionCodes.length === 0) return true + return permissionCodes.every(code => hasPermission(code)) +} + +/** + * 获取用户所有权限 + */ +export function getUserPermissions() { + return userPermissions +} \ No newline at end of file diff --git a/src/views/Monitor/Dashboard.vue b/src/views/Monitor/Dashboard.vue new file mode 100644 index 0000000..60a766a --- /dev/null +++ b/src/views/Monitor/Dashboard.vue @@ -0,0 +1,157 @@ + + + + + \ No newline at end of file diff --git a/src/views/logistics/index.vue b/src/views/logistics/index.vue new file mode 100644 index 0000000..9c17d9a --- /dev/null +++ b/src/views/logistics/index.vue @@ -0,0 +1,968 @@ + + + + + diff --git a/src/views/redirectUrl/index.vue b/src/views/redirectUrl/index.vue new file mode 100644 index 0000000..955d926 --- /dev/null +++ b/src/views/redirectUrl/index.vue @@ -0,0 +1,560 @@ + + + + + \ No newline at end of file