import dayjs from 'dayjs'; /** * 筛选条件相关信息获取逻辑 * 包括场景类型、行政区划 */ export const useOptions = Behavior({ data: { sceneTypeText: '', sceneTypeValue: [], time:'', }, methods: { setScene(e) { const { sceneText: sceneTypeText, sceneValue: sceneTypeValue } = e.detail; this.setData({ sceneTypeText, sceneTypeValue }); }, initScene(e) { this.setScene(e); this.init(); }, // 场景类型切换时,同时获取新的线上监管信息 onScenePickerConfirm(e) { this.setScene(e); this.fetchSupervision(); this.fetchInspection(); }, setLocation(e) { const { provinceText: provinceName, cityText: cityName, districtText: districtName, townText: townName, provinceValue: provinceCode, cityValue: cityCode, districtValue: districtCode, townValue: townCode, locationValue, } = e.detail; this.setData({ provinceName, cityName, districtName, townName, provinceCode, cityCode, districtCode, townCode, locationValue, }); }, initLocation(e) { this.setLocation(e); this.init(); }, // 行政区划切换时,获取新的线上监管信息以及线下巡查监管信息 onLocationChange(e) { this.setLocation(e); this.fetchSupervision(); this.fetchInspection(); }, // 时间更改 setTimeValue(e) { const { timeValue } = e.detail; const p = dayjs(timeValue).format('YYYY-MM-DD HH:mm:ss'); this.setData({ time: p, }); }, initTime(e) { this.setTimeValue(e); this.init(); }, onTimePickerConfirm(e) { this.setTimeValue(e); this._startLoad(); }, }, });