mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-29 05:09:46 +01:00
feat: 完成参数管理页面改造
This commit is contained in:
parent
6859fdc90e
commit
2d9b915d51
9 changed files with 931 additions and 765 deletions
|
|
@ -80,7 +80,7 @@ export default {
|
|||
}).send()
|
||||
},
|
||||
// 保存
|
||||
addParam(data, callback) {
|
||||
addParam(data, callback, failCallback) {
|
||||
RequestService.sendRequest()
|
||||
.url(`${getServiceUrl()}/admin/params`)
|
||||
.method('POST')
|
||||
|
|
@ -89,6 +89,10 @@ export default {
|
|||
RequestService.clearRequestTime()
|
||||
callback(res)
|
||||
})
|
||||
.fail((err) => {
|
||||
RequestService.clearRequestTime()
|
||||
failCallback(err)
|
||||
})
|
||||
.networkFail((err) => {
|
||||
console.error('添加参数失败:', err)
|
||||
RequestService.reAjaxFun(() => {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ export default {
|
|||
type: {
|
||||
type: String,
|
||||
default: 'default',
|
||||
validator: (val) => ['default', 'confirm'].includes(val)
|
||||
validator: (val) => ['default', 'confirm', 'delete'].includes(val)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -23,29 +23,33 @@ export default {
|
|||
|
||||
<style lang="scss" scoped>
|
||||
.custom-button--default {
|
||||
background: transparent;
|
||||
color: #8099fc;
|
||||
border: 1px solid #adbdff;
|
||||
width: fit-content;
|
||||
background: #4998ff;
|
||||
color: #ffffff;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&.el-button--small {
|
||||
font-size: 14px;
|
||||
}
|
||||
&.el-button--medium {
|
||||
padding: 12px 20px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: #f1f2ff;
|
||||
color: #8099fc;
|
||||
border-color: #adbdff;
|
||||
box-shadow: 0 2px 8px rgba(128, 153, 252, 0.3);
|
||||
background: #62a4fc;
|
||||
color: #ffffff;
|
||||
border-color: transparent;
|
||||
box-shadow: 0 2px 8px rgba(74, 124, 253, 0.2);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
&.is-disabled,
|
||||
&.is-disabled:hover {
|
||||
background: transparent;
|
||||
color: #c0c4cc;
|
||||
border-color: #e4e7ed;
|
||||
background: linear-gradient(to right, #f0f3fe, #f5f6fe);
|
||||
color: rgba(74, 124, 253, 0.5);
|
||||
border-color: transparent;
|
||||
box-shadow: none;
|
||||
transform: none;
|
||||
cursor: not-allowed;
|
||||
|
|
@ -63,9 +67,11 @@ export default {
|
|||
&.el-button--small {
|
||||
font-size: 14px;
|
||||
}
|
||||
&.el-button--medium {
|
||||
padding: 12px 20px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: linear-gradient(to right, #6b8cff, #9a7cff);
|
||||
color: white;
|
||||
border-color: transparent;
|
||||
box-shadow: 0 2px 8px rgba(74, 124, 253, 0.3);
|
||||
|
|
@ -82,4 +88,37 @@ export default {
|
|||
cursor: not-allowed;
|
||||
}
|
||||
}
|
||||
|
||||
.custom-button--delete {
|
||||
width: fit-content;
|
||||
background: linear-gradient(to right, #ff6b6b, #ff8e8e);
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&.el-button--small {
|
||||
font-size: 14px;
|
||||
}
|
||||
&.el-button--medium {
|
||||
padding: 12px 20px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
color: white;
|
||||
border-color: transparent;
|
||||
box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
&.is-disabled,
|
||||
&.is-disabled:hover {
|
||||
background: linear-gradient(to right, #ffaaaa, #ffcaca);
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
border-color: transparent;
|
||||
box-shadow: none;
|
||||
transform: none;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -21,19 +21,20 @@
|
|||
<slot></slot>
|
||||
<template slot="footer">
|
||||
<div v-if="footer" class="dialog-footer">
|
||||
<el-button @click="handleCancel">{{ cancelText }}</el-button>
|
||||
<el-button :loading="confirmLoading" type="primary" @click="handleConfirm">
|
||||
<CustomButton @click="handleCancel">{{ cancelText }}</CustomButton>
|
||||
<CustomButton :loading="confirmLoading" type="confirm" @click="handleConfirm">
|
||||
<span class="confirm-inner">
|
||||
<img src="@/assets/knowledge-base/star.png" class="confirm-icon" />
|
||||
{{ confirmText }}
|
||||
</span>
|
||||
</el-button>
|
||||
</CustomButton>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CustomButton from './CustomButton.vue';
|
||||
export default {
|
||||
name: "CustomDialog",
|
||||
props: {
|
||||
|
|
@ -91,6 +92,9 @@ export default {
|
|||
dialogVisible: this.visible
|
||||
};
|
||||
},
|
||||
components: {
|
||||
CustomButton
|
||||
},
|
||||
watch: {
|
||||
visible(val) {
|
||||
this.dialogVisible = val;
|
||||
|
|
@ -195,7 +199,6 @@ export default {
|
|||
.dialog-footer {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 12px;
|
||||
|
||||
.el-button {
|
||||
padding: 10px 20px;
|
||||
|
|
|
|||
|
|
@ -46,9 +46,6 @@ export default {
|
|||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.pagination-wrapper {
|
||||
margin-top: 20px;
|
||||
}
|
||||
::v-deep .el-pagination {
|
||||
.btn-next,
|
||||
.btn-prev,
|
||||
|
|
|
|||
278
main/manager-web/src/components/CustomTable.vue
Normal file
278
main/manager-web/src/components/CustomTable.vue
Normal file
|
|
@ -0,0 +1,278 @@
|
|||
<template>
|
||||
<div class="custom-table-wrapper">
|
||||
<el-table
|
||||
ref="tableRef"
|
||||
:data="data"
|
||||
:class="['custom-table', tableClass]"
|
||||
height="100%"
|
||||
v-loading="loading"
|
||||
:element-loading-text="loadingText"
|
||||
:element-loading-spinner="loadingSpinner"
|
||||
:element-loading-background="loadingBackground"
|
||||
:header-cell-class-name="headerCellClassName"
|
||||
:row-class-name="rowClassName"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-click="handleRowClick"
|
||||
>
|
||||
<!-- 选择列 -->
|
||||
<el-table-column
|
||||
v-if="showSelection"
|
||||
width="55"
|
||||
align="center"
|
||||
label="选择"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<slot
|
||||
v-if="$scopedSlots.selection"
|
||||
name="selection"
|
||||
:row="scope.row"
|
||||
:$index="scope.$index"
|
||||
/>
|
||||
<el-checkbox
|
||||
v-else
|
||||
:value="scope.row.selected"
|
||||
@change="handleCheckboxChange(scope.row)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 动态列 -->
|
||||
<el-table-column
|
||||
v-for="column in columns"
|
||||
:key="column.prop"
|
||||
:prop="column.prop"
|
||||
:label="column.label"
|
||||
:width="column.width"
|
||||
:min-width="column.minWidth"
|
||||
:align="column.align || 'center'"
|
||||
:show-overflow-tooltip="column.showOverflowTooltip !== false"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<!-- 自定义插槽:优先使用 column.slot 指定的插槽名,否则用 column.prop 作为插槽名 -->
|
||||
<slot
|
||||
v-if="$scopedSlots[column.slot] || $scopedSlots[column.prop]"
|
||||
:name="column.slot || column.prop"
|
||||
:row="scope.row"
|
||||
:$index="scope.$index"
|
||||
:column="column"
|
||||
/>
|
||||
<!-- 默认显示 -->
|
||||
<template v-else>
|
||||
{{ scope.row[column.prop] }}
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 操作列 -->
|
||||
<el-table-column
|
||||
v-if="showOperations"
|
||||
:label="operationsLabel"
|
||||
align="center"
|
||||
:width="operationsWidth"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<slot name="operations" :row="scope.row" :$index="scope.$index" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页 -->
|
||||
<div class="table-footer">
|
||||
<slot name="footer-btns"></slot>
|
||||
<CustomPagination
|
||||
v-if="showPagination"
|
||||
:total="total"
|
||||
:current-page="currentPage"
|
||||
:page-size="pageSize"
|
||||
:page-size-options="pageSizeOptions"
|
||||
@size-change="handleSizeChange"
|
||||
@page-change="handlePageChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CustomPagination from './CustomPagination.vue';
|
||||
|
||||
export default {
|
||||
name: 'CustomTable',
|
||||
components: {
|
||||
CustomPagination
|
||||
},
|
||||
props: {
|
||||
// 表格数据
|
||||
data: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
// 列配置
|
||||
columns: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
// 是否显示选择框
|
||||
showSelection: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
// 是否显示操作列
|
||||
showOperations: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
operationsLabel: {
|
||||
type: String,
|
||||
default: '操作'
|
||||
},
|
||||
operationsWidth: {
|
||||
type: [String, Number],
|
||||
default: 180
|
||||
},
|
||||
// 分页相关
|
||||
showPagination: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
total: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
currentPage: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
pageSize: {
|
||||
type: Number,
|
||||
default: 10
|
||||
},
|
||||
pageSizeOptions: {
|
||||
type: Array,
|
||||
default: () => [10, 20, 50, 100]
|
||||
},
|
||||
// 加载状态
|
||||
loading: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
loadingText: {
|
||||
type: String,
|
||||
default: 'Loading'
|
||||
},
|
||||
loadingSpinner: {
|
||||
type: String,
|
||||
default: 'el-icon-loading'
|
||||
},
|
||||
loadingBackground: {
|
||||
type: String,
|
||||
default: 'rgba(255, 255, 255, 0.7)'
|
||||
},
|
||||
// 自定义类名
|
||||
tableClass: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
headerCellClassName: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
rowClassName: {
|
||||
type: [String, Function],
|
||||
default: ''
|
||||
},
|
||||
// 敏感值相关
|
||||
hideText: {
|
||||
type: String,
|
||||
default: '隐藏'
|
||||
},
|
||||
viewText: {
|
||||
type: String,
|
||||
default: '查看'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 掩码处理
|
||||
maskValue(value) {
|
||||
if (!value) return '';
|
||||
return '*'.repeat(Math.min(value.length, 8));
|
||||
},
|
||||
// 切换显示/隐藏
|
||||
toggleValue(row, prop) {
|
||||
this.$set(row, 'showValue', !row.showValue);
|
||||
},
|
||||
// 复选框变化
|
||||
handleCheckboxChange(row) {
|
||||
this.$set(row, 'selected', !row.selected);
|
||||
},
|
||||
// 分页事件
|
||||
handleSizeChange(val) {
|
||||
this.$emit('size-change', val);
|
||||
},
|
||||
handlePageChange(page) {
|
||||
this.$emit('page-change', page);
|
||||
},
|
||||
// 选择事件
|
||||
handleSelectionChange(selection) {
|
||||
this.$emit('selection-change', selection);
|
||||
},
|
||||
// 行点击事件
|
||||
handleRowClick(row, column, event) {
|
||||
this.$emit('row-click', row, column, event);
|
||||
},
|
||||
// 获取表格实例
|
||||
getTable() {
|
||||
return this.$refs.tableRef;
|
||||
},
|
||||
// 清除选择
|
||||
clearSelection() {
|
||||
this.$refs.tableRef && this.$refs.tableRef.clearSelection();
|
||||
},
|
||||
// 切换选择
|
||||
toggleRowSelection(row, selected) {
|
||||
this.$refs.tableRef && this.$refs.tableRef.toggleRowSelection(row, selected);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.custom-table-wrapper {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
.custom-table {
|
||||
width: 100%;
|
||||
border: 1px solid #eef3fd;
|
||||
border-bottom: none;
|
||||
border-radius: 6px;
|
||||
.el-table__body-wrapper {
|
||||
overflow-y: auto;
|
||||
&::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background: #a1c9fd;
|
||||
border-radius: 3px;
|
||||
}
|
||||
&::-webkit-scrollbar-track {
|
||||
background: #f0f3fe;
|
||||
border-radius: 3px;
|
||||
}
|
||||
}
|
||||
.el-table__header {
|
||||
th {
|
||||
color: #342f45;
|
||||
background: #edf2fc !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.table-footer {
|
||||
padding: 20px 0px 0px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,16 +1,14 @@
|
|||
<template>
|
||||
<el-dialog :title="title" :visible.sync="visible" width="520px" class="param-dialog-wrapper" :append-to-body="true"
|
||||
:close-on-click-modal="false" :key="dialogKey" custom-class="custom-param-dialog" :show-close="false">
|
||||
<CustomDialog
|
||||
:title="title"
|
||||
:visible.sync="visible"
|
||||
width="600px"
|
||||
class="param-dialog-wrapper"
|
||||
@confirm="submit"
|
||||
@close="cancel"
|
||||
:confirmLoading="saving"
|
||||
>
|
||||
<div class="dialog-container">
|
||||
<div class="dialog-header">
|
||||
<h2 class="dialog-title">{{ title }}</h2>
|
||||
<button class="custom-close-btn" @click="cancel">
|
||||
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M13 1L1 13M1 1L13 13" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<el-form :model="form" :rules="rules" ref="form" label-width="auto" label-position="left" class="param-form">
|
||||
<el-form-item :label="$t('paramDialog.paramCode')" prop="paramCode" class="form-item">
|
||||
<el-input v-model="form.paramCode" :placeholder="$t('paramDialog.paramCodePlaceholder')"
|
||||
|
|
@ -54,20 +52,12 @@
|
|||
class="custom-textarea"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submit" class="save-btn" :loading="saving" :disabled="saving">
|
||||
{{ $t('paramDialog.save') }}
|
||||
</el-button>
|
||||
<el-button @click="cancel" class="cancel-btn">
|
||||
{{ $t('paramDialog.cancel') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</CustomDialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CustomDialog from './CustomDialog.vue';
|
||||
export default {
|
||||
props: {
|
||||
title: {
|
||||
|
|
@ -89,6 +79,9 @@ export default {
|
|||
})
|
||||
}
|
||||
},
|
||||
components: {
|
||||
CustomDialog
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogKey: Date.now(),
|
||||
|
|
@ -210,61 +203,9 @@ export default {
|
|||
|
||||
<style scoped lang="scss">
|
||||
.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 {
|
||||
.form-item {
|
||||
margin-bottom: 20px;
|
||||
|
||||
:deep(.el-form-item__label) {
|
||||
color: #475569;
|
||||
font-weight: 500;
|
||||
|
|
@ -355,65 +296,5 @@ export default {
|
|||
margin-top: -4px;
|
||||
}
|
||||
}
|
||||
|
||||
.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>
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<CustomPagination
|
||||
class="pagination-wrapper"
|
||||
:total="total"
|
||||
:current-page="currentPage"
|
||||
:page-size="pageSize"
|
||||
|
|
@ -605,6 +606,10 @@ export default {
|
|||
}
|
||||
}
|
||||
|
||||
.pagination-wrapper {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
@media (max-width: 1144px) {
|
||||
.doc-grid {
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
|
|
|
|||
|
|
@ -1126,6 +1126,7 @@ export default {
|
|||
}
|
||||
|
||||
.slice-pagination {
|
||||
margin-top: 20px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,101 +1,88 @@
|
|||
<template>
|
||||
<div class="welcome">
|
||||
<HeaderBar />
|
||||
|
||||
<div class="operation-bar">
|
||||
<h2 class="page-title">{{ $t('paramManagement.pageTitle') }}</h2>
|
||||
<div class="right-operations">
|
||||
<el-input :placeholder="$t('paramManagement.searchPlaceholder')" v-model="searchCode"
|
||||
class="search-input" @keyup.enter.native="handleSearch" clearable />
|
||||
<el-button class="btn-search" @click="handleSearch">{{ $t('paramManagement.search') }}</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="main-wrapper">
|
||||
<div class="content-panel">
|
||||
<div class="content-area">
|
||||
<el-card class="params-card" shadow="never">
|
||||
<el-table ref="paramsTable" :data="paramsList" class="transparent-table" v-loading="loading"
|
||||
element-loading-text="Loading" element-loading-spinner="el-icon-loading"
|
||||
element-loading-background="rgba(255, 255, 255, 0.7)"
|
||||
:header-cell-class-name="headerCellClassName">
|
||||
<el-table-column :label="$t('modelConfig.select')" align="center" width="120">
|
||||
<template slot-scope="scope">
|
||||
<div class="operation-header">
|
||||
<h2 class="page-title">{{ $t('paramManagement.pageTitle') }}</h2>
|
||||
<div class="right-operations">
|
||||
<el-input :placeholder="$t('paramManagement.searchPlaceholder')" v-model="searchCode" class="search-input"
|
||||
@keyup.enter.native="handleSearch" clearable />
|
||||
<CustomButton icon="el-icon-search" type="confirm" @click="handleSearch">{{ $t('paramManagement.search') }}</CustomButton>
|
||||
</div>
|
||||
</div>
|
||||
<CustomTable
|
||||
ref="paramsTable"
|
||||
:data="paramsList"
|
||||
:columns="tableColumns"
|
||||
:loading="loading"
|
||||
:show-selection="true"
|
||||
:show-operations="true"
|
||||
:operations-label="$t('paramManagement.operation')"
|
||||
:total="total"
|
||||
:current-page="currentPage"
|
||||
:page-size="pageSize"
|
||||
:page-size-options="pageSizeOptions"
|
||||
:hide-text="$t('paramManagement.hide')"
|
||||
:view-text="$t('paramManagement.view')"
|
||||
@size-change="handlePageSizeChange"
|
||||
@page-change="goToPage"
|
||||
>
|
||||
<!-- 选择列自定义插槽 -->
|
||||
<template slot="selection" slot-scope="scope">
|
||||
<el-checkbox v-model="scope.row.selected"></el-checkbox>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('paramManagement.paramCode')" prop="paramCode"
|
||||
align="center"></el-table-column>
|
||||
<el-table-column :label="$t('paramManagement.paramValue')" prop="paramValue" align="center"
|
||||
show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
<template slot="paramValue" slot-scope="scope">
|
||||
<div v-if="isSensitiveParam(scope.row.paramCode)">
|
||||
<span v-if="!scope.row.showValue">
|
||||
{{ maskSensitiveValue(scope.row.paramValue) }}
|
||||
</span>
|
||||
<span v-else>{{ scope.row.paramValue }}</span>
|
||||
<el-button size="mini" type="text" @click="toggleSensitiveValue(scope.row)">
|
||||
{{ scope.row.showValue ? $t('paramManagement.hide') :
|
||||
$t('paramManagement.view') }}
|
||||
{{ scope.row.showValue ? $t('paramManagement.hide') : $t('paramManagement.view') }}
|
||||
</el-button>
|
||||
</div>
|
||||
<span v-else>{{ scope.row.paramValue }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('paramManagement.remark')" prop="remark"
|
||||
align="center"></el-table-column>
|
||||
<el-table-column :label="$t('paramManagement.operation')" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" @click="editParam(scope.row)">{{
|
||||
$t('paramManagement.edit') }}</el-button>
|
||||
<el-button size="mini" type="text" @click="deleteParam(scope.row)">{{
|
||||
$t('paramManagement.delete') }}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="table_bottom">
|
||||
<div class="ctrl_btn">
|
||||
<el-button size="mini" type="primary" class="select-all-btn" @click="handleSelectAll">
|
||||
{{ isAllSelected ? $t('paramManagement.deselectAll') :
|
||||
$t('paramManagement.selectAll') }}
|
||||
<!-- 操作列插槽 -->
|
||||
<template slot="operations" slot-scope="scope">
|
||||
<el-button size="mini" type="text" @click="editParam(scope.row)">
|
||||
{{ $t('paramManagement.edit') }}
|
||||
</el-button>
|
||||
<el-button size="mini" type="success" @click="showAddDialog">{{
|
||||
$t('paramManagement.add') }}</el-button>
|
||||
<el-button size="mini" type="danger" icon="el-icon-delete"
|
||||
@click="deleteSelectedParams">{{
|
||||
$t('paramManagement.delete') }}</el-button>
|
||||
</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>
|
||||
<el-button size="mini" type="text" @click="deleteParam(scope.row)">
|
||||
{{ $t('paramManagement.delete') }}
|
||||
</el-button>
|
||||
</template>
|
||||
<template slot="footer-btns">
|
||||
<div class="ctrl_btn">
|
||||
<CustomButton :icon="isAllSelected ? 'el-icon-circle-close' : 'el-icon-circle-check'" size="small" @click="handleSelectAll">
|
||||
{{ isAllSelected ? $t('paramManagement.deselectAll') : $t('paramManagement.selectAll') }}
|
||||
</CustomButton>
|
||||
<CustomButton icon="el-icon-plus" size="small" @click="showAddDialog">
|
||||
{{ $t('paramManagement.add') }}
|
||||
</CustomButton>
|
||||
<CustomButton size="small" type="delete" icon="el-icon-delete" @click="deleteSelectedParams">
|
||||
{{ $t('paramManagement.delete') }}
|
||||
</CustomButton>
|
||||
</div>
|
||||
</template>
|
||||
</CustomTable>
|
||||
</el-card>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 新增/编辑参数对话框 -->
|
||||
<param-dialog ref="paramDialog" :title="dialogTitle" :visible.sync="dialogVisible" :form="paramForm"
|
||||
@submit="handleSubmit" @cancel="dialogVisible = false" />
|
||||
<param-dialog
|
||||
ref="paramDialog"
|
||||
:title="dialogTitle"
|
||||
:visible.sync="dialogVisible"
|
||||
:form="paramForm"
|
||||
@submit="handleSubmit"
|
||||
@cancel="dialogVisible = false"
|
||||
/>
|
||||
<el-footer>
|
||||
<version-footer />
|
||||
</el-footer>
|
||||
|
|
@ -107,8 +94,12 @@ import Api from "@/apis/api";
|
|||
import HeaderBar from "@/components/HeaderBar.vue";
|
||||
import ParamDialog from "@/components/ParamDialog.vue";
|
||||
import VersionFooter from "@/components/VersionFooter.vue";
|
||||
import CustomButton from "@/components/CustomButton.vue";
|
||||
import CustomTable from "@/components/CustomTable.vue";
|
||||
import CustomDialog from "@/components/CustomDialog.vue";
|
||||
|
||||
export default {
|
||||
components: { HeaderBar, ParamDialog, VersionFooter },
|
||||
components: { HeaderBar, ParamDialog, VersionFooter, CustomButton, CustomTable, CustomDialog },
|
||||
data() {
|
||||
return {
|
||||
searchCode: "",
|
||||
|
|
@ -129,9 +120,11 @@ export default {
|
|||
valueType: "string",
|
||||
remark: ""
|
||||
},
|
||||
tableColumns: []
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.initTableColumns();
|
||||
this.fetchParams();
|
||||
|
||||
},
|
||||
|
|
@ -157,6 +150,27 @@ export default {
|
|||
},
|
||||
},
|
||||
methods: {
|
||||
initTableColumns() {
|
||||
this.tableColumns = [
|
||||
{
|
||||
prop: 'paramCode',
|
||||
label: this.$t('paramManagement.paramCode'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'paramValue',
|
||||
label: this.$t('paramManagement.paramValue'),
|
||||
align: 'center',
|
||||
sensitive: true,
|
||||
toggleable: true
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: this.$t('paramManagement.remark'),
|
||||
align: 'center'
|
||||
}
|
||||
];
|
||||
},
|
||||
handlePageSizeChange(val) {
|
||||
this.pageSize = val;
|
||||
this.currentPage = 1;
|
||||
|
|
@ -261,6 +275,15 @@ export default {
|
|||
this.$refs.paramDialog.resetSaving();
|
||||
}
|
||||
}
|
||||
}, ({ data }) => {
|
||||
this.$message.error({
|
||||
message: data.msg || this.$t('paramManagement.updateFailed'),
|
||||
showClose: true
|
||||
});
|
||||
// 调用ParamDialog的resetSaving方法重置保存状态
|
||||
if (this.$refs.paramDialog && typeof this.$refs.paramDialog.resetSaving === 'function') {
|
||||
this.$refs.paramDialog.resetSaving();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
@ -381,22 +404,25 @@ export default {
|
|||
}
|
||||
|
||||
.main-wrapper {
|
||||
// 顶部 63px 底部 35px 查询72px
|
||||
height: calc(100vh - 63px - 35px - 72px);
|
||||
margin: 0 22px;
|
||||
border-radius: 15px;
|
||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
|
||||
// 顶部 63px 底部 35px
|
||||
height: calc(100vh - 63px - 35px);
|
||||
padding: 20px 22px 0;
|
||||
position: relative;
|
||||
background: rgba(237, 242, 255, 0.5);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.operation-bar {
|
||||
.operation-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 16px 24px;
|
||||
justify-content: space-between;
|
||||
padding: 0 0 16px 0;
|
||||
}
|
||||
.divider {
|
||||
height: 1px;
|
||||
background: #f3f1f1;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.page-title {
|
||||
|
|
@ -421,7 +447,6 @@ export default {
|
|||
}
|
||||
|
||||
.content-panel {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
height: 100%;
|
||||
|
|
@ -450,7 +475,7 @@ export default {
|
|||
overflow: hidden;
|
||||
|
||||
::v-deep .el-card__body {
|
||||
padding: 15px;
|
||||
padding: 16px 22px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
|
|
@ -468,36 +493,6 @@ export default {
|
|||
|
||||
.ctrl_btn {
|
||||
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 {
|
||||
|
|
@ -568,43 +563,6 @@ export default {
|
|||
}
|
||||
}
|
||||
|
||||
: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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue