| | |
| | | // pages/supervision/index.js |
| | | import { useLoading } from '../../behaviors/loading'; |
| | | import { useTopic } from './topic-proxy.js'; |
| | | import { useRankResult } from './rank-result-proxy.js'; |
| | | import { fetchGradeList } from '../../services/enterprise/fetchAssessment'; |
| | | import { sceneTypeList } from '../../common/dataSceneTypes'; |
| | | import dayjs from 'dayjs'; |
| | | |
| | | Page({ |
| | | behaviors: [useLoading], |
| | | behaviors: [useLoading, useTopic, useRankResult], |
| | | /** |
| | | * 页面的初始数据 |
| | | */ |
| | |
| | | init() { |
| | | this.optionsCount++; |
| | | // 包括时间、场景类型、区域三个选项,全部获取初始值后,执行加载 |
| | | if (this.optionsCount == 3) this._startLoad(); |
| | | if (this.optionsCount == 3) { |
| | | // 初始化专题管理的选项 |
| | | this.initselectedTopics(); |
| | | this._startLoad(); |
| | | } |
| | | }, |
| | | |
| | | _fetchData(page) { |
| | | let { |
| | | province, |
| | | city, |
| | | district, |
| | | town, |
| | | area, |
| | | management, |
| | | sorts, |
| | | sceneType, |
| | | period, |
| | | } = this.data.searchOptions; |
| | | let { province, city, district, town, area, management, sorts, sceneType, period } = |
| | | this.data.searchOptions; |
| | | return fetchGradeList({ |
| | | page, |
| | | data: { |
| | |
| | | sceneTypes: [sceneType], |
| | | }, |
| | | }).then(res => { |
| | | const startIndex = page == 1 ? 0 : this.data.searchResult.length |
| | | this.setData({ |
| | | searchResult: |
| | | page == 1 ? res.data : this.data.searchResult.concat(res.data), |
| | | searchResult: page == 1 ? res.data : this.data.searchResult.concat(res.data), |
| | | }); |
| | | // 获取专题相关的台账信息 |
| | | this.fetchTopicLedgers(startIndex); |
| | | return res.head; |
| | | }); |
| | | }, |
| | |
| | | const { timeValue } = e.detail; |
| | | const p = dayjs(timeValue); |
| | | const period = `${p.year()}/${p.month() + 1}-${p.month() + 1}`; |
| | | const time = p.format('YYYY-MM-DD'); |
| | | this.setData({ |
| | | ['searchOptions.period']: period, |
| | | ['searchOptions.time']: time, |
| | | }); |
| | | }, |
| | | initTime(e) { |
| | |
| | | }, |
| | | handleScenePickerChange(e) { |
| | | this.setSceneValue(e); |
| | | // 初始化专题管理的选项 |
| | | this.initselectedTopics(); |
| | | this._startLoad(); |
| | | }, |
| | | |
| | |
| | | |
| | | setPopupValue(e) { |
| | | const { searchOptions } = this.data; |
| | | const { |
| | | provinceText, |
| | | cityText, |
| | | districtText, |
| | | townText, |
| | | areaText, |
| | | managementText, |
| | | } = e.detail; |
| | | const { provinceText, cityText, districtText, townText, areaText, managementText } = e.detail; |
| | | searchOptions.province = provinceText; |
| | | searchOptions.city = cityText; |
| | | searchOptions.district = districtText; |