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.
		
		
		
		
		
			
		
			
				
					
					
						
							180 lines
						
					
					
						
							5.1 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							180 lines
						
					
					
						
							5.1 KiB
						
					
					
				
								import {getInspRecord} from "../../../../utils/api"
							 | 
						|
								const app = getApp()
							 | 
						|
								Page({
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * 页面的初始数据
							 | 
						|
								     */
							 | 
						|
								    data: { 
							 | 
						|
								        title:'',
							 | 
						|
								        tableData:[],
							 | 
						|
								        lowerThreshold:'10',
							 | 
						|
								        loadMoreVisible:false,
							 | 
						|
								        loadMoreType: "none",
							 | 
						|
								        nodata:false,
							 | 
						|
								        pageNo:1,
							 | 
						|
								        pageSize:1000,
							 | 
						|
								        type:''
							 | 
						|
								    },
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * 生命周期函数--监听页面加载
							 | 
						|
								     */
							 | 
						|
								    onLoad(options) {
							 | 
						|
								       this.setData({
							 | 
						|
								        statusHeight: app.globalData.deviceInfo.statusHeight,
							 | 
						|
								        navigationHeight: app.globalData.deviceInfo.navigationHeight,
							 | 
						|
								        share:app.globalData.share,
							 | 
						|
								        type:options.type,
							 | 
						|
								        keyWord:options.keyWord
							 | 
						|
								      })
							 | 
						|
								      this.getTable()
							 | 
						|
								      wx.loadFontFace({
							 | 
						|
								        family: 'PingFangSC-regular',
							 | 
						|
								        source: 'url("https://img2.misssixty.com.cn/rs/lib/fonts/PingFangSC-regular.ttf")',
							 | 
						|
								        success: function() {
							 | 
						|
								          console.log('Font loaded successfully');
							 | 
						|
								        },
							 | 
						|
								        fail: function(error) {
							 | 
						|
								          console.error('Font loading failed', error);
							 | 
						|
								        },
							 | 
						|
								        complete: function() {
							 | 
						|
								          console.log('Font loading process complete');
							 | 
						|
								        }
							 | 
						|
								      });
							 | 
						|
								    },
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * 生命周期函数--监听页面初次渲染完成
							 | 
						|
								     */
							 | 
						|
								    onReady() {
							 | 
						|
								
							 | 
						|
								    },
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * 生命周期函数--监听页面显示
							 | 
						|
								     */
							 | 
						|
								    onShow() {
							 | 
						|
								
							 | 
						|
								    },
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * 生命周期函数--监听页面隐藏
							 | 
						|
								     */
							 | 
						|
								    onHide() {
							 | 
						|
								
							 | 
						|
								    },
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * 生命周期函数--监听页面卸载
							 | 
						|
								     */
							 | 
						|
								    onUnload() {
							 | 
						|
								
							 | 
						|
								    },
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * 页面相关事件处理函数--监听用户下拉动作
							 | 
						|
								     */
							 | 
						|
								    onPullDownRefresh() {
							 | 
						|
								
							 | 
						|
								    },
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * 页面上拉触底事件的处理函数
							 | 
						|
								     */
							 | 
						|
								    onReachBottom() {
							 | 
						|
								
							 | 
						|
								    },
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * 用户点击右上角分享
							 | 
						|
								     */
							 | 
						|
								    onShareAppMessage() {
							 | 
						|
								      return{
							 | 
						|
								        title:`${this.data.agencyName}${this.data.monthName}月份满意度调查`,
							 | 
						|
								        path:'/pages/webView/webView?url=' + this.data.questionnaireUrl,
							 | 
						|
								        imageUrl:'../../../../images/work/shareBg.png'
							 | 
						|
								      }
							 | 
						|
								    },
							 | 
						|
								    share(e){
							 | 
						|
								      console.log(e);
							 | 
						|
								      this.setData({
							 | 
						|
								        url:e.currentTarget.dataset.item.questionnaireUrl,
							 | 
						|
								        agencyName:e.currentTarget.dataset.item.agencyName,
							 | 
						|
								        monthName:e.currentTarget.dataset.item.monthName
							 | 
						|
								      })
							 | 
						|
								    },
							 | 
						|
								    getTable(){
							 | 
						|
								        this.setData({
							 | 
						|
								            loadMoreVisible: true,
							 | 
						|
								            nodata: false,
							 | 
						|
								            loadMoreType: "more",
							 | 
						|
								          })
							 | 
						|
								        let parm ={
							 | 
						|
								            searchKey:this.data.keyWord,
							 | 
						|
								            pageSize:this.data.pageSize,
							 | 
						|
								            pageNo:this.data.pageNo
							 | 
						|
								        }
							 | 
						|
								      
							 | 
						|
								        getInspRecord(parm).then(res=>{
							 | 
						|
								          res.data.list = res.data.list.reverse()
							 | 
						|
								                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);
							 | 
						|
								            })
							 | 
						|
								        
							 | 
						|
								    },
							 | 
						|
								    onScrollToLower(e){
							 | 
						|
								        if (this.data.loadMoreType === 'more') {
							 | 
						|
								            this.setData({
							 | 
						|
								              loadMoreVisible: true,
							 | 
						|
								            })
							 | 
						|
								            this.data.pageNo += 1
							 | 
						|
								            this.getTable()
							 | 
						|
								          }
							 | 
						|
								    },
							 | 
						|
								    jumpAdd(){
							 | 
						|
								        if(this.data.type == 'resi'){
							 | 
						|
								            wx.navigateTo({
							 | 
						|
								              url: '/subpages/addResi/pages/addResi/addResi',
							 | 
						|
								            })
							 | 
						|
								        }else{
							 | 
						|
								            wx.navigateTo({
							 | 
						|
								                url: '/subpages/addhouse/pages/addhouse/addhouse',
							 | 
						|
								              })
							 | 
						|
								        }
							 | 
						|
								    },
							 | 
						|
								    handelClickedit(e){
							 | 
						|
								        console.log(e);
							 | 
						|
								        // if(this.data.type == 'resi'){
							 | 
						|
								        //     wx.navigateTo({
							 | 
						|
								        //         url: `/subpages/addResi/pages/addResi/addResi?type=edit&resiId=${e.currentTarget.dataset.item.resiId}`,
							 | 
						|
								        //     })
							 | 
						|
								        // }else{
							 | 
						|
								        //     wx.navigateTo({
							 | 
						|
								        //         url: `/subpages/addhouse/pages/addhouse/addhouse?type=edit&houseId=${e.currentTarget.dataset.item.id}`,
							 | 
						|
								        //     })
							 | 
						|
								        // }
							 | 
						|
								        wx.navigateTo({
							 | 
						|
								          url: `/subpages/communitySelfInsp/pages/synthesis/synthesis?inspRecordId=${encodeURIComponent(e.currentTarget.dataset.item.id)}&qrCodeImgUrl=${encodeURIComponent(e.currentTarget.dataset.item.qrCodeImgUrl)}&agencyName=${encodeURIComponent(e.currentTarget.dataset.item.agencyName)}&monthName=${encodeURIComponent(e.currentTarget.dataset.item.monthName)}&questionnaireUrl=${encodeURIComponent(e.currentTarget.dataset.item.questionnaireUrl)}&status=${encodeURIComponent(e.currentTarget.dataset.item.status)}`
							 | 
						|
								        })
							 | 
						|
								        // wx.navigateTo({
							 | 
						|
								        //     url: `/subpages/communitySelfInsp/pages/synthesis/synthesis?inspRecordId=${e.currentTarget.dataset.item.id}&monthName=${e.currentTarget.dataset.item.monthName}&status=${e.currentTarget.dataset.item.status}`,
							 | 
						|
								        // })
							 | 
						|
								    },
							 | 
						|
								    back() {
							 | 
						|
										//返回上一级,关闭当前页面
							 | 
						|
										wx.navigateBack({
							 | 
						|
											delta: 1
							 | 
						|
										})
							 | 
						|
									},
							 | 
						|
								})
							 |