This commit is contained in:
zwt13703
2026-07-02 14:48:05 +08:00
parent a1a314cf99
commit e558733f05
64 changed files with 3258 additions and 1 deletions
+17
View File
@@ -0,0 +1,17 @@
import { defineStore } from 'pinia'
import { ref } from 'vue'
import { generateApi } from '@/api/generate'
import type { Document } from '@/types'
export const useDocumentStore = defineStore('document', () => {
const documents = ref<Document[]>([])
const currentDoc = ref<Document | null>(null)
const loading = ref(false)
async function fetchList(params?: any) { loading.value = true; try { const r: any = await generateApi.documents(params); documents.value = r.data?.items || r.data || [] } finally { loading.value = false } }
async function generateFull(data: any) { const r: any = await generateApi.full(data); return r.data }
async function cancel(id: number) { await generateApi.cancel(id) }
async function removeDoc(id: number) { await generateApi.deleteDocument(id); await fetchList() }
return { documents, currentDoc, loading, fetchList, generateFull, cancel, removeDoc }
})