Merge branch 'v4' of github.com:jumpserver/lina into v4

This commit is contained in:
ibuler
2024-05-23 18:26:06 +08:00
4 changed files with 69 additions and 20 deletions

View File

@@ -29,13 +29,14 @@
:placeholder="placeholder" :placeholder="placeholder"
:validate-event="false" :validate-event="false"
class="search-input" class="search-input"
suffix-icon="el-icon-search" :suffix-icon="suffixIcon"
@blur="handleBlur" @blur="handleBlur"
@change="handleConfirm" @change="handleConfirm"
@focus="focus = true" @focus="handleFocus"
@keyup.enter.native="handleConfirm" @keyup.enter.native="handleConfirm"
@keyup.delete.native="handleDelete" @keyup.delete.native="handleDelete"
/> />
<span class="keydown-focus" :class="isFocus ? 'is-focus ' : ''">t</span>
</div> </div>
</template> </template>
@@ -67,10 +68,12 @@ export default {
filterKey: '', filterKey: '',
filterValue: '', filterValue: '',
valueLabel: '', valueLabel: '',
suffixIcon: '',
emptyCount: 0, emptyCount: 0,
filterTags: this.default || {}, filterTags: this.default || {},
focus: false, focus: false,
showCascade: true showCascade: true,
isFocus: false
} }
}, },
computed: { computed: {
@@ -134,9 +137,22 @@ export default {
} }
} }
}, },
mounted() {
document.addEventListener('keyup', this.handleKeyUp)
},
beforeDestroy() {
document.removeEventListener('keyup', this.handleKeyUp)
},
methods: { methods: {
handleFocus() {
this.focus = true
this.isFocus = true
this.suffixIcon = 'el-icon-search'
},
handleBlur() { handleBlur() {
this.focus = false this.focus = false
this.isFocus = false
this.suffixIcon = ''
this.$emit('blur') this.$emit('blur')
}, },
// 获取url中的查询条件判断是不是包含在当前查询条件里 // 获取url中的查询条件判断是不是包含在当前查询条件里
@@ -329,6 +345,14 @@ export default {
this.filterValue = v.value this.filterValue = v.value
this.$refs.SearchInput.focus() this.$refs.SearchInput.focus()
}, },
handleKeyUp(event) {
// 检查按下的键是否是"T"键
if (event.key === 'T' || event.key === 't') {
this.$refs.SearchInput.focus()
this.suffixIcon = 'el-icon-search'
this.isFocus = true
}
},
// 删除查询条件时改变url // 删除查询条件时改变url
checkUrlFields(evt) { checkUrlFields(evt) {
let newQuery = _.omit(this.$route.query, evt) let newQuery = _.omit(this.$route.query, evt)
@@ -347,11 +371,16 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
$borderColor-neutral-muted: #afb8c133;
$bgColor-muted: #f6f8fa;
$origin-white-color: #ffffff;
.filter-field { .filter-field {
position: relative;
display: flex; display: flex;
align-items: center; align-items: center;
min-width: 198px; min-width: 210px;
background-color: #fff; background-color: $origin-white-color;
.el-cascader { .el-cascader {
height: 28px; height: 28px;
@@ -413,6 +442,25 @@ export default {
font-size: 13px; font-size: 13px;
} }
} }
.keydown-focus {
position: absolute;
right: 0;
display: inline-block;
margin-right: 10px;
padding: 3px 5px;
font-size: 11px;
color: var(--color-text-primary);
border: solid 1px $borderColor-neutral-muted;
border-radius: 6px;
line-height: 10px;
background-color: var(--bgColor-muted);
box-shadow: inset 0 -1px 0 $borderColor-neutral-muted;
&.is-focus {
display: none;
}
}
} }
.search-input2 >>> .el-input__inner { .search-input2 >>> .el-input__inner {

View File

@@ -114,7 +114,7 @@ export default {
} }
.box { .box {
margin-top: 16px; margin-top: 10px;
padding: 20px; padding: 20px;
background: #fff; background: #fff;

View File

@@ -104,7 +104,7 @@ export default {
padding: 26px 0 10px; padding: 26px 0 10px;
& >>> .echarts { & >>> .echarts {
width: 100% !important; width: 100% !important;
height: 272px !important; height: 278px !important;
} }
} }

View File

@@ -232,19 +232,20 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.echarts { .echarts {
width: 100%; width: 100%;
height: 266px; height: 272px;
}
@media print {
.disabled-when-print {
display: none;
} }
@media print { .enabled-when-print {
.disabled-when-print{ display: inherit !important;
display: none;
}
.enabled-when-print{
display: inherit !important;
}
.print-margin{
margin-top: 10px;
}
} }
.print-margin {
margin-top: 10px;
}
}
</style> </style>