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, useProblemChangeList, useStatistic, useSortOptions],
|
data: {
|
placeholder: '输入关键字搜索场景',
|
},
|
|
onLoad(options) {
|
this.getOpenerEventChannel().on('acceptInspectionData', data => {
|
this.setData({
|
location: {
|
provinceText: data.inspection.provinceName,
|
cityText: data.inspection.cityName,
|
districtText: data.inspection.districtName,
|
townText: data.inspection.townName,
|
},
|
inspection: data.inspection,
|
time: data.time,
|
sceneTypeText: data.sceneTypeText,
|
sceneTypeValue: data.sceneTypeValue,
|
});
|
this._startLoad();
|
});
|
},
|
|
onReachBottom() {
|
this._loadMore();
|
},
|
|
_fetchData(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];
|
});
|
},
|
|
onTimePickerConfirm(e) {
|
const { timeValue } = e.detail;
|
this.setData({
|
time: timeValue,
|
});
|
this._startLoad();
|
},
|
onLocationChange(e) {
|
const { inspection } = this.data;
|
inspection.provinceName = e.detail.provinceText;
|
inspection.cityName = e.detail.cityText;
|
inspection.districtName = e.detail.districtText;
|
inspection.townName = e.detail.townText;
|
inspection.provinceCode = e.detail.provinceValue;
|
inspection.cityCode = e.detail.cityValue;
|
inspection.districtCode = e.detail.districtValue;
|
inspection.townCode = e.detail.townValue;
|
inspection.locationValue = e.detail.locationValue;
|
this.setData({ inspection });
|
this._startLoad();
|
},
|
onScenePickerConfirm(e) {
|
const { sceneText: sceneTypeText, sceneValue: sceneTypeValue } = e.detail;
|
this.setData({ sceneTypeText, sceneTypeValue });
|
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();
|
// },
|
|
navToSearchPage() {
|
wx.navigateTo({
|
url: '/pages/inspection/ranking/search/index',
|
success: result => {},
|
fail: res => {},
|
complete: res => {},
|
});
|
},
|
});
|