fix(store): fix

This commit is contained in:
2026-03-19 20:35:54 +08:00
parent bfd5a550af
commit bbe72251a8
3 changed files with 17 additions and 3 deletions

View File

@@ -20,6 +20,9 @@ const RecoverModal = ({ open, handleCancel, handleOk }: ComponentProps) => {
initialValues: {
name: "",
},
validate: {
name: (value) => (value.length < 1 ? "请选择备份" : null),
},
})
const [options, setOptions] = useState<any[]>([])
@@ -59,8 +62,8 @@ const RecoverModal = ({ open, handleCancel, handleOk }: ComponentProps) => {
data={options}
searchable
label="备份名称"
key="backup_name"
{...form.getInputProps("backup_name")}
key="name"
{...form.getInputProps("name")}
/>
</CustomModal>
)

View File

@@ -967,8 +967,16 @@ const TopTools = (
if (!renderPolygons) return
let taskLabelData = await storage.getItem(taskDetail!.id.toString())
if (taskLabelData) {
const backupData = taskLabelData.state?.[name]
if (!name || !backupData) {
notifications.show({
color: "yellow",
message: "备份不存在或尚未选择备份",
})
return
}
const finalData = adjustAllPoints(
taskLabelData.state[name],
backupData,
usePaperStore.getState().rasterScale
)
for (const entry of finalData.entries()) {

View File

@@ -118,6 +118,9 @@ export const adjustAllPoints: (
string,
Map<string, [number, any[], any, any[]][]>
>()
if (!(nestedMap instanceof Map)) {
return adjustedMap
}
nestedMap.forEach((innerMap, outerKey) => {
const scale = allScale[outerKey]
if (scale) {