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.

293 lines
8.7 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";
Page({
/**
* 页面的初始数据
*/
data: {
1 year ago
houseId: '',
detail: {},
1 year ago
logs: [],
residIds: [],
ywData: {},
ywVisible: false,
houseName:null
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
houseId: options.resiId,
})
this.getData()
},
1 year ago
getData() {
api.getClearHouseDeatilById(this.data.houseId).then((res) => {
this.setData({
detail: res.data,
houseName: res.data.houseName
1 year ago
})
}).catch((error) => {
});
1 year ago
api.houseResidentChangeRecord({ houseId: this.data.houseId }).then((res) => {
1 year ago
this.setData({
1 year ago
logs: res.data
1 year ago
})
}).catch((error) => {
console.error("发生错误:", error);
1 year ago
});
1 year ago
api.getResiList({ homeId: this.data.houseId, pageNo: 1, pageSize: 1000 }).then(res => {
const arr = res.data.list.map(item => {
return item.resiId
})
this.setData({
residIds: arr,
})
this.getTabData()
})
},
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() {
},
/**
* 生命周期函数--监听页面隐藏
*/
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()
}
},
})