Skip to content

Commit 1e6f96e

Browse files
committed
feat: 增加参数管理功能,调整菜单选择组件。
1 parent a48ff1f commit 1e6f96e

File tree

3 files changed

+146
-18
lines changed

3 files changed

+146
-18
lines changed

web/src/api/sysParams.js

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
import service from '@/utils/request'
2+
// @Tags SysParams
3+
// @Summary 创建参数
4+
// @Security ApiKeyAuth
5+
// @accept application/json
6+
// @Produce application/json
7+
// @Param data body model.SysParams true "创建参数"
8+
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
9+
// @Router /sysParams/createSysParams [post]
10+
export const createSysParams = (data) => {
11+
return service({
12+
url: '/sysParams/createSysParams',
13+
method: 'post',
14+
data
15+
})
16+
}
17+
18+
// @Tags SysParams
19+
// @Summary 删除参数
20+
// @Security ApiKeyAuth
21+
// @accept application/json
22+
// @Produce application/json
23+
// @Param data body model.SysParams true "删除参数"
24+
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
25+
// @Router /sysParams/deleteSysParams [delete]
26+
export const deleteSysParams = (params) => {
27+
return service({
28+
url: '/sysParams/deleteSysParams',
29+
method: 'delete',
30+
params
31+
})
32+
}
33+
34+
// @Tags SysParams
35+
// @Summary 批量删除参数
36+
// @Security ApiKeyAuth
37+
// @accept application/json
38+
// @Produce application/json
39+
// @Param data body request.IdsReq true "批量删除参数"
40+
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
41+
// @Router /sysParams/deleteSysParams [delete]
42+
export const deleteSysParamsByIds = (params) => {
43+
return service({
44+
url: '/sysParams/deleteSysParamsByIds',
45+
method: 'delete',
46+
params
47+
})
48+
}
49+
50+
// @Tags SysParams
51+
// @Summary 更新参数
52+
// @Security ApiKeyAuth
53+
// @accept application/json
54+
// @Produce application/json
55+
// @Param data body model.SysParams true "更新参数"
56+
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
57+
// @Router /sysParams/updateSysParams [put]
58+
export const updateSysParams = (data) => {
59+
return service({
60+
url: '/sysParams/updateSysParams',
61+
method: 'put',
62+
data
63+
})
64+
}
65+
66+
// @Tags SysParams
67+
// @Summary 用id查询参数
68+
// @Security ApiKeyAuth
69+
// @accept application/json
70+
// @Produce application/json
71+
// @Param data query model.SysParams true "用id查询参数"
72+
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
73+
// @Router /sysParams/findSysParams [get]
74+
export const findSysParams = (params) => {
75+
return service({
76+
url: '/sysParams/findSysParams',
77+
method: 'get',
78+
params
79+
})
80+
}
81+
82+
// @Tags SysParams
83+
// @Summary 分页获取参数列表
84+
// @Security ApiKeyAuth
85+
// @accept application/json
86+
// @Produce application/json
87+
// @Param data query request.PageInfo true "分页获取参数列表"
88+
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
89+
// @Router /sysParams/getSysParamsList [get]
90+
export const getSysParamsList = (params) => {
91+
return service({
92+
url: '/sysParams/getSysParamsList',
93+
method: 'get',
94+
params
95+
})
96+
}
97+
98+
// @Tags SysParams
99+
// @Summary 不需要鉴权的参数接口
100+
// @accept application/json
101+
// @Produce application/json
102+
// @Param data query systemReq.SysParamsSearch true "分页获取参数列表"
103+
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
104+
// @Router /sysParams/getSysParam [get]
105+
export const getSysParam = (params) => {
106+
return service({
107+
url: '/sysParams/getSysParam',
108+
method: 'get',
109+
params
110+
})
111+
}

web/src/utils/dictionary.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { useDictionaryStore } from '@/pinia/modules/dictionary'
2+
import { getSysParam } from '@/api/sysParams'
23
// 获取字典方法 使用示例 getDict('sex').then(res) 或者 async函数下 const res = await getDict('sex')
34
export const getDict = async(type) => {
45
const dictionaryStore = useDictionaryStore()
@@ -24,3 +25,11 @@ export const showDictLabel = (
2425
})
2526
return Reflect.has(dictMap, code) ? dictMap[code] : ''
2627
}
28+
29+
30+
export const getParams = async (key)=>{
31+
const res = await getSysParam({key})
32+
if(res.code === 0){
33+
return res.data.value
34+
}
35+
}

web/src/view/superAdmin/menu/components/components-cascader.vue

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
1+
<template>
2+
<div class="flex justify-between items-center gap-2 w-full">
3+
<el-cascader
4+
v-if="pathIsSelect"
5+
placeholder="请选择文件路径"
6+
:options="pathOptions"
7+
v-model="activeComponent"
8+
filterable
9+
class="w-full"
10+
clearable
11+
@change="emitChange"
12+
/>
13+
<el-input v-else v-model="tempPath" placeholder="页面:view/xxx/xx.vue 插件:plugin/xx/xx.vue" @change="emitChange" />
14+
<el-button @click="togglePathIsSelect">{{ pathIsSelect ? '手动输入' : '快捷选择' }} </el-button>
15+
</div>
16+
</template>
17+
18+
119
<script setup>
220
import { onMounted, ref } from "vue";
3-
import { useToggle } from "@vueuse/core";
421
import pathInfo from "@/pathInfo.json";
522
623
const props = defineProps({
@@ -18,6 +35,13 @@ const activeComponent = ref('')
1835
const pathIsSelect = ref(true)
1936
2037
const togglePathIsSelect = () => {
38+
if(pathIsSelect.value){
39+
tempPath.value = activeComponent.value?.join('/')
40+
}else{
41+
activeComponent.value = tempPath.value.split('/')
42+
console.log(activeComponent.value)
43+
}
44+
2145
pathIsSelect.value = !pathIsSelect.value
2246
emitChange()
2347
}
@@ -89,23 +113,7 @@ const emitChange = () => {
89113
}
90114
</script>
91115
92-
<template>
93-
<div class="flex justify-between items-center gap-2 w-full">
94-
<el-cascader
95-
v-if="pathIsSelect"
96-
placeholder="请选择文件路径"
97-
:options="pathOptions"
98-
v-model="activeComponent"
99-
filterable
100-
class="w-full"
101-
clearable
102-
@change="emitChange"
103-
/>
104-
<el-input v-else v-model="tempPath" placeholder="页面:view/xxx/xx.vue 插件:plugin/xx/xx.vue" @change="emitChange" />
105-
<el-button @click="togglePathIsSelect" size="small">{{ pathIsSelect ? '没找到我的菜单' : '切换至菜单选择' }} </el-button>
106-
</div>
107-
</template>
108116
109117
<style scoped lang="scss">
110118
111-
</style>
119+
</style>

0 commit comments

Comments
 (0)