diff --git a/main/manager-web/src/apis/module/admin.js b/main/manager-web/src/apis/module/admin.js index 1f9ad5d4..fecc5877 100644 --- a/main/manager-web/src/apis/module/admin.js +++ b/main/manager-web/src/apis/module/admin.js @@ -115,7 +115,6 @@ export default { }, // 删除 deleteParam(ids, callback) { - console.log(4444,ids ) RequestService.sendRequest() .url(`${getServiceUrl()}/admin/params/delete`) .method('POST') diff --git a/main/manager-web/src/apis/module/timbre.js b/main/manager-web/src/apis/module/timbre.js index 9b48e5c3..91920522 100644 --- a/main/manager-web/src/apis/module/timbre.js +++ b/main/manager-web/src/apis/module/timbre.js @@ -1,11 +1,8 @@ -// timbre.js import {getServiceUrl} from '../api'; import RequestService from '../httpRequest'; export default { - /** - * 获取音色数据 - */ + // 获取音色 getVoiceList(params, callback) { const queryParams = new URLSearchParams({ ttsModelId: params.ttsModelId, @@ -28,9 +25,7 @@ export default { }); }).send(); }, - /** - * 音色保存 - */ + // 音色保存 saveVoice(params, callback) { RequestService.sendRequest() .url(`${getServiceUrl()}/ttsVoice`) @@ -54,15 +49,12 @@ export default { }); }).send(); }, - /** - * 音色删除 - */ - deleteVoice(id, callback) { - console.log('尝试删除音色,ID:', id); + // 音色删除 + deleteVoice(ids, callback) { RequestService.sendRequest() - .url(`${getServiceUrl()}/ttsVoice`) - .method('DELETE') - .data({ ids: [id] }) + .url(`${getServiceUrl()}/ttsVoice/delete`) + .method('POST') + .data(ids) .success((res) => { RequestService.clearRequestTime() callback(res); @@ -70,13 +62,11 @@ export default { .fail((err) => { console.error('删除音色失败:', err); RequestService.reAjaxFun(() => { - this.deleteVoice(id, callback); + this.deleteVoice(ids, callback); }); }).send(); }, - /** - * 音色修改 - */ + // 音色修改 updateVoice(params, callback) { RequestService.sendRequest() .url(`${getServiceUrl()}/ttsVoice/${params.id}`) diff --git a/main/manager-web/src/components/TtsModel.vue b/main/manager-web/src/components/TtsModel.vue index e60bfbb0..06984b6d 100644 --- a/main/manager-web/src/components/TtsModel.vue +++ b/main/manager-web/src/components/TtsModel.vue @@ -1,7 +1,7 @@ + @scroll="handleScroll"> {{ scope.row.languageType }} - + + class="audio-input"> + - + - 编辑 + + 编辑 - + 删除 @@ -105,10 +104,14 @@ {{ selectAll ? '取消全选' : '全选' }} - + 新增 - 删除 + row.selected))" + style="background: red;border:None">删除 + @@ -419,105 +422,57 @@ export default { }, deleteRow(row) { - this.$confirm("确定要删除该音色吗?", "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning", - }) - .then(() => { - Api.timbre.deleteVoice(row.id, (response) => { - if (response.code === 0) { - this.$message.success({ - message: "删除成功", - showClose: true - }); - this.loadData(); // 刷新数据 - } else { - this.$message.error({ - message: response.msg || "删除失败", - showClose: true - }); + // 处理单个音色或音色数组 + const voices = Array.isArray(row) ? row : [row]; + + if (Array.isArray(row) && row.length === 0) { + this.$message.warning("请先选择需要删除的音色"); + return; + } + + + const voiceCount = voices.length; + this.$confirm(`确定要删除选中的${voiceCount}个音色吗?`, "警告", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + distinguishCancelAndClose: true + }).then(() => { + const ids = voices.map(voice => voice.id); + if (ids.some(id => !id)) { + this.$message.error("存在无效的音色ID"); + return; } - }); - }) - .catch(() => { - this.$message.info("已取消删除"); - }); - }, - batchDelete() { - const selectedRows = this.filteredTtsModels.filter(row => row.selected); - if (selectedRows.length === 0) { - this.$message.warning("请先选择需要删除的音色"); - return; - } - - this.$confirm(`确定要删除选中的${selectedRows.length}个音色吗?`, "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning", - }) - .then(async () => { - const loading = this.$loading({ - lock: true, - text: "正在删除中...", - spinner: "el-icon-loading", - background: "rgba(0, 0, 0, 0.7)", - }); - - try { - const results = await Promise.all( - selectedRows.map((row) => { - return new Promise((resolve) => { - Api.timbre.deleteVoice(row.id, (response) => { - if (response.code === 0) { - resolve({ success: true, id: row.id }); - } else { - resolve({ - success: false, - id: row.id, - msg: response.msg || '删除失败' - }); - } - }); + Api.timbre.deleteVoice(ids, ({data}) => { + if (data.code === 0) { + this.$message.success({ + message: `成功删除${voiceCount}个参数`, + showClose: true }); - }) - ); - - const successCount = results.filter(r => r.success).length; - const failCount = results.length - successCount; - - if (failCount === 0) { - this.$message.success({ - message: `成功删除${successCount}个音色`, - showClose: true - }); - } else if (successCount === 0) { - this.$message.error({ - message: '删除失败,请重试', - showClose: true - }); + this.loadData(); // 刷新参数列表 } else { - this.$message.warning({ - message: `成功删除${successCount}个音色,${failCount}个删除失败`, - showClose: true - }); + this.$message.error({ + message: data.msg || '删除失败,请重试', + showClose: true + }); } - - this.loadData(); // 刷新数据 - } catch (error) { - console.error('批量删除出错:', error); - this.$message.error({ - message: '删除过程中发生错误', - showClose: true - }); - } finally { - loading.close(); - } - }) - .catch(() => { - this.$message.info("已取消删除"); }); + }).catch(action => { + if (action === 'cancel') { + this.$message({ + type: 'info', + message: '已取消删除操作', + duration: 1000 + }); + } else { + this.$message({ + type: 'info', + message: '操作已关闭', + duration: 1000 + }); + } + }); }, isValidAudioUrl(url) { @@ -532,7 +487,7 @@ export default { ::v-deep .el-dialog { border-radius: 8px !important; overflow: hidden; - top: 8vh !important; + top: 1vh !important; } ::v-deep .el-dialog__header { @@ -628,13 +583,13 @@ export default { .table-container { flex: 1; overflow-y: scroll; - scrollbar-width: none; /* Firefox */ - padding-right: 15px; /* 为滚动条留出空间 */ - width: calc(100% - 16px); /* 减去滚动条宽度 */ + scrollbar-width: none; + padding-right: 15px; + width: calc(100% - 16px); } .table-container::-webkit-scrollbar { - display: none; /* Chrome/Safari */ + display: none; } /* 自定义滚动条 */ @@ -684,10 +639,33 @@ export default { display: none; } +/* 音频播放器容器样式 */ +.custom-audio-container { + width: 280px; + margin: auto; +} + /* 新增按钮组样式 */ .action-buttons { bottom: 20px; padding-top: 10px; } +.edit-btn, +.delete-btn, +.save-btn { + margin: 0 8px; + color: #7079aa !important; + transition: all 0.3s; +} +.edit-btn:hover, +.delete-btn:hover, +.save-btn:hover { + color: #5f70f3 !important; + transform: scale(1.05); +} + +.save-btn { + color: #5cca8e !important; +} \ No newline at end of file diff --git a/main/manager-web/src/views/ModelConfig.vue b/main/manager-web/src/views/ModelConfig.vue index 3ad7232e..1216c45f 100644 --- a/main/manager-web/src/views/ModelConfig.vue +++ b/main/manager-web/src/views/ModelConfig.vue @@ -3,7 +3,7 @@ - 模型配置 + {{ modelTypeText }} @@ -14,6 +14,21 @@ + + + + + 搜索 + + + @@ -44,23 +59,6 @@ - - - {{ modelTypeText }} - - 添加 - - - - - - - 查询 - - - - - @@ -103,9 +101,13 @@