// pages/workBenchNew/components/uninstallMeter/index.js import dayjs from "../../../../utils/dayjs" import { alertInfo, } from "../../../../utils/index" Page({ /** * 页面的初始数据 */ data: { }, onParkFocus(e) { this.setData({ show: true, title: "园区", type: 'park' }) }, onMeterFocus(e) { const { park } = this.data; if (!park) { alertInfo("请先选择园区") return; } this.setData({ show: true, title: "电表", type: 'meter' }) }, onConfirm(e) { const { type, data = {} } = e.detail; const {collection} = this.data; switch(type) { case "park": this.setData({ park: data.id, parkName: data.name, }) break; case "tenement": this.setData({ tenement: data.id, tenementName: data.name, }) break; case "building": this.setData({ building: data.id, buildingName: data.name, }); break; case "meterBox": this.setData({ meterBox: data.id, meterBoxName: data.address, }); break; case "meterType": this.setData({ meterType: data.way, meterTypeName: data, }); break; case "meter": this.setData({ meter: data.id, meterName: data.address, }); break; case "card": this.setData({ card: data.id, cardName: data.sim_number, }); break; case "collection": let newData = {} if (collection === "A") { newData = { collectionA: data.id, collectionAName: data.name, } } if (collection === "B") { newData = { collectionB: data.id, collectionBName: data.name, } } if (collection === "C") { newData = { collectionC: data.id, collectionCName: data.name, } } this.setData(newData); break; } this.onCancel(); }, onCancel() { this.setData({ show: false, title: "", type: "", }) }, goback() { wx.navigateBack() }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { this.setData({ time: dayjs().format("YYYY-MM-DD HH:mm:ss") }) }, changeReason(e) { this.setData({ reason: e.detail, }) }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })