节假日,系统设置

This commit is contained in:
Songsl 2026-04-19 15:10:30 +08:00
parent 93893c2918
commit 214bc66b1c
11 changed files with 829 additions and 519 deletions

View File

@ -1,8 +1,8 @@
# 开发环境标识Vite 内置变量,无需修改)
NODE_ENV = development
# 开发环境接口基础地址(对应你配置的 192.168.10.10:8085/api
VITE_API_BASE_URL = http://192.168.10.10:8085/api
# 开发环境接口基础地址(对应你配置的 192.168.11.113:8085/api
VITE_API_BASE_URL = http://192.168.11.113:8085/api
# 请求超时时间(毫秒)
VITE_REQUEST_TIMEOUT = 10000

View File

@ -2,7 +2,8 @@ import axios from 'axios'
import type { AxiosResponse, AxiosError, InternalAxiosRequestConfig } from 'axios'
import type { ApiResponse } from '@/api/types'
import { ElLoading, ElNotification } from 'element-plus'
import { getStorage, setStorage } from '@/utils/storage'
import { getStorage, setStorage, removeStorage } from '@/utils/storage'
import router from '../router'
// 定义loading实例类型用于控制loading的显示和关闭
let loadingInstance: ReturnType<typeof ElLoading.service> | null = null
@ -14,7 +15,7 @@ const showLoading = () => {
if (requestCount === 0 && !loadingInstance) {
loadingInstance = ElLoading.service({
lock: true, // 锁定屏幕滚动
fullscreen: true // 全屏显示
fullscreen: true, // 全屏显示
})
}
requestCount++
@ -46,7 +47,7 @@ const service = axios.create({
// 3. 请求拦截器:直接使用 axios 内置类型
const requestInterceptor = (config: InternalAxiosRequestConfig) => {
console.log('请求配置', config);
console.log('请求配置', config)
// 显示loading可通过config配置项控制是否显示比如某些请求不需要loading
if (config.headers?.showLoading !== false) {
@ -81,9 +82,9 @@ const responseInterceptor = <T = unknown>(response: AxiosResponse<ApiResponse<T>
if (response.headers['new_token'] !== undefined) {
setStorage('token', response.headers['new_token'] as string)
}
console.log('响应response', response);
console.log('响应response', response)
const { data } = response
console.log('响应数据data', data);
console.log('响应数据data', data)
// 判断业务状态码
if (data.code == 200 || data.code == 0) {
// 仅当业务成功时,才弹成功提示
@ -91,23 +92,23 @@ const responseInterceptor = <T = unknown>(response: AxiosResponse<ApiResponse<T>
message: data.msg || '操作成功!',
type: 'success',
duration: 2000,
customClass: 'global-notification'
customClass: 'global-notification',
})
return data.data
} else {
if (data.code === 1) {
// 不弹错误提示,返回带特殊标识的结果
// 其他业务失败弹错误提示并拒绝Promise
ElNotification({
message: data.msg || '未知的错误!',
type: 'error',
duration: 2000,
customClass: 'global-notification'
})
const result = {
isUserNotExist: true, // 自定义标识,标记“用户不存在”
} as T
return result
switch (data.code) {
case 1:
if (!data.msg) {
data.msg = '未知的错误!'
}
break
case -101:
data.msg = 'token错误'
removeStorage('token')
router.push({ name: 'Login' })
break
default:
break;
}
// 其他业务失败弹错误提示并拒绝Promise
@ -115,7 +116,7 @@ const responseInterceptor = <T = unknown>(response: AxiosResponse<ApiResponse<T>
message: data.msg || '未知的错误!',
type: 'error',
duration: 2000,
customClass: 'global-notification'
customClass: 'global-notification',
})
return Promise.reject(data)
}
@ -159,7 +160,7 @@ const responseErrorInterceptor = (error: AxiosError) => {
message: errMsg,
type: 'error',
duration: 2000,
customClass: 'global-notification'
customClass: 'global-notification',
})
return Promise.reject(error)
}
@ -170,13 +171,13 @@ service.interceptors.response.use(responseInterceptor, responseErrorInterceptor)
export const request = {
get<T = unknown>(url: string, params?: unknown, config?: InternalAxiosRequestConfig): Promise<T> {
return service.get<ApiResponse<T>>(url, { params, ...config }).then((res) => {
return res as T;
});
return res as T
})
},
post<T = unknown>(url: string, data?: unknown, config?: InternalAxiosRequestConfig): Promise<T> {
return service.post<ApiResponse<T>>(url, data, config).then((res) => {
return res as T;
});
return res as T
})
},
}

View File

@ -0,0 +1,38 @@
import { request } from '@/api';
type SettingFormParams = {
key: string
value: string
description: string
}
type SettingListResponse = SettingFormParams & {
id: number
}
/**
*
* @returns Promise<MenuListResponse>
*/
export async function getSettingApi(): Promise<SettingListResponse[]> {
return request.get<SettingListResponse[]>('/setting/getList')
}
/**
*
* @param params
* @returns Promise<void>
*/
export async function createSettingApi(params: SettingFormParams): Promise<void> {
return request.post<void>('/setting/add', params)
}
/**
*
* @param params id
* @returns Promise<void>
*/
export async function editSettingApi(params: SettingFormParams): Promise<void> {
return request.post<void>('/setting/edit', params)
}

