perf(X-Pack): 系统参数-基础设置增加登录设置项

This commit is contained in:
fit2cloud-chenyw 2024-11-19 12:43:38 +08:00
parent e0ef4e4027
commit 3eb6bca5ac
7 changed files with 84 additions and 18 deletions

View File

@ -492,6 +492,7 @@ export default {
click_to_show: '点击显示',
click_to_hide: '点击隐藏',
basic_settings: '基础设置',
login_settings: '登录设置',
and_0_seconds: '0分0秒',
time_0_seconds: '分钟执行时间0秒',
and_0_seconds_de: '小时执行时间0分0秒',
@ -3080,7 +3081,10 @@ export default {
shareDisable: '禁用分享',
sharePeRequire: '分享有效期密码必填',
defaultSort: '资源默认排序方式',
defaultOpen: '页面打开方式'
defaultOpen: '页面打开方式',
loginLimit: '限制登录',
loginLimitRate: '限制登录失败次数()',
loginLimitTime: '限制登录失败时间()'
},
resource_sort: {
time_asc: '按创建时间升序',

View File

@ -12,7 +12,7 @@
<el-button type="primary" @click="edit">{{ t('commons.edit') }}</el-button>
</div>
</div>
<div class="info-template-content">
<div class="info-template-content clearfix">
<div class="info-content-item" v-for="item in settingList" :key="item.pkey">
<div class="info-item-label">
<span>{{ t(item.pkey) }}</span>
@ -222,7 +222,7 @@ formatLabel()
}
}
.info-template-container {
padding: 24px;
padding: 24px 24px 0;
.info-template-header {
display: flex;
margin-top: -4px;
@ -286,5 +286,10 @@ formatLabel()
}
}
}
.clearfix::after {
content: '';
display: table;
clear: both;
}
}
</style>

View File

