// package/AIOTOverview/flowMonitoring/flowMonitoring.js import { getProjectList, getRelationList } from "../../../utils/getApiUrl"; import { Request } from "../../../common"; const moment = require("../../../utils/moment"); Page({ /** * 页面的初始数据 */ data: { structList: [], curStruId: 'all', // 选中结构物id cardData: [], cardDataCopy: [] }, onClose(e) { // 获取报告 // this.getPatrolReport(); }, onStruChange(e) { if (e.detail) { let data = [] if (e.detail === 'all') { data = this.data.cardDataCopy } else { data = this.data.cardDataCopy.filter(item => item.xjId === e.detail) } this.setData({ curStruId: e.detail, cardData: data }) } }, /** * 生命周期函数--监听页面加载 */ async onLoad(options) { let dd = [] const complexArray = JSON.parse(decodeURIComponent(options.data)) //获取结构物列表(巡检) const res = await Request.get(getProjectList()) const rslt = await Request.get(getRelationList()) if (res.rows.length && rslt.rows.length) { const filterData=res.rows.filter(s => s.type=='管廊' ) const data=filterData?.map(item=>( { value: item.id, text:item.name })) data.unshift({ text: '全部', value: 'all' }) if (complexArray && complexArray.length) { dd = complexArray.map(item => { return { ...item, structName: data?.find(q => q.value == item.xjId)?.text } }) } console.log('dd',dd) this.setData({ structList: data, cardData:dd , cardDataCopy:dd }) } }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })