Commit 56d96eb5 by Jaxon

feat(督导统计): 业务开发

1 parent ca3eb5ae
......@@ -8,13 +8,16 @@
</van-tabs>
<div class="filter-wrapper">
<div class="brand-filter">
<BrandTabs v-model="list.query.statDimension" :list="options.brandTypeList" />
<BrandTabs v-model="list.query.statDimension"
:list="options.brandTypeList"
@change="getData()" />
</div>
<div class="date-filter">
<DateTypeTabs v-model="list.query.dateType" />
<DatePicker v-model="list.query.date"
style="margin-left:16px"
:type="options.dateType[list.query.dateType]" />
:type="options.dateType[list.query.dateType]"
@change="getData()" />
</div>
<!-- <div class="static-wrapper">
......@@ -47,7 +50,7 @@
<script>
import dayjs from "dayjs";
import { cloneDeep, get } from "lodash-es";
import { cloneDeep, throttle } from "lodash-es";
import DatePicker from "@/components/datePicker/index.vue";
import DateTypeTabs from "@/components/dateTypeTabs/index.vue";
import SearchInput from "@/components/searchBar/index.vue";
......@@ -69,6 +72,7 @@ export default {
},
data() {
return {
throttledFilterSearchKeyword: null,
pageBgUrl: "https://img02.glsx.com.cn/weapp/resource/supervise-wecom/page-bg.png",
options: {
brandTypeList,
......@@ -83,6 +87,7 @@ export default {
},
list: {
loading: false,
originData: [],
data: [],
query: {
dateType: 0,
......@@ -95,9 +100,22 @@ export default {
},
};
},
watch: {
"list.query.searchKeyword": function () {
this.throttledFilterSearchKeyword();
},
},
created() {
this.throttledFilterSearchKeyword = throttle(() => {
this.list.data = this.filterSearchKeyword();
}, 300);
},
async mounted() {
await this.getData();
},
beforeDestroy() {
this.throttledFilterSearchKeyword?.cancel?.();
},
methods: {
log() {
console.log("this.list.query", this.list.query);
......@@ -114,13 +132,26 @@ export default {
};
},
async getData() {
this.list.data = await getSupervisorPerformance(this.getQuery());
this.$loading.show();
try {
await this.$nextTick();
const list = await getSupervisorPerformance(this.getQuery());
this.list.originData = cloneDeep(list);
this.list.data = this.afterGetData(list);
} finally {
this.$loading.hide();
}
},
afterGetData() {
afterGetData(list) {
return this.filterSearchKeyword();
},
filterSearchKeyword(list) {
const keyword = (this.list.query.searchKeyword || "").trim();
if (!keyword) {
return this.list.originData;
}
return this.list.originData.filter(item => item?.supervisorName?.includes(keyword));
},
handleTapItem() {
this.$router.push({
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!