Merge pull request #3226 from xinnan-tech/update-theme

页面样式改造
This commit is contained in:
wengzh
2026-06-18 16:39:41 +08:00
committed by GitHub
15 changed files with 1099 additions and 2071 deletions
@@ -31,6 +31,7 @@ export default {
transition: all 0.3s ease; transition: all 0.3s ease;
&.el-button--small { &.el-button--small {
padding: 10px;
font-size: 14px; font-size: 14px;
} }
&.el-button--medium { &.el-button--medium {
@@ -91,7 +92,7 @@ export default {
.custom-button--delete { .custom-button--delete {
width: fit-content; width: fit-content;
background: linear-gradient(to right, #ff6b6b, #ff8e8e); background: #ff6b6b;
color: white; color: white;
border: none; border: none;
border-radius: 6px; border-radius: 6px;
@@ -1,6 +1,6 @@
<template> <template>
<div class="custom-table-wrapper"> <div class="custom-table-wrapper">
<div class="table-container"> <div class="table-container" :style="{ height: tableContainerHeight }">
<el-table <el-table
ref="tableRef" ref="tableRef"
:data="data" :data="data"
@@ -79,10 +79,9 @@
</div> </div>
<!-- 分页 --> <!-- 分页 -->
<div class="table-footer"> <div class="table-footer" v-if="showPagination">
<slot name="footer-btns"></slot> <slot name="footer-btns"></slot>
<CustomPagination <CustomPagination
v-if="showPagination"
:total="total" :total="total"
:current-page="currentPage" :current-page="currentPage"
:page-size="pageSize" :page-size="pageSize"
@@ -182,26 +181,13 @@ export default {
type: [String, Function], type: [String, Function],
default: '' default: ''
}, },
// 敏感值相关
hideText: {
type: String,
default: '隐藏'
}, },
viewText: { computed: {
type: String, tableContainerHeight() {
default: '查看' return this.showPagination ? 'calc(100% - 48px)' : '100%';
} }
}, },
methods: { methods: {
// 掩码处理
maskValue(value) {
if (!value) return '';
return '*'.repeat(Math.min(value.length, 8));
},
// 切换显示/隐藏
toggleValue(row, prop) {
this.$set(row, 'showValue', !row.showValue);
},
// 复选框变化 // 复选框变化
handleCheckboxChange(row) { handleCheckboxChange(row) {
this.$set(row, 'selected', !row.selected); this.$set(row, 'selected', !row.selected);
@@ -221,10 +207,6 @@ export default {
handleRowClick(row, column, event) { handleRowClick(row, column, event) {
this.$emit('row-click', row, column, event); this.$emit('row-click', row, column, event);
}, },
// 获取表格实例
getTable() {
return this.$refs.tableRef;
},
// 清除选择 // 清除选择
clearSelection() { clearSelection() {
this.$refs.tableRef && this.$refs.tableRef.clearSelection(); this.$refs.tableRef && this.$refs.tableRef.clearSelection();
@@ -244,7 +226,6 @@ export default {
flex-direction: column; flex-direction: column;
min-height: 0; min-height: 0;
.table-container { .table-container {
height: calc(100% - 48px);
width: 100%; width: 100%;
box-shadow: 0 2px 12px rgba(74, 124, 253, 0.12); box-shadow: 0 2px 12px rgba(74, 124, 253, 0.12);
border-radius: 6px; border-radius: 6px;
@@ -1,24 +1,28 @@
<template> <template>
<el-dialog :title="title" :visible.sync="dialogVisible" width="30%" @close="handleClose"> <CustomDialog
<el-form :model="form" :rules="rules" ref="form" label-width="auto"> :title="title"
<el-form-item :label="$t('dictDataDialog.dictLabel')" prop="dictLabel"> :visible.sync="dialogVisible"
<el-input v-model="form.dictLabel" :placeholder="$t('dictDataDialog.dictLabelPlaceholder')"></el-input> width="600px"
@confirm="submit"
@close="cancel"
:confirmLoading="saving"
>
<el-form :model="form" :rules="rules" ref="form" label-width="auto" label-position="left">
<el-form-item :label="$t('dictDataDialog.dictLabel')" prop="dictLabel" class="form-item">
<el-input v-model="form.dictLabel" :placeholder="$t('dictDataDialog.dictLabelPlaceholder')" />
</el-form-item> </el-form-item>
<el-form-item :label="$t('dictDataDialog.dictValue')" prop="dictValue"> <el-form-item :label="$t('dictDataDialog.dictValue')" prop="dictValue" class="form-item">
<el-input v-model="form.dictValue" :placeholder="$t('dictDataDialog.dictValuePlaceholder')"></el-input> <el-input v-model="form.dictValue" :placeholder="$t('dictDataDialog.dictValuePlaceholder')" />
</el-form-item> </el-form-item>
<el-form-item :label="$t('dictDataDialog.sort')" prop="sort"> <el-form-item :label="$t('dictDataDialog.sort')" prop="sort" class="form-item">
<el-input-number v-model="form.sort" :min="0" :max="999" style="width: 100%;"></el-input-number> <el-input-number v-model="form.sort" :min="0" :max="999" class="custom-input-number"></el-input-number>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> </CustomDialog>
<el-button @click="handleClose">{{ $t('button.cancel') }}</el-button>
<el-button type="primary" @click="handleSave">{{ $t('button.save') }}</el-button>
</div>
</el-dialog>
</template> </template>
<script> <script>
import CustomDialog from './CustomDialog.vue';
export default { export default {
name: 'DictDataDialog', name: 'DictDataDialog',
props: { props: {
@@ -39,9 +43,13 @@ export default {
default: null default: null
} }
}, },
components: {
CustomDialog
},
data() { data() {
return { return {
dialogVisible: this.visible, dialogVisible: this.visible,
saving: false,
form: { form: {
id: null, id: null,
dictTypeId: null, dictTypeId: null,
@@ -53,13 +61,22 @@ export default {
dictLabel: [{ required: true, message: this.$t('dictDataDialog.requiredDictLabel'), trigger: 'blur' }], dictLabel: [{ required: true, message: this.$t('dictDataDialog.requiredDictLabel'), trigger: 'blur' }],
dictValue: [{ required: true, message: this.$t('dictDataDialog.requiredDictValue'), trigger: 'blur' }] dictValue: [{ required: true, message: this.$t('dictDataDialog.requiredDictValue'), trigger: 'blur' }]
} }
} };
}, },
watch: { watch: {
visible(val) {
this.dialogVisible = val;
},
dialogVisible(val) {
this.$emit('update:visible', val);
if (!val) {
this.saving = false;
}
},
dictData: { dictData: {
handler(val) { handler(val) {
if (val) { if (val) {
this.form = { ...val } this.form = { ...val };
} }
}, },
immediate: true immediate: true
@@ -67,50 +84,34 @@ export default {
dictTypeId: { dictTypeId: {
handler(val) { handler(val) {
if (val) { if (val) {
this.form.dictTypeId = val this.form.dictTypeId = val;
} }
}, },
immediate: true immediate: true
},
visible(val) {
this.dialogVisible = val;
},
dialogVisible(val) {
this.$emit('update:visible', val);
} }
}, },
methods: { methods: {
handleClose() { submit() {
this.dialogVisible = false; this.$refs.form.validate((valid) => {
this.resetForm();
},
resetForm() {
this.form = {
id: null,
dictTypeId: this.dictTypeId,
dictLabel: '',
dictValue: '',
sort: 0
}
this.$refs.form?.resetFields()
},
handleSave() {
this.$refs.form.validate(valid => {
if (valid) { if (valid) {
this.$emit('save', this.form) this.saving = true;
} this.$emit('save', this.form);
})
} }
});
},
cancel() {
this.saving = false;
this.$emit('cancel');
},
resetSaving() {
this.saving = false;
} }
} }
};
</script> </script>
<style scoped> <style scoped lang="scss">
.dialog-footer { .custom-input-number {
text-align: right; width: 100%;
} }
:deep(.el-dialog) {
border-radius: 15px;
}
</style> </style>
@@ -1,21 +1,25 @@
<template> <template>
<el-dialog :title="title" :visible.sync="dialogVisible" width="30%" @close="handleClose"> <CustomDialog
<el-form :model="form" :rules="rules" ref="form" label-width="auto"> :title="title"
<el-form-item :label="$t('dictTypeDialog.dictName')" prop="dictName"> :visible.sync="dialogVisible"
<el-input v-model="form.dictName" :placeholder="$t('dictTypeDialog.dictNamePlaceholder')"></el-input> width="600px"
@confirm="submit"
@close="cancel"
:confirmLoading="saving"
>
<el-form :model="form" :rules="rules" ref="form" label-width="auto" label-position="left">
<el-form-item :label="$t('dictTypeDialog.dictName')" prop="dictName" class="form-item">
<el-input v-model="form.dictName" :placeholder="$t('dictTypeDialog.dictNamePlaceholder')" />
</el-form-item> </el-form-item>
<el-form-item :label="$t('dictTypeDialog.dictType')" prop="dictType"> <el-form-item :label="$t('dictTypeDialog.dictType')" prop="dictType" class="form-item">
<el-input v-model="form.dictType" :placeholder="$t('dictTypeDialog.dictTypePlaceholder')"></el-input> <el-input v-model="form.dictType" :placeholder="$t('dictTypeDialog.dictTypePlaceholder')" />
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> </CustomDialog>
<el-button @click="handleClose">{{ $t('button.cancel') }}</el-button>
<el-button type="primary" @click="handleSave">{{ $t('button.save') }}</el-button>
</div>
</el-dialog>
</template> </template>
<script> <script>
import CustomDialog from './CustomDialog.vue';
export default { export default {
name: 'DictTypeDialog', name: 'DictTypeDialog',
props: { props: {
@@ -32,9 +36,13 @@ export default {
default: () => ({}) default: () => ({})
} }
}, },
components: {
CustomDialog
},
data() { data() {
return { return {
dialogVisible: this.visible, dialogVisible: this.visible,
saving: false,
form: { form: {
id: null, id: null,
dictName: '', dictName: '',
@@ -44,7 +52,7 @@ export default {
dictName: [{ required: true, message: this.$t('dictTypeDialog.requiredDictName'), trigger: 'blur' }], dictName: [{ required: true, message: this.$t('dictTypeDialog.requiredDictName'), trigger: 'blur' }],
dictType: [{ required: true, message: this.$t('dictTypeDialog.requiredDictType'), trigger: 'blur' }] dictType: [{ required: true, message: this.$t('dictTypeDialog.requiredDictType'), trigger: 'blur' }]
} }
} };
}, },
watch: { watch: {
visible(val) { visible(val) {
@@ -52,46 +60,35 @@ export default {
}, },
dialogVisible(val) { dialogVisible(val) {
this.$emit('update:visible', val); this.$emit('update:visible', val);
if (!val) {
this.saving = false;
}
}, },
dictTypeData: { dictTypeData: {
handler(val) { handler(val) {
if (val) { if (val) {
this.form = { ...val } this.form = { ...val };
} }
}, },
immediate: true immediate: true
} }
}, },
methods: { methods: {
handleClose() { submit() {
this.dialogVisible = false; this.$refs.form.validate((valid) => {
this.resetForm()
},
resetForm() {
this.form = {
id: null,
dictName: '',
dictType: ''
}
this.$refs.form?.resetFields()
},
handleSave() {
this.$refs.form.validate(valid => {
if (valid) { if (valid) {
this.$emit('save', this.form) this.saving = true;
} this.$emit('save', this.form);
})
} }
});
},
cancel() {
this.saving = false;
this.$emit('cancel');
},
resetSaving() {
this.saving = false;
} }
} }
};
</script> </script>
<style scoped>
.dialog-footer {
text-align: right;
}
:deep(.el-dialog) {
border-radius: 15px;
}
</style>
@@ -1,30 +1,26 @@
<template> <template>
<el-dialog :title="title" :visible.sync="visible" width="700px" class="param-dialog-wrapper" :append-to-body="true" <CustomDialog
:close-on-click-modal="false" :key="dialogKey" custom-class="custom-param-dialog" :show-close="false"> :title="title"
<div class="dialog-container"> :visible.sync="visible"
<div class="dialog-header"> width="700px"
<h2 class="dialog-title">{{ title }}</h2> class="param-dialog-wrapper"
<button class="custom-close-btn" @click="cancel"> @confirm="submit"
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg"> @close="cancel"
<path d="M13 1L1 13M1 1L13 13" stroke="currentColor" stroke-width="2" stroke-linecap="round" /> :confirmLoading="saving"
</svg> >
</button>
</div>
<el-form :model="localForm" :rules="rules" ref="form" label-width="auto" label-position="left" class="param-form"> <el-form :model="localForm" :rules="rules" ref="form" label-width="auto" label-position="left" class="param-form">
<el-form-item :label="$t('replacementDialog.fileName')" prop="fileName" class="form-item"> <el-form-item :label="$t('replacementDialog.fileName')" prop="fileName">
<el-input v-model="localForm.fileName" :placeholder="$t('replacementDialog.fileNamePlaceholder')" <el-input v-model="localForm.fileName" :placeholder="$t('replacementDialog.fileNamePlaceholder')"
class="custom-input" @input="clearFieldError('fileName')"></el-input> @input="clearFieldError('fileName')"></el-input>
</el-form-item> </el-form-item>
<el-form-item :label="$t('replacementDialog.content')" prop="content" class="form-item content-item"> <el-form-item :label="$t('replacementDialog.content')" prop="content" class="content-item">
<div class="content-wrapper"> <div class="content-wrapper">
<el-input <el-input
type="textarea" type="textarea"
v-model="localForm.content" v-model="localForm.content"
:placeholder="$t('replacementDialog.contentPlaceholder')" :placeholder="$t('replacementDialog.contentPlaceholder')"
:rows="8" :rows="8"
class="custom-textarea"
@input="clearFieldError('content')" @input="clearFieldError('content')"
></el-input> ></el-input>
<p class="format-tip">{{ $t('replacementDialog.formatTip') }}</p> <p class="format-tip">{{ $t('replacementDialog.formatTip') }}</p>
@@ -56,21 +52,16 @@
</div> </div>
</el-form-item> </el-form-item>
</el-form> </el-form>
</CustomDialog>
<div class="dialog-footer">
<el-button type="primary" @click="submit" class="save-btn" :loading="saving" :disabled="saving">
{{ $t('replacementDialog.save') }}
</el-button>
<el-button @click="cancel" class="cancel-btn">
{{ $t('replacementDialog.cancel') }}
</el-button>
</div>
</div>
</el-dialog>
</template> </template>
<script> <script>
import CustomDialog from './CustomDialog.vue';
export default { export default {
components: {
CustomDialog
},
props: { props: {
title: { title: {
type: String, type: String,
@@ -270,155 +261,21 @@ export default {
}; };
</script> </script>
<style>
.custom-param-dialog {
border-radius: 16px !important;
overflow: hidden;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
border: none !important;
.el-dialog__header {
display: none;
}
.el-dialog__body {
padding: 0 !important;
border-radius: 16px;
}
}
</style>
<style scoped lang="scss"> <style scoped lang="scss">
.param-dialog-wrapper { .param-dialog-wrapper {
.dialog-container {
padding: 24px 32px;
background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}
.dialog-header {
position: relative;
margin-bottom: 24px;
text-align: center;
}
.dialog-title {
font-size: 20px;
color: #1e293b;
margin: 0;
padding: 0;
font-weight: 600;
letter-spacing: 0.5px;
}
.custom-close-btn {
position: absolute;
top: -8px;
right: -8px;
width: 32px;
height: 32px;
border-radius: 50%;
border: none;
background: #f1f5f9;
color: #64748b;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
padding: 0;
outline: none;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
&:hover {
color: #ffffff;
background: #ef4444;
transform: rotate(90deg);
box-shadow: 0 4px 6px rgba(239, 68, 68, 0.2);
}
svg {
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
}
.param-form { .param-form {
.form-item {
margin-bottom: 20px;
:deep(.el-form-item__label) {
color: #475569;
font-weight: 500;
padding-right: 12px;
text-align: right;
font-size: 14px;
letter-spacing: 0.2px;
}
}
.content-item { .content-item {
:deep(.el-form-item__content) { :deep(.el-form-item__content) {
line-height: 1; line-height: 1;
} }
} }
.custom-input {
:deep(.el-input__inner) {
background-color: #ffffff;
border-radius: 8px;
border: 1px solid #e2e8f0;
height: 42px;
padding: 0 14px;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
font-size: 14px;
color: #334155;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
&:focus {
border-color: #3b82f6;
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
background-color: #ffffff;
}
&::placeholder {
color: #94a3b8;
font-weight: 400;
}
}
}
.content-wrapper { .content-wrapper {
width: 100%; width: 100%;
} }
.custom-textarea {
:deep(.el-textarea__inner) {
background-color: #ffffff;
border-radius: 8px;
border: 1px solid #e2e8f0;
padding: 12px 14px;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
font-size: 14px;
color: #334155;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
line-height: 1.8;
resize: none;
white-space: pre;
overflow-x: auto;
word-wrap: normal;
&:focus {
border-color: #3b82f6;
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
background-color: #ffffff;
}
&::placeholder {
color: #94a3b8;
font-weight: 400;
}
}
}
.format-tip { .format-tip {
text-align: left;
font-size: 12px; font-size: 12px;
color: #5778ff; color: #5778ff;
} }
@@ -472,65 +329,5 @@ export default {
} }
} }
} }
.dialog-footer {
display: flex;
justify-content: center;
padding: 16px 0 0;
margin-top: 16px;
.save-btn {
width: 120px;
height: 42px;
font-size: 14px;
font-weight: 500;
border-radius: 8px;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
background: #3b82f6;
color: white;
border: none;
letter-spacing: 0.5px;
box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
&:hover {
background: #2563eb;
transform: translateY(-1px);
box-shadow: 0 4px 6px rgba(59, 130, 246, 0.3);
}
&:active {
transform: translateY(0);
box-shadow: 0 2px 3px rgba(59, 130, 246, 0.2);
}
}
.cancel-btn {
width: 120px;
height: 42px;
font-size: 14px;
font-weight: 500;
border-radius: 8px;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
background: #ffffff;
color: #64748b;
border: 1px solid #e2e8f0;
margin-left: 16px;
letter-spacing: 0.5px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
&:hover {
background: #f8fafc;
color: #475569;
border-color: #cbd5e1;
transform: translateY(-1px);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
&:active {
transform: translateY(0);
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
}
}
} }
</style> </style>
+5
View File
@@ -352,6 +352,8 @@ export default {
// Replacement word management page related // Replacement word management page related
'replacementWordManagement.pageTitle': 'Ersetzungswortverwaltung', 'replacementWordManagement.pageTitle': 'Ersetzungswortverwaltung',
'replacementWordManagement.searchPlaceholder': 'Bitte geben Sie den Dateinamen zur Suche ein',
'replacementWordManagement.search': 'Suchen',
'replacementWordManagement.fileName': 'Dateiname', 'replacementWordManagement.fileName': 'Dateiname',
'replacementWordManagement.replacementWordCount': 'Anzahl der Ersetzungswörter', 'replacementWordManagement.replacementWordCount': 'Anzahl der Ersetzungswörter',
'replacementWordManagement.replacementWordContent': 'Ersetzungswortinhalt', 'replacementWordManagement.replacementWordContent': 'Ersetzungswortinhalt',
@@ -706,6 +708,9 @@ export default {
'common.cancel': 'Abbrechen', 'common.cancel': 'Abbrechen',
'common.sensitive': 'Sensibel', 'common.sensitive': 'Sensibel',
'common.loading': 'Lädt', 'common.loading': 'Lädt',
'common.copySuccess': 'Erfolgreich kopiert',
'common.copyFailed': 'Kopieren fehlgeschlagen',
'common.copyAddress': 'Adresse kopieren',
// Language switch // Language switch
'language.zhCN': '中文简体', 'language.zhCN': '中文简体',
+5
View File
@@ -352,6 +352,8 @@ export default {
// Replacement word management page related // Replacement word management page related
'replacementWordManagement.pageTitle': 'Replacement Word Management', 'replacementWordManagement.pageTitle': 'Replacement Word Management',
'replacementWordManagement.searchPlaceholder': 'Please enter file name to search',
'replacementWordManagement.search': 'Search',
'replacementWordManagement.fileName': 'File Name', 'replacementWordManagement.fileName': 'File Name',
'replacementWordManagement.replacementWordCount': 'Replacement Word Count', 'replacementWordManagement.replacementWordCount': 'Replacement Word Count',
'replacementWordManagement.replacementWordContent': 'Replacement Word Content', 'replacementWordManagement.replacementWordContent': 'Replacement Word Content',
@@ -706,6 +708,9 @@ export default {
'common.cancel': 'Cancel', 'common.cancel': 'Cancel',
'common.sensitive': 'Sensitive', 'common.sensitive': 'Sensitive',
'common.loading': 'Loading', 'common.loading': 'Loading',
'common.copySuccess': 'Copy successful',
'common.copyFailed': 'Copy failed',
'common.copyAddress': 'Copy address',
// Language switch // Language switch
'language.zhCN': '中文简体', 'language.zhCN': '中文简体',
+5
View File
@@ -352,6 +352,8 @@ export default {
// Replacement word management page related // Replacement word management page related
'replacementWordManagement.pageTitle': 'Gerenciamento de Palavras de Substituição', 'replacementWordManagement.pageTitle': 'Gerenciamento de Palavras de Substituição',
'replacementWordManagement.searchPlaceholder': 'Digite o nome do arquivo para pesquisar',
'replacementWordManagement.search': 'Pesquisar',
'replacementWordManagement.fileName': 'Nome do Arquivo', 'replacementWordManagement.fileName': 'Nome do Arquivo',
'replacementWordManagement.replacementWordCount': 'Quantidade de Palavras de Substituição', 'replacementWordManagement.replacementWordCount': 'Quantidade de Palavras de Substituição',
'replacementWordManagement.replacementWordContent': 'Conteúdo Substituto', 'replacementWordManagement.replacementWordContent': 'Conteúdo Substituto',
@@ -706,6 +708,9 @@ export default {
'common.cancel': 'Cancelar', 'common.cancel': 'Cancelar',
'common.sensitive': 'Sensível', 'common.sensitive': 'Sensível',
'common.loading': 'Carregando', 'common.loading': 'Carregando',
'common.copySuccess': 'Cópia bem-sucedida',
'common.copyFailed': 'Falha ao copiar',
'common.copyAddress': 'Copiar endereço',
// Troca de idioma // Troca de idioma
'language.zhCN': '中文简体', 'language.zhCN': '中文简体',
+5
View File
@@ -352,6 +352,8 @@ export default {
// Replacement word management page related // Replacement word management page related
'replacementWordManagement.pageTitle': 'Quản lý từ thay thế', 'replacementWordManagement.pageTitle': 'Quản lý từ thay thế',
'replacementWordManagement.searchPlaceholder': 'Vui lòng nhập tên tệp để tìm kiếm',
'replacementWordManagement.search': 'Tìm kiếm',
'replacementWordManagement.fileName': 'Tên tệp', 'replacementWordManagement.fileName': 'Tên tệp',
'replacementWordManagement.replacementWordCount': 'Số lượng từ thay thế', 'replacementWordManagement.replacementWordCount': 'Số lượng từ thay thế',
'replacementWordManagement.replacementWordContent': 'Nội dung từ thay thế', 'replacementWordManagement.replacementWordContent': 'Nội dung từ thay thế',
@@ -706,6 +708,9 @@ export default {
'common.cancel': 'Hủy bỏ', 'common.cancel': 'Hủy bỏ',
'common.sensitive': 'Nhạy cảm', 'common.sensitive': 'Nhạy cảm',
'common.loading': 'Đang tải', 'common.loading': 'Đang tải',
'common.copySuccess': 'Sao chép thành công',
'common.copyFailed': 'Sao chép thất bại',
'common.copyAddress': 'Sao chép địa chỉ',
// Language switch // Language switch
'language.zhCN': '中文简体', 'language.zhCN': '中文简体',
+5
View File
@@ -352,6 +352,8 @@ export default {
// 替换词对话框相关 // 替换词对话框相关
'replacementWordManagement.pageTitle': '替换词管理', 'replacementWordManagement.pageTitle': '替换词管理',
'replacementWordManagement.searchPlaceholder': '请输入文件名称查询',
'replacementWordManagement.search': '搜索',
'replacementWordManagement.fileName': '文件名称', 'replacementWordManagement.fileName': '文件名称',
'replacementWordManagement.replacementWordCount': '替换词数量', 'replacementWordManagement.replacementWordCount': '替换词数量',
'replacementWordManagement.replacementWordContent': '替换词内容', 'replacementWordManagement.replacementWordContent': '替换词内容',
@@ -706,6 +708,9 @@ export default {
'common.cancel': '取消', 'common.cancel': '取消',
'common.sensitive': '敏感', 'common.sensitive': '敏感',
'common.loading': '加载中', 'common.loading': '加载中',
'common.copySuccess': '复制成功',
'common.copyFailed': '复制失败',
'common.copyAddress': '复制地址',
// 语言切换 // 语言切换
'language.zhCN': '中文简体', 'language.zhCN': '中文简体',
+5
View File
@@ -352,6 +352,8 @@ export default {
// 替換詞管理頁面相關 // 替換詞管理頁面相關
'replacementWordManagement.pageTitle': '替換詞管理', 'replacementWordManagement.pageTitle': '替換詞管理',
'replacementWordManagement.searchPlaceholder': '請輸入檔案名稱查詢',
'replacementWordManagement.search': '搜尋',
'replacementWordManagement.fileName': '檔案名稱', 'replacementWordManagement.fileName': '檔案名稱',
'replacementWordManagement.replacementWordCount': '替換詞數量', 'replacementWordManagement.replacementWordCount': '替換詞數量',
'replacementWordManagement.replacementWordContent': '替換詞內容', 'replacementWordManagement.replacementWordContent': '替換詞內容',
@@ -706,6 +708,9 @@ export default {
'common.cancel': '取消', 'common.cancel': '取消',
'common.sensitive': '敏感', 'common.sensitive': '敏感',
'common.loading': '載入中', 'common.loading': '載入中',
'common.copySuccess': '複製成功',
'common.copyFailed': '複製失敗',
'common.copyAddress': '複製地址',
// 語言切換 // 語言切換
'language.zhCN': '中文简体', 'language.zhCN': '中文简体',
@@ -78,7 +78,7 @@
@confirm="handleDialogConfirm" @confirm="handleDialogConfirm"
@cancel="dialogVisible = false" @cancel="dialogVisible = false"
> >
<el-form ref="dialogForm" :model="form" label-width="100px"> <el-form ref="dialogForm" :model="form" :rules="formRules" label-width="100px">
<el-form-item :label="$t('templateQuickConfig.agentSettings.agentName')" prop="agentName"> <el-form-item :label="$t('templateQuickConfig.agentSettings.agentName')" prop="agentName">
<el-input <el-input
v-model="form.agentName" v-model="form.agentName"
@@ -155,6 +155,14 @@ export default {
sort: 0, sort: 0,
model: { ...DEFAULT_MODEL_CONFIG } model: { ...DEFAULT_MODEL_CONFIG }
}, },
formRules: {
agentName: [
{ required: true, message: "请输入助手昵称", trigger: "blur" }
],
systemPrompt: [
{ required: true, message: "请输入角色介绍", trigger: "blur" }
]
},
originalForm: null originalForm: null
}; };
}, },
@@ -263,6 +271,9 @@ export default {
}); });
}, },
handleDialogConfirm() { handleDialogConfirm() {
this.$refs.dialogForm.validate((valid) => {
if (!valid) return;
const configData = { const configData = {
id: this.form.id || "", id: this.form.id || "",
agentCode: this.form.agentCode, agentCode: this.form.agentCode,
@@ -297,6 +308,7 @@ export default {
this.confirmLoading = false; this.confirmLoading = false;
this.$message.error(this.$t("common.networkError")); this.$message.error(this.$t("common.networkError"));
}); });
});
}, },
deleteTemplate(row) { deleteTemplate(row) {
this.$confirm( this.$confirm(
+253 -603
View File
@@ -1,115 +1,83 @@
<template> <template>
<div class="welcome"> <div class="welcome">
<HeaderBar /> <HeaderBar />
<div class="operation-bar">
<h2 class="page-title">{{ $t('dictManagement.pageTitle') }}</h2>
<div class="action-group">
<div class="search-group">
<el-input :placeholder="$t('dictManagement.searchPlaceholder')" v-model="search" class="search-input" clearable
@keyup.enter.native="handleSearch" style="width: 240px" />
<el-button class="btn-search" @click="handleSearch">
{{ $t('dictManagement.search') }}
</el-button>
</div>
</div>
</div>
<!-- 主体内容 -->
<div class="main-wrapper"> <div class="main-wrapper">
<el-card class="main-card" shadow="never">
<div class="operation-header">
<h2 class="page-title">{{ $t('dictManagement.pageTitle') }}</h2>
<div class="right-operations">
<el-input :placeholder="$t('dictManagement.searchPlaceholder')" v-model="search" class="search-input"
@keyup.enter.native="handleSearch" clearable />
<CustomButton icon="el-icon-search" type="confirm" @click="handleSearch">
{{ $t('dictManagement.search') }}
</CustomButton>
</div>
</div>
<div class="content-panel"> <div class="content-panel">
<!-- 左侧字典类型列表 --> <!-- 左侧字典类型列表 -->
<div class="dict-type-panel"> <div class="dict-type-panel">
<div class="dict-type-header"> <div class="dict-type-header">
<el-button type="success" size="mini" @click="showAddDictTypeDialog">{{ $t('dictManagement.addDictType') }}</el-button> <h4 class="dict-type-title">字典分类</h4>
<el-button type="danger" size="mini" @click="batchDeleteDictType" <div>
:disabled="selectedDictTypes.length === 0"> <el-button icon="el-icon-plus" size="mini" @click="showAddDictTypeDialog" />
{{ $t('dictManagement.batchDeleteDictType') }} <el-button icon="el-icon-delete" size="mini" @click="batchDeleteDictType" />
</el-button> </div>
</div>
<div class="dict-type-checkbox" v-loading="dictTypeLoading">
<el-checkbox class="dict-type-all" :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">{{ $t('common.selectAll') }}</el-checkbox>
<el-checkbox-group v-model="checkedDictTypesIds" @change="handleDictTypeSelectionChange">
<div
class="dict-type-item"
:class="{ 'dict-type-active': selectedDictType?.id === item.id }"
v-for="item in dictTypeList"
:key="item.id"
>
<el-checkbox :label="item.dictName" :key="item.id">
</el-checkbox>
<div class="dict-type-item-content" @click="handleDictTypeRowClick(item)">
<span class="dict-type-name">{{item.dictName}}</span>
<el-button class="dict-type-edit-btn" type="text" icon="el-icon-edit" size="mini" @click.stop="editDictType(item)"/>
</div>
</div>
</el-checkbox-group>
</div> </div>
<el-table ref="dictTypeTable" :data="dictTypeList" style="width: 100%" v-loading="dictTypeLoading"
element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading"
element-loading-background="rgba(255, 255, 255, 0.7)" @row-click="handleDictTypeRowClick"
@selection-change="handleDictTypeSelectionChange" :row-class-name="tableRowClassName"
class="dict-type-table" :header-cell-class-name="headerCellClassName">
<el-table-column type="selection" width="70" align="center" :cell-class-name="selectionCellClassName"></el-table-column>
<el-table-column :label="$t('dictManagement.dictTypeName')" prop="dictName" align="center"></el-table-column>
<el-table-column :label="$t('dictManagement.operation')" width="100" align="center">
<template slot-scope="scope">
<el-button type="text" size="mini" @click.stop="editDictType(scope.row)">{{ $t('dictManagement.edit') }}</el-button>
</template>
</el-table-column>
</el-table>
</div> </div>
<!-- 右侧字典数据列表 --> <!-- 右侧字典数据列表 -->
<div class="content-area"> <div class="content-area">
<el-card class="dict-data-card" shadow="never"> <CustomTable :data="dictDataList" :columns="tableColumns" :loading="dictDataLoading" :show-selection="true"
<el-table ref="dictDataTable" :data="dictDataList" style="width: 100%" :show-operations="true" :operations-label="$t('dictManagement.operation')" :total="total"
v-loading="dictDataLoading" element-loading-text="拼命加载中" :current-page="currentPage" :page-size="pageSize" :page-size-options="pageSizeOptions"
element-loading-spinner="el-icon-loading" @size-change="handlePageSizeChange" @page-change="goToPage">
element-loading-background="rgba(255, 255, 255, 0.7)" class="transparent-table" <template slot="selection" slot-scope="scope">
header-row-class-name="table-header">
<el-table-column :label="$t('modelConfig.select')" align="center" width="70">
<template slot-scope="scope">
<el-checkbox v-model="scope.row.selected"></el-checkbox> <el-checkbox v-model="scope.row.selected"></el-checkbox>
</template> </template>
</el-table-column> <template slot="operations" slot-scope="scope">
<el-table-column :label="$t('dictManagement.dictLabel')" prop="dictLabel" align="center"></el-table-column> <el-button type="text" size="mini" @click="editDictData(scope.row)">
<el-table-column :label="$t('dictManagement.dictValue')" prop="dictValue" align="center"></el-table-column>
<el-table-column :label="$t('dictManagement.sort')" prop="sort" align="center"></el-table-column>
<el-table-column :label="$t('dictManagement.operation')" align="center" width="180px">
<template slot-scope="scope">
<el-button type="text" size="mini" @click="editDictData(scope.row)"
class="edit-btn">
{{ $t('dictManagement.edit') }} {{ $t('dictManagement.edit') }}
</el-button> </el-button>
<el-button type="text" size="mini" @click="deleteDictData(scope.row)" <el-button type="text" size="mini" @click="deleteDictData(scope.row)">
class="delete-btn">
{{ $t('dictManagement.delete') }} {{ $t('dictManagement.delete') }}
</el-button> </el-button>
</template> </template>
</el-table-column> <template slot="footer-btns">
</el-table> <div class="ctrl_btn">
<div class="table-footer"> <CustomButton :icon="isAllDictDataSelected ? 'el-icon-circle-close' : 'el-icon-circle-check'"
<div class="batch-actions"> size="small" @click="selectAllDictData">
<el-button size="mini" type="primary" @click="selectAllDictData">
{{ isAllDictDataSelected ? $t('dictManagement.deselectAll') : $t('dictManagement.selectAll') }} {{ isAllDictDataSelected ? $t('dictManagement.deselectAll') : $t('dictManagement.selectAll') }}
</el-button> </CustomButton>
<el-button type="success" size="mini" @click="showAddDictDataDialog" class="add-btn"> <CustomButton icon="el-icon-plus" size="small" @click="showAddDictDataDialog">
{{ $t('dictManagement.addDictData') }} {{ $t('dictManagement.addDictData') }}
</el-button> </CustomButton>
<el-button size="mini" type="danger" icon="el-icon-delete" @click="batchDeleteDictData"> <CustomButton size="small" type="delete" icon="el-icon-delete" @click="batchDeleteDictData">
{{ $t('dictManagement.batchDeleteDictData') }} {{ $t('dictManagement.batchDeleteDictData') }}
</el-button> </CustomButton>
</div> </div>
<div class="custom-pagination"> </template>
<el-select v-model="pageSize" @change="handlePageSizeChange" class="page-size-select"> </CustomTable>
<el-option v-for="item in pageSizeOptions" :key="item" :label="$t('dictManagement.itemsPerPage', { items: item })"
:value="item">
</el-option>
</el-select>
<button class="pagination-btn" :disabled="currentPage === 1" @click="goFirst">
{{ $t('dictManagement.firstPage') }}
</button>
<button class="pagination-btn" :disabled="currentPage === 1" @click="goPrev">
{{ $t('dictManagement.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('dictManagement.nextPage') }}
</button>
<span class="total-text">{{ $t('dictManagement.totalRecords', { total }) }}</span>
</div> </div>
</div> </div>
</el-card> </el-card>
</div> </div>
</div>
</div>
<!-- 使用字典类型编辑弹框组件 --> <!-- 使用字典类型编辑弹框组件 -->
<DictTypeDialog :visible.sync="dictTypeDialogVisible" :title="dictTypeDialogTitle" :dictTypeData="dictTypeForm" <DictTypeDialog :visible.sync="dictTypeDialogVisible" :title="dictTypeDialogTitle" :dictTypeData="dictTypeForm"
@@ -130,13 +98,17 @@ import DictDataDialog from '@/components/DictDataDialog.vue'
import DictTypeDialog from '@/components/DictTypeDialog.vue' import DictTypeDialog from '@/components/DictTypeDialog.vue'
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 CustomButton from '@/components/CustomButton.vue'
import CustomTable from '@/components/CustomTable.vue'
export default { export default {
name: 'DictManagement', name: 'DictManagement',
components: { components: {
HeaderBar, HeaderBar,
DictTypeDialog, DictTypeDialog,
DictDataDialog, DictDataDialog,
VersionFooter VersionFooter,
CustomButton,
CustomTable
}, },
data() { data() {
return { return {
@@ -144,7 +116,7 @@ export default {
dictTypeList: [], dictTypeList: [],
dictTypeLoading: false, dictTypeLoading: false,
selectedDictType: null, selectedDictType: null,
selectedDictTypes: [], // 恢复多选数组 selectedDictTypes: [],
dictTypeDialogVisible: false, dictTypeDialogVisible: false,
dictTypeDialogTitle: '新增字典类型', dictTypeDialogTitle: '新增字典类型',
dictTypeForm: { dictTypeForm: {
@@ -167,17 +139,64 @@ export default {
sort: 0 sort: 0
}, },
search: '', search: '',
// 添加分页相关数据
pageSizeOptions: [10, 20, 50, 100], pageSizeOptions: [10, 20, 50, 100],
currentPage: 1, currentPage: 1,
pageSize: 10, pageSize: 10,
total: 0 total: 0,
tableColumns: [],
isIndeterminate: false,
checkAll: false,
checkedDictTypesIds: []
} }
}, },
created() { created() {
this.initTableColumns()
this.loadDictTypeList() this.loadDictTypeList()
}, },
methods: { methods: {
handleCheckAllChange(val) {
// 根据当前实际选中状态决定是全选还是取消全选
const isAllSelected = this.checkedDictTypesIds.length === this.dictTypeList.length;
if (isAllSelected) {
// 已全选,取消全选
this.checkedDictTypesIds = [];
this.checkAll = false;
this.selectedDictTypes = [];
} else {
// 未全选,执行全选
this.checkedDictTypesIds = this.dictTypeList.map(item => item.dictName);
this.checkAll = true;
this.selectedDictTypes = [...this.dictTypeList];
}
// 重置 indeterminate 状态
this.isIndeterminate = false;
},
handleDictTypeSelectionChange(checkedIds) {
// 更新选中的字典类型列表
this.selectedDictTypes = this.dictTypeList.filter(item => checkedIds.includes(item.dictName));
// 部分选中时 checkAll 为 trueisIndeterminate 为 true 显示半选状态
this.checkAll = checkedIds.length > 0;
this.isIndeterminate = checkedIds.length > 0 && checkedIds.length < this.dictTypeList.length;
},
initTableColumns() {
this.tableColumns = [
{
prop: 'dictLabel',
label: this.$t('dictManagement.dictLabel'),
align: 'center'
},
{
prop: 'dictValue',
label: this.$t('dictManagement.dictValue'),
align: 'center'
},
{
prop: 'sort',
label: this.$t('dictManagement.sort'),
align: 'center'
}
]
},
// 字典类型相关方法 // 字典类型相关方法
loadDictTypeList() { loadDictTypeList() {
this.dictTypeLoading = true this.dictTypeLoading = true
@@ -191,9 +210,6 @@ export default {
if (this.dictTypeList.length > 0) { if (this.dictTypeList.length > 0) {
this.selectedDictType = this.dictTypeList[0] this.selectedDictType = this.dictTypeList[0]
this.loadDictDataList(this.dictTypeList[0].id) this.loadDictDataList(this.dictTypeList[0].id)
this.$nextTick(() => {
this.$refs.dictTypeTable.setCurrentRow(this.dictTypeList[0])
})
} }
} }
this.dictTypeLoading = false this.dictTypeLoading = false
@@ -202,13 +218,6 @@ export default {
handleDictTypeRowClick(row) { handleDictTypeRowClick(row) {
this.selectedDictType = row this.selectedDictType = row
this.loadDictDataList(row.id) this.loadDictDataList(row.id)
this.$refs.dictTypeTable.setCurrentRow(row)
},
handleDictTypeSelectionChange(val) {
this.selectedDictTypes = val
},
tableRowClassName({ row }) {
return row === this.selectedDictType ? 'current-row' : ''
}, },
showAddDictTypeDialog() { showAddDictTypeDialog() {
this.dictTypeDialogTitle = this.$t('dictManagement.addDictType') this.dictTypeDialogTitle = this.$t('dictManagement.addDictType')
@@ -351,95 +360,22 @@ export default {
}, },
handleSearch() { handleSearch() {
if (!this.selectedDictType) { if (!this.selectedDictType) {
this.$message.warning('请先选择字典类型') this.$message.warning(this.$t('dictManagement.selectDictTypeFirst'))
return return
} }
this.currentPage = 1 this.currentPage = 1
this.loadDictDataList(this.selectedDictType.id) this.loadDictDataList(this.selectedDictType.id)
}, },
// 添加分页相关方法
handlePageSizeChange(val) { handlePageSizeChange(val) {
this.pageSize = val; this.pageSize = val
this.currentPage = 1; this.currentPage = 1
this.loadDictDataList(this.selectedDictType?.id); this.loadDictDataList(this.selectedDictType?.id)
},
// 更新选择列表头翻译文本
updateSelectionHeaderText() {
const thElement = document.querySelector(`.el-table__header th:nth-child(1) .cell`);
if (thElement) {
thElement.setAttribute('data-content', this.$t('modelConfig.select'));
}
},
goFirst() {
this.currentPage = 1;
this.loadDictDataList(this.selectedDictType?.id);
},
goPrev() {
if (this.currentPage > 1) {
this.currentPage--;
this.loadDictDataList(this.selectedDictType?.id);
}
},
goNext() {
if (this.currentPage < this.pageCount) {
this.currentPage++;
this.loadDictDataList(this.selectedDictType?.id);
}
}, },
goToPage(page) { goToPage(page) {
this.currentPage = page; if (page !== this.currentPage) {
this.loadDictDataList(this.selectedDictType?.id); this.currentPage = page
}, this.loadDictDataList(this.selectedDictType?.id)
// 表头单元格样式类名,用于选择列
headerCellClassName({ columnIndex }) {
if (columnIndex === 0) {
return 'custom-selection-header';
} }
return '';
},
// 单元格样式类名,用于设置选择列表头的翻译文本
selectionCellClassName({ row, column, rowIndex, columnIndex }) {
// 只对表头行设置data-content
if (rowIndex === undefined) {
setTimeout(() => {
this.updateSelectionHeaderText();
}, 0);
}
return '';
}
},
mounted() {
// 在组件挂载后确保表头翻译文本正确显示
setTimeout(() => {
this.updateSelectionHeaderText();
}, 100);
},
updated() {
// 在组件更新后重新设置表头翻译文本
this.updateSelectionHeaderText();
},
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;
} }
} }
} }
@@ -461,458 +397,172 @@ 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 { .content-panel {
flex: 1;
gap: 16px;
padding: 0 20px;
display: flex;
min-height: 0;
}
.dict-type-panel {
width: 340px;
display: flex;
flex-direction: column;
margin-bottom: 20px;
box-shadow: 0 0 12px rgba(74, 124, 253, 0.12);
border-radius: 6px;
.dict-type-checkbox {
flex: 1;
padding: 16px 10px;
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 10px;
.dict-type-all {
margin-left: 10px;
}
::v-deep .el-checkbox-group {
width: 100%;
gap: 10px;
display: flex;
flex-direction: column;
align-items: flex-start;
.el-checkbox__label {
display: none;
}
}
.dict-type-item {
padding: 0 10px;
padding-right: 0;
width: 100%;
display: flex;
align-items: center;
cursor: pointer;
box-sizing: border-box;
border-radius: 4px;
&:hover {
background: #4998ff;
.dict-type-name, .dict-type-edit-btn {
color: #ffffff;
}
}
.dict-type-item-content {
flex: 1;
padding: 8px 0;
display: flex;
align-items: center;
justify-content: space-between;
}
.dict-type-name {
margin-left: 10px;
font-size: 14px;
}
.dict-type-edit-btn {
color: #303133;
padding: 6px 10px;
font-size: 14px;
}
}
.dict-type-active {
background-color: #4998ff;
.dict-type-name, .dict-type-edit-btn {
color: #ffffff;
}
}
}
}
.dict-type-header {
display: flex;
padding: 10px 16px;
border-bottom: 1px solid #ebeef5;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
padding: 16px 24px; .dict-type-title {
margin: 0;
font-weight: 500;
}
> div {
.el-button {
border-radius: 6px;
padding: 7px 8px;
}
}
}
.content-area {
flex: 1;
height: 100%;
min-width: 600px;
display: flex;
flex-direction: column;
padding: 0 0 20px;
box-sizing: border-box;
}
.main-card {
background: white;
flex: 1;
display: flex;
flex-direction: column;
border: none;
border-radius: 15px;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
overflow: hidden;
::v-deep .el-card__body {
padding: 0;
display: flex;
flex-direction: column;
flex: 1;
overflow: hidden;
}
}
.operation-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px 20px;
flex-shrink: 0;
} }
.page-title { .page-title {
font-weight: 500;
font-size: 24px; font-size: 24px;
margin: 0; margin: 0;
} }
.action-group { .right-operations {
display: flex;
align-items: center;
gap: 16px;
}
.search-group {
display: flex; display: flex;
gap: 10px; gap: 10px;
margin-left: auto;
} }
.search-input { .search-input {
width: 240px; width: 240px;
} }
.btn-search { .ctrl_btn {
background: linear-gradient(135deg, #6b8cff, #a966ff);
border: none;
color: white;
}
.btn-search:hover {
opacity: 0.9;
transform: translateY(-1px);
}
:deep(.search-input .el-input__inner) {
border-radius: 4px;
border: 1px solid #DCDFE6;
background-color: white;
transition: border-color 0.2s;
}
:deep(.search-input .el-input__inner:focus) {
border-color: #6b8cff;
outline: none;
}
.content-panel {
flex: 1;
display: flex; display: flex;
overflow: hidden;
height: 100%;
border-radius: 15px;
background: transparent;
border: 1px solid #fff;
} }
.dict-type-panel { :deep(.el-table .el-button--text) {
width: 300px; color: #7079aa;
background: white;
border-right: 1px solid #ebeef5;
display: flex;
flex-direction: column;
} }
.dict-type-header { :deep(.el-table .el-button--text:hover) {
padding: 16px; color: #5a64b5;
border-bottom: 1px solid #ebeef5;
display: flex;
gap: 8px;
}
.dict-type-table {
flex: 1;
overflow-y: auto;
}
.content-area {
flex: 1;
padding: 24px 24px 0;
height: 100%;
min-width: 600px;
overflow: hidden;
background-color: white;
display: flex;
flex-direction: column;
box-sizing: border-box;
}
.dict-data-card {
background: white;
flex: 1;
display: flex;
flex-direction: column;
border: none;
box-shadow: none;
overflow: hidden;
}
: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;
}
}
.table-footer {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
flex-shrink: 0;
min-height: 60px;
background: white;
margin-top: 10px;
}
.batch-actions {
display: flex;
gap: 8px;
padding-left: 26px;
.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);
&:hover {
transform: translateY(-1px);
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}
}
.el-button--primary {
background: #5f70f3;
color: white;
}
.el-button--success {
background: #5bc98c;
color: white;
}
.el-button--danger {
background: #fd5b63;
color: white;
}
}
.custom-pagination {
display: flex;
align-items: center;
gap: 8px;
.el-select {
margin-right: 8px;
}
.pagination-btn:first-child,
.pagination-btn:nth-child(2),
.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;
}
}
.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;
}
}
.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;
}
}
.edit-btn,
.delete-btn {
margin: 0 8px;
color: #7079aa !important;
font-size: 12px;
padding: 7px 12px;
height: 32px;
line-height: 1;
border-radius: 4px;
transition: all 0.3s ease;
&:hover {
color: #5a64b5 !important;
transform: translateY(-1px);
}
}
:deep(.dict-type-header .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);
&:hover {
transform: translateY(-1px);
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}
&.el-button--success {
background: #5bc98c;
color: white;
}
&.el-button--danger {
background: #fd5b63;
color: white;
}
}
:deep(.el-table .cell) {
padding-left: 10px;
padding-right: 10px;
}
:deep(.el-loading-mask) {
background-color: rgba(255, 255, 255, 0.6) !important;
backdrop-filter: blur(2px);
}
:deep(.el-loading-spinner .circular) {
width: 28px;
height: 28px;
}
:deep(.el-loading-spinner .path) {
stroke: #6b8cff;
}
:deep(.el-loading-text) {
color: #6b8cff !important;
font-size: 14px;
margin-top: 8px;
}
:deep(.dict-type-table .el-table__row) {
cursor: pointer;
}
:deep(.dict-type-table .el-table__row.current-row) {
background-color: #5778ff !important;
color: white;
}
:deep(.dict-type-table .el-table__row.current-row .el-button--text) {
color: white !important;
}
:deep(.dict-type-table .el-table__row:hover) {
background-color: #f5f7fa;
}
:deep(.dict-type-table .el-table__row.current-row:hover) {
background-color: #5778ff !important;
}
:deep(.dict-type-table .el-table__row td) {
background-color: transparent !important;
}
::v-deep .el-table .custom-selection-header .cell .el-checkbox__inner {
display: none !important;
}
::v-deep .el-table .custom-selection-header .cell::before {
content: attr(data-content);
display: block;
text-align: center;
line-height: 32px;
color: black;
margin-top: 0;
height: 32px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 100%;
}
.custom-selection-header .cell {
position: relative;
}
:deep(.el-table thead) {
color: #000000;
}
:deep(.el-card__body) {
padding: 0;
display: flex;
flex-direction: column;
flex: 1;
overflow: hidden;
} }
:deep(.el-checkbox__inner) { :deep(.el-checkbox__inner) {
@@ -1,100 +1,89 @@
<template> <template>
<div class="welcome"> <div class="welcome">
<HeaderBar /> <HeaderBar />
<div class="operation-bar">
<h2 class="page-title">{{ $t('replacementWordManagement.pageTitle') }}</h2>
</div>
<div class="main-wrapper"> <div class="main-wrapper">
<div class="content-panel"> <div class="content-panel">
<div class="content-area"> <div class="content-area">
<el-card class="params-card" shadow="never"> <el-card class="params-card" shadow="never">
<el-table <div class="operation-header">
<h2 class="page-title">{{ $t('replacementWordManagement.pageTitle') }}</h2>
<div class="right-operations">
<el-input
:placeholder="$t('replacementWordManagement.searchPlaceholder')"
v-model="searchKeyword"
class="search-input"
@keyup.enter.native="handleSearch"
clearable
/>
<CustomButton icon="el-icon-search" type="confirm" size="small" @click="handleSearch">
{{ $t('replacementWordManagement.search') }}
</CustomButton>
</div>
</div>
<CustomTable
ref="paramsTable" ref="paramsTable"
:data="paramsList" :data="filteredParamsList"
class="transparent-table" :columns="tableColumns"
v-loading="loading" :loading="loading"
:element-loading-text="$t('serverSideManager.loading')" :show-selection="true"
element-loading-spinner="el-icon-loading" :show-operations="true"
element-loading-background="rgba(255, 255, 255, 0.7)" :operations-label="$t('replacementWordManagement.operation')"
:total="total"
:current-page="currentPage"
:page-size="pageSize"
:page-size-options="pageSizeOptions"
@size-change="handlePageSizeChange"
@page-change="goToPage"
> >
<el-table-column :label="$t('modelConfig.select')" align="center" width="120"> <template slot="content" slot-scope="scope">
<template slot-scope="scope">
<el-checkbox v-model="scope.row.selected" @change="handleCheckboxChange(scope.row)"></el-checkbox>
</template>
</el-table-column>
<el-table-column :label="$t('replacementWordManagement.fileName')" prop="fileName" align="center"/>
<el-table-column :label="$t('replacementWordManagement.replacementWordCount')" prop="wordCount" align="center"/>
<el-table-column :label="$t('replacementWordManagement.replacementWordContent')" prop="content" align="center">
<template slot-scope="scope">
<el-tooltip placement="right" effect="light" popper-class="replace-word-tooltip"> <el-tooltip placement="right" effect="light" popper-class="replace-word-tooltip">
<div slot="content" class="replace-word-content"> <div slot="content" class="replace-word-content">
<el-tag v-for="(item, index) in scope.row.content" :key="index" size="mini" class="custom-tag">{{ item }}</el-tag> <el-tag
v-for="(item, index) in scope.row.content"
:key="index"
size="mini"
class="custom-tag"
>
{{ item }}
</el-tag>
</div> </div>
<span class="content-text">{{ formatContent(scope.row.content) }}</span> <span class="content-text">{{ formatContent(scope.row.content) }}</span>
</el-tooltip> </el-tooltip>
</template> </template>
</el-table-column> <template slot="operations" slot-scope="scope">
<el-table-column :label="$t('replacementWordManagement.createTime')" prop="createdAt" align="center"/> <el-button size="mini" type="text" @click="handleEdit(scope.row)">
<el-table-column :label="$t('replacementWordManagement.updateTime')" prop="updatedAt" align="center"/>
<el-table-column :label="$t('replacementWordManagement.operation')" prop="operator" align="center">
<template slot-scope="scope">
<el-button size="medium" type="text" @click="handleEdit(scope.row)">
{{ $t('replacementWordManagement.edit') }} {{ $t('replacementWordManagement.edit') }}
</el-button> </el-button>
<el-button size="medium" type="text" @click="handleDownload(scope.row)"> <el-button size="mini" type="text" @click="handleDownload(scope.row)">
{{ $t('replacementWordManagement.download') }} {{ $t('replacementWordManagement.download') }}
</el-button> </el-button>
<el-button size="medium" type="text" @click="handleDelete(scope.row)"> <el-button size="mini" type="text" @click="handleDelete(scope.row)">
{{ $t('replacementWordManagement.delete') }} {{ $t('replacementWordManagement.delete') }}
</el-button> </el-button>
</template> </template>
</el-table-column> <template slot="footer-btns">
</el-table>
<div class="table_bottom">
<div class="ctrl_btn"> <div class="ctrl_btn">
<el-button size="mini" type="primary" class="select-all-btn" @click="handleSelectAll"> <CustomButton
:icon="allSelected ? 'el-icon-circle-close' : 'el-icon-circle-check'"
size="small"
@click="handleSelectAll"
>
{{ allSelected ? $t('user.deselectAll') : $t('user.selectAll') }} {{ allSelected ? $t('user.deselectAll') : $t('user.selectAll') }}
</el-button> </CustomButton>
<el-button size="mini" type="success" @click="handleAdd">{{ $t('replacementWordManagement.addFile') }}</el-button> <CustomButton icon="el-icon-plus" size="small" @click="handleAdd">
<el-button size="mini" type="danger" :disabled="!hasAnySelected" @click="handleBatchDelete"> {{ $t('replacementWordManagement.addFile') }}
</CustomButton>
<CustomButton size="small" type="delete" icon="el-icon-delete" @click="handleBatchDelete">
{{ $t('replacementWordManagement.batchDelete') }} {{ $t('replacementWordManagement.batchDelete') }}
</el-button> </CustomButton>
</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="`${item}${$t('paramManagement.itemsPerPage')}`"
:value="item"
>
</el-option>
</el-select>
<button class="pagination-btn" :disabled="currentPage === 1" @click="goFirst">
{{ $t('paramManagement.firstPage') }}
</button>
<button class="pagination-btn" :disabled="currentPage === 1" @click="goPrev">
{{ $t('paramManagement.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('paramManagement.nextPage') }}
</button>
<span class="total-text">{{ $t('paramManagement.totalRecords', { total }) }}</span>
</div>
</div> </div>
</template>
</CustomTable>
</el-card> </el-card>
</div> </div>
</div> </div>
</div> </div>
<el-footer><VersionFooter/></el-footer>
<ReplacementWordDialog <ReplacementWordDialog
ref="paramDialog" ref="paramDialog"
:title="dialogTitle" :title="dialogTitle"
@@ -103,20 +92,23 @@
@submit="handleSubmit" @submit="handleSubmit"
@cancel="dialogVisible = false" @cancel="dialogVisible = false"
/> />
<el-footer><VersionFooter/></el-footer>
</div> </div>
</template> </template>
<script> <script>
import Api from "@/apis/api"; import Api from "@/apis/api";
import HeaderBar from "@/components/HeaderBar.vue"; import HeaderBar from "@/components/HeaderBar.vue";
import ParamDialog from "@/components/ParamDialog.vue";
import VersionFooter from "@/components/VersionFooter.vue"; import VersionFooter from "@/components/VersionFooter.vue";
import ReplacementWordDialog from "@/components/ReplacementWordDialog.vue"; import ReplacementWordDialog from "@/components/ReplacementWordDialog.vue";
import CustomButton from "@/components/CustomButton.vue";
import CustomTable from "@/components/CustomTable.vue";
export default { export default {
components: { HeaderBar, ParamDialog, VersionFooter, ReplacementWordDialog }, components: { HeaderBar, VersionFooter, ReplacementWordDialog, CustomButton, CustomTable },
data() { data() {
return { return {
searchKeyword: "",
paramsList: [], paramsList: [],
selectedRows: new Set(), selectedRows: new Set(),
currentPage: 1, currentPage: 1,
@@ -127,33 +119,18 @@ export default {
dialogVisible: false, dialogVisible: false,
dialogTitle: '', dialogTitle: '',
dialogForm: {}, dialogForm: {},
tableColumns: []
}; };
}, },
created() {
this.fetchFileList();
},
mounted() {
this.dialogTitle = this.$t('replacementWordManagement.addFile');
},
computed: { computed: {
pageCount() { filteredParamsList() {
return Math.ceil(this.total / this.pageSize); if (!this.searchKeyword) {
}, return this.paramsList;
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);
} }
const keyword = this.searchKeyword.toLowerCase();
for (let i = start; i <= end; i++) { return this.paramsList.filter(row =>
pages.push(i); (row.fileName || '').toLowerCase().includes(keyword)
} );
return pages;
}, },
hasAnySelected() { hasAnySelected() {
@@ -161,13 +138,51 @@ export default {
}, },
allSelected() { allSelected() {
if (this.paramsList.length === 0) { if (this.filteredParamsList.length === 0) {
return false; return false;
} }
return this.paramsList.every(row => this.selectedRows.has(row.id)); return this.filteredParamsList.every(row => this.selectedRows.has(row.id));
}
}, },
created() {
this.initTableColumns();
this.fetchFileList();
},
mounted() {
this.dialogTitle = this.$t('replacementWordManagement.addFile');
}, },
methods: { methods: {
initTableColumns() {
this.tableColumns = [
{
prop: 'fileName',
label: this.$t('replacementWordManagement.fileName'),
align: 'center'
},
{
prop: 'wordCount',
label: this.$t('replacementWordManagement.replacementWordCount'),
align: 'center'
},
{
prop: 'content',
label: this.$t('replacementWordManagement.replacementWordContent'),
align: 'center',
slot: 'content'
},
{
prop: 'createdAt',
label: this.$t('replacementWordManagement.createTime'),
align: 'center'
},
{
prop: 'updatedAt',
label: this.$t('replacementWordManagement.updateTime'),
align: 'center'
}
];
},
formatContent(content) { formatContent(content) {
if (!content) return ''; if (!content) return '';
if (Array.isArray(content)) { if (Array.isArray(content)) {
@@ -176,35 +191,22 @@ export default {
return content; return content;
}, },
handleSearch() {
this.currentPage = 1;
},
handlePageSizeChange(val) { handlePageSizeChange(val) {
this.pageSize = val; this.pageSize = val;
this.currentPage = 1; this.currentPage = 1;
this.fetchFileList(); this.fetchFileList();
}, },
goToPage(page) { goToPage(page) {
if (page !== this.currentPage) { if (page !== this.currentPage) {
this.currentPage = page; this.currentPage = page;
this.fetchFileList(); this.fetchFileList();
} }
}, },
goFirst() {
if (this.currentPage !== 1) {
this.currentPage = 1;
this.fetchFileList();
}
},
goPrev() {
if (this.currentPage > 1) {
this.currentPage--;
this.fetchFileList();
}
},
goNext() {
if (this.currentPage < this.pageCount) {
this.currentPage++;
this.fetchFileList();
}
},
handleCheckboxChange(row) { handleCheckboxChange(row) {
const newSet = new Set(this.selectedRows); const newSet = new Set(this.selectedRows);
@@ -218,20 +220,20 @@ export default {
handleSelectAll() { handleSelectAll() {
if (this.allSelected) { if (this.allSelected) {
this.paramsList.forEach(row => { this.filteredParamsList.forEach(row => {
this.$set(row, 'selected', false); this.$set(row, 'selected', false);
}); });
this.selectedRows = new Set(); this.selectedRows = new Set();
} else { } else {
this.paramsList.forEach(row => { this.filteredParamsList.forEach(row => {
this.$set(row, 'selected', true); this.$set(row, 'selected', true);
}); });
this.selectedRows = new Set(this.paramsList.map(row => row.id)); this.selectedRows = new Set(this.filteredParamsList.map(row => row.id));
} }
}, },
handleBatchDelete() { handleBatchDelete() {
const ids = Array.from(this.paramsList) const ids = Array.from(this.filteredParamsList)
.filter(row => row.selected) .filter(row => row.selected)
.map(row => row.id); .map(row => row.id);
@@ -273,15 +275,10 @@ export default {
}, ({ data }) => { }, ({ data }) => {
this.loading = false; this.loading = false;
if (data.code === 0) { if (data.code === 0) {
this.paramsList = data.data.list || []; this.paramsList = (data.data.list || []).map(row => ({
...row,
this.paramsList.forEach(row => { selected: this.selectedRows.has(row.id)
if (this.selectedRows.has(row.id)) { }));
this.$set(row, 'selected', true);
} else {
this.$set(row, 'selected', false);
}
});
this.total = data.data.total || 0; this.total = data.data.total || 0;
} else { } else {
@@ -325,10 +322,14 @@ export default {
}, },
handleDelete(row) { handleDelete(row) {
this.$confirm(this.$t('replacementWordManagement.confirmDelete'), this.$t('replacementWordManagement.deleteHint'), { this.$confirm(
this.$t('replacementWordManagement.confirmDelete'),
this.$t('replacementWordManagement.deleteHint'),
{
confirmButtonText: this.$t('common.confirm'), confirmButtonText: this.$t('common.confirm'),
cancelButtonText: this.$t('common.cancel') cancelButtonText: this.$t('common.cancel')
}).then(() => { }
).then(() => {
Api.correctWord.deleteFile(row.id, ({ data }) => { Api.correctWord.deleteFile(row.id, ({ data }) => {
if (data.code === 0) { if (data.code === 0) {
this.$message.success(this.$t('common.deleteSuccess')); this.$message.success(this.$t('common.deleteSuccess'));
@@ -372,7 +373,7 @@ export default {
}); });
} }
} }
}, }
}; };
</script> </script>
@@ -392,24 +393,23 @@ export default {
} }
.main-wrapper { .main-wrapper {
height: calc(100vh - 63px - 35px - 72px); height: calc(100vh - 63px - 35px);
margin: 0 22px; padding: 20px 22px 0;
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: 22px 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;
} }
@@ -424,14 +424,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%;
@@ -460,7 +453,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;
@@ -468,185 +461,8 @@ export default {
} }
} }
.table_bottom {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 10px;
}
.ctrl_btn { .ctrl_btn {
display: flex; display: flex;
gap: 8px;
padding-left: 26px;
.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);
&:hover {
transform: translateY(-1px);
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}
}
.el-button--primary {
background: #5f70f3;
color: white;
}
.el-button--danger {
background: #fd5b63;
color: white;
}
}
.custom-pagination {
display: flex;
align-items: center;
gap: 10px;
.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;
transition: all 0.3s ease;
&:hover {
background: #d7dce6;
}
&: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)) {
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;
}
}
: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;
}
&::before {
display: none;
}
.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);
}
}
}
: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;
}
@media (min-width: 1144px) {
.table_bottom {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 40px;
}
:deep(.transparent-table) {
.el-table__body tr {
td {
padding-top: 16px;
padding-bottom: 16px;
}
&+tr {
margin-top: 10px;
}
}
}
} }
:deep(.el-table .el-button--text) { :deep(.el-table .el-button--text) {
@@ -657,16 +473,7 @@ export default {
color: #5a64b5; color: #5a64b5;
} }
.el-button--success {
background: #5bc98c;
color: white;
}
:deep(.el-table .cell) { :deep(.el-table .cell) {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
.content-text { .content-text {
display: block; display: block;
max-width: 300px; max-width: 300px;
@@ -676,64 +483,6 @@ export default {
} }
} }
.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(.el-table) {
.el-table__body-wrapper {
transition: height 0.3s ease;
}
}
.el-table {
max-height: var(--table-max-height);
.el-table__body-wrapper {
max-height: calc(var(--table-max-height) - 40px);
overflow-y: auto;
}
}
.custom-tag { .custom-tag {
background: #e6ebff; background: #e6ebff;
color: #5778ff; color: #5778ff;
+88 -278
View File
@@ -1,38 +1,37 @@
<template> <template>
<div class="welcome"> <div class="welcome">
<HeaderBar /> <HeaderBar />
<div class="operation-bar">
<h2 class="page-title">{{ $t('serverSideManager.pageTitle') }}</h2>
</div>
<div class="main-wrapper"> <div class="main-wrapper">
<div class="content-panel"> <div class="content-panel">
<div class="content-area"> <div class="content-area">
<el-card class="params-card" shadow="never"> <el-card class="params-card" shadow="never">
<el-table ref="paramsTable" :data="paramsList" class="transparent-table" v-loading="loading" <div class="operation-header">
:element-loading-text="$t('serverSideManager.loading')" element-loading-spinner="el-icon-loading" <h2 class="page-title">{{ $t('serverSideManager.pageTitle') }}</h2>
element-loading-background="rgba(255, 255, 255, 0.7)" :header-cell-class-name="headerCellClassName"> </div>
<el-table-column :label="$t('modelConfig.select')" align="center" width="120"> <el-card class="server-list-card">
<template slot-scope="scope"> <div v-for="(item, index) in paramsList" :key="index" class="server-list" v-loading="loading">
<el-checkbox v-model="scope.row.selected"></el-checkbox> <div class="server-card">
</template> <div class="server-info">
</el-table-column> <span class="server-label">{{ $t('serverSideManager.wsAddress') }}</span>
<el-table-column :label="$t('serverSideManager.wsAddress')" prop="address" align="center"></el-table-column> <span class="server-value">{{ item.address }}</span>
<el-table-column :label="$t('serverSideManager.operation')" prop="operator" align="center" show-overflow-tooltip> </div>
<template slot-scope="scope"> <el-button class="copy-button" type="text" size="small" @click="copyAddress(item.address)">{{ $t('common.copyAddress') }}</el-button>
<el-button size="medium" type="text" @click="emitAction(scope.row, actionMap.restart)">{{ $t('serverSideManager.restart') }}</el-button> </div>
<el-button size="medium" type="text" <el-divider />
@click="emitAction(scope.row, actionMap.update_config)">{{ $t('serverSideManager.updateConfig') }}</el-button> <div class="header-actions">
</template> <CustomButton icon="el-icon-refresh-right" size="small" @click="emitAction(item, actionMap.restart)">{{
</el-table-column> $t('serverSideManager.restart') }}</CustomButton>
</el-table> <CustomButton icon="el-icon-setting" size="small" type="confirm" @click="emitAction(item, actionMap.update_config)">
{{ $t('serverSideManager.updateConfig') }}
</CustomButton>
</div>
<el-empty v-if="paramsList.length === 0 && !loading" :description="$t('common.noData')"></el-empty>
</div>
</el-card>
</el-card> </el-card>
</div> </div>
</div> </div>
</div> </div>
<el-footer> <el-footer>
<version-footer /> <version-footer />
</el-footer> </el-footer>
@@ -41,59 +40,22 @@
<script> <script>
import Api from "@/apis/api"; import Api from "@/apis/api";
import CustomButton from "@/components/CustomButton.vue";
import HeaderBar from "@/components/HeaderBar.vue"; import HeaderBar from "@/components/HeaderBar.vue";
import ParamDialog from "@/components/ParamDialog.vue";
import VersionFooter from "@/components/VersionFooter.vue"; import VersionFooter from "@/components/VersionFooter.vue";
import i18n from '@/i18n';
export default { export default {
components: { HeaderBar, ParamDialog, VersionFooter }, components: { HeaderBar, VersionFooter, CustomButton },
data() { data() {
return { return {
paramsList: [], paramsList: [],
currentPage: 1,
loading: false, loading: false,
pageSize: 10,
pageSizeOptions: [10, 20, 50, 100],
total: 0,
dialogVisible: false,
dialogTitle: '',
isAllSelected: false,
sensitive_keys: ["api_key", "personal_access_token", "access_token", "token", "secret", "access_key_secret", "secret_key"],
paramForm: {
id: null,
paramCode: "",
paramValue: "",
remark: ""
},
}; };
}, },
created() { created() {
this.fetchParams(); this.fetchParams();
}, },
mounted() {
this.dialogTitle = this.$t('paramManagement.addParam');
},
computed: { 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;
},
actionMap() { actionMap() {
return { return {
restart: { restart: {
@@ -112,11 +74,6 @@ export default {
} }
}, },
methods: { methods: {
handlePageSizeChange(val) {
this.pageSize = val;
this.currentPage = 1;
this.fetchParams();
},
fetchParams() { fetchParams() {
this.loading = true; this.loading = true;
Api.admin.getWsServerList( Api.admin.getWsServerList(
@@ -125,7 +82,6 @@ export default {
this.loading = false; this.loading = false;
if (data.code === 0) { if (data.code === 0) {
this.paramsList = data.data.map(item => ({ address: item })); this.paramsList = data.data.map(item => ({ address: item }));
this.total = data.data.length;
} else { } else {
this.$message.error({ this.$message.error({
message: data.msg || this.$t('serverSideManager.getServerListFailed'), message: data.msg || this.$t('serverSideManager.getServerListFailed'),
@@ -139,12 +95,10 @@ export default {
if (actionItem === undefined || rowItem.address === undefined) { if (actionItem === undefined || rowItem.address === undefined) {
return; return;
} }
// 弹开询问框
this.$confirm(actionItem.message, actionItem.title, { this.$confirm(actionItem.message, actionItem.title, {
confirmButtonText: actionItem.confirmText, // 确认按钮文本 confirmButtonText: actionItem.confirmText,
cancelButtonText: this.$t('common.cancel') // 取消按钮文本 cancelButtonText: this.$t('common.cancel')
}).then(() => { }).then(() => {
// 用户点击了确认按钮
Api.admin.sendWsServerAction({ Api.admin.sendWsServerAction({
targetWs: rowItem.address, targetWs: rowItem.address,
action: actionItem.value action: actionItem.value
@@ -163,13 +117,14 @@ export default {
}) })
}) })
}, },
headerCellClassName({ columnIndex }) { copyAddress(address) {
if (columnIndex === 0) { navigator.clipboard.writeText(address).then(() => {
return "custom-selection-header"; this.$message.success(this.$t('common.copySuccess'));
}).catch(() => {
this.$message.error(this.$t('common.copyFailed'));
});
} }
return "";
} }
},
}; };
</script> </script>
@@ -189,47 +144,21 @@ export default {
} }
.main-wrapper { .main-wrapper {
// 顶部 63px 底部 35px 查询58px height: calc(100vh - 63px - 35px);
height: calc(100vh - 63px - 35px - 58px); 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 {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16px 24px;
} }
.page-title { .page-title {
font-weight: 500;
font-size: 24px; font-size: 24px;
margin: 0; margin: 0;
} }
.right-operations {
display: flex;
gap: 10px;
margin-left: auto;
}
.search-input {
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%;
@@ -258,7 +187,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;
@@ -266,197 +195,78 @@ export default {
} }
} }
.table_bottom { .server-list {
display: flex; padding: 16px 20px;
justify-content: space-between; border-radius: 10px;
align-items: center; box-shadow: 0 0 8px #ececec;
margin-top: 10px;
padding-bottom: 10px;
} }
.ctrl_btn { .server-list-card {
display: flex; flex: 1;
gap: 8px;
padding-left: 26px;
.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; border: none;
transition: all 0.3s ease; border-radius: 8px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1); box-shadow: none;
&:hover { ::v-deep .el-card__body {
transform: translateY(-1px); gap: 20px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15); overflow: auto;
padding: 16px;
height: 100%;
box-sizing: border-box;
}
::v-deep .el-divider {
margin: 16px 0 !important;
background: #ecf2fb !important;
} }
} }
.el-button--primary { .header-actions {
background: #5f70f3; display: flex;
color: white; justify-content: flex-end;
} }
.el-button--danger { .operation-header {
background: #fd5b63; height: 56px;
color: white; display: flex;
} align-items: center;
justify-content: space-between;
padding: 0 0 16px 0;
box-sizing: border-box;
} }
:deep(.transparent-table) { .server-card {
background: white; display: flex;
flex: 1; align-items: center;
width: 100%; justify-content: space-between;
padding: 16px;
border-radius: 10px;
background: rgba(239, 243, 252, 0.4);
border: 1px solid #ecf2fb;
}
.server-info {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: flex-start;
.el-table__body-wrapper {
flex: 1;
overflow-y: auto;
max-height: none !important;
} }
.el-table__header-wrapper { .server-label {
flex-shrink: 0; font-size: 16px;
font-weight: 500;
} }
.el-table__header th { .server-value {
background: white !important;
color: black;
}
&::before {
display: none;
}
.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);
}
}
}
: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;
}
@media (min-width: 1144px) {
.table_bottom {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 40px;
}
:deep(.transparent-table) {
.el-table__body tr {
td {
padding-top: 16px;
padding-bottom: 16px;
}
&+tr {
margin-top: 10px; margin-top: 10px;
}
}
}
}
:deep(.el-table .el-button--text) {
color: #7079aa;
}
:deep(.el-table .el-button--text:hover) {
color: #5a64b5;
}
.el-button--success {
background: #5bc98c;
color: white;
}
:deep(.el-table .cell) {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.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; font-size: 14px;
} }
:deep(.el-input__suffix) { .server-actions {
right: 6px;
width: 15px;
height: 20px;
display: flex; display: flex;
justify-content: center; gap: 8px;
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(.el-table) {
.el-table__body-wrapper {
transition: height 0.3s ease;
}
}
.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);
overflow-y: auto;
} }
.copy-button {
font-size: 14px;
color: #5778ff;
} }
</style> </style>