perf: 搜索后支持快速取消筛选

This commit is contained in:
kuaifan 2022-04-07 23:23:04 +08:00
parent 1323bba420
commit f3fb777924
7 changed files with 86 additions and 22 deletions

View File

@ -24,7 +24,8 @@
transfer> transfer>
<Button :loading="loadIng > 0" type="primary" icon="ios-search" @click="onSearch">{{$L('搜索')}}</Button> <Button :loading="loadIng > 0" type="primary" icon="ios-search" @click="onSearch">{{$L('搜索')}}</Button>
<div slot="content"> <div slot="content">
<Button :loading="loadIng > 0" type="text" @click="refresh">{{$L('刷新')}}</Button> <Button v-if="keyIs" type="text" @click="keyIs=false">{{$L('取消筛选')}}</Button>
<Button v-else :loading="loadIng > 0" type="text" @click="getLists">{{$L('刷新')}}</Button>
</div> </div>
</Tooltip> </Tooltip>
</li> </li>
@ -63,6 +64,7 @@ export default {
loadIng: 0, loadIng: 0,
keys: {}, keys: {},
keyIs: false,
columns: [], columns: [],
list: [], list: [],
@ -79,6 +81,14 @@ export default {
computed: { computed: {
...mapState(['windowMax768']) ...mapState(['windowMax768'])
}, },
watch: {
keyIs(v) {
if (!v) {
this.keys = {}
this.setPage(1)
}
}
},
methods: { methods: {
initLanguage() { initLanguage() {
this.columns = [ this.columns = [
@ -194,11 +204,6 @@ export default {
] ]
}, },
refresh() {
this.keys = [];
this.getLists();
},
onSearch() { onSearch() {
this.page = 1; this.page = 1;
this.getLists(); this.getLists();
@ -206,6 +211,7 @@ export default {
getLists() { getLists() {
this.loadIng++; this.loadIng++;
this.keyIs = $A.objImplode(this.keys) != "";
this.$store.dispatch("call", { this.$store.dispatch("call", {
url: 'project/lists', url: 'project/lists',
data: { data: {

View File

@ -36,7 +36,8 @@
transfer> transfer>
<Button :loading="loadIng > 0" type="primary" icon="ios-search" @click="onSearch">{{$L('搜索')}}</Button> <Button :loading="loadIng > 0" type="primary" icon="ios-search" @click="onSearch">{{$L('搜索')}}</Button>
<div slot="content"> <div slot="content">
<Button :loading="loadIng > 0" type="text" @click="getLists">{{$L('刷新')}}</Button> <Button v-if="keyIs" type="text" @click="keyIs=false">{{$L('取消筛选')}}</Button>
<Button v-else :loading="loadIng > 0" type="text" @click="getLists">{{$L('刷新')}}</Button>
</div> </div>
</Tooltip> </Tooltip>
</li> </li>
@ -75,6 +76,7 @@ export default {
loadIng: 0, loadIng: 0,
keys: {}, keys: {},
keyIs: false,
columns: [], columns: [],
list: [], list: [],
@ -91,6 +93,14 @@ export default {
computed: { computed: {
...mapState(['windowMax768']) ...mapState(['windowMax768'])
}, },
watch: {
keyIs(v) {
if (!v) {
this.keys = {}
this.setPage(1)
}
}
},
methods: { methods: {
initLanguage() { initLanguage() {
this.columns = [ this.columns = [
@ -178,10 +188,12 @@ export default {
}, },
] ]
}, },
onSearch() { onSearch() {
this.page = 1; this.page = 1;
this.getLists(); this.getLists();
}, },
getLists() { getLists() {
let archived = 'all'; let archived = 'all';
if (this.keys.status == 'archived') { if (this.keys.status == 'archived') {
@ -190,6 +202,7 @@ export default {
archived = 'no'; archived = 'no';
} }
this.loadIng++; this.loadIng++;
this.keyIs = $A.objImplode(this.keys) != "";
this.$store.dispatch("call", { this.$store.dispatch("call", {
url: 'project/lists', url: 'project/lists',
data: { data: {

View File

@ -35,7 +35,8 @@
transfer> transfer>
<Button :loading="loadIng > 0" type="primary" icon="ios-search" @click="onSearch">{{$L('搜索')}}</Button> <Button :loading="loadIng > 0" type="primary" icon="ios-search" @click="onSearch">{{$L('搜索')}}</Button>
<div slot="content"> <div slot="content">
<Button :loading="loadIng > 0" type="text" @click="getLists">{{$L('刷新')}}</Button> <Button v-if="keyIs" type="text" @click="keyIs=false">{{$L('取消筛选')}}</Button>
<Button v-else :loading="loadIng > 0" type="text" @click="getLists">{{$L('刷新')}}</Button>
</div> </div>
</Tooltip> </Tooltip>
</li> </li>
@ -85,6 +86,8 @@ export default {
noDataText: "数据加载中.....", noDataText: "数据加载中.....",
keys: {}, keys: {},
keyIs: false,
reportTypeList: [ reportTypeList: [
{value: "", label: this.$L('全部')}, {value: "", label: this.$L('全部')},
{value: "weekly", label: this.$L('周报')}, {value: "weekly", label: this.$L('周报')},
@ -98,6 +101,14 @@ export default {
computed: { computed: {
...mapState(['windowMax768']) ...mapState(['windowMax768'])
}, },
watch: {
keyIs(v) {
if (!v) {
this.keys = {}
this.setPage(1)
}
}
},
methods: { methods: {
initLanguage() { initLanguage() {
this.columns = [{ this.columns = [{
@ -161,6 +172,7 @@ export default {
getLists() { getLists() {
this.loadIng++; this.loadIng++;
this.keyIs = $A.objImplode(this.keys) != "";
this.$store.dispatch("call", { this.$store.dispatch("call", {
url: 'report/my', url: 'report/my',
data: { data: {

View File

@ -42,7 +42,8 @@
transfer> transfer>
<Button :loading="loadIng > 0" type="primary" icon="ios-search" @click="onSearch">{{$L('搜索')}}</Button> <Button :loading="loadIng > 0" type="primary" icon="ios-search" @click="onSearch">{{$L('搜索')}}</Button>
<div slot="content"> <div slot="content">
<Button :loading="loadIng > 0" type="text" @click="getLists">{{$L('刷新')}}</Button> <Button v-if="keyIs" type="text" @click="keyIs=false">{{$L('取消筛选')}}</Button>
<Button v-else :loading="loadIng > 0" type="text" @click="getLists">{{$L('刷新')}}</Button>
</div> </div>
</Tooltip> </Tooltip>
</li> </li>
@ -88,6 +89,8 @@ export default {
noDataText: "数据加载中.....", noDataText: "数据加载中.....",
keys: {}, keys: {},
keyIs: false,
reportTypeList: [ reportTypeList: [
{value: "", label: this.$L('全部')}, {value: "", label: this.$L('全部')},
{value: "weekly", label: this.$L('周报')}, {value: "weekly", label: this.$L('周报')},
@ -101,6 +104,14 @@ export default {
computed: { computed: {
...mapState(['userId', 'windowMax768']) ...mapState(['userId', 'windowMax768'])
}, },
watch: {
keyIs(v) {
if (!v) {
this.keys = {}
this.setPage(1)
}
}
},
methods: { methods: {
initLanguage() { initLanguage() {
this.columns = [{ this.columns = [{
@ -180,6 +191,7 @@ export default {
getLists() { getLists() {
this.loadIng++; this.loadIng++;
this.keyIs = $A.objImplode(this.keys) != "";
this.$store.dispatch("call", { this.$store.dispatch("call", {
url: 'report/receive', url: 'report/receive',
data: { data: {

View File

@ -24,7 +24,8 @@
transfer> transfer>
<Button :loading="loadIng > 0" type="primary" icon="ios-search" @click="onSearch">{{$L('搜索')}}</Button> <Button :loading="loadIng > 0" type="primary" icon="ios-search" @click="onSearch">{{$L('搜索')}}</Button>
<div slot="content"> <div slot="content">
<Button :loading="loadIng > 0" type="text" @click="getLists">{{$L('刷新')}}</Button> <Button v-if="keyIs" type="text" @click="keyIs=false">{{$L('取消筛选')}}</Button>
<Button v-else :loading="loadIng > 0" type="text" @click="getLists">{{$L('刷新')}}</Button>
</div> </div>
</Tooltip> </Tooltip>
</li> </li>
@ -69,6 +70,7 @@ export default {
loadIng: 0, loadIng: 0,
keys: {}, keys: {},
keyIs: false,
columns: [], columns: [],
list: [], list: [],
@ -91,6 +93,12 @@ export default {
this.getLists(); this.getLists();
}, },
immediate: true immediate: true
},
keyIs(v) {
if (!v) {
this.keys = {}
this.setPage(1)
}
} }
}, },
methods: { methods: {
@ -233,11 +241,6 @@ export default {
] ]
}, },
refresh() {
this.keys = {};
this.getLists()
},
onSearch() { onSearch() {
this.page = 1; this.page = 1;
this.getLists(); this.getLists();
@ -248,6 +251,7 @@ export default {
return; return;
} }
this.loadIng++; this.loadIng++;
this.keyIs = $A.objImplode(this.keys) != "";
this.$store.dispatch("call", { this.$store.dispatch("call", {
url: 'project/task/lists', url: 'project/task/lists',
data: { data: {

View File

@ -24,7 +24,8 @@
transfer> transfer>
<Button :loading="loadIng > 0" type="primary" icon="ios-search" @click="onSearch">{{$L('搜索')}}</Button> <Button :loading="loadIng > 0" type="primary" icon="ios-search" @click="onSearch">{{$L('搜索')}}</Button>
<div slot="content"> <div slot="content">
<Button :loading="loadIng > 0" type="text" @click="getLists">{{$L('刷新')}}</Button> <Button v-if="keyIs" type="text" @click="keyIs=false">{{$L('取消筛选')}}</Button>
<Button v-else :loading="loadIng > 0" type="text" @click="getLists">{{$L('刷新')}}</Button>
</div> </div>
</Tooltip> </Tooltip>
</li> </li>
@ -69,6 +70,7 @@ export default {
loadIng: 0, loadIng: 0,
keys: {}, keys: {},
keyIs: false,
columns: [], columns: [],
list: [], list: [],
@ -91,6 +93,12 @@ export default {
this.getLists(); this.getLists();
}, },
immediate: true immediate: true
},
keyIs(v) {
if (!v) {
this.keys = {}
this.setPage(1)
}
} }
}, },
methods: { methods: {
@ -181,11 +189,6 @@ export default {
] ]
}, },
refresh() {
this.keys = {};
this.getLists()
},
onSearch() { onSearch() {
this.page = 1; this.page = 1;
this.getLists(); this.getLists();
@ -196,6 +199,7 @@ export default {
return; return;
} }
this.loadIng++; this.loadIng++;
this.keyIs = $A.objImplode(this.keys) != "";
this.$store.dispatch("call", { this.$store.dispatch("call", {
url: 'project/task/lists', url: 'project/task/lists',
data: { data: {

View File

@ -50,7 +50,8 @@
transfer> transfer>
<Button :loading="loadIng > 0" type="primary" icon="ios-search" @click="onSearch">{{$L('搜索')}}</Button> <Button :loading="loadIng > 0" type="primary" icon="ios-search" @click="onSearch">{{$L('搜索')}}</Button>
<div slot="content"> <div slot="content">
<Button :loading="loadIng > 0" type="text" @click="getLists">{{$L('刷新')}}</Button> <Button v-if="keyIs" type="text" @click="keyIs=false">{{$L('取消筛选')}}</Button>
<Button v-else :loading="loadIng > 0" type="text" @click="getLists">{{$L('刷新')}}</Button>
</div> </div>
</Tooltip> </Tooltip>
</li> </li>
@ -91,6 +92,7 @@ export default {
keys: { keys: {
identity: 'nodisable' identity: 'nodisable'
}, },
keyIs: false,
columns: [], columns: [],
list: [], list: [],
@ -107,6 +109,14 @@ export default {
computed: { computed: {
...mapState(['windowMax768']) ...mapState(['windowMax768'])
}, },
watch: {
keyIs(v) {
if (!v) {
this.keys = {}
this.setPage(1)
}
}
},
methods: { methods: {
initLanguage() { initLanguage() {
this.columns = [ this.columns = [
@ -288,12 +298,15 @@ export default {
} }
] ]
}, },
onSearch() { onSearch() {
this.page = 1; this.page = 1;
this.getLists(); this.getLists();
}, },
getLists() { getLists() {
this.loadIng++; this.loadIng++;
this.keyIs = $A.objImplode(this.keys) != "";
this.$store.dispatch("call", { this.$store.dispatch("call", {
url: 'users/lists', url: 'users/lists',
data: { data: {