使用amis实现bpmn
- Dominant language
- TypeScript
- Stars
- 18.9k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
Description
#### 描述问题:
如何在弹窗中点击按钮,再弹窗,获取第一个弹窗的值(使用bpmnjs的公用方法获取图的数据,传值是如何传?)
目前使用react的hooks拿不到值 直接使用let定义变量可以拿到 但无法渲染新的弹窗及拿值
如何传值呢?
#### 截图或视频:
可以的话,尽可能提供截图或视频来补充描述你的问题...
#### 如何复现(请务必完整填写下面内容):
1. 你是如何使用 amis 的?
`sdk`、`npm` 或`其他`...
2. amis 版本是什么?请先在最新 beta 版本测试问题是否存在
3. 粘贴有问题的完整 `amis schema` 代码:
```
const [yuValue, setValue] = useState(''); // 预览
function getValue(){
return yuValue
}
const handleButtonClick = () => {
// 通过方法获取数值
console.log(yuValue,'yuValue')
// const dialogValue = yuValue;
const dialogValue = getValue();
amisRender({
type: 'dialog',
label: '预览',
"actionType": "dialog",
body: {
type: 'tpl',
tpl: `获取到的数值为:${aaaaaaa}`
}
});
};
{
"name": "buttonZu",
"id":"asda",
"type": "dropdown-button",
"hideCaret": true,
"label": "预览",
"icon": "fa fa-eye",
"level": "primary",
"trigger": "hover",
"buttons": [
{
"type": "button",
"name": "xmlLook",
"label": "预览XML",
"actionType": "dialog",
"onEvent": {
"click": {
"actions": [
{
// "actionType": "setValue",
"actionType": "custom",
// "actionType": "closeDialog",
// "componentId": "asda",
"script": function (e: any) {
console.log(e, 'eeeeeeeeeeee')
console.log(bpmnModeler, 'bpmnModelerbpmnModelerbpmnModeler')
bpmnModeler.saveXML({ format: true }).then(({ xml }) => {
console.log(xml,'预览xml')
setValue(xml);
aaaaaaa=xml
setTimeout(() => {
handleButtonClick()
}, 1000);
});
},
// "script": "return new Promise((resolve, reject) => {setTimeout(() => {event.setData({...event.data, pId: '01027359'});resolve();}, 3000)})",
// "target": "xmlslook=${xmlLook}"
},
]
},
},
"dialog": {
"actions": [],
"title": "预览",
"body": [
{
"name": "xmlslook",
"type":"tpl",
"tpl":"${xmlData}"
}
]
},
},
{
"type": "button",
"label": "预览JSON"
}
]
}
```
4. 操作步骤
请简单描述一下复现的操作步骤...
表格里点击按钮 弹出bpmnjs流程图,再点击预览 再弹出一个窗显示 bpmnjs的数据,无法获取值
@2betop
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the provided schema, the React useState setup, and handleButtonClick, then trace the custom action calling bpmnModeler.saveXML and setValue. Check how amisRender opens the second dialog and how the dialog body reads xmlData. Done would require a reproducible schema and confirmed value passing, but the issue does not provide an amis version or complete reproduction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100