feat:表格添加搜素框

This commit is contained in:
zhangyu
2020-09-10 09:18:37 +08:00
parent 1fd203a131
commit 5b30992694
5 changed files with 143 additions and 9 deletions

View File

@@ -14,6 +14,21 @@
<div class="right-box-title">Asset</div>
<!-- end--标题-->
<!-- begin搜素框-->
<div class="top-tools">
<div class="top-tool-main-right" :class="{'top-tool-main-right-to-left': false}">
<div class="top-tool-search">
<search-input :searchMsg="searchMsg" @search="search" :bottomBox.inTransform="true"></search-input>
</div>
<!--<button type="button" @click="showExportDialog" :title="$t('overall.exportExcelLower')"-->
<!--class="nz-btn nz-btn-size-normal nz-btn-style-light margin-l-20" id="alert-list-export">-->
<!--<i class="el-icon-download"></i>-->
<!--</button>-->
</div>
<div class="pagination-top pagination-top-hide display-none"></div>
</div>
<!-- end搜素框-->
<!-- begin--表格-->
<el-scrollbar class="right-box-form-box">
<el-table
@@ -169,6 +184,40 @@
show: true,
width: 100
},],
searchMsg: { //给搜索框子组件传递的信息
zheze_none: true,
searchLabelList: [{
id: 1,
name: 'ID',
type: 'input',
label: 'id',
disabled: false
},{
id: 20,
name: 'SN',
type: 'input',
label: 'sn',
disabled: false
},{
id: 21,
name: 'Host',
type: 'input',
label: 'host',
disabled: false
},{
id: 22,
name: this.$t("asset.state"),
type: 'select',
label: 'assetState',
disabled: false
},{
id: 23,
name: "pingStatus",
type: 'select',
label: 'pingStatus',
disabled: false
}],
},
tableData:[],
loading:false,
tableHeight:'100%',
@@ -264,6 +313,23 @@
this.tableTitle=this.tableTitle.filter(item=>item.prop!=='pingStatus');
}
},
search(searchObj) {
let orderBy = '';
if(this.searchLabel.orderBy){
orderBy = this.searchLabel.orderBy
}
this.searchLabel = {};
this.pageObj.pageNo = 1;
for (let item in searchObj) {
if (searchObj[item]) {
this.$set(this.searchLabel, item, searchObj[item]);
}
}
if(orderBy){
this.$set(this.searchLabel, 'orderBy', orderBy);
}
this.getAssetList();
},
},
}
@@ -288,6 +354,12 @@
/deep/.resize-box .danger{
background-color: #f9f9f9 !important;
}
.top-tools{
float: right;
}
/deep/ .top-tools>div{
margin-top: 6px;
}
/* end--table*/
</style>