update:优化了"新增/编辑参数"页面样式

This commit is contained in:
CGD
2025-04-10 11:59:46 +08:00
parent f16d0406ea
commit 3d8afac9e1
2 changed files with 272 additions and 35 deletions
+243 -18
View File
@@ -1,19 +1,48 @@
<template> <template>
<el-dialog :title="title" :visible.sync="visible" width="500px"> <el-dialog :title="title"
<el-form :model="form" :rules="rules" ref="form" label-width="100px"> :visible.sync="visible"
<el-form-item label="参数编码" prop="paramCode"> width="500px"
<el-input v-model="form.paramCode" placeholder="请输入参数编码"></el-input> class="param-dialog-wrapper"
</el-form-item> :append-to-body="true"
<el-form-item label="参数值" prop="paramValue"> :close-on-click-modal="false"
<el-input v-model="form.paramValue" placeholder="请输入参数值"></el-input> :key="dialogKey"
</el-form-item> custom-class="custom-param-dialog"
<el-form-item label="备注" prop="remark"> :show-close="false"
<el-input type="textarea" v-model="form.remark" placeholder="请输入备注"></el-input> >
</el-form-item> <div class="dialog-container">
</el-form> <div class="dialog-header">
<div slot="footer" class="dialog-footer"> <h2 class="dialog-title">{{ title }}</h2>
<el-button @click="cancel"> </el-button> <button class="custom-close-btn" @click="cancel">×</button>
<el-button type="primary" @click="submit"> </el-button> </div>
<el-form :model="form" :rules="rules" ref="form" label-width="100px" label-position="left" class="param-form">
<el-form-item label="参数编码" prop="paramCode" class="form-item">
<el-input v-model="form.paramCode" placeholder="请输入参数编码" class="custom-input"></el-input>
</el-form-item>
<el-form-item label="参数值" prop="paramValue" class="form-item">
<el-input v-model="form.paramValue" placeholder="请输入参数值" class="custom-input"></el-input>
</el-form-item>
<el-form-item label="值类型" prop="valueType" class="form-item">
<el-select v-model="form.valueType" placeholder="请选择值类型" class="custom-select">
<el-option v-for="item in valueTypeOptions" :key="item.value" :label="item.label" :value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="备注" prop="remark" class="form-item remark-item">
<el-input type="textarea" v-model="form.remark" placeholder="请输入备注" :rows="3" class="custom-textarea"></el-input>
</el-form-item>
</el-form>
<div class="dialog-footer">
<el-button type="primary" @click="submit" class="save-btn">
保存
</el-button>
<el-button @click="cancel" class="cancel-btn">
取消
</el-button>
</div>
</div> </div>
</el-dialog> </el-dialog>
</template> </template>
@@ -35,18 +64,29 @@ export default {
id: null, id: null,
paramCode: '', paramCode: '',
paramValue: '', paramValue: '',
valueType: 'string',
remark: '' remark: ''
}) })
} }
}, },
data() { data() {
return { return {
dialogKey: Date.now(),
valueTypeOptions: [
{ value: 'string', label: '字符串(string)' },
{ value: 'number', label: '数字(number)' },
{ value: 'boolean', label: '布尔值(boolean)' },
{ value: 'array', label: '数组(array)' }
],
rules: { rules: {
paramCode: [ paramCode: [
{ required: true, message: "请输入参数编码", trigger: "blur" } { required: true, message: "请输入参数编码", trigger: "blur" }
], ],
paramValue: [ paramValue: [
{ required: true, message: "请输入参数值", trigger: "blur" } { required: true, message: "请输入参数值", trigger: "blur" }
],
valueType: [
{ required: true, message: "请选择值类型", trigger: "change" }
] ]
} }
}; };
@@ -62,12 +102,197 @@ export default {
cancel() { cancel() {
this.$emit('cancel'); this.$emit('cancel');
} }
},
watch: {
visible(newVal) {
if (newVal) {
this.dialogKey = Date.now();
}
}
} }
}; };
</script> </script>
<style scoped> <style>
.dialog-footer { .custom-param-dialog {
text-align: right; border-radius: 20px !important;
overflow: hidden;
.el-dialog__header {
display: none;
}
.el-dialog__body {
padding: 0 !important;
border-radius: 20px;
}
}
</style>
<style scoped lang="scss">
.param-dialog-wrapper {
.dialog-container {
padding: 20px 30px;
}
.dialog-header {
position: relative;
margin-bottom: 20px;
text-align: center;
}
.dialog-title {
font-size: 24px;
color: #3d4566;
margin: 0;
padding: 0;
font-weight: normal;
}
.custom-close-btn {
position: absolute;
top: 0;
right: 0;
width: 35px;
height: 35px;
border-radius: 50%;
border: 2px solid #cfcfcf;
background: none;
font-size: 24px;
color: #cfcfcf;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
padding: 0;
outline: none;
transition: all 0.2s ease;
&:hover {
color: #409EFF;
border-color: #409EFF;
}
}
.param-form {
.form-item {
margin-bottom: 20px;
:deep(.el-form-item__label) {
color: #3d4566;
font-weight: normal;
padding-right: 20px;
text-align: right;
}
}
.custom-input {
:deep(.el-input__inner) {
background-color: #f6f8fc;
border-radius: 8px;
border: 1px solid #e0e3e9;
height: 40px;
padding: 0 12px;
transition: all 0.3s;
&:focus {
border-color: #5b8cff;
box-shadow: 0 0 0 2px rgba(91, 140, 255, 0.2);
background-color: #fff;
}
&::placeholder {
color: #9c9f9e;
}
}
}
.custom-select {
width: 100%;
:deep(.el-input__inner) {
background-color: #f6f8fc;
border-radius: 8px;
border: 1px solid #e0e3e9;
height: 40px;
transition: all 0.3s;
&:focus {
border-color: #5b8cff;
box-shadow: 0 0 0 2px rgba(91, 140, 255, 0.2);
background-color: #fff;
}
&::placeholder {
color: #9c9f9e;
}
}
}
.custom-textarea {
:deep(.el-textarea__inner) {
background-color: #f6f8fc;
border-radius: 8px;
border: 1px solid #e0e3e9;
padding: 12px;
transition: all 0.3s;
&:focus {
border-color: #5b8cff;
box-shadow: 0 0 0 2px rgba(91, 140, 255, 0.2);
background-color: #fff;
}
&::placeholder {
color: #9c9f9e;
}
}
}
.remark-item :deep(.el-form-item__label) {
margin-top: -4px;
}
}
.dialog-footer {
display: flex;
justify-content: center;
padding: 15px 0 0;
margin-top: 10px;
.save-btn {
width: 120px;
height: 40px;
font-size: 16px;
border-radius: 8px;
transition: all 0.3s ease;
background: #e6f0fd;
color: #237ff4;
border: 1px solid #b3d1ff;
&:hover {
background: #237ff4;
color: white;
border: none;
}
}
.cancel-btn {
width: 120px;
height: 40px;
font-size: 16px;
border-radius: 8px;
transition: all 0.3s ease;
background: #f6f8fc;
color: #3d4566;
border: 1px solid #e0e3e9;
margin-left: 20px;
&:hover {
background: #e9e9e9;
border-color: #d9d9d9;
}
}
}
} }
</style> </style>
+29 -17
View File
@@ -33,9 +33,9 @@
<div class="ctrl_btn"> <div class="ctrl_btn">
<el-button size="mini" type="primary" class="select-all-btn" <el-button size="mini" type="primary" class="select-all-btn"
@click="handleSelectAll">全选</el-button> @click="handleSelectAll">全选</el-button>
<el-button size="mini" type="success" @click="showAddDialog">新增</el-button>
<el-button size="mini" type="danger" icon="el-icon-delete" <el-button size="mini" type="danger" icon="el-icon-delete"
@click="batchDelete">删除</el-button> @click="batchDelete">删除</el-button>
<el-button size="mini" type="primary" @click="showAddDialog">新增参数</el-button>
</div> </div>
<div class="custom-pagination"> <div class="custom-pagination">
<button class="pagination-btn" :disabled="currentPage === 1" @click="goFirst"> <button class="pagination-btn" :disabled="currentPage === 1" @click="goFirst">
@@ -486,24 +486,36 @@ export default {
} }
@media (min-width: 1144px) { @media (min-width: 1144px) {
.table_bottom { .table_bottom {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin-top: 40px; margin-top: 40px;
} }
:deep(.transparent-table) { :deep(.transparent-table) {
.el-table__body tr { .el-table__body tr {
td { td {
padding-top: 16px; padding-top: 16px;
padding-bottom: 16px; padding-bottom: 16px;
} }
&+tr { & + 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;
}
</style> </style>