From 7bcfe180ad28af9700f962c06bd2472aa3046aa8 Mon Sep 17 00:00:00 2001 From: wangxk Date: Wed, 18 Jun 2025 09:21:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=98=E5=82=A8=E7=A9=BA=E9=97=B4=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/api/storage/index.ts | 39 ++++++++ web/src/views/system/storage/index.vue | 118 ++++++++++++++++++------- 2 files changed, 125 insertions(+), 32 deletions(-) create mode 100644 web/src/api/storage/index.ts diff --git a/web/src/api/storage/index.ts b/web/src/api/storage/index.ts new file mode 100644 index 0000000..745a1c7 --- /dev/null +++ b/web/src/api/storage/index.ts @@ -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 + }); +} \ No newline at end of file diff --git a/web/src/views/system/storage/index.vue b/web/src/views/system/storage/index.vue index 8b1ef51..99e9e69 100644 --- a/web/src/views/system/storage/index.vue +++ b/web/src/views/system/storage/index.vue @@ -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 } @@ -180,10 +226,10 @@ function Loglist(row: any) {
- - + + @@ -191,7 +237,7 @@ function Loglist(row: any) {
新增 - 删除 +
@@ -201,22 +247,22 @@ function Loglist(row: any) { - + - - - + + +