feat(clone): allow same-source cloning and disable cross-sourceType targets

- Remove the restriction that prevents cloning to the same data source
- Disable (instead of hide) target options with different sourceType
- Add sourceType label (MT4/MT5) to data source select options
- Preserve groupFilter/param1/param2 when cloning to same source
- Auto-reset target when source changes to incompatible sourceType
- Remove parent-level check requiring at least 2 data sources

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-06-14 21:39:01 +08:00
parent dfcba94cf5
commit 16999ca583
4 changed files with 174 additions and 97 deletions

View File

@@ -232,22 +232,22 @@ const MultiCopyPopup = ({
onValuesChange={({ sourceDataSourceId }) => {
if (sourceDataSourceId) {
const curFormRef = formMapRef?.current?.[0]?.current;
const curTargetDataSourceId =
curFormRef?.getFieldValue('targetDataSourceId');
if (curTargetDataSourceId === sourceDataSourceId) {
let targetDataSourceId: string | number | null = null;
for (const item of dataSourceList) {
if (item.id !== sourceDataSourceId) {
targetDataSourceId = item.id;
break;
}
}
if (targetDataSourceId) {
curFormRef?.setFieldsValue({
targetDataSourceId,
});
setTargetDataSourceId(targetDataSourceId);
}
const curTargetId = curFormRef?.getFieldValue('targetDataSourceId');
const sourceItem = dataSourceList.find(
(item) => item.id === sourceDataSourceId,
);
const targetItem = dataSourceList.find(
(item) => item.id === curTargetId,
);
if (targetItem && sourceItem && targetItem.sourceType !== sourceItem.sourceType) {
const fallback =
dataSourceList.find(
(item) =>
item.id !== sourceDataSourceId &&
item.sourceType === sourceItem.sourceType,
)?.id || sourceDataSourceId;
curFormRef?.setFieldsValue({ targetDataSourceId: fallback });
setTargetDataSourceId(fallback);
}
}
}}