import dayjs from 'dayjs'; /** * 筛选条件相关信息获取逻辑 * 包括时间、行政区划 */ export const useOptions = Behavior({ data: { time: '', }, methods: { setLocation(e) { const { provinceText: provinceName, cityText: cityName, districtText: districtName, townText: townName, provinceValue: provinceCode, cityValue: cityCode, districtValue: districtCode, townValue: townCode, locationValue, } = e.detail; this.setData({ location: { provinceName, cityName, districtName, townName, provinceCode, cityCode, districtCode, townCode, locationValue, }, }); }, initLocation(e) { this.setLocation(e); this.init(); }, // 行政区划切换时,获取新的线上监管信息以及线下巡查监管信息 onLocationChange(e) { this.setLocation(e); this._startLoad(); }, // 时间更改 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(); }, }, });