From f46786f11c5c08ead7501a82e5a71430ad69b782 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期日, 27 四月 2025 17:39:24 +0800 Subject: [PATCH] 修复线索问题定位错误问题 --- pages/inspection/ranking/index.js | 105 ++++++++++++---------------------------------------- 1 files changed, 24 insertions(+), 81 deletions(-) diff --git a/pages/inspection/ranking/index.js b/pages/inspection/ranking/index.js index 9bfd155..1953f75 100644 --- a/pages/inspection/ranking/index.js +++ b/pages/inspection/ranking/index.js @@ -1,19 +1,16 @@ import dayjs from 'dayjs'; import { useLoading } from '../../../behaviors/loading'; +import { useProblemChangeList } from "./problem-change-list.js"; +import { useStatistic } from "./statistic.js"; +import { useSortOptions } from "./sort-options.js"; import { fetchSceneProSummary } from '../../../services/inspection/fetchScene'; import { fetchProblemsStatistic } from '../../../services/inspection/fetchInspection'; import { _getParamsArea } from '../param-util.js'; Page({ - behaviors: [useLoading], + behaviors: [useLoading, useProblemChangeList, useStatistic, useSortOptions], data: { - summaryList: [], - sort: '', - sortBy: 'pro', - statistic: { - proNum: 0, - changeNum: 0, - }, + placeholder: '杈撳叆鍏抽敭瀛楁悳绱㈠満鏅�', }, onLoad(options) { @@ -39,49 +36,12 @@ }, _fetchData(page) { - const f1 = this.fetchSceneProSummary(page); - const f2 = this.fetchProblems(page); + const params = _getParamsArea(this.data); + const f1 = this.fetchSceneProSummary(params, page); + const f2 = this.fetchProblems(params, page); return Promise.all([f1, f2]).then(res => { // 杩斿洖璇锋眰f1鐨勫垎椤典俊鎭� return res[0]; - }); - }, - - fetchSceneProSummary(page) { - const params = _getParamsArea(this.data); - const { sortBy } = this.data; - return fetchSceneProSummary({ area: params, sortBy, page }).then(res => { - if (res.success) { - this.setData({ - summaryList: page == 1 ? res.data : this.data.summaryList.concat(res.data), - }); - } else { - this.setData({ - summaryList: [], - }); - } - return res.head; - }); - }, - - fetchProblems(page) { - const params = _getParamsArea(this.data); - return fetchProblemsStatistic(params).then(res => { - let proNum = 0, - changeNum = 0, - changePer = 0; - res.data.forEach(r => { - proNum += r.count; - changeNum += r.changeCount; - }); - if (proNum > 0) { - changePer = Math.round((changeNum / proNum) * 1000) / 10; - changePer += '%'; - } - this.setData({ - statistic: { proNum, changeNum, changePer }, - }); - return res.head; }); }, @@ -112,41 +72,24 @@ this._startLoad(); }, - onSortChange(e) { - const { sorts } = e.detail; - const { type } = e.currentTarget.dataset; - this.setData({ - sort: sorts, - sortBy: type, - proSort: type == 'pro' ? sorts : 'default', - changeSort: type == 'changePer' ? sorts : 'default', - }); - this._startLoad(); - }, + // onSortChange(e) { + // const { sorts } = e.detail; + // const { type } = e.currentTarget.dataset; + // this.setData({ + // sort: sorts, + // sortBy: type, + // proSort: type == 'pro' ? sorts : 'default', + // changeSort: type == 'changePer' ? sorts : 'default', + // }); + // this._startLoad(); + // }, - // 闂鏁版帓搴忔洿鏀� - onProNumSortChange(e) { - const { sorts } = e.detail; - this.setData({ - sort: sorts, - }); - this._startLoad(); - }, - - // 鏁存敼鐜囨帓搴忔洿鏀� - onChangePerSortChange(e) {}, - - navToDetail(e) { - const { index } = e.currentTarget.dataset; - const summary = this.data.summaryList[index]; + navToSearchPage() { wx.navigateTo({ - url: '/pages/inspection/detail/index', - success: result => { - result.eventChannel.emit('acceptInspectionDetailData', { - scene: summary.scene, - time: this.data.time, - }); - }, + url: '/pages/inspection/ranking/search/index', + success: result => {}, + fail: res => {}, + complete: res => {}, }); }, }); -- Gitblit v1.9.3