弹框宽度和高度统一收口

同一批弹框的尺寸还是各管各的:模型配置里改参数那个是跟着窗口大小按比例伸缩,历史提示词的源编辑弹框是 900 像素,参数管理里又是 720 像素,智能体变更详情那个上下还留了一大块空白。这次收到同一个共用底子上:宽度都对齐到 720 像素,弹框默认上下贴齐屏幕边、内容多时中间滚动,变更详情那个高度撑到接近屏幕顶到底。
This commit is contained in:
hrz 2026-10-06 11:53:33 +08:00
parent 6b625dc740
commit 499c37020c
4 changed files with 43 additions and 28 deletions

View file

@ -2115,10 +2115,10 @@ export default {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow: hidden; overflow: hidden;
margin: 32px auto !important; margin: 5vh auto !important;
border-radius: 10px; border-radius: 10px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
max-height: calc(100vh - 64px); max-height: calc(100vh - 10vh);
} }
::v-deep .el-dialog__wrapper { ::v-deep .el-dialog__wrapper {

View file

@ -1,11 +1,13 @@
<template> <template>
<el-dialog <CustomDialog
:visible.sync="dialogVisible"
width="900px"
:title="$t('contextProviderDialog.title')" :title="$t('contextProviderDialog.title')"
:close-on-click-modal="false" :visible.sync="dialogVisible"
custom-class="context-provider-dialog" width="720px"
append-to-body class="context-provider-dialog"
:closeOnClickModal="false"
:confirmText="$t('contextProviderDialog.confirm')"
:cancelText="$t('contextProviderDialog.cancel')"
@confirm="handleConfirm"
> >
<div class="dialog-content"> <div class="dialog-content">
<el-empty v-if="localProviders.length === 0" :description="$t('contextProviderDialog.noContextApi')"> <el-empty v-if="localProviders.length === 0" :description="$t('contextProviderDialog.noContextApi')">
@ -51,7 +53,7 @@
size="small" size="small"
class="flex-1" class="flex-1"
></el-input> ></el-input>
<div class="row-controls"> <div class="row-controls">
<el-button <el-button
type="primary" type="primary"
@ -104,17 +106,15 @@
</div> </div>
</div> </div>
</div> </div>
</CustomDialog>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">{{ $t('contextProviderDialog.cancel') }}</el-button>
<el-button type="primary" @click="handleConfirm">{{ $t('contextProviderDialog.confirm') }}</el-button>
</span>
</el-dialog>
</template> </template>
<script> <script>
import CustomDialog from './CustomDialog.vue';
export default { export default {
name: 'ContextProviderDialog', name: 'ContextProviderDialog',
components: { CustomDialog },
props: { props: {
visible: { visible: {
type: Boolean, type: Boolean,
@ -157,7 +157,7 @@ export default {
headers: Object.entries(headers).map(([key, value]) => ({ key, value })) headers: Object.entries(headers).map(([key, value]) => ({ key, value }))
}; };
}); });
// 如果为空,添加一个默认块 // 如果为空,添加一个默认块
if (this.localProviders.length === 0) { if (this.localProviders.length === 0) {
this.localProviders.push({ url: '', headers: [{ key: '', value: '' }] }); this.localProviders.push({ url: '', headers: [{ key: '', value: '' }] });
@ -193,19 +193,22 @@ export default {
headers: headersObj headers: headersObj
}; };
}); });
this.$emit('confirm', result); this.$emit('confirm', result);
this.dialogVisible = false; this.$emit('update:visible', false);
} }
} }
}; };
</script> </script>
<style scoped> <style scoped>
.context-provider-dialog ::v-deep .el-dialog__body {
padding: 16px 20px;
}
.dialog-content { .dialog-content {
max-height: 60vh; max-height: calc(100vh - 280px);
overflow-y: auto; overflow-y: auto;
padding: 20px 25px; padding: 0 5px;
} }
.dialog-content::-webkit-scrollbar { .dialog-content::-webkit-scrollbar {
@ -230,7 +233,7 @@ export default {
flex: 1; flex: 1;
border-radius: 12px; border-radius: 12px;
border: 1px solid #e4e7ed; border: 1px solid #e4e7ed;
border-left: 4px solid #409EFF; /* 左侧强调色 */ border-left: 4px solid #409EFF;
background-color: #fff; background-color: #fff;
transition: all 0.3s ease; transition: all 0.3s ease;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05); box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
@ -261,7 +264,7 @@ export default {
text-align: right; text-align: right;
font-size: 13px; font-size: 13px;
white-space: nowrap; white-space: nowrap;
line-height: 32px; /* 垂直居中对齐 */ line-height: 32px;
} }
.flex-1 { .flex-1 {
@ -327,3 +330,4 @@ export default {
margin-right: 8px; margin-right: 8px;
} }
</style> </style>

View file

@ -129,6 +129,22 @@ export default {
border-radius: 10px; border-radius: 10px;
overflow: hidden; overflow: hidden;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
margin: 5vh auto !important;
display: flex;
flex-direction: column;
max-height: calc(100vh - 10vh);
}
::v-deep .el-dialog__wrapper {
display: flex;
align-items: center;
justify-content: center;
overflow: auto;
}
::v-deep .el-dialog__body {
max-height: calc(100vh - 220px);
overflow-y: auto;
} }
::v-deep + .v-modal { ::v-deep + .v-modal {

View file

@ -2,7 +2,7 @@
<CustomDialog <CustomDialog
:title="$t('modelConfigDialog.editModel')" :title="$t('modelConfigDialog.editModel')"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
width="57%" width="720px"
class="model-edit-dialog" class="model-edit-dialog"
:confirmLoading="saving" :confirmLoading="saving"
@confirm="handleSave" @confirm="handleSave"
@ -464,11 +464,6 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
@import '@/styles/global.scss'; @import '@/styles/global.scss';
::v-deep .el-dialog__body {
max-height: calc(100vh - 220px);
overflow-y: auto;
@include scrollbar-style;
}
.model-edit-dialog { .model-edit-dialog {
.header-row { .header-row {
display: flex; display: flex;