update:优化输入框提示

This commit is contained in:
hrz
2025-09-28 18:25:29 +08:00
parent 8f3229ddda
commit d47664e670
2 changed files with 64 additions and 177 deletions
@@ -3,8 +3,8 @@
custom-class="custom-dialog" :show-close="false" class="center-dialog"> custom-class="custom-dialog" :show-close="false" class="center-dialog">
<div style="margin: 0 18px; text-align: left; padding: 10px; border-radius: 10px;"> <div style="margin: 0 18px; text-align: left; padding: 10px; border-radius: 10px;">
<div style="font-size: 30px; color: #3d4566; margin-top: -10px; margin-bottom: 10px; text-align: center;"> <div style="font-size: 30px; color: #3d4566; margin-top: -10px; margin-bottom: 10px; text-align: center;">
{{ $t('modelConfigDialog.addModel') }} {{ $t('modelConfigDialog.addModel') }}
</div> </div>
<button class="custom-close-btn" @click="handleClose"> <button class="custom-close-btn" @click="handleClose">
× ×
@@ -29,37 +29,43 @@
<el-form :model="formData" label-width="100px" label-position="left" class="custom-form"> <el-form :model="formData" label-width="100px" label-position="left" class="custom-form">
<div style="display: flex; gap: 20px; margin-bottom: 0;"> <div style="display: flex; gap: 20px; margin-bottom: 0;">
<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')" class="custom-input-bg"></el-input> <el-input v-model="formData.modelName" :placeholder="$t('modelConfigDialog.enterModelName')"
class="custom-input-bg"></el-input>
</el-form-item> </el-form-item>
<el-form-item :label="$t('modelConfigDialog.modelCode')" prop="modelCode" style="flex: 1;"> <el-form-item :label="$t('modelConfigDialog.modelCode')" prop="modelCode" style="flex: 1;">
<el-input v-model="formData.modelCode" :placeholder="$t('modelConfigDialog.enterModelCode')" class="custom-input-bg"></el-input> <el-input v-model="formData.modelCode" :placeholder="$t('modelConfigDialog.enterModelCode')"
class="custom-input-bg"></el-input>
</el-form-item> </el-form-item>
</div> </div>
<div style="display: flex; gap: 20px; margin-bottom: 0;"> <div style="display: flex; gap: 20px; margin-bottom: 0;">
<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')" class="custom-select custom-input-bg" <el-select v-model="formData.supplier" :placeholder="$t('modelConfigDialog.selectSupplier')"
style="width: 100%;" @focus="loadProviders" filterable> class="custom-select custom-input-bg" style="width: 100%;" @focus="loadProviders" filterable>
<el-option v-for="item in providers" :key="item.value" :label="item.label" :value="item.value" /> <el-option v-for="item in providers" :key="item.value" :label="item.label" :value="item.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label="$t('modelConfigDialog.sortOrder')" prop="sortOrder" style="flex: 1;"> <el-form-item :label="$t('modelConfigDialog.sortOrder')" prop="sortOrder" style="flex: 1;">
<el-input v-model="formData.sort" type="number" :placeholder="$t('modelConfigDialog.enterSortOrder')" class="custom-input-bg"></el-input> <el-input v-model="formData.sort" type="number" :placeholder="$t('modelConfigDialog.enterSortOrder')"
class="custom-input-bg"></el-input>
</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')" class="custom-input-bg"></el-input> <el-input v-model="formData.docLink" :placeholder="$t('modelConfigDialog.enterDocLink')"
class="custom-input-bg"></el-input>
</el-form-item> </el-form-item>
<el-form-item :label="$t('modelConfigDialog.remark')" prop="remark" class="prop-remark"> <el-form-item :label="$t('modelConfigDialog.remark')" prop="remark" class="prop-remark">
<el-input v-model="formData.remark" type="textarea" :rows="3" :placeholder="$t('modelConfigDialog.enterRemark')" :autosize="{ minRows: 3, maxRows: 5 }" <el-input v-model="formData.remark" type="textarea" :rows="3"
:placeholder="$t('modelConfigDialog.enterRemark')" :autosize="{ minRows: 3, maxRows: 5 }"
class="custom-input-bg"></el-input> class="custom-input-bg"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div style="font-size: 20px; font-weight: bold; color: #3d4566; margin-bottom: 15px;">{{ $t('modelConfigDialog.callInfo') }}</div> <div style="font-size: 20px; font-weight: bold; color: #3d4566; margin-bottom: 15px;">{{
$t('modelConfigDialog.callInfo') }}</div>
<div style="height: 2px; background: #e9e9e9; margin-bottom: 22px;"></div> <div style="height: 2px; background: #e9e9e9; margin-bottom: 22px;"></div>
<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">
@@ -77,12 +83,7 @@
</div> </div>
<div style="display: flex;justify-content: center;"> <div style="display: flex;justify-content: center;">
<el-button <el-button type="primary" @click="confirm" class="save-btn" :loading="saving" :disabled="saving">
type="primary"
@click="confirm"
class="save-btn"
:loading="saving"
:disabled="saving">
{{ $t('modelConfigDialog.save') }} {{ $t('modelConfigDialog.save') }}
</el-button> </el-button>
</div> </div>
@@ -159,7 +160,7 @@ export default {
label: f.label, label: f.label,
prop: f.key, prop: f.key,
type: f.type === 'password' ? 'password' : 'text', type: f.type === 'password' ? 'password' : 'text',
placeholder: `请输入${f.label}` placeholder: `请输入${f.key}`
})) }))
})) }))
this.providersLoaded = true this.providersLoaded = true
@@ -1,23 +1,14 @@
<template> <template>
<el-dialog <el-dialog :visible.sync="dialogVisible" :close-on-click-modal="false" width="57%" center custom-class="custom-dialog"
:visible.sync="dialogVisible" :show-close="false" class="center-dialog">
:close-on-click-modal="false"
width="57%"
center
custom-class="custom-dialog"
:show-close="false"
class="center-dialog"
>
<div style="margin: 0 18px; text-align: left; padding: 10px; border-radius: 10px"> <div style="margin: 0 18px; text-align: left; padding: 10px; border-radius: 10px">
<div <div style="
style="
font-size: 30px; font-size: 30px;
color: #3d4566; color: #3d4566;
margin-top: -10px; margin-top: -10px;
margin-bottom: 10px; margin-bottom: 10px;
text-align: center; text-align: center;
" ">
>
{{ {{
modelData.duplicateMode modelData.duplicateMode
? $t("modelConfigDialog.duplicateModel") ? $t("modelConfigDialog.duplicateModel")
@@ -27,198 +18,99 @@
<button class="custom-close-btn" @click="dialogVisible = false">×</button> <button class="custom-close-btn" @click="dialogVisible = false">×</button>
<div <div style="
style="
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin-bottom: 10px; margin-bottom: 10px;
" ">
>
<div style="font-size: 20px; font-weight: bold; color: #3d4566"> <div style="font-size: 20px; font-weight: bold; color: #3d4566">
{{ $t("modelConfigDialog.modelInfo") }} {{ $t("modelConfigDialog.modelInfo") }}
</div> </div>
<div style="display: flex; align-items: center; gap: 20px"> <div style="display: flex; align-items: center; gap: 20px">
<div style="display: flex; align-items: center"> <div style="display: flex; align-items: center">
<span style="margin-right: 8px">{{ $t("modelConfigDialog.enable") }}</span> <span style="margin-right: 8px">{{ $t("modelConfigDialog.enable") }}</span>
<el-switch <el-switch v-model="form.isEnabled" :active-value="1" :inactive-value="0" class="custom-switch"></el-switch>
v-model="form.isEnabled"
:active-value="1"
:inactive-value="0"
class="custom-switch"
></el-switch>
</div> </div>
<div style="display: none; align-items: center"> <div style="display: none; align-items: center">
<span style="margin-right: 8px">{{ <span style="margin-right: 8px">{{
$t("modelConfigDialog.setDefault") $t("modelConfigDialog.setDefault")
}}</span> }}</span>
<el-switch <el-switch v-model="form.isDefault" :active-value="1" :inactive-value="0" class="custom-switch"></el-switch>
v-model="form.isDefault"
:active-value="1"
:inactive-value="0"
class="custom-switch"
></el-switch>
</div> </div>
</div> </div>
</div> </div>
<div style="height: 2px; background: #e9e9e9; margin-bottom: 22px"></div> <div style="height: 2px; background: #e9e9e9; margin-bottom: 22px"></div>
<el-form <el-form :model="form" ref="form" label-width="auto" label-position="left" class="custom-form">
:model="form"
ref="form"
label-width="auto"
label-position="left"
class="custom-form"
>
<div style="display: flex; gap: 20px; margin-bottom: 0"> <div style="display: flex; gap: 20px; margin-bottom: 0">
<el-form-item <el-form-item :label="$t('modelConfigDialog.modelName')" prop="name" style="flex: 1">
:label="$t('modelConfigDialog.modelName')" <el-input v-model="form.modelName" :placeholder="$t('modelConfigDialog.enterModelName')"
prop="name" class="custom-input-bg"></el-input>
style="flex: 1"
>
<el-input
v-model="form.modelName"
:placeholder="$t('modelConfigDialog.enterModelName')"
class="custom-input-bg"
></el-input>
</el-form-item> </el-form-item>
<el-form-item <el-form-item :label="$t('modelConfigDialog.modelCode')" prop="code" style="flex: 1">
:label="$t('modelConfigDialog.modelCode')" <el-input v-model="form.modelCode" :placeholder="$t('modelConfigDialog.enterModelCode')"
prop="code" class="custom-input-bg"></el-input>
style="flex: 1"
>
<el-input
v-model="form.modelCode"
:placeholder="$t('modelConfigDialog.enterModelCode')"
class="custom-input-bg"
></el-input>
</el-form-item> </el-form-item>
</div> </div>
<div style="display: flex; gap: 20px; margin-bottom: 0"> <div style="display: flex; gap: 20px; margin-bottom: 0">
<el-form-item <el-form-item :label="$t('modelConfigDialog.supplier')" prop="supplier" style="flex: 1">
:label="$t('modelConfigDialog.supplier')" <el-select v-model="form.configJson.type" :placeholder="$t('modelConfigDialog.selectSupplier')"
prop="supplier" class="custom-select custom-input-bg" style="width: 100%" @focus="loadProviders" filterable>
style="flex: 1" <el-option v-for="item in providers" :key="item.value" :label="item.label" :value="item.value" />
>
<el-select
v-model="form.configJson.type"
:placeholder="$t('modelConfigDialog.selectSupplier')"
class="custom-select custom-input-bg"
style="width: 100%"
@focus="loadProviders"
filterable
>
<el-option
v-for="item in providers"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item <el-form-item :label="$t('modelConfigDialog.sortOrder')" prop="sort" style="flex: 1">
:label="$t('modelConfigDialog.sortOrder')" <el-input v-model.number="form.sort" type="number" :placeholder="$t('modelConfigDialog.enterSortOrder')"
prop="sort" class="custom-input-bg"></el-input>
style="flex: 1"
>
<el-input
v-model.number="form.sort"
type="number"
:placeholder="$t('modelConfigDialog.enterSortOrder')"
class="custom-input-bg"
></el-input>
</el-form-item> </el-form-item>
</div> </div>
<el-form-item <el-form-item :label="$t('modelConfigDialog.docLink')" prop="docUrl" style="margin-bottom: 27px">
:label="$t('modelConfigDialog.docLink')" <el-input v-model="form.docLink" :placeholder="$t('modelConfigDialog.enterDocLink')"
prop="docUrl" class="custom-input-bg"></el-input>
style="margin-bottom: 27px"
>
<el-input
v-model="form.docLink"
:placeholder="$t('modelConfigDialog.enterDocLink')"
class="custom-input-bg"
></el-input>
</el-form-item> </el-form-item>
<el-form-item <el-form-item :label="$t('modelConfigDialog.remark')" prop="remark" class="prop-remark">
:label="$t('modelConfigDialog.remark')" <el-input v-model="form.remark" type="textarea" :rows="3" :placeholder="$t('modelConfigDialog.enterRemark')"
prop="remark" :autosize="{ minRows: 3, maxRows: 5 }" class="custom-input-bg"></el-input>
class="prop-remark"
>
<el-input
v-model="form.remark"
type="textarea"
:rows="3"
:placeholder="$t('modelConfigDialog.enterRemark')"
:autosize="{ minRows: 3, maxRows: 5 }"
class="custom-input-bg"
></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div <div style="font-size: 20px; font-weight: bold; color: #3d4566; margin-bottom: 15px">
style="font-size: 20px; font-weight: bold; color: #3d4566; margin-bottom: 15px"
>
{{ $t("modelConfigDialog.callInfo") }} {{ $t("modelConfigDialog.callInfo") }}
</div> </div>
<div style="height: 2px; background: #e9e9e9; margin-bottom: 22px"></div> <div style="height: 2px; background: #e9e9e9; margin-bottom: 22px"></div>
<el-form <el-form :model="form.configJson" ref="callInfoForm" label-width="auto" class="custom-form">
:model="form.configJson"
ref="callInfoForm"
label-width="auto"
class="custom-form"
>
<template v-for="(row, rowIndex) in chunkedCallInfoFields"> <template v-for="(row, rowIndex) in chunkedCallInfoFields">
<div :key="rowIndex" style="display: flex; gap: 20px; margin-bottom: 0"> <div :key="rowIndex" style="display: flex; gap: 20px; margin-bottom: 0">
<el-form-item <el-form-item v-for="field in row" :key="field.prop" :label="field.label" :prop="field.prop"
v-for="field in row" style="flex: 1">
:key="field.prop"
:label="field.label"
:prop="field.prop"
style="flex: 1"
>
<template v-if="field.type === 'json-textarea'"> <template v-if="field.type === 'json-textarea'">
<el-input <el-input v-model="fieldJsonMap[field.prop]" type="textarea" :rows="3"
v-model="fieldJsonMap[field.prop]" :placeholder="$t('modelConfigDialog.enterJsonExample')" class="custom-input-bg"
type="textarea" @change="(val) => handleJsonChange(field.prop, val)" @focus="
:rows="3"
:placeholder="$t('modelConfigDialog.enterJsonExample')"
class="custom-input-bg"
@change="(val) => handleJsonChange(field.prop, val)"
@focus="
isSensitiveField(field.prop) isSensitiveField(field.prop)
? handleJsonInputFocus(field.prop, fieldJsonMap[field.prop]) ? handleJsonInputFocus(field.prop, fieldJsonMap[field.prop])
: undefined : undefined
" " @blur="
@blur="
isSensitiveField(field.prop) isSensitiveField(field.prop)
? handleJsonInputBlur(field.prop) ? handleJsonInputBlur(field.prop)
: undefined : undefined
" "></el-input>
></el-input>
</template> </template>
<el-input <el-input v-else v-model="form.configJson[field.prop]" :placeholder="field.placeholder" :type="field.type"
v-else class="custom-input-bg" :show-password="field.type === 'password'" @focus="
v-model="form.configJson[field.prop]"
:placeholder="field.placeholder"
:type="field.type"
class="custom-input-bg"
:show-password="field.type === 'password'"
@focus="
isSensitiveField(field.prop) isSensitiveField(field.prop)
? handleInputFocus(field.prop, form.configJson[field.prop]) ? handleInputFocus(field.prop, form.configJson[field.prop])
: undefined : undefined
" " @blur="
@blur="
isSensitiveField(field.prop) ? handleInputBlur(field.prop) : undefined isSensitiveField(field.prop) ? handleInputBlur(field.prop) : undefined
" "></el-input>
></el-input>
</el-form-item> </el-form-item>
</div> </div>
</template> </template>
@@ -226,13 +118,7 @@
</div> </div>
<div style="display: flex; justify-content: center"> <div style="display: flex; justify-content: center">
<el-button <el-button type="primary" @click="handleSave" class="save-btn" :loading="saving" :disabled="saving">
type="primary"
@click="handleSave"
class="save-btn"
:loading="saving"
:disabled="saving"
>
{{ $t("modelConfigDialog.save") }} {{ $t("modelConfigDialog.save") }}
</el-button> </el-button>
</div> </div>
@@ -442,9 +328,9 @@ export default {
f.type === "dict" f.type === "dict"
? "json-textarea" ? "json-textarea"
: f.type === "password" : f.type === "password"
? "password" ? "password"
: "text", : "text",
placeholder: `请输入${f.label}`, placeholder: `请输入${f.key}`,
})); }));
if (this.pendingModelData && this.pendingProviderType === providerCode) { if (this.pendingModelData && this.pendingProviderType === providerCode) {