Skip to content
Merged

Dev #84

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions apps/app-pc/src/api/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,31 @@ export const remove = (id:string) => {
export const changeState = (id:string) => {
return httpClient.post('/api/cmd/workflow/changeState',{id});
}

/**
* 当前用户是否可执行「同步流程」(仅流程管理员)
*/
export const forceSyncPermission = () => {
return httpClient.get('/api/query/workflow/permission/forceSync');
}

export interface ForceSyncRequest {
/** 流程编码 */
workCode: string;
/** 需要同步的流程实例,未指定的实例不受影响 */
processIds: string[];
}

export interface ForceSyncResult {
workflowRuntimeId: number;
workVersion: number;
syncedProcessIds: string[];
skippedProcessIds: string[];
}

/**
* 把指定流程实例的配置同步为最新流程设计
*/
export const forceSync = (request: ForceSyncRequest) => {
return httpClient.post('/api/cmd/record/forceSync', request);
}
56 changes: 55 additions & 1 deletion apps/app-pc/src/pages/todo.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from "react";
import { done, list, notify, todo } from "@/api/record.ts";
import { forceSync, forceSyncPermission, type ForceSyncResult } from "@/api/workflow.ts";
import { ApprovalPanelDrawer, FlowTitle, WorkflowSelectModal } from "@coding-flow/flow-pc-approval";
import { Table, type TableProps } from "@coding-flow/flow-pc-ui";
import { Button, Space, Tabs, type TabsProps } from "antd";
import { Button, message, Popconfirm, Space, Tabs, type TabsProps } from "antd";
import dayjs from "dayjs";
import { EventBus, type ActionType } from "@coding-flow/flow-core";

Expand All @@ -19,6 +20,34 @@ const TodoPage: React.FC = () => {
const [workflowCode, setWorkflowCode] = React.useState<string>('');
const [currentRecordId, setCurrentRecordId] = React.useState<string>('');
const [currentTab, setCurrentTab] = React.useState<string>('todo');
// 同步流程属于流程管理员的干预操作,非管理员不展示该操作
const [canForceSync, setCanForceSync] = React.useState<boolean>(false);

React.useEffect(() => {
forceSyncPermission().then(res => {
setCanForceSync(!!res.data);
})
}, []);

/**
* 把该流程实例的配置同步为最新流程设计(仅未完成的流程允许操作)
*/
const handleForceSync = (record: any) => {
forceSync({
workCode: record.workCode,
processIds: [record.processId],
}).then(res => {
if (res.success) {
const result = res.data as ForceSyncResult | undefined;
if ((result?.syncedProcessIds?.length ?? 0) > 0) {
message.success('同步成功');
} else {
message.info('该流程已是最新设计,无需同步');
}
actionAll.current?.reload();
}
})
}

const columns: TableProps<any>['columns'] = [
{
Expand Down Expand Up @@ -86,6 +115,31 @@ const TodoPage: React.FC = () => {
>办理</a>
</Space>
)
} else if (currentTab === 'all') {
return (
<Space>
<a
onClick={() => {
setCurrentRecordId(record.recordId);
setReviewVisible(true);
setApprovalVisible(true);
}}
>详情</a>
{
// 仅未完成的流程(flowState=0 运行中)允许把配置同步为最新设计
canForceSync && record.flowState === 0 && (
<Popconfirm
title={"确认将该流程的配置同步为最新流程设计吗?"}
onConfirm={() => {
handleForceSync(record);
}}
>
<a>同步流程</a>
</Popconfirm>
)
}
</Space>
)
} else {
return (
<Space>
Expand Down
6 changes: 6 additions & 0 deletions packages/flow-approval-presenter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @coding-flow/flow-approval-presenter

## 0.2.22

### Patch Changes

- 版本号升级至 0.2.22(配合后端版本升级,本包无对外功能变更)

## 0.2.21

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/flow-approval-presenter/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coding-flow/flow-approval-presenter",
"version": "0.2.21",
"version": "0.2.22",
"description": "flow-engine approval presenter framework ",
"type": "module",
"sideEffects": [
Expand Down
6 changes: 6 additions & 0 deletions packages/flow-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @coding-flow/flow-core

## 0.2.22

### Patch Changes

- 版本号升级至 0.2.22(配合后端版本升级,本包无对外功能变更)

## 0.2.21

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/flow-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coding-flow/flow-core",
"version": "0.2.21",
"version": "0.2.22",
"description": "flow-engine core lib framework ",
"type": "module",
"sideEffects": [
Expand Down
6 changes: 6 additions & 0 deletions packages/flow-design/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @coding-flow/flow-design

## 0.2.22

### Patch Changes

- 版本号升级至 0.2.22(配合后端版本升级,本包无对外功能变更)

## 0.2.21

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/flow-design/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coding-flow/flow-design",
"version": "0.2.21",
"version": "0.2.22",
"description": "flow-engine design components ",
"type": "module",
"sideEffects": [
Expand Down
46 changes: 46 additions & 0 deletions packages/flow-design/src/api/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,49 @@ export const importWorkflow = (request: WorkflowImportRequest) => {
export const workflowCodeExists = (code: string) => {
return httpClient.get('/api/cmd/workflow/exists', {code});
}

/**
* 运行中的流程实例(以开始节点记录代表一个实例),用于强制同步时选择范围
*/
export interface RunningInstanceQuery {
workCode: string;
current: number;
pageSize: number;
}

export interface RunningInstanceItem {
processId: string;
recordId: number;
title?: string;
workTitle?: string;
workCode?: string;
nodeName?: string;
createOperatorId?: number;
createOperatorName?: string;
createTime?: number;
workflowRuntimeId?: number;
}

export const runningInstances = (request: RunningInstanceQuery) => {
return httpClient.page('/api/query/record/running', request, {}, {}, []);
}

export interface ForceSyncRequest {
workCode: string;
/** 选中同步的流程实例,未选中的实例不会被修改 */
processIds: string[];
}

export interface ForceSyncResult {
workflowRuntimeId: number;
workVersion: number;
syncedProcessIds: string[];
skippedProcessIds: string[];
}

/**
* 运行中流程实例强制同步最新流程设计
*/
export const forceSync = (request: ForceSyncRequest) => {
return httpClient.post('/api/cmd/record/forceSync', request);
}
6 changes: 6 additions & 0 deletions packages/flow-icons/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @coding-flow/flow-icons

## 0.2.22

### Patch Changes

- 版本号升级至 0.2.22(配合后端版本升级,本包无对外功能变更)

## 0.2.21

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/flow-icons/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coding-flow/flow-icons",
"version": "0.2.21",
"version": "0.2.22",
"description": "flow-engine icons ",
"type": "module",
"sideEffects": [
Expand Down
6 changes: 6 additions & 0 deletions packages/flow-mobile/flow-mobile-approval/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @coding-flow/flow-mobile-approval

## 0.2.22

### Patch Changes

- 版本号升级至 0.2.22(配合后端版本升级,本包无对外功能变更)

## 0.2.21

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/flow-mobile/flow-mobile-approval/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coding-flow/flow-mobile-approval",
"version": "0.2.21",
"version": "0.2.22",
"description": "flow-engine pc mobile approval components",
"type": "module",
"sideEffects": [
Expand Down
6 changes: 6 additions & 0 deletions packages/flow-mobile/flow-mobile-form/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @coding-flow/flow-mobile-form

## 0.2.22

### Patch Changes

- 版本号升级至 0.2.22(配合后端版本升级,本包无对外功能变更)

## 0.2.21

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/flow-mobile/flow-mobile-form/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coding-flow/flow-mobile-form",
"version": "0.2.21",
"version": "0.2.22",
"description": "flow-engine mobile form engine",
"type": "module",
"sideEffects": [
Expand Down
6 changes: 6 additions & 0 deletions packages/flow-mobile/flow-mobile-ui/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @coding-flow/flow-mobile-ui

## 0.2.22

### Patch Changes

- 版本号升级至 0.2.22(配合后端版本升级,本包无对外功能变更)

## 0.2.21

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/flow-mobile/flow-mobile-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coding-flow/flow-mobile-ui",
"version": "0.2.21",
"version": "0.2.22",
"description": "flow-engine mobile ui components",
"type": "module",
"sideEffects": [
Expand Down
6 changes: 6 additions & 0 deletions packages/flow-pc/flow-pc-approval/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @coding-flow/flow-pc-approval

## 0.2.22

### Patch Changes

- 版本号升级至 0.2.22(配合后端版本升级,本包无对外功能变更)

## 0.2.21

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/flow-pc/flow-pc-approval/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coding-flow/flow-pc-approval",
"version": "0.2.21",
"version": "0.2.22",
"description": "flow-engine pc form approval components",
"type": "module",
"sideEffects": [
Expand Down
6 changes: 6 additions & 0 deletions packages/flow-pc/flow-pc-form/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @coding-flow/flow-pc-form

## 0.2.22

### Patch Changes

- 版本号升级至 0.2.22(配合后端版本升级,本包无对外功能变更)

## 0.2.21

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/flow-pc/flow-pc-form/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coding-flow/flow-pc-form",
"version": "0.2.21",
"version": "0.2.22",
"description": "flow-engine pc form engine",
"type": "module",
"sideEffects": [
Expand Down
6 changes: 6 additions & 0 deletions packages/flow-pc/flow-pc-ui/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @coding-flow/flow-pc-ui

## 0.2.22

### Patch Changes

- 版本号升级至 0.2.22(配合后端版本升级,本包无对外功能变更)

## 0.2.21

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/flow-pc/flow-pc-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coding-flow/flow-pc-ui",
"version": "0.2.21",
"version": "0.2.22",
"description": "flow-engine pc ui components",
"type": "module",
"sideEffects": [
Expand Down
6 changes: 6 additions & 0 deletions packages/flow-types/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @coding-flow/flow-types

## 0.2.22

### Patch Changes

- 版本号升级至 0.2.22(配合后端版本升级,本包无对外功能变更)

## 0.2.21

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/flow-types/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coding-flow/flow-types",
"version": "0.2.21",
"version": "0.2.22",
"description": "flow-engine types",
"type": "module",
"sideEffects": [
Expand Down
Loading