epmet 工作端 小程序
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.

343 lines
10 KiB

// subpages/house/pages/housePortrait/housePortrait.js
import api from "../../../../utils/api"
1 year ago
import { getComplainList, getShengList, getPunchRecord, getShequList, getshijianList, getxuqiuList, getfuwuList, getMultiLogList } from "../../../../utils/businessRecords.js";
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
1 year ago
houseId: '',
detail: null,
1 year ago
logs: [],
residIds: [],
ywData: {},
ywVisible: false,
houseName:null
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
if( options.resiId){
this.setData({
houseId: options.resiId,
agencyLevel: app.globalData.user.level
})
this.getData()
}
},
handleGetResiId(item){
this.setData({
"detail.residentId":item.detail
})
},
1 year ago
getData() {
api.getClearHouseDeatilById(this.data.houseId).then((res) => {
this.setData({
detail: res.data,
houseName: res.data.houseName
});
return api.houseResidentChangeRecord({ houseId: this.data.houseId });
}).then((res) => {
1 year ago
this.setData({
1 year ago
logs: res.data
});
return api.getResiList({ homeId: this.data.houseId, pageNo: 1, pageSize: 1000 });
}).then((res) => {
const arr = res.data.list.map(item => item.resiId);
1 year ago
this.setData({
residIds: arr,
});
this.getTabData();
}).catch((error) => {
this.setData({
detail: null,
});
if(error.code != 0){
wx.showToast({
title: error.msg,
icon:'none',
duration:3000,
success:function(){
setTimeout(()=>{
wx.navigateBack({
delta: 1
})
},3000)
}
})
}
});
},
toEvent() {
let obj = {
resiId: this.data.detail.residentId,
resiMobile: this.data.detail.ownerPhone,
resiName: this.data.detail.ownerName
}
wx.setStorageSync('resiDetail', obj)
wx.navigateTo({
url: '/subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck',
})
},
handelTopunchCard(){
wx.navigateTo({
url: '/subpages/searchResult/pages/punchCard/punchCard?resiId=' + this.data.detail.residentId,
})
},
toWebView() {
if (app.globalData.questionnaireUrl) {
wx.navigateTo({
url: '/pages/webView/webView?url=' + app.globalData.questionnaireUrl,
})
} else {
wx.showToast({
icon: "none",
title: '未创建满意度调查问卷',
})
}
},
handelClickAddResi(){
wx.navigateTo({
url: `/subpages/addResi/pages/addResi/addResi?type=add&grid=${this.data.detail.gridId}&neighborHoodId=${this.data.detail.neighborHoodId}&buildingId=${this.data.detail.buildingId}&buildingUnitId=${this.data.detail.buildingUnitId}&doorId=${this.data.detail.id}`,
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.getTabData();
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
},
1 year ago
gotopage({ currentTarget: { dataset } }) {
const { url } = dataset
wx.navigateTo({
url
})
},
1 year ago
async getTabData() {
if (this.data.residIds.length === 0) {
this.setData({
ywVisible: true,
ywData: { "12345": [], "provinceSurvey": [], "selfSurvey": [], "event": [], "need": [], "serve": [], "punchRecord": [] }
})
return
}
let params1 = {
"residList": this.data.residIds,
"eventType": "3"
}
await getComplainList(params1).then(res => {
this.data.ywData['12345'] = res.data.list.map(item => {
return {
...item,
categorycode: item.categorycode || '--',
eventcontent: item.eventcontent || '--'
}
});
this.setData({
data: this.data.ywData
})
})
let params = {
"residList": this.data.residIds
}
await getShengList(params).then(res => {
if (res.data && res.data.length > 0) {
let renamedArray = [];
res.data.forEach(item => {
let renamedItem = {
categorycode: item.scope || '--',
eventcontent: item.problemDesc || '--'
};
renamedArray.push(renamedItem);
});
this.data.ywData['provinceSurvey'] = renamedArray;
this.setData({
ywData: this.data.ywData
})
} else {
this.data.ywData['provinceSurvey'] = [];
this.setData({
ywData: this.data.ywData
})
}
})
await getShequList(params).then(res => {
if (res.data && res.data.length > 0) {
let renamedArray = [];
res.data.forEach(item => {
let renamedItem = {
categorycode: item.scope || '--',
eventcontent: item.problemDesc || '--'
};
renamedArray.push(renamedItem);
});
this.data.ywData['selfSurvey'] = renamedArray;
this.setData({
ywData: this.data.ywData
})
} else {
this.data.ywData['selfSurvey'] = [];
this.setData({
ywData: this.data.ywData
})
}
})
await getshijianList(params).then(res => {
if (res.data && res.data.length > 0) {
let renamedArray = [];
res.data.forEach(item => {
let renamedItem = {
categorycode: item.categorycode || '--',
eventcontent: item.eventcontent || '--'
};
renamedArray.push(renamedItem);
});
this.data.ywData['event'] = renamedArray;
this.setData({
ywData: this.data.ywData
})
} else {
this.data.ywData['event'] = [];
this.setData({
ywData: this.data.ywData
})
}
})
await getxuqiuList(params).then(res => {
if (res.data && res.data.length > 0) {
let renamedArray = [];
res.data.forEach(item => {
let renamedItem = {
categorycode: item.parentName || '--',
eventcontent: item.content || '--'
};
renamedArray.push(renamedItem);
});
this.data.ywData['need'] = renamedArray;
this.setData({
ywData: this.data.ywData
})
} else {
this.data.ywData['need'] = [];
this.setData({
ywData: this.data.ywData
})
}
})
1 year ago
await getfuwuList(params).then(res => {
if (res.data && res.data.length > 0) {
let renamedArray = [];
res.data.forEach(item => {
let renamedItem = {
categorycode: item.serviceCategoryKey || '--',
eventcontent: item.serviceName || '--'
};
renamedArray.push(renamedItem);
});
this.data.ywData['serve'] = renamedArray;
this.setData({
ywData: this.data.ywData
})
} else {
this.data.ywData['serve'] = [];
this.setData({
ywData: this.data.ywData
})
}
})
const residIds = this.data.residIds.map(function(item) {
return encodeURIComponent(item);
}).join(',');
const params2 = {
"resiIdList": residIds,
pageNo: 1,
pageSize: 1000,
}
await getMultiLogList(params2).then(res => {
if (res.data && res.data.length > 0) {
let arr = [];
res.data.forEach(item => {
item.list.forEach(item1=>{
arr.push(item1)
})
})
this.data.ywData['punchRecord'] = arr;
this.setData({
ywData: this.data.ywData,
})
} else {
this.data.ywData['punchRecord'] = [];
this.setData({
ywData: this.data.ywData
})
}
})
this.setData({
ywVisible: true
})
},
clickGraphNode(parm){
if(parm.detail.data.type === 0){
wx.navigateTo({
url: `/subpages/searchResult/pages/resiInfo/resiInfo?resiId=${parm.detail.data.id}`,
})
}else{
this.setData({
houseId:parm.detail.data.id
})
this.getData()
}
},
})