perf: 优化弹出层

This commit is contained in:
wangdan-fit2cloud 2024-09-24 19:01:35 +08:00
parent a9d9e293a7
commit d4419d9ed5
24 changed files with 134 additions and 39 deletions

View File

@ -6,6 +6,8 @@
destroy-on-close destroy-on-close
append-to-body append-to-body
align-center align-center
:close-on-click-modal="false"
:close-on-press-escape="false"
> >
<div class="mb-8"> <div class="mb-8">
<el-scrollbar> <el-scrollbar>

View File

@ -1,5 +1,11 @@
<template> <template>
<el-dialog :title="$t('layout.topbar.avatar.apiKey')" v-model="dialogVisible" width="800"> <el-dialog
:title="$t('layout.topbar.avatar.apiKey')"
v-model="dialogVisible"
width="800"
:close-on-click-modal="false"
:close-on-press-escape="false"
>
<el-card shadow="never" class="layout-bg mb-16"> <el-card shadow="never" class="layout-bg mb-16">
<el-text type="info" class="color-secondary">{{ <el-text type="info" class="color-secondary">{{
$t('layout.topbar.avatar.apiServiceAddress') $t('layout.topbar.avatar.apiServiceAddress')

View File

@ -1,5 +1,10 @@
<template> <template>
<el-dialog v-model="resetPasswordDialog" :title="$t('layout.topbar.avatar.resetPassword')"> <el-dialog
v-model="resetPasswordDialog"
:title="$t('layout.topbar.avatar.resetPassword')"
:close-on-click-modal="false"
:close-on-press-escape="false"
>
<el-form <el-form
class="reset-password-form mb-24" class="reset-password-form mb-24"
ref="resetPasswordFormRef" ref="resetPasswordFormRef"

View File

@ -1,25 +1,33 @@
<template> <template>
<el-dialog :title="$t('views.applicationOverview.appInfo.SettingAPIKeyDialog.dialogTitle')" v-model="dialogVisible"> <el-dialog
:title="$t('views.applicationOverview.appInfo.SettingAPIKeyDialog.dialogTitle')"
v-model="dialogVisible"
:close-on-click-modal="false"
:close-on-press-escape="false"
>
<el-form label-position="top" ref="settingFormRef" :model="form"> <el-form label-position="top" ref="settingFormRef" :model="form">
<el-form-item :label="$t('views.applicationOverview.appInfo.SettingAPIKeyDialog.allowCrossDomainLabel')" <el-form-item
@click.prevent> :label="$t('views.applicationOverview.appInfo.SettingAPIKeyDialog.allowCrossDomainLabel')"
@click.prevent
>
<el-switch size="small" v-model="form.allow_cross_domain"></el-switch> <el-switch size="small" v-model="form.allow_cross_domain"></el-switch>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-input <el-input
v-model="form.cross_domain_list" v-model="form.cross_domain_list"
:placeholder="$t('views.applicationOverview.appInfo.SettingAPIKeyDialog.crossDomainPlaceholder')" :placeholder="
:rows="10" $t('views.applicationOverview.appInfo.SettingAPIKeyDialog.crossDomainPlaceholder')
type="textarea" "
:rows="10"
type="textarea"
/> />
</el-form-item> </el-form-item>
</el-form> </el-form>
<template #footer> <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
<el-button <el-button @click.prevent="dialogVisible = false">{{
@click.prevent="dialogVisible = false">{{ $t('views.applicationOverview.appInfo.SettingAPIKeyDialog.cancelButtonText')
$t('views.applicationOverview.appInfo.SettingAPIKeyDialog.cancelButtonText') }}</el-button>
}}</el-button>
<el-button type="primary" @click="submit(settingFormRef)" :loading="loading"> <el-button type="primary" @click="submit(settingFormRef)" :loading="loading">
{{ $t('views.applicationOverview.appInfo.SettingAPIKeyDialog.saveButtonText') }} {{ $t('views.applicationOverview.appInfo.SettingAPIKeyDialog.saveButtonText') }}
</el-button> </el-button>
@ -28,16 +36,16 @@
</el-dialog> </el-dialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import {ref, watch} from 'vue' import { ref, watch } from 'vue'
import {useRoute} from 'vue-router' import { useRoute } from 'vue-router'
import type {FormInstance} from 'element-plus' import type { FormInstance } from 'element-plus'
import overviewApi from '@/api/system-api-key' import overviewApi from '@/api/system-api-key'
import {MsgSuccess} from '@/utils/message' import { MsgSuccess } from '@/utils/message'
import {t} from '@/locales' import { t } from '@/locales'
const route = useRoute() const route = useRoute()
const { const {
params: {id} params: { id }
} = route } = route
const emit = defineEmits(['refresh']) const emit = defineEmits(['refresh'])
@ -66,8 +74,8 @@ const open = (data: any) => {
APIKeyId.value = data.id APIKeyId.value = data.id
form.value.allow_cross_domain = data.allow_cross_domain form.value.allow_cross_domain = data.allow_cross_domain
form.value.cross_domain_list = data.cross_domain_list?.length form.value.cross_domain_list = data.cross_domain_list?.length
? data.cross_domain_list?.join('\n') ? data.cross_domain_list?.join('\n')
: '' : ''
dialogVisible.value = true dialogVisible.value = true
} }
@ -78,10 +86,10 @@ const submit = async (formEl: FormInstance | undefined) => {
const obj = { const obj = {
allow_cross_domain: form.value.allow_cross_domain, allow_cross_domain: form.value.allow_cross_domain,
cross_domain_list: form.value.cross_domain_list cross_domain_list: form.value.cross_domain_list
? form.value.cross_domain_list.split('\n').filter(function (item: string) { ? form.value.cross_domain_list.split('\n').filter(function (item: string) {
return item !== '' return item !== ''
}) })
: [] : []
} }
overviewApi.putAPIKey(APIKeyId.value, obj, loading).then((res) => { overviewApi.putAPIKey(APIKeyId.value, obj, loading).then((res) => {
emit('refresh') emit('refresh')
@ -93,6 +101,6 @@ const submit = async (formEl: FormInstance | undefined) => {
}) })
} }
defineExpose({open}) defineExpose({ open })
</script> </script>
<style lang="scss" scope></style> <style lang="scss" scope></style>

View File

@ -1,5 +1,11 @@
<template> <template>
<el-dialog title="API Key" v-model="dialogVisible" width="800"> <el-dialog
title="API Key"
v-model="dialogVisible"
width="800"
:close-on-click-modal="false"
:close-on-press-escape="false"
>
<el-button type="primary" class="mb-16" @click="createApiKey"> <el-button type="primary" class="mb-16" @click="createApiKey">
{{ $t('views.applicationOverview.appInfo.APIKeyDialog.creatApiKey') }} {{ $t('views.applicationOverview.appInfo.APIKeyDialog.creatApiKey') }}
</el-button> </el-button>

View File

@ -1,5 +1,10 @@
<template> <template>
<el-dialog title="显示设置" v-model="dialogVisible"> <el-dialog
title="显示设置"
v-model="dialogVisible"
:close-on-click-modal="false"
:close-on-press-escape="false"
>
<el-form label-position="top" ref="displayFormRef" :model="form"> <el-form label-position="top" ref="displayFormRef" :model="form">
<el-form-item> <el-form-item>
<el-space direction="vertical" alignment="start"> <el-space direction="vertical" alignment="start">

View File

@ -2,6 +2,8 @@
<el-dialog <el-dialog
:title="$t('views.applicationOverview.appInfo.EditAvatarDialog.title')" :title="$t('views.applicationOverview.appInfo.EditAvatarDialog.title')"
v-model="dialogVisible" v-model="dialogVisible"
:close-on-click-modal="false"
:close-on-press-escape="false"
> >
<el-radio-group v-model="radioType" class="radio-block mb-16"> <el-radio-group v-model="radioType" class="radio-block mb-16">
<div> <div>

View File

@ -4,6 +4,8 @@
v-model="dialogVisible" v-model="dialogVisible"
width="900" width="900"
class="embed-dialog" class="embed-dialog"
:close-on-click-modal="false"
:close-on-press-escape="false"
> >
<el-row :gutter="12"> <el-row :gutter="12">
<el-col :span="12"> <el-col :span="12">
@ -71,9 +73,8 @@ const source1 = ref('')
const source2 = ref('') const source2 = ref('')
const urlParams1 = computed(() => props.apiInputParams ? '?' + props.apiInputParams : '') const urlParams1 = computed(() => (props.apiInputParams ? '?' + props.apiInputParams : ''))
const urlParams2 = computed(() => props.apiInputParams ? '&' + props.apiInputParams : '') const urlParams2 = computed(() => (props.apiInputParams ? '&' + props.apiInputParams : ''))
watch(dialogVisible, (bool) => { watch(dialogVisible, (bool) => {
if (!bool) { if (!bool) {
@ -103,7 +104,6 @@ src="${window.location.origin}/api/application/embed?protocol=${window.location.
dialogVisible.value = true dialogVisible.value = true
} }
defineExpose({ open }) defineExpose({ open })
</script> </script>
<style lang="scss" scope> <style lang="scss" scope>

View File

@ -2,6 +2,8 @@
<el-dialog <el-dialog
:title="$t('views.applicationOverview.appInfo.LimitDialog.dialogTitle')" :title="$t('views.applicationOverview.appInfo.LimitDialog.dialogTitle')"
v-model="dialogVisible" v-model="dialogVisible"
:close-on-click-modal="false"
:close-on-press-escape="false"
> >
<el-form label-position="top" ref="limitFormRef" :model="form"> <el-form label-position="top" ref="limitFormRef" :model="form">
<!-- <el-form-item <!-- <el-form-item

View File

@ -1,13 +1,23 @@
<template> <template>
<el-dialog :title="$t('views.applicationOverview.appInfo.SettingAPIKeyDialog.dialogTitle')" v-model="dialogVisible"> <el-dialog
:title="$t('views.applicationOverview.appInfo.SettingAPIKeyDialog.dialogTitle')"
v-model="dialogVisible"
:close-on-click-modal="false"
:close-on-press-escape="false"
>
<el-form label-position="top" ref="settingFormRef" :model="form"> <el-form label-position="top" ref="settingFormRef" :model="form">
<el-form-item :label="$t('views.applicationOverview.appInfo.SettingAPIKeyDialog.allowCrossDomainLabel')" @click.prevent> <el-form-item
:label="$t('views.applicationOverview.appInfo.SettingAPIKeyDialog.allowCrossDomainLabel')"
@click.prevent
>
<el-switch size="small" v-model="form.allow_cross_domain"></el-switch> <el-switch size="small" v-model="form.allow_cross_domain"></el-switch>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-input <el-input
v-model="form.cross_domain_list" v-model="form.cross_domain_list"
:placeholder="$t('views.applicationOverview.appInfo.SettingAPIKeyDialog.crossDomainPlaceholder')" :placeholder="
$t('views.applicationOverview.appInfo.SettingAPIKeyDialog.crossDomainPlaceholder')
"
:rows="10" :rows="10"
type="textarea" type="textarea"
/> />
@ -15,9 +25,11 @@
</el-form> </el-form>
<template #footer> <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
<el-button @click.prevent="dialogVisible = false">{{$t('views.applicationOverview.appInfo.SettingAPIKeyDialog.cancelButtonText')}}</el-button> <el-button @click.prevent="dialogVisible = false">{{
$t('views.applicationOverview.appInfo.SettingAPIKeyDialog.cancelButtonText')
}}</el-button>
<el-button type="primary" @click="submit(settingFormRef)" :loading="loading"> <el-button type="primary" @click="submit(settingFormRef)" :loading="loading">
{{$t('views.applicationOverview.appInfo.SettingAPIKeyDialog.saveButtonText')}} {{ $t('views.applicationOverview.appInfo.SettingAPIKeyDialog.saveButtonText') }}
</el-button> </el-button>
</span> </span>
</template> </template>

View File

@ -6,6 +6,8 @@
v-model="dialogVisible" v-model="dialogVisible"
style="width: 550px" style="width: 550px"
append-to-body append-to-body
:close-on-click-modal="false"
:close-on-press-escape="false"
> >
<DynamicsForm <DynamicsForm
v-model="form_data" v-model="form_data"

View File

@ -6,6 +6,8 @@
append-to-body append-to-body
class="addDataset-dialog" class="addDataset-dialog"
align-center align-center
:close-on-click-modal="false"
:close-on-press-escape="false"
> >
<template #header="{ titleId, titleClass }"> <template #header="{ titleId, titleClass }">
<div class="flex-between mb-8"> <div class="flex-between mb-8">

View File

@ -4,6 +4,8 @@
v-model="dialogVisible" v-model="dialogVisible"
width="650" width="650"
append-to-body append-to-body
:close-on-click-modal="false"
:close-on-press-escape="false"
> >
<el-form <el-form
ref="applicationFormRef" ref="applicationFormRef"

View File

@ -4,6 +4,8 @@
v-model="dialogVisible" v-model="dialogVisible"
width="650" width="650"
append-to-body append-to-body
:close-on-click-modal="false"
:close-on-press-escape="false"
> >
<el-form <el-form
ref="applicationFormRef" ref="applicationFormRef"

View File

@ -6,6 +6,8 @@
v-model="dialogVisible" v-model="dialogVisible"
style="width: 550px" style="width: 550px"
append-to-body append-to-body
:close-on-click-modal="false"
:close-on-press-escape="false"
> >
<div class="dialog-max-height"> <div class="dialog-max-height">
<el-scrollbar always> <el-scrollbar always>

View File

@ -1,5 +1,12 @@
<template> <template>
<el-dialog title="创建知识库" v-model="dialogVisible" width="680" append-to-body> <el-dialog
title="创建知识库"
v-model="dialogVisible"
width="680"
append-to-body
:close-on-click-modal="false"
:close-on-press-escape="false"
>
<!-- 基本信息 --> <!-- 基本信息 -->
<BaseForm ref="BaseFormRef" v-if="dialogVisible" /> <BaseForm ref="BaseFormRef" v-if="dialogVisible" />
<el-form <el-form

View File

@ -5,6 +5,8 @@
width="80%" width="80%"
destroy-on-close destroy-on-close
class="paragraph-dialog" class="paragraph-dialog"
:close-on-click-modal="false"
:close-on-press-escape="false"
> >
<el-row v-if="isConnect"> <el-row v-if="isConnect">
<el-col :span="18" class="p-24"> <el-col :span="18" class="p-24">

View File

@ -1,5 +1,12 @@
<template> <template>
<el-dialog title="选择知识库" v-model="dialogVisible" width="600" class="select-dataset-dialog"> <el-dialog
title="选择知识库"
v-model="dialogVisible"
width="600"
class="select-dataset-dialog"
:close-on-click-modal="false"
:close-on-press-escape="false"
>
<template #header="{ titleId, titleClass }"> <template #header="{ titleId, titleClass }">
<div class="my-header flex"> <div class="my-header flex">
<h4 :id="titleId" :class="titleClass">选择知识库</h4> <h4 :id="titleId" :class="titleClass">选择知识库</h4>

View File

@ -1,5 +1,12 @@
<template> <template>
<el-dialog title="修改标注" v-model="dialogVisible" width="600" class="edit-mark-dialog"> <el-dialog
title="修改标注"
v-model="dialogVisible"
width="600"
class="edit-mark-dialog"
:close-on-click-modal="false"
:close-on-press-escape="false"
>
<template #header="{ titleId, titleClass }"> <template #header="{ titleId, titleClass }">
<div class="flex-between"> <div class="flex-between">
<h4 :id="titleId" :class="titleClass">修改标注</h4> <h4 :id="titleId" :class="titleClass">修改标注</h4>

View File

@ -1,5 +1,11 @@
<template> <template>
<el-dialog title="选择知识库/文档" v-model="dialogVisible" width="500"> <el-dialog
title="选择知识库/文档"
v-model="dialogVisible"
width="500"
:close-on-click-modal="false"
:close-on-press-escape="false"
>
<el-form <el-form
ref="formRef" ref="formRef"
:model="form" :model="form"

View File

@ -5,6 +5,8 @@
width="80%" width="80%"
class="paragraph-dialog" class="paragraph-dialog"
destroy-on-close destroy-on-close
:close-on-click-modal="false"
:close-on-press-escape="false"
> >
<el-row v-loading="loading"> <el-row v-loading="loading">
<el-col :span="6"> <el-col :span="6">

View File

@ -7,6 +7,8 @@
label-position="top" label-position="top"
require-asterisk-position="right" require-asterisk-position="right"
@submit.prevent @submit.prevent
:close-on-click-modal="false"
:close-on-press-escape="false"
> >
<el-form-item :prop="isEdit ? '' : 'username'" label="用户名"> <el-form-item :prop="isEdit ? '' : 'username'" label="用户名">
<el-input <el-input

View File

@ -7,6 +7,8 @@
label-position="top" label-position="top"
require-asterisk-position="right" require-asterisk-position="right"
@submit.prevent @submit.prevent
:close-on-click-modal="false"
:close-on-press-escape="false"
> >
<el-form-item label="新密码" prop="password"> <el-form-item label="新密码" prop="password">
<el-input <el-input

View File

@ -6,6 +6,8 @@
v-model="dialogVisible" v-model="dialogVisible"
style="width: 550px" style="width: 550px"
append-to-body append-to-body
:close-on-click-modal="false"
:close-on-press-escape="false"
> >
<div> <div>
<el-scrollbar always> <el-scrollbar always>