存储空间后台联调
This commit is contained in:
parent
d9bace9591
commit
7bcfe180ad
39
web/src/api/storage/index.ts
Normal file
39
web/src/api/storage/index.ts
Normal file
@ -0,0 +1,39 @@
|
||||
import request from '@/utils/request';
|
||||
//新增储存源
|
||||
export function storage(params:any) {
|
||||
return request({
|
||||
url: '/admin/storage',
|
||||
method: 'post',
|
||||
data:params
|
||||
});
|
||||
}
|
||||
//查询存储元
|
||||
export function storagesPage(params:any) {
|
||||
return request({
|
||||
url: '/admin/storagesPage',
|
||||
method: 'get',
|
||||
params:params
|
||||
});
|
||||
}
|
||||
//编辑查询
|
||||
export function storage2(params:any) {
|
||||
return request({
|
||||
url: '/admin/storage/'+params.id,
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
//删除存储源
|
||||
export function storagestorageId(params:any) {
|
||||
return request({
|
||||
url: '/admin/storage/'+params,
|
||||
method: 'delete',
|
||||
});
|
||||
}
|
||||
//出巡储存元
|
||||
export function storagesBytype(params:any) {
|
||||
return request({
|
||||
url: '/admin/storagesBytype',
|
||||
method: 'get',
|
||||
params:params
|
||||
});
|
||||
}
|
@ -9,22 +9,30 @@ import { onMounted, ref } from "vue";
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { getDict } from '@/api/dict'
|
||||
import Page from '@/components/Pagination/page.vue'
|
||||
import { storage, storagesPage, storage2, storagestorageId,storagesBytype } from "@/api/storage";
|
||||
//定义表格数据
|
||||
const tableData: any = ref([]);
|
||||
// 查询数据
|
||||
const queryParams: any = ref({
|
||||
current: 1,
|
||||
size: 20,
|
||||
projectType: '',
|
||||
projectName: '',
|
||||
description: ''
|
||||
name: '',
|
||||
type: '',
|
||||
});
|
||||
const total = ref(0);
|
||||
// 表格加载
|
||||
const loading = ref(false)
|
||||
//获取表格数据
|
||||
function getdata() {
|
||||
// loading.value = true
|
||||
loading.value = true
|
||||
storagesPage(queryParams.value).then((res: any) => {
|
||||
// tableData.value = res.data
|
||||
tableData.value = res.data.records
|
||||
total.value = res.data.total
|
||||
loading.value = false
|
||||
queryParams.value.current = res.data.current
|
||||
queryParams.value.size = res.data.size
|
||||
})
|
||||
|
||||
}
|
||||
//获取字典项目类型
|
||||
@ -56,9 +64,22 @@ function addproject() {
|
||||
}
|
||||
//修改项目弹框
|
||||
function editproject(row: any) {
|
||||
title.value = "修改储存源"
|
||||
frame.value = true
|
||||
projectForme.value = JSON.parse(JSON.stringify(row))
|
||||
storage2({ id: row.id }).then((res: any) => {
|
||||
projectForme.value.name = res.data.name
|
||||
projectForme.value.key = res.data.key
|
||||
projectForme.value.remark = res.data.remark
|
||||
projectForme.value.type = res.data.type
|
||||
projectForme.value.filePath = res.data.storageSourceAllParam.filePath
|
||||
projectForme.value.accessKey = res.data.storageSourceAllParam.accessKey
|
||||
projectForme.value.secretKey = res.data.storageSourceAllParam.secretKey
|
||||
projectForme.value.bucketName = res.data.storageSourceAllParam.bucketName
|
||||
projectForme.value.endPoint = res.data.storageSourceAllParam.endPoint
|
||||
projectForme.value.id = res.data.id
|
||||
title.value = "修改储存源"
|
||||
frame.value = true
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
//删除项目弹框
|
||||
function delproject(row: any) {
|
||||
@ -73,7 +94,15 @@ function delproject(row: any) {
|
||||
)
|
||||
.then(() => {
|
||||
loading.value = true
|
||||
|
||||
storagestorageId(row.id).then((res: any) => {
|
||||
if (res.code == 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '删除成功',
|
||||
})
|
||||
getdata()
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
@ -100,8 +129,7 @@ function delprojectArr() {
|
||||
)
|
||||
.then(() => {
|
||||
loading.value = true
|
||||
|
||||
|
||||
getdata()
|
||||
})
|
||||
}
|
||||
//弹框关闭
|
||||
@ -128,14 +156,29 @@ async function submitForm(formEl: any) {
|
||||
if (!formEl) return
|
||||
await formEl.validate((valid: any, fields: any) => {
|
||||
if (valid) {
|
||||
console.log('submit!');
|
||||
if (projectForme.value.id) {
|
||||
|
||||
} else {
|
||||
|
||||
let params: any = {
|
||||
name: projectForme.value.name,//存储源名称
|
||||
key: projectForme.value.key,//存储源别名
|
||||
remark: projectForme.value.remark,//备注
|
||||
type: projectForme.value.type,//存储源策略
|
||||
storageSourceAllParam: {
|
||||
filePath: projectForme.value.filePath,//文件路径
|
||||
accessKey: projectForme.value.accessKey,//AccessKey
|
||||
secretKey: projectForme.value.secretKey,//SecretKey
|
||||
bucketName: projectForme.value.bucketName,//存储空间名称
|
||||
endPoint: projectForme.value.endPoint,// 服务地址
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (projectForme.value.id) {
|
||||
params.id = projectForme.value.id
|
||||
}
|
||||
storage(params).then((res: any) => {
|
||||
if (res.code == 0) {
|
||||
ElMessage.success('保存成功')
|
||||
getdata()
|
||||
frame.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -168,9 +211,12 @@ function typeName(arr: any, itemCode: any) {
|
||||
const logqing = ref(false)
|
||||
const logTxt = ref('')
|
||||
function Loglist(row: any) {
|
||||
title.value = row.projectName + '_项目描述'
|
||||
title.value = row.name+'_存储内容'
|
||||
logqing.value = true
|
||||
logTxt.value = row.description
|
||||
logTxt.value = row.storeContent
|
||||
}
|
||||
function handleClose1() {
|
||||
logqing.value = false
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -180,10 +226,10 @@ function Loglist(row: any) {
|
||||
<div class="record-box">
|
||||
<div class="sou_title">
|
||||
<div class="sou_title_left">
|
||||
<el-input style="margin-right: 10px ;" v-model="queryParams.projectName" clearable
|
||||
@change="getdata()" placeholder="存储空间名称"></el-input>
|
||||
<el-select v-model="queryParams.projectType" placeholder="存储策略" style="margin-right: 10px ;"
|
||||
clearable @change="getdata()">
|
||||
<el-input style="margin-right: 10px ;" v-model="queryParams.name" clearable @change="getdata()"
|
||||
placeholder="存储空间名称"></el-input>
|
||||
<el-select v-model="queryParams.type" placeholder="存储策略" style="margin-right: 10px ;" clearable
|
||||
@change="getdata()">
|
||||
<el-option v-for="item in dictType" :key="item.itemcode" :label="item.dictname"
|
||||
:value="item.itemcode" />
|
||||
</el-select>
|
||||
@ -191,7 +237,7 @@ function Loglist(row: any) {
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="primary" @click="addproject()">新增</el-button>
|
||||
<el-button type="primary" @click="delprojectArr()" :disabled="tableIdarr.length == 0">删除</el-button>
|
||||
<!-- <el-button type="primary" @click="delprojectArr()" :disabled="tableIdarr.length == 0">删除</el-button> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -201,22 +247,22 @@ function Loglist(row: any) {
|
||||
<el-table-column type="selection" width="40" />
|
||||
<!-- <el-table-column type="index" label="序号" width="70" align="center"></el-table-column> -->
|
||||
<el-table-column prop="name" label="存储空间名称" width="200"></el-table-column>
|
||||
<el-table-column prop="type" label="存储策略" width="200">
|
||||
<el-table-column prop="type" label="存储策略" width="100">
|
||||
<template #default="scope">
|
||||
<span>{{ typeName(dictType, scope.row.type) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="filePath" label="存储路径" width="200"></el-table-column>
|
||||
<el-table-column prop="projectTime" label="存储内容" width="165" align="center"></el-table-column>
|
||||
<el-table-column prop="description" label="存储空间占用比例">
|
||||
<el-table-column prop="valueData" label="存储路径" width="200"></el-table-column>
|
||||
<el-table-column prop="storeContent" label="存储内容">
|
||||
<template #default="scope">
|
||||
<div class="ellipsis">
|
||||
<span class="single-line-ellipsis">{{ scope.row.description }}</span>
|
||||
<span class="single-line-ellipsis">{{ scope.row.storeContent }}</span>
|
||||
<img src="@/assets/MenuIcon/xqing.png" alt="" title="详情" @click="Loglist(scope.row)"
|
||||
style="cursor: pointer;">
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="spaceOccupancyRatio" label="存储空间占用比例" width="140"></el-table-column>
|
||||
<el-table-column fixed="right" label="操作" width="80" align="center">
|
||||
<template #default="scope">
|
||||
<span
|
||||
@ -240,10 +286,10 @@ function Loglist(row: any) {
|
||||
<el-form-item label=" 存储源名称" prop="name">
|
||||
<el-input v-model="projectForme.name" />
|
||||
</el-form-item>
|
||||
<el-form-item label=" 存储源别名" prop="key">
|
||||
<el-form-item label=" 存储源别名">
|
||||
<el-input v-model="projectForme.key" />
|
||||
</el-form-item>
|
||||
<el-form-item label=" 存储源备注" prop="remark">
|
||||
<el-form-item label=" 存储源备注">
|
||||
<el-input v-model="projectForme.remark" />
|
||||
</el-form-item>
|
||||
<el-form-item label=" 存储策略" prop="type">
|
||||
@ -252,7 +298,7 @@ function Loglist(row: any) {
|
||||
:value="item.itemcode" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label=" 文件路径" prop="filePath">
|
||||
<el-form-item label=" 文件路径" prop="filePath" >
|
||||
<el-input v-model="projectForme.filePath" />
|
||||
</el-form-item>
|
||||
<el-form-item label=" AccessKey" prop="accessKey" v-if="projectForme.type == 'minio'">
|
||||
@ -275,6 +321,14 @@ function Loglist(row: any) {
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
<el-dialog :title="title" v-model="logqing" width="60%" :before-close="handleClose1" top="30px" draggable
|
||||
:close-on-click-modal="false" destroy-on-close>
|
||||
<div class="texlog">
|
||||
<el-scrollbar height="80vh">
|
||||
{{ logTxt }}
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user