自然语言抵扣金信息解析为抵扣金
This commit is contained in:
@@ -30,3 +30,13 @@ export function deleteLbDeductionAmount(id) {
|
|||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 大模型解析抵扣金文本并保存,请求可能较慢 */
|
||||||
|
export function parseLbDeductionAmountFromText(data) {
|
||||||
|
return request({
|
||||||
|
url: '/lbDeductionAmount/parseFromText',
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
timeout: 120000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -70,8 +70,23 @@
|
|||||||
/>
|
/>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="640px" @close="resetForm">
|
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="760px" @close="resetForm">
|
||||||
<el-form ref="dataForm" :model="form" :rules="formRules" label-width="100px">
|
<el-form ref="dataForm" :model="form" :rules="formRules" label-width="100px">
|
||||||
|
<template v-if="!isEdit">
|
||||||
|
<el-form-item label="抵扣金文本">
|
||||||
|
<el-input
|
||||||
|
v-model="deductionParseText"
|
||||||
|
type="textarea"
|
||||||
|
:rows="7"
|
||||||
|
placeholder="请输入抵扣金相关自然语言描述,点击下方「AI解析」自动保存"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label=" ">
|
||||||
|
<el-button type="primary" plain :loading="parseAiLoading" @click="handleParseFromDeductionText">
|
||||||
|
AI解析
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</template>
|
||||||
<el-form-item label="用户姓名" prop="userName">
|
<el-form-item label="用户姓名" prop="userName">
|
||||||
<el-input v-model="form.userName" placeholder="请输入用户姓名" />
|
<el-input v-model="form.userName" placeholder="请输入用户姓名" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -111,6 +126,7 @@ import {
|
|||||||
addLbDeductionAmount,
|
addLbDeductionAmount,
|
||||||
deleteLbDeductionAmount,
|
deleteLbDeductionAmount,
|
||||||
getLbDeductionAmountList,
|
getLbDeductionAmountList,
|
||||||
|
parseLbDeductionAmountFromText,
|
||||||
updateLbDeductionAmount
|
updateLbDeductionAmount
|
||||||
} from '@/api/lb-deduction-amount'
|
} from '@/api/lb-deduction-amount'
|
||||||
import { getBusinessHeaders } from '@/utils/business-headers'
|
import { getBusinessHeaders } from '@/utils/business-headers'
|
||||||
@@ -121,6 +137,8 @@ export default {
|
|||||||
return {
|
return {
|
||||||
loading: false,
|
loading: false,
|
||||||
submitLoading: false,
|
submitLoading: false,
|
||||||
|
parseAiLoading: false,
|
||||||
|
deductionParseText: '',
|
||||||
list: [],
|
list: [],
|
||||||
total: 0,
|
total: 0,
|
||||||
createTimeRange: [],
|
createTimeRange: [],
|
||||||
@@ -156,6 +174,29 @@ export default {
|
|||||||
const value = headers && headers['X-Tenant-Id']
|
const value = headers && headers['X-Tenant-Id']
|
||||||
return value ? String(value).trim() : ''
|
return value ? String(value).trim() : ''
|
||||||
},
|
},
|
||||||
|
handleParseFromDeductionText() {
|
||||||
|
const text = (this.deductionParseText || '').trim()
|
||||||
|
if (!text) {
|
||||||
|
this.$message.warning('请先填写抵扣金文本')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const tenantId = this.getTenantIdFromBusinessHeaders()
|
||||||
|
if (!tenantId) {
|
||||||
|
this.$message.error('未获取到租户ID,请先登录或配置业务请求头中的租户')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.parseAiLoading = true
|
||||||
|
parseLbDeductionAmountFromText({ text, tenantId })
|
||||||
|
.then((res) => {
|
||||||
|
const payload = res && typeof res === 'object' ? res : {}
|
||||||
|
this.$message.success((payload.message) || '解析成功')
|
||||||
|
this.dialogVisible = false
|
||||||
|
this.fetchList()
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.parseAiLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
fetchList() {
|
fetchList() {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
getLbDeductionAmountList(this.buildListParams())
|
getLbDeductionAmountList(this.buildListParams())
|
||||||
@@ -291,6 +332,7 @@ export default {
|
|||||||
this.resetFormData()
|
this.resetFormData()
|
||||||
},
|
},
|
||||||
resetFormData() {
|
resetFormData() {
|
||||||
|
this.deductionParseText = ''
|
||||||
this.form = {
|
this.form = {
|
||||||
id: '',
|
id: '',
|
||||||
userName: '',
|
userName: '',
|
||||||
|
|||||||
Reference in New Issue
Block a user