存储设置列表接口对接

This commit is contained in:
Mrtangl 2022-06-22 19:03:05 +08:00
parent f36911f3c8
commit eddc1db493
4 changed files with 113 additions and 18 deletions

View File

@ -83,3 +83,25 @@ export function apiAuthAdminEditSelf(params: any) {
export function apiAuthAdminMySelf() {
return request.post('/auth.admin/mySelf')
}
/** S 存储设置 **/
// 存储列表
export function apiStorageLists() {
return request.get('/setting/storage/list')
}
// 存储切换
export function apiStorageChange(params: any) {
return request.post('/setting/storage/change', params)
}
// 存储详情
export function apiStorageDetail(params: any) {
return request.get('/setting/storage/detail', { params })
}
// 存储配置
export function apiStorageEdit(params: any) {
return request.post('/setting/storage/edit', params)
}
/** E 存储设置 **/

View File

@ -21,7 +21,7 @@ export const constantRoutes: Array<RouteRecordRaw> = [
path: '/',
redirect: 'workbench',
name: 'index',
component: Layout
component: Layout,
},
{
@ -31,19 +31,19 @@ export const constantRoutes: Array<RouteRecordRaw> = [
{
path: 'admin/edit',
component: () => import('@/views/permission/admin/edit.vue'),
meta: { title: '编辑管理员', activeMenu: '/permission/admin' }
meta: { title: '编辑管理员', activeMenu: '/permission/admin' },
},
{
path: 'menu/edit',
component: () => import('@/views/permission/menu/edit.vue'),
meta: { title: '编辑菜单', activeMenu: '/permission/menu' }
meta: { title: '编辑菜单', activeMenu: '/permission/menu' },
},
{
path: 'role/edit',
component: () => import('@/views/permission/role/edit.vue'),
meta: { title: '编辑角色', activeMenu: '/permission/role' }
}
]
meta: { title: '编辑角色', activeMenu: '/permission/role' },
},
],
},
{
path: '/organize',
@ -52,27 +52,38 @@ export const constantRoutes: Array<RouteRecordRaw> = [
{
path: 'department/edit',
component: () => import('@/views/organize/department/edit.vue'),
meta: { title: '编辑部门', activeMenu: '/organize/department' }
meta: { title: '编辑部门', activeMenu: '/organize/department' },
},
{
path: 'post/edit',
component: () => import('@/views/organize/post/edit.vue'),
meta: { title: '编辑岗位', activeMenu: '/organize/post' }
}
]
meta: { title: '编辑岗位', activeMenu: '/organize/post' },
},
],
},
{
path: '/setting',
component: Layout,
children: [
{
path: 'storage/edit',
component: () => import('@/views/setting/storage/edit.vue'),
meta: { title: '存储设置', activeMenu: '/setting/storage' },
},
],
},
{
path: '/login',
component: () => import('@/views/account/login.vue')
component: () => import('@/views/account/login.vue'),
},
{
path: '/500',
component: () => import('@/views/error/500.vue')
component: () => import('@/views/error/500.vue'),
},
{
path: '/:pathMatch(.*)*',
component: () => import('@/views/error/404.vue')
}
component: () => import('@/views/error/404.vue'),
},
]
const router = createRouter({
@ -84,7 +95,7 @@ const router = createRouter({
} else {
return { top: 0 }
}
}
},
})
export default router

View File

@ -2,6 +2,6 @@
<div>存储edit</div>
</template>
<script></script>
<script setup lang="ts"></script>
<style></style>
<style lang="scss" scoped></style>

View File

@ -10,9 +10,71 @@
>
</el-alert>
</el-card>
<el-card class="m-t-15" shadow="never">
<el-table :data="storageLists" class="m-t-20" size="small">
<el-table-column label="储存方式" prop="alias"></el-table-column>
<el-table-column label="储存位置" prop="describe"> </el-table-column>
<el-table-column label="状态">
<template #default="{ row }">
<el-switch
v-model="row.status"
:active-value="1"
:inactive-value="0"
@change="handleChange(row)"
/>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right">
<template #default="scope">
<router-link
class="m-r-10"
:to="{
path: '/setting/storage/edit',
query: {
engine: scope.row.engine,
},
}"
>
<el-button type="text">设置</el-button>
</router-link>
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</template>
<script setup lang="ts"></script>
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { ElMessage } from 'element-plus'
import { apiStorageLists, apiStorageChange } from '@/api/setting'
//
let storageLists = ref<any>([])
//
const getStorageLists = async () => {
storageLists.value = await apiStorageLists()
}
//
const handleChange = async (event: any) => {
await apiStorageChange({
alias: event.alias,
status: event.status,
}).then(() => {
ElMessage({ type: 'success', message: '切换成功' })
})
getStorageLists()
}
onMounted(() => {
getStorageLists()
})
</script>
<style lang="scss" scoped></style>