customRect.js
924 Bytes
/*
* @Date: 2025-03-11 15:09:41
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-03-11 15:36:53
* @FilePath: /logic-flow2/src/views/node/customRect.js
* @Description: 文件描述
*/
import { RectNode, RectNodeModel } from '@logicflow/core';
class CustomRectModel extends RectNodeModel {
getNodeStyle() {
const style = super.getNodeStyle();
const properties = this.properties;
if (properties.status === 'pass') {
// 业务属性status为‘pass’时 展示边框颜色为green
style.stroke = 'green';
} else if (properties.status === 'reject') {
// 业务属性status为‘reject’时 展示边框颜色为red
style.stroke = 'red';
} else {
style.stroke = 'rgb(24, 125, 255)';
}
return style;
}
}
class CustomRectNode extends RectNode {}
export default {
type: 'custom-rect',
view: CustomRectNode,
model: CustomRectModel,
};