2024-03-01 16:42:56 +08:00

223 lines
5.4 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const app = getApp()
import {
meetingRoomDict,
} from "../../../api/meeting/meetingRoom.js"
Page({
/**
* 页面的初始数据
*/
data: {
IMG_NAME: app.IMG_NAME,
queryParam: {
meetingTypeDict: {
list: [],
value: null,
},
personDict: {
list: [],
value: null,
},
itemDict: {
list: [],
value: null,
title: '设备'
},
shapeDict: {
list: [],
value: null,
},
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
// 页面初始化 options为页面跳转所带来的参数
wx.setNavigationBarTitle({
title: options.name
})
// 初始化数据
this.initData();
},
// 初始化数据
initData() {
let _this = this;
// 1.会议室类型2.人数3.会议室设备4.形式
meetingRoomDict("1").then(res => {
console.log('meetingRoomDict("1")', res);
// 封装参数
let list = res.roomContents.map(item => {
return {
text: item.typeName,
value: item.typeValue
}
})
list = [{
text: "类型",
value: null
}, ...list]
// 赋值参数
let queryParam = _this.data.queryParam;
queryParam.meetingTypeDict.list = list;
_this.setData({
queryParam
})
console.log('meetingRoomDict("1")=>', list);
})
meetingRoomDict("2").then(res => {
console.log('meetingRoomDict("2")', res);
// 封装参数
let list = res.roomContents.map(item => {
return {
text: item.capacityNum + '人',
value: item.capacityNum
}
})
list = [{
text: "人数",
value: null
}, ...list]
// 赋值参数
let queryParam = _this.data.queryParam;
queryParam.personDict.list = list;
_this.setData({
queryParam
})
console.log('meetingRoomDict("2")=>', list);
})
meetingRoomDict("3").then(res => {
console.log('meetingRoomDict("3")', res);
// 封装参数
let list = res.roomItem.map(item => {
return {
text: item.name,
value: item.name
}
})
list = [{
text: "设备",
value: null
}, ...list]
// 赋值参数
let queryParam = _this.data.queryParam;
queryParam.itemDict.list = list;
_this.setData({
queryParam
})
console.log('meetingRoomDict("3")=>', list);
})
meetingRoomDict("4").then(res => {
console.log('meetingRoomDict("4")', res);
// 封装参数
let list = res.roomContents.map(item => {
return {
text: item.shape,
value: item.shape
}
})
list = [{
text: "形式",
value: null
}, ...list]
// 赋值参数
let queryParam = _this.data.queryParam;
queryParam.shapeDict.list = list;
_this.setData({
queryParam
})
console.log('meetingRoomDict("4")=>', list);
})
},
// 查询条件变动
dictChange(e) {
console.log('dictChange', e);
let queryParam = this.data.queryParam;
queryParam[e.currentTarget.dataset.type].value = e.detail;
this.setData({
queryParam
})
},
// 设备-多选
dictSwitchChange(e) {
console.log('dictSwitchChange', e);
let select = e.detail;
let name = e.currentTarget.dataset.name;
let queryParam = this.data.queryParam;
queryParam.itemDict.list = queryParam.itemDict.list.map(item => {
if (item.text == name) {
item.select = select;
}
return item
})
this.setData({
queryParam
})
},
// 设备多选确定
itemDictConfirm() {
this.selectComponent('#itemSelect').toggle();
},
// 会议室
jumpMeetingRoom() {
wx.navigateTo({
url: "/pages/meeting/meetingRoom/meetingRoom",
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})