|
@@ -1,5 +1,5 @@
|
|
|
import { ref } from "vue";
|
|
|
-import { autoSetModeCallback, createTemploraryID } from './sys'
|
|
|
+import { autoSetModeCallback, createTemploraryID, unSetModelUpdate } from './sys'
|
|
|
import { deleteStoreItem, recoverStoreItems, saveStoreItems } from '@/utils'
|
|
|
import { fetchRecordFragments, postDeleteRecordFragment } from '@/api'
|
|
|
|
|
@@ -38,18 +38,22 @@ export const recoverRecordFragments = recoverStoreItems(recordFragments, getBack
|
|
|
|
|
|
export const initRecordFragmentsByRecord = async (record: Record) => {
|
|
|
const fragments = await fetchRecordFragments(record.id)
|
|
|
- recordFragments.value = recordFragments.value
|
|
|
- .filter(fragment => fragment.recordId !== record.id)
|
|
|
- .concat(fragments.map(fragment => ({...fragment, recordId: record.id})))
|
|
|
+ unSetModelUpdate(() => {
|
|
|
+ recordFragments.value = recordFragments.value
|
|
|
+ .filter(fragment => fragment.recordId !== record.id)
|
|
|
+ .concat(fragments.map(fragment => ({...fragment, recordId: record.id})))
|
|
|
+ })
|
|
|
|
|
|
- getBackupRecordFragments()
|
|
|
+ backupRecordFragments()
|
|
|
}
|
|
|
|
|
|
export const deleteRecordFragment = deleteStoreItem(recordFragments, fragment => postDeleteRecordFragment(fragment.id))
|
|
|
export const saveRecordFragments = saveStoreItems(
|
|
|
recordFragments,
|
|
|
getBackupRecordFragments,
|
|
|
- { delete: deleteRecordFragment }
|
|
|
+ {
|
|
|
+ // delete: deleteRecordFragment
|
|
|
+ }
|
|
|
)
|
|
|
export const autoSaveRecordFragments = autoSetModeCallback(recordFragments, {
|
|
|
backup: backupRecordFragments,
|