From 5e019d12c391073be39b133e8df5f9c174278d91 Mon Sep 17 00:00:00 2001
From: lzq <2495532633@qq.com>
Date: Fri, 12 Dec 2025 14:56:31 +0800
Subject: [PATCH] 1
---
src/common/router/index.ts | 8 -
src/dts/components.d.ts | 3 +-
src/pages/sys/endpoint/Endpoint.vue | 193 ++++++++++++++++++++++++
src/pages/sys/endpoint/EndpointForm.vue | 162 ++++++++++++++++++++
src/pages/sys/endpoint/endpoint-api.ts | 22 +++
src/pages/sys/endpoint/endpoint.d.ts | 65 ++++++++
src/pages/sys/endpoint/page.ts | 3 +
src/pages/sys/menus/MenuForm.vue | 3 +
src/pages/sys/resource/resource-api.ts | 8 +-
src/pages/sys/role/BindRes.vue | 43 ++++--
10 files changed, 488 insertions(+), 22 deletions(-)
create mode 100644 src/pages/sys/endpoint/Endpoint.vue
create mode 100644 src/pages/sys/endpoint/EndpointForm.vue
create mode 100644 src/pages/sys/endpoint/endpoint-api.ts
create mode 100644 src/pages/sys/endpoint/endpoint.d.ts
create mode 100644 src/pages/sys/endpoint/page.ts
diff --git a/src/common/router/index.ts b/src/common/router/index.ts
index 53e088b..693c694 100644
--- a/src/common/router/index.ts
+++ b/src/common/router/index.ts
@@ -105,14 +105,6 @@ export function reloadRouter() {
const routNames = useAppSettingStore()
.menus.filter((it) => it.menuCategory === MenuCategory.Page || it.menuCategory === MenuCategory.SubPage)
.map((it) => it.routeName)
-
- routNames.push('menus')
- routNames.push('user')
- routNames.push('role')
- routNames.push('dict')
- routNames.push('db-table')
- routNames.push('tpl')
-
if (Colls.isEmpty(routNames)) {
return false
}
diff --git a/src/dts/components.d.ts b/src/dts/components.d.ts
index 23ff205..60da430 100644
--- a/src/dts/components.d.ts
+++ b/src/dts/components.d.ts
@@ -5,6 +5,7 @@
// ------
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
+import { GlobalComponents } from 'vue'
export {}
@@ -105,4 +106,4 @@ declare global {
const ElUpload: typeof import('element-plus/es')['ElUpload']
const RouterLink: typeof import('vue-router')['RouterLink']
const RouterView: typeof import('vue-router')['RouterView']
-}
+}
\ No newline at end of file
diff --git a/src/pages/sys/endpoint/Endpoint.vue b/src/pages/sys/endpoint/Endpoint.vue
new file mode 100644
index 0000000..50ddf4b
--- /dev/null
+++ b/src/pages/sys/endpoint/Endpoint.vue
@@ -0,0 +1,193 @@
+
+
+
+
+
+
+
+
+ 搜索
+ 重置
+
+
+
+
+ 新建
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 删除
+
+
+ 修改
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/sys/endpoint/EndpointForm.vue b/src/pages/sys/endpoint/EndpointForm.vue
new file mode 100644
index 0000000..da12643
--- /dev/null
+++ b/src/pages/sys/endpoint/EndpointForm.vue
@@ -0,0 +1,162 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ status === 'view' ? '关闭' : '取消' }}
+ 提交
+
+
+
+
+
+
+
diff --git a/src/pages/sys/endpoint/endpoint-api.ts b/src/pages/sys/endpoint/endpoint-api.ts
new file mode 100644
index 0000000..e79e1e6
--- /dev/null
+++ b/src/pages/sys/endpoint/endpoint-api.ts
@@ -0,0 +1,22 @@
+import {
+ get,
+ post,
+} from '@/common/utils/http-util.ts'
+
+export default {
+ paging(data: EndpointTypes.SearchEndpointParam) {
+ return get>('/endpoint/paging', data)
+ },
+ detail(id: string) {
+ return get('/endpoint/detail', {id})
+ },
+ add(data: EndpointTypes.AddEndpointParam) {
+ return post('/endpoint/add', data)
+ },
+ modify(data: EndpointTypes.ModifyEndpointParam) {
+ return post('/endpoint/modify', data)
+ },
+ del(ids: string[]) {
+ return post('/endpoint/del', ids)
+ },
+}
diff --git a/src/pages/sys/endpoint/endpoint.d.ts b/src/pages/sys/endpoint/endpoint.d.ts
new file mode 100644
index 0000000..b100f4a
--- /dev/null
+++ b/src/pages/sys/endpoint/endpoint.d.ts
@@ -0,0 +1,65 @@
+export {}
+
+declare global {
+ namespace EndpointTypes {
+ interface SearchEndpointParam extends G.PageParam {
+ // Id
+ id?: string
+ // 请求方式;字典代码:request_method
+ requestMethod?: string
+ // 路由前缀; 以 / 开头 或 为空
+ routingPath?: string
+ // 端点地址; 以 / 开头, Ant 匹配模式
+ endpointPath?: string
+ // 接口访问模式;字典代码:endpoint_access_model
+ accessModel?: string
+ // 备注
+ memo?: string
+ }
+
+ interface SearchEndpointResult {
+ // Id
+ id?: string
+ // 请求方式;字典代码:request_method
+ requestMethod?: string
+ // 路由前缀; 以 / 开头 或 为空
+ routingPath?: string
+ // 端点地址; 以 / 开头, Ant 匹配模式
+ endpointPath?: string
+ // 接口访问模式;字典代码:endpoint_access_model
+ accessModel?: string
+ // 备注
+ memo?: string
+ }
+
+ interface AddEndpointParam {
+ // Id
+ id?: string
+ // 请求方式;字典代码:request_method
+ requestMethod?: string
+ // 路由前缀; 以 / 开头 或 为空
+ routingPath?: string
+ // 端点地址; 以 / 开头, Ant 匹配模式
+ endpointPath?: string
+ // 接口访问模式;字典代码:endpoint_access_model
+ accessModel?: string
+ // 备注
+ memo?: string
+ }
+
+ interface ModifyEndpointParam {
+ // Id
+ id?: string
+ // 请求方式;字典代码:request_method
+ requestMethod?: string
+ // 路由前缀; 以 / 开头 或 为空
+ routingPath?: string
+ // 端点地址; 以 / 开头, Ant 匹配模式
+ endpointPath?: string
+ // 接口访问模式;字典代码:endpoint_access_model
+ accessModel?: string
+ // 备注
+ memo?: string
+ }
+ }
+}
diff --git a/src/pages/sys/endpoint/page.ts b/src/pages/sys/endpoint/page.ts
new file mode 100644
index 0000000..5c51f4d
--- /dev/null
+++ b/src/pages/sys/endpoint/page.ts
@@ -0,0 +1,3 @@
+export default {
+ component: () => import('@/pages/sys/endpoint/Endpoint.vue'),
+} as RouterTypes.RouteConfig
\ No newline at end of file
diff --git a/src/pages/sys/menus/MenuForm.vue b/src/pages/sys/menus/MenuForm.vue
index ba5db9e..4881957 100644
--- a/src/pages/sys/menus/MenuForm.vue
+++ b/src/pages/sys/menus/MenuForm.vue
@@ -83,6 +83,7 @@ import {
} from '@/components/a-icon/iconfont.ts'
import AIcon from '@/components/a-icon/AIcon.tsx'
import ClientUtil from '@/common/utils/client-util.ts'
+import Utils from '@/common/utils'
const emits = defineEmits([ 'editSucc' ])
@@ -177,6 +178,8 @@ defineExpose({
}) {
if (!Strings.isBlank(data.id)) {
status.value = 'modify'
+ data = Utils.clone(data)
+ data.clients = ClientUtil.getClients(data.clientCode!).map(it => it.val)
menuForm.value = data
} else {
menuForm.value = {
diff --git a/src/pages/sys/resource/resource-api.ts b/src/pages/sys/resource/resource-api.ts
index ddeea86..5857c25 100644
--- a/src/pages/sys/resource/resource-api.ts
+++ b/src/pages/sys/resource/resource-api.ts
@@ -1,10 +1,10 @@
import { get } from '@/common/utils/http-util.ts'
export default {
- list(data?: ResourceTypes.SearchResourceParam) {
- return get('/resource/list', data)
+ list(tableName: string, keywords?: string) {
+ return get('/resource/list', {keywords, tableName})
},
- listRoleRes(roleId: string) {
- return get('/resource/list_role_res', {roleId})
+ listRoleRes(roleId: string, tableName: string) {
+ return get('/resource/list_role_res', {roleId, tableName})
},
}
diff --git a/src/pages/sys/role/BindRes.vue b/src/pages/sys/role/BindRes.vue
index ab9664e..e1a1004 100644
--- a/src/pages/sys/role/BindRes.vue
+++ b/src/pages/sys/role/BindRes.vue
@@ -30,6 +30,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
取消
@@ -57,6 +75,21 @@ function filterMethod(query: string, item: TransferDataItem) {
return Strings.isBlank(query) || (item as ResourceTypes.SearchResourceResult).memo!.includes(query) || (item as ResourceTypes.SearchResourceResult).memo!.includes(query)
}
+const resourceOrigin = ref<'sys_menu' | 'sys_endpoint'>('sys_menu')
+
+function resourceOriginChangeHandle(val: 'sys_menu' | 'sys_endpoint') {
+ ResourceApi.listRoleRes(currentUserId.value, val)
+ .then(res => {
+ hadRes.value = res.data ?? []
+ rightValue.value = hadRes.value.map(it => it.id!)
+ })
+
+ ResourceApi.list(val)
+ .then(res => {
+ allRes.value = res.data ?? []
+ })
+}
+
function submitHandler() {
submiting.value = true
RoleApi.bindRes({
@@ -75,15 +108,7 @@ defineExpose({
open(roleId: string) {
currentUserId.value = roleId
showDialog.value = true
- ResourceApi.listRoleRes(roleId)
- .then(res => {
- hadRes.value = res.data ?? []
- rightValue.value = hadRes.value.map(it => it.id!)
- })
- ResourceApi.list()
- .then(res => {
- allRes.value = res.data ?? []
- })
+ resourceOriginChangeHandle(resourceOrigin.value)
},
})