Skip to content

Commit

Permalink
perf: 搜索后支持快速取消筛选
Browse files Browse the repository at this point in the history
  • Loading branch information
kuaifan committed Apr 7, 2022
1 parent 1323bba commit f3fb777
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 22 deletions.
18 changes: 12 additions & 6 deletions resources/assets/js/pages/manage/components/ProjectArchived.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
transfer>
<Button :loading="loadIng > 0" type="primary" icon="ios-search" @click="onSearch">{{$L('搜索')}}</Button>
<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>
</Tooltip>
</li>
Expand Down Expand Up @@ -63,6 +64,7 @@ export default {
loadIng: 0,
keys: {},
keyIs: false,
columns: [],
list: [],
Expand All @@ -79,6 +81,14 @@ export default {
computed: {
...mapState(['windowMax768'])
},
watch: {
keyIs(v) {
if (!v) {
this.keys = {}
this.setPage(1)
}
}
},
methods: {
initLanguage() {
this.columns = [
Expand Down Expand Up @@ -194,18 +204,14 @@ export default {
]
},
refresh() {
this.keys = [];
this.getLists();
},
onSearch() {
this.page = 1;
this.getLists();
},
getLists() {
this.loadIng++;
this.keyIs = $A.objImplode(this.keys) != "";
this.$store.dispatch("call", {
url: 'project/lists',
data: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
transfer>
<Button :loading="loadIng > 0" type="primary" icon="ios-search" @click="onSearch">{{$L('搜索')}}</Button>
<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>
</Tooltip>
</li>
Expand Down Expand Up @@ -75,6 +76,7 @@ export default {
loadIng: 0,
keys: {},
keyIs: false,
columns: [],
list: [],
Expand All @@ -91,6 +93,14 @@ export default {
computed: {
...mapState(['windowMax768'])
},
watch: {
keyIs(v) {
if (!v) {
this.keys = {}
this.setPage(1)
}
}
},
methods: {
initLanguage() {
this.columns = [
Expand Down Expand Up @@ -178,10 +188,12 @@ export default {
},
]
},
onSearch() {
this.page = 1;
this.getLists();
},
getLists() {
let archived = 'all';
if (this.keys.status == 'archived') {
Expand All @@ -190,6 +202,7 @@ export default {
archived = 'no';
}
this.loadIng++;
this.keyIs = $A.objImplode(this.keys) != "";
this.$store.dispatch("call", {
url: 'project/lists',
data: {
Expand Down
14 changes: 13 additions & 1 deletion resources/assets/js/pages/manage/components/ReportMy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
transfer>
<Button :loading="loadIng > 0" type="primary" icon="ios-search" @click="onSearch">{{$L('搜索')}}</Button>
<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>
</Tooltip>
</li>
Expand Down Expand Up @@ -85,6 +86,8 @@ export default {
noDataText: "数据加载中.....",
keys: {},
keyIs: false,
reportTypeList: [
{value: "", label: this.$L('全部')},
{value: "weekly", label: this.$L('周报')},
Expand All @@ -98,6 +101,14 @@ export default {
computed: {
...mapState(['windowMax768'])
},
watch: {
keyIs(v) {
if (!v) {
this.keys = {}
this.setPage(1)
}
}
},
methods: {
initLanguage() {
this.columns = [{
Expand Down Expand Up @@ -161,6 +172,7 @@ export default {
getLists() {
this.loadIng++;
this.keyIs = $A.objImplode(this.keys) != "";
this.$store.dispatch("call", {
url: 'report/my',
data: {
Expand Down
14 changes: 13 additions & 1 deletion resources/assets/js/pages/manage/components/ReportReceive.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
transfer>
<Button :loading="loadIng > 0" type="primary" icon="ios-search" @click="onSearch">{{$L('搜索')}}</Button>
<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>
</Tooltip>
</li>
Expand Down Expand Up @@ -88,6 +89,8 @@ export default {
noDataText: "数据加载中.....",
keys: {},
keyIs: false,
reportTypeList: [
{value: "", label: this.$L('全部')},
{value: "weekly", label: this.$L('周报')},
Expand All @@ -101,6 +104,14 @@ export default {
computed: {
...mapState(['userId', 'windowMax768'])
},
watch: {
keyIs(v) {
if (!v) {
this.keys = {}
this.setPage(1)
}
}
},
methods: {
initLanguage() {
this.columns = [{
Expand Down Expand Up @@ -180,6 +191,7 @@ export default {
getLists() {
this.loadIng++;
this.keyIs = $A.objImplode(this.keys) != "";
this.$store.dispatch("call", {
url: 'report/receive',
data: {
Expand Down
16 changes: 10 additions & 6 deletions resources/assets/js/pages/manage/components/TaskArchived.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
transfer>
<Button :loading="loadIng > 0" type="primary" icon="ios-search" @click="onSearch">{{$L('搜索')}}</Button>
<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>
</Tooltip>
</li>
Expand Down Expand Up @@ -69,6 +70,7 @@ export default {
loadIng: 0,
keys: {},
keyIs: false,
columns: [],
list: [],
Expand All @@ -91,6 +93,12 @@ export default {
this.getLists();
},
immediate: true
},
keyIs(v) {
if (!v) {
this.keys = {}
this.setPage(1)
}
}
},
methods: {
Expand Down Expand Up @@ -233,11 +241,6 @@ export default {
]
},
refresh() {
this.keys = {};
this.getLists()
},
onSearch() {
this.page = 1;
this.getLists();
Expand All @@ -248,6 +251,7 @@ export default {
return;
}
this.loadIng++;
this.keyIs = $A.objImplode(this.keys) != "";
this.$store.dispatch("call", {
url: 'project/task/lists',
data: {
Expand Down
16 changes: 10 additions & 6 deletions resources/assets/js/pages/manage/components/TaskDeleted.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
transfer>
<Button :loading="loadIng > 0" type="primary" icon="ios-search" @click="onSearch">{{$L('搜索')}}</Button>
<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>
</Tooltip>
</li>
Expand Down Expand Up @@ -69,6 +70,7 @@ export default {
loadIng: 0,
keys: {},
keyIs: false,
columns: [],
list: [],
Expand All @@ -91,6 +93,12 @@ export default {
this.getLists();
},
immediate: true
},
keyIs(v) {
if (!v) {
this.keys = {}
this.setPage(1)
}
}
},
methods: {
Expand Down Expand Up @@ -181,11 +189,6 @@ export default {
]
},
refresh() {
this.keys = {};
this.getLists()
},
onSearch() {
this.page = 1;
this.getLists();
Expand All @@ -196,6 +199,7 @@ export default {
return;
}
this.loadIng++;
this.keyIs = $A.objImplode(this.keys) != "";
this.$store.dispatch("call", {
url: 'project/task/lists',
data: {
Expand Down
15 changes: 14 additions & 1 deletion resources/assets/js/pages/manage/components/TeamManagement.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
transfer>
<Button :loading="loadIng > 0" type="primary" icon="ios-search" @click="onSearch">{{$L('搜索')}}</Button>
<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>
</Tooltip>
</li>
Expand Down Expand Up @@ -91,6 +92,7 @@ export default {
keys: {
identity: 'nodisable'
},
keyIs: false,
columns: [],
list: [],
Expand All @@ -107,6 +109,14 @@ export default {
computed: {
...mapState(['windowMax768'])
},
watch: {
keyIs(v) {
if (!v) {
this.keys = {}
this.setPage(1)
}
}
},
methods: {
initLanguage() {
this.columns = [
Expand Down Expand Up @@ -288,12 +298,15 @@ export default {
}
]
},
onSearch() {
this.page = 1;
this.getLists();
},
getLists() {
this.loadIng++;
this.keyIs = $A.objImplode(this.keys) != "";
this.$store.dispatch("call", {
url: 'users/lists',
data: {
Expand Down

0 comments on commit f3fb777

Please sign in to comment.