Riku
2024-08-13 093afd3be27ea5e9692839845b69bd56e2405518
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import { useLoading } from '../../../behaviors/loading';
import { searchScene } from '../../../services/inspection/fetchScene';
 
// 现场巡查监管场景信息管理
Page({
  behaviors: [useLoading],
  data: {
    placeholder: '输入关键字搜索场景',
    sceneList: [],
    area: {},
  },
 
  onLoad(options) {},
 
  onReachBottom() {
    this._loadMore();
  },
 
  _fetchData(page) {
    const { area, onlineValue, sceneValue } = this.data;
    if (!onlineValue || !sceneValue) return;
    area.scensetypeid = sceneValue[0];
    area.online = onlineValue[0];
    return searchScene(area, page).then(res => {
      if (res.success) {
        this.setData({
          sceneList: page == 1 ? res.data : this.data.sceneList.concat(res.data),
        });
      } else {
        this.setData({
          sceneList: [],
        });
      }
      return res.head;
    });
  },
 
  onOnlineChange(e) {
    const { onlineText, onlineValue } = e.detail;
    this.setData({ onlineText, onlineValue });
    this._startLoad();
  },
 
  onLocationChange(e) {
    const { area } = this.data;
    area.provincename = e.detail.provinceText;
    area.cityname = e.detail.cityText;
    area.districtname = e.detail.districtText;
    area.townname = e.detail.townText;
    area.provincecode = e.detail.provinceValue;
    area.citycode = e.detail.cityValue;
    area.districtcode = e.detail.districtValue;
    area.towncode = e.detail.townValue;
    area.locationValue = e.detail.locationValue;
    this.setData({ area });
    this._startLoad();
  },
  onScenePickerConfirm(e) {
    const { sceneText, sceneValue } = e.detail;
    this.setData({ sceneText, sceneValue });
    this._startLoad();
  },
 
  navToSearchPage() {
    wx.navigateTo({
      url: '/pages/inspection/scene/search/index',
      success: result => {},
      fail: res => {},
      complete: res => {},
    });
  },
 
  navToDetail(e) {
    const { index } = e.currentTarget.dataset;
    const scene = this.data.sceneList[index];
    wx.navigateTo({
      url: '/pages/inspection/scene/info/index',
      success: result => {
        result.eventChannel.emit('acceptSceneData', {
          scene: scene,
        });
      },
    });
  },
});