Commit 56d96eb5 by Jaxon

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

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