Files
dvcp_v2_webapp/ui/packages/layout/AiSearchBar.vue
aixianling ee15427e88 feat(ear-tag): 新增耳标登记功能
- 添加耳标登记页面,支持新增和编辑功能
- 实现养殖场、养殖舍、养殖栏的级联选择- 添加耳标信息的详细录入,包括生物芯片耳标号、电子耳标号等
-优化列表页面,增加搜索和筛选功能
- 重构表格组件,支持更多列类型和操作
2024-12-25 12:12:47 +08:00

114 lines
2.1 KiB
Vue

<template>
<section class="AiSearchBar" :class="{bottomBorder,isSingleRow,expand}">
<div ref="AiSearchBarZone" class="searchLeftZone">
<slot name="left"/>
</div>
<div class="searchRightZone" ref="searchRightZone" v-if="$slots.right">
<slot name="right"/>
</div>
<ai-pull-down v-if="!isSingleRow" v-model="expand"/>
</section>
</template>
<script>
export default {
name: "AiSearchBar",
props: {
bottomBorder: Boolean,
size: {default: "small"}
},
computed: {
isSingleRow: v => v.height <= 45
},
data() {
return {
height: 0,
rightHeight: 0,
searchBarStyle: {},
observer: null,
expand: false
}
},
methods: {
initSize() {
this.height = this.$refs?.AiSearchBarZone?.offsetHeight
this.rightHeight = this.$refs?.searchRightZone?.offsetHeight + 12
}
},
mounted() {
this.$nextTick(() => {
this.initSize()
this.observer = new ResizeObserver(this.initSize)
this.observer.observe(this.$refs?.AiSearchBarZone)
})
},
beforeDestroy() {
this.observer?.disconnect()
}
}
</script>
<style lang="scss" scoped>
.AiSearchBar {
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 10px;
padding-bottom: 36px;
position: relative;
height: 64px;
overflow: hidden;
&.isSingleRow {
height: 44px;
padding-bottom: 12px;
}
&.bottomBorder {
border-bottom: 1px solid #eee;
}
&.expand {
height: auto;
}
:deep(.searchLeftZone ) {
flex: 1;
min-width: 0;
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
overflow: hidden;
//height: 40px;
}
:deep(.searchRightZone ) {
display: flex;
align-items: center;
flex-shrink: 0;
align-self: flex-start;
.el-input {
width: 280px;
}
* + button, * + div, * + section {
margin-left: 8px;
}
}
.el-input {
width: auto;
}
}
.AiPullDown {
margin-top: 8px;
}
:deep( .searchLeftZone > .el-button), :deep( .searchRightZone > .el-button ) {
margin-left: 0;
}
</style>