feat: 项目模块添加进展功能

This commit is contained in:
caiyuchao
2025-07-09 16:27:21 +08:00
parent a81e4a3496
commit 31d29e3d22
5 changed files with 67 additions and 3 deletions

View File

@@ -18,5 +18,6 @@
"code": "Project Code",
"name": "Project Name",
"envInfoFile": "Environment Info Attachment",
"list": "Project List"
"list": "Project List",
"progress": "Progress"
}

View File

@@ -18,5 +18,6 @@
"code": "项目编号",
"name": "项目名称",
"envInfoFile": "环境信息附件",
"list": "项目列表"
"list": "项目列表",
"progress": "进展"
}

View File

@@ -510,6 +510,11 @@ export function useGridColumns(
code: 'edit',
show: hasAccessByCodes(['license:project:update']),
},
// {
// code: 'progress',
// text: $t('project.progress'),
// show: hasAccessByCodes(['license:project:update']),
// },
{
code: 'delete',
show: hasAccessByCodes(['license:project:delete']),

View File

@@ -5,7 +5,7 @@ import type {
} from '#/adapter/vxe-table';
import type { ProjectApi } from '#/api/license/project';
import { Page, useVbenModal } from '@vben/common-ui';
import { Page, useVbenDrawer, useVbenModal } from '@vben/common-ui';
import { downloadFileFromBlobPart } from '@vben/utils';
import { message } from 'ant-design-vue';
@@ -20,12 +20,18 @@ import { $t } from '#/locales';
import { useGridColumns, useGridFormSchema } from './data';
import Form from './modules/form.vue';
import Progress from './modules/progress.vue';
const [FormModal, formModalApi] = useVbenModal({
connectedComponent: Form,
destroyOnClose: true,
});
const [ProgressDrawer, progressDrawerApi] = useVbenDrawer({
connectedComponent: Progress,
destroyOnClose: true,
});
/** 刷新表格 */
function onRefresh() {
gridApi.query();
@@ -41,6 +47,11 @@ function onEdit(row: ProjectApi.Project) {
formModalApi.setData(row).open();
}
/** 项目进展 */
function onProgress(row: ProjectApi.Project) {
progressDrawerApi.setData(row).open();
}
/** 删除项目 */
async function onDelete(row: ProjectApi.Project) {
const hideLoading = message.loading({
@@ -78,6 +89,10 @@ function onActionClick({ code, row }: OnActionClickParams<ProjectApi.Project>) {
onEdit(row);
break;
}
case 'progress': {
onProgress(row);
break;
}
}
}
@@ -123,6 +138,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
<template>
<Page auto-content-height>
<FormModal @success="onRefresh" />
<ProgressDrawer @success="onRefresh" />
<Grid :table-title="$t('project.list')">
<template #toolbar-tools>

View File

@@ -0,0 +1,41 @@
<script lang="ts" setup>
import type { ProjectApi } from '#/api/license/project';
import { ref } from 'vue';
import { useVbenDrawer } from '@vben/common-ui';
import { getProject } from '#/api/license/project';
const projectData = ref<ProjectApi.Project>();
const [Drawer, drawerApi] = useVbenDrawer({
async onConfirm() {},
async onOpenChange(isOpen: boolean) {
if (!isOpen) {
return;
}
// 加载数据
let data = drawerApi.getData<ProjectApi.Project>();
if (!data) {
return;
}
if (data.id) {
drawerApi.lock();
try {
data = await getProject(data.id);
} finally {
drawerApi.unlock();
}
}
// 设置到 values
projectData.value = data;
},
});
</script>
<template>
<Drawer :title="projectData?.name" class="w-[800px]">
<div>进展测试</div>
<div>{{ projectData }}</div>
</Drawer>
</template>