feat(projects): 新增我的已办,我的抄送功能

This commit is contained in:
AN
2025-07-15 21:45:23 +08:00
parent bd6b575af6
commit 01d42722f5
18 changed files with 690 additions and 8 deletions

View File

@ -48,7 +48,7 @@ UPDATE sys_menu SET component = 'workflow/task/myDocument/index', icon = 'hugeic
UPDATE sys_menu SET component = 'Layout', icon = 'lucide:monitor-cog' WHERE menu_id = 11630;
UPDATE sys_menu SET component = 'workflow/task/allTaskWaiting/index', icon = 'ri:todo-line' WHERE menu_id = 11631;
UPDATE sys_menu SET component = 'workflow/task/taskFinish/index', icon = 'hugeicons:task-done-01' WHERE menu_id = 11632;
UPDATE sys_menu SET component = 'workflow/task/taskCopyList/index', icon = 'mynaui:copy' WHERE menu_id = 11633;
UPDATE sys_menu SET path = 'taskCopy', component = 'workflow/task/taskCopy/index', icon = 'mynaui:copy' WHERE menu_id = 11633;
UPDATE sys_menu SET icon = 'pepicons-pencil:leave' WHERE menu_id = 11638;
UPDATE sys_menu SET path = 'design', component = 'workflow/design/index' WHERE menu_id = 11700;

View File