View File

@ -0,0 +1,21 @@
import { request } from '@/api';
// 获取节假日列表
export async function getHolidayList(): Promise<any> {
return request.get<any>('/contractVariety/getHolidayList')
}
// 添加节假日
export async function addHoliday(params: any): Promise<any> {
return request.post<any>('/contractVariety/addHoliday', { ...params })
}
//编辑节假日
export async function editHoliday(params: any): Promise<any> {
return request.post<any>('/contractVariety/editHoliday', { ...params })
}
// 删除节假日
export async function delHoliday(params: any): Promise<any> {
return request.post<any>('/contractVariety/delHoliday', { ...params })
}

View File

@ -1,49 +1,57 @@
<template>
<aside>
<div class="sidebar-header">
<div class="logo">
<img src="@/assets/images/logo.webp" alt="logo" :router="true" />
<span>Admin System</span>
</div>
</div>
<aside>
<div class="sidebar-header">
<div class="logo">
<img src="@/assets/images/logo.webp" alt="logo" :router="true" />
<span>Admin System</span>
</div>
</div>
<!-- 菜单区域 -->
<el-menu class="menu" :unique-opened="true" :default-active="activeMenu" router>
<template v-for="menu in staticMenuList" :key="menu.id">
<!-- 无子菜单 -->
<el-menu-item v-if="!menu.children || menu.children.length === 0" :index="menu.path">
<el-icon>
<component :is="iconMap[menu.icon]" />
</el-icon>
<template #title>{{ menu.label }}</template>
</el-menu-item>
<!-- 菜单区域 -->
<el-menu class="menu" :unique-opened="true" :default-active="activeMenu" router>
<template v-for="menu in staticMenuList" :key="menu.id">
<!-- 无子菜单 -->
<el-menu-item v-if="!menu.children || menu.children.length === 0" :index="menu.path">
<el-icon>
<component :is="iconMap[menu.icon]" />
</el-icon>
<template #title>{{ menu.label }}</template>
</el-menu-item>
<el-sub-menu v-else :index="menu.path">
<template #title>
<el-icon>
<component :is="iconMap[menu.icon]" />
</el-icon>
<span>{{ menu.label }}</span>
</template>
<el-menu-item v-for="subMenu in menu.children" :key="subMenu.id" :index="subMenu.path">
<el-icon v-if="subMenu.icon">
<component :is="iconMap[subMenu.icon]" />
</el-icon>
<template #title>{{ subMenu.label }}</template>
</el-menu-item>
</el-sub-menu>
</template>
</el-menu>
</aside>
<el-sub-menu v-else :index="menu.path">
<template #title>
<el-icon>
<component :is="iconMap[menu.icon]" />
</el-icon>
<span>{{ menu.label }}</span>
</template>
<el-menu-item v-for="subMenu in menu.children" :key="subMenu.id" :index="subMenu.path">
<el-icon v-if="subMenu.icon">
<component :is="iconMap[subMenu.icon]" />
</el-icon>
<template #title>{{ subMenu.label }}</template>
</el-menu-item>
</el-sub-menu>
</template>
</el-menu>
</aside>
</template>
<script setup lang="ts">
import { HomeFilled, List, UserFilled, Platform, BellFilled, GoodsFilled, WarningFilled, Tools } from '@element-plus/icons-vue'
import {
HomeFilled,
List,
UserFilled,
Platform,
BellFilled,
GoodsFilled,
WarningFilled,
Tools,
} from '@element-plus/icons-vue'
//
import { useUserStore } from '@/stores/modules/user'
const route = useRoute()
const userStore = useUserStore()
const menuList = ref<any[]>([])
@ -54,369 +62,370 @@ const activeMenu = computed(() => {
})
//
onMounted(async () => {
menuList.value = userStore.sideMenu || []
menuList.value = userStore.sideMenu || []
})
//
const iconMap: Record<string, any> = {
HomeFilled,
List,
UserFilled,
Platform,
BellFilled,
GoodsFilled,
WarningFilled,
Tools
HomeFilled,
List,
UserFilled,
Platform,
BellFilled,
GoodsFilled,
WarningFilled,
Tools,
}
//
import type { ElMenuItem } from '@/utils/menuFormat';
import type { ElMenuItem } from '@/utils/menuFormat'
//
const staticMenuList = ref<ElMenuItem[]>(
[
//
{
id: 1,
label: '首页',
path: 'dashboard', // el-menu-item index="dashboard"
icon: 'HomeFilled' // 对应 <HomeFilled /> 图标
},
//
// {
// id: 2,
// label: '',
// path: '2', // el-sub-menu index="2"
// icon: 'List', // <List />
// children: [
// {
// id: 21,
// label: '',
// path: '2-1', // el-menu-item index="2-1"
// icon: ''
// //
// }
// ]
// },
//
{
id: 3,
label: '账户管理',
path: 'account', // el-sub-menu index="account"
icon: 'UserFilled', // <UserFilled />
children: [
{
id: 31,
label: '客户管理',
path: '/account/client', // index="client"
icon: ''
},
{
id: 32,
label: '代理管理',
path: '/account/agentList', // index="3-2"
icon: ''
},
{
id: 33,
label: '做市商管理',
path: '/account/market-maker', // index="3-3"
icon: ''
},
{
id: 34,
label: '档案管理',
path: '/account/archives', // index="3-4"
icon: ''
},
{
id: 35,
label: '账号管理',
path: '/account/accountDetail', // index="3-5"
icon: ''
},
]
},
//
{
id: 4,
label: '交易管理',
path: '4', // index="4"
icon: 'Platform', // <Platform />
children: [
{
id: 41,
label: '品种',
path: '/trade/variety', // index="4-1"
icon: ''
},
{
id: 42,
label: '交易组',
path: '/trade/group', // index="4-2"
icon: ''
},
{
id: 43,
label: '持仓统计',
path: '/trade/positionStat', // index="4-3"
icon: ''
},
{
id: 44,
label: '历史交易',
path: '/trade/historyTrade', // index="4-4"
icon: ''
},
{
id: 45,
label: '交易软件',
path: '/trade/tradeSoftware', // index="4-5"
icon: ''
},
{
id: 46,
label: '交易时间',
path: '/trade/time', // index="4-3"
icon: ''
}
]
},
//
{
id: 5,
label: '公告管理',
path: '/notice', // index="5"
icon: 'BellFilled' // 对应 <BellFilled /> 图标
},
//
{
id: 6,
label: '资金管理',
path: '6', // index="6"
icon: 'GoodsFilled', // <GoodsFilled />
children: [
// {
// id: 61,
// label: '',
// path: '/funding/deposit', // index="6-1"
// icon: ''
// },
// {
// id: 62,
// label: '',
// path: '/funding/withdrawal', // index="6-2"
// icon: ''
// },
// {
// id: 63,
// label: '',
// path: '/funding/withdrawalDetail', // index="6-3"
// icon: ''
// },
// {
// id: 64,
// label: '',
// path: '/funding/depositDetail', // index="6-4"
// icon: ''
// },
{
id: 64,
label: '转账',
path: '/funding/transfer', // index="6-4"
icon: ''
},
{
id: 65,
label: '转账明细',
path: '/funding/transferDetail', // index="6-5"
icon: ''
},
{
id: 66,
label: '资金明细',
path: '/funding/fundDetail', // index="6-6"
icon: ''
},
// {
// id: 66,
// label: '',
// path: '/funding/flowDetail', // index="6-6"
// icon: ''
// },
// {
// id: 67,
// label: '',
// path: '/funding/receiverAccount', // index="6-7"
// icon: ''
// },
// {
// id: 68,
// label: '',
// path: '/funding/depositChannel', // index="6-8"
// icon: ''
// }
]
},
//
{
id: 7,
label: '系统管理',
path: 'system', // index="7"
icon: 'Tools', // <Tools />
children: [
{
id: 71,
label: '菜单管理',
path: '/system/menu', // index="6-1" index 6-1
icon: ''
},
{
id: 72,
label: '角色管理',
path: '/system/role', // index="6-2" index 6-2
icon: ''
}
]
},
//
{
id: 8,
label: '风控管理',
path: '/risk', // index="8"
icon: 'WarningFilled' // 对应 <WarningFilled /> 图标
},
const staticMenuList = ref<ElMenuItem[]>([
//
{
id: 1,
label: '首页',
path: 'dashboard', // el-menu-item index="dashboard"
icon: 'HomeFilled', // <HomeFilled />
},
//
// {
// id: 2,
// label: '',
// path: '2', // el-sub-menu index="2"
// icon: 'List', // <List />
// children: [
// {
// id: 21,
// label: '',
// path: '2-1', // el-menu-item index="2-1"
// icon: ''
// //
// }
// ]
// },
//
{
id: 3,
label: '账户管理',
path: 'account', // el-sub-menu index="account"
icon: 'UserFilled', // <UserFilled />
children: [
{
id: 31,
label: '客户管理',
path: '/account/client', // index="client"
icon: '',
},
{
id: 32,
label: '代理管理',
path: '/account/agentList', // index="3-2"
icon: '',
},
{
id: 33,
label: '做市商管理',
path: '/account/market-maker', // index="3-3"
icon: '',
},
{
id: 34,
label: '档案管理',
path: '/account/archives', // index="3-4"
icon: '',
},
{
id: 35,
label: '账号管理',
path: '/account/accountDetail', // index="3-5"
icon: '',
},
],
},
//
{
id: 4,
label: '交易管理',
path: '4', // index="4"
icon: 'Platform', // <Platform />
children: [
{
id: 41,
label: '品种',
path: '/trade/variety', // index="4-1"
icon: '',
},
{
id: 42,
label: '交易组',
path: '/trade/group', // index="4-2"
icon: '',
},
{
id: 43,
label: '持仓统计',
path: '/trade/positionStat', // index="4-3"
icon: '',
},
{
id: 44,
label: '历史交易',
path: '/trade/historyTrade', // index="4-4"
icon: '',
},
{
id: 45,
label: '交易软件',
path: '/trade/tradeSoftware', // index="4-5"
icon: '',
},
{
id: 46,
label: '交易时间',
path: '/trade/time', // index="4-3"
icon: '',
},
],
},
//
{
id: 5,
label: '公告管理',
path: '/notice', // index="5"
icon: 'BellFilled', // <BellFilled />
},
//
{
id: 6,
label: '资金管理',
path: '6', // index="6"
icon: 'GoodsFilled', // <GoodsFilled />
children: [
// {
// id: 61,
// label: '',
// path: '/funding/deposit', // index="6-1"
// icon: ''
// },
// {
// id: 62,
// label: '',
// path: '/funding/withdrawal', // index="6-2"
// icon: ''
// },
// {
// id: 63,
// label: '',
// path: '/funding/withdrawalDetail', // index="6-3"
// icon: ''
// },
// {
// id: 64,
// label: '',
// path: '/funding/depositDetail', // index="6-4"
// icon: ''
// },
{
id: 64,
label: '转账',
path: '/funding/transfer', // index="6-4"
icon: '',
},
{
id: 65,
label: '转账明细',
path: '/funding/transferDetail', // index="6-5"
icon: '',
},
{
id: 66,
label: '资金明细',
path: '/funding/fundDetail', // index="6-6"
icon: '',
},
// {
// id: 66,
// label: '',
// path: '/funding/flowDetail', // index="6-6"
// icon: ''
// },
// {
// id: 67,
// label: '',
// path: '/funding/receiverAccount', // index="6-7"
// icon: ''
// },
// {
// id: 68,
// label: '',
// path: '/funding/depositChannel', // index="6-8"
// icon: ''
// }
],
},
//
{
id: 7,
label: '系统管理',
path: 'system', // index="7"
icon: 'Tools', // <Tools />
children: [
{
id: 71,
label: '菜单管理',
path: '/system/menu', // index="6-1" index 6-1
icon: '',
},
{
id: 72,
label: '角色管理',
path: '/system/role', // index="6-2" index 6-2
icon: '',
},
{
id: 73,
label: '系统设置',
path: '/system/setting', // index="6-2" index 6-2
icon: '',
},
],
},
//
{
id: 8,
label: '风控管理',
path: '/risk', // index="8"
icon: 'WarningFilled', // <WarningFilled />
},
//
// {
// id: 9,
// label: '',
// path: 'funding', // index="funding"
// icon: 'GoodsFilled', // <GoodsFilled />
// children: [
// ///// /
// //
//
// {
// id: 9,
// label: '',
// path: 'funding', // index="funding"
// icon: 'GoodsFilled', // <GoodsFilled />
// children: [
// ///// /
// //
// ]
// },
//
// {
// id: 10,
// label: '',
// path: 'trade', // index="trade"
// icon: 'ChartBarFilled', // <ChartBarFilled />
// children: [
// //
// //
// //
// ]
// },
//
// {
// id: 11,
// label: '',
// path: 'account', // index="account"
// icon: 'UserFilled', // <UserFilled />
// children: [
// //
// //
// ]
// },
//
{
id: 12,
label: '个性化交易',
path: 'personalized', // index="personalized"
icon: 'SettingFilled', // <SettingFilled />
children: [
// app
//
{
id: 121,
label: '跟单记录',
path: '/personalized/followRecord', // index="12-1"
icon: ''
},
//
{
id: 122,
label: '带单记录',
path: '/personalized/leadRecord', // index="12-2"
icon: ''
},
]
},
//
{
id: 13,
label: '代理管理',
path: 'agent', // index="agent"
icon: 'UserFilled', // <UserFilled />
children: [
//
{
id: 132,
label: '客户列表',
path: '/agent/customerList', // index="13-2"
icon: ''
},
//
{
id: 133,
label: '客户交易订单',
path: '/agent/customerTradeOrder', // index="13-3"
icon: ''
},
//
{
id: 135,
label: '客户资金流水',
path: '/agent/customerCapitalFlow', // index="13-5"
icon: ''
},
]
},
//
{
id: 14,
label: '通知管理',
path: 'notification', // index="notification"
icon: 'NotificationFilled', // <NotificationFilled />
},
]
)
// ]
// },
//
// {
// id: 10,
// label: '',
// path: 'trade', // index="trade"
// icon: 'ChartBarFilled', // <ChartBarFilled />
// children: [
// //
// //
// //
// ]
// },
//
// {
// id: 11,
// label: '',
// path: 'account', // index="account"
// icon: 'UserFilled', // <UserFilled />
// children: [
// //
// //
// ]
// },
//
{
id: 12,
label: '个性化交易',
path: 'personalized', // index="personalized"
icon: 'SettingFilled', // <SettingFilled />
children: [
// app
//
{
id: 121,
label: '跟单记录',
path: '/personalized/followRecord', // index="12-1"
icon: '',
},
//
{
id: 122,
label: '带单记录',
path: '/personalized/leadRecord', // index="12-2"
icon: '',
},
],
},
//
{
id: 13,
label: '代理管理',
path: 'agent', // index="agent"
icon: 'UserFilled', // <UserFilled />
children: [
//
{
id: 132,
label: '客户列表',
path: '/agent/customerList', // index="13-2"
icon: '',
},
//
{
id: 133,
label: '客户交易订单',
path: '/agent/customerTradeOrder', // index="13-3"
icon: '',
},
//
{
id: 135,
label: '客户资金流水',
path: '/agent/customerCapitalFlow', // index="13-5"
icon: '',
},
],
},
//
{
id: 14,
label: '通知管理',
path: 'notification', // index="notification"
icon: 'NotificationFilled', // <NotificationFilled />
},
])
</script>
<style scoped lang="scss">
aside {
.sidebar-header {
height: 60px;
border-bottom: solid 1px var(--el-menu-border-color);
padding: 0 10px;
display: flex;
justify-content: space-between;
align-items: center;
.sidebar-header {
height: 60px;
border-bottom: solid 1px var(--el-menu-border-color);
padding: 0 10px;
display: flex;
justify-content: space-between;
align-items: center;
.logo {
display: flex;
align-items: center;
.logo {
display: flex;
align-items: center;
img {
width: 100px;
}
}
img {
width: 100px;
}
}
}
.menu {
height: 100%;
border: none;
:deep(.el-menu-item.is-active) {
background-color: var(--el-menu-hover-bg-color)
}
.menu {
height: 100%;
border: none;
:deep(.el-menu-item.is-active) {
background-color: var(--el-menu-hover-bg-color);
}
}
}
</style>

View File

@ -14,39 +14,39 @@ const routes = [
path: 'login',
name: 'Login',
component: () => import('@/views/user/Login.vue'),
meta: { isAuthPage: true, title: '登录' }
meta: { isAuthPage: true, title: '登录' },
},
{
path: 'register',
name: 'Register',
component: () => import('@/views/user/Register.vue'),
meta: { isAuthPage: true, title: '注册' }
meta: { isAuthPage: true, title: '注册' },
},
{
path: 'forgot-password',
name: 'ForgotPassword',
component: () => import('@/views/user/ForgotPassword.vue'),
meta: { isAuthPage: true, title: '忘记密码' }
meta: { isAuthPage: true, title: '忘记密码' },
},
{
path: 'change-password',
name: 'ChangePassword',
component: () => import('@/views/user/ChangePassword.vue'),
meta: { requiresAuth: true, title: '修改密码' }
meta: { requiresAuth: true, title: '修改密码' },
},
{
path: 'bind-email',
name: 'BindEmail',
component: () => import('@/views/user/bindEmail.vue'),
meta: { requiresAuth: true, title: '绑定邮箱' }
meta: { requiresAuth: true, title: '绑定邮箱' },
},
{
path: 'bind-phone',
name: 'BindPhone',
component: () => import('@/views/user/bindPhone.vue'),
meta: { requiresAuth: true, title: '绑定手机号' }
}
]
meta: { requiresAuth: true, title: '绑定手机号' },
},
],
},
// 带侧边栏布局的核心业务页面
{
@ -62,7 +62,7 @@ const routes = [
component: () => import('@/views/dashboard/index.vue'),
meta: {
title: '首页', // 左侧菜单显示的标题
}
},
},
// 系统管理
{
@ -78,7 +78,7 @@ const routes = [
component: () => import('@/views/system/menu/index.vue'),
meta: {
title: '菜单管理', // 左侧菜单显示的标题
}
},
},
{
path: 'role',
@ -86,9 +86,17 @@ const routes = [
component: () => import('@/views/system/role/index.vue'),
meta: {
title: '角色管理', // 左侧菜单显示的标题
}
}
]
},
},
{
path: 'setting',
name: 'Setting',
component: () => import('@/views/system/setting/index.vue'),
meta: {
title: '系统设置', // 左侧菜单显示的标题
},
},
],
},
//模板配置
{
@ -97,7 +105,7 @@ const routes = [
meta: {
title: '模板配置', // 左侧菜单显示的标题
},
children: []
children: [],
},
//账户管理
{
@ -113,7 +121,7 @@ const routes = [
component: () => import('@/views/account/client/index.vue'),
meta: {
title: '客户管理', // 左侧菜单显示的标题
}
},
},
{
path: 'agentList',
@ -121,7 +129,7 @@ const routes = [
component: () => import('@/views/account/agentList/index.vue'),
meta: {
title: '代理管理', // 左侧菜单显示的标题
}
},
},
{
path: 'market-maker',
@ -129,7 +137,7 @@ const routes = [
component: () => import('@/views/account/market-maker/index.vue'),
meta: {
title: '做市商管理', // 左侧菜单显示的标题
}
},
},
{
path: 'archives',
@ -137,7 +145,7 @@ const routes = [
component: () => import('@/views/account/archives/index.vue'),
meta: {
title: '档案管理', // 左侧菜单显示的标题
}
},
},
{
path: 'accountDetail',
@ -145,9 +153,9 @@ const routes = [
component: () => import('@/views/account/accountDetail/index.vue'),
meta: {
title: '账号管理', // 左侧菜单显示的标题
}
},
},
]
],
},
//交易管理
{
@ -163,7 +171,7 @@ const routes = [
component: () => import('@/views/trade/variety/index.vue'),
meta: {
title: '品种', // 左侧菜单显示的标题
}
},
},
{
path: 'group',
@ -171,7 +179,7 @@ const routes = [
component: () => import('@/views/trade/group/index.vue'),
meta: {
title: '交易组', // 左侧菜单显示的标题
}
},
},
{
path: 'time',
@ -179,7 +187,7 @@ const routes = [
component: () => import('@/views/trade/time/index.vue'),
meta: {
title: '交易时间', // 左侧菜单显示的标题
}
},
},
{
path: 'positionStat',
@ -187,7 +195,7 @@ const routes = [
component: () => import('@/views/trade/positionStat/index.vue'),
meta: {
title: '持仓统计', // 左侧菜单显示的标题
}
},
},
{
path: 'historyTrade',
@ -195,7 +203,7 @@ const routes = [
component: () => import('@/views/trade/historyTrade/index.vue'),
meta: {
title: '历史交易', // 左侧菜单显示的标题
}
},
},
{
path: 'tradeSoftware',
@ -203,9 +211,9 @@ const routes = [
component: () => import('@/views/trade/tradeSoftware/index.vue'),
meta: {
title: '交易软件', // 左侧菜单显示的标题
}
},
},
]
],
},
//公告管理
{
@ -230,7 +238,7 @@ const routes = [
component: () => import('@/views/funding/deposit/index.vue'),
meta: {
title: '存款审核', // 左侧菜单显示的标题
}
},
},
{
path: 'withdrawal',
@ -238,7 +246,7 @@ const routes = [
component: () => import('@/views/funding/withdrawl/index.vue'),
meta: {
title: '取款审核', // 左侧菜单显示的标题
}
},
},
{
path: 'withdrawalDetail',
@ -246,7 +254,7 @@ const routes = [
component: () => import('@/views/funding/withdrawalDetail/index.vue'),
meta: {
title: '取款明细', // 左侧菜单显示的标题
}
},
},
{
path: 'depositDetail',
@ -254,7 +262,7 @@ const routes = [
component: () => import('@/views/funding/depositDetail/index.vue'),
meta: {
title: '存款明细', // 左侧菜单显示的标题
}
},
},
{
path: 'transfer',
@ -262,7 +270,7 @@ const routes = [
component: () => import('@/views/funding/transfer/index.vue'),
meta: {
title: '转账', // 左侧菜单显示的标题
}
},
},
{
path: 'transferDetail',
@ -270,7 +278,7 @@ const routes = [
component: () => import('@/views/funding/transferDetail/index.vue'),
meta: {
title: '转账明细', // 左侧菜单显示的标题
}
},
},
{
path: 'capitalFlow',
@ -278,7 +286,7 @@ const routes = [
component: () => import('@/views/funding/capitalFlow/index.vue'),
meta: {
title: '资金流水', // 左侧菜单显示的标题
}
},
},
{
path: 'receiverAccount',
@ -286,7 +294,7 @@ const routes = [
component: () => import('@/views/funding/receiverAccount/index.vue'),
meta: {
title: '收款账户列表', // 左侧菜单显示的标题
}
},
},
{
path: 'depositChannel',
@ -294,7 +302,7 @@ const routes = [
component: () => import('@/views/funding/depositChannel/index.vue'),
meta: {
title: '存款渠道列表', // 左侧菜单显示的标题
}
},
},
{
path: 'fundDetail',
@ -302,9 +310,9 @@ const routes = [
component: () => import('@/views/funding/fundDetail/index.vue'),
meta: {
title: '资金明细', // 左侧菜单显示的标题
}
},
},
]
],
},
{
path: 'risk',
@ -329,7 +337,7 @@ const routes = [
component: () => import('@/views/personalized/followRecord/index.vue'),
meta: {
title: '跟单记录', // 左侧菜单显示的标题
}
},
},
// 带单记录
{
@ -338,9 +346,9 @@ const routes = [
component: () => import('@/views/personalized/leadRecord/index.vue'),
meta: {
title: '带单记录', // 左侧菜单显示的标题
}
},
},
]
],
},
//代理管理
{
@ -357,7 +365,7 @@ const routes = [
component: () => import('@/views/agent/customerList/index.vue'),
meta: {
title: '客户列表', // 左侧菜单显示的标题
}
},
},
//客户详情
{
@ -366,7 +374,7 @@ const routes = [
component: () => import('@/views/agent/customerDetail/index.vue'),
meta: {
title: '客户详情', // 左侧菜单显示的标题
}
},
},
//客户交易订单
{
@ -375,7 +383,7 @@ const routes = [
component: () => import('@/views/agent/customerTradeOrder/index.vue'),
meta: {
title: '客户交易订单', // 左侧菜单显示的标题
}
},
},
//客户资金流水
{
@ -384,17 +392,17 @@ const routes = [
component: () => import('@/views/agent/customerCapitalFlow/index.vue'),
meta: {
title: '客户资金流水', // 左侧菜单显示的标题
}
},
},
]
],
},
]
],
},
{
path: '/:pathMatch(.*)*',
redirect: '/user/login' // 404 重定向到登录页,避免循环
}
];
redirect: '/user/login', // 404 重定向到登录页,避免循环
},
]
const router = createRouter({
history: createWebHistory(),
@ -429,4 +437,4 @@ router.afterEach((to) => {
}
});
export default router;
export default router;

View File

@ -0,0 +1,156 @@
<template>
<div class="system">
<!-- 菜单列表头 -->
<MenuHeader :title="menuTitle" :buttons="menuHeaderButtons" @click="handleAddMenu" />
<!-- 菜单列表表格 -->
<MenuTable :table-data="menuTree" :columns="menuTableColumns" row-key="id">
<template #action="{ row }">
<el-button link type="primary" size="small" @click="handleEditMenu(row)"> 编辑 </el-button>
</template>
</MenuTable>
</div>
<!-- 新增/编辑弹窗 -->
<MenuDialog
:visible="dialogVisible"
:title="dialogTitle"
:type="dialogType"
@confirm="handleSubmit"
@cancel="handleCancel"
@close="handleClose"
>
<MenuForm
:form-data="menuForm"
:form-rules="menuFormRules"
:form-items="menuFormItemOptions"
ref="menuFormRef"
/>
</MenuDialog>
</template>
<script lang="ts" setup>
import type { FormInstance } from 'element-plus'
import { Plus } from '@element-plus/icons-vue'
//
import MenuHeader from '@/components/common/Header.vue'
import MenuTable from '@/components/common/Table.vue'
import MenuDialog from '@/components/common/Dialog.vue'
import MenuForm from '@/components/common/Form.vue'
import { menuTableColumns, menuFormItemOptions } from './options'
import { rules } from './rules'
import { getSettingApi, createSettingApi, editSettingApi } from '@/api/modules/system/setting'
type SettingItem = {
id: number
key: string
value: string
description: string
}
// header
const menuTitle = ref('系统设置')
const menuHeaderButtons = [
{ label: '新增设置', type: 'primary' as const, icon: Plus, key: 'addMenu' },
]
//
const menuTree = ref<SettingItem[]>([])
//
const dialogVisible = ref(false)
const dialogTitle = ref('')
const dialogType = ref('add')
//
const menuForm = ref({
key: '',
value: '',
description: '',
})
const menuFormRef = ref<FormInstance>()
//
const menuFormRules = rules()
/**
@description: 新增菜单
**/
const handleAddMenu = () => {
dialogVisible.value = true
dialogTitle.value = '新增菜单'
menuFormItemOptions[0]!.disabled = false
}
/**
@description: 菜单数据处理
**/
//
const fetchSettingList = async () => {
try {
const data = await getSettingApi()
menuTree.value = data
} catch (err) {
console.error('获取菜单列表失败', err)
}
}
//
onMounted(async () => {
await fetchSettingList()
})
/**
@description: 处理菜单编辑/删除/状态切换
**/
const handleEditMenu = (row: SettingItem) => {
dialogVisible.value = true
menuFormItemOptions[0]!.disabled = true
dialogTitle.value = '编辑菜单'
dialogType.value = 'edit'
menuForm.value = {
...row
}
}
/**
@description: 处理弹窗提交/取消/关闭事件
**/
const handleSubmit = async () => {
console.log('提交菜单表单')
try {
await menuFormRef.value?.validate()
if (dialogType.value === 'add') {
const params = {
key: menuForm.value.key,
value: menuForm.value.value,
description: menuForm.value.description,
}
await createSettingApi(params)
await fetchSettingList()
} else {
await editSettingApi(menuForm.value)
console.log('编辑菜单成功', menuForm.value)
await fetchSettingList()
}
dialogVisible.value = false
} catch (err) {
console.log('表单验证失败', err)
return
}
}
const handleCancel = () => {
dialogVisible.value = false
dialogType.value = 'add'
menuForm.value = {
key: '',
value: '',
description: '',
}
}
const handleClose = () => {
dialogVisible.value = false
dialogType.value = 'add'
menuForm.value = {
key: '',
value: '',
description: '',
}
}
</script>

View File

@ -0,0 +1,19 @@
//定义table配置
export const menuTableColumns = [
{ prop: 'key', label: 'key', align: 'center' as const },
{ prop: 'value', label: 'value', align: 'center' as const },
{ prop: 'description', label: '备注', align: 'center' as const },
{ label: '操作', slotName: 'action', align: 'center' as const },
]
//定义menuForm配置
export const menuFormItemOptions = [
{ prop: 'key', label: 'key', type: 'input' as const, placeholder: '请输入key', disabled: false },
{ prop: 'value', label: 'value', type: 'input' as const, placeholder: '请选择value' },
{
prop: 'description',
label: 'description',
type: 'input' as const,
placeholder: '请选择description',
},
]

View File

@ -0,0 +1,9 @@
import type { FormRules } from 'element-plus'
export const rules = (): FormRules => {
return {
key: [{ required: true, message: '请选择key', trigger: 'blur' }],
value: [{ required: true, message: '请选择value', trigger: 'blur' }],
description: [{ required: true, message: '请选择备注', trigger: 'blur' }],
}
}

View File

@ -1,6 +1,6 @@
<template>
<div class="trade-group">
<el-form-item label="交易系统时间设置">
<el-form-item label="交易时间设置">
<el-button type="primary" @click="addTableItem">添加</el-button>
</el-form-item>
<!-- 表格 -->

View File

@ -1,6 +1,6 @@
<template>
<div class="trade-group">
<el-form-item label="交易系统时间设置">
<el-form-item label="交易节假日时间设置">
<el-button style="margin-left: 18px" type="primary" @click="handleAdd">添加</el-button>
<el-button style="margin-left: 18px" type="danger" @click="handleDel">删除</el-button>
</el-form-item>
@ -18,33 +18,43 @@
</thead>
<tbody>
<tr>
<tr v-for="(item, index) in dataList" :key="`${item.id}-${index}`">
<td>
<el-input style="width: 80px" />
<el-input v-model="item.name" style="width: 80px" />
</td>
<td>
<el-date-picker
v-model="item.datePicker"
type="datetimerange"
start-placeholder="Start date"
end-placeholder="End date"
start-placeholder="休市开始时间"
end-placeholder="休市结束时间"
format="YYYY-MM-DD HH:mm:ss"
date-format="YYYY-MM-DD HH:mm:ss"
time-format="YYYY-MM-DD HH:mm:ss"
value-format="YYYY-MM-DD HH:mm:ss"
/>
</td>
<td>
<el-select multiple placeholder="Select" style="width: 240px">
<el-option :label="1" :value="1" />
<el-option :label="2" :value="2" />
<el-option :label="3" :value="3" />
<el-option :label="4" :value="4" />
<el-option :label="5" :value="5" />
<el-select
multiple
placeholder="请选择休市市场"
style="width: 240px"
v-model="item.groupId"
>
<el-option
v-for="item in marketList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</td>
<td><el-input style="width: 250px" /></td>
<td><el-input style="width: 250px" v-model="item.description" /></td>
<td>
<el-button type="primary" @click="handleAdd">确认</el-button>
<el-button type="danger" @click="handleDel">取消</el-button>
<el-button type="primary" v-if="!item.editStatus" @click="item.editStatus = true">编辑</el-button>
<el-button type="danger" v-if="!item.editStatus" @click="handleDel(item.id)">删除</el-button>
<el-button type="primary" v-if="item.editStatus" @click="submitItem(index)">确认</el-button>
<el-button type="danger" v-if="item.editStatus" @click="item.editStatus = false">取消</el-button>
</td>
</tr>
</tbody>
@ -54,61 +64,100 @@
</template>
<script setup lang="ts">
//
import { ref, onMounted } from 'vue'
import { getGroupListApi } from '@/api/modules/trade/group'
import { getHolidayList, addHoliday, editHoliday, delHoliday } from '@/api/modules/trade/time'
import { ElMessageBox } from 'element-plus'
//
type DataItem = {
id?: number | string
name: string
start_time?: string
end_time?: string
datePicker: string[]
groupId: number[]
description: string
editStatus: boolean
}
/**
* @description: 定义表格数据
*/
const dataList = ref<DataItem[]>([])
/**
* @description: 定义弹窗数据
*/
const dialogVisible = ref(false)
const dialogTitle = ref('')
const dialogType = ref('')
const marketList = ref<{ label: string; value: number | string }[]>([])
/**
* @description: 定义弹窗表格数据
*/
const tradeGroupForm = ref({
//
tradeGroupName: '',
// ID
exchangeId: '',
//
status: 1,
//
winterTime: [],
//
summerTime: [],
//
sort: 0,
// ID
id: '',
})
const getMarketList = async () => {
getGroupListApi().then((res) => {
console.log(res)
marketList.value = res.map((item: { name: string; id: number }[]) => ({
label: item.name,
value: item.id + '',
}))
})
}
const initDate = () => {
getHolidayList().then((res) => {
dataList.value = res.map((item: any) => ({
id: item.id + '',
name: item.name,
start_time: item.start_time,
end_time: item.end_time,
datePicker: [item.start_time, item.end_time],
groupId: item.group_id,
description: item.description,
editStatus: false,
}))
})
}
const handleAdd = () => {
dataList.value.unshift({
name: '',
start_time: '',
end_time: '',
datePicker: [],
groupId: [],
description: '',
editStatus: true,
})
}
const submitItem = (idx: number) => {
const submitObj = {
name: dataList.value[idx]!.name,
start_time: dataList.value[idx]!.datePicker[0],
end_time: dataList.value[idx]!.datePicker[1],
group_id: dataList.value[idx]!.groupId.join(','),
description: dataList.value[idx]!.description,
}
if (dataList.value[idx]!.id) {
editHoliday({id: dataList.value[idx]!.id, ...submitObj}).then(() => {
initDate()
})
} else {
addHoliday(submitObj).then(() => {
initDate()
})
}
}
const handleDel = (id: number | string) => {
ElMessageBox.confirm('确认删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
}).then(() => {
delHoliday({id}).then(() => {
initDate()
})
})
}
/**
* @description: 页面加载完成需要请求的数据
*/
onMounted(() => {})
const handleAdd = () => {
dialogVisible.value = true
dialogTitle.value = '添加交易组'
dialogType.value = 'add'
tradeGroupForm.value = {
tradeGroupName: '',
winterTime: [],
summerTime: [],
status: 1,
sort: 0,
id: '',
} as any
}
const handleDel = () => {}
onMounted(() => {
getMarketList()
initDate()
})
</script>
<style scoped lang="scss">