feat(projects): 新增 '我发起的' 功能
This commit is contained in:
parent
c3ea81dc0d
commit
a77edc2e36
@ -150,7 +150,7 @@ async function handleUpdateModelWhenEdit() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (props.operateType === 'edit' || (props.operateType === 'detail' && props.rowData)) {
|
||||
if (props.rowData) {
|
||||
Object.assign(model, props.rowData);
|
||||
Object.assign(modelDetail, props.rowData);
|
||||
} else {
|
||||
@ -159,6 +159,7 @@ async function handleUpdateModelWhenEdit() {
|
||||
window.$message?.error(error.message);
|
||||
return;
|
||||
}
|
||||
Object.assign(model, data);
|
||||
Object.assign(modelDetail, data);
|
||||
}
|
||||
}
|
||||
|
@ -241,7 +241,8 @@ const local: App.I18n.Schema = {
|
||||
'workflow_process-instance': 'Process Instance',
|
||||
workflow_task: 'Task',
|
||||
'workflow_task_all-task-waiting': 'All Task Waiting',
|
||||
workflow_leave: 'Leave Apply'
|
||||
workflow_leave: 'Leave Apply',
|
||||
'workflow_task_my-document': 'My Document'
|
||||
},
|
||||
menu: {
|
||||
system_tenant: 'Tenant Management',
|
||||
|
@ -241,7 +241,8 @@ const local: App.I18n.Schema = {
|
||||
'workflow_process-instance': '流程实例',
|
||||
workflow_task: '任务',
|
||||
'workflow_task_all-task-waiting': '待办任务',
|
||||
workflow_leave: '请假申请'
|
||||
workflow_leave: '请假申请',
|
||||
'workflow_task_my-document': '我发起的'
|
||||
},
|
||||
menu: {
|
||||
system_tenant: '租户管理',
|
||||
|
@ -49,4 +49,5 @@ export const views: Record<LastLevelRouteKey, RouteComponent | (() => Promise<Ro
|
||||
"workflow_process-definition": () => import("@/views/workflow/process-definition/index.vue"),
|
||||
"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"),
|
||||
};
|
||||
|
@ -402,6 +402,15 @@ export const generatedRoutes: GeneratedRoute[] = [
|
||||
title: 'workflow_task_all-task-waiting',
|
||||
i18nKey: 'route.workflow_task_all-task-waiting'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'workflow_task_my-document',
|
||||
path: '/workflow/task/my-document',
|
||||
component: 'view.workflow_task_my-document',
|
||||
meta: {
|
||||
title: 'workflow_task_my-document',
|
||||
i18nKey: 'route.workflow_task_my-document'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -206,7 +206,8 @@ const routeMap: RouteMap = {
|
||||
"workflow_process-definition": "/workflow/process-definition",
|
||||
"workflow_process-instance": "/workflow/process-instance",
|
||||
"workflow_task": "/workflow/task",
|
||||
"workflow_task_all-task-waiting": "/workflow/task/all-task-waiting"
|
||||
"workflow_task_all-task-waiting": "/workflow/task/all-task-waiting",
|
||||
"workflow_task_my-document": "/workflow/task/my-document"
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { request } from '@/service/request';
|
||||
|
||||
/** 查询正在运行的流程实例列表 */
|
||||
export function fetchGetRunningProcessInstanceList(params: Api.Workflow.ProcessInstanceSearchParams) {
|
||||
return request<Api.Workflow.ProcessInstanceList>({
|
||||
export function fetchGetRunningInstanceList(params: Api.Workflow.InstanceSearchParams) {
|
||||
return request<Api.Workflow.InstanceList>({
|
||||
url: '/workflow/instance/pageByRunning',
|
||||
method: 'get',
|
||||
params
|
||||
@ -10,8 +10,8 @@ export function fetchGetRunningProcessInstanceList(params: Api.Workflow.ProcessI
|
||||
}
|
||||
|
||||
/** 查询已结束的流程实例列表 */
|
||||
export function fetchGetFinishedProcessInstanceList(params: Api.Workflow.ProcessInstanceSearchParams) {
|
||||
return request<Api.Workflow.ProcessInstanceList>({
|
||||
export function fetchGetFinishedInstanceList(params: Api.Workflow.InstanceSearchParams) {
|
||||
return request<Api.Workflow.InstanceList>({
|
||||
url: '/workflow/instance/pageByFinish',
|
||||
method: 'get',
|
||||
params
|
||||
@ -19,7 +19,7 @@ export function fetchGetFinishedProcessInstanceList(params: Api.Workflow.Process
|
||||
}
|
||||
|
||||
/** 按照实例id删除流程实例 */
|
||||
export function fetchBatchDeleteProcessInstance(instanceIds: CommonType.IdType[]) {
|
||||
export function fetchBatchDeleteInstance(instanceIds: CommonType.IdType[]) {
|
||||
return request<boolean>({
|
||||
url: `/workflow/instance/deleteByInstanceIds/${instanceIds.join(',')}`,
|
||||
method: 'delete'
|
||||
@ -42,3 +42,11 @@ export function fetchGetFlowHisTaskList(businessId: CommonType.IdType) {
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
/** 流程作废操作 */
|
||||
export function fetchCancelProcessApply(data: Api.Workflow.CancelProcessApplyParams) {
|
||||
return request<boolean>({
|
||||
url: '/workflow/instance/cancelProcessApply',
|
||||
method: 'put',
|
||||
data
|
||||
});
|
||||
}
|
||||
|
11
src/service/api/workflow/my-document.ts
Normal file
11
src/service/api/workflow/my-document.ts
Normal file
@ -0,0 +1,11 @@
|
||||
/** 我的待办 */
|
||||
|
||||
import { request } from '@/service/request';
|
||||
|
||||
export function fetchGetMyDocument(data: Api.Workflow.InstanceSearchParams) {
|
||||
return request<Api.Workflow.InstanceList>({
|
||||
url: '/workflow/instance/pageByCurrent',
|
||||
method: 'get',
|
||||
params: data
|
||||
});
|
||||
}
|
18
src/typings/api/workflow.api.d.ts
vendored
18
src/typings/api/workflow.api.d.ts
vendored
@ -141,7 +141,7 @@ declare namespace Api {
|
||||
type WorkflowActivityStatus = 0 | 1;
|
||||
|
||||
/** 流程实例 */
|
||||
type ProcessInstance = Common.CommonRecord<{
|
||||
type Instance = Common.CommonRecord<{
|
||||
/** 主键 */
|
||||
id: CommonType.IdType;
|
||||
/** 租户编号 */
|
||||
@ -194,15 +194,15 @@ declare namespace Api {
|
||||
}>;
|
||||
|
||||
/** 流程实例搜索参数 */
|
||||
type ProcessInstanceSearchParams = CommonType.RecordNullable<
|
||||
Pick<ProcessInstance, 'flowName' | 'flowCode' | 'businessId' | 'category' | 'nodeName'> &
|
||||
type InstanceSearchParams = CommonType.RecordNullable<
|
||||
Pick<Instance, 'flowName' | 'flowCode' | 'businessId' | 'category' | 'nodeName'> &
|
||||
Api.Common.CommonSearchParams & {
|
||||
startUserId: CommonType.IdType;
|
||||
createByIds: CommonType.IdType[];
|
||||
}
|
||||
>;
|
||||
/** 流程实例列表 */
|
||||
type ProcessInstanceList = Common.PaginatingQueryRecord<ProcessInstance>;
|
||||
type InstanceList = Common.PaginatingQueryRecord<Instance>;
|
||||
|
||||
/** 流程作废操作参数 */
|
||||
type FlowInvalidOperateParams = CommonType.RecordNullable<{
|
||||
@ -212,6 +212,14 @@ declare namespace Api {
|
||||
comment: string;
|
||||
}>;
|
||||
|
||||
/** 流程撤销操作参数 */
|
||||
type CancelProcessApplyParams = CommonType.RecordNullable<{
|
||||
/** 主键 */
|
||||
businessId: CommonType.IdType;
|
||||
/** 撤销原因 */
|
||||
message: string;
|
||||
}>;
|
||||
|
||||
/** 启动流程操作参数 */
|
||||
type StartWorkflowOperateParams = CommonType.RecordNullable<{
|
||||
/** 流程定义ID */
|
||||
@ -225,7 +233,7 @@ declare namespace Api {
|
||||
/** 启动流程结果 */
|
||||
type StartWorkflowResult = CommonType.RecordNullable<{
|
||||
/** 流程实例ID */
|
||||
processInstanceId: CommonType.IdType;
|
||||
instanceId: CommonType.IdType;
|
||||
/** 任务ID */
|
||||
taskId: CommonType.IdType;
|
||||
}>;
|
||||
|
2
src/typings/elegant-router.d.ts
vendored
2
src/typings/elegant-router.d.ts
vendored
@ -61,6 +61,7 @@ declare module "@elegant-router/types" {
|
||||
"workflow_process-instance": "/workflow/process-instance";
|
||||
"workflow_task": "/workflow/task";
|
||||
"workflow_task_all-task-waiting": "/workflow/task/all-task-waiting";
|
||||
"workflow_task_my-document": "/workflow/task/my-document";
|
||||
};
|
||||
|
||||
/**
|
||||
@ -160,6 +161,7 @@ declare module "@elegant-router/types" {
|
||||
| "workflow_process-definition"
|
||||
| "workflow_process-instance"
|
||||
| "workflow_task_all-task-waiting"
|
||||
| "workflow_task_my-document"
|
||||
>;
|
||||
|
||||
/**
|
||||
|
@ -5,10 +5,10 @@ import { useBoolean, useLoading } from '@sa/hooks';
|
||||
import { workflowActivityStatusRecord } from '@/constants/workflow';
|
||||
import { fetchGetCategoryTree } from '@/service/api/workflow/category';
|
||||
import {
|
||||
fetchBatchDeleteProcessInstance,
|
||||
fetchBatchDeleteInstance,
|
||||
fetchFlowInvalidOperate,
|
||||
fetchGetFinishedProcessInstanceList,
|
||||
fetchGetRunningProcessInstanceList
|
||||
fetchGetFinishedInstanceList,
|
||||
fetchGetRunningInstanceList
|
||||
} from '@/service/api/workflow/instance';
|
||||
import { useAppStore } from '@/store/modules/app';
|
||||
import { useTable, useTableOperate } from '@/hooks/common/table';
|
||||
@ -17,8 +17,8 @@ import { loadDynamicComponent } from '@/utils/common';
|
||||
import DictTag from '@/components/custom/dict-tag.vue';
|
||||
import { $t } from '@/locales';
|
||||
import ButtonIcon from '@/components/custom/button-icon.vue';
|
||||
import ProcessInstanceSearch from './modules/process-instance-search.vue';
|
||||
import ProcessInstanceVariableDrawer from './modules/process-instance-variable-drawer.vue';
|
||||
import InstanceSearch from './modules/process-instance-search.vue';
|
||||
import InstanceVariableDrawer from './modules/process-instance-variable-drawer.vue';
|
||||
|
||||
const dynamicComponent = shallowRef();
|
||||
|
||||
@ -28,7 +28,7 @@ interface RunningStatusOption {
|
||||
}
|
||||
|
||||
defineOptions({
|
||||
name: 'ProcessInstanceList'
|
||||
name: 'InstanceList'
|
||||
});
|
||||
|
||||
useDict('wf_business_status');
|
||||
@ -61,7 +61,7 @@ function createDefaultModel(): CancelModel {
|
||||
}
|
||||
|
||||
// 基础列
|
||||
const baseColumns = ref<NaiveUI.TableColumn<Api.Workflow.ProcessInstance>[]>([
|
||||
const baseColumns = ref<NaiveUI.TableColumn<Api.Workflow.Instance>[]>([
|
||||
{
|
||||
type: 'selection',
|
||||
align: 'center',
|
||||
@ -136,7 +136,7 @@ const baseColumns = ref<NaiveUI.TableColumn<Api.Workflow.ProcessInstance>[]>([
|
||||
]);
|
||||
|
||||
// 完成列
|
||||
const finishColumns = ref<NaiveUI.TableColumn<Api.Workflow.ProcessInstance>[]>([
|
||||
const finishColumns = ref<NaiveUI.TableColumn<Api.Workflow.Instance>[]>([
|
||||
{
|
||||
key: 'updateTime',
|
||||
title: '结束时间',
|
||||
@ -146,7 +146,7 @@ const finishColumns = ref<NaiveUI.TableColumn<Api.Workflow.ProcessInstance>[]>([
|
||||
]);
|
||||
|
||||
// 操作列
|
||||
const operateColumns = ref<NaiveUI.TableColumn<Api.Workflow.ProcessInstance>[]>([
|
||||
const operateColumns = ref<NaiveUI.TableColumn<Api.Workflow.Instance>[]>([
|
||||
{
|
||||
key: 'operate',
|
||||
title: $t('common.operate'),
|
||||
@ -226,7 +226,7 @@ const {
|
||||
resetSearchParams,
|
||||
updateApiFn
|
||||
} = useTable({
|
||||
apiFn: fetchGetRunningProcessInstanceList,
|
||||
apiFn: fetchGetRunningInstanceList,
|
||||
apiParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
@ -245,7 +245,7 @@ const {
|
||||
const { checkedRowKeys, editingData, handleEdit, onBatchDeleted, onDeleted } = useTableOperate(data, getData);
|
||||
// 监听运行状态变化
|
||||
watch(runningStatus, async () => {
|
||||
const newApiFn = runningStatus.value ? fetchGetRunningProcessInstanceList : fetchGetFinishedProcessInstanceList;
|
||||
const newApiFn = runningStatus.value ? fetchGetRunningInstanceList : fetchGetFinishedInstanceList;
|
||||
updateApiFn(newApiFn);
|
||||
await getDataByPage();
|
||||
reloadColumns();
|
||||
@ -290,14 +290,14 @@ function handleResetSearch() {
|
||||
|
||||
async function handleBatchDelete() {
|
||||
// request
|
||||
const { error } = await fetchBatchDeleteProcessInstance(checkedRowKeys.value);
|
||||
const { error } = await fetchBatchDeleteInstance(checkedRowKeys.value);
|
||||
if (error) return;
|
||||
onBatchDeleted();
|
||||
}
|
||||
|
||||
async function handleDelete(instanceId: CommonType.IdType) {
|
||||
// request
|
||||
const { error } = await fetchBatchDeleteProcessInstance([instanceId]);
|
||||
const { error } = await fetchBatchDeleteInstance([instanceId]);
|
||||
if (error) return;
|
||||
onDeleted();
|
||||
}
|
||||
@ -320,7 +320,7 @@ const modules = import.meta.glob('@/components/custom/workflow/**/*.vue');
|
||||
const businessId = ref<CommonType.IdType>();
|
||||
|
||||
/** 流程预览,动态加载组件 */
|
||||
async function handlePreview(row: Api.Workflow.ProcessInstance) {
|
||||
async function handlePreview(row: Api.Workflow.Instance) {
|
||||
businessId.value = row.businessId;
|
||||
const formPath = row.formPath;
|
||||
if (formPath) {
|
||||
@ -364,7 +364,7 @@ async function handlePreview(row: Api.Workflow.ProcessInstance) {
|
||||
</NSpin>
|
||||
</template>
|
||||
<div class="h-full flex-col-stretch gap-12px overflow-hidden lt-sm:overflow-auto">
|
||||
<ProcessInstanceSearch v-model:model="searchParams" @reset="handleResetSearch" @search="getDataByPage" />
|
||||
<InstanceSearch v-model:model="searchParams" @reset="handleResetSearch" @search="getDataByPage" />
|
||||
<NCard :bordered="false" size="small" class="card-wrapper sm:flex-1-hidden">
|
||||
<template #header>
|
||||
<NSpace>
|
||||
@ -406,7 +406,7 @@ async function handlePreview(row: Api.Workflow.ProcessInstance) {
|
||||
class="sm:h-full"
|
||||
/>
|
||||
<component :is="dynamicComponent" :visible="previewVisible" operate-type="detail" :business-id="businessId" />
|
||||
<ProcessInstanceVariableDrawer v-model:visible="variableVisible" :row-data="editingData" />
|
||||
<InstanceVariableDrawer v-model:visible="variableVisible" :row-data="editingData" />
|
||||
</NCard>
|
||||
</div>
|
||||
</TableSiderLayout>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<script setup lang="tsx">
|
||||
import { useNaiveForm } from '@/hooks/common/form';
|
||||
defineOptions({
|
||||
name: 'WorkflowProcessInstanceSearch'
|
||||
name: 'WorkflowInstanceSearch'
|
||||
});
|
||||
|
||||
interface Emits {
|
||||
@ -12,7 +12,7 @@ interface Emits {
|
||||
const emit = defineEmits<Emits>();
|
||||
|
||||
const { formRef, validate, restoreValidation } = useNaiveForm();
|
||||
const model = defineModel<Api.Workflow.ProcessInstanceSearchParams>('model', { required: true });
|
||||
const model = defineModel<Api.Workflow.InstanceSearchParams>('model', { required: true });
|
||||
|
||||
async function reset() {
|
||||
await restoreValidation();
|
||||
|
@ -2,11 +2,11 @@
|
||||
import JsonPreview from '@/components/custom/json-preview.vue';
|
||||
|
||||
defineOptions({
|
||||
name: 'ProcessInstanceVariableDrawer'
|
||||
name: 'InstanceVariableDrawer'
|
||||
});
|
||||
|
||||
interface Props {
|
||||
rowData: Api.Workflow.ProcessInstance | null;
|
||||
rowData: Api.Workflow.Instance | null;
|
||||
}
|
||||
|
||||
const props = defineProps<Props>();
|
||||
|
@ -20,7 +20,7 @@ interface WaitingStatusOption {
|
||||
}
|
||||
|
||||
defineOptions({
|
||||
name: 'ProcessInstanceList'
|
||||
name: 'AllTaskWaitingList'
|
||||
});
|
||||
|
||||
useDict('wf_business_status');
|
||||
@ -127,7 +127,7 @@ const operateColumns = ref<NaiveUI.TableColumn<Api.Workflow.TaskOrHisTask>[]>([
|
||||
}
|
||||
|
||||
return (
|
||||
<div class="flex-center gap-1px">
|
||||
<div class="flex-center gap-8px">
|
||||
{buttons.map((btn, index) => (index > 0 ? [<NDivider vertical />, btn] : btn))}
|
||||
</div>
|
||||
);
|
||||
@ -288,9 +288,7 @@ function handleIntervene(row: Api.Workflow.Task) {
|
||||
:show-delete="false"
|
||||
:show-export="false"
|
||||
@refresh="getData"
|
||||
>
|
||||
<template #prefix></template>
|
||||
</TableHeaderOperation>
|
||||
></TableHeaderOperation>
|
||||
</template>
|
||||
<NDataTable
|
||||
v-model:checked-row-keys="checkedRowKeys"
|
||||
|
317
src/views/workflow/task/my-document/index.vue
Normal file
317
src/views/workflow/task/my-document/index.vue
Normal file
@ -0,0 +1,317 @@
|
||||
<script setup lang="tsx">
|
||||
import { computed, ref, shallowRef } from 'vue';
|
||||
import { NButton, NDivider, NEmpty, NInput, NTag } from 'naive-ui';
|
||||
import { useBoolean, useLoading } from '@sa/hooks';
|
||||
import { workflowActivityStatusRecord } from '@/constants/workflow';
|
||||
import { fetchBatchDeleteInstance, fetchCancelProcessApply } from '@/service/api/workflow/instance';
|
||||
import { fetchGetCategoryTree } from '@/service/api/workflow/category';
|
||||
import { fetchGetMyDocument } from '@/service/api/workflow/my-document';
|
||||
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 MyDocumentSearch from './modules/my-document-search.vue';
|
||||
|
||||
defineOptions({
|
||||
name: 'MyDocumentList'
|
||||
});
|
||||
|
||||
useDict('wf_business_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: fetchGetMyDocument,
|
||||
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: 80,
|
||||
render: row => {
|
||||
return <NTag type="info">v{row.version}.0</NTag>;
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '流程状态',
|
||||
key: 'flowStatus',
|
||||
align: 'center',
|
||||
width: 80,
|
||||
render(row) {
|
||||
return <DictTag value={row.flowStatus} dict-code="wf_business_status" />;
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
key: 'activityStatus',
|
||||
align: 'center',
|
||||
width: 80,
|
||||
render(row) {
|
||||
return (
|
||||
<NTag type={row.activityStatus === 0 ? 'warning' : 'success'}>
|
||||
{workflowActivityStatusRecord[row.activityStatus]}
|
||||
</NTag>
|
||||
);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '启动时间',
|
||||
key: 'createTime',
|
||||
align: 'center',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'operate',
|
||||
align: 'center',
|
||||
fixed: 'right',
|
||||
width: 100,
|
||||
render(row) {
|
||||
const buttons = [];
|
||||
|
||||
buttons.push(
|
||||
<ButtonIcon
|
||||
text
|
||||
type="info"
|
||||
icon="material-symbols:visibility-outline"
|
||||
tooltipContent="查看"
|
||||
onClick={() => handleOpen(row, 'detail')}
|
||||
/>
|
||||
);
|
||||
const showEditAndDelete =
|
||||
row.flowStatus === 'draft' || row.flowStatus === 'cancel' || row.flowStatus === 'back';
|
||||
if (showEditAndDelete) {
|
||||
buttons.push(
|
||||
<ButtonIcon
|
||||
text
|
||||
type="info"
|
||||
icon="material-symbols:drive-file-rename-outline-outline"
|
||||
tooltipContent="编辑"
|
||||
onClick={() => handleOpen(row, 'edit')}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (showEditAndDelete) {
|
||||
buttons.push(
|
||||
<ButtonIcon
|
||||
text
|
||||
type="error"
|
||||
icon="material-symbols:delete-outline"
|
||||
tooltipContent={$t('common.delete')}
|
||||
popconfirmContent={$t('common.confirmDelete')}
|
||||
onPositiveClick={() => handleDelete(row)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (row.flowStatus === 'waiting') {
|
||||
buttons.push(
|
||||
<ButtonIcon
|
||||
text
|
||||
type="error"
|
||||
showPopconfirmIcon={false}
|
||||
icon="material-symbols:cancel-outline-rounded"
|
||||
tooltipContent="撤销"
|
||||
popconfirmContent="确认撤销此流程申请?"
|
||||
onPositiveClick={() => handleCancelProcessApply(row.businessId)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div class="flex-center gap-8px">
|
||||
{buttons.map((btn, index) => (index > 0 ? [<NDivider vertical />, btn] : btn))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const { checkedRowKeys, editingData: _editingData, handleEdit: _handleEdit } = 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 operateType = ref<CommonType.WorkflowTableOperateType>();
|
||||
|
||||
async function handleOpen(row: Api.Workflow.Instance, type: 'edit' | 'detail') {
|
||||
operateType.value = type;
|
||||
businessId.value = row.businessId;
|
||||
const formPath = row.formPath;
|
||||
if (formPath) {
|
||||
dynamicComponent.value = await loadDynamicComponent(modules, formPath);
|
||||
showViewDrawer();
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDelete(row: Api.Workflow.Instance) {
|
||||
const { error } = await fetchBatchDeleteInstance([row.id]);
|
||||
if (error) return;
|
||||
window.$message?.success('删除成功');
|
||||
getData();
|
||||
}
|
||||
|
||||
async function handleCancelProcessApply(id: CommonType.IdType) {
|
||||
const { error } = await fetchCancelProcessApply({ businessId: id, message: '申请人撤销流程!' });
|
||||
if (error) return;
|
||||
window.$message?.success('撤销成功');
|
||||
getData();
|
||||
}
|
||||
</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">
|
||||
<MyDocumentSearch 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="operateType"
|
||||
:business-id="businessId"
|
||||
@submitted="getData"
|
||||
/>
|
||||
</NCard>
|
||||
</div>
|
||||
</TableSiderLayout>
|
||||
</template>
|
@ -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.InstanceSearchParams>('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>
|
Loading…
Reference in New Issue
Block a user