@ -244,7 +244,9 @@ const local: App.I18n.Schema = {
'workflow_task_all-task-waiting': 'All Task Waiting',
workflow_leave: 'Leave Apply',
'workflow_task_my-document': 'My Document',
'workflow_task_task-waiting': 'My Task Waiting'
'workflow_task_task-waiting': 'My Task Waiting',
'workflow_task_task-finish': 'My Task Finish',
'workflow_task_task-copy': 'My Task Copy'
},
menu: {
system_tenant: 'Tenant Management',

View File

@ -244,7 +244,9 @@ const local: App.I18n.Schema = {
'workflow_task_all-task-waiting': '待办任务',
workflow_leave: '请假申请',
'workflow_task_my-document': '我发起的',
'workflow_task_task-waiting': '我的待办'
'workflow_task_task-waiting': '我的待办',
'workflow_task_task-finish': '我的已办',
'workflow_task_task-copy': '我的抄送'
},
menu: {
system_tenant: '租户管理',

View File

@ -50,5 +50,7 @@ export const views: Record<LastLevelRouteKey, RouteComponent | (() => Promise<Ro
"workflow_process-instance": () => import("@/views/workflow/process-instance/index.vue"),
"workflow_task_all-task-waiting": () => import("@/views/workflow/task/all-task-waiting/index.vue"),
"workflow_task_my-document": () => import("@/views/workflow/task/my-document/index.vue"),
"workflow_task_task-copy": () => import("@/views/workflow/task/task-copy/index.vue"),
"workflow_task_task-finish": () => import("@/views/workflow/task/task-finish/index.vue"),
"workflow_task_task-waiting": () => import("@/views/workflow/task/task-waiting/index.vue"),
};

View File

@ -412,6 +412,24 @@ export const generatedRoutes: GeneratedRoute[] = [
i18nKey: 'route.workflow_task_my-document'
}
},
{
name: 'workflow_task_task-copy',
path: '/workflow/task/task-copy',
component: 'view.workflow_task_task-copy',
meta: {
title: 'workflow_task_task-copy',
i18nKey: 'route.workflow_task_task-copy'
}
},
{
name: 'workflow_task_task-finish',
path: '/workflow/task/task-finish',
component: 'view.workflow_task_task-finish',
meta: {
title: 'workflow_task_task-finish',
i18nKey: 'route.workflow_task_task-finish'
}
},
{
name: 'workflow_task_task-waiting',
path: '/workflow/task/task-waiting',

View File

@ -208,6 +208,8 @@ const routeMap: RouteMap = {
"workflow_task": "/workflow/task",
"workflow_task_all-task-waiting": "/workflow/task/all-task-waiting",
"workflow_task_my-document": "/workflow/task/my-document",
"workflow_task_task-copy": "/workflow/task/task-copy",
"workflow_task_task-finish": "/workflow/task/task-finish",
"workflow_task_task-waiting": "/workflow/task/task-waiting"
};

View File

@ -87,6 +87,7 @@ export function fetchGetTaskWaitList(data: Api.Workflow.TaskSearchParams) {
params: data
});
}
/** 获取可驳回节点 */
export function fetchGetBackNode(definitionId: CommonType.IdType, nodeCode: string) {
return request<Api.Workflow.FlowNodeList>({
@ -94,6 +95,7 @@ export function fetchGetBackNode(definitionId: CommonType.IdType, nodeCode: stri
method: 'get'
});
}
/** 驳回任务 */
export function fetchBackTask(data: Api.Workflow.BackOperateParams) {
return request<boolean>({
@ -102,3 +104,21 @@ export function fetchBackTask(data: Api.Workflow.BackOperateParams) {
data
});
}
/** 获取我的已办任务 */
export function fetchGetFinishedTask(data: Api.Workflow.TaskSearchParams) {
return request<Api.Workflow.HisTaskList>({
url: '/workflow/task/pageByTaskFinish',
method: 'get',
params: data
});
}
/** 获取我的抄送任务 */
export function fetchGetCopyTask(data: Api.Workflow.TaskSearchParams) {
return request<Api.Workflow.TaskList>({
url: '/workflow/task/pageByTaskCopy',
method: 'get',
params: data
});
}

View File

@ -423,7 +423,7 @@ declare namespace Api {
/** 任务搜索参数 */
type TaskSearchParams = CommonType.RecordNullable<
Pick<Task, 'flowName' | 'flowCode' | 'businessId' | 'category' | 'nodeName'> &
Pick<Task, 'flowName' | 'flowCode' | 'businessId' | 'category' | 'nodeName' | 'instanceId' | 'permissionList'> &
Api.Common.CommonSearchParams & {
createByIds: CommonType.IdType[];
}

View File

@ -81,6 +81,7 @@ declare module 'vue' {
NButton: typeof import('naive-ui')['NButton']
NCard: typeof import('naive-ui')['NCard']
NCheckbox: typeof import('naive-ui')['NCheckbox']
NCheckboxGroup: typeof import('naive-ui')['NCheckboxGroup']
NCode: typeof import('naive-ui')['NCode']
NCollapse: typeof import('naive-ui')['NCollapse']
NCollapseItem: typeof import('naive-ui')['NCollapseItem']

View File

@ -62,6 +62,8 @@ declare module "@elegant-router/types" {
"workflow_task": "/workflow/task";
"workflow_task_all-task-waiting": "/workflow/task/all-task-waiting";
"workflow_task_my-document": "/workflow/task/my-document";
"workflow_task_task-copy": "/workflow/task/task-copy";
"workflow_task_task-finish": "/workflow/task/task-finish";
"workflow_task_task-waiting": "/workflow/task/task-waiting";
};
@ -163,6 +165,8 @@ declare module "@elegant-router/types" {
| "workflow_process-instance"
| "workflow_task_all-task-waiting"
| "workflow_task_my-document"
| "workflow_task_task-copy"
| "workflow_task_task-finish"
| "workflow_task_task-waiting"
>;

View File

@ -164,7 +164,7 @@ const {
}
});
const { checkedRowKeys, editingData: _editingData, handleEdit: _handleEdit } = useTableOperate(data, getData);
const { checkedRowKeys } = useTableOperate(data, getData);
watch(waitingStatus, async () => {
const newApiFn = waitingStatus.value ? fetchGetAllWaitingTask : fetchGetAllFinishedTask;

View File

@ -178,7 +178,7 @@ const {
]
});
const { checkedRowKeys, editingData: _editingData, handleEdit: _handleEdit } = useTableOperate(data, getData);
const { checkedRowKeys } = useTableOperate(data, getData);
const { loading: treeLoading, startLoading: startTreeLoading, endLoading: endTreeLoading } = useLoading();
const categoryPattern = ref<string>();

View File

@ -12,7 +12,7 @@ interface Emits {
const emit = defineEmits<Emits>();
const { formRef, validate, restoreValidation } = useNaiveForm();
const model = defineModel<Api.Workflow.InstanceSearchParams>('model', { required: true });
const model = defineModel<Api.Workflow.TaskSearchParams>('model', { required: true });
async function reset() {
await restoreValidation();

View File

@ -0,0 +1,252 @@
<script setup lang="tsx">
import { computed, ref, shallowRef } from 'vue';
import { NButton, NEmpty, NInput, NTag } from 'naive-ui';
import { useBoolean, useLoading } from '@sa/hooks';
import { fetchGetCategoryTree } from '@/service/api/workflow/category';
import { fetchGetCopyTask } from '@/service/api/workflow/task';
import { useAppStore } from '@/store/modules/app';
import { useTable, useTableOperate } from '@/hooks/common/table';
import { useDict } from '@/hooks/business/dict';
import { loadDynamicComponent } from '@/utils/common';
import DictTag from '@/components/custom/dict-tag.vue';
import ButtonIcon from '@/components/custom/button-icon.vue';
import { $t } from '@/locales';
import TaskCopySearch from './modules/task-copy-search.vue';
defineOptions({
name: 'TaskCopyList'
});
useDict('wf_business_status');
useDict('wf_task_status');
const appStore = useAppStore();
const { bool: viewVisible, setTrue: showViewDrawer } = useBoolean();
const dynamicComponent = shallowRef();
const {
columns,
columnChecks,
data,
getData,
getDataByPage,
loading,
mobilePagination,
searchParams,
resetSearchParams
} = useTable({
apiFn: fetchGetCopyTask,
apiParams: {
pageNum: 1,
pageSize: 10,
category: null,
flowName: null,
flowCode: null,
nodeName: null,
createByIds: null
},
columns: () => [
{
key: 'index',
title: $t('common.index'),
align: 'center',
width: 64
},
{
title: '流程定义名称',
key: 'flowName',
align: 'center',
width: 120
},
{
title: '流程定义编码',
key: 'flowCode',
align: 'center',
width: 100
},
{
title: '流程分类',
key: 'categoryName',
align: 'center',
width: 80,
render: row => {
return <NTag>{row.categoryName}</NTag>;
}
},
{
title: '版本号',
key: 'version',
align: 'center',
width: 100,
render: row => <NTag type="info">v{row.version}.0</NTag>
},
{
title: '任务名称',
key: 'nodeName',
align: 'center',
width: 100
},
{
title: '流程状态',
key: 'flowStatus',
align: 'center',
width: 80,
render(row) {
return <DictTag value={row.flowStatus} dict-code="wf_business_status" />;
}
},
{
title: '申请人',
key: 'createByName',
align: 'center',
width: 100
},
{
key: 'createTime',
title: '创建时间',
align: 'center',
width: 120
},
{
title: '操作',
key: 'operate',
align: 'center',
fixed: 'right',
width: 50,
render(row) {
return (
<ButtonIcon
text
type="primary"
icon="material-symbols:visibility-outline"
tooltipContent="查看"
onClick={() => handleView(row)}
/>
);
}
}
]
});
const { checkedRowKeys } = useTableOperate(data, getData);
const { loading: treeLoading, startLoading: startTreeLoading, endLoading: endTreeLoading } = useLoading();
const categoryPattern = ref<string>();
const categoryData = ref<Api.Common.CommonTreeRecord>([]);
const selectedKeys = ref<string[]>([]);
const expandedKeys = ref<CommonType.IdType[]>(['100']);
const selectable = computed(() => !loading.value);
async function getTreeData() {
startTreeLoading();
const { data: tree, error } = await fetchGetCategoryTree();
if (!error) {
categoryData.value = tree;
}
endTreeLoading();
}
getTreeData();
function handleClickTree(keys: string[]) {
searchParams.category = keys.length ? keys[0] : null;
checkedRowKeys.value = [];
getDataByPage();
}
function handleResetTreeData() {
categoryPattern.value = undefined;
getTreeData();
}
function handleResetSearch() {
resetSearchParams();
selectedKeys.value = [];
}
const modules = import.meta.glob('@/components/custom/workflow/**/*.vue');
const businessId = ref<CommonType.IdType>();
const taskId = ref<CommonType.IdType>();
async function handleView(row: Api.Workflow.Task) {
businessId.value = row.businessId;
taskId.value = row.id;
const formPath = row.formPath;
if (formPath) {
dynamicComponent.value = await loadDynamicComponent(modules, formPath);
showViewDrawer();
}
}
</script>
<template>
<TableSiderLayout sider-title="流程分类列表">
<template #header-extra>
<NButton size="small" text class="h-18px" @click.stop="() => handleResetTreeData()">
<template #icon>
<SvgIcon icon="ic:round-refresh" />
</template>
</NButton>
</template>
<template #sider>
<NInput v-model:value="categoryPattern" clearable :placeholder="$t('common.keywordSearch')" />
<NSpin class="category-tree" :show="treeLoading">
<NTree
v-model:selected-keys="selectedKeys"
v-model:expanded-keys="expandedKeys"
block-node
show-line
:data="categoryData as []"
:show-irrelevant-nodes="false"
:pattern="categoryPattern"
class="infinite-scroll h-full min-h-200px py-3"
key-field="id"
label-field="label"
virtual-scroll
:selectable="selectable"
@update:selected-keys="handleClickTree"
>
<template #empty>
<NEmpty description="暂无分类信息" class="h-full min-h-200px justify-center" />
</template>
</NTree>
</NSpin>
</template>
<div class="h-full flex-col-stretch gap-12px overflow-hidden lt-sm:overflow-auto">
<TaskCopySearch v-model:model="searchParams" @reset="handleResetSearch" @search="getDataByPage" />
<NCard title="我的抄送" :bordered="false" size="small" class="card-wrapper sm:flex-1-hidden">
<template #header-extra>
<TableHeaderOperation
v-model:columns="columnChecks"
:disabled-delete="checkedRowKeys.length === 0"
:loading="loading"
:show-add="false"
:show-delete="false"
:show-export="false"
@refresh="getData"
></TableHeaderOperation>
</template>
<NDataTable
v-model:checked-row-keys="checkedRowKeys"
:columns="columns"
:data="data"
size="small"
:flex-height="!appStore.isMobile"
:scroll-x="1405"
:loading="loading"
remote
:row-key="row => row.id"
:pagination="mobilePagination"
class="sm:h-full"
/>
<component
:is="dynamicComponent"
:visible="viewVisible"
operate-type="detail"
:business-id="businessId"
:task-id="taskId"
@submitted="getData"
/>
</NCard>
</div>
</TableSiderLayout>
</template>

View File

@ -0,0 +1,57 @@
<script setup lang="tsx">
import { useNaiveForm } from '@/hooks/common/form';
defineOptions({
name: 'MyDocumentSearch'
});
interface Emits {
(e: 'reset'): void;
(e: 'search'): void;
}
const emit = defineEmits<Emits>();
const { formRef, validate, restoreValidation } = useNaiveForm();
const model = defineModel<Api.Workflow.TaskSearchParams>('model', { required: true });
async function reset() {
await restoreValidation();
emit('reset');
}
async function search() {
await validate();
emit('search');
}
</script>
<template>
<NCard :bordered="false" size="small" class="card-wrapper">
<NCollapse>
<NCollapseItem :title="$t('common.search')">
<NForm ref="formRef" :model="model" label-placement="left" :label-width="100">
<NGrid responsive="screen" item-responsive>
<NFormItemGi span="6 s:12 m:6" label="流程定义编码" path="flowCode" class="pr-24px">
<NInput v-model:value="model.flowCode" placeholder="请输入流程定义编码" />
</NFormItemGi>
<NFormItemGi span="6" class="pr-24px">
<NSpace class="w-full" justify="end">
<NButton @click="reset">
<template #icon>
<icon-ic-round-refresh class="text-icon" />
</template>
{{ $t('common.reset') }}
</NButton>
<NButton type="primary" ghost @click="search">
<template #icon>
<icon-ic-round-search class="text-icon" />
</template>
{{ $t('common.search') }}
</NButton>
</NSpace>
</NFormItemGi>
</NGrid>
</NForm>
</NCollapseItem>
</NCollapse>
</NCard>
</template>

View File

@ -0,0 +1,265 @@
<script setup lang="tsx">
import { computed, ref, shallowRef } from 'vue';
import { NButton, NEmpty, NInput, NTag } from 'naive-ui';
import { useBoolean, useLoading } from '@sa/hooks';
import { fetchGetCategoryTree } from '@/service/api/workflow/category';
import { fetchGetFinishedTask } from '@/service/api/workflow/task';
import { useAppStore } from '@/store/modules/app';
import { useTable, useTableOperate } from '@/hooks/common/table';
import { useDict } from '@/hooks/business/dict';
import { loadDynamicComponent } from '@/utils/common';
import DictTag from '@/components/custom/dict-tag.vue';
import ButtonIcon from '@/components/custom/button-icon.vue';
import { $t } from '@/locales';
import TaskFinishSearch from './modules/task-finish-search.vue';
defineOptions({
name: 'TaskFinishList'
});
useDict('wf_business_status');
useDict('wf_task_status');
const appStore = useAppStore();
const { bool: viewVisible, setTrue: showViewDrawer } = useBoolean();
const dynamicComponent = shallowRef();
const {
columns,
columnChecks,
data,
getData,
getDataByPage,
loading,
mobilePagination,
searchParams,
resetSearchParams
} = useTable({
apiFn: fetchGetFinishedTask,
apiParams: {
pageNum: 1,
pageSize: 10,
category: null,
flowName: null,
flowCode: null,
nodeName: null,
createByIds: null
},
columns: () => [
{
key: 'index',
title: $t('common.index'),
align: 'center',
width: 64
},
{
title: '流程定义名称',
key: 'flowName',
align: 'center',
width: 120
},
{
title: '流程定义编码',
key: 'flowCode',
align: 'center',
width: 100
},
{
title: '流程分类',
key: 'categoryName',
align: 'center',
width: 80,
render: row => {
return <NTag>{row.categoryName}</NTag>;
}
},
{
title: '版本号',
key: 'version',
align: 'center',
width: 100,
render: row => <NTag type="info">v{row.version}.0</NTag>
},
{
title: '任务名称',
key: 'nodeName',
align: 'center',
width: 100
},
{
title: '流程状态',
key: 'flowStatus',
align: 'center',
width: 80,
render(row) {
return <DictTag value={row.flowStatus} dict-code="wf_business_status" />;
}
},
{
key: 'flowTaskStatus',
title: '任务状态',
align: 'center',
width: 80,
render: row => <DictTag size="small" value={row.flowTaskStatus} dict-code="wf_task_status" />
},
{
title: '申请人',
key: 'createByName',
align: 'center',
width: 100
},
{
title: '办理人',
key: 'approveName',
align: 'center',
width: 100
},
{
key: 'createTime',
title: '创建时间',
align: 'center',
width: 120
},
{
title: '操作',
key: 'operate',
align: 'center',
fixed: 'right',
width: 50,
render(row) {
return (
<ButtonIcon
text
type="primary"
icon="material-symbols:visibility-outline"
tooltipContent="查看"
onClick={() => handleView(row)}
/>
);
}
}
]
});
const { checkedRowKeys } = useTableOperate(data, getData);
const { loading: treeLoading, startLoading: startTreeLoading, endLoading: endTreeLoading } = useLoading();
const categoryPattern = ref<string>();
const categoryData = ref<Api.Common.CommonTreeRecord>([]);
const selectedKeys = ref<string[]>([]);
const expandedKeys = ref<CommonType.IdType[]>(['100']);
const selectable = computed(() => !loading.value);
async function getTreeData() {
startTreeLoading();
const { data: tree, error } = await fetchGetCategoryTree();
if (!error) {
categoryData.value = tree;
}
endTreeLoading();
}
getTreeData();
function handleClickTree(keys: string[]) {
searchParams.category = keys.length ? keys[0] : null;
checkedRowKeys.value = [];
getDataByPage();
}
function handleResetTreeData() {
categoryPattern.value = undefined;
getTreeData();
}
function handleResetSearch() {
resetSearchParams();
selectedKeys.value = [];
}
const modules = import.meta.glob('@/components/custom/workflow/**/*.vue');
const businessId = ref<CommonType.IdType>();
const taskId = ref<CommonType.IdType>();
async function handleView(row: Api.Workflow.HisTask) {
businessId.value = row.businessId;
taskId.value = row.id;
const formPath = row.formPath;
if (formPath) {
dynamicComponent.value = await loadDynamicComponent(modules, formPath);
showViewDrawer();
}
}
</script>
<template>
<TableSiderLayout sider-title="流程分类列表">
<template #header-extra>
<NButton size="small" text class="h-18px" @click.stop="() => handleResetTreeData()">
<template #icon>
<SvgIcon icon="ic:round-refresh" />
</template>
</NButton>
</template>
<template #sider>
<NInput v-model:value="categoryPattern" clearable :placeholder="$t('common.keywordSearch')" />
<NSpin class="category-tree" :show="treeLoading">
<NTree
v-model:selected-keys="selectedKeys"
v-model:expanded-keys="expandedKeys"
block-node
show-line
:data="categoryData as []"
:show-irrelevant-nodes="false"
:pattern="categoryPattern"
class="infinite-scroll h-full min-h-200px py-3"
key-field="id"
label-field="label"
virtual-scroll
:selectable="selectable"
@update:selected-keys="handleClickTree"
>
<template #empty>
<NEmpty description="暂无分类信息" class="h-full min-h-200px justify-center" />
</template>
</NTree>
</NSpin>
</template>
<div class="h-full flex-col-stretch gap-12px overflow-hidden lt-sm:overflow-auto">
<TaskFinishSearch v-model:model="searchParams" @reset="handleResetSearch" @search="getDataByPage" />
<NCard title="我的已办" :bordered="false" size="small" class="card-wrapper sm:flex-1-hidden">
<template #header-extra>
<TableHeaderOperation
v-model:columns="columnChecks"
:disabled-delete="checkedRowKeys.length === 0"
:loading="loading"
:show-add="false"
:show-delete="false"
:show-export="false"
@refresh="getData"
></TableHeaderOperation>
</template>
<NDataTable
v-model:checked-row-keys="checkedRowKeys"
:columns="columns"
:data="data"
size="small"
:flex-height="!appStore.isMobile"
:scroll-x="1405"
:loading="loading"
remote
:row-key="row => row.id"
:pagination="mobilePagination"
class="sm:h-full"
/>
<component
:is="dynamicComponent"
:visible="viewVisible"
operate-type="detail"
:business-id="businessId"
:task-id="taskId"
@submitted="getData"
/>
</NCard>
</div>
</TableSiderLayout>
</template>

View File

@ -0,0 +1,57 @@
<script setup lang="tsx">
import { useNaiveForm } from '@/hooks/common/form';
defineOptions({
name: 'MyDocumentSearch'
});
interface Emits {
(e: 'reset'): void;
(e: 'search'): void;
}
const emit = defineEmits<Emits>();
const { formRef, validate, restoreValidation } = useNaiveForm();
const model = defineModel<Api.Workflow.TaskSearchParams>('model', { required: true });
async function reset() {
await restoreValidation();
emit('reset');
}
async function search() {
await validate();
emit('search');
}
</script>
<template>
<NCard :bordered="false" size="small" class="card-wrapper">
<NCollapse>
<NCollapseItem :title="$t('common.search')">
<NForm ref="formRef" :model="model" label-placement="left" :label-width="100">
<NGrid responsive="screen" item-responsive>
<NFormItemGi span="6 s:12 m:6" label="流程定义编码" path="flowCode" class="pr-24px">
<NInput v-model:value="model.flowCode" placeholder="请输入流程定义编码" />
</NFormItemGi>
<NFormItemGi span="6" class="pr-24px">
<NSpace class="w-full" justify="end">
<NButton @click="reset">
<template #icon>
<icon-ic-round-refresh class="text-icon" />
</template>
{{ $t('common.reset') }}
</NButton>
<NButton type="primary" ghost @click="search">
<template #icon>
<icon-ic-round-search class="text-icon" />
</template>
{{ $t('common.search') }}
</NButton>
</NSpace>
</NFormItemGi>
</NGrid>
</NForm>
</NCollapseItem>
</NCollapse>
</NCard>
</template>

View File

@ -121,7 +121,7 @@ const {
]
});
const { checkedRowKeys, editingData: _editingData, handleEdit: _handleEdit } = useTableOperate(data, getData);
const { checkedRowKeys } = useTableOperate(data, getData);
const { loading: treeLoading, startLoading: startTreeLoading, endLoading: endTreeLoading } = useLoading();
const categoryPattern = ref<string>();