Files
xiaozhi-esp32-server/main/manager-web/src/views/ModelConfig.vue
T

1006 lines
27 KiB
Vue
Raw Normal View History

2025-03-26 17:10:06 +08:00
<template>
<div class="welcome">
<HeaderBar />
2025-04-05 20:19:28 +08:00
<div class="operation-bar">
<h2 class="page-title">{{ $t('modelConfig.' + activeTab) }}</h2>
<div class="action-group">
2025-04-15 01:46:36 +08:00
<div class="search-group">
<el-input :placeholder="$t('modelConfig.searchPlaceholder')" v-model="search" class="search-input" clearable
2025-04-15 01:46:36 +08:00
@keyup.enter.native="handleSearch" style="width: 240px" />
<el-button class="btn-search" @click="handleSearch">
{{ $t('modelConfig.search') }}
2025-04-15 01:46:36 +08:00
</el-button>
</div>
</div>
2025-04-05 20:19:28 +08:00
</div>
2025-03-31 14:28:29 +08:00
2025-03-26 17:10:06 +08:00
<!-- 主体内容 -->
<div class="main-wrapper">
<div class="content-panel">
<!-- 左侧导航 -->
<el-menu :default-active="activeTab" class="nav-panel" @select="handleMenuSelect"
2025-04-05 20:19:28 +08:00
style="background-size: cover; background-position: center;">
2025-03-26 17:10:06 +08:00
<el-menu-item index="vad">
<span class="menu-text">{{ $t('modelConfig.vad') }}</span>
2025-03-26 17:10:06 +08:00
</el-menu-item>
<el-menu-item index="asr">
<span class="menu-text">{{ $t('modelConfig.asr') }}</span>
2025-03-26 17:10:06 +08:00
</el-menu-item>
<el-menu-item index="llm">
<span class="menu-text">{{ $t('modelConfig.llm') }}</span>
2025-03-26 17:10:06 +08:00
</el-menu-item>
2025-06-01 13:34:32 +08:00
<el-menu-item index="vllm">
<span class="menu-text">{{ $t('modelConfig.vllm') }}</span>
2025-06-01 13:34:32 +08:00
</el-menu-item>
2025-03-26 17:10:06 +08:00
<el-menu-item index="intent">
<span class="menu-text">{{ $t('modelConfig.intent') }}</span>
2025-03-26 17:10:06 +08:00
</el-menu-item>
<el-menu-item index="tts">
<span class="menu-text">{{ $t('modelConfig.tts') }}</span>
2025-03-26 17:10:06 +08:00
</el-menu-item>
<el-menu-item index="memory">
<span class="menu-text">{{ $t('modelConfig.memory') }}</span>
2025-03-26 17:10:06 +08:00
</el-menu-item>
</el-menu>
<!-- 右侧内容 -->
<div class="content-area">
<el-card class="model-card" shadow="never">
<el-table ref="modelTable" style="width: 100%" v-loading="loading" :element-loading-text="$t('modelConfig.loading')"
2025-04-24 10:41:14 +08:00
element-loading-spinner="el-icon-loading" element-loading-background="rgba(255, 255, 255, 0.7)"
:header-cell-style="{ background: 'transparent' }" :data="modelList" class="data-table"
header-row-class-name="table-header" :header-cell-class-name="headerCellClassName"
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" :cell-class-name="selectionCellClassName"></el-table-column>
<el-table-column :label="$t('modelConfig.modelId')" prop="id" align="center"></el-table-column>
<el-table-column :label="$t('modelConfig.modelName')" prop="modelName" align="center"></el-table-column>
<el-table-column :label="$t('modelConfig.provider')" align="center">
<template slot-scope="scope">
{{ scope.row.configJson.type || $t('modelConfig.unknown') }}
</template>
</el-table-column>
<el-table-column :label="$t('modelConfig.isEnabled')" align="center">
<template slot-scope="scope">
<el-switch v-model="scope.row.isEnabled" class="custom-switch" :active-value="1" :inactive-value="0"
@change="handleStatusChange(scope.row)" />
</template>
</el-table-column>
<el-table-column :label="$t('modelConfig.isDefault')" align="center">
<template slot-scope="scope">
<el-switch v-model="scope.row.isDefault" class="custom-switch" :active-value="1" :inactive-value="0"
@change="handleDefaultChange(scope.row)" />
</template>
</el-table-column>
<el-table-column v-if="activeTab === 'tts'" :label="$t('modelConfig.voiceManagement')" align="center">
<template slot-scope="scope">
<el-button type="text" size="mini" @click="openTtsDialog(scope.row)" class="voice-management-btn">
{{ $t('modelConfig.voiceManagement') }}
</el-button>
</template>
</el-table-column>
<el-table-column :label="$t('modelConfig.action')" align="center" width="180px">
<template slot-scope="scope">
<el-button type="text" size="mini" @click="editModel(scope.row)" class="edit-btn">
{{ $t('modelConfig.edit') }}
</el-button>
<el-button type="text" size="mini" @click="duplicateModel(scope.row)" class="edit-btn">
{{ $t('modelConfig.duplicate') }}
</el-button>
<el-button type="text" size="mini" @click="deleteModel(scope.row)" class="delete-btn">
{{ $t('modelConfig.delete') }}
</el-button>
</template>
</el-table-column>
</el-table>
<div class="table-footer">
<div class="batch-actions">
<el-button size="mini" type="primary" @click="selectAll">
{{ isAllSelected ?
$t('modelConfig.deselectAll') : $t('modelConfig.selectAll') }}
</el-button>
<el-button type="success" size="mini" @click="addModel" class="add-btn">
{{ $t('modelConfig.add') }}
</el-button>
<el-button size="mini" type="danger" icon="el-icon-delete" @click="batchDelete">
{{ $t('modelConfig.delete') }}
</el-button>
</div>
<div class="custom-pagination">
2025-04-15 10:30:52 +08:00
<el-select v-model="pageSize" @change="handlePageSizeChange" class="page-size-select">
<el-option v-for="item in pageSizeOptions" :key="item" :label="$t('modelConfig.itemsPerPage', { items: item })" :value="item">
2025-04-15 10:30:52 +08:00
</el-option>
</el-select>
2025-04-15 10:30:52 +08:00
<button class="pagination-btn" :disabled="currentPage === 1" @click="goFirst">{{ $t('modelConfig.firstPage') }}</button>
<button class="pagination-btn" :disabled="currentPage === 1" @click="goPrev">{{ $t('modelConfig.prevPage') }}</button>
<button v-for="page in visiblePages" :key="page" class="pagination-btn"
:class="{ active: page === currentPage }" @click="goToPage(page)">
{{ page }}
</button>
<button class="pagination-btn" :disabled="currentPage === pageCount" @click="goNext">{{ $t('modelConfig.nextPage') }}</button>
<span class="total-text">{{ $t('modelConfig.totalRecords', { total }) }}</span>
</div>
2025-03-26 21:43:07 +08:00
</div>
</el-card>
2025-03-26 17:10:06 +08:00
</div>
</div>
2025-04-05 20:19:28 +08:00
<ModelEditDialog :modelType="activeTab" :visible.sync="editDialogVisible" :modelData="editModelData"
@save="handleModelSave" />
<TtsModel :visible.sync="ttsDialogVisible" :ttsModelId="selectedTtsModelId" :modelConfig="selectedModelConfig" />
2025-04-05 20:19:28 +08:00
<AddModelDialog :modelType="activeTab" :visible.sync="addDialogVisible" @confirm="handleAddConfirm" />
2025-03-20 18:11:37 +08:00
</div>
2025-04-24 10:41:14 +08:00
<el-footer>
<version-footer />
</el-footer>
2025-04-05 20:19:28 +08:00
</div>
2025-03-26 17:10:06 +08:00
</template>
2025-03-20 18:11:37 +08:00
2025-03-26 17:10:06 +08:00
<script>
2025-04-05 21:03:46 +08:00
import Api from "@/apis/api";
2025-04-05 20:19:28 +08:00
import AddModelDialog from "@/components/AddModelDialog.vue";
2025-03-26 17:10:06 +08:00
import HeaderBar from "@/components/HeaderBar.vue";
import ModelEditDialog from "@/components/ModelEditDialog.vue";
import TtsModel from "@/components/TtsModel.vue";
2025-04-24 10:41:14 +08:00
import VersionFooter from "@/components/VersionFooter.vue";
2025-03-26 17:10:06 +08:00
export default {
2025-04-24 10:41:14 +08:00
components: { HeaderBar, ModelEditDialog, TtsModel, AddModelDialog, VersionFooter },
2025-03-26 17:10:06 +08:00
data() {
return {
2025-03-26 21:43:07 +08:00
addDialogVisible: false,
2025-03-26 17:10:06 +08:00
activeTab: 'llm',
search: '',
editDialogVisible: false,
editModelData: {},
ttsDialogVisible: false,
selectedTtsModelId: '',
2025-04-02 23:52:13 +08:00
modelList: [],
pageSizeOptions: [10, 20, 50, 100],
2025-03-26 17:10:06 +08:00
currentPage: 1,
pageSize: 10,
2025-04-02 23:52:13 +08:00
total: 0,
2025-03-31 14:28:29 +08:00
selectedModels: [],
isAllSelected: false,
loading: false,
selectedModelConfig: {}
2025-03-26 17:10:06 +08:00
};
},
2025-04-02 23:52:13 +08:00
created() {
this.loadData();
},
mounted() {
// 在组件挂载后确保表头翻译文本正确显示
setTimeout(() => {
this.updateSelectionHeaderText();
}, 100);
},
updated() {
// 在组件更新后重新设置表头翻译文本
this.updateSelectionHeaderText();
},
2025-04-02 23:52:13 +08:00
computed: {
2025-04-03 08:24:47 +08:00
modelTypeText() {
return this.$t('modelConfig.' + this.activeTab) || this.$t('modelConfig.modelConfig')
2025-04-03 08:24:47 +08:00
},
pageCount() {
return Math.ceil(this.total / this.pageSize);
},
visiblePages() {
const pages = [];
const maxVisible = 3;
let start = Math.max(1, this.currentPage - 1);
let end = Math.min(this.pageCount, start + maxVisible - 1);
if (end - start + 1 < maxVisible) {
start = Math.max(1, end - maxVisible + 1);
}
for (let i = start; i <= end; i++) {
pages.push(i);
}
return pages;
}
},
2025-03-26 17:10:06 +08:00
methods: {
// 更新选择列表头翻译文本
updateSelectionHeaderText() {
const thElement = document.querySelector(`.el-table__header th:nth-child(1) .cell`);
if (thElement) {
thElement.setAttribute('data-content', this.$t('modelConfig.select'));
}
},
handlePageSizeChange(val) {
this.pageSize = val;
this.currentPage = 1;
this.loadData();
},
openTtsDialog(row) {
this.selectedTtsModelId = row.id;
this.selectedModelConfig = row;
this.ttsDialogVisible = true;
},
2025-03-31 14:28:29 +08:00
headerCellClassName({ column, columnIndex }) {
if (columnIndex === 0) {
return 'custom-selection-header';
}
return '';
},
selectionCellClassName({ row, column, rowIndex, columnIndex }) {
// 只对表头行设置data-content
if (rowIndex === undefined) {
// 使用setTimeout确保DOM已经渲染完成
setTimeout(() => {
const thElement = document.querySelector(`.el-table__header th:nth-child(1) .cell`);
if (thElement) {
thElement.setAttribute('data-content', this.$t('modelConfig.select'));
}
}, 0);
}
return '';
},
2025-03-26 17:10:06 +08:00
handleMenuSelect(index) {
this.activeTab = index;
this.currentPage = 1; // 重置到第一页
this.pageSize = 10; // 可选:重置每页条数
2025-04-03 08:24:47 +08:00
this.loadData();
2025-03-20 18:11:37 +08:00
},
2025-03-26 17:10:06 +08:00
handleSearch() {
2025-04-07 16:57:31 +08:00
this.currentPage = 1;
this.loadData();
2025-03-26 17:10:06 +08:00
},
// 批量删除
2025-03-26 17:10:06 +08:00
batchDelete() {
2025-03-31 14:28:29 +08:00
if (this.selectedModels.length === 0) {
this.$message.warning(this.$t('modelConfig.selectModelsFirst'))
return
2025-03-31 14:28:29 +08:00
}
this.$confirm(this.$t('modelConfig.confirmBatchDelete'), this.$t('common.prompt'), {
confirmButtonText: this.$t('common.confirm'),
cancelButtonText: this.$t('common.cancel'),
2025-03-31 14:28:29 +08:00
type: 'warning'
}).then(() => {
const deletePromises = this.selectedModels.map(model =>
new Promise(resolve => {
2025-04-05 21:03:46 +08:00
Api.model.deleteModel(
model.id,
2025-04-05 20:19:28 +08:00
({ data }) => resolve(data.code === 0)
)
})
)
Promise.all(deletePromises).then(results => {
if (results.every(Boolean)) {
this.$message.success({
message: this.$t('modelConfig.batchDeleteSuccess'),
showClose: true
})
this.loadData()
} else {
this.$message.error({
message: this.$t('modelConfig.partialDeleteFailed'),
showClose: true
})
}
})
2025-03-31 14:28:29 +08:00
}).catch(() => {
this.$message.info(this.$t('modelConfig.deleteCancelled'))
})
},
2025-03-26 17:10:06 +08:00
addModel() {
2025-03-26 21:43:07 +08:00
this.addDialogVisible = true;
2025-03-26 17:10:06 +08:00
},
editModel(model) {
this.editModelData = JSON.parse(JSON.stringify(model));
2025-03-26 17:10:06 +08:00
this.editDialogVisible = true;
},
duplicateModel(model) {
this.editModelData = JSON.parse(JSON.stringify(model));
this.editModelData.duplicateMode = true;
this.editDialogVisible = true;
},
// 删除单个模型
2025-03-26 17:10:06 +08:00
deleteModel(model) {
this.$confirm(this.$t('modelConfig.confirmDelete'), this.$t('common.prompt'), {
confirmButtonText: this.$t('common.confirm'),
cancelButtonText: this.$t('common.cancel'),
2025-03-31 14:28:29 +08:00
type: 'warning'
}).then(() => {
2025-04-05 21:03:46 +08:00
Api.model.deleteModel(
model.id,
2025-04-05 20:19:28 +08:00
({ data }) => {
if (data.code === 0) {
this.$message.success({
message: this.$t('modelConfig.deleteSuccess'),
showClose: true
})
this.loadData()
} else {
this.$message.error({
message: data.msg || this.$t('modelConfig.deleteFailed'),
showClose: true
})
}
}
)
2025-03-31 14:28:29 +08:00
}).catch(() => {
this.$message.info(this.$t('modelConfig.deleteCancelled'))
})
2025-03-26 17:10:06 +08:00
},
handleCurrentChange(page) {
this.currentPage = page;
2025-03-31 14:28:29 +08:00
this.$refs.modelTable.clearSelection();
2025-03-26 17:10:06 +08:00
},
handleModelSave({ provideCode, formData, done }) {
2025-04-08 10:53:59 +08:00
const modelType = this.activeTab;
const id = formData.id;
if (this.editModelData.duplicateMode) {
Api.model.addModel({modelType, provideCode, formData},
2025-04-08 10:53:59 +08:00
({ data }) => {
if (data.code === 0) {
this.$message.success(this.$t('modelConfig.duplicateSuccess'));
2025-04-08 10:53:59 +08:00
this.loadData();
this.editDialogVisible = false;
} else {
this.$message.error(data.msg || this.$t('modelConfig.duplicateFailed'));
2025-04-08 10:53:59 +08:00
}
done && done(); // 调用done回调关闭加载状态
})
}
else {
Api.model.updateModel(
{ modelType, provideCode, id, formData },
({ data }) => {
if (data.code === 0) {
this.$message.success(this.$t('modelConfig.saveSuccess'));
this.loadData();
this.editDialogVisible = false;
} else {
this.$message.error(data.msg || this.$t('modelConfig.saveFailed'));
}
done && done(); // 调用done回调关闭加载状态
}
);
}
2025-03-26 17:10:06 +08:00
},
selectAll() {
2025-03-31 14:28:29 +08:00
if (this.isAllSelected) {
this.$refs.modelTable.clearSelection();
} else {
this.$refs.modelTable.toggleAllSelection();
}
},
handleSelectionChange(val) {
this.selectedModels = val;
this.isAllSelected = val.length === this.modelList.length;
if (val.length === 0) {
this.isAllSelected = false;
}
2025-03-26 21:43:07 +08:00
},
2025-04-03 16:23:15 +08:00
// 新增模型配置
2025-03-26 21:43:07 +08:00
handleAddConfirm(newModel) {
2025-04-03 16:23:15 +08:00
const params = {
modelType: this.activeTab,
2025-04-07 09:44:48 +08:00
provideCode: newModel.provideCode,
2025-04-03 16:23:15 +08:00
formData: {
...newModel,
isDefault: newModel.isDefault ? 1 : 0,
2025-04-07 09:44:48 +08:00
isEnabled: newModel.isEnabled ? 1 : 0,
configJson: newModel.configJson
2025-04-03 16:23:15 +08:00
}
};
2025-04-05 21:03:46 +08:00
Api.model.addModel(params, ({ data }) => {
2025-04-03 16:23:15 +08:00
if (data.code === 0) {
this.$message.success({
message: this.$t('modelConfig.addSuccess'),
showClose: true
});
2025-04-03 16:23:15 +08:00
this.loadData();
} else {
this.$message.error({
message: data.msg || this.$t('modelConfig.addFailed'),
showClose: true
});
2025-04-03 16:23:15 +08:00
}
});
},
// 分页器
goFirst() {
2025-04-05 20:19:28 +08:00
this.currentPage = 1;
this.loadData();
},
goPrev() {
if (this.currentPage > 1) {
this.currentPage--;
this.loadData();
}
},
goNext() {
if (this.currentPage < this.pageCount) {
this.currentPage++;
this.loadData();
}
},
goToPage(page) {
this.currentPage = page;
this.loadData();
},
2025-04-02 23:52:13 +08:00
// 获取模型配置列表
loadData() {
this.loading = true; // 开始加载
2025-04-02 23:52:13 +08:00
const params = {
modelType: this.activeTab,
modelName: this.search,
page: this.currentPage,
limit: this.pageSize
};
2025-04-05 21:03:46 +08:00
Api.model.getModelList(params, ({ data }) => {
this.loading = false; // 结束加载
2025-04-02 23:52:13 +08:00
if (data.code === 0) {
this.modelList = data.data.list;
this.total = data.data.total;
} else {
this.$message.error(data.msg || this.$t('modelConfig.fetchModelsFailed'));
2025-04-02 23:52:13 +08:00
}
});
2025-04-07 15:15:45 +08:00
},
2025-04-12 17:36:04 +08:00
// 处理启用/禁用状态变更
2025-04-07 15:15:45 +08:00
handleStatusChange(model) {
const newStatus = model.isEnabled ? 1 : 0
const originalStatus = model.isEnabled
2025-04-12 17:36:04 +08:00
2025-04-07 15:15:45 +08:00
model.isEnabled = !model.isEnabled
Api.model.updateModelStatus(
model.id,
newStatus,
({ data }) => {
if (data.code === 0) {
this.$message.success(newStatus === 1 ? this.$t('modelConfig.enableSuccess') : this.$t('modelConfig.disableSuccess'))
2025-04-07 15:15:45 +08:00
// 保持新状态
model.isEnabled = newStatus
} else {
// 操作失败时恢复原状态
model.isEnabled = originalStatus
this.$message.error(data.msg || this.$t('modelConfig.operationFailed'))
2025-04-07 15:15:45 +08:00
}
}
)
2025-04-12 17:36:04 +08:00
},
handleDefaultChange(model) {
Api.model.setDefaultModel(model.id, ({ data }) => {
if (data.code === 0) {
this.$message.success(this.$t('modelConfig.setDefaultSuccess'))
2025-04-12 17:36:04 +08:00
this.loadData()
}
})
2025-03-24 17:27:08 +08:00
}
2025-03-26 21:43:07 +08:00
},
2025-03-26 17:10:06 +08:00
};
</script>
2025-03-20 18:11:37 +08:00
2025-03-26 17:10:06 +08:00
<style scoped>
2025-04-12 17:36:04 +08:00
.el-switch {
height: 23px;
}
2025-04-05 20:19:28 +08:00
::v-deep .el-table tr {
2025-04-02 12:05:09 +08:00
background: transparent;
}
2025-03-26 17:10:06 +08:00
.welcome {
min-width: 900px;
min-height: 506px;
height: 100vh;
display: flex;
position: relative;
flex-direction: column;
2025-04-02 11:36:12 +08:00
background-size: cover;
2025-04-02 12:05:09 +08:00
background: linear-gradient(to bottom right, #dce8ff, #e4eeff, #e6cbfd) center;
2025-03-26 17:10:06 +08:00
-webkit-background-size: cover;
-o-background-size: cover;
}
2025-03-20 18:11:37 +08:00
2025-03-26 17:10:06 +08:00
.main-wrapper {
margin: 5px 22px;
2025-03-26 17:10:06 +08:00
border-radius: 15px;
2025-05-26 15:34:21 +08:00
min-height: calc(100vh - 26vh);
height: auto;
max-height: 80vh;
2025-03-26 17:10:06 +08:00
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
position: relative;
2025-04-05 20:19:28 +08:00
background: rgba(237, 242, 255, 0.5);
2025-03-26 17:10:06 +08:00
}
2025-03-24 17:27:08 +08:00
2025-03-26 17:10:06 +08:00
.operation-bar {
display: flex;
2025-03-31 14:28:29 +08:00
justify-content: space-between;
2025-03-26 17:10:06 +08:00
align-items: center;
padding: 16px 24px;
}
2025-03-24 17:27:08 +08:00
2025-03-31 14:28:29 +08:00
.page-title {
font-size: 24px;
margin: 0;
}
2025-03-26 17:10:06 +08:00
.content-panel {
flex: 1;
display: flex;
overflow: hidden;
height: 100%;
border-radius: 15px;
background: transparent;
2025-04-05 22:12:54 +08:00
border: 1px solid #fff;
2025-03-26 17:10:06 +08:00
}
2025-03-24 17:27:08 +08:00
2025-03-26 17:10:06 +08:00
.nav-panel {
2025-03-31 14:28:29 +08:00
min-width: 242px;
2025-03-26 17:10:06 +08:00
height: 100%;
border-right: 1px solid #ebeef5;
2025-03-31 14:28:29 +08:00
background:
2025-04-05 20:19:28 +08:00
linear-gradient(120deg,
2025-03-31 14:28:29 +08:00
rgba(107, 140, 255, 0.3) 0%,
rgba(169, 102, 255, 0.3) 25%,
2025-04-05 20:19:28 +08:00
transparent 60%),
2025-03-31 14:28:29 +08:00
url("../assets/model/model.png") no-repeat center / cover;
2025-03-26 17:10:06 +08:00
padding: 16px 0;
flex-shrink: 0;
display: flex;
flex-direction: column;
}
2025-03-24 17:27:08 +08:00
2025-03-26 17:10:06 +08:00
.nav-panel .el-menu-item {
2025-03-31 14:28:29 +08:00
height: 50px;
2025-04-24 10:41:14 +08:00
background: #e9f0ff;
2025-03-31 14:28:29 +08:00
line-height: 50px;
2025-04-24 10:41:14 +08:00
border-radius: 4px 0 0 4px !important;
2025-03-26 17:10:06 +08:00
transition: all 0.3s;
display: flex !important;
justify-content: flex-end;
padding-right: 12px !important;
width: fit-content;
margin: 8px 0 8px auto;
2025-03-26 17:10:06 +08:00
min-width: unset;
}
2025-03-20 18:11:37 +08:00
2025-03-26 17:10:06 +08:00
.nav-panel .el-menu-item.is-active {
2025-04-24 10:41:14 +08:00
background: #5778ff;
2025-03-31 14:28:29 +08:00
position: relative;
padding-left: 40px !important;
}
.nav-panel .el-menu-item.is-active::before {
content: '';
position: absolute;
left: 15px;
top: 50%;
transform: translateY(-50%);
width: 13px;
height: 13px;
2025-04-24 10:41:14 +08:00
background: #fff;
2025-03-31 14:28:29 +08:00
border-radius: 50%;
box-shadow: 0 0 4px rgba(64, 158, 255, 0.5);
2025-03-26 17:10:06 +08:00
}
2025-03-20 18:11:37 +08:00
2025-03-26 17:10:06 +08:00
.menu-text {
font-size: 14px;
color: #606266;
text-align: right;
width: 100%;
padding-right: 8px;
}
2025-03-20 18:11:37 +08:00
2025-03-26 17:10:06 +08:00
.content-area {
flex: 1;
padding: 24px;
height: 100%;
min-width: 600px;
overflow: hidden;
background-color: white;
2025-03-26 17:10:06 +08:00
display: flex;
flex-direction: column;
2025-03-26 17:10:06 +08:00
}
2025-03-24 17:27:08 +08:00
2025-03-26 17:10:06 +08:00
.action-group {
display: flex;
align-items: center;
gap: 16px;
}
2025-03-24 17:27:08 +08:00
2025-03-26 17:10:06 +08:00
.search-group {
display: flex;
gap: 10px;
2025-03-26 17:10:06 +08:00
}
.search-input {
width: 240px;
}
.btn-search {
background: linear-gradient(135deg, #6b8cff, #a966ff);
border: none;
color: white;
2025-03-31 14:28:29 +08:00
}
2025-04-15 17:59:29 +08:00
.btn-search:hover {
opacity: 0.9;
transform: translateY(-1px);
}
2025-04-02 12:05:09 +08:00
::v-deep .search-input .el-input__inner {
border-radius: 4px;
border: 1px solid #DCDFE6;
background-color: white;
transition: border-color 0.2s;
2025-03-31 14:28:29 +08:00
}
::v-deep .page-size-select {
width: 100px;
margin-right: 8px;
}
::v-deep .page-size-select .el-input__inner {
height: 32px;
line-height: 32px;
border-radius: 4px;
border: 1px solid #e4e7ed;
background: #dee7ff;
color: #606266;
font-size: 14px;
}
::v-deep .page-size-select .el-input__suffix {
right: 6px;
width: 15px;
height: 20px;
display: flex;
justify-content: center;
align-items: center;
top: 6px;
border-radius: 4px;
}
::v-deep .page-size-select .el-input__suffix-inner {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
}
::v-deep .page-size-select .el-icon-arrow-up:before {
content: "";
display: inline-block;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-top: 9px solid #606266;
position: relative;
transform: rotate(0deg);
transition: transform 0.3s;
}
::v-deep .search-input .el-input__inner:focus {
border-color: #6b8cff;
outline: none;
}
2025-03-26 17:10:06 +08:00
.data-table {
border-radius: 6px;
overflow: hidden;
background-color: transparent !important;
}
2025-04-02 12:05:09 +08:00
.data-table /deep/ .el-table__row {
2025-03-26 17:10:06 +08:00
background-color: transparent !important;
}
.table-header th {
background-color: transparent !important;
color: #606266;
font-weight: 600;
}
.table-footer {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16px 0;
2025-03-26 21:43:07 +08:00
width: 100%;
flex-shrink: 0;
min-height: 60px;
background: white;
2025-03-26 17:10:06 +08:00
}
.batch-actions {
display: flex;
gap: 8px;
}
.batch-actions .el-button {
min-width: 72px;
height: 32px;
padding: 7px 12px 7px 10px;
font-size: 12px;
border-radius: 4px;
line-height: 1;
font-weight: 500;
border: none;
transition: all 0.3s ease;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.batch-actions .el-button:hover {
transform: translateY(-1px);
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}
.batch-actions .el-button--primary {
background: #5f70f3 !important;
color: white;
}
.batch-actions .el-button--success {
background: #5bc98c;
color: white;
}
.batch-actions .el-button--danger {
background: #fd5b63;
color: white;
}
2025-04-02 12:05:09 +08:00
.batch-actions .el-button:first-child {
background: linear-gradient(135deg, #409EFF, #6B8CFF);
2025-03-26 17:10:06 +08:00
border: none;
color: white;
}
2025-04-02 12:05:09 +08:00
.batch-actions .el-button:first-child:hover {
background: linear-gradient(135deg, #3A8EE6, #5A7CFF);
}
.el-table th /deep/ .el-table__cell {
overflow: hidden;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
background-color: transparent !important;
}
::v-deep .el-table .custom-selection-header .cell .el-checkbox__inner {
2025-04-05 20:19:28 +08:00
display: none !important;
2025-04-02 12:05:09 +08:00
}
::v-deep .el-table .custom-selection-header .cell::before {
content: attr(data-content);
2025-04-02 12:05:09 +08:00
display: block;
text-align: center;
line-height: 32px; /* 设置合适的行高,确保文本完整显示 */
2025-04-02 12:05:09 +08:00
color: black;
margin-top: 0; /* 移除可能导致偏移的上边距 */
height: 32px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 100%;
2025-04-02 12:05:09 +08:00
}
.custom-selection-header .cell {
position: relative;
}
/* 已移除可能影响文本显示的空伪元素 */
2025-04-02 12:05:09 +08:00
::v-deep .el-table__body .el-checkbox__inner {
display: inline-block !important;
background: #e6edfa;
}
::v-deep .el-table thead th:not(:first-child) .cell {
color: #303133 !important;
}
::v-deep .nav-panel .el-menu-item.is-active .menu-text {
2025-04-24 10:41:14 +08:00
color: #fff !important;
2025-04-02 12:05:09 +08:00
}
::v-deep .data-table {
2025-04-05 20:19:28 +08:00
2025-04-02 12:05:09 +08:00
&.el-table::before,
&.el-table::after,
&.el-table__inner-wrapper::before {
display: none !important;
}
}
::v-deep .data-table .el-table__header-wrapper {
2025-04-05 20:19:28 +08:00
border-bottom: 1px solid rgb(224, 227, 237);
2025-04-02 12:05:09 +08:00
}
::v-deep .data-table .el-table__body td {
2025-04-05 20:19:28 +08:00
border-bottom: 1px solid rgb(224, 227, 237) !important;
2025-04-02 12:05:09 +08:00
}
2025-04-05 20:19:28 +08:00
.el-button img {
2025-04-02 12:05:09 +08:00
height: 1em;
vertical-align: middle;
padding-right: 2px;
padding-bottom: 2px;
}
::v-deep .el-checkbox__inner {
border-color: #cfcfcf !important;
transition: all 0.2s ease-in-out;
}
::v-deep .el-checkbox__input.is-checked .el-checkbox__inner {
background-color: #5f70f3;
border-color: #5f70f3;
2025-04-02 12:05:09 +08:00
}
2025-04-02 11:36:12 +08:00
.voice-management-btn {
background: #9db3ea;
color: white;
min-width: 68px;
line-height: 14px;
white-space: nowrap;
transition: all 0.3s;
border-radius: 10px;
2025-03-26 17:10:06 +08:00
}
2025-04-02 11:36:12 +08:00
.voice-management-btn:hover {
2025-04-05 20:19:28 +08:00
background: #8aa2e0;
/* 悬停时颜色加深 */
2025-04-02 11:36:12 +08:00
transform: scale(1.05);
2025-03-26 21:43:07 +08:00
}
2025-04-02 12:05:09 +08:00
::v-deep .el-table .el-table-column--selection .cell {
padding-left: 15px !important;
}
::v-deep .el-table .el-table__fixed-right .cell {
padding-right: 15px !important;
}
2025-04-05 20:19:28 +08:00
.edit-btn,
.delete-btn {
2025-04-02 11:36:12 +08:00
margin: 0 8px;
color: #7079aa !important;
2025-03-26 21:43:07 +08:00
}
2025-04-02 12:05:09 +08:00
::v-deep .el-table .cell {
padding-left: 10px;
padding-right: 10px;
2025-03-31 14:28:29 +08:00
}
2025-04-02 12:05:09 +08:00
/* 分页器 */
.custom-pagination {
display: flex;
align-items: center;
gap: 8px;
/* 导航按钮样式 (首页、上一页、下一页) */
.pagination-btn:first-child,
.pagination-btn:nth-child(2),
2025-04-15 10:30:52 +08:00
.pagination-btn:nth-child(3),
.pagination-btn:nth-last-child(2) {
min-width: 60px;
height: 32px;
padding: 0 12px;
border-radius: 4px;
border: 1px solid #e4e7ed;
background: #DEE7FF;
color: #606266;
font-size: 14px;
cursor: pointer;
transition: all 0.3s ease;
&:hover {
background: #d7dce6;
}
&:disabled {
opacity: 0.6;
cursor: not-allowed;
}
}
/* 数字按钮样式 */
2025-04-15 10:30:52 +08:00
.pagination-btn:not(:first-child):not(:nth-child(2)):not(:nth-child(3)):not(:nth-last-child(2)) {
min-width: 28px;
height: 32px;
padding: 0;
border-radius: 4px;
border: 1px solid transparent;
background: transparent;
color: #606266;
font-size: 14px;
cursor: pointer;
transition: all 0.3s ease;
&:hover {
background: rgba(245, 247, 250, 0.3);
}
}
.pagination-btn.active {
background: #5f70f3 !important;
color: #ffffff !important;
border-color: #5f70f3 !important;
&:hover {
background: #6d7cf5 !important;
}
}
.total-text {
color: #909399;
font-size: 14px;
margin-left: 10px;
}
}
2025-04-15 10:30:52 +08:00
.model-card {
background: white;
flex: 1;
display: flex;
flex-direction: column;
border: none;
box-shadow: none;
overflow: hidden;
}
2025-04-15 10:30:52 +08:00
.model-card ::v-deep .el-card__body {
padding: 0;
display: flex;
flex-direction: column;
flex: 1;
overflow: hidden;
}
2025-04-15 10:30:52 +08:00
.data-table {
--table-max-height: calc(100vh - 45vh);
max-height: var(--table-max-height);
}
.data-table ::v-deep .el-table__body-wrapper {
max-height: calc(var(--table-max-height) - 80px);
overflow-y: auto;
2025-04-15 10:30:52 +08:00
}
::v-deep .el-loading-mask {
background-color: rgba(255, 255, 255, 0.6) !important;
backdrop-filter: blur(2px);
}
2025-04-24 10:41:14 +08:00
::v-deep .el-loading-spinner .circular {
width: 28px;
height: 28px;
}
2025-04-24 10:41:14 +08:00
::v-deep .el-loading-spinner .path {
stroke: #6b8cff;
}
2025-04-24 10:41:14 +08:00
::v-deep .el-loading-text {
color: #6b8cff !important;
font-size: 14px;
margin-top: 8px;
}
2025-03-26 17:10:06 +08:00
</style>