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"
:validate-event="false"
class="search-input"
suffix-icon="el-icon-search"
:suffix-icon="suffixIcon"
@blur="handleBlur"
@change="handleConfirm"
@focus="focus = true"
@focus="handleFocus"
@keyup.enter.native="handleConfirm"
@keyup.delete.native="handleDelete"
/>
<span class="keydown-focus" :class="isFocus ? 'is-focus ' : ''">t</span>
</div>
</template>
@@ -67,10 +68,12 @@ export default {
filterKey: '',
filterValue: '',
valueLabel: '',
suffixIcon: '',
emptyCount: 0,
filterTags: this.default || {},
focus: false,
showCascade: true
showCascade: true,
isFocus: false
}
},
computed: {
@@ -134,9 +137,22 @@ export default {
}
}
},
mounted() {
document.addEventListener('keyup', this.handleKeyUp)
},
beforeDestroy() {
document.removeEventListener('keyup', this.handleKeyUp)
},
methods: {
handleFocus() {
this.focus = true
this.isFocus = true
this.suffixIcon = 'el-icon-search'
},
handleBlur() {
this.focus = false
this.isFocus = false
this.suffixIcon = ''
this.$emit('blur')
},
// 获取url中的查询条件判断是不是包含在当前查询条件里
@@ -329,6 +345,14 @@ export default {
this.filterValue = v.value
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
checkUrlFields(evt) {
let newQuery = _.omit(this.$route.query, evt)
@@ -347,11 +371,16 @@ export default {
</script>
<style lang="scss" scoped>
$borderColor-neutral-muted: #afb8c133;
$bgColor-muted: #f6f8fa;
$origin-white-color: #ffffff;
.filter-field {
position: relative;
display: flex;
align-items: center;
min-width: 198px;
background-color: #fff;
min-width: 210px;
background-color: $origin-white-color;
.el-cascader {
height: 28px;
@@ -413,6 +442,25 @@ export default {
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 {

View File

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

View File

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

View File

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