update: 模型配置新增弹窗样式调整

This commit is contained in:
zhuoqinglian
2026-06-22 17:58:35 +08:00
parent 3c5ca9f143
commit ea48b948bf
2 changed files with 88 additions and 168 deletions
@@ -1,39 +1,38 @@
<template> <template>
<el-dialog :visible="dialogVisible" @update:visible="handleVisibleChange" width="57%" center <CustomDialog
custom-class="add-model-dialog" :show-close="false" class="center-dialog"> :visible.sync="dialogVisible"
<div style="margin: 0 18px; text-align: left; padding: 10px; border-radius: 10px;"> :title="$t('modelConfigDialog.addModel')"
<div style="font-size: 30px; color: #3d4566; margin-top: -10px; margin-bottom: 10px; text-align: center;"> width="57%"
{{ $t('modelConfigDialog.addModel') }} class="add-model-dialog"
</div> :confirmLoading="saving"
@close="handleClose"
<button class="custom-close-btn" @click="handleClose"> @confirm="confirm"
× >
</button> <div class="dialog-content">
<!-- 模型信息部分 --> <!-- 模型信息部分 -->
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;"> <div class="section-header">
<div style="font-size: 20px; font-weight: bold; color: #3d4566;">{{ $t('modelConfigDialog.modelInfo') }}</div> <div class="section-title">{{ $t('modelConfigDialog.modelInfo') }}</div>
<div style="display: flex; align-items: center; gap: 20px;"> <div class="switch-group">
<div style="display: flex; align-items: center;"> <div class="switch-item">
<span style="margin-right: 8px;">{{ $t('modelConfigDialog.enable') }}</span> <span>{{ $t('modelConfigDialog.enable') }}</span>
<el-switch v-model="formData.isEnabled" class="custom-switch"></el-switch> <el-switch v-model="formData.isEnabled" class="custom-switch"></el-switch>
</div> </div>
<div style="display: none; align-items: center;"> <div class="switch-item" style="display: none;">
<span style="margin-right: 8px;">{{ $t('modelConfigDialog.setDefault') }}</span> <span>{{ $t('modelConfigDialog.setDefault') }}</span>
<el-switch v-model="formData.isDefault" class="custom-switch"></el-switch> <el-switch v-model="formData.isDefault" class="custom-switch"></el-switch>
</div> </div>
</div> </div>
</div> </div>
<div style="height: 2px; background: #e9e9e9; margin-bottom: 22px;"></div> <div class="divider"></div>
<el-form :model="formData" label-width="100px" label-position="left" class="custom-form"> <el-form :model="formData" label-width="auto" label-position="left" class="custom-form">
<div style="display: flex; gap: 20px; margin-bottom: 0;"> <div class="form-row">
<el-form-item :label="$t('modelConfigDialog.modelId')" prop="id" style="flex: 1;"> <el-form-item :label="$t('modelConfigDialog.modelId')" prop="id" style="flex: 1;">
<el-input v-model="formData.id" :placeholder="$t('modelConfigDialog.enterModelId')" class="custom-input-bg" <el-input v-model="formData.id" :placeholder="$t('modelConfigDialog.enterModelId')" class="custom-input-bg"
maxlength="32"></el-input> maxlength="32"></el-input>
</el-form-item> </el-form-item>
</div> </div>
<div style="display: flex; gap: 20px; margin-bottom: 0;"> <div class="form-row">
<el-form-item :label="$t('modelConfigDialog.modelName')" prop="modelName" style="flex: 1;"> <el-form-item :label="$t('modelConfigDialog.modelName')" prop="modelName" style="flex: 1;">
<el-input v-model="formData.modelName" :placeholder="$t('modelConfigDialog.enterModelName')" <el-input v-model="formData.modelName" :placeholder="$t('modelConfigDialog.enterModelName')"
class="custom-input-bg"></el-input> class="custom-input-bg"></el-input>
@@ -44,7 +43,7 @@
</el-form-item> </el-form-item>
</div> </div>
<div style="display: flex; gap: 20px; margin-bottom: 0;"> <div class="form-row">
<el-form-item :label="$t('modelConfigDialog.supplier')" prop="supplier" style="flex: 1;"> <el-form-item :label="$t('modelConfigDialog.supplier')" prop="supplier" style="flex: 1;">
<el-select v-model="formData.supplier" :placeholder="$t('modelConfigDialog.selectSupplier')" <el-select v-model="formData.supplier" :placeholder="$t('modelConfigDialog.selectSupplier')"
class="custom-select custom-input-bg" style="width: 100%;" @focus="loadProviders" filterable> class="custom-select custom-input-bg" style="width: 100%;" @focus="loadProviders" filterable>
@@ -57,7 +56,6 @@
</el-form-item> </el-form-item>
</div> </div>
<el-form-item :label="$t('modelConfigDialog.docLink')" prop="docLink" style="margin-bottom: 27px;"> <el-form-item :label="$t('modelConfigDialog.docLink')" prop="docLink" style="margin-bottom: 27px;">
<el-input v-model="formData.docLink" :placeholder="$t('modelConfigDialog.enterDocLink')" <el-input v-model="formData.docLink" :placeholder="$t('modelConfigDialog.enterDocLink')"
class="custom-input-bg"></el-input> class="custom-input-bg"></el-input>
@@ -70,13 +68,13 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<div style="font-size: 20px; font-weight: bold; color: #3d4566; margin-bottom: 15px;">{{ <teleport v-if="chunkedCallInfoFields.length">
$t('modelConfigDialog.callInfo') }}</div> <div class="section-title">{{ $t('modelConfigDialog.callInfo') }}</div>
<div style="height: 2px; background: #e9e9e9; margin-bottom: 22px;"></div> <div class="divider"></div>
</teleport>
<el-form :model="formData.configJson" label-width="auto" label-position="left" class="custom-form"> <el-form :model="formData.configJson" label-width="auto" label-position="left" class="custom-form">
<div v-for="(row, rowIndex) in chunkedCallInfoFields" :key="rowIndex" <div v-for="(row, rowIndex) in chunkedCallInfoFields" :key="rowIndex" class="form-row">
style="display: flex; gap: 20px; margin-bottom: 0;">
<el-form-item v-for="field in row" :key="field.prop" :label="field.label" :prop="field.prop" style="flex: 1;"> <el-form-item v-for="field in row" :key="field.prop" :label="field.label" :prop="field.prop" style="flex: 1;">
<el-input v-model="formData.configJson[field.prop]" :placeholder="field.placeholder" <el-input v-model="formData.configJson[field.prop]" :placeholder="field.placeholder"
:type="field.type || 'text'" class="custom-input-bg" :show-password="field.type === 'password'"> :type="field.type || 'text'" class="custom-input-bg" :show-password="field.type === 'password'">
@@ -85,19 +83,17 @@
</div> </div>
</el-form> </el-form>
</div> </div>
</CustomDialog>
<div style="display: flex;justify-content: center;">
<el-button type="primary" @click="confirm" class="save-btn" :loading="saving" :disabled="saving">
{{ $t('modelConfigDialog.save') }}
</el-button>
</div>
</el-dialog>
</template> </template>
<script> <script>
import Api from '@/apis/api'; import Api from '@/apis/api';
import CustomDialog from './CustomDialog.vue';
export default { export default {
name: 'AddModelDialog', name: 'AddModelDialog',
components: {
CustomDialog
},
props: { props: {
visible: { type: Boolean, required: true }, visible: { type: Boolean, required: true },
modelType: { type: String, required: true } modelType: { type: String, required: true }
@@ -178,16 +174,10 @@ export default {
}); });
this.formData.configJson = { ...defaultConfig }; this.formData.configJson = { ...defaultConfig };
}, },
handleVisibleChange(val) {
this.dialogVisible = val;
this.$emit('update:visible', val);
if (!val) {
this.resetForm();
}
},
handleClose() { handleClose() {
this.saving = false; this.saving = false;
this.dialogVisible = false;
this.$emit('update:visible', false); this.$emit('update:visible', false);
}, },
initDynamicConfig() { initDynamicConfig() {
@@ -232,7 +222,7 @@ export default {
try { try {
this.$emit('confirm', submitData); this.$emit('confirm', submitData);
this.$emit('update:visible', false); this.handleClose();
this.resetForm(); this.resetForm();
} catch (e) { } catch (e) {
console.error(e); console.error(e);
@@ -297,134 +287,64 @@ export default {
} }
</script> </script>
<style> <style lang="scss" scoped>
::v-deep .el-dialog {
margin-top: 6vh !important;
}
.add-model-dialog { .add-model-dialog {
position: relative; .section-header {
border-radius: 20px; display: flex;
overflow: hidden; justify-content: space-between;
background: white; align-items: center;
padding-bottom: 17px; }
}
.add-model-dialog .el-dialog__header { .section-title {
padding: 0; margin-bottom: 10px;
border-bottom: none; font-size: 20px;
} font-weight: bold;
color: #3d4566;
text-align: left;
}
.center-dialog { .switch-group {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; gap: 20px;
} }
.center-dialog .el-dialog { .switch-item {
margin: 0 0 auto !important; display: flex;
display: flex; align-items: center;
flex-direction: column;
}
.custom-close-btn { span {
position: absolute; margin-right: 8px;
top: 20px; }
right: 20px; }
width: 35px;
height: 35px;
border-radius: 50%;
border: 2px solid #cfcfcf;
background: none;
font-size: 30px;
font-weight: lighter;
color: #cfcfcf;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
z-index: 1;
padding: 0;
outline: none;
}
.custom-close-btn:hover { .divider {
color: #409EFF; height: 1px;
border-color: #409EFF; background: #e9e9e9;
} margin-bottom: 16px;
}
.custom-select .el-input__suffix { .form-row {
background: #e6e8ea; display: flex;
right: 6px; gap: 20px;
width: 20px; margin-bottom: 0;
height: 20px; }
display: flex;
justify-content: center;
align-items: center;
top: 9px;
}
.custom-select .el-input__suffix-inner { .dialog-footer {
display: flex; display: flex;
align-items: center; justify-content: center;
justify-content: center; gap: 20px;
width: 100%; padding: 16px 20px;
} }
.custom-select .el-icon-arrow-up:before {
content: "";
display: inline-block;
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-top: 7px solid #c0c4cc;
position: relative;
top: -2px;
transform: rotate(180deg);
} }
.custom-form .el-form-item { .custom-form .el-form-item {
margin-bottom: 20px; margin-bottom: 10px;
} }
.custom-form .el-form-item__label {
color: #3d4566;
font-weight: normal;
text-align: right;
padding-right: 20px;
}
.custom-form .el-form-item.prop-remark .el-form-item__label {
margin-top: -4px;
}
.custom-input-bg .el-input__inner::-webkit-input-placeholder,
.custom-input-bg .el-textarea__inner::-webkit-input-placeholder {
color: #9c9f9e;
}
.custom-input-bg .el-input__inner,
.custom-input-bg .el-textarea__inner {
background-color: #ffffff;
}
.save-btn {
background: #e6f0fd;
color: #237ff4;
border: 1px solid #b3d1ff;
width: 150px;
height: 40px;
font-size: 16px;
transition: all 0.3s ease;
}
.save-btn:hover {
background: linear-gradient(to right, #237ff4, #9c40d5);
color: white;
border: none;
}
.custom-switch .el-switch__core { .custom-switch .el-switch__core {
border-radius: 20px; border-radius: 20px;
height: 23px; height: 23px;
@@ -439,7 +359,7 @@ export default {
background-color: white; background-color: white;
top: 3px; top: 3px;
left: 4px; left: 4px;
transition: all .3s; transition: all 0.3s;
} }
.custom-switch.is-checked .el-switch__core { .custom-switch.is-checked .el-switch__core {
@@ -454,12 +374,10 @@ export default {
background-color: #1b47ee; background-color: #1b47ee;
} }
[style*="display: flex"] {
gap: 20px;
}
.custom-input-bg .el-input__inner { .custom-input-bg .el-input__inner {
height: 32px; height: 32px;
} }
::v-deep .el-input__inner {
height: 32px;
}
</style> </style>
@@ -1,6 +1,6 @@
<template> <template>
<CustomDialog <CustomDialog
:title="title" :title="$t('modelConfigDialog.editModel')"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
width="57%" width="57%"
class="model-edit-dialog" class="model-edit-dialog"
@@ -57,8 +57,10 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<div class="section-title">{{ $t("modelConfigDialog.callInfo") }}</div> <teleport v-if="chunkedCallInfoFields.length">
<div class="section-divider"></div> <div class="section-title">{{ $t("modelConfigDialog.callInfo") }}</div>
<div class="section-divider"></div>
</teleport>
<el-form :model="form.configJson" ref="callInfoForm" label-width="auto"> <el-form :model="form.configJson" ref="callInfoForm" label-width="auto">
<template> <template>