封装搜索、表格、新增表单

This commit is contained in:
qq787203167
2022-01-19 17:53:19 +08:00
parent fa0e712ccf
commit e634323ff3
9 changed files with 744 additions and 2 deletions
+78
View File
@@ -0,0 +1,78 @@
<template>
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :md="6" :sm="8" v-for="(item,index) in searchList" :key="index" style="line-height: 48px">
<div class="box-title-text">
<div class="title-text">
<span>{{item.enName}}</span><br>
<span>{{item.name}}</span>
</div>
<a-input class="box-input" :placeholder="item.placeholder" v-model="queryParam[item.attrModel]"></a-input>
</div>
</a-col>
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-col :md="6" :sm="24">
<a-button class="box-button" type="primary" @click="searchQuery">{{$t('query')}}</a-button>
<a-button class="box-button" style="margin-left: 8px" @click="searchReset">{{$t('reset')}}</a-button>
</a-col>
</span>
</a-row>
</a-form>
</template>
<script>
import eventBUs from '../../common/event.js'
export default {
name: 'index',
props: {
searchList: {
type: Array,
default: []
}
},
data() {
return {
queryParam: {}
}
},
mounted() {
},
methods: {
searchQuery() {
eventBUs.$emit('searchQuery', this.queryParam)
},
searchReset() {
this.queryParam = {}
eventBUs.$emit('searchQuery', this.queryParam)
}
}
}
</script>
<style scoped>
.box-title-text {
line-height: 1.4;
display: flex;
align-items: center;
}
.title-text {
display: inline-block;
font-weight: bold;
font-size: 14px;
margin-right: 16px;
}
.box-input {
display: inline-block;
width: 80%;
height: 38px;
margin-top: 2px;
}
.box-button {
height: 38px;
margin-top: 2px;
}
</style>