feat: auto open digital sync records
This commit is contained in:
@@ -51,6 +51,7 @@ const DigitalEmployeeSync: React.FC = () => {
|
||||
const { hasPermission } = useModel('menuModel');
|
||||
const actionRef = useRef<ActionType>();
|
||||
const formRef = useRef<FormInstance>();
|
||||
const autoOpenedOutboxRef = useRef<string | null>(null);
|
||||
const location = useLocation();
|
||||
const [, setSearchParams] = useSearchParams();
|
||||
const [payloadRecord, setPayloadRecord] =
|
||||
@@ -80,6 +81,7 @@ const DigitalEmployeeSync: React.FC = () => {
|
||||
outbox_id: undefined,
|
||||
});
|
||||
actionRef.current?.setPageInfo?.({ current: 1, pageSize: 15 });
|
||||
autoOpenedOutboxRef.current = null;
|
||||
if (location.search) {
|
||||
setSearchParams(new URLSearchParams());
|
||||
return;
|
||||
@@ -87,6 +89,10 @@ const DigitalEmployeeSync: React.FC = () => {
|
||||
actionRef.current?.reload();
|
||||
}, [location.search, setSearchParams]);
|
||||
|
||||
useEffect(() => {
|
||||
autoOpenedOutboxRef.current = null;
|
||||
}, [location.search]);
|
||||
|
||||
useEffect(() => {
|
||||
const state = location.state as any;
|
||||
if (state?._t) {
|
||||
@@ -211,8 +217,23 @@ const DigitalEmployeeSync: React.FC = () => {
|
||||
message.error(response.message || '查询数字员工同步记录失败');
|
||||
}
|
||||
|
||||
const records = response.data?.records || [];
|
||||
const outboxId = params.outbox_id?.trim();
|
||||
const matchedRecord = outboxId
|
||||
? records.find((record) => record.outbox_id === outboxId)
|
||||
: null;
|
||||
if (
|
||||
response.code === SUCCESS_CODE &&
|
||||
outboxId &&
|
||||
matchedRecord &&
|
||||
autoOpenedOutboxRef.current !== outboxId
|
||||
) {
|
||||
autoOpenedOutboxRef.current = outboxId;
|
||||
setPayloadRecord(matchedRecord);
|
||||
}
|
||||
|
||||
return {
|
||||
data: response.data?.records || [],
|
||||
data: records,
|
||||
total: response.data?.total || 0,
|
||||
success: response.code === SUCCESS_CODE,
|
||||
};
|
||||
|
||||
@@ -484,7 +484,7 @@ GET /api/digital-employee/sync/records
|
||||
- 支持 `client_key`、`entity_type`、`entity_id`、`outbox_id`、`page_no`、`page_size` 查询参数。
|
||||
- 按当前登录上下文租户隔离,默认每页 20 条,最大每页 100 条。
|
||||
- 当前返回通用同步记录和原始 payload,用于管理端页面或联调工具先查看同步结果;后续再拆分为更丰富的 Plan / Task / Run / Event 查询模型。
|
||||
- 管理端已增加“数字员工同步记录”菜单、权限资源和列表页,可按客户端 Key、实体类型、实体 ID、Outbox ID 查询并查看 payload,且支持 URL 查询参数预填筛选条件。
|
||||
- 管理端已增加“数字员工同步记录”菜单、权限资源和列表页,可按客户端 Key、实体类型、实体 ID、Outbox ID 查询并查看 payload;URL 查询参数会预填筛选条件,并在命中 Outbox ID 时自动打开 payload 抽屉。
|
||||
|
||||
下一步:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user