@ -250,7 +250,8 @@ defineExpose({
item.pkey === 'pwdStrategy' ||
item.pkey === 'dip' ||
item.pkey === 'shareDisable' ||
item.pkey === 'sharePeRequire'
item.pkey === 'sharePeRequire' ||
item.pkey === 'loginLimit'
"
active-value="true"
inactive-value="false"
@ -290,7 +291,14 @@ defineExpose({
type="number"
/>
</div>
<div v-else-if="item.pkey === 'logLiveTime' || item.pkey === 'thresholdLogLiveTime'">
<div
v-else-if="
item.pkey === 'logLiveTime' ||
item.pkey === 'thresholdLogLiveTime' ||
item.pkey === 'loginLimitRate' ||
item.pkey === 'loginLimitTime'
"
>
<el-input-number
v-model="state.form[item.pkey]"
autocomplete="off"

View File

@ -4,14 +4,23 @@
:label-tooltips="tooltips"
setting-key="basic"
:setting-title="t('system.basic_settings')"
:setting-data="state.templateList"
:setting-data="baseInfoSettings"
@edit="edit"
/>
<InfoTemplate
ref="loginTemplate"
class="login-setting-template"
:label-tooltips="tooltips"
setting-key="basic"
:setting-title="t('system.login_settings')"
:setting-data="loginInoSettings"
@edit="edit"
/>
<basic-edit ref="editor" @saved="refresh" />
</template>
<script lang="ts" setup>
import { ref } from 'vue'
import { ref, computed, nextTick } from 'vue'
import InfoTemplate from '../../common/InfoTemplate.vue'
import BasicEdit from './BasicEdit.vue'
import request from '@/config/axios'
@ -22,6 +31,7 @@ import { useI18n } from '@/hooks/web/useI18n'
const { t } = useI18n()
const editor = ref()
const infoTemplate = ref()
const loginTemplate = ref()
const showDefaultLogin = ref(false)
const pvpOptions = [
{ value: '0', label: t('commons.date.permanent') },
@ -48,6 +58,14 @@ const tooltips = [
val: '开启后仪表板以及大屏分享无效'
}
]
const loginSettings = [
'setting_basic.dip',
'setting_basic.pvp',
'setting_basic.defaultLogin',
'setting_basic.loginLimit',
'setting_basic.loginLimitRate',
'setting_basic.loginLimitTime'
]
const state = reactive({
templateList: [] as SettingRecord[],
orgOptions: [],
@ -89,10 +107,21 @@ const selectedOName = ref('')
const selectedRid = ref<string[]>([])
const selectedRName = ref<string[]>([])
const selectedPvp = ref('0')
const baseInfoSettings = computed(() =>
state.templateList.filter(item => !loginSettings.includes(item.pkey))
)
const loginInoSettings = computed(() => {
const list = state.templateList.filter(item => loginSettings.includes(item.pkey))
console.log(list)
return list
})
const search = cb => {
const url = '/sysParameter/basic/query'
originData = []
state.templateList = []
const resultList = []
request.get({ url }).then(async res => {
originData = cloneDeep(res.data)
const data = res.data
@ -103,7 +132,8 @@ const search = cb => {
item.pkey === 'basic.dip' ||
item.pkey === 'basic.pwdStrategy' ||
item.pkey === 'basic.shareDisable' ||
item.pkey === 'basic.sharePeRequire'
item.pkey === 'basic.sharePeRequire' ||
item.pkey === 'basic.loginLimit'
) {
item.pval = item.pval === 'true' ? t('chart.open') : t('system.not_enabled')
} else if (item.pkey === 'basic.platformOid') {
@ -170,15 +200,19 @@ const search = cb => {
}
item.pkey = 'setting_' + item.pkey
if (!item.pkey.includes('defaultLogin') || showDefaultLogin.value) {
state.templateList.push(item)
resultList.push(item)
}
}
state.templateList.splice(0, resultList.length, ...resultList)
cb && cb()
})
}
const refresh = () => {
search(() => {
infoTemplate?.value.init()
nextTick(() => {
infoTemplate?.value.init()
loginTemplate?.value.init()
})
})
}
refresh()
@ -275,3 +309,11 @@ const resetDefaultLogin = () => {
}
}
</script>
<style lang="less" scoped>
.login-setting-template {
padding-top: 0;
:deep(button) {
display: none;
}
}
</style>

View File

@ -3,8 +3,8 @@
<el-tabs v-model="activeName">
<el-tab-pane v-for="item in tabArray" :key="item.name" :label="item.label" :name="item.name" />
</el-tabs>
<div class="sys-setting-p" :class="{ 'setting-auto-h': activeName !== 'map' }">
<div class="container-sys-param">
<div class="sys-setting-p">
<div class="container-sys-param" :class="{ 'setting-max-h': activeName === 'map' }">
<map-setting v-if="activeName === 'map'" />
<basic-info v-if="activeName === 'basic'" />
<engine-info v-if="activeName === 'engine'" />
@ -57,14 +57,15 @@ const addTable = tab => {
box-sizing: border-box;
margin-top: 12px;
}
.setting-auto-h {
height: auto !important;
}
.container-sys-param {
height: 100%;
overflow: hidden;
max-height: 100%;
height: auto;
overflow-y: auto;
background: var(--ContentBG, #ffffff);
border-radius: 4px;
}
.setting-max-h {
height: 100% !important;
}
</style>

View File

@ -13,4 +13,7 @@ public class XpackSettingConstants {
public static final String THRSHOLD_LOG_LIVE_TIME = "basic.thresholdLogLiveTime";
public static final String DEFAULT_SORT = "basic.defaultSort";
public static final String DEFAULT_OPEN = "basic.defaultOpen";
public static final String LOGIN_LIMIT = "basic.loginLimit";
public static final String LOGIN_LIMIT_RATE = "basic.loginLimitRate";
public static final String LOGIN_LIMIT_TIME = "basic.loginLimitTime";
}

View File

@ -15,7 +15,10 @@ public class SystemSettingUtils {
XpackSettingConstants.PVP,
XpackSettingConstants.PLATFORM_RID,
XpackSettingConstants.DEFAULT_LOGIN,
XpackSettingConstants.THRSHOLD_LOG_LIVE_TIME);
XpackSettingConstants.THRSHOLD_LOG_LIVE_TIME,
XpackSettingConstants.LOGIN_LIMIT,
XpackSettingConstants.LOGIN_LIMIT_RATE,
XpackSettingConstants.LOGIN_LIMIT_TIME);
return xpackSettingList.contains(pkey);
}
}