riku
2024-08-12 65124213af664a68ad88ce7f6dcb133116d7702f
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
import {
  fetchInspectionStatistic,
  fetchSubtaskSummaryByArea,
} from '../../services/inspection/fetchInspection';
 
/**
 * 现场巡查监管相关信息获取逻辑
 */
export const useInsepction = Behavior({
  data: {
    tabIndex: 0,
    inspectionLoading: false,
    inspectionRes: [],
  },
  methods: {
    fetchInspection(page) {
      this.setData({ inspectionLoading: true });
      const { provinceCode, cityCode, districtCode, townCode, sceneTypeValue, time } = this.data;
      fetchSubtaskSummaryByArea({
        provincecode: provinceCode,
        citycode: cityCode,
        districtcode: districtCode,
        towncode: townCode,
        scensetypeid: sceneTypeValue[0],
        starttime: time,
        endtime: time,
      })
        .then(res => {
          this.setData({
            inspectionRes: res.data,
          });
        })
        .finally(() => {
          this.setData({ inspectionLoading: false });
        });
    },
    onTabsChange(e) {
      this.setData({ tabIndex: e.detail.value });
    },
    navToInspection(e) {
      const i1 = e.detail.index;
      const { inspectionRes, time, sceneTypeText, sceneTypeValue, tabIndex } = this.data;
      wx.navigateTo({
        url: '/pages/inspection/ranking/index',
        success: function (res) {
          res.eventChannel.emit('acceptInspectionData', {
            inspection: inspectionRes[tabIndex],
            time,
            sceneTypeText,
            sceneTypeValue,
          });
        },
      });
    },
    navToInspAnalysis(e) {
      const { inspectionRes, time, sceneTypeText, sceneTypeValue, tabIndex } = this.data;
      wx.navigateTo({
        url: '/pages/inspection/index',
        success: function (res) {
          res.eventChannel.emit('acceptInspectionData', {
            inspection: inspectionRes[tabIndex],
            time,
            sceneTypeText,
            sceneTypeValue,
          });
        },
      });
    },
  },
});