471615499@qq.com d397749fbf 管理员功能
- 管理员进入系统
- 管理员进入会议室列表
- 管理员选择时间、占用会议、预约会议
- 管理员、普通人员权限
2024-09-28 17:46:21 +08:00

136 lines
2.4 KiB
JavaScript

const app = getApp()
import Notify from '@vant/weapp/notify/notify';
import {
pinyin
} from 'pinyin-pro'
import {
getDep,
} from "../../../../api/meeting/meetingRoom.js"
Page({
/**
* 页面的初始数据
*/
data: {
depId: '',
depList: {}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
console.log(options)
let _this = this
let depId = options.depId
_this.setData({
depId: depId
})
// 获取数据
_this.getData()
},
// 获取数据
getData() {
let _this = this
// 获取单位列表
getDep().then(res => {
console.log('单位列表', res)
let dep = res.data
let depList = {}
for (let key in dep) {
let eachObj = dep[key]
let depName = eachObj['orgName']
let depPinYin = pinyin(depName, {
pattern: 'first',
type: 'array'
})
depPinYin = depPinYin[0]
if (!depList.hasOwnProperty(depPinYin)) {
depList[depPinYin] = []
}
depList[depPinYin].push({
id: eachObj['orgId'],
name: depName
})
}
let newDepList = []
for (let key in depList) {
newDepList.push({
first: key,
dep: depList[key]
})
}
_this.setData({
depList: newDepList
})
})
},
// 选择单位方法
chooseDep(e) {
console.log(e)
let id = e.currentTarget.dataset.id
let name = e.currentTarget.dataset.name
// 数据状态变更,向上个页面传递变更
let pages = getCurrentPages() //获取page
let prevPage = pages[pages.length - 2] //上一个页面(父页面)
prevPage.setData({
dep: name,
depId: id,
'detail.depName': name,
'detail.depId': id,
})
wx.navigateBack()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})