修改部分规则模块删除无用前端 新增前端界面
This commit is contained in:
179
modeler/mock/behavior.ts
Normal file
179
modeler/mock/behavior.ts
Normal file
@@ -0,0 +1,179 @@
|
||||
/*
|
||||
* This file is part of the kernelstudio package.
|
||||
*
|
||||
* (c) 2014-2025 zlin <admin@kernelstudio.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE file
|
||||
* that was distributed with this source code.
|
||||
*/
|
||||
import {MockMethod} from 'vite-plugin-mock';
|
||||
import {createResponse} from './core';
|
||||
|
||||
const statusOption = {
|
||||
type: 'select',
|
||||
defaults: 0,
|
||||
name: 'status',
|
||||
tips: '状态',
|
||||
options: [
|
||||
{
|
||||
name: '默认',
|
||||
value: 'default',
|
||||
},
|
||||
{
|
||||
name: '运行中',
|
||||
value: 'running',
|
||||
color: 'blue',
|
||||
},
|
||||
{
|
||||
name: '已完成',
|
||||
value: 'finished',
|
||||
color: 'teal'
|
||||
},
|
||||
{
|
||||
name: '错误',
|
||||
value: 'error',
|
||||
color: 'red',
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
const behaviors = [
|
||||
{
|
||||
id: 'behavior_001',
|
||||
name: '行为树1',
|
||||
desc: '行为树1说明',
|
||||
status: null,
|
||||
options: {},
|
||||
// data: [
|
||||
// {
|
||||
// id: '5a0c4b08-0b02-44f3-8918-79c6f9ab22fa',
|
||||
// type: 'startEvent',
|
||||
// name: '开始',
|
||||
// description: '',
|
||||
// width: 160,
|
||||
// height: 40,
|
||||
// position: {
|
||||
// x: 460,
|
||||
// y: 120,
|
||||
// },
|
||||
// data: {
|
||||
// status: 'default',
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// id: 'ec8741db-9580-44ab-8a58-8c731bf1faad',
|
||||
// type: 'sequenceFlow',
|
||||
// name: null,
|
||||
// description: null,
|
||||
// source: '5a0c4b08-0b02-44f3-8918-79c6f9ab22fa',
|
||||
// target: '7422aefc-7781-457a-b910-783f73ac0ac5',
|
||||
// data: {
|
||||
// status: 'default',
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// id: '7422aefc-7781-457a-b910-783f73ac0ac5',
|
||||
// type: 'task',
|
||||
// name: '任务',
|
||||
// description: '',
|
||||
// width: 160,
|
||||
// height: 40,
|
||||
// position: {
|
||||
// x: 460,
|
||||
// y: 120,
|
||||
// },
|
||||
// data: {
|
||||
// status: 'default',
|
||||
// }
|
||||
// },
|
||||
// ]
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
const definitions = [
|
||||
{
|
||||
type: 'sequenceFlow',
|
||||
label: null,
|
||||
options: [
|
||||
{
|
||||
type: 'input',
|
||||
defaults: null,
|
||||
name: 'label',
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'startEvent',
|
||||
label: '开始',
|
||||
desc: '行为树的开始节点,每个行为树仅允许一个开始节点',
|
||||
options: [
|
||||
statusOption
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'task',
|
||||
label: '任务节点',
|
||||
desc: '执行特定任务',
|
||||
options: [
|
||||
statusOption,
|
||||
{
|
||||
type: 'number',
|
||||
defaults: 0,
|
||||
name: 'counter',
|
||||
tips: '统计数量'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'parallelGateway',
|
||||
label: '并行网关',
|
||||
desc: '并行执行子节点',
|
||||
options: [
|
||||
statusOption,
|
||||
{
|
||||
type: 'number',
|
||||
defaults: 0,
|
||||
name: 'counter',
|
||||
tips: '统计数量'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'exclusiveGateway',
|
||||
label: '排他网关',
|
||||
desc: '选择满足条件的一个子节点执行',
|
||||
options: [
|
||||
statusOption,
|
||||
{
|
||||
type: 'number',
|
||||
defaults: 0,
|
||||
name: 'counter',
|
||||
tips: '统计数量'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
export default [
|
||||
{
|
||||
url: '/api/behavior/trees',
|
||||
method: 'get',
|
||||
response: () => {
|
||||
return createResponse(behaviors)
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/api/behavior/trees',
|
||||
method: 'post',
|
||||
response: ({body}) => {
|
||||
let value = behaviors.filter((b) => b.id == body?.id)
|
||||
if (value && value.length > 0) {
|
||||
value[0] = Object.assign(value[0], body)
|
||||
} else {
|
||||
behaviors.push(body)
|
||||
}
|
||||
return createResponse(behaviors)
|
||||
},
|
||||
},
|
||||
] as MockMethod[];
|
||||
16
modeler/mock/core.ts
Normal file
16
modeler/mock/core.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* This file is part of the kernelstudio package.
|
||||
*
|
||||
* (c) 2014-2025 zlin <admin@kernelstudio.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE file
|
||||
* that was distributed with this source code.
|
||||
*/
|
||||
|
||||
export const createResponse = (result: any,success: boolean = true, message: String = null)=> {
|
||||
return {
|
||||
success: success,
|
||||
message: message,
|
||||
result: result,
|
||||
}
|
||||
}
|
||||
61
modeler/mock/files.ts
Normal file
61
modeler/mock/files.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* This file is part of the kernelstudio package.
|
||||
*
|
||||
* (c) 2014-2025 zlin <admin@kernelstudio.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE file
|
||||
* that was distributed with this source code.
|
||||
*/
|
||||
import {MockMethod} from 'vite-plugin-mock';
|
||||
import {createResponse} from './core';
|
||||
|
||||
export default [
|
||||
{
|
||||
url: '/api/finder/browser',
|
||||
method: 'post',
|
||||
response: () => {
|
||||
return {
|
||||
success: true,
|
||||
message: null,
|
||||
data: [
|
||||
{
|
||||
name: 'home',
|
||||
directory: true,
|
||||
path: '/home',
|
||||
children: [
|
||||
{
|
||||
name: 'users',
|
||||
directory: true,
|
||||
path: '/users',
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'usr',
|
||||
directory: true,
|
||||
path: '/usr',
|
||||
children: [
|
||||
{
|
||||
name: 'opt',
|
||||
directory: true,
|
||||
path: '/opt',
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'var',
|
||||
directory: true,
|
||||
path: '/var',
|
||||
children: [
|
||||
{
|
||||
name: 'lib',
|
||||
directory: true,
|
||||
path: '/lib',
|
||||
},
|
||||
]
|
||||
}
|
||||
],
|
||||
}
|
||||
}
|
||||
},
|
||||
] as MockMethod[];
|
||||
22
modeler/mock/samples.ts
Normal file
22
modeler/mock/samples.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* This file is part of the kernelstudio package.
|
||||
*
|
||||
* (c) 2014-2025 zlin <admin@kernelstudio.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE file
|
||||
* that was distributed with this source code.
|
||||
*/
|
||||
import {MockMethod} from 'vite-plugin-mock';
|
||||
import {createResponse} from './core';
|
||||
|
||||
export default [
|
||||
{
|
||||
url: '/api/samples',
|
||||
method: 'get',
|
||||
response: () => {
|
||||
return createResponse( {
|
||||
name: 'vben',
|
||||
})
|
||||
},
|
||||
},
|
||||
] as MockMethod[];
|
||||
Reference in New Issue
Block a user