forked from erp-dev/erp
36 lines
933 B
Python
36 lines
933 B
Python
"""
|
|
测试新增的 get_process_nodes API 端点
|
|
"""
|
|
import requests
|
|
|
|
BASE_URL = "http://localhost:8000"
|
|
|
|
# 假设你已经有了 JWT token
|
|
TOKEN = "your_jwt_token_here"
|
|
headers = {"Authorization": f"Bearer {TOKEN}"}
|
|
|
|
# 业务对象 ID
|
|
business_object_id = 1
|
|
|
|
# 获取流程的所有节点
|
|
response = requests.get(
|
|
f"{BASE_URL}/api/v1/stateflow/business-objects/{business_object_id}/process-nodes/",
|
|
headers=headers
|
|
)
|
|
|
|
if response.status_code == 200:
|
|
data = response.json()
|
|
print(f"流程共有 {data['count']} 个节点:")
|
|
print()
|
|
|
|
for node in data['nodes']:
|
|
print(f"节点 {node['order'] + 1}:")
|
|
print(f" - ProcessNode ID: {node['id']}")
|
|
print(f" - State ID: {node['state_id']}")
|
|
print(f" - State 名称: {node['state_name']}")
|
|
print(f" - 顺序: {node['order']}")
|
|
print()
|
|
else:
|
|
print(f"错误: {response.status_code}")
|
|
print(response.json())
|