| | |
| | | riskRes: [], |
| | | creditPeriod: '', |
| | | creditRes: [], |
| | | // 取消网络请求标志 |
| | | cancelFetch: [], |
| | | }, |
| | | lifetimes: { |
| | | attached: function () {}, |
| | |
| | | * 线上监管统计信息 |
| | | */ |
| | | fetchSupervision(page) { |
| | | const { provinceName, cityName, districtName, townName, sceneTypeValue } = this.data; |
| | | const params = { provinceName, cityName, districtName, townName, sceneTypes: sceneTypeValue }; |
| | | this._fetchSupervision(page, params); |
| | | }, |
| | | |
| | | _fetchSupervision(page, params) { |
| | | // 取消正在进行中的上一次请求 |
| | | let { cancelFetch } = this.data; |
| | | if (cancelFetch.length > 0) { |
| | | cancelFetch[0] = true; |
| | | cancelFetch = []; |
| | | } |
| | | let abort = false; |
| | | cancelFetch.push(abort); |
| | | this.setData({ cancelFetch }); |
| | | this.setData({ supervisionLoading: true }); |
| | | // 企业数量 |
| | | const { provinceName, cityName, districtName, townName, sceneTypeValue } = this.data; |
| | | const f1 = fetchEnterpriseCount({ |
| | | data: { provinceName, cityName, districtName, townName, sceneTypes: sceneTypeValue }, |
| | | data: params, |
| | | }).then(res => { |
| | | this.setData({ |
| | | enterpriseCountRes: res.data, |
| | | }); |
| | | if (!abort) { |
| | | this.setData({ |
| | | enterpriseCountRes: res.data, |
| | | }); |
| | | } |
| | | }); |
| | | // 综合风险 |
| | | const f2 = fetchRiskCount({ |
| | | data: { provinceName, cityName, districtName, townName, sceneTypes: sceneTypeValue }, |
| | | data: params, |
| | | }).then(res => { |
| | | this.setData({ |
| | | riskPeriod: res.data.period, |
| | | riskRes: res.data.count, |
| | | }); |
| | | if (!abort) { |
| | | this.setData({ |
| | | riskPeriod: res.data.period, |
| | | riskRes: res.data.count, |
| | | }); |
| | | } |
| | | }); |
| | | // 环信码 |
| | | const f3 = fetchCreditCodeCount({ |
| | | data: { provinceName, cityName, districtName, townName, sceneTypes: sceneTypeValue }, |
| | | data: params, |
| | | }).then(res => { |
| | | this.setData({ |
| | | creditPeriod: res.data.period, |
| | | creditRes: res.data.count, |
| | | }); |
| | | if (!abort) { |
| | | this.setData({ |
| | | creditPeriod: res.data.period, |
| | | creditRes: res.data.count, |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | Promise.all([f1, f2, f3]).finally(() => { |
| | |
| | | }, |
| | | |
| | | _navParams() { |
| | | const { provinceName, cityName, districtName, townName, sceneTypeValue, locationValue } = this.data; |
| | | const { provinceName, cityName, districtName, townName, sceneTypeValue, locationValue } = |
| | | this.data; |
| | | let url = `?sceneType=${sceneTypeValue[0]}`; |
| | | if (provinceName) url += `&province=${provinceName}`; |
| | | if (cityName) url += `&city=${cityName}`; |