调整服务列表

This commit is contained in:
zhonghua.li
2026-04-19 21:00:05 +08:00
parent 24e8418cbf
commit b4d9a61b47
2 changed files with 59 additions and 44 deletions

View File

@@ -76,9 +76,6 @@
class="service-action-menu" class="service-action-menu"
v-if="selectedServiceItem && selectedServiceItem.id === item.id && showServiceActionMenu" v-if="selectedServiceItem && selectedServiceItem.id === item.id && showServiceActionMenu"
@click.stop> @click.stop>
<view class="service-action-menu-item service-action-menu-item--danger" @click="handleDelete(item)">
<text>删除</text>
</view>
<view class="service-action-menu-divider"></view> <view class="service-action-menu-divider"></view>
<view class="service-action-menu-item" @click="handleView(item)"> <view class="service-action-menu-item" @click="handleView(item)">
<text>查看</text> <text>查看</text>
@@ -88,6 +85,10 @@
<text>AI分析</text> <text>AI分析</text>
</view> </view>
<view class="service-action-menu-divider"></view> <view class="service-action-menu-divider"></view>
<view class="service-action-menu-item" @click="handleAnalysisDetail(item)">
<text>AI精提</text>
</view>
<view class="service-action-menu-divider"></view>
<view class="service-action-menu-item" @click="handleAudio(item)"> <view class="service-action-menu-item" @click="handleAudio(item)">
<text>录音</text> <text>录音</text>
</view> </view>
@@ -210,12 +211,10 @@
item: item item: item
}); });
}, },
// 处理AI分析 // 处理AI分析(与 AI精提 共用请求体 AudioManagement仅接口路径与文案不同
async handleAnalysis(item) { async postAudioManagementAi(item, { apiPath, loadingTitle, successFallback, errorLabel }) {
this.closeServiceActionMenu(); this.closeServiceActionMenu();
try { try {
// 获取录音记录ID
const recordId = item.id || item.rawData?.id; const recordId = item.id || item.rawData?.id;
if (!recordId) { if (!recordId) {
uni.showToast({ uni.showToast({
@@ -224,20 +223,13 @@
}); });
return; return;
} }
// 获取完整的 AudioManagement 对象,优先使用 rawData如果没有则使用 item 的字段构建
const audioManagement = item.rawData || { const audioManagement = item.rawData || {
id: recordId id: recordId
}; };
uni.showLoading({ uni.showLoading({
title: 'AI分析中...' title: loadingTitle
}); });
const url = getApiUrl(apiPath);
// 调用AI分析接口/api/audioManagement/AIAnlyzById
const url = getApiUrl('/api/audioManagement/AIAnlyzById');
// 获取认证信息
let tenantId = ''; let tenantId = '';
let token = ''; let token = '';
try { try {
@@ -246,8 +238,6 @@
} catch (e) { } catch (e) {
console.error('获取认证信息失败:', e); console.error('获取认证信息失败:', e);
} }
// 构建请求头
const headers = { const headers = {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}; };
@@ -257,25 +247,20 @@
if (tenantId) { if (tenantId) {
headers['X-Tenant-Id'] = tenantId; headers['X-Tenant-Id'] = tenantId;
} }
const res = await uni.request({ const res = await uni.request({
url: url, url: url,
method: 'POST', method: 'POST',
data: audioManagement, data: audioManagement,
header: headers, header: headers,
timeout: 60000 // AI分析可能需要较长时间设置60秒超时 timeout: 60000
}); });
uni.hideLoading(); uni.hideLoading();
if (res.statusCode === 200 && res.data && res.data.success) { if (res.statusCode === 200 && res.data && res.data.success) {
uni.showToast({ uni.showToast({
title: res.data.message || 'AI分析请求已提交', title: res.data.message || successFallback,
icon: 'success', icon: 'success',
duration: 2000 duration: 2000
}); });
// 如果返回了更新后的数据,通知父组件更新列表项
if (res.data.data) { if (res.data.data) {
const d = res.data.data; const d = res.data.data;
const updatedItem = { const updatedItem = {
@@ -286,36 +271,47 @@
audioFileExtension: d.audioFileExtension != null ? d.audioFileExtension : item.audioFileExtension, audioFileExtension: d.audioFileExtension != null ? d.audioFileExtension : item.audioFileExtension,
recordingText: d.recordingText != null ? d.recordingText : item.recordingText recordingText: d.recordingText != null ? d.recordingText : item.recordingText
}; };
// 通知父组件更新该项
this.$emit('updateItem', { this.$emit('updateItem', {
recordId: recordId, recordId: recordId,
data: updatedItem data: updatedItem
}); });
// 触发详情查看事件,使用更新后的数据打开详情页
this.$emit('itemClick', updatedItem); this.$emit('itemClick', updatedItem);
} else { } else {
// 如果没有返回数据,仍然打开详情页
this.$emit('itemClick', item); this.$emit('itemClick', item);
} }
} else { } else {
uni.showToast({ uni.showToast({
title: res.data?.message || 'AI分析失败', title: res.data?.message || `${errorLabel}失败`,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });
} }
} catch (error) { } catch (error) {
uni.hideLoading(); uni.hideLoading();
console.error('AI分析失败:', error); console.error(`${errorLabel}失败:`, error);
uni.showToast({ uni.showToast({
title: `AI分析失败: ${error.errMsg || error.message || '未知错误'}`, title: `${errorLabel}失败: ${error.errMsg || error.message || '未知错误'}`,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });
} }
}, },
handleAnalysis(item) {
return this.postAudioManagementAi(item, {
apiPath: '/api/audioManagement/AIAnlyzById',
loadingTitle: 'AI分析中...',
successFallback: 'AI分析请求已提交',
errorLabel: 'AI分析'
});
},
handleAnalysisDetail(item) {
return this.postAudioManagementAi(item, {
apiPath: '/api/audioManagement/AIAnlyzByIdForDetail',
loadingTitle: 'AI精提中...',
successFallback: 'AI精提请求已提交',
errorLabel: 'AI精提'
});
},
// 处理录音 // 处理录音
handleAudio(item) { handleAudio(item) {
this.closeServiceActionMenu(); this.closeServiceActionMenu();

View File

@@ -53,8 +53,13 @@
<text class="info-value">{{loginUserInfo.email}}</text> <text class="info-value">{{loginUserInfo.email}}</text>
</view> </view>
</view> </view>
<uni-grid class="grid" :column="4" :showBorder="false" :square="true"> <view class="ucenter-stats">
<uni-grid-item class="item" v-for="(item,index) in gridList" @click.native="tapGrid(index)" :key="index"> <view
class="ucenter-stats-cell"
v-for="(item,index) in gridList"
:key="index"
@click="tapGrid(index)"
>
<uni-icons class="icon" color="#007AFF" :type="item.icon" size="26"></uni-icons> <uni-icons class="icon" color="#007AFF" :type="item.icon" size="26"></uni-icons>
<view v-if="index === 0" class="device-text-wrapper"> <view v-if="index === 0" class="device-text-wrapper">
<text class="device-label">设备总数</text> <text class="device-label">设备总数</text>
@@ -69,8 +74,8 @@
<text class="device-count">{{totalProjects}}</text> <text class="device-count">{{totalProjects}}</text>
</view> </view>
<text v-else class="text">{{item.text}}</text> <text v-else class="text">{{item.text}}</text>
</uni-grid-item> </view>
</uni-grid> </view>
<uni-list class="center-list" v-for="(sublist , index) in ucenterList" :key="index"> <uni-list class="center-list" v-for="(sublist , index) in ucenterList" :key="index">
<uni-list-item v-for="(item,i) in sublist" :title="item.title" link :rightText="item.rightText" :key="i" <uni-list-item v-for="(item,i) in sublist" :title="item.title" link :rightText="item.rightText" :key="i"
:clickable="true" :to="item.to" @click="ucenterListClick(item)" :show-extra-icon="true" :clickable="true" :to="item.to" @click="ucenterListClick(item)" :show-extra-icon="true"
@@ -971,21 +976,35 @@
word-break: break-all; word-break: break-all;
} }
.grid { .ucenter-stats {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
width: 100%;
background-color: #FFFFFF; background-color: #FFFFFF;
margin-bottom: 6px; margin-bottom: 6px;
padding: 24rpx 16rpx;
box-sizing: border-box;
} }
.uni-grid .text { .ucenter-stats-cell {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
padding: 8rpx 4rpx;
box-sizing: border-box;
}
.ucenter-stats .text {
font-size: 16px; font-size: 16px;
height: 25px; height: 25px;
line-height: 25px; line-height: 25px;
color: #817f82; color: #817f82;
} margin-top: 8rpx;
text-align: center;
.uni-grid .item ::v-deep .uni-grid-item__box {
justify-content: center;
align-items: center;
} }
.device-text-wrapper { .device-text-wrapper {