You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
192 lines
5.0 KiB
192 lines
5.0 KiB
// subpages/gatherInformation/pages/gatherInformation/gatherInformation.js
|
|
import { $wuxCalendar } from '../../../../components/dist/index'
|
|
import {getCollect} from '../../../../utils/api'
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
selectList:[['全部信息','居民信息采集','房屋信息采集']],
|
|
selectValue:['全部信息',''],
|
|
pageSize:10,
|
|
pageNo:1,
|
|
tableData:[],
|
|
lowerThreshold:'10',
|
|
loadMoreVisible:false,
|
|
loadMoreType: "none",
|
|
nodata:false,
|
|
visible:false,
|
|
typeVal:'',
|
|
collectType:'',
|
|
newType:'',
|
|
form:{
|
|
type: "",
|
|
collectType: "",
|
|
collectStartDate: "",
|
|
collectEndDate: ""
|
|
}
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad(options) {
|
|
console.log("123123",options.key1)
|
|
this.setData({
|
|
newType: options.key1
|
|
});
|
|
let title = options.key1 == 'resi'?'新增居民记录':'新增房屋记录'
|
|
wx.setNavigationBarTitle({
|
|
title: title
|
|
})
|
|
|
|
this.getCollect()
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage() {
|
|
|
|
},
|
|
openCalendar2() {
|
|
console.log(123)
|
|
$wuxCalendar().open({
|
|
value: this.data.value2,
|
|
multiple: true,
|
|
onChange: (values, displayValues) => {
|
|
console.log('onChange', values, displayValues)
|
|
this.setData({
|
|
'form.collectStartDate': displayValues[0],
|
|
'form.collectEndDate': displayValues[1],
|
|
})
|
|
},
|
|
})
|
|
},
|
|
getCollect(){
|
|
this.setData({
|
|
loadMoreVisible: true,
|
|
nodata: false,
|
|
loadMoreType: "more",
|
|
})
|
|
const parm = {
|
|
type:this.data.newType,
|
|
pageSize:this.data.pageSize,
|
|
pageNo:this.data.pageNo,
|
|
collectType:'add',
|
|
collectStartDate:this.data.form.collectStartDate,
|
|
collectEndDate:this.data.form.collectEndDate
|
|
}
|
|
console.log(parm);
|
|
getCollect(parm).then(res=>{
|
|
this.setData({
|
|
loadMoreType: res.data.list.length === this.data.pageSize ? 'more' : 'none',
|
|
tableData: this.data.tableData.concat(res.data.list),
|
|
})
|
|
if (this.data.tableData.length == 0) {
|
|
this.setData({
|
|
loadMoreVisible: false,
|
|
nodata: true
|
|
})
|
|
}
|
|
}).catch(err=>{
|
|
console.log(err);
|
|
this.setData({
|
|
loadMoreVisible: false,
|
|
nodata: true,
|
|
})
|
|
})
|
|
},
|
|
onScrollToLower(e){
|
|
if (this.data.loadMoreType === 'more') {
|
|
this.setData({
|
|
loadMoreVisible: true,
|
|
})
|
|
this.data.pageNo += 1
|
|
this.getCollect()
|
|
}
|
|
},
|
|
onValueChange(e){
|
|
this.setData({
|
|
typeVal: e.detail.selectedIndex[0] === 1 ? 'resi' : e.detail.selectedIndex[0] === 2 ? 'house' : '',
|
|
collectTypeVal: e.detail.selectedIndex[1] === 1 ? 'add' : e.detail.selectedIndex[1] === 2 ? 'edit' : e.detail.selectedIndex[1] === 3 ? 'del' : '',
|
|
})
|
|
},
|
|
onConfirm(e) {
|
|
this.setData({
|
|
typeVal: e.detail.selectedIndex[0] === 1 ? 'resi' : e.detail.selectedIndex[0] === 2 ? 'house' : '',
|
|
collectTypeVal: e.detail.selectedIndex[1] === 1 ? 'add' : e.detail.selectedIndex[1] === 2 ? 'edit' : e.detail.selectedIndex[1] === 3 ? 'del' : '',
|
|
'form.type': e.detail.selectedIndex[0] === 1 ? 'resi' : e.detail.selectedIndex[0] === 2 ? 'house' : '',
|
|
'form.collectType':e.detail.selectedIndex[1] === 1 ? 'add' : e.detail.selectedIndex[1] === 2 ? 'edit' : e.detail.selectedIndex[1] === 3 ? 'del' : '',
|
|
visible:false,
|
|
selectValue:e.detail.selectedValue
|
|
})
|
|
},
|
|
handelShow(){
|
|
this.setData({
|
|
visible:true
|
|
})
|
|
},
|
|
handelHidden(){
|
|
this.setData({
|
|
visible:false
|
|
})
|
|
},
|
|
handleClickfilter(){
|
|
this.setData({
|
|
tableData:[],
|
|
pageNo:1
|
|
})
|
|
this.getCollect()
|
|
|
|
},
|
|
handelDel(){
|
|
this.setData({
|
|
'form.collectStartDate':'',
|
|
'form.collectEndDate':''
|
|
})
|
|
}
|
|
})
|