|
@@ -194,14 +194,17 @@
|
|
|
|
|
|
|
|
<!-- AI Insights -->
|
|
<!-- AI Insights -->
|
|
|
<div class="detail-section" >
|
|
<div class="detail-section" >
|
|
|
- <h4><i class="fas fa-robot"></i> AI 洞察</h4>
|
|
|
|
|
- <div class="ai-insight-cards" v-if="selectedCustomer.customerAnalysisResult?.reasonSummary">
|
|
|
|
|
|
|
+ <h4>
|
|
|
|
|
+ <div><i class="fas fa-robot"></i> AI 洞察</div>
|
|
|
|
|
+ <div><button class="btn btn-primary" @click="aiStreaming(selectedCustomer.id)" style="margin-left: 10px;padding: 4px 8px;border-radius: 4px;" :disabled="aiContentLoading"><i class="fas fa-sync" :class="{'icon-spin': aiContentLoading}" style="color: #fff;"></i> AI分析</button></div>
|
|
|
|
|
+ </h4>
|
|
|
|
|
+ <div class="ai-insight-cards" v-if="formattedText">
|
|
|
<div class="ai-insight-card">
|
|
<div class="ai-insight-card">
|
|
|
<!-- <div class="insight-icon" :class="insight.level">
|
|
<!-- <div class="insight-icon" :class="insight.level">
|
|
|
<i :class="insight.icon"></i>
|
|
<i :class="insight.icon"></i>
|
|
|
</div> -->
|
|
</div> -->
|
|
|
<div class="insight-content">
|
|
<div class="insight-content">
|
|
|
- <div class="insight-title">{{ selectedCustomer.customerAnalysisResult?.reasonSummary }}</div>
|
|
|
|
|
|
|
+ <div class="insight-title">{{ formattedText }}</div>
|
|
|
<!-- <div class="insight-desc">{{ insight.description }}</div> -->
|
|
<!-- <div class="insight-desc">{{ insight.description }}</div> -->
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -261,7 +264,7 @@
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
import { ref, computed } from 'vue'
|
|
import { ref, computed } from 'vue'
|
|
|
-import { getCustomerList,getCustomerDetail } from '../api/customer'
|
|
|
|
|
|
|
+import { getCustomerList,getCustomerDetail,streaming } from '../api/customer'
|
|
|
import {region} from '@/utils/region';
|
|
import {region} from '@/utils/region';
|
|
|
// 引入添加客户组件
|
|
// 引入添加客户组件
|
|
|
import AddCustomerModal from '../components/addCustomer.vue'
|
|
import AddCustomerModal from '../components/addCustomer.vue'
|
|
@@ -277,6 +280,8 @@ const showToast = ref(false)
|
|
|
const toastMessage = ref('')
|
|
const toastMessage = ref('')
|
|
|
const toastType = ref('success')
|
|
const toastType = ref('success')
|
|
|
const dataLoading = ref(false)
|
|
const dataLoading = ref(false)
|
|
|
|
|
+const aiContentLoading = ref(false)
|
|
|
|
|
+const formattedText = ref('')
|
|
|
|
|
|
|
|
const customerStats = ref({
|
|
const customerStats = ref({
|
|
|
total: 0,
|
|
total: 0,
|
|
@@ -327,6 +332,43 @@ const getRegion = (value) => {
|
|
|
getCustomer()
|
|
getCustomer()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+const showCustomerDetail = (customer) => {
|
|
|
|
|
+ getCustomerDetail({id:customer.id}).then(res => {
|
|
|
|
|
+ if(res.success){
|
|
|
|
|
+ selectedCustomer.value = res.result
|
|
|
|
|
+ showDetailModal.value = true
|
|
|
|
|
+ if(selectedCustomer.value.customerAnalysisResult){
|
|
|
|
|
+ formattedText.value = selectedCustomer.value.customerAnalysisResult.reasonSummary.replace(/(?=【(沟通意见|注意事项)】)/g, '\n')
|
|
|
|
|
+ }
|
|
|
|
|
+ }else{
|
|
|
|
|
+ ElMessage.warning(res.message)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const aiStreaming= (id) =>{
|
|
|
|
|
+ let params = {
|
|
|
|
|
+ appId: "app-rQrSHhudWbi5LVRkIX4tfVrg",
|
|
|
|
|
+ inputs: {"analysis_batch_no":"1","customer_id":+id},
|
|
|
|
|
+ query: "1",
|
|
|
|
|
+ response_mode: "streaming",
|
|
|
|
|
+ user: "1",
|
|
|
|
|
+ files:[]
|
|
|
|
|
+ }
|
|
|
|
|
+ if(aiContentLoading.value) return
|
|
|
|
|
+ aiContentLoading.value = true
|
|
|
|
|
+ streaming(params).then(res => {
|
|
|
|
|
+ aiContentLoading.value = false
|
|
|
|
|
+ ElMessage.warning('AI分析时间大概为2-4分钟,请稍后查看')
|
|
|
|
|
+ if(res.success){
|
|
|
|
|
+ aiContentLoading.value = true
|
|
|
|
|
+ }
|
|
|
|
|
+ // else{
|
|
|
|
|
+ // return ElMessage.error('请求超时,请稍后再试')
|
|
|
|
|
+ // }
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const goOtherProject = (data) => {
|
|
const goOtherProject = (data) => {
|
|
|
console.log(data)
|
|
console.log(data)
|
|
|
const baseUrl = 'https://sales.test.storlead.com/customer/followPanel' // 销售管理系统
|
|
const baseUrl = 'https://sales.test.storlead.com/customer/followPanel' // 销售管理系统
|
|
@@ -450,17 +492,6 @@ const getStatusLabel = (status) => ({
|
|
|
silent: '沉默'
|
|
silent: '沉默'
|
|
|
}[status] || status)
|
|
}[status] || status)
|
|
|
|
|
|
|
|
-const showCustomerDetail = (customer) => {
|
|
|
|
|
- getCustomerDetail({id:customer.id}).then(res => {
|
|
|
|
|
- console.log(res)
|
|
|
|
|
- if(res.success){
|
|
|
|
|
- selectedCustomer.value = res.result
|
|
|
|
|
- showDetailModal.value = true
|
|
|
|
|
- }else{
|
|
|
|
|
- ElMessage.warning(res.message)
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
-}
|
|
|
|
|
|
|
|
|
|
const sendEmail = (customer) => {
|
|
const sendEmail = (customer) => {
|
|
|
showToastMessage(`正在发送邮件给 ${customer.contact}...`, 'success')
|
|
showToastMessage(`正在发送邮件给 ${customer.contact}...`, 'success')
|
|
@@ -619,7 +650,7 @@ const handleAddCustomer = (customerData) => {
|
|
|
.insight-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 14px; }
|
|
.insight-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 14px; }
|
|
|
.insight-icon.high { background: rgba(16, 185, 129, 0.2); color: var(--success); }
|
|
.insight-icon.high { background: rgba(16, 185, 129, 0.2); color: var(--success); }
|
|
|
.insight-icon.medium { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
|
|
.insight-icon.medium { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
|
|
|
-.insight-title { font-size: 13px; margin-bottom: 4px; }
|
|
|
|
|
|
|
+.insight-title { font-size: 13px; margin-bottom: 4px;white-space: pre-line; }
|
|
|
.insight-desc { font-size: 11px; color: var(--text-secondary); line-height: 1.5; }
|
|
.insight-desc { font-size: 11px; color: var(--text-secondary); line-height: 1.5; }
|
|
|
.timeline { display: flex; flex-direction: column; gap: 12px; position: relative; padding-left: 24px; }
|
|
.timeline { display: flex; flex-direction: column; gap: 12px; position: relative; padding-left: 24px; }
|
|
|
.timeline::before { content: ''; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: var(--border); }
|
|
.timeline::before { content: ''; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: var(--border); }
|
|
@@ -648,4 +679,12 @@ const handleAddCustomer = (customerData) => {
|
|
|
.toast.success i { color: var(--success); }
|
|
.toast.success i { color: var(--success); }
|
|
|
.toast-enter-active, .toast-leave-active { transition: all 0.3s ease; }
|
|
.toast-enter-active, .toast-leave-active { transition: all 0.3s ease; }
|
|
|
.toast-enter-from, .toast-leave-to { opacity: 0; transform: translateY(20px); }
|
|
.toast-enter-from, .toast-leave-to { opacity: 0; transform: translateY(20px); }
|
|
|
|
|
+
|
|
|
|
|
+.icon-spin {
|
|
|
|
|
+ animation: spin 1s linear infinite !important;
|
|
|
|
|
+}
|
|
|
|
|
+@keyframes spin {
|
|
|
|
|
+ 0% { transform: rotate(0deg); }
|
|
|
|
|
+ 100% { transform: rotate(360deg); }
|
|
|
|
|
+}
|
|
|
</style>
|
|
</style>
|