;
-
- private constructor() {
- this.events = new Map();
- }
-
- public static getInstance(): EventBus {
- if (!this.instance) {
- this.instance = new EventBus();
- }
- return this.instance;
- }
-
- public on(eventName: string, callback: Function): void {
- const callbacks = this.events.get(eventName) || [];
- callbacks.push(callback);
- this.events.set(eventName, callbacks);
- }
-
- public emit(eventName: string, ...args: any[]): void {
- const callbacks = this.events.get(eventName);
- if (callbacks) {
- callbacks.forEach((callback) => {
- try {
- callback(...args);
- } catch (err) {
- console.error(
- `Error executing callback for event: ${eventName}`,
- err
- );
- }
- });
- }
- }
-
- public off(eventName: string, callback?: Function): void {
- if (callback) {
- const callbacks = this.events.get(eventName);
- if (callbacks) {
- const callbackIndex = callbacks.indexOf(callback);
- if (callbackIndex > -1) {
- callbacks.splice(callbackIndex, 1);
- if (callbacks.length === 0) {
- this.events.delete(eventName);
- } else {
- this.events.set(eventName, callbacks);
- }
- }
- }
- } else {
- this.events.delete(eventName);
- }
- }
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-core/src/groovy.ts b/frontend/packages/flow-core/src/groovy.ts
deleted file mode 100644
index b823e008..00000000
--- a/frontend/packages/flow-core/src/groovy.ts
+++ /dev/null
@@ -1,459 +0,0 @@
-/** 自定义脚本标记 */
-export const CUSTOM_SCRIPT = '@CUSTOM_SCRIPT';
-
-/** 脚本标题标记 */
-export const SCRIPT_TITLE = '@SCRIPT_TITLE';
-
-
-/** 脚本元数据标记 */
-export const SCRIPT_META = '@SCRIPT_META';
-
-
-/**
- * Groovy脚本格式化器
- */
-export class GroovyFormatter {
- /**
- * 格式化Groovy脚本内容
- * @param script Groovy脚本内容
- * @returns 格式化后的脚本
- */
- static formatScript(script: string): string {
- if (!script || script.trim().length === 0) {
- return '';
- }
-
- let formatted = script;
-
- // 1. 基础trim处理
- formatted = formatted.trim();
-
- // 2. 统一换行符为\n
- formatted = formatted.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
-
- // 3. 去除多余空行(保留单个空行)
- formatted = formatted.replace(/\n\s*\n/g, '\n\n');
-
- // 4. 去除行尾空白
- const lines = formatted.split('\n');
- formatted = lines
- .map(line => line.replace(/\s+$/, ''))
- .join('\n');
-
- // 5. 移除末尾多余的换行符
- formatted = formatted.replace(/\n+$/, '\n');
-
- // 6. 缩进规范化
- formatted = this.normalizeIndentation(formatted);
-
- return formatted;
- }
-
- /**
- * 规范化缩进
- */
- private static normalizeIndentation(script: string): string {
- const lines = script.split('\n');
- const result: string[] = [];
- let indentLevel = 0;
- let inMultilineString = false;
- let multilineStringDelimiter = '';
-
- for (let i = 0; i < lines.length; i++) {
- let line = lines[i];
- const trimmedLine = line.trim();
-
- // 跳过空行但保留空行
- if (trimmedLine.length === 0) {
- result.push('');
- continue;
- }
-
- // 处理多行字符串(Groovy支持'''和""")
- if (!inMultilineString) {
- if (trimmedLine.includes("'''") || trimmedLine.includes('"""')) {
- const delimiter = trimmedLine.includes("'''") ? "'''" : '"""';
- const count = (trimmedLine.match(new RegExp(delimiter, 'g')) || []).length;
-
- if (count % 2 === 1) {
- inMultilineString = true;
- multilineStringDelimiter = delimiter;
- }
- }
- } else {
- // 检查多行字符串结束
- if (trimmedLine.includes(multilineStringDelimiter)) {
- const count = (trimmedLine.match(new RegExp(multilineStringDelimiter, 'g')) || []).length;
- if (count % 2 === 1) {
- inMultilineString = false;
- multilineStringDelimiter = '';
- }
- }
- }
-
- // 如果不是在多行字符串内,进行缩进调整
- if (!inMultilineString) {
- // 减少缩进的条件
- const shouldDecreaseIndent = this.shouldDecreaseIndent(trimmedLine);
- if (shouldDecreaseIndent) {
- indentLevel = Math.max(0, indentLevel - 1);
- }
-
- // 添加当前行的缩进
- const indentation = ' '.repeat(indentLevel);
-
- // 增加缩进的条件
- if (this.shouldIncreaseIndent(trimmedLine)) {
- indentLevel++;
- }
-
- result.push(indentation + trimmedLine);
- } else {
- // 在多行字符串内,保持原样但保留基础缩进
- result.push(line);
- }
- }
-
- return result.join('\n');
- }
-
- /**
- * 判断是否需要增加缩进
- */
- private static shouldIncreaseIndent(line: string): boolean {
- // Groovy中需要增加缩进的语法结构
- const increasePatterns = [
- /.*\{\s*$/, // 代码块开始 {
- /.*\(\s*$/, // 方法参数开始 (
- /.*\[\s*$/, // 列表/映射开始 [
- /^if\s*\(.*\)\s*$/, // if语句
- /^for\s*\(.*\)\s*$/, // for循环
- /^while\s*\(.*\)\s*$/, // while循环
- /^switch\s*\(.*\)\s*$/, // switch语句
- /^try\s*$/, // try语句
- /^catch\s*\(.*\)\s*$/, // catch语句
- /^finally\s*$/, // finally语句
- /^else\s*$/, // else语句
- /^else\s+if\s*\(.*\)\s*$/, // else if语句
- /.*->\s*$/, // Groovy闭包
- /^def\s+\w+\s*=\s*\{/, // 定义闭包
- /^class\s+\w+/, // 类定义
- /^interface\s+\w+/, // 接口定义
- /^enum\s+\w+/, // 枚举定义
- /^annotation\s+\w+/, // 注解定义
- /^trait\s+\w+/, // trait定义
- /^static\s*\{/, // 静态初始化块
- ];
-
- return increasePatterns.some(pattern => pattern.test(line));
- }
-
- /**
- * 判断是否需要减少缩进
- */
- private static shouldDecreaseIndent(line: string): boolean {
- // Groovy中需要减少缩进的语法结构
- const decreasePatterns = [
- /^\}/, // 闭包结束 }
- /^\]/, // 列表/映射结束 ]
- /^\)/, // 参数结束 )
- /^else\b/, // else语句(如果else在新行)
- /^catch\b/, // catch语句
- /^finally\b/, // finally语句
- /^case\b/, // case语句
- /^default\s*:/, // default语句
- ];
-
- return decreasePatterns.some(pattern => pattern.test(line));
- }
-
- /**
- * 增强版格式化:包含更多Groovy特定处理
- */
- static formatGroovyScript(script: string, options?: FormatOptions): string {
- if (!script || script.trim().length === 0) {
- return '';
- }
-
- const opts = {
- indentSize: 4,
- addSpacesAroundOperators: true,
- formatComments: true,
- ...options
- };
-
- let formatted = script;
-
- // 1. 基础清理
- formatted = formatted.trim();
- formatted = formatted.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
-
- // 2. 格式化注释
- if (opts.formatComments) {
- formatted = this.formatComments(formatted);
- }
-
- // 3. 操作符周围添加空格
- if (opts.addSpacesAroundOperators) {
- formatted = this.addSpacesAroundOperators(formatted);
- }
-
- // 4. 逗号和分号后添加空格
- formatted = formatted.replace(/,(?!\s)/g, ', ');
- formatted = formatted.replace(/;(?!\s)/g, '; ');
-
- // 5. 去除多余空格
- formatted = formatted.replace(/\s+/g, ' ');
-
- // 6. 还原必要的换行
- const lines = formatted.split(';');
- if (lines.length > 1) {
- formatted = lines
- .map(line => line.trim())
- .filter(line => line.length > 0)
- .join(';\n');
- }
-
- // 7. 应用缩进规范化
- formatted = this.normalizeIndentation(formatted);
-
- // 8. 特殊处理Groovy特定的语法
- formatted = this.formatGroovySpecific(formatted);
-
- return formatted;
- }
-
- /**
- * 格式化注释
- */
- private static formatComments(script: string): string {
- // 处理单行注释
- let formatted = script.replace(/\/\/\s*/g, '// ');
-
- // 处理多行注释
- formatted = formatted.replace(/\/\*(\s*)\*\//g, '/**$1*/');
-
- return formatted;
- }
-
- /**
- * 操作符周围添加空格
- */
- private static addSpacesAroundOperators(script: string): string {
- // 操作符列表
- const operators = [
- '=', '==', '!=', '===', '!==',
- '>', '<', '>=', '<=',
- '+', '-', '*', '/', '%',
- '&&', '||', '&', '|', '^',
- '<<', '>>', '>>>',
- '+=', '-=', '*=', '/=', '%=', '&=', '|=', '^=', '<<=', '>>=', '>>>='
- ];
-
- let formatted = script;
-
- // 为每个操作符添加空格(避免在字符串内操作)
- operators.forEach(op => {
- // 使用正则表达式,确保不在字符串内
- const regex = new RegExp(`(?/g, '{ $2 ->');
-
- // 3. 格式化列表和映射
- formatted = formatted.replace(/\[(\s*)(\w+)(\s*):/g, '[$2:');
-
- // 4. 格式化注解
- formatted = formatted.replace(/@(\w+)\((\s*)(\w+)(\s*)=/g, '@$1($3=');
-
- // 5. 格式化安全导航操作符
- formatted = formatted.replace(/(\w+)(\s*)\?\.(\s*)(\w+)/g, '$1?.$4');
-
- // 6. 格式化展开操作符
- formatted = formatted.replace(/(\w+)(\s*)\*\.(\s*)(\w+)/g, '$1*.$4');
-
- return formatted;
- }
-
- /**
- * 压缩脚本(移除所有非必要空白)
- */
- static minifyScript(script: string): string {
- if (!script || script.trim().length === 0) {
- return '';
- }
-
- let minified = script;
-
- // 移除注释
- minified = minified.replace(/\/\/.*$/gm, '');
- minified = minified.replace(/\/\*[\s\S]*?\*\//g, '');
-
- // 移除多余空白
- minified = minified.replace(/\s+/g, ' ');
-
- // 移除不必要的空格
- minified = minified.replace(/\s*([{}();,=+\-*/%&|<>!])\s*/g, '$1');
-
- // 移除空行
- minified = minified.replace(/\n\s*\n/g, '\n');
-
- return minified.trim();
- }
-}
-
-/**
- * 格式化选项接口
- */
-export interface FormatOptions {
- indentSize?: number; // 缩进大小(空格数)
- addSpacesAroundOperators?: boolean; // 操作符周围添加空格
- formatComments?: boolean; // 格式化注释
- maxLineLength?: number; // 最大行长度
- preserveEmptyLines?: boolean; // 保留空行
-}
-
-
-
-/**
- * Groovy脚本转换器工具类,提供一些通用的脚本处理方法
- */
-export class GroovyScriptConvertorUtil {
-
- /**
- * 判断脚本是否包含自定义注释标记
- * @param script
- */
- public static isCustomScript(script: string): boolean {
- return script.includes(CUSTOM_SCRIPT);
- }
-
-
- /**
- * 格式化脚本内容,去除多余空白等
- * @param script
- */
- public static formatScript(script: string): string {
- // 这里可以添加一些格式化逻辑,比如统一换行、缩进等
- return GroovyFormatter.formatScript(script);
- }
-
-
- /**
- * 将普通脚本转换为包含自定义注释标记的脚本
- * @param script
- */
- public static toCustomScript(script: string): string {
- if (GroovyScriptConvertorUtil.isCustomScript(script)) {
- return GroovyFormatter.formatScript(script);
- }
- return GroovyFormatter.formatScript(`// ${CUSTOM_SCRIPT}\n${script}`);
- }
-
-
- /**
- * 获取脚本中的标题注释内容
- * @param script
- */
- public static getScriptTitle(script: string): string {
- const titleMatch = script.match(new RegExp(`//\\s*${SCRIPT_TITLE}\\s*(.+)`));
- if (titleMatch) {
- return titleMatch[1].trim();
- }
- return '';
- }
-
- /**
- * 更新脚本中的标题注释内容,如果不存在则添加
- * @param script
- * @param title
- */
- public static updateScriptTitle(script: string, title: string): string {
- const titleComment = `// ${SCRIPT_TITLE} ${title}`;
- if (GroovyScriptConvertorUtil.getScriptTitle(script)) {
- return script.replace(new RegExp(`//\\s*${SCRIPT_TITLE}\\s*.+`), titleComment);
- } else {
- return `${titleComment}\n${script}`;
- }
- }
-
-
- /**
- * 获取脚本中的元数据
- * @param script
- */
- public static getScriptMeta(script: string): string {
- const titleMatch = script.match(new RegExp(`//\\s*${SCRIPT_META}\\s*(.+)`));
- if (titleMatch) {
- return titleMatch[1].trim();
- }
- return '';
- }
-
-
- /**
- * 更新脚本中的元数据内容,如果不存在则添加
- * @param script
- * @param meta
- */
- public static updateScriptMeta(script: string, meta: string): string {
- const metaComment = `// ${SCRIPT_META} ${meta}`;
- if (GroovyScriptConvertorUtil.getScriptMeta(script)) {
- return script.replace(new RegExp(`//\\s*${SCRIPT_META}\\s*.+`), metaComment);
- } else {
- return `${metaComment}\n${script}`;
- }
- }
-
-
- /**
- * 清除脚本中的注释
- * @param script
- */
- public static clearComments(script: string): string {
- return script.replace(/\/\/.*$/gm, '').trim();
- }
-
- /**
- * 提取脚本中的return表达式
- * @param script
- */
- public static getReturnScript(script: string): string {
- try {
- let result = GroovyScriptConvertorUtil.clearComments(script);
- const funcMatch = result.match(/def\s+run\s*\([^)]*\)\s*\{([\s\S]*)\}/);
- if (funcMatch) {
- result = funcMatch[1];
- }
- const returnMatch = result.match(/return\s+(.+?);?\s*$/m);
- if (returnMatch) {
- result = returnMatch[1].trim();
- } else {
- // 如果没有找到return语句,可能整个脚本就是表达式
- result = result.trim();
- }
-
- return result;
- } catch (e) {
- return '';
- }
- }
-
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-core/src/hooks.ts b/frontend/packages/flow-core/src/hooks.ts
deleted file mode 100644
index a99e93c5..00000000
--- a/frontend/packages/flow-core/src/hooks.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import React from "react";
-import {BasePresenter, PresenterConstructor} from "@/presenter.ts";
-
-export class PresenterHooks {
-
- public static create,S,M>(PresenterClass:PresenterConstructor
,
- initStata:S,
- model:M){
- const [state, dispatch] = React.useState(initStata);
-
- const ref = React.useRef
(null);
-
- if (!ref.current) {
- ref.current = new PresenterClass(state, dispatch, model);
- }
-
- React.useEffect(() => {
- ref.current?.syncState(state);
- }, [state]);
-
- return {
- state,
- presenter: ref.current
- }
- }
-
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-core/src/http.ts b/frontend/packages/flow-core/src/http.ts
deleted file mode 100644
index 261aa977..00000000
--- a/frontend/packages/flow-core/src/http.ts
+++ /dev/null
@@ -1,233 +0,0 @@
-import axios, {AxiosInstance} from "axios";
-import {sleep} from "./sleep";
-import {Base64Utils} from "./base64";
-
-export interface MessageBox {
- success: (msg: string) => void;
- error: (msg: string) => void;
-}
-
-export type Response = {
- success: boolean;
- errCode?: string;
- errMessage?: string;
- data?: any;
- total?: number;
-}
-
-export class HttpClient {
- private readonly api: AxiosInstance;
- private readonly messageBox: MessageBox;
-
- constructor(timeout: number, messageBox: MessageBox, baseUrl = '') {
- this.messageBox = messageBox;
- this.api = axios.create({
- timeout: timeout,
- baseURL: baseUrl,
- headers: {
- "Content-Type": "application/json",
- },
- });
-
- this.addRequestInterceptors();
- this.addResponseInterceptors();
- }
-
- private addRequestInterceptors() {
- this.api.interceptors.request.use((config: any) => {
- const token = localStorage.getItem("token");
- if (token) {
- config.headers = {
- Authorization: `${token}`,
- } as any;
- }
- return config;
- }, (error: any) => {
- return Promise.reject(error);
- });
- }
-
- private addResponseInterceptors() {
- this.api.interceptors.response.use(async (response: any) => {
- const headers = response.headers;
- const token = headers['authorization'];
-
- const state = response.status;
- if (state === 200) {
- if (token) {
- console.log('reset token', token);
- localStorage.setItem("token", token)
- }
-
- if (response.data) {
- const success = response.data.success;
- if (!success) {
- const errMessage = response.data.errMessage;
- const errCode = response.data.errCode;
- if ("token.expire" === errCode || "token.error" === errCode) {
- this.messageBox.error('登录已过期,请退出再重新打开');
- await sleep(1500);
- localStorage.clear();
- window.location.href = '/#login';
- } else {
- if ("login.error" === errCode) {
- return response;
- }
- this.messageBox.error(errMessage)
- }
- }
- } else {
- this.messageBox.error('抱歉,该账户无权限访问');
- }
- }
- return response;
- },
- (error: any) => {
- const response = error.response;
- const state = response.data.status;
-
- if (state === 403) {
- this.messageBox.error('抱歉,该账户无权限访问');
- return {
- data: {
- success: false,
- }
- }
- }
- return Promise.reject(error);
- }
- )
- }
-
- public get = async (url: string, params?: any): Promise => {
- try {
- const response = await this.api.get(url, {
- params
- });
- return response.data as Response;
- } catch (err:any) {
- return {
- success: false,
- errMessage:err.message,
- errCode:'http.error'
- }
- }
- }
-
- public put = async (url: string, data: any): Promise => {
- try {
- const response = await this.api.put(url, data);
- return response.data as Response;
- } catch (err:any) {
- return {
- success: false,
- errMessage:err.message,
- errCode:'http.error'
- }
- }
- }
-
- public delete = async (url: string, params?: any): Promise => {
- try {
- const response = await this.api.delete(url, {
- params
- });
- return response.data as Response;
- } catch (err:any) {
- return {
- success: false,
- errMessage:err.message,
- errCode:'http.error'
- }
- }
- }
-
- public post = async (url: string, data: any): Promise => {
- try {
- const response = await this.api.post(url, data);
- return response.data as Response;
- } catch (err:any) {
- return {
- success: false,
- errMessage:err.message,
- errCode:'http.error'
- }
- }
- }
-
-
- public page = async (url: string, params: any, sort: any, filter: any, match: {
- key: string,
- type: string
- }[]): Promise => {
- const base64Match = Base64Utils.stringToBase64(JSON.stringify(match));
- const base64Sort = Base64Utils.stringToBase64(JSON.stringify(sort));
- const base64Filter = Base64Utils.stringToBase64(JSON.stringify(filter));
-
- const response = await this.get(url, {
- ...params,
- sort: base64Sort,
- filter: base64Filter,
- params: base64Match,
- });
-
- if (response.success) {
- const list = response.data.total > 0 ? response.data.list : [];
- return {
- data: list,
- success: response.success,
- total: response.data.total
- };
- } else {
- return {
- data: [],
- success: response.success,
- total: 0
- }
- }
- }
-
-
- public download = async (url: string, filename?: string) => {
- try {
- const token = localStorage.getItem("token");
- const response = await axios.get(url, {
- responseType: 'blob',
- headers: {
- 'Authorization': token,
- }
- });
- const bytes = await response.data;
- const blob = new Blob([bytes]);
- const downloadUrl = window.URL.createObjectURL(blob);
- const a = document.createElement('a');
- a.href = downloadUrl;
- a.download = filename || 'result.csv';
- a.click();
- } catch (e) {
- console.log(e);
- }
- }
-
- public postDownload = async (url: string, data: any, filename?: string) => {
- try {
- const token = localStorage.getItem("token");
- const response = await axios.post(url, data, {
- responseType: 'blob',
- headers: {
- 'Authorization': token,
- }
- });
- const bytes = await response.data;
- const blob = new Blob([bytes]);
- const downloadUrl = window.URL.createObjectURL(blob);
- const a = document.createElement('a');
- a.href = downloadUrl;
- a.download = filename || 'result.csv';
- a.click();
- } catch (e) {
- console.log(e);
- }
- }
-
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-core/src/index.ts b/frontend/packages/flow-core/src/index.ts
deleted file mode 100644
index fd629ef4..00000000
--- a/frontend/packages/flow-core/src/index.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-export * from "./base64";
-export * from "./dispatch";
-export * from "./http";
-export * from "./presenter";
-export * from "./hooks.ts";
-export * from "./object.ts";
-export * from "./table.ts";
-export * from "./view-plugin.ts";
-export * from "./groovy.ts";
-export * from "./event.ts";
\ No newline at end of file
diff --git a/frontend/packages/flow-core/src/object.ts b/frontend/packages/flow-core/src/object.ts
deleted file mode 100644
index 7013adc9..00000000
--- a/frontend/packages/flow-core/src/object.ts
+++ /dev/null
@@ -1,61 +0,0 @@
-export class ObjectUtils {
-
- public static isEmptyObject(obj: any) {
- return Object.keys(obj).length === 0 && obj.constructor === Object;
- }
-
- public static isEqual(obj1: any, obj2: any): boolean {
- return JSON.stringify(obj1) === JSON.stringify(obj2);
- }
-
- public static cleanObject(obj: any, options = {
- removeNull: true,
- removeUndefined: true,
- removeEmptyString: true,
- removeEmptyArray: true,
- removeEmptyObject: true,
- }) {
- const {
- removeNull,
- removeUndefined,
- removeEmptyString,
- removeEmptyArray,
- removeEmptyObject,
- } = options;
-
- let newObj: any = {};
-
- for (const [key, value] of Object.entries(obj)) {
- // 跳过 null
- if (removeNull && value === null) continue;
-
- // 跳过 undefined
- if (removeUndefined && value === undefined) continue;
-
- // 跳过空字符串
- if (removeEmptyString && value === '') continue;
-
- // 跳过空数组
- if (removeEmptyArray && Array.isArray(value) && value.length === 0) continue;
-
- // 跳过空对象
- if (removeEmptyObject &&
- value &&
- typeof value === 'object' &&
- !Array.isArray(value) &&
- Object.keys(value).length === 0) continue;
-
- // 递归处理嵌套对象
- if (value && typeof value === 'object' && !Array.isArray(value)) {
- const cleaned = ObjectUtils.cleanObject(value, options);
- // 只有当清理后的对象不为空时才保留
- if (Object.keys(cleaned).length > 0) {
- newObj[key] = cleaned;
- }
- } else {
- newObj[key] = value;
- }
- }
- return newObj;
- }
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-core/src/presenter.ts b/frontend/packages/flow-core/src/presenter.ts
deleted file mode 100644
index 80215202..00000000
--- a/frontend/packages/flow-core/src/presenter.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-import {Dispatch} from "@/dispatch.ts";
-
-export class BasePresenter {
-
- protected state:S;
- protected readonly dispatch:Dispatch;
- protected readonly model:M;
-
- public constructor(state:S, dispatch:Dispatch,model:M){
- this.state = state;
- this.dispatch = dispatch;
- this.model = model;
- }
-
- public syncState(state:S){
- this.state = state;
- }
-}
-
-export type PresenterConstructor, S, M> = {
- new(state: S, dispatch: Dispatch, model: M): P;
-};
diff --git a/frontend/packages/flow-core/src/sleep.ts b/frontend/packages/flow-core/src/sleep.ts
deleted file mode 100644
index 67d15ea1..00000000
--- a/frontend/packages/flow-core/src/sleep.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-export const sleep = async (time: number) => {
- return new Promise((resolve:any) => {
- setTimeout(() => {
- resolve();
- }, time);
- })
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-core/src/table.ts b/frontend/packages/flow-core/src/table.ts
deleted file mode 100644
index 50626a39..00000000
--- a/frontend/packages/flow-core/src/table.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-export interface Result {
- data:T[]
- total: number;
- success: boolean
-}
-
-export interface ActionType {
- reload(): void;
-}
-
-export interface ParamRequest {
- current: number;
- pageSize: number;
- [key: string]: any;
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-core/src/view-plugin.ts b/frontend/packages/flow-core/src/view-plugin.ts
deleted file mode 100644
index 6f9a3393..00000000
--- a/frontend/packages/flow-core/src/view-plugin.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-import React from "react";
-
-/**
- * 视图绑定插件,提供视图组件注册和获取功能
- */
-export class ViewBindPlugin {
-
- private readonly cache:Map>;
-
- private static readonly instance:ViewBindPlugin = new ViewBindPlugin();
-
- private constructor(){
- this.cache = new Map();
- }
-
- public static getInstance(){
- return this.instance;
- }
-
- public register(name:string,view:React.ComponentType){
- this.cache.set(name,view);
- }
-
- public get(name:string){
- return this.cache.get(name);
- }
-
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-core/tests/groovy.test.ts b/frontend/packages/flow-core/tests/groovy.test.ts
deleted file mode 100644
index 30505833..00000000
--- a/frontend/packages/flow-core/tests/groovy.test.ts
+++ /dev/null
@@ -1,113 +0,0 @@
-import {describe, expect, it} from '@rstest/core';
-import {GroovyScriptConvertorUtil} from "@/groovy";
-
-describe('GroovyScriptUtil', () => {
-
- describe('getReturnScript1', () => {
- it('get groovy script return data', () => {
- const script = `
-// @CUSTOM_SCRIPT
-def run(request){
- return "你有一条" + request.getOperatorName() + "的" + request.getWorkflowTitle() + "待办消息 【" + request.getNodeName() + "】"
-}`
- const result = GroovyScriptConvertorUtil.getReturnScript(script)
- expect(result).toEqual(`"你有一条" + request.getOperatorName() + "的" + request.getWorkflowTitle() + "待办消息 【" + request.getNodeName() + "】"`);
- });
- });
-
- describe('getReturnScript2', () => {
- it('get groovy script return data', () => {
- const script = `
-def run(request){
- return [request.getCreateOperator(),request.getCurrentOperator()]
-}`
- const result = GroovyScriptConvertorUtil.getReturnScript(script)
- expect(result).toEqual(`[request.getCreateOperator(),request.getCurrentOperator()]`);
- });
- });
-
-
- describe('getScriptTitle', () => {
- it('get groovy script display title', () => {
- const script = `
-// @SCRIPT_TITLE 这是一个实例的标题
-def run(request){
- return "你有一条" + request.getOperatorName() + "的" + request.getWorkflowTitle() + "待办消息 【" + request.getNodeName() + "】"
-}`
- const result = GroovyScriptConvertorUtil.getScriptTitle(script)
- expect(result).toEqual(`这是一个实例的标题`);
- });
- });
-
- describe('updateScriptTitle', () => {
- it('update groovy script display title', () => {
- const script = `
-// @SCRIPT_TITLE 这是一个实例的标题
-def run(request){
- return "你有一条" + request.getOperatorName() + "的" + request.getWorkflowTitle() + "待办消息 【" + request.getNodeName() + "】"
-}`
- const result = GroovyScriptConvertorUtil.updateScriptTitle(script,'这就是一个实例的标题');
- console.log(result);
- const title = GroovyScriptConvertorUtil.getScriptTitle(result)
- expect(title).toEqual(`这就是一个实例的标题`);
- });
- });
-
-
- describe('getScriptMeta1', () => {
- it('get groovy script meta', () => {
- const script = `
-// @SCRIPT_TITLE 这是一个实例的标题
-// @SCRIPT_META {name:"name"}
-def run(request){
- return "你有一条" + request.getOperatorName() + "的" + request.getWorkflowTitle() + "待办消息 【" + request.getNodeName() + "】"
-}`
- const result = GroovyScriptConvertorUtil.getScriptMeta(script)
- expect(result).toEqual(`{name:"name"}`);
- });
- });
-
- describe('getScriptMeta2', () => {
- it('get groovy script meta', () => {
- const script = `
-// @CUSTOM_SCRIPT 自定义脚本,返回的数据为动作类型
-// @SCRIPT_META {"trigger":"PASS"}
-def run(request){
- return 'SAVE';
-}`
- const result = GroovyScriptConvertorUtil.getScriptMeta(script)
- expect(result).toEqual(`{"trigger":"PASS"}`);
- });
- });
-
-
- describe('updateScriptMeta1', () => {
- it('update groovy script meta', () => {
- const script = `
-// @SCRIPT_TITLE 这是一个实例的标题
-// @SCRIPT_META {name:"name"}
-def run(request){
- return "你有一条" + request.getOperatorName() + "的" + request.getWorkflowTitle() + "待办消息 【" + request.getNodeName() + "】"
-}`
- const result = GroovyScriptConvertorUtil.updateScriptMeta(script,'{name:"test"}');
- console.log(result);
- const title = GroovyScriptConvertorUtil.getScriptMeta(result)
- expect(title).toEqual(`{name:"test"}`);
- });
- });
-
- describe('updateScriptMeta2', () => {
- it('update groovy script meta', () => {
- const script = `
-// @CUSTOM_SCRIPT 自定义脚本,返回的数据为动作类型
-// @SCRIPT_META {"trigger":"PASS"}
-def run(request){
- return 'SAVE';
-}`
- const result = GroovyScriptConvertorUtil.updateScriptMeta(script,'{trigger:"SAVE"}');
- console.log(result);
- const title = GroovyScriptConvertorUtil.getScriptMeta(result)
- expect(title).toEqual(`{trigger:"SAVE"}`);
- });
- });
-});
\ No newline at end of file
diff --git a/frontend/packages/flow-core/tests/test.d.ts b/frontend/packages/flow-core/tests/test.d.ts
deleted file mode 100644
index e48dee96..00000000
--- a/frontend/packages/flow-core/tests/test.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-///
diff --git a/frontend/packages/flow-core/tests/tsconfig.json b/frontend/packages/flow-core/tests/tsconfig.json
deleted file mode 100644
index 5eac80a2..00000000
--- a/frontend/packages/flow-core/tests/tsconfig.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "extends": "../tsconfig.json",
- "include": [".", "../rstest.setup.ts"],
- "compilerOptions": {
- "baseUrl": ".",
- "paths": {
- "@/*": ["../src/*"]
- }
- }
-}
diff --git a/frontend/packages/flow-core/tsconfig.json b/frontend/packages/flow-core/tsconfig.json
deleted file mode 100644
index 130b702a..00000000
--- a/frontend/packages/flow-core/tsconfig.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "compilerOptions": {
- "lib": ["DOM", "ES2022"],
- "module": "ESNext",
- "noEmit": true,
- "strict": true,
- "skipLibCheck": true,
- "isolatedModules": true,
- "resolveJsonModule": true,
- "moduleResolution": "bundler",
- "useDefineForClassFields": true,
- "allowImportingTsExtensions": true,
- "baseUrl": ".",
- "paths": {
- "@/*": ["src/*"]
- }
- },
- "include": ["src"]
-}
diff --git a/frontend/packages/flow-pc/flow-pc-approval/.gitignore b/frontend/packages/flow-pc/flow-pc-approval/.gitignore
deleted file mode 100644
index 6f3092c3..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/.gitignore
+++ /dev/null
@@ -1,16 +0,0 @@
-# Local
-.DS_Store
-*.local
-*.log*
-
-# Dist
-node_modules
-dist/
-
-# Profile
-.rspack-profile-*/
-
-# IDE
-.vscode/*
-!.vscode/extensions.json
-.idea
diff --git a/frontend/packages/flow-pc/flow-pc-approval/AGENTS.md b/frontend/packages/flow-pc/flow-pc-approval/AGENTS.md
deleted file mode 100644
index 992bc6fa..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/AGENTS.md
+++ /dev/null
@@ -1,23 +0,0 @@
-# AGENTS.md
-
-You are an expert in JavaScript, Rsbuild, and web application development. You write maintainable, performant, and accessible code.
-
-## Commands
-
-- `pnpm run dev` - Start the dev server
-- `pnpm run build` - Build the app for production
-- `pnpm run preview` - Preview the production build locally
-
-## Docs
-
-- Rsbuild: https://rsbuild.rs/llms.txt
-- Rspack: https://rspack.rs/llms.txt
-
-- Rstest: https://rstest.rs/llms.txt
-
-## Tools
-
-### Rstest
-
-- Run `pnpm run test` to run tests
-- Run `pnpm run test:watch` to run tests in watch mode
diff --git a/frontend/packages/flow-pc/flow-pc-approval/README.md b/frontend/packages/flow-pc/flow-pc-approval/README.md
deleted file mode 100644
index f3f11922..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/README.md
+++ /dev/null
@@ -1,261 +0,0 @@
-# @flow-engine/flow-pc-approval
-
-Flow Engine PC 端审批组件库,提供待办/已办/审批处理等功能。
-
-## 简介
-
-`flow-pc-approval` 是 Flow Engine PC 端的审批页面组件库,提供:
-
-- 待办列表(我的待办)
-- 已办列表(我的已办)
-- 我发起的(我的申请)
-- 审批处理(审批操作)
-- 流程详情查看
-- 审批记录展示
-
-### 依赖关系
-
-- **依赖**: `@flow-engine/flow-pc-design`, `@flow-engine/flow-pc-ui`
-
-## Setup
-
-安装依赖:
-
-```bash
-pnpm install
-```
-
-## 开发
-
-构建组件库:
-
-```bash
-pnpm run build
-```
-
-监听模式构建:
-
-```bash
-pnpm run dev
-```
-
-## 核心功能
-
-### 待办列表
-
-我的待办任务列表:
-
-- 任务筛选(按状态、类型、时间等)
-- 任务搜索
-- 批量操作
-- 分页加载
-
-```typescript
-import { TodoList } from '@flow-engine/flow-pc-approval';
-
-
-```
-
-### 已办列表
-
-我的已办任务列表:
-
-- 历史记录查询
-- 筛选和搜索
-- 查看审批详情
-
-```typescript
-import { DoneList } from '@flow-engine/flow-pc-approval';
-
-
-```
-
-### 我发起的
-
-我发起的流程列表:
-
-- 流程状态查看
-- 流程跟踪
-- 撤回/取消操作
-
-```typescript
-import { MyRequestsList } from '@flow-engine/flow-pc-approval';
-
-
-```
-
-### 审批处理
-
-审批操作组件:
-
-- 表单展示(只读/编辑)
-- 审批意见填写
-- 审批操作(通过/拒绝/保存/转交/退回/委托)
-- 附件上传
-
-```typescript
-import { ApprovalForm } from '@flow-engine/flow-pc-approval';
-
-
-```
-
-### 流程详情
-
-流程详情查看:
-
-- 流程基本信息
-- 节点状态展示
-- 审批记录时间轴
-- 表单数据展示
-
-```typescript
-import { FlowDetail } from '@flow-engine/flow-pc-approval';
-
-
-```
-
-### 审批记录
-
-审批记录展示:
-
-- 时间轴展示
-- 审批人信息
-- 审批意见
-- 审批时间
-- 操作记录
-
-```typescript
-import { ApprovalTimeline } from '@flow-engine/flow-pc-approval';
-
-
-```
-
-## 模块结构
-
-```
-flow-pc-approval/
-├── src/
-│ ├── todo/ # 待办列表
-│ ├── done/ # 已办列表
-│ ├── my-requests/ # 我发起的
-│ ├── approval-form/ # 审批表单
-│ ├── flow-detail/ # 流程详情
-│ ├── timeline/ # 审批记录时间轴
-│ ├── components/ # 公共组件
-│ └── index.ts # 统一导出
-└── README.md
-```
-
-## 使用示例
-
-### 待办页面
-
-```typescript
-import { TodoList, ApprovalModal } from '@flow-engine/flow-pc-approval';
-
-const TodoPage = () => {
- const [selectedTask, setSelectedTask] = useState(null);
- const [showApprovalModal, setShowApprovalModal] = useState(false);
-
- const handleTaskClick = async (task) => {
- setSelectedTask(task);
- setShowApprovalModal(true);
- };
-
- return (
- <>
-
- {showApprovalModal && (
- setShowApprovalModal(false)}
- onApproved={handleRefresh}
- />
- )}
- >
- );
-};
-```
-
-### 审批操作
-
-```typescript
-import { ApprovalForm } from '@flow-engine/flow-pc-approval';
-
-const MyApprovalForm = () => {
- const handleSubmit = async (action, opinion) => {
- await approvalApi.submit({
- taskId,
- action,
- opinion,
- formData
- });
- };
-
- return (
- handleSubmit('PASS', opinion)}
- onReject={(opinion) => handleSubmit('REJECT', opinion)}
- onSave={(data) => handleSubmit('SAVE', data)}
- onTransfer={(userId) => handleSubmit('TRANSFER', { userId })}
- onReturn={(nodeId) => handleSubmit('RETURN', { nodeId })}
- onDelegate={(userId) => handleSubmit('DELEGATE', { userId })}
- />
- );
-};
-```
-
-## 审批动作
-
-支持以下审批动作:
-
-- `PASS` - 通过
-- `REJECT` - 拒绝
-- `SAVE` - 保存
-- `ADD_AUDIT` - 加签
-- `DELEGATE` - 委托
-- `RETURN` - 退回
-- `TRANSFER` - 转交
-- `CUSTOM` - 自定义动作
-
-## Learn more
-
-- [Rslib documentation](https://lib.rsbuild.io/) - Rslib 特性和 API
-- [Flow Engine Docs](https://github.com/codingapi/flow-engine) - 完整文档
-- [CLAUDE.md](../../../CLAUDE.md) - 开发指南
diff --git a/frontend/packages/flow-pc/flow-pc-approval/package.json b/frontend/packages/flow-pc/flow-pc-approval/package.json
deleted file mode 100644
index f9892a2c..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/package.json
+++ /dev/null
@@ -1,41 +0,0 @@
-{
- "name": "@flow-engine/flow-pc-approval",
- "version": "1.0.0",
- "private": true,
- "type": "module",
- "exports": {
- ".": {
- "types": "./dist/index.d.ts",
- "import": "./dist/index.js"
- }
- },
- "types": "./dist/index.d.ts",
- "files": [
- "dist"
- ],
- "scripts": {
- "build": "rslib build",
- "dev": "rslib build --watch",
- "test": "rstest"
- },
- "peerDependencies": {
- "react": ">=18",
- "react-dom": ">=18"
- },
- "dependencies": {
- "@ant-design/icons": "~6.1.0",
- "@flow-engine/flow-core": "workspace:*",
- "@flow-engine/flow-types": "workspace:*",
- "@flow-engine/flow-pc-design": "workspace:*",
- "@flow-engine/flow-pc-ui": "workspace:*",
- "@flow-engine/flow-pc-form": "workspace:*",
- "@reduxjs/toolkit": "^2.11.2",
- "antd": "^6.2.1",
- "dayjs": "^1.11.19",
- "immer": "^11.1.3",
- "react-redux": "^9.2.0"
- },
- "devDependencies": {
- "@flow-engine/flow-types": "workspace:*"
- }
-}
diff --git a/frontend/packages/flow-pc/flow-pc-approval/public/favicon.png b/frontend/packages/flow-pc/flow-pc-approval/public/favicon.png
deleted file mode 100644
index af06119f..00000000
Binary files a/frontend/packages/flow-pc/flow-pc-approval/public/favicon.png and /dev/null differ
diff --git a/frontend/packages/flow-pc/flow-pc-approval/rslib.config.ts b/frontend/packages/flow-pc/flow-pc-approval/rslib.config.ts
deleted file mode 100644
index 66f24187..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/rslib.config.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { pluginReact } from '@rsbuild/plugin-react';
-import { defineConfig } from '@rslib/core';
-import {pluginSass} from '@rsbuild/plugin-sass';
-import {pluginLess} from '@rsbuild/plugin-less';
-import * as path from 'node:path';
-
-export default defineConfig({
- source: {
- entry: {
- index: './src/**',
- },
- },
- resolve: {
- alias: {
- "@/": path.resolve(__dirname, "src"),
- }
- },
- lib: [
- {
- bundle: false,
- dts: true,
- format: 'esm',
- },
- ],
- output: {
- target: 'web',
- },
- plugins: [pluginReact(),pluginSass(),pluginLess()],
-});
diff --git a/frontend/packages/flow-pc/flow-pc-approval/rstest.config.ts b/frontend/packages/flow-pc/flow-pc-approval/rstest.config.ts
deleted file mode 100644
index 9057a186..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/rstest.config.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import {pluginReact} from '@rsbuild/plugin-react';
-import {defineConfig} from '@rstest/core';
-import {pluginSass} from "@rsbuild/plugin-sass";
-import * as path from "path";
-
-export default defineConfig({
- testEnvironment: 'jsdom',
- setupFiles: ['./rstest.setup.ts'],
- plugins: [pluginReact(), pluginSass()],
- resolve: {
- alias: {
- "@/": path.resolve(__dirname, "src"),
- }
- }
-});
diff --git a/frontend/packages/flow-pc/flow-pc-approval/rstest.setup.ts b/frontend/packages/flow-pc/flow-pc-approval/rstest.setup.ts
deleted file mode 100644
index 32b38ae2..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/rstest.setup.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-import { expect } from '@rstest/core';
-import * as jestDomMatchers from '@testing-library/jest-dom/matchers';
-
-expect.extend(jestDomMatchers);
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/api/index.ts b/frontend/packages/flow-pc/flow-pc-approval/src/api/index.ts
deleted file mode 100644
index 8d65b389..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/api/index.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import {HttpClient} from "@flow-engine/flow-core";
-import { message } from "antd";
-
-export const httpClient = new HttpClient(10000,{
- success:(msg:string)=>{
- message.success(msg)
- },
- error:(msg:string)=>{
- console.log(msg);
- message.error(msg)
- }
-})
\ No newline at end of file
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/api/record.ts b/frontend/packages/flow-pc/flow-pc-approval/src/api/record.ts
deleted file mode 100644
index 5504fa8a..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/api/record.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { httpClient } from ".";
-
-export const detail = (id:string) => {
- return httpClient.get('/api/cmd/record/detail',{id});
-}
-
-export const processNodes = (body:any) => {
- return httpClient.post('/api/cmd/record/processNodes',body);
-}
-
-export const create = (body:any) => {
- return httpClient.post('/api/cmd/record/create',body);
-}
-
-export const action = (body:any) => {
- return httpClient.post('/api/cmd/record/action',body);
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action-button.tsx b/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action-button.tsx
deleted file mode 100644
index 6e10fe98..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action-button.tsx
+++ /dev/null
@@ -1,50 +0,0 @@
-import {Button} from "antd";
-import React from "react";
-import {DisplayStyle, FlowActionDisplay} from "@flow-engine/flow-types";
-import {Icon} from "@flow-engine/flow-pc-ui";
-
-interface ActionButtonProps {
- onClick: () => void;
- title: string;
- display: FlowActionDisplay;
-}
-
-export const ActionButton: React.FC = (props) => {
-
- const display = props.display;
- const title = display.title || props.title;
-
- const style = React.useMemo(() => {
- if (display) {
- const data = JSON.parse(display.style) as DisplayStyle | undefined;
- if (data) {
- let style = {}
- if (data.backgroundColor) {
- style = Object.assign(data, {backgroundColor: `#${data.backgroundColor}`});
- }
- if (data.borderColor) {
- style = Object.assign(data, {borderColor: `#${data.borderColor}`});
- }
- if (data.borderRadius) {
- style = Object.assign(data, {borderRadius: Number.parseInt(data.borderRadius)});
- }
- if (data.borderSize) {
- style = Object.assign(data, {borderWidth: Number.parseInt(data.borderSize)});
- }
- return style;
- }
- }
- return {}
- }, [display]);
-
-
- return (
- }
- >
- {title}
-
- )
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action/add-audit.tsx b/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action/add-audit.tsx
deleted file mode 100644
index 3646d32b..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action/add-audit.tsx
+++ /dev/null
@@ -1,75 +0,0 @@
-import React from "react";
-import {FlowActionProps} from "./type";
-import {Form, message, Modal} from "antd";
-import {useApprovalContext} from "@/components/flow-approval/hooks/use-approval-context";
-import {AddAuditView} from "@/plugins/view/add-audit-view";
-import {ActionButton} from "@/components/flow-approval/components/action-button";
-
-/**
- * 加签
- * @param props
- * @constructor
- */
-export const AddAuditAction: React.FC = (props) => {
-
- const action = props.action;
- const {context} = useApprovalContext();
- const [form] = Form.useForm();
-
- const actionPresenter = context.getPresenter().getFlowActionPresenter();
-
- const [modalVisible, setModalVisible] = React.useState(false);
-
- const handleSubmit = (params?: any) => {
- actionPresenter.action(action.id, params).then((res) => {
- if (res.success) {
- message.success("操作成功");
- setModalVisible(false);
- context.close();
- }
- });
- }
- return (
- <>
- {
- form.resetFields();
- setModalVisible(true);
- }}
- title={action.title}
- />
-
- setModalVisible(false)}
- onOk={() => {
- form.submit();
- }}
- >
-
-
-
-
-
- >
- )
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action/custom.tsx b/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action/custom.tsx
deleted file mode 100644
index 79defc8c..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action/custom.tsx
+++ /dev/null
@@ -1,49 +0,0 @@
-import React from "react";
-import {FlowActionProps} from "./type";
-import {message} from "antd";
-import {useApprovalContext} from "@/components/flow-approval/hooks/use-approval-context";
-import {GroovyScriptConvertorUtil} from "@flow-engine/flow-core";
-import {ActionFactory} from "@/components/flow-approval/components/action/factory";
-import {ActionButton} from "@/components/flow-approval/components/action-button";
-import {ActionType} from "@flow-engine/flow-types";
-
-/**
- * 自定义
- * @param props
- * @constructor
- */
-export const CustomAction: React.FC = (props) => {
-
- const action = props.action;
- const {context} = useApprovalContext()
- const actionPresenter = context.getPresenter().getFlowActionPresenter();
-
- const script = action.script || '';
- const returnData = GroovyScriptConvertorUtil.getReturnScript(script);
- const triggerType = returnData.replaceAll('\'', '');
-
-
- const ActionView = ActionFactory.getInstance().render({
- ...props.action,
- type: triggerType as ActionType,
- });
-
- if (ActionView) {
- return ActionView
- }
-
- return (
- {
- actionPresenter.action(action.id).then((res) => {
- if (res.success) {
- message.success("操作成功");
- context.close();
- }
- });
- }}
- title={action.title}
- />
- )
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action/delegate.tsx b/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action/delegate.tsx
deleted file mode 100644
index b20df469..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action/delegate.tsx
+++ /dev/null
@@ -1,75 +0,0 @@
-import React from "react";
-import {FlowActionProps} from "./type";
-import {Form, message, Modal} from "antd";
-import {useApprovalContext} from "@/components/flow-approval/hooks/use-approval-context";
-import {DelegateView} from "@/plugins/view/delegate-view";
-import {ActionButton} from "@/components/flow-approval/components/action-button";
-
-/**
- * 委派
- * @param props
- * @constructor
- */
-export const DelegateAction: React.FC = (props) => {
-
- const action = props.action;
- const {context} = useApprovalContext();
- const [form] = Form.useForm();
-
- const actionPresenter = context.getPresenter().getFlowActionPresenter();
-
- const [modalVisible, setModalVisible] = React.useState(false);
-
- const handleSubmit = (params?: any) => {
- actionPresenter.action(action.id, params).then((res) => {
- if (res.success) {
- message.success("操作成功");
- setModalVisible(false);
- context.close();
- }
- });
- }
- return (
- <>
- {
- form.resetFields();
- setModalVisible(true);
- }}
- title={action.title}
- />
-
- setModalVisible(false)}
- onOk={() => {
- form.submit();
- }}
- >
-
-
-
-
-
- >
- )
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action/factory.tsx b/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action/factory.tsx
deleted file mode 100644
index 8145498b..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action/factory.tsx
+++ /dev/null
@@ -1,50 +0,0 @@
-import React from "react";
-import {FlowActionProps} from "./type";
-import {FlowAction} from "@flow-engine/flow-types";
-import {PassAction} from "@/components/flow-approval/components/action/pass";
-import {AddAuditAction} from "@/components/flow-approval/components/action/add-audit";
-import {CustomAction} from "@/components/flow-approval/components/action/custom";
-import {DelegateAction} from "@/components/flow-approval/components/action/delegate";
-import {RejectAction} from "@/components/flow-approval/components/action/reject";
-import {ReturnAction} from "@/components/flow-approval/components/action/return";
-import {SaveAction} from "@/components/flow-approval/components/action/save";
-import {TransferAction} from "@/components/flow-approval/components/action/transfer";
-
-export class ActionFactory {
-
- private readonly cache: Map>;
-
- private constructor() {
- this.cache = new Map();
- this.initActions();
- }
-
- private static readonly instance = new ActionFactory();
-
- public static getInstance() {
- return ActionFactory.instance;
- }
-
-
- private initActions() {
- this.cache.set("ADD_AUDIT", AddAuditAction);
- this.cache.set("CUSTOM", CustomAction);
- this.cache.set("DELEGATE", DelegateAction);
- this.cache.set("PASS", PassAction);
- this.cache.set("REJECT", RejectAction);
- this.cache.set("RETURN", ReturnAction);
- this.cache.set("SAVE", SaveAction);
- this.cache.set("TRANSFER", TransferAction);
-
- }
-
- public render(action: FlowAction) {
- const FlowActionComponent = this.cache.get(action.type);
- if (FlowActionComponent) {
- return (
-
- )
- }
- }
-
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action/pass.tsx b/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action/pass.tsx
deleted file mode 100644
index 4cc3ffbc..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action/pass.tsx
+++ /dev/null
@@ -1,111 +0,0 @@
-import React from "react";
-import {FlowActionProps} from "./type";
-import {Form, Input, message, Modal} from "antd";
-import {useApprovalContext} from "@/components/flow-approval/hooks/use-approval-context";
-import {SignKeyView} from "@/plugins/view/sign-key-view";
-import {ActionButton} from "@/components/flow-approval/components/action-button";
-
-const {TextArea} = Input;
-
-/**
- * 通过
- * @param props
- * @constructor
- */
-export const PassAction: React.FC = (props) => {
-
- const action = props.action;
- const {state, context} = useApprovalContext()
- const actionPresenter = context.getPresenter().getFlowActionPresenter();
-
- const [modalVisible, setModalVisible] = React.useState(false);
-
- const isStartNode = state.flow?.nodeType === 'START';
-
- const currentOperator = state.flow?.currentOperator;
-
- const [form] = Form.useForm();
-
- const handleSubmit = (params?: any) => {
- actionPresenter.action(action.id, params).then((res) => {
- if (res.success) {
- message.success("操作成功");
- setModalVisible(false);
- context.close();
- }
- });
- }
-
- const adviceRules = state.flow?.adviceRequired ? [
- {
- required: state.flow?.adviceRequired || false,
- message: '请输入审批意见'
- }
- ] : [];
-
- return (
- <>
- {
- if (isStartNode) {
- handleSubmit();
- } else {
- form.resetFields();
- setModalVisible(true);
- }
- }}
- title={action.title}
- />
-
- setModalVisible(false)}
- onOk={() => {
- form.submit();
- }}
- >
-
-
-
-
- {state.flow?.signRequired && currentOperator && (
-
-
-
- )}
-
-
-
- >
- )
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action/reject.tsx b/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action/reject.tsx
deleted file mode 100644
index 7e4fe96a..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action/reject.tsx
+++ /dev/null
@@ -1,77 +0,0 @@
-import React from "react";
-import {FlowActionProps} from "./type";
-import {Form, Input, message, Modal} from "antd";
-import {useApprovalContext} from "@/components/flow-approval/hooks/use-approval-context";
-import {ActionButton} from "@/components/flow-approval/components/action-button";
-
-const {TextArea} = Input;
-
-/**
- * 拒绝
- * @param props
- * @constructor
- */
-export const RejectAction: React.FC = (props) => {
-
- const action = props.action;
- const {state, context} = useApprovalContext()
- const actionPresenter = context.getPresenter().getFlowActionPresenter();
- const [modalVisible, setModalVisible] = React.useState(false);
- const [form] = Form.useForm();
-
- const handleSubmit = (params?: any) => {
- actionPresenter.action(action.id, params).then((res) => {
- if (res.success) {
- message.success("操作成功");
- setModalVisible(false);
- context.close();
- }
- });
- }
-
- const adviceRules = state.flow?.adviceRequired ? [
- {
- required: state.flow?.adviceRequired || false,
- message: '请输入审批意见'
- }
- ] : [];
-
- return (
- <>
- {
- form.resetFields();
- setModalVisible(true);
- }}
- title={action.title}
- />
-
- setModalVisible(false)}
- onOk={() => {
- form.submit();
- }}
- >
-
-
-
-
- >
- )
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action/return.tsx b/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action/return.tsx
deleted file mode 100644
index e96c8c2a..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action/return.tsx
+++ /dev/null
@@ -1,75 +0,0 @@
-import React from "react";
-import {FlowActionProps} from "./type";
-import {Button, Form, message, Modal} from "antd";
-import {useApprovalContext} from "@/components/flow-approval/hooks/use-approval-context";
-import {ReturnView} from "@/plugins/view/return-view";
-import {ActionButton} from "@/components/flow-approval/components/action-button";
-
-/**
- * 退回
- * @param props
- * @constructor
- */
-export const ReturnAction: React.FC = (props) => {
-
- const action = props.action;
- const {context} = useApprovalContext();
- const [form] = Form.useForm();
-
- const actionPresenter = context.getPresenter().getFlowActionPresenter();
-
- const [modalVisible, setModalVisible] = React.useState(false);
-
- const handleSubmit = (params?: any) => {
- actionPresenter.action(action.id, params).then((res) => {
- if (res.success) {
- message.success("操作成功");
- setModalVisible(false);
- context.close();
- }
- });
- }
- return (
- <>
- {
- form.resetFields();
- setModalVisible(true);
- }}
- title={action.title}
- />
-
- setModalVisible(false)}
- onOk={() => {
- form.submit();
- }}
- >
-
-
-
-
-
- >
- )
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action/save.tsx b/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action/save.tsx
deleted file mode 100644
index a676d127..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action/save.tsx
+++ /dev/null
@@ -1,31 +0,0 @@
-import React from "react";
-import {FlowActionProps} from "./type";
-import {message} from "antd";
-import {useApprovalContext} from "@/components/flow-approval/hooks/use-approval-context";
-import {ActionButton} from "@/components/flow-approval/components/action-button";
-
-/**
- * 保存
- * @param props
- * @constructor
- */
-export const SaveAction: React.FC = (props) => {
-
- const action = props.action;
- const {context} = useApprovalContext()
- const actionPresenter = context.getPresenter().getFlowActionPresenter();
-
- return (
- {
- actionPresenter.action(action.id).then((res) => {
- if (res.success) {
- message.success("流程数据已保存");
- }
- });
- }}
- title={action.title}
- />
- )
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action/transfer.tsx b/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action/transfer.tsx
deleted file mode 100644
index 78486520..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action/transfer.tsx
+++ /dev/null
@@ -1,75 +0,0 @@
-import React from "react";
-import {FlowActionProps} from "./type";
-import {Form, message, Modal} from "antd";
-import {useApprovalContext} from "@/components/flow-approval/hooks/use-approval-context";
-import {TransferView} from "@/plugins/view/transfer-view";
-import {ActionButton} from "@/components/flow-approval/components/action-button";
-
-/**
- * 转办
- * @param props
- * @constructor
- */
-export const TransferAction: React.FC = (props) => {
-
- const action = props.action;
- const {context} = useApprovalContext();
- const [form] = Form.useForm();
-
- const actionPresenter = context.getPresenter().getFlowActionPresenter();
-
- const [modalVisible, setModalVisible] = React.useState(false);
-
- const handleSubmit = (params?: any) => {
- actionPresenter.action(action.id, params).then((res) => {
- if (res.success) {
- message.success("操作成功");
- setModalVisible(false);
- context.close();
- }
- });
- }
- return (
- <>
- {
- form.resetFields();
- setModalVisible(true);
- }}
- title={action.title}
- />
-
- setModalVisible(false)}
- onOk={() => {
- form.submit();
- }}
- >
-
-
-
-
-
- >
- )
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action/type.ts b/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action/type.ts
deleted file mode 100644
index 83e1c45d..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/action/type.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import {FlowAction} from "@flow-engine/flow-types";
-
-export interface FlowActionProps{
- action:FlowAction;
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/flow-node-history.tsx b/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/flow-node-history.tsx
deleted file mode 100644
index 4e2c9f96..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/flow-node-history.tsx
+++ /dev/null
@@ -1,53 +0,0 @@
-import React from "react";
-import {useApprovalContext} from "@/components/flow-approval/hooks/use-approval-context";
-import {ProcessNode} from "@flow-engine/flow-types";
-import {Empty, Timeline} from "antd";
-import {FlowTimeNode, getNodeStatus, getStatusConfig} from "@/components/flow-approval/components/flow-time-node";
-
-
-export interface FlowNodeHistoryAction {
- refresh: () => void;
-}
-
-interface FlowNodeHistoryProps {
- actionRef?: React.Ref;
-}
-
-
-export const FlowNodeHistory: React.FC = (props) => {
- const {context} = useApprovalContext();
- const [processNodes, setProcessNodes] = React.useState([]);
-
- const triggerProcessNodes = () => {
- context.getPresenter().processNodes().then(nodes => {
- setProcessNodes(nodes);
- });
- }
-
- React.useEffect(() => {
- triggerProcessNodes();
- }, []);
-
- React.useImperativeHandle(props.actionRef, () => {
- return {
- refresh: () => {
- triggerProcessNodes();
- }
- }
- }, []);
-
- return (
- <>
- {processNodes.length > 0 ? (
- ({
- icon: getStatusConfig(getNodeStatus(node)).icon,
- content: (
-
- )
- }))}/>
- ) : (
-
- )}
- >
- )
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/flow-time-node.tsx b/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/flow-time-node.tsx
deleted file mode 100644
index a48fffdd..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/flow-time-node.tsx
+++ /dev/null
@@ -1,112 +0,0 @@
-import {CheckCircleFilled, ClockCircleOutlined, SyncOutlined} from "@ant-design/icons";
-import {Tag, Typography} from "antd";
-import React from "react";
-import {FlowApprovalOperator, ProcessNode} from "@flow-engine/flow-types";
-import dayjs from "dayjs";
-
-const {Text} = Typography;
-
-// 获取状态配置
-export const getStatusConfig = (status: 'completed' | 'current' | 'pending') => {
- switch (status) {
- case 'completed':
- return {
- color: 'success',
- label: '已审批',
- icon:
- };
- case 'current':
- return {
- color: 'processing',
- label: '待审批',
- icon:
- };
- case 'pending':
- return {
- color: 'default',
- label: '未执行',
- icon:
- };
- }
-};
-
-
-// 获取节点状态
-export const getNodeStatus = (node: ProcessNode): 'completed' | 'current' | 'pending' => {
- if (node.state === -1) {
- return 'completed';
- }
- // 非历史节点,检查是否有审批人
- if (node.state === 0) {
- return 'current';
- }
- return 'pending';
-};
-
-interface FlowTimeNodeProps {
- node: ProcessNode;
-}
-
-
-interface FlowOperatorItemProps {
- operator: FlowApprovalOperator;
- state: number;
-}
-
-const FlowOperatorItem: React.FC = (props) => {
- const operator = props.operator;
- const state = props.state;
-
- if (state === -1) {
- return (
- <>
-
- 审批人: {operator.flowOperator.name}
-
- {operator.approveTime > 0 && (
-
- {dayjs(operator.approveTime).format('YYYY-MM-DD HH:mm:ss')} {operator.actionName}
-
- )}
- {operator.advice && (
-
-
- {operator.advice}
-
-
- )}
- >
- )
- } else {
- return (
-
- 待审批人: {operator.flowOperator.name}
-
- )
- }
-}
-
-export const FlowTimeNode: React.FC = (props) => {
- const node = props.node;
- const operators = node.operators || [];
- return (
-
-
- {node.nodeName}
-
- {getStatusConfig(getNodeStatus(node)).label}
-
-
- {operators.map(operator => {
- return (
-
- )
- })}
-
- )
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/form-view-component.tsx b/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/form-view-component.tsx
deleted file mode 100644
index e2123440..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/components/form-view-component.tsx
+++ /dev/null
@@ -1,80 +0,0 @@
-import React from "react";
-import {useApprovalContext} from "@/components/flow-approval/hooks/use-approval-context";
-import {ViewBindPlugin} from "@flow-engine/flow-core";
-import {Form as AntdForm} from "antd";
-import {FlowFormView} from "@flow-engine/flow-pc-form";
-
-interface FormViewComponentProps {
- onValuesChange?: (values: any) => void;
-}
-
-export const FormViewComponent: React.FC = (props) => {
- const {state, context} = useApprovalContext();
- const review = state.review || false;
- const ViewComponent = ViewBindPlugin.getInstance().get(state.flow?.view || 'default') || FlowFormView;
-
- const flowForm = state.flow?.form;
- const fieldPermissions = state.flow?.fieldPermissions || [];
-
- // 是否可合并审批
- const mergeable = state.flow?.mergeable || false;
- const todos = state.flow?.todos || [];
- const viewForms= todos.length > 0 ? todos.map(item => {
- return {
- instance: AntdForm.useForm()[0],
- data: item.data as any,
- }
- }) : [
- {
- instance: AntdForm.useForm()[0],
- data: undefined,
- }
- ]
-
- React.useEffect(() => {
- viewForms.forEach(item => {
- const formInstance = item.instance;
- const data = item.data;
- context.getPresenter().getFormActionContext().addAction({
- save: () => {
- return formInstance.getFieldsValue();
- },
- key: () => {
- return 'view-form'
- },
- validate: () => {
- return new Promise((resolve,reject) => {
- formInstance.validateFields()
- .then(resolve)
- .catch(reject)
- })
- }
- });
- formInstance.setFieldsValue(data);
- });
- }, []);
-
- if (ViewComponent && flowForm) {
- if (mergeable) {
- return (
-
-
合并审批
-
- )
- }
- return (
- <>
- {viewForms.map((item, index) => (
-
- ))}
- >
- )
- }
-}
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/context/index.ts b/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/context/index.ts
deleted file mode 100644
index be7e258a..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/context/index.ts
+++ /dev/null
@@ -1,38 +0,0 @@
-import React from "react";
-import {State,ApprovalLayoutProps} from "../typings";
-import {Presenter} from "../presenters";
-
-export class ApprovalContextScope {
- private readonly presenter: Presenter;
- private readonly props: ApprovalLayoutProps;
-
-
- constructor(presenter: Presenter, props: ApprovalLayoutProps) {
- this.presenter = presenter;
- this.props = props;
- }
-
- public syncState(state: State) {
- this.presenter.syncState(state);
- }
-
- public getPresenter() {
- return this.presenter;
- }
-
-
- public close() {
- this.props.onClose?.();
- }
-
- public initialState() {
- this.presenter.initialState({
- flow: this.props.content,
- review: this.props.review,
- });
- }
-}
-
-
-export const ApprovalContext = React.createContext(undefined);
-
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/hooks/use-approval-context.ts b/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/hooks/use-approval-context.ts
deleted file mode 100644
index f935359f..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/hooks/use-approval-context.ts
+++ /dev/null
@@ -1,51 +0,0 @@
-import React from "react";
-import {useDispatch, useSelector} from "react-redux";
-import {ApprovalContext, ApprovalContextScope} from "../context";
-import {ApprovalReduxState, updateState} from "../store";
-import {Presenter} from "../presenters";
-import {FlowApprovalApiImpl} from "../model";
-import {ApprovalLayoutProps} from "../typings";
-
-export const useApprovalContext = () => {
- const context = React.useContext(ApprovalContext);
- const state = useSelector((state: ApprovalReduxState) => state.approval);
- if (!context) {
- throw new Error("ApprovalContext must be used within useContext");
- }
- return {
- state,
- context,
- };
-}
-
-export const createApprovalContext = (props: ApprovalLayoutProps) => {
- const ref = React.useRef(undefined);
-
- const dispatch = useDispatch();
-
- const state = useSelector((state: ApprovalReduxState) => state.approval);
-
- if (!ref.current) {
- const presenter = new Presenter(
- state,
- (prevState) => {
- dispatch(updateState(prevState));
- return prevState;
- },
- new FlowApprovalApiImpl()
- );
- ref.current = new ApprovalContextScope(presenter, props);
- ref.current.initialState();
- }
-
- React.useEffect(() => {
- if(state.flow) {
- ref.current?.syncState(state);
- }
- }, [state]);
-
- return {
- state,
- context: ref.current,
- }
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/index.tsx b/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/index.tsx
deleted file mode 100644
index 13bfa69a..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/index.tsx
+++ /dev/null
@@ -1,65 +0,0 @@
-import React from "react";
-import {Drawer} from "@flow-engine/flow-pc-ui";
-import {detail} from "@/api/record";
-import {FlowContent} from "@flow-engine/flow-types";
-import {ApprovalLayout} from "@/components/flow-approval/layout";
-
-interface ApprovalPanelProps {
- // 流程设计编码
- workflowCode?: string;
- // 流程记录Id
- recordId?: string;
- // 关闭回掉
- onClose?: () => void;
- // 是否预览(当查看详情非审批时,设置为true)
- review?:boolean;
-}
-
-export const ApprovalPanel: React.FC = (props) => {
-
- const [content, dispatch] = React.useState(undefined);
-
- React.useEffect(() => {
- const id = props.recordId || props.workflowCode || '';
- detail(id).then(res => {
- if (res.success) {
- dispatch(res.data);
- }
- });
- }, []);
-
- return (
-
- )
-}
-
-interface ApprovalPanelDrawerProps extends ApprovalPanelProps {
- open: boolean;
- onClose: () => void;
-}
-
-export const ApprovalPanelDrawer: React.FC = (props) => {
-
- return (
-
-
-
- )
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/layout/body.tsx b/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/layout/body.tsx
deleted file mode 100644
index f66d1373..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/layout/body.tsx
+++ /dev/null
@@ -1,117 +0,0 @@
-import React, {useState} from "react";
-import {FormViewComponent} from "@/components/flow-approval/components/form-view-component";
-import {FlowNodeHistory, FlowNodeHistoryAction} from "@/components/flow-approval/components/flow-node-history";
-import {
- ApprovalContentPaddingV,
- ApprovalContentPaddingH,
- ApprovalSidebarWidth,
- ApprovalSidebarCollapsedWidth,
- ApprovalLayoutHeight,
-} from "@/components/flow-approval/typings";
-import {Layout, Card, Button, Typography, Flex} from "antd";
-import {LeftOutlined, RightOutlined} from "@ant-design/icons";
-
-const {Sider, Content} = Layout;
-const {Title} = Typography;
-
-export const Body = () => {
- const [collapsed, setCollapsed] = useState(false);
- const flowNodeHistoryAction = React.useRef(null);
-
- const handleValuesChange = (values:any) => {
- flowNodeHistoryAction.current?.refresh();
- }
-
- return (
-
-
- 流程表单}
- style={{height: '100%', borderRadius: 8}}
- styles={{body: {padding: 24}}}
- >
-
-
-
-
-
- {!collapsed && (
-
-
- 流程记录
- }
- onClick={() => setCollapsed(true)}
- style={{color: '#8c8c8c'}}
- />
-
-
-
-
-
- )}
- {collapsed && (
-
- }
- onClick={() => setCollapsed(false)}
- style={{color: '#8c8c8c'}}
- />
-
- 流程记录
-
-
- )}
-
-
- )
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/layout/header.tsx b/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/layout/header.tsx
deleted file mode 100644
index d5044a2e..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/layout/header.tsx
+++ /dev/null
@@ -1,50 +0,0 @@
-import React from "react";
-import {useApprovalContext} from "@/components/flow-approval/hooks/use-approval-context";
-import {Button, Flex, Space, Typography} from "antd";
-import {ApprovalLayoutHeight} from "@/components/flow-approval/typings";
-import {ActionFactory} from "@/components/flow-approval/components/action/factory";
-
-const {Title} = Typography;
-
-export const Header = () => {
- const {state, context} = useApprovalContext()
- const actions = state.flow?.actions || [];
- const review = state?.review || false;
-
- return (
-
-
-
- {state.flow?.title || '审批详情'}
-
-
-
- {!review && actions.map((action) => {
- return ActionFactory.getInstance().render(action);
- })}
-
-
-
-
- )
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/layout/index.tsx b/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/layout/index.tsx
deleted file mode 100644
index 1b8990eb..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/layout/index.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-import React from "react";
-import {ApprovalLayoutProps} from "../typings";
-import {Provider} from "react-redux";
-import {approvalStore} from "@/components/flow-approval/store";
-import {ApprovalContext} from "@/components/flow-approval/context";
-import {createApprovalContext} from "@/components/flow-approval/hooks/use-approval-context";
-import {Header} from "@/components/flow-approval/layout/header";
-import {Body} from "@/components/flow-approval/layout/body";
-
-const ApprovalLayoutScope: React.FC = (props) => {
- const {context} = createApprovalContext(props);
- return (
-
-
-
-
-
-
- )
-}
-
-export const ApprovalLayout: React.FC = (props) => {
- return (
-
-
-
- )
-}
-
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/model.ts b/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/model.ts
deleted file mode 100644
index c61f004e..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/model.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-import {FlowApprovalApi} from "@/components/flow-approval/typings";
-import {action as actionRecord, create as createRecord, processNodes as postProcessNodes} from "@/api/record";
-
-export class FlowApprovalApiImpl implements FlowApprovalApi {
-
- create = async (body: Record)=> {
- const response = await createRecord(body);
- if(response.success){
- return response.data;
- }
- }
-
- action =async (body: Record)=> {
- return await actionRecord(body);
- }
-
- processNodes =async (body: Record)=> {
- const response = await postProcessNodes(body);
- if(response.success){
- return response.data.list;
- }
- }
-
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/presenters/action.ts b/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/presenters/action.ts
deleted file mode 100644
index 390a4b25..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/presenters/action.ts
+++ /dev/null
@@ -1,101 +0,0 @@
-import {FlowApprovalApi, State} from "@/components/flow-approval/typings";
-import {FormActionContext} from "@flow-engine/flow-types";
-import {GroovyScriptConvertorUtil} from "@flow-engine/flow-core";
-
-export class FlowActionPresenter {
-
- private readonly api: FlowApprovalApi;
- private readonly formActionContext: FormActionContext;
- private state: State;
-
- constructor(state: State,
- api: FlowApprovalApi,
- formActionContext: FormActionContext) {
- this.state = state;
- this.api = api;
- this.formActionContext = formActionContext;
- }
-
- public syncState(state: State) {
- this.state = state;
- }
-
- public async processNodes() {
- const formData = this.formActionContext.save();
- const id = this.state.flow?.recordId || this.state.flow?.workId || '';
- return await this.api.processNodes({
- id,
- formData,
- });
- }
-
-
- /**
- * 是否通过操作
- * @param actionId
- * @private
- */
- private isPassAction(actionId: string) {
- const actions = this.state.flow?.actions || [];
- for (const action of actions) {
- if (action.id === actionId) {
- if (action.type === 'PASS') {
- return true;
- }
- if (action.type === 'CUSTOM') {
- const script = action.script || '';
- const returnData = GroovyScriptConvertorUtil.getReturnScript(script);
- if (returnData.includes('PASS')) {
- return true;
- }
- }
- }
- }
- return false;
- }
-
-
- private async submitAction(actionId: string, formData: any, params?: any) {
- const recordId = this.state.flow?.recordId;
- const workId = this.state.flow?.workId;
- if (recordId) {
- const request = {
- formData,
- recordId,
- advice: {
- actionId,
- ...params
- }
- }
- return await this.api.action(request);
- } else {
- const createRequest = {
- workId,
- formData,
- actionId,
- }
- const recordId = await this.api.create(createRequest);
- const actionRequest = {
- formData,
- recordId,
- advice: {
- actionId,
- ...params
- }
- }
- return await this.api.action(actionRequest);
- }
- }
-
-
- public async action(actionId: string, params?: any) {
- let formData;
- if (this.isPassAction(actionId)) {
- formData = await this.formActionContext.validate();
- } else {
- formData = this.formActionContext.save();
- }
- return await this.submitAction(actionId, formData, params);
- }
-
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/presenters/index.ts b/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/presenters/index.ts
deleted file mode 100644
index 5b9ff9fc..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/presenters/index.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-import {FlowApprovalApi, State} from "@/components/flow-approval/typings";
-import {Dispatch} from "@flow-engine/flow-core";
-import {FormActionContext} from "@flow-engine/flow-types";
-import {FlowActionPresenter} from "./action";
-
-export class Presenter {
-
- private state: State;
- private readonly dispatch: Dispatch;
- private readonly api: FlowApprovalApi;
- private readonly formActionContext:FormActionContext;
- private readonly flowActionPresenter:FlowActionPresenter;
-
- constructor(state: State, dispatch: Dispatch, api: FlowApprovalApi) {
- this.state = state;
- this.dispatch = dispatch;
- this.api = api;
- this.formActionContext = new FormActionContext();
- this.flowActionPresenter = new FlowActionPresenter(state,api,this.formActionContext);
- }
-
- public syncState(state: State) {
- this.state = state;
- this.flowActionPresenter.syncState(state);
- }
-
-
- public getFormActionContext() {
- return this.formActionContext;
- }
-
- public getFlowActionPresenter() {
- return this.flowActionPresenter;
- }
-
- public initialState(state: State) {
- this.dispatch(state);
- }
-
- public processNodes(){
- return this.flowActionPresenter.processNodes();
- }
-
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/store.tsx b/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/store.tsx
deleted file mode 100644
index 91b95dfb..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/store.tsx
+++ /dev/null
@@ -1,36 +0,0 @@
-import {configureStore, createSlice, PayloadAction} from '@reduxjs/toolkit';
-import {initStateData, State} from "./typings";
-import { original } from 'immer';
-
-export type ApprovalStoreAction = {
- updateState: (state: State, action: PayloadAction | ((prev: State) => Partial)>) => void;
-}
-
-export const approvalSlice = createSlice({
- name: 'approval',
- initialState: {
- ...initStateData
- },
- reducers: {
- updateState: (state, action) => {
- if(typeof action.payload === 'function') {
- const currentState = original(state) as State;
- Object.assign(state, action.payload(currentState));
- }else {
- Object.assign(state, action.payload);
- }
- },
- },
-});
-
-
-export const {
- updateState,
-} = approvalSlice.actions;
-export const approvalStore = configureStore({
- reducer: {
- approval: approvalSlice.reducer
- },
-});
-
-export type ApprovalReduxState = ReturnType;
\ No newline at end of file
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/typings/index.ts b/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/typings/index.ts
deleted file mode 100644
index fb4f8b0f..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-approval/typings/index.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-import {FlowContent,ProcessNode} from "@flow-engine/flow-types";
-
-/**
- * 流程审批布局组件属性
- */
-export interface ApprovalLayoutProps {
- content:FlowContent;
- review?:boolean;
- onClose?:() => void;
-}
-
-// Layout constants
-export const ApprovalLayoutHeight = 64;
-export const ApprovalContentPaddingV = 24;
-export const ApprovalContentPaddingH = 24;
-export const ApprovalSidebarWidth = 250;
-export const ApprovalSidebarCollapsedWidth = 48;
-
-
-export type State = {
- flow?:FlowContent;
- review?:boolean;
-};
-
-
-export const initStateData = {
-
-}
-
-export interface FlowApprovalApi{
-
- create(body:Record):Promise;
-
- processNodes(body:Record):Promise;
-
- action(body:Record):Promise;
-}
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-title/index.tsx b/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-title/index.tsx
deleted file mode 100644
index 79d792e7..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/components/flow-title/index.tsx
+++ /dev/null
@@ -1,15 +0,0 @@
-import React from "react";
-
-interface FlowTitleProps {
- title: string;
-}
-
-
-export const FlowTitle:React.FC = (props) => {
-
- return (
-
- )
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/index.ts b/frontend/packages/flow-pc/flow-pc-approval/src/index.ts
deleted file mode 100644
index 866332d8..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export * from '@/components/flow-approval';
-export * from '@/components/flow-title';
-export * from '@/plugins';
\ No newline at end of file
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/plugins/add-audit-type.ts b/frontend/packages/flow-pc/flow-pc-approval/src/plugins/add-audit-type.ts
deleted file mode 100644
index dbce5a96..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/plugins/add-audit-type.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-export const VIEW_KEY = 'AddAuditViewPlugin';
-
-export interface AddAuditViewPlugin {
- /** 返回用户 */
- onChange?: (value: string|string[]) => void;
- /** 当前用户 */
- value?: string|string[];
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/plugins/delegate-type.ts b/frontend/packages/flow-pc/flow-pc-approval/src/plugins/delegate-type.ts
deleted file mode 100644
index 8e0d3cd8..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/plugins/delegate-type.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-export const VIEW_KEY = 'DelegateViewPlugin';
-
-export interface DelegateViewPlugin {
- /** 返回用户 */
- onChange?: (value: string|string[]) => void;
- /** 当前用户 */
- value?: string|string[];
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/plugins/index.ts b/frontend/packages/flow-pc/flow-pc-approval/src/plugins/index.ts
deleted file mode 100644
index 9d741ae3..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/plugins/index.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-export {type AddAuditViewPlugin,VIEW_KEY as AddAuditViewPluginKey} from "./add-audit-type";
-export {type DelegateViewPlugin,VIEW_KEY as DelegateViewPluginKey} from "./delegate-type";
-export {type ReturnViewPlugin,VIEW_KEY as ReturnViewPluginKey} from "./return-type";
-export {type SignKeyViewPlugin,VIEW_KEY as SignKeyViewPluginKey} from "./sign-key-type";
-export {type TransferViewPlugin,VIEW_KEY as TransferViewPluginKey} from "./transfer-type";
\ No newline at end of file
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/plugins/return-type.ts b/frontend/packages/flow-pc/flow-pc-approval/src/plugins/return-type.ts
deleted file mode 100644
index 1a4bc2dc..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/plugins/return-type.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-export const VIEW_KEY = 'ReturnViewPlugin';
-
-export interface ReturnViewPlugin {
- /** 返回用户 */
- onChange?: (value: string|string[]) => void;
- /** 当前用户 */
- value?: string|string[];
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/plugins/sign-key-type.ts b/frontend/packages/flow-pc/flow-pc-approval/src/plugins/sign-key-type.ts
deleted file mode 100644
index 9a2717d4..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/plugins/sign-key-type.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import {FlowOperator} from "@flow-engine/flow-types";
-
-export const VIEW_KEY = 'SignKeyViewPlugin';
-
-export interface SignKeyViewPlugin {
- /** 当前用户 */
- current: FlowOperator;
- /** 返回签名 */
- onChange?: (value: string) => void;
- /** 当前签名 */
- value?: string;
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/plugins/transfer-type.ts b/frontend/packages/flow-pc/flow-pc-approval/src/plugins/transfer-type.ts
deleted file mode 100644
index 5f509f72..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/plugins/transfer-type.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-export const VIEW_KEY = 'TransferViewPlugin';
-
-export interface TransferViewPlugin {
- /** 返回用户 */
- onChange?: (value: string|string[]) => void;
- /** 当前用户 */
- value?: string|string[];
-}
\ No newline at end of file
diff --git a/frontend/packages/flow-pc/flow-pc-approval/src/plugins/view/add-audit-view.tsx b/frontend/packages/flow-pc/flow-pc-approval/src/plugins/view/add-audit-view.tsx
deleted file mode 100644
index 7abe7a1d..00000000
--- a/frontend/packages/flow-pc/flow-pc-approval/src/plugins/view/add-audit-view.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-import React from "react";
-import {AddAuditViewPlugin, VIEW_KEY} from "../add-audit-type";
-import {ViewBindPlugin} from "@flow-engine/flow-core";
-import {Select} from "antd";
-import {useApprovalContext} from "@/components/flow-approval/hooks/use-approval-context";
-
-export const AddAuditView: React.FC = (props) => {
- const AddAuditViewComponent = ViewBindPlugin.getInstance().get(VIEW_KEY);
-
- const {state} = useApprovalContext();
-
- const createOperator = state.flow?.createOperator;
-
- const options = createOperator?[
- {
- label:createOperator.name,
- value:createOperator.id,
- }
- ]:[];
-
- if (AddAuditViewComponent) {
- return (
-
- );
- }
-
- const handleChange = (value: string|string[]) => {
- props.onChange?.(value);
- }
-
- return (
-