mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
perf: Optimize application setting switch button control
This commit is contained in:
parent
e364d6e373
commit
21d2a44090
|
|
@ -172,7 +172,7 @@ export default {
|
|||
feishu: {
|
||||
selectDocument: 'Select Document',
|
||||
tip1: 'Supports document and table types, including TXT, Markdown, PDF, DOCX, HTML, XLS, XLSX, CSV, and ZIP formats;',
|
||||
tip2: 'The system does not store the original documents. Before importing a document, it is recommended to standardize the paragraph segmentation markings of the document.',
|
||||
tip2: 'The system does not store original documents. Before importing, Please ensure the document follows standardized paragraph markers',
|
||||
allCheck: 'Select All',
|
||||
errorMessage1: 'Please select a document'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,11 @@
|
|||
<el-table-column :label="$t('common.status.label')" width="70">
|
||||
<template #default="{ row }">
|
||||
<div @click.stop>
|
||||
<el-switch size="small" v-model="row.is_active" @change="changeState($event, row)" />
|
||||
<el-switch
|
||||
size="small"
|
||||
v-model="row.is_active"
|
||||
:before-change="() => changeState(row)"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
|
@ -104,17 +108,23 @@ function deleteApiKey(row: any) {
|
|||
.catch(() => {})
|
||||
}
|
||||
|
||||
function changeState(bool: Boolean, row: any) {
|
||||
function changeState(row: any) {
|
||||
const obj = {
|
||||
is_active: bool
|
||||
is_active: !row.is_active
|
||||
}
|
||||
const str = bool
|
||||
const str = obj.is_active
|
||||
? t('views.applicationOverview.appInfo.APIKeyDialog.enabledSuccess')
|
||||
: t('views.applicationOverview.appInfo.APIKeyDialog.disabledSuccess')
|
||||
overviewApi.putAPIKey(id as string, row.id, obj, loading).then((res) => {
|
||||
MsgSuccess(str)
|
||||
getApiKeyList()
|
||||
})
|
||||
overviewApi
|
||||
.putAPIKey(id as string, row.id, obj, loading)
|
||||
.then((res) => {
|
||||
MsgSuccess(str)
|
||||
getApiKeyList()
|
||||
return true
|
||||
})
|
||||
.catch(() => {
|
||||
return false
|
||||
})
|
||||
}
|
||||
|
||||
function createApiKey() {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@
|
|||
inline-prompt
|
||||
:active-text="$t('views.applicationOverview.appInfo.openText')"
|
||||
:inactive-text="$t('views.applicationOverview.appInfo.closeText')"
|
||||
@change="changeState($event)"
|
||||
:before-change="() => changeState(accessToken.is_active)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
@ -148,7 +148,12 @@
|
|||
{{ $t('views.applicationOverview.monitor.monitoringStatistics') }}
|
||||
</h4>
|
||||
<div class="mb-16">
|
||||
<el-select v-model="history_day" class="mr-12" @change="changeDayHandle" style="width:180px">
|
||||
<el-select
|
||||
v-model="history_day"
|
||||
class="mr-12"
|
||||
@change="changeDayHandle"
|
||||
style="width: 180px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dayOptions"
|
||||
:key="item.value"
|
||||
|
|
@ -331,13 +336,19 @@ function refreshAccessToken() {
|
|||
}
|
||||
function changeState(bool: Boolean) {
|
||||
const obj = {
|
||||
is_active: bool
|
||||
is_active: !bool
|
||||
}
|
||||
const str = bool ? t('common.status.enableSuccess') : t('common.status.disableSuccess')
|
||||
const str = obj.is_active ? t('common.status.enableSuccess') : t('common.status.disableSuccess')
|
||||
updateAccessToken(obj, str)
|
||||
.then(() => {
|
||||
return true
|
||||
})
|
||||
.catch(() => {
|
||||
return false
|
||||
})
|
||||
}
|
||||
|
||||
function updateAccessToken(obj: any, str: string) {
|
||||
async function updateAccessToken(obj: any, str: string) {
|
||||
applicationApi.putAccessToken(id as string, obj, loading).then((res) => {
|
||||
accessToken.value = res?.data
|
||||
MsgSuccess(str)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
</template>
|
||||
<div class="create-dataset__main flex" v-loading="loading">
|
||||
<div class="create-dataset__component main-calc-height">
|
||||
<div class="upload-document p-24">
|
||||
<div class="upload-document p-24" style="min-width: 850px">
|
||||
<h4 class="title-decoration-1 mb-8">
|
||||
{{ $t('views.document.feishu.selectDocument') }}
|
||||
</h4>
|
||||
|
|
@ -41,7 +41,7 @@
|
|||
@change="handleAllCheckChange"
|
||||
/>
|
||||
</div>
|
||||
<div style="height: calc(100vh - 430px)">
|
||||
<div style="height: calc(100vh - 450px)">
|
||||
<el-scrollbar>
|
||||
<el-tree
|
||||
:props="props"
|
||||
|
|
|
|||
|
|
@ -508,9 +508,6 @@ const open = (data: any) => {
|
|||
visible.value = true
|
||||
setTimeout(() => {
|
||||
showEditor.value = true
|
||||
nextTick(() => {
|
||||
onDragHandle()
|
||||
})
|
||||
}, 100)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue