fix
Some checks failed
Docker Build & Deploy / Build Docker Image (push) Failing after 6s
Docker Build & Deploy / Deploy to Production (push) Has been skipped

This commit is contained in:
2026-01-01 11:58:21 +08:00
parent 0444218898
commit c1aa4df4f3
11 changed files with 442 additions and 165 deletions

View File

@@ -51,7 +51,7 @@
</template>
<script setup>
import { ref, computed, onMounted } from 'vue'
import { ref, computed, onMounted, nextTick } from 'vue'
import { useRouter } from 'vue-router'
import { showToast, showLoadingToast, closeToast, showConfirmDialog } from 'vant'
import {
@@ -68,6 +68,7 @@ const totalGroups = ref(0)
const classifying = ref(false)
const hasChanges = ref(false)
const classifyBuffer = ref('')
const suppressDataChanged = ref(false)
// 计算已选中的数量
const selectedCount = computed(() => {
@@ -98,6 +99,11 @@ const handleDataLoaded = ({ groups, total }) => {
// 处理数据变更
const handleDataChanged = async () => {
if (suppressDataChanged.value) {
suppressDataChanged.value = false
return
}
await loadUnclassifiedCount()
hasChanges.value = false
}
@@ -191,6 +197,7 @@ const startClassify = async () => {
// 处理SSE事件
const handleSSEEvent = (eventType, data, classifyResults) => {
console.log('收到事件:', eventType, data)
if (eventType === 'data') {
try {
classifyBuffer.value += data
@@ -221,27 +228,32 @@ const handleSSEEvent = (eventType, data, classifyResults) => {
try {
const result = JSON.parse(jsonStr)
if (result.id && groupListRef.value) {
classifyResults.set(result.id, {
classify: result.classify || '',
type: result.type !== undefined ? result.type : null
classify: result.Classify || '',
type: result.Type !== undefined ? result.Type : null
})
// 更新组件内的分组显示状态
const groups = groupListRef.value.getList()
for (const group of groups) {
if (group.transactionIds.includes(result.id)) {
group.sampleClassify = result.classify || ''
if (result.type !== undefined && result.type !== null) {
group.sampleType = result.type
group.sampleClassify = result.Classify || ''
if (result.Type !== undefined && result.Type !== null) {
group.sampleType = result.Type
}
hasChanges.value = true
break
}
}
// 更新回组件
// 更新回组件(内部更新时抑制 data-changed 处理)
suppressDataChanged.value = true
groupListRef.value.setList(groups)
// 确保在子组件内部事件触发后恢复标志并保持 hasChanges
nextTick(() => {
suppressDataChanged.value = false
hasChanges.value = true
})
}
} catch (e) {
console.error('JSON解析失败:', e)