import { queryDifficultItem } from '../../../../api/reality' Page({ data: { selectTab: 'tab1', loadType: 'none', loadVisible: false, selectType: 'end', timeList: [ {time: '最近一个月', id: '1', select: true }, {time: '最近三个月', id: '2', select: false }, {time: '最近六个月', id: '3', select: false }, {time: '最近一年', id: '4', select: false} ], timePickerVisible: false, choosedTime: { time: '最近一个月', id: '1' }, preloadVisible: true, diffOrPluggList: [], loading:true }, onLoad () { this.initLoad() }, onReachBottom () { this.setData({ loadVisible: true }) }, // tab 切换 onTabChange (e: AnyObject) { if(this.data.loading){ }else{ this.setData({ loading:true, timePickerVisible:false, selectTab: e.currentTarget.dataset.tab }) this.resetCondition() this.initLoad() } }, // 结案或已关闭和处理中type切换 onTypeChange (e: AnyObject) { if(this.data.loading){ }else{ this.setData({ timePickerVisible:false, loading:true, selectType: e.currentTarget.dataset.type }) this.resetCondition() this.initLoad() } }, // 点击显示 timepicker onChangeTimePicker () { this.setData({ timePickerVisible: !this.data.timePickerVisible }) }, closePicker(){ this.setData({ timePickerVisible: false }) }, // 选择时间范围 onChooseTime (e: AnyObject) { const list = this.data.timeList list.forEach(item => { if (item.id === e.currentTarget.dataset.id) { item.select = true this.setData({ 'choosedTime.time': item.time, 'choosedTime.id': item.id }) } else { item.select = false } }) this.setData({ timeList: list }) this.resetCondition() this.initLoad() }, // 初始化加载 async initLoad () { let itemState = '1' if (this.data.selectType === 'end') { itemState = '1' } else if (this.data.selectType === 'handle') { itemState = '2' } let analysisType = 1 if (this.data.selectTab === 'tab1') { analysisType = 1 } else if (this.data.selectTab === 'tab2') { analysisType = 2 } else if (this.data.selectTab === 'tab3') { analysisType = 3 } try { const para = { someMonthsType: Number(this.data.choosedTime.id), analysisType, itemState, } const res: any = await queryDifficultItem(para) for(var i=0;i