Skip to content

Commit

Permalink
perf: 代码优化移除多余代码
Browse files Browse the repository at this point in the history
  • Loading branch information
BoBoooooo committed Jan 12, 2021
1 parent a5b4ca7 commit 3513446
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 51 deletions.
4 changes: 0 additions & 4 deletions src/component/crud-table/src/CrudTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,6 @@
<!-- 分页 -->
<div style="overflow:hidden;background:white"
class="mt-8">
<!-- 表格底部左侧功能按钮 -->
<div style="float:left">
<slot name="bottom-btn"></slot>
</div>
<el-pagination v-if="showPagination"
:current-page="pagination.pageIndex"
:page-sizes="pageSizes"
Expand Down
77 changes: 30 additions & 47 deletions src/component/crud-table/src/SearchForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,54 +7,41 @@

<template>
<div class="search-form-container">
<el-input
placeholder="请输入查询内容"
@clear="clearEvent"
clearable
@change="changeEvent"
v-model="searchContent"
class="input"
>
<el-input placeholder="请输入查询内容"
@clear="clearEvent"
clearable
@change="changeEvent"
v-model="searchContent"
class="input">
</el-input>
<el-button-group>
<el-button
size="mini"
type="primary"
icon="el-icon-search"
@click="btnSearchOnClick()"
class="tool-btn"
>查询</el-button
>
<el-button size="mini"
type="primary"
icon="el-icon-search"
@click="btnSearchOnClick()"
class="tool-btn">查询</el-button>
<!-- 高级查询表单 -->
<SeniorSearchForm
v-if="showSeniorSearchFormButton"
:remoteFuncs="remoteFuncs"
@fetchSearch="getFetchParamsSearch"
:columns="columns"
>
<SeniorSearchForm v-if="showSeniorSearchFormButton && !$slots.seniorSearchForm"
:remoteFuncs="remoteFuncs"
@fetchSearch="getFetchParamsSearch"
:columns="columns">
</SeniorSearchForm>
<!-- 自定义高级查询表单-->
<slot name="seniorSearchForm"></slot>

<el-button
size="mini"
icon="el-icon-refresh"
@click="clearEvent()"
class="tool-btn"
>清空</el-button
>
<el-button size="mini"
icon="el-icon-refresh"
@click="clearEvent()"
class="tool-btn">清空</el-button>
</el-button-group>
<div class="tips">
<!-- 提示当前查询内容 -->
<template v-if="isArray">
<el-tag
v-for="(item, index) in paramsTips"
size="small"
effect="plain"
:key="index"
closable
@close="handleClose(item)"
>
<el-tag v-for="(item, index) in paramsTips"
size="small"
effect="plain"
:key="index"
closable
@close="handleClose(item)">
{{ item.label + ":" + item.value }}
</el-tag>
</template>
Expand Down Expand Up @@ -104,9 +91,7 @@ export default class SearchForm extends Vue {

// 标签关闭事件
handleClose(tag) {
this.paramsTips = this.paramsTips.filter(
item => item.field !== tag.field,
);
this.paramsTips = this.paramsTips.filter(item => item.field !== tag.field);
this.$emit(
'update:searchFormCondition',
this.paramsTips.map(item => ({
Expand Down Expand Up @@ -137,9 +122,7 @@ export default class SearchForm extends Vue {
getParams() {
let params: any = [];
// 拿到所有字段
const props = this.columns
.filter(item => item.searchable)
.map(item => item.prop);
const props = this.columns.filter(item => item.searchable).map(item => item.prop);
const str = props.toString();
if (this.searchContent) {
params = [
Expand Down Expand Up @@ -218,10 +201,10 @@ export default class SearchForm extends Vue {
<style rel="stylesheet/scss" lang="scss" scoped>
.search-form-container {
float: left;
.tool-btn{
display:inline;
.tool-btn {
display: inline;
height: 29px;
border-radius:0
border-radius: 0;
}
.input {
/deep/ .el-input__inner {
Expand Down

0 comments on commit 3513446

Please sign in to comment.