feat: 完成音色克隆页面样式改造

This commit is contained in:
zhuoqinglian
2026-06-24 11:43:36 +08:00
parent b6ed220e48
commit 7529c500a4
2 changed files with 452 additions and 832 deletions
@@ -1,6 +1,11 @@
<template> <template>
<el-dialog :title="$t('voiceClone.dialogTitle')" :visible.sync="visible" width="900px" top="10vh" <CustomDialog
:before-close="handleClose" class="voice-clone-dialog"> :title="$t('voiceClone.dialogTitle')"
:visible.sync="innerVisible"
width="900px"
:footer="false"
@close="handleDialogClose"
>
<div class="dialog-content"> <div class="dialog-content">
<!-- 步骤指示器 --> <!-- 步骤指示器 -->
<div class="steps-header"> <div class="steps-header">
@@ -73,22 +78,28 @@
</div> </div>
</div> </div>
</div> </div>
<div class="custom-footer">
<span slot="footer" class="dialog-footer"> <CustomButton @click="handleCancel">
<el-button @click="handleClose">{{ currentStep === 1 ? $t('voiceClone.cancel') : $t('voiceClone.prevStep') {{ currentStep === 1 ? $t('voiceClone.cancel') : $t('voiceClone.prevStep') }}
}}</el-button> </CustomButton>
<el-button type="primary" @click="handleNext" :loading="uploading"> <CustomButton type="confirm" :loading="uploading" @click="handleNext">
{{ currentStep === 1 ? $t('voiceClone.nextStep') : $t('voiceClone.upload') }} {{ currentStep === 1 ? $t('voiceClone.nextStep') : $t('voiceClone.upload') }}
</el-button> </CustomButton>
</span> </div>
</el-dialog> </CustomDialog>
</template> </template>
<script> <script>
import Api from "@/apis/api"; import Api from "@/apis/api";
import CustomDialog from './CustomDialog.vue';
import CustomButton from './CustomButton.vue';
export default { export default {
name: 'VoiceCloneDialog', name: 'VoiceCloneDialog',
components: {
CustomDialog,
CustomButton
},
props: { props: {
visible: { visible: {
type: Boolean, type: Boolean,
@@ -122,6 +133,14 @@ export default {
}; };
}, },
computed: { computed: {
innerVisible: {
get() {
return this.visible;
},
set(val) {
this.$emit('update:visible', val);
}
},
selectedDuration() { selectedDuration() {
if (this.selectionStart !== null && this.selectionEnd !== null && this.audioBuffer) { if (this.selectionStart !== null && this.selectionEnd !== null && this.audioBuffer) {
const duration = this.audioBuffer.duration; const duration = this.audioBuffer.duration;
@@ -146,14 +165,16 @@ export default {
} }
}, },
methods: { methods: {
handleClose() { handleCancel() {
if (this.currentStep === 2) { if (this.currentStep === 2) {
this.currentStep = 1; this.currentStep = 1;
} else { } else {
this.resetDialog();
this.$emit('update:visible', false); this.$emit('update:visible', false);
} }
}, },
handleDialogClose() {
this.resetDialog();
},
resetDialog() { resetDialog() {
this.currentStep = 1; this.currentStep = 1;
this.audioFile = null; this.audioFile = null;
@@ -509,13 +530,6 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.voice-clone-dialog {
::v-deep .el-dialog__body {
padding: 20px 30px;
}
}
.steps-header { .steps-header {
display: flex; display: flex;
justify-content: center; justify-content: center;
@@ -578,7 +592,6 @@ export default {
background: #e4e7ed; background: #e4e7ed;
margin-left: 12px; margin-left: 12px;
} }
.step-content { .step-content {
padding: 20px 0; padding: 20px 0;
} }
@@ -685,10 +698,7 @@ export default {
gap: 12px; gap: 12px;
margin-top: 20px; margin-top: 20px;
} }
.custom-footer {
.dialog-footer { text-align: right;
display: flex;
justify-content: flex-end;
gap: 10px;
} }
</style> </style>
@@ -1,61 +1,54 @@
<template> <template>
<div class="welcome"> <div class="welcome">
<HeaderBar /> <HeaderBar />
<div class="operation-bar"> <div class="main-wrapper">
<div class="content-panel">
<div class="content-area">
<el-card class="params-card" shadow="never">
<div class="operation-header">
<h2 class="page-title">{{ $t('voiceClone.title') }}</h2> <h2 class="page-title">{{ $t('voiceClone.title') }}</h2>
<div class="right-operations"> <div class="right-operations">
<el-input :placeholder="$t('voiceClone.searchPlaceholder')" v-model="searchName" class="search-input" <el-input :placeholder="$t('voiceClone.searchPlaceholder')" v-model="searchName" class="search-input"
@keyup.enter.native="handleSearch" clearable /> @keyup.enter.native="handleSearch" clearable />
<el-button class="btn-search" @click="handleSearch">{{ $t('voiceClone.search') }}</el-button> <CustomButton type="confirm" icon="el-icon-search" @click="handleSearch">{{ $t('voiceClone.search') }}</CustomButton>
</div> </div>
</div> </div>
<CustomTable
<div class="main-wrapper"> ref="voiceCloneTable"
<div class="content-panel"> :data="voiceCloneList"
<div class="content-area"> :columns="tableColumns"
<!-- 显示表格或空状态 --> :loading="loading"
<el-card class="params-card" shadow="never" v-if="total > 0"> :total="total"
<el-table ref="paramsTable" :data="voiceCloneList" class="transparent-table" v-loading="loading" :current-page="currentPage"
element-loading-text="Loading" element-loading-spinner="el-icon-loading" :page-size="pageSize"
element-loading-background="rgba(255, 255, 255, 0.7)"> :page-size-options="pageSizeOptions"
<el-table-column :label="$t('voiceClone.voiceId')" prop="voiceId" @size-change="handlePageSizeChange"
align="center"></el-table-column> @page-change="goToPage"
<el-table-column :label="$t('voiceClone.name')" align="center"> >
<template #default="{ row }"> <template slot="name" slot-scope="scope">
<el-input v-show="row.isEdit" v-model="row.name" size="mini" maxlength="64" <el-input v-show="scope.row.isEdit" v-model="scope.row.name" size="mini" maxlength="64"
show-word-limit @blur="onNameBlur(row)" @keyup.enter.native="onNameEnter(row)" show-word-limit @blur="onNameBlur(scope.row)" @keyup.enter.native="onNameEnter(scope.row)"
ref="nameInput" /> ref="nameInput" />
<span v-show="!row.isEdit" class="name-view"> <span v-show="!scope.row.isEdit" class="name-view">
<i class="el-icon-edit" @click="handleEditName(row)" <i class="el-icon-edit" @click="handleEditName(scope.row)" style="cursor: pointer;"></i>
style="cursor: pointer;"></i> <span @click="handleEditName(scope.row)">
<span @click="handleEditName(row)"> {{ scope.row.name || '-' }}
{{ row.name || '-' }}
</span> </span>
</span> </span>
</template> </template>
</el-table-column> <template slot="trainStatus" slot-scope="scope">
<el-table-column :label="$t('voiceClone.languages')" prop="languages"
align="center"></el-table-column>
<el-table-column :label="$t('voiceClone.trainStatus')" prop="trainStatus" align="center">
<template slot-scope="scope">
<div class="status-button" :class="getStatusButtonClass(scope.row)"> <div class="status-button" :class="getStatusButtonClass(scope.row)">
<span>{{ getTrainStatusText(scope.row) }}</span> <span>{{ getTrainStatusText(scope.row) }}</span>
</div> </div>
</template> </template>
</el-table-column> <template slot="Details" slot-scope="scope">
<el-table-column :label="$t('voiceClone.Details')" align="center" width="120">
<template slot-scope="scope">
<el-tooltip :content="getTooltipContent(scope.row)" placement="top"> <el-tooltip :content="getTooltipContent(scope.row)" placement="top">
<el-button size="mini" type="text" icon="el-icon-info" <el-button size="mini" type="text" icon="el-icon-info"
@click="handleViewDetails(scope.row)"> @click="handleViewDetails(scope.row)">
</el-button> </el-button>
</el-tooltip> </el-tooltip>
</template> </template>
</el-table-column> <template slot="action" slot-scope="scope">
<el-table-column :label="$t('voiceClone.action')" align="center" width="230">
<template slot-scope="scope">
<el-button v-if="scope.row.hasVoice" size="mini" type="text" <el-button v-if="scope.row.hasVoice" size="mini" type="text"
@click="handlePlay(scope.row)"> @click="handlePlay(scope.row)">
{{ playingRowId === scope.row.id ? $t('voiceClone.stop') : $t('voiceClone.play') }} {{ playingRowId === scope.row.id ? $t('voiceClone.stop') : $t('voiceClone.play') }}
@@ -68,58 +61,20 @@
{{ $t('voiceClone.clone') }} {{ $t('voiceClone.clone') }}
</el-button> </el-button>
</template> </template>
</el-table-column> <!-- 占位作用保持分页在右边展示 -->
</el-table> <template slot="footer-btns">
<div></div>
<div class="table_bottom"> </template>
<div class="ctrl_btn"> </CustomTable>
</div>
<div class="custom-pagination">
<el-select v-model="pageSize" @change="handlePageSizeChange" class="page-size-select">
<el-option v-for="item in pageSizeOptions" :key="item"
:label="$t('voiceClone.itemsPerPage', { items: item })" :value="item">
</el-option>
</el-select>
<button class="pagination-btn" :disabled="currentPage === 1" @click="goFirst">
{{ $t('voiceClone.firstPage') }}
</button>
<button class="pagination-btn" :disabled="currentPage === 1" @click="goPrev">
{{ $t('voiceClone.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('voiceClone.nextPage') }}
</button>
<span class="total-text">{{ $t('voiceClone.totalRecords', { total }) }}</span>
</div>
</div>
</el-card> </el-card>
</div>
</div>
</div>
<!-- 空状态提示 -->
<div v-else-if="!loading" class="empty-state-wrapper">
<div class="empty-state">
<div class="empty-icon">
<i class="el-icon-microphone" style="font-size: 48px;"></i>
</div>
<div class="empty-text">
{{ $t('voiceClone.noVoiceCloneAssigned') }}
</div>
<div class="empty-desc">
{{ $t('voiceClone.contactAdmin') }}
</div>
</div>
</div>
</div>
</div>
</div>
<el-footer> <el-footer>
<version-footer /> <version-footer />
</el-footer> </el-footer>
<!-- 复刻弹框 -->
<VoiceCloneDialog :visible.sync="cloneDialogVisible" :voiceCloneData="currentVoiceClone" <VoiceCloneDialog :visible.sync="cloneDialogVisible" :voiceCloneData="currentVoiceClone"
@success="handleCloneSuccess" /> @success="handleCloneSuccess" />
</div> </div>
@@ -130,10 +85,12 @@ import Api from "@/apis/api";
import HeaderBar from "@/components/HeaderBar.vue"; import HeaderBar from "@/components/HeaderBar.vue";
import VersionFooter from "@/components/VersionFooter.vue"; import VersionFooter from "@/components/VersionFooter.vue";
import VoiceCloneDialog from "@/components/VoiceCloneDialog.vue"; import VoiceCloneDialog from "@/components/VoiceCloneDialog.vue";
import CustomButton from "@/components/CustomButton.vue";
import CustomTable from "@/components/CustomTable.vue";
import { formatDate } from "@/utils/format"; import { formatDate } from "@/utils/format";
export default { export default {
components: { HeaderBar, VersionFooter, VoiceCloneDialog }, components: { HeaderBar, VersionFooter, VoiceCloneDialog, CustomButton, CustomTable },
data() { data() {
return { return {
searchName: "", searchName: "",
@@ -143,45 +100,33 @@ export default {
pageSize: 10, pageSize: 10,
pageSizeOptions: [10, 20, 50, 100], pageSizeOptions: [10, 20, 50, 100],
total: 0, total: 0,
dialogVisible: false,
cloneDialogVisible: false, cloneDialogVisible: false,
currentVoiceClone: {}, currentVoiceClone: {},
isAllSelected: false,
voiceCloneForm: { voiceCloneForm: {
modelId: "", modelId: "",
voiceIds: [], voiceIds: [],
userId: null userId: null
}, },
// 音频播放相关 currentAudio: null,
currentAudio: null, // 当前正在播放的音频对象 playingRowId: null,
playingRowId: null // 当前正在播放的行 ID tableColumns: []
}; };
}, },
created() { created() {
this.initTableColumns();
this.fetchVoiceCloneList(); this.fetchVoiceCloneList();
}, },
computed: {
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;
},
},
methods: { methods: {
initTableColumns() {
this.tableColumns = [
{ prop: 'voiceId', label: this.$t('voiceClone.voiceId'), align: 'center' },
{ prop: 'name', label: this.$t('voiceClone.name'), align: 'center' },
{ prop: 'languages', label: this.$t('voiceClone.languages'), align: 'center' },
{ prop: 'trainStatus', label: this.$t('voiceClone.trainStatus'), align: 'center' },
{ prop: 'Details', label: this.$t('voiceClone.Details'), align: 'center', width: 120 },
{ prop: 'action', label: this.$t('voiceClone.action'), align: 'center', width: 230 }
];
},
getTooltipContent(row) { getTooltipContent(row) {
if (!row.hasVoice) { if (!row.hasVoice) {
return '待上传'; return '待上传';
@@ -192,7 +137,6 @@ export default {
case 2: case 2:
return '训练成功'; return '训练成功';
case 3: case 3:
// 训练失败时,根据错误信息智能展示
if (row.trainError) { if (row.trainError) {
return `训练失败:${row.trainError}`; return `训练失败:${row.trainError}`;
} }
@@ -203,13 +147,18 @@ export default {
}, },
handleViewDetails(row) { handleViewDetails(row) {
console.log('查看详情:', row); console.log('查看详情:', row);
// 可以在这里添加查看详情的逻辑
}, },
handlePageSizeChange(val) { handlePageSizeChange(val) {
this.pageSize = val; this.pageSize = val;
this.currentPage = 1; this.currentPage = 1;
this.fetchVoiceCloneList(); this.fetchVoiceCloneList();
}, },
goToPage(page) {
if (page !== this.currentPage) {
this.currentPage = page;
this.fetchVoiceCloneList();
}
},
fetchVoiceCloneList() { fetchVoiceCloneList() {
this.loading = true; this.loading = true;
const params = { const params = {
@@ -221,7 +170,7 @@ export default {
}; };
Api.voiceClone.getVoiceCloneList(params, (res) => { Api.voiceClone.getVoiceCloneList(params, (res) => {
this.loading = false; this.loading = false;
res = res.data res = res.data;
if (res.code === 0) { if (res.code === 0) {
this.voiceCloneList = res.data.list; this.voiceCloneList = res.data.list;
this.total = res.data.total || 0; this.total = res.data.total || 0;
@@ -239,26 +188,6 @@ export default {
this.currentPage = 1; this.currentPage = 1;
this.fetchVoiceCloneList(); this.fetchVoiceCloneList();
}, },
goFirst() {
this.currentPage = 1;
this.fetchVoiceCloneList();
},
goPrev() {
if (this.currentPage > 1) {
this.currentPage--;
this.fetchVoiceCloneList();
}
},
goNext() {
if (this.currentPage < this.pageCount) {
this.currentPage++;
this.fetchVoiceCloneList();
}
},
goToPage(page) {
this.currentPage = page;
this.fetchVoiceCloneList();
},
formatDate, formatDate,
getTrainStatusText(row) { getTrainStatusText(row) {
if (!row.hasVoice) { if (!row.hasVoice) {
@@ -275,7 +204,6 @@ export default {
return ''; return '';
} }
}, },
// 获取状态按钮样式
getStatusButtonClass(row) { getStatusButtonClass(row) {
if (!row.hasVoice || row.trainStatus === 0) { if (!row.hasVoice || row.trainStatus === 0) {
return 'status-waiting'; return 'status-waiting';
@@ -286,34 +214,24 @@ export default {
} }
return ''; return '';
}, },
// 处理复刻操作
handleClone(row) { handleClone(row) {
// 防止重复提交
if (row._cloning) { if (row._cloning) {
return; return;
} }
this.$set(row, '_cloning', true); this.$set(row, '_cloning', true);
const params = { cloneId: row.id };
const params = {
cloneId: row.id
};
try { try {
Api.voiceClone.cloneAudio(params, (res) => { Api.voiceClone.cloneAudio(params, (res) => {
try { try {
res = res.data; res = res.data;
if (res.code === 0) { if (res.code === 0) {
this.$message.success(this.$t('message.success')); this.$message.success(this.$t('message.success'));
// 复刻成功后刷新列表
this.fetchVoiceCloneList(); this.fetchVoiceCloneList();
} else { } else {
// 复刻失败时刷新列表以获取完整的错误信息
console.log('API返回错误,刷新列表获取详细错误信息');
this.$message.error(res.msg || this.$t('message.error')); this.$message.error(res.msg || this.$t('message.error'));
// 刷新列表以获取后端保存的完整错误详情
this.fetchVoiceCloneList(); this.fetchVoiceCloneList();
} }
} catch (error) { } catch (error) {
// 处理响应时出错,刷新列表
console.error('处理响应时出错:', error); console.error('处理响应时出错:', error);
this.$message.error('处理响应时出错'); this.$message.error('处理响应时出错');
this.fetchVoiceCloneList(); this.fetchVoiceCloneList();
@@ -321,67 +239,26 @@ export default {
this.$set(row, '_cloning', false); this.$set(row, '_cloning', false);
} }
}, (error) => { }, (error) => {
// API调用失败,刷新列表以获取最新状态
console.error('API调用失败:', error); console.error('API调用失败:', error);
this.$message.error('克隆失败,请将鼠标悬停在错误提示上,查看错误详情'); this.$message.error('克隆失败,请将鼠标悬停在错误提示上,查看错误详情');
this.fetchVoiceCloneList(); this.fetchVoiceCloneList();
this.$set(row, '_cloning', false); this.$set(row, '_cloning', false);
}); });
} catch (error) { } catch (error) {
// 调用API时出错,刷新列表
console.error('调用API时出错:', error); console.error('调用API时出错:', error);
this.$message.error('调用API时出错'); this.$message.error('调用API时出错');
this.fetchVoiceCloneList(); this.fetchVoiceCloneList();
this.$set(row, '_cloning', false); this.$set(row, '_cloning', false);
} }
}, },
// 更新行状态并触发视图更新
updateRowStatus(row, status, statusCode = null) {
// 在Vue中直接修改数组中的对象属性可能不会触发视图更新
const index = this.voiceCloneList.findIndex(item => item.id === row.id);
const updateData = {
trainStatus: status
};
// 如果提供了状态码,也更新状态码信息
if (statusCode !== null) {
updateData.statusCode = statusCode;
}
if (index !== -1) {
// 使用Vue.set来确保响应式更新
this.$set(this.voiceCloneList, index, {
...this.voiceCloneList[index],
...updateData
});
// 强制表格重新渲染
if (this.$refs.paramsTable) {
this.$refs.paramsTable.doLayout();
}
} else {
// 如果找不到索引,直接更新row对象
row.trainStatus = status;
if (statusCode !== null) {
row.statusCode = statusCode;
}
// 强制整个表格重新渲染
this.$forceUpdate();
}
console.log('更新行状态:', row.id, '状态:', status, '状态码:', statusCode);
},
// 复刻成功后的回调
handleCloneSuccess() { handleCloneSuccess() {
this.fetchVoiceCloneList(); this.fetchVoiceCloneList();
}, },
// 进入编辑模式
handleEditName(row) { handleEditName(row) {
this.$set(row, 'isEdit', true); this.$set(row, 'isEdit', true);
this.$nextTick(() => { this.$nextTick(() => {
// 聚焦到输入框
const input = this.$refs.nameInput; const input = this.$refs.nameInput;
if (input) { if (input) {
// nameInput 可能是一个数组
if (Array.isArray(input)) { if (Array.isArray(input)) {
const idx = this.voiceCloneList.indexOf(row); const idx = this.voiceCloneList.indexOf(row);
if (input[idx]) { if (input[idx]) {
@@ -393,79 +270,55 @@ export default {
} }
}); });
}, },
// 提交名称修改
submitName(row) { submitName(row) {
// 防止重复提交
if (row._submitting) { if (row._submitting) {
return; return;
} }
row._submitting = true; row._submitting = true;
const params = { id: row.id, name: row.name };
const params = {
id: row.id,
name: row.name
};
Api.voiceClone.updateName(params, (res) => { Api.voiceClone.updateName(params, (res) => {
res = res.data; res = res.data;
if (res.code === 0) { if (res.code === 0) {
this.$message.success(this.$t('voiceClone.updateNameSuccess') || '名称更新成功'); this.$message.success(this.$t('voiceClone.updateNameSuccess') || '名称更新成功');
} else { } else {
this.$message.error(res.msg || this.$t('voiceClone.updateNameFailed') || '名称更新失败'); this.$message.error(res.msg || this.$t('voiceClone.updateNameFailed') || '名称更新失败');
// 失败时恢复原值
this.fetchVoiceCloneList(); this.fetchVoiceCloneList();
} }
row._submitting = false; row._submitting = false;
}); });
}, },
// 名称输入框:失焦时提交
onNameBlur(row) { onNameBlur(row) {
row.isEdit = false; row.isEdit = false;
setTimeout(() => { setTimeout(() => {
this.submitName(row); this.submitName(row);
}, 100); // 延迟 100ms,避开 enter+blur 同时触发的窗口 }, 100);
}, },
// 名称输入框:按回车时提交
onNameEnter(row) { onNameEnter(row) {
row.isEdit = false; row.isEdit = false;
this.submitName(row); this.submitName(row);
}, },
// 播放音频
handlePlay(row) { handlePlay(row) {
// 如果点击的是正在播放的行,则停止播放
if (this.playingRowId === row.id && this.currentAudio) { if (this.playingRowId === row.id && this.currentAudio) {
this.stopCurrentAudio(); this.stopCurrentAudio();
return; return;
} }
// 停止当前正在播放的音频(如果有)
this.stopCurrentAudio(); this.stopCurrentAudio();
// 先获取音频下载ID
Api.voiceClone.getAudioId(row.id, (res) => { Api.voiceClone.getAudioId(row.id, (res) => {
res = res.data; res = res.data;
if (res.code === 0) { if (res.code === 0) {
const uuid = res.data; const uuid = res.data;
// 使用获取到的uuid播放音频
const audioUrl = Api.voiceClone.getPlayVoiceUrl(uuid); const audioUrl = Api.voiceClone.getPlayVoiceUrl(uuid);
const audio = new Audio(audioUrl); const audio = new Audio(audioUrl);
// 设置当前播放状态
this.currentAudio = audio; this.currentAudio = audio;
this.playingRowId = row.id; this.playingRowId = row.id;
// 播放结束时清除状态
audio.addEventListener('ended', () => { audio.addEventListener('ended', () => {
this.playingRowId = null; this.playingRowId = null;
this.currentAudio = null; this.currentAudio = null;
}); });
// 播放出错时清除状态
audio.addEventListener('error', () => { audio.addEventListener('error', () => {
this.playingRowId = null; this.playingRowId = null;
this.currentAudio = null; this.currentAudio = null;
}); });
audio.play().catch(err => { audio.play().catch(err => {
console.error('播放失败:', err); console.error('播放失败:', err);
this.$message.error(this.$t('voiceClone.playFailed') || '播放失败'); this.$message.error(this.$t('voiceClone.playFailed') || '播放失败');
@@ -477,7 +330,6 @@ export default {
} }
}); });
}, },
// 停止当前音频播放
stopCurrentAudio() { stopCurrentAudio() {
if (this.currentAudio) { if (this.currentAudio) {
this.currentAudio.pause(); this.currentAudio.pause();
@@ -486,12 +338,11 @@ export default {
} }
this.playingRowId = null; this.playingRowId = null;
}, },
// 上传音频
handleUpload(row) { handleUpload(row) {
this.currentVoiceClone = row; this.currentVoiceClone = row;
this.cloneDialogVisible = true; this.cloneDialogVisible = true;
} }
}, }
}; };
</script> </script>
@@ -511,25 +362,23 @@ export default {
} }
.main-wrapper { .main-wrapper {
// 顶部 63px 底部 35px 查询72px height: calc(100vh - 63px - 35px);
height: calc(100vh - 63px - 35px - 72px); padding: 20px 22px 0;
margin: 0 22px;
border-radius: 15px;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
position: relative; position: relative;
background: rgba(237, 242, 255, 0.5);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
box-sizing: border-box;
} }
.operation-bar { .operation-header {
display: flex; display: flex;
justify-content: space-between;
align-items: center; align-items: center;
padding: 16px 24px; justify-content: space-between;
padding: 0 0 16px 0;
} }
.page-title { .page-title {
font-weight: 500;
font-size: 24px; font-size: 24px;
margin: 0; margin: 0;
} }
@@ -544,14 +393,7 @@ export default {
width: 240px; width: 240px;
} }
.btn-search {
background: linear-gradient(135deg, #6b8cff, #a966ff);
border: none;
color: white;
}
.content-panel { .content-panel {
flex: 1;
display: flex; display: flex;
overflow: hidden; overflow: hidden;
height: 100%; height: 100%;
@@ -580,7 +422,7 @@ export default {
overflow: hidden; overflow: hidden;
::v-deep .el-card__body { ::v-deep .el-card__body {
padding: 15px; padding: 14px 20px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
flex: 1; flex: 1;
@@ -588,193 +430,28 @@ export default {
} }
} }
.table_bottom { .name-view {
display: flex; display: inline-flex;
justify-content: space-between;
align-items: center; align-items: center;
margin-top: 10px; gap: 6px;
}
.ctrl_btn {
display: flex;
gap: 8px;
padding-left: 26px;
}
.custom-pagination {
display: flex;
align-items: center;
gap: 5px;
.el-select {
margin-right: 8px;
}
.pagination-btn:first-child,
.pagination-btn:nth-child(2),
.pagination-btn:nth-last-child(2),
.pagination-btn:nth-child(3) {
min-width: 60px;
height: 32px;
padding: 0 12px;
border-radius: 4px;
border: 1px solid #e4e7ed;
background: #dee7ff;
color: #606266;
font-size: 14px;
cursor: pointer; cursor: pointer;
transition: all 0.3s ease;
i {
color: #909399;
font-size: 14px;
&:hover { &:hover {
background: #d7dce6; color: #5a64b5;
}
&:disabled {
opacity: 0.6;
cursor: not-allowed;
} }
} }
.pagination-btn:not(:first-child):not(:nth-child(3)):not(:nth-child(2)):not(:nth-last-child(2)) { span {
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 { &:hover {
background: rgba(245, 247, 250, 0.3); color: #5a64b5;
}
}
.pagination-btn.active {
background: #5f70f3 !important;
color: #ffffff !important;
border-color: #5f70f3 !important;
&:hover {
background: #6d7cf5 !important;
} }
} }
} }
.empty-state-wrapper {
margin-top: 20vh;
}
.total-text {
margin-left: 10px;
color: #606266;
font-size: 14px;
}
.page-size-select {
width: 100px;
margin-right: 10px;
:deep(.el-input__inner) {
height: 32px;
line-height: 32px;
border-radius: 4px;
border: 1px solid #e4e7ed;
background: #dee7ff;
color: #606266;
font-size: 14px;
}
:deep(.el-input__suffix) {
right: 6px;
width: 15px;
height: 20px;
display: flex;
justify-content: center;
align-items: center;
top: 6px;
border-radius: 4px;
}
:deep(.el-input__suffix-inner) {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
}
:deep(.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;
}
}
:deep(.transparent-table) {
background: white;
flex: 1;
width: 100%;
display: flex;
flex-direction: column;
.el-table__body-wrapper {
flex: 1;
overflow-y: auto;
max-height: none !important;
}
.el-table__header-wrapper {
flex-shrink: 0;
}
.el-table__header th {
background: white !important;
color: black;
font-weight: 600;
height: 40px;
padding: 8px 0;
font-size: 14px;
border-bottom: 1px solid #e4e7ed;
}
.el-table__body tr {
background-color: white;
td {
border-top: 1px solid rgba(0, 0, 0, 0.04);
border-bottom: 1px solid rgba(0, 0, 0, 0.04);
padding: 8px 0;
height: 40px;
color: #606266;
font-size: 14px;
}
}
.el-table__row:hover>td {
background-color: #f5f7fa !important;
}
&::before {
display: none;
}
}
:deep(.el-table .el-button--text) {
color: #7079aa !important;
}
:deep(.el-table .el-button--text:hover) {
color: #5a64b5 !important;
}
/* 状态按钮样式 */
.status-button { .status-button {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
@@ -803,78 +480,11 @@ export default {
border: 1px solid #ffccc7; border: 1px solid #ffccc7;
} }
.name-view { :deep(.el-table .el-button--text) {
display: inline-flex; color: #7079aa;
align-items: center; }
gap: 6px;
cursor: pointer;
i { :deep(.el-table .el-button--text:hover) {
color: #909399;
font-size: 14px;
&:hover {
color: #5a64b5; color: #5a64b5;
} }
}
span {
&:hover {
color: #5a64b5;
}
}
}
:deep(.el-checkbox__inner) {
background-color: #ffffff !important;
border-color: #cccccc !important;
}
:deep(.el-checkbox__inner:hover) {
border-color: #cccccc !important;
}
:deep(.el-checkbox__input.is-checked .el-checkbox__inner) {
background-color: #5f70f3 !important;
border-color: #5f70f3 !important;
}
:deep(.el-loading-mask) {
background-color: rgba(255, 255, 255, 0.6) !important;
backdrop-filter: blur(2px);
}
:deep(.el-loading-spinner .path) {
stroke: #6b8cff;
}
.el-table {
--table-max-height: calc(100vh - 40vh);
// max-height: var(--table-max-height);
.el-table__body-wrapper {
max-height: calc(var(--table-max-height) - 40px);
}
}
@media (min-width: 1144px) {
.table_bottom {
display: flex;
justify-content: space-between;
align-items: center;
}
:deep(.transparent-table) {
.el-table__body tr {
td {
padding-top: 16px;
padding-bottom: 16px;
}
&+tr {
margin-top: 10px;
}
}
}
}
</style> </style>