mirror of
https://github.com/jumpserver/lina.git
synced 2025-07-09 21:23:45 +00:00
commit
d22d16681e
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ElFormRender from './components/el-form-renderer'
|
import ElFormRender from './components/el-form-renderer'
|
||||||
|
import { scrollToError } from '@/utils'
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
ElFormRender
|
ElFormRender
|
||||||
@ -76,6 +77,7 @@ export default {
|
|||||||
this.$emit('submit', form.getFormValue(), form, addContinue)
|
this.$emit('submit', form.getFormValue(), form, addContinue)
|
||||||
} else {
|
} else {
|
||||||
this.$emit('invalid', valid)
|
this.$emit('invalid', valid)
|
||||||
|
scrollToError(form.$el)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -86,8 +86,12 @@ export default {
|
|||||||
if (key === '') {
|
if (key === '') {
|
||||||
key = 'search'
|
key = 'search'
|
||||||
}
|
}
|
||||||
|
if (key.startsWith('search')) {
|
||||||
|
data['search'] = (data.search ? data.search + ',' : '') + value
|
||||||
|
} else {
|
||||||
data[key] = value
|
data[key] = value
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return data
|
return data
|
||||||
},
|
},
|
||||||
placeholder() {
|
placeholder() {
|
||||||
@ -109,6 +113,19 @@ export default {
|
|||||||
handler(val) {
|
handler(val) {
|
||||||
if (val && val.length > 0) {
|
if (val && val.length > 0) {
|
||||||
const routeFilter = this.checkInTableColumns()
|
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)
|
const asFilterTags = _.cloneDeep(this.filterTags)
|
||||||
this.filterTags = {
|
this.filterTags = {
|
||||||
...asFilterTags,
|
...asFilterTags,
|
||||||
@ -130,8 +147,7 @@ export default {
|
|||||||
if (Object.keys(this.filterMaps).length > 0) {
|
if (Object.keys(this.filterMaps).length > 0) {
|
||||||
return this.$emit('tagSearch', this.filterMaps)
|
return this.$emit('tagSearch', this.filterMaps)
|
||||||
}
|
}
|
||||||
}
|
}, 400)
|
||||||
, 400)
|
|
||||||
// this.$nextTick(() => this.$emit('tagSearch', this.filterMaps))
|
// this.$nextTick(() => this.$emit('tagSearch', this.filterMaps))
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -200,23 +216,29 @@ export default {
|
|||||||
this.$nextTick(() => this.$refs.Cascade.handleClear())
|
this.$nextTick(() => this.$refs.Cascade.handleClear())
|
||||||
},
|
},
|
||||||
handleTagClose(evt) {
|
handleTagClose(evt) {
|
||||||
this.checkUrlFilds(evt)
|
|
||||||
this.$delete(this.filterTags, evt)
|
this.$delete(this.filterTags, evt)
|
||||||
|
this.checkUrlFilds(evt)
|
||||||
this.$emit('tagSearch', this.filterMaps)
|
this.$emit('tagSearch', this.filterMaps)
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
handleConfirm() {
|
handleConfirm() {
|
||||||
if (!this.filterValue) return
|
if (this.filterValue === '') return
|
||||||
if (this.filterValue && !this.filterKey) {
|
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 }
|
const tag = { key: this.filterKey, label: this.keyLabel, value: this.filterValue, valueLabel: this.valueLabel }
|
||||||
this.$set(this.filterTags, this.filterKey, tag)
|
this.$set(this.filterTags, this.filterKey, tag)
|
||||||
this.$emit('tagSearch', this.filterMaps)
|
this.$emit('tagSearch', this.filterMaps)
|
||||||
|
|
||||||
|
// 修改查询参数时改变url中保存的参数
|
||||||
if (this.getUrlQuery) {
|
if (this.getUrlQuery) {
|
||||||
let newQuery = _.cloneDeep(this.$route.query)
|
let newQuery = _.cloneDeep(this.$route.query)
|
||||||
|
if (this.filterKey.startsWith('search')) {
|
||||||
|
newQuery = { ...newQuery, search: encodeURI(this.filterMaps.search) }
|
||||||
|
} else {
|
||||||
newQuery = { ...newQuery, [this.filterKey]: encodeURI(this.filterValue) }
|
newQuery = { ...newQuery, [this.filterKey]: encodeURI(this.filterValue) }
|
||||||
|
}
|
||||||
this.$router.replace({ query: newQuery })
|
this.$router.replace({ query: newQuery })
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,7 +271,15 @@ export default {
|
|||||||
},
|
},
|
||||||
// 删除查询条件时改变url
|
// 删除查询条件时改变url
|
||||||
checkUrlFilds(evt) {
|
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 })
|
this.$router.replace({ query: newQuery })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,3 +110,24 @@ export function param2Obj(url) {
|
|||||||
export function getDateTimeStamp(dateStr) {
|
export function getDateTimeStamp(dateStr) {
|
||||||
return Date.parse(dateStr.replace(/-/gi, '/'))
|
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 {
|
return {
|
||||||
tableConfig: {
|
tableConfig: {
|
||||||
url: `/api/v1/assets/cmd-filters/${this.object.id}/rules/`,
|
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: {
|
columnsMeta: {
|
||||||
type: {
|
type: {
|
||||||
width: '100px'
|
width: '100px'
|
||||||
},
|
},
|
||||||
|
ignore_case: {
|
||||||
|
width: '100px',
|
||||||
|
formatterArgs: {
|
||||||
|
showFalse: false
|
||||||
|
}
|
||||||
|
},
|
||||||
priority: {
|
priority: {
|
||||||
width: '70px'
|
width: '70px'
|
||||||
},
|
},
|
||||||
|
@ -28,7 +28,7 @@ export default {
|
|||||||
action: 0
|
action: 0
|
||||||
},
|
},
|
||||||
fields: [
|
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: {
|
fieldsMeta: {
|
||||||
filter: {
|
filter: {
|
||||||
|
@ -84,7 +84,7 @@ export default {
|
|||||||
// 这个页面不去提交auth这些
|
// 这个页面不去提交auth这些
|
||||||
const removeFields = [
|
const removeFields = [
|
||||||
'AUTH_CAS', 'AUTH_OPENID', 'AUTH_WECOM', 'AUTH_DINGTALK',
|
'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) {
|
for (const i of removeFields) {
|
||||||
delete data[i]
|
delete data[i]
|
||||||
|
@ -41,6 +41,7 @@ export default {
|
|||||||
[
|
[
|
||||||
'SECURITY_MFA_AUTH',
|
'SECURITY_MFA_AUTH',
|
||||||
'SECURITY_MFA_IN_LOGIN_PAGE',
|
'SECURITY_MFA_IN_LOGIN_PAGE',
|
||||||
|
'SECURITY_MFA_AUTH_ENABLED_FOR_THIRD_PARTY',
|
||||||
'SECURITY_LOGIN_CHALLENGE_ENABLED',
|
'SECURITY_LOGIN_CHALLENGE_ENABLED',
|
||||||
'SECURITY_LOGIN_CAPTCHA_ENABLED',
|
'SECURITY_LOGIN_CAPTCHA_ENABLED',
|
||||||
'SECURITY_PASSWORD_EXPIRATION_TIME',
|
'SECURITY_PASSWORD_EXPIRATION_TIME',
|
||||||
|
Loading…
Reference in New Issue
Block a user