大量的代码格式化
Some checks failed
Docker Build & Deploy / Build Docker Image (push) Failing after 1m10s
Docker Build & Deploy / Deploy to Production (push) Has been skipped
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s
Some checks failed
Docker Build & Deploy / Build Docker Image (push) Failing after 1m10s
Docker Build & Deploy / Deploy to Production (push) Has been skipped
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s
This commit is contained in:
@@ -1,11 +1,6 @@
|
||||
<template>
|
||||
<div class="page-container-flex classification-nlp">
|
||||
<van-nav-bar
|
||||
title="自然语言分类"
|
||||
left-text="返回"
|
||||
left-arrow
|
||||
@click-left="onClickLeft"
|
||||
/>
|
||||
<van-nav-bar title="自然语言分类" left-text="返回" left-arrow @click-left="onClickLeft" />
|
||||
|
||||
<div class="scroll-content">
|
||||
<!-- 输入区域 -->
|
||||
@@ -21,15 +16,9 @@
|
||||
show-word-limit
|
||||
/>
|
||||
</van-cell-group>
|
||||
|
||||
|
||||
<div class="action-buttons">
|
||||
<van-button
|
||||
type="primary"
|
||||
block
|
||||
round
|
||||
:loading="analyzing"
|
||||
@click="handleAnalyze"
|
||||
>
|
||||
<van-button type="primary" block round :loading="analyzing" @click="handleAnalyze">
|
||||
分析查询
|
||||
</van-button>
|
||||
</div>
|
||||
@@ -41,9 +30,9 @@
|
||||
<van-cell title="查询关键词" :value="analysisResult.searchKeyword" />
|
||||
<van-cell title="AI建议类型" :value="getTypeName(analysisResult.targetType)" />
|
||||
<van-cell title="AI建议分类" :value="analysisResult.targetClassify" />
|
||||
<van-cell
|
||||
title="找到记录"
|
||||
:value="`${analysisResult.records.length} 条`"
|
||||
<van-cell
|
||||
title="找到记录"
|
||||
:value="`${analysisResult.records.length} 条`"
|
||||
is-link
|
||||
@click="showRecordsList = true"
|
||||
/>
|
||||
@@ -59,32 +48,14 @@
|
||||
/>
|
||||
|
||||
<!-- 记录列表弹窗 -->
|
||||
<PopupContainer
|
||||
v-model="showRecordsList"
|
||||
title="交易记录列表"
|
||||
height="75%"
|
||||
>
|
||||
<div style="background: var(--van-background);">
|
||||
<PopupContainer v-model="showRecordsList" title="交易记录列表" height="75%">
|
||||
<div style="background: var(--van-background)">
|
||||
<!-- 批量操作按钮 -->
|
||||
<div class="batch-actions">
|
||||
<van-button
|
||||
plain
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="selectAll"
|
||||
>
|
||||
全选
|
||||
</van-button>
|
||||
<van-button
|
||||
plain
|
||||
type="default"
|
||||
size="small"
|
||||
@click="selectNone"
|
||||
>
|
||||
全不选
|
||||
</van-button>
|
||||
<van-button
|
||||
type="success"
|
||||
<van-button plain type="primary" size="small" @click="selectAll"> 全选 </van-button>
|
||||
<van-button plain type="default" size="small" @click="selectNone"> 全不选 </van-button>
|
||||
<van-button
|
||||
type="success"
|
||||
size="small"
|
||||
:loading="submitting"
|
||||
:disabled="selectedIds.size === 0"
|
||||
@@ -138,9 +109,11 @@ const onClickLeft = () => {
|
||||
|
||||
// 将带目标分类的记录转换为普通交易记录格式供列表显示
|
||||
const displayRecords = computed(() => {
|
||||
if (!analysisResult.value) return []
|
||||
|
||||
return analysisResult.value.records.map(r => ({
|
||||
if (!analysisResult.value) {
|
||||
return []
|
||||
}
|
||||
|
||||
return analysisResult.value.records.map((r) => ({
|
||||
id: r.id,
|
||||
reason: r.reason,
|
||||
amount: r.amount,
|
||||
@@ -178,14 +151,14 @@ const handleAnalyze = async () => {
|
||||
try {
|
||||
analyzing.value = true
|
||||
const response = await nlpAnalysis(userInput.value)
|
||||
|
||||
|
||||
if (response.success) {
|
||||
analysisResult.value = response.data
|
||||
|
||||
|
||||
// 默认全选
|
||||
const allIds = new Set(response.data.records.map(r => r.id))
|
||||
const allIds = new Set(response.data.records.map((r) => r.id))
|
||||
selectedIds.value = allIds
|
||||
|
||||
|
||||
showToast(`找到 ${response.data.records.length} 条记录`)
|
||||
} else {
|
||||
showToast(response.message || '分析失败')
|
||||
@@ -200,8 +173,10 @@ const handleAnalyze = async () => {
|
||||
|
||||
// 全选
|
||||
const selectAll = () => {
|
||||
if (!analysisResult.value) return
|
||||
const allIds = new Set(analysisResult.value.records.map(r => r.id))
|
||||
if (!analysisResult.value) {
|
||||
return
|
||||
}
|
||||
const allIds = new Set(analysisResult.value.records.map((r) => r.id))
|
||||
selectedIds.value = allIds
|
||||
}
|
||||
|
||||
@@ -218,7 +193,7 @@ const updateSelectedIds = (newSelectedIds) => {
|
||||
// 点击记录查看详情
|
||||
const handleRecordClick = (transaction) => {
|
||||
// 从原始记录中获取完整信息
|
||||
const record = analysisResult.value?.records.find(r => r.id === transaction.id)
|
||||
const record = analysisResult.value?.records.find((r) => r.id === transaction.id)
|
||||
if (record) {
|
||||
currentTransaction.value = {
|
||||
id: record.id,
|
||||
@@ -263,18 +238,18 @@ const handleSubmit = async () => {
|
||||
|
||||
try {
|
||||
submitting.value = true
|
||||
|
||||
|
||||
// 构建批量更新数据(使用AI修改后的结果)
|
||||
const items = analysisResult.value.records
|
||||
.filter(r => selectedIds.value.has(r.id))
|
||||
.map(r => ({
|
||||
.filter((r) => selectedIds.value.has(r.id))
|
||||
.map((r) => ({
|
||||
id: r.id,
|
||||
classify: r.upsetedClassify,
|
||||
type: r.upsetedType
|
||||
}))
|
||||
|
||||
|
||||
const response = await batchUpdateClassify(items)
|
||||
|
||||
|
||||
if (response.success) {
|
||||
showToast('分类设置成功')
|
||||
// 清空结果,让用户进行新的查询
|
||||
|
||||
Reference in New Issue
Block a user