mirror of
https://github.com/jumpserver/lina.git
synced 2025-07-08 20:54:29 +00:00
commit
d22d16681e
@ -23,6 +23,7 @@
|
||||
|
||||
<script>
|
||||
import ElFormRender from './components/el-form-renderer'
|
||||
import { scrollToError } from '@/utils'
|
||||
export default {
|
||||
components: {
|
||||
ElFormRender
|
||||
@ -76,6 +77,7 @@ export default {
|
||||
this.$emit('submit', form.getFormValue(), form, addContinue)
|
||||
} else {
|
||||
this.$emit('invalid', valid)
|
||||
scrollToError(form.$el)
|
||||
return false
|
||||
}
|
||||
})
|
||||
|
@ -86,7 +86,11 @@ export default {
|
||||
if (key === '') {
|
||||
key = 'search'
|
||||
}
|
||||
data[key] = value
|
||||
if (key.startsWith('search')) {
|
||||
data['search'] = (data.search ? data.search + ',' : '') + value
|
||||
} else {
|
||||
data[key] = value
|
||||
}
|
||||
}
|
||||
return data
|
||||
},
|
||||
@ -109,6 +113,19 @@ export default {
|
||||
handler(val) {
|
||||
if (val && val.length > 0) {
|
||||
const routeFilter = this.checkInTableColumns()
|
||||
const routerSearch = routeFilter.search || {}
|
||||
const routerSearchArrs = routerSearch?.value?.split(',') || []
|
||||
const routerSearchArrsLength = routerSearchArrs.length || 0
|
||||
if (routerSearch && routerSearchArrsLength > 0) {
|
||||
for (let i = 0; i < routerSearchArrsLength; i++) {
|
||||
const cur = routerSearchArrs[i]
|
||||
routeFilter[`search_${cur}`] = {
|
||||
...routerSearch,
|
||||
value: cur
|
||||
}
|
||||
}
|
||||
delete routeFilter.search
|
||||
}
|
||||
const asFilterTags = _.cloneDeep(this.filterTags)
|
||||
this.filterTags = {
|
||||
...asFilterTags,
|
||||
@ -130,8 +147,7 @@ export default {
|
||||
if (Object.keys(this.filterMaps).length > 0) {
|
||||
return this.$emit('tagSearch', this.filterMaps)
|
||||
}
|
||||
}
|
||||
, 400)
|
||||
}, 400)
|
||||
// this.$nextTick(() => this.$emit('tagSearch', this.filterMaps))
|
||||
},
|
||||
methods: {
|
||||
@ -200,23 +216,29 @@ export default {
|
||||
this.$nextTick(() => this.$refs.Cascade.handleClear())
|
||||
},
|
||||
handleTagClose(evt) {
|
||||
this.checkUrlFilds(evt)
|
||||
this.$delete(this.filterTags, evt)
|
||||
this.checkUrlFilds(evt)
|
||||
this.$emit('tagSearch', this.filterMaps)
|
||||
return true
|
||||
},
|
||||
handleConfirm() {
|
||||
if (!this.filterValue) return
|
||||
if (this.filterValue === '') return
|
||||
if (this.filterValue && !this.filterKey) {
|
||||
this.filterKey = 'search'
|
||||
this.filterKey = Object.prototype.hasOwnProperty.call(this.filterTags, 'search')
|
||||
? 'search' + '_' + this.filterValue : 'search'
|
||||
}
|
||||
const tag = { key: this.filterKey, label: this.keyLabel, value: this.filterValue, valueLabel: this.valueLabel }
|
||||
this.$set(this.filterTags, this.filterKey, tag)
|
||||
this.$emit('tagSearch', this.filterMaps)
|
||||
|
||||
// 修改查询参数时改变url中保存的参数
|
||||
if (this.getUrlQuery) {
|
||||
let newQuery = _.cloneDeep(this.$route.query)
|
||||
newQuery = { ...newQuery, [this.filterKey]: encodeURI(this.filterValue) }
|
||||
if (this.filterKey.startsWith('search')) {
|
||||
newQuery = { ...newQuery, search: encodeURI(this.filterMaps.search) }
|
||||
} else {
|
||||
newQuery = { ...newQuery, [this.filterKey]: encodeURI(this.filterValue) }
|
||||
}
|
||||
this.$router.replace({ query: newQuery })
|
||||
}
|
||||
|
||||
@ -249,7 +271,15 @@ export default {
|
||||
},
|
||||
// 删除查询条件时改变url
|
||||
checkUrlFilds(evt) {
|
||||
const newQuery = _.omit(this.$route.query, evt)
|
||||
let newQuery = _.omit(this.$route.query, evt)
|
||||
if (this.getUrlQuery && evt.startsWith('search')) {
|
||||
if (newQuery.search) delete newQuery.search
|
||||
const filterMapsSearch = this.filterMaps.search || ''
|
||||
newQuery = {
|
||||
...newQuery,
|
||||
...(filterMapsSearch && { search: encodeURI(filterMapsSearch) })
|
||||
}
|
||||
}
|
||||
this.$router.replace({ query: newQuery })
|
||||
}
|
||||
}
|
||||
|
@ -110,3 +110,24 @@ export function param2Obj(url) {
|
||||
export function getDateTimeStamp(dateStr) {
|
||||
return Date.parse(dateStr.replace(/-/gi, '/'))
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动滚动到错误位置
|
||||
* @param {*} el 目标元素
|
||||
* @param {Object} 滚动参数 scrollOption={
|
||||
* behavior: 'smooth',
|
||||
* block: 'center'
|
||||
* }
|
||||
*/
|
||||
export const scrollToError = (
|
||||
el,
|
||||
scrollOption = {
|
||||
behavior: 'smooth',
|
||||
block: 'center'
|
||||
}
|
||||
) => {
|
||||
setTimeout(() => {
|
||||
const isError = el.getElementsByClassName('is-error')
|
||||
isError[0].scrollIntoView(scrollOption)
|
||||
}, 0)
|
||||
}
|
||||
|
@ -20,11 +20,17 @@ export default {
|
||||
return {
|
||||
tableConfig: {
|
||||
url: `/api/v1/assets/cmd-filters/${this.object.id}/rules/`,
|
||||
columns: ['type', 'content', 'action', 'priority', 'pattern', 'comment', 'actions'],
|
||||
columns: ['type', 'content', 'ignore_case', 'action', 'priority', 'pattern', 'comment', 'actions'],
|
||||
columnsMeta: {
|
||||
type: {
|
||||
width: '100px'
|
||||
},
|
||||
ignore_case: {
|
||||
width: '100px',
|
||||
formatterArgs: {
|
||||
showFalse: false
|
||||
}
|
||||
},
|
||||
priority: {
|
||||
width: '70px'
|
||||
},
|
||||
|
@ -28,7 +28,7 @@ export default {
|
||||
action: 0
|
||||
},
|
||||
fields: [
|
||||
[this.$t('common.Basic'), ['filter', 'type', 'content', 'priority', 'action', 'reviewers', 'comment']]
|
||||
[this.$t('common.Basic'), ['filter', 'type', 'content', 'ignore_case', 'priority', 'action', 'reviewers', 'comment']]
|
||||
],
|
||||
fieldsMeta: {
|
||||
filter: {
|
||||
|
@ -84,7 +84,7 @@ export default {
|
||||
// 这个页面不去提交auth这些
|
||||
const removeFields = [
|
||||
'AUTH_CAS', 'AUTH_OPENID', 'AUTH_WECOM', 'AUTH_DINGTALK',
|
||||
'AUTH_FEISHU', 'AUTH_RADIUS', 'AUTH_SSO'
|
||||
'AUTH_FEISHU', 'AUTH_RADIUS', 'AUTH_SSO', 'AUTH_SAML2'
|
||||
]
|
||||
for (const i of removeFields) {
|
||||
delete data[i]
|
||||
|
@ -41,6 +41,7 @@ export default {
|
||||
[
|
||||
'SECURITY_MFA_AUTH',
|
||||
'SECURITY_MFA_IN_LOGIN_PAGE',
|
||||
'SECURITY_MFA_AUTH_ENABLED_FOR_THIRD_PARTY',
|
||||
'SECURITY_LOGIN_CHALLENGE_ENABLED',
|
||||
'SECURITY_LOGIN_CAPTCHA_ENABLED',
|
||||
'SECURITY_PASSWORD_EXPIRATION_TIME',
|
||||
|
Loading…
Reference in New Issue
Block a user