2024-09-13 17:09:25 +08:00
|
|
|
|
const app = getApp()
|
|
|
|
|
|
|
|
|
|
import Notify from '@vant/weapp/notify/notify';
|
2024-09-24 17:36:03 +08:00
|
|
|
|
import {
|
|
|
|
|
depLogin
|
|
|
|
|
} from "../../../api/login/login.js"
|
2024-09-13 17:09:25 +08:00
|
|
|
|
Page({
|
|
|
|
|
|
2024-09-16 18:22:00 +08:00
|
|
|
|
/**
|
|
|
|
|
* 页面的初始数据
|
|
|
|
|
*/
|
|
|
|
|
data: {
|
|
|
|
|
IMG_NAME: app.IMG_NAME,
|
|
|
|
|
userDetail: {},
|
|
|
|
|
menuList: [{
|
|
|
|
|
type: "report",
|
|
|
|
|
name: "会议预约",
|
2024-09-18 20:35:54 +08:00
|
|
|
|
img: "/profile/static/meeting/index/reservation.png",
|
2024-09-16 18:22:00 +08:00
|
|
|
|
path: "/pages/meeting/meetingReservation/meetingReservation",
|
2024-09-20 15:47:11 +08:00
|
|
|
|
visible: false
|
2024-09-16 18:22:00 +08:00
|
|
|
|
}, {
|
|
|
|
|
type: "query",
|
|
|
|
|
name: "预约记录",
|
2024-09-18 20:35:54 +08:00
|
|
|
|
img: "/profile/static/meeting/index/record.png",
|
2024-09-16 18:22:00 +08:00
|
|
|
|
path: "/pages/meeting/reservationRecord/meetingRecord/meetingRecord",
|
|
|
|
|
visible: true
|
|
|
|
|
}, {
|
|
|
|
|
type: "assign",
|
|
|
|
|
name: "会议审核",
|
2024-09-18 20:35:54 +08:00
|
|
|
|
img: "/profile/static/meeting/index/examine.png",
|
2024-09-17 20:26:20 +08:00
|
|
|
|
path: "/pages/meeting/reservationRecord/approve/approve",
|
|
|
|
|
visible: true
|
2024-09-16 18:22:00 +08:00
|
|
|
|
}, {
|
|
|
|
|
type: "repair",
|
|
|
|
|
name: "会务服务",
|
2024-09-18 20:35:54 +08:00
|
|
|
|
img: "/profile/static/meeting/index/serve.png",
|
2024-09-17 20:26:20 +08:00
|
|
|
|
path: "/pages/meeting/reservationRecord/service/service",
|
|
|
|
|
visible: true
|
2024-09-16 18:22:00 +08:00
|
|
|
|
}],
|
|
|
|
|
timeShow: false,
|
|
|
|
|
currentDate: new Date().getTime(),
|
|
|
|
|
minDate: new Date().getTime(),
|
|
|
|
|
maxDate: '',
|
|
|
|
|
formatter(type, value) {
|
|
|
|
|
if (type === 'year') {
|
|
|
|
|
return `${value}年`;
|
|
|
|
|
}
|
|
|
|
|
if (type === 'month') {
|
|
|
|
|
return `${value}月`;
|
|
|
|
|
}
|
|
|
|
|
if (type === 'day') {
|
|
|
|
|
return `${value}日`;
|
|
|
|
|
}
|
|
|
|
|
return value;
|
2024-09-13 17:09:25 +08:00
|
|
|
|
},
|
2024-09-20 15:47:11 +08:00
|
|
|
|
// 用户登录相关参数
|
|
|
|
|
showLogin: false, // 是否展示弹出层
|
|
|
|
|
username: '', // 用户名
|
|
|
|
|
pwd: '', // 登录密码
|
2024-09-24 17:36:03 +08:00
|
|
|
|
depName: '', // 登录单位
|
2024-09-24 23:04:06 +08:00
|
|
|
|
depId: '', // 登录单位id
|
2024-09-20 15:47:11 +08:00
|
|
|
|
beforeClose(action) {
|
|
|
|
|
return new Promise(resolve => {
|
|
|
|
|
if (action === 'confirm') {
|
|
|
|
|
resolve(false)
|
|
|
|
|
} else {
|
|
|
|
|
resolve(true)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}, // 弹出层点击确认不关闭,手动关
|
2024-09-16 18:22:00 +08:00
|
|
|
|
},
|
|
|
|
|
showTimePicker() {
|
2024-09-20 15:47:11 +08:00
|
|
|
|
this.setData({
|
|
|
|
|
timeShow: true
|
|
|
|
|
});
|
2024-09-16 18:22:00 +08:00
|
|
|
|
},
|
|
|
|
|
hideTimePicker() {
|
2024-09-20 15:47:11 +08:00
|
|
|
|
this.setData({
|
|
|
|
|
timeShow: false
|
|
|
|
|
});
|
2024-09-16 18:22:00 +08:00
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
|
*/
|
|
|
|
|
onLoad(options) {
|
|
|
|
|
let _this = this
|
|
|
|
|
// 获取一月后时间,默认只能选一个月之后
|
|
|
|
|
const today = new Date()
|
|
|
|
|
const newDate = new Date(today)
|
|
|
|
|
newDate.setMonth(newDate.getMonth() + 1)
|
|
|
|
|
let userDetail = wx.getStorageSync('user')
|
|
|
|
|
_this.setData({
|
|
|
|
|
userDetail,
|
|
|
|
|
maxDate: newDate.getTime()
|
|
|
|
|
})
|
2024-09-13 17:09:25 +08:00
|
|
|
|
// 展示模块
|
2024-09-16 18:22:00 +08:00
|
|
|
|
_this.visibleBlock()
|
|
|
|
|
},
|
|
|
|
|
// 跳转会议预约页面
|
|
|
|
|
goRes(e) {
|
|
|
|
|
wx.navigateTo({
|
2024-09-24 23:04:06 +08:00
|
|
|
|
url: '/pages/meeting/meetingReservation/meetingReservation?time=' + e.detail + '&dep=' + this.data.depName + '&depId=' + this.data.depId,
|
2024-09-16 18:22:00 +08:00
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 跳转菜单
|
|
|
|
|
jumpMenu(e) {
|
|
|
|
|
console.log('jumpMenu', e);
|
|
|
|
|
let obj = e.currentTarget.dataset.obj
|
|
|
|
|
if (obj.visible) {
|
|
|
|
|
// 未授权
|
|
|
|
|
if (obj.name == '会议预约') {
|
|
|
|
|
// 会议预约需要先选择时间
|
|
|
|
|
this.showTimePicker()
|
|
|
|
|
} else {
|
|
|
|
|
wx.navigateTo({
|
|
|
|
|
url: obj.path,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (obj.name === '会议预约') {
|
|
|
|
|
// 未授权
|
2024-09-20 15:47:11 +08:00
|
|
|
|
this.setData({
|
|
|
|
|
showLogin: true
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
// app.selfShowMsg('您暂无权限使用该功能,请联系机关事务局XXX(电话15888888888)进行赋权后使用')
|
2024-09-16 18:22:00 +08:00
|
|
|
|
} else {
|
|
|
|
|
app.vantNotifyErrTop(Notify, `"${obj.name}"无权限访问!`)
|
|
|
|
|
return
|
|
|
|
|
}
|
2024-09-13 17:09:25 +08:00
|
|
|
|
}
|
2024-09-16 18:22:00 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 展示模块
|
|
|
|
|
visibleBlock() {
|
|
|
|
|
let _this = this
|
|
|
|
|
let userDetail = _this.data.userDetail
|
|
|
|
|
let dataType = userDetail.dataType
|
|
|
|
|
let menuList = _this.data.menuList
|
|
|
|
|
// 角色类型 1.普通用户,3派单员,5维修工,7管理员 , 9楼层
|
|
|
|
|
// if (dataType == 3 || dataType == 7) { // 展示-派单入口,仅有派单员、管理员能进
|
|
|
|
|
// menuList = menuList.map(item => {
|
|
|
|
|
// if (item.type == 'assign') {
|
|
|
|
|
// item.visible = true
|
|
|
|
|
// }
|
|
|
|
|
// return item
|
|
|
|
|
// })
|
|
|
|
|
// }
|
|
|
|
|
// if (dataType == 5) { // 展示-维修入口
|
|
|
|
|
// menuList = menuList.map(item => {
|
|
|
|
|
// if (item.type == 'repair') {
|
|
|
|
|
// item.visible = true
|
|
|
|
|
// }
|
|
|
|
|
// return item
|
|
|
|
|
// })
|
|
|
|
|
// }
|
|
|
|
|
// _this.setData({
|
|
|
|
|
// menuList
|
|
|
|
|
// })
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
back() {
|
|
|
|
|
wx.navigateBack()
|
|
|
|
|
},
|
|
|
|
|
|
2024-09-20 15:47:11 +08:00
|
|
|
|
onCloseLogin(e) {
|
|
|
|
|
let _this = this;
|
|
|
|
|
_this.setData({
|
|
|
|
|
cancelId: '',
|
|
|
|
|
showCancelReason: false,
|
|
|
|
|
cancelReason: ''
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
onChangeUsername(e) {
|
|
|
|
|
let _this = this;
|
|
|
|
|
_this.setData({
|
|
|
|
|
username: e.detail
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
onChangePwd(e) {
|
|
|
|
|
let _this = this;
|
|
|
|
|
_this.setData({
|
|
|
|
|
pwd: e.detail
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 认证方法
|
|
|
|
|
orderLogin() {
|
|
|
|
|
let _this = this;
|
|
|
|
|
let uName = _this.data.username
|
|
|
|
|
let pwd = _this.data.pwd
|
|
|
|
|
if (uName === '' || pwd === '') {
|
|
|
|
|
Notify({
|
|
|
|
|
message: '请填写用户名、密码!',
|
|
|
|
|
top: 50
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
2024-09-24 17:36:03 +08:00
|
|
|
|
depLogin({
|
|
|
|
|
loginName: uName,
|
|
|
|
|
password: pwd
|
|
|
|
|
}).then(res => {
|
|
|
|
|
if (res.code !== 0) {
|
|
|
|
|
Notify({
|
|
|
|
|
message: '认证失败!',
|
|
|
|
|
top: 50
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
// 认证通过
|
|
|
|
|
Notify({
|
|
|
|
|
type: 'success',
|
|
|
|
|
message: '认证通过!',
|
|
|
|
|
top: 50
|
|
|
|
|
})
|
|
|
|
|
_this.setData({
|
|
|
|
|
['menuList[0].visible']: true,
|
|
|
|
|
username: '',
|
|
|
|
|
pwd: '',
|
|
|
|
|
showLogin: false,
|
2024-09-24 23:04:06 +08:00
|
|
|
|
depName: res.data.orgName,
|
|
|
|
|
depId: res.data.orgId,
|
2024-09-24 17:36:03 +08:00
|
|
|
|
})
|
|
|
|
|
this.showTimePicker()
|
|
|
|
|
}
|
|
|
|
|
console.log('depLogin', res)
|
|
|
|
|
|
2024-09-20 15:47:11 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
},
|
2024-09-16 18:22:00 +08:00
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
|
|
*/
|
|
|
|
|
onReady() {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面显示
|
|
|
|
|
*/
|
|
|
|
|
onShow() {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
|
|
*/
|
|
|
|
|
onHide() {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
|
|
*/
|
|
|
|
|
onUnload() {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
|
|
*/
|
|
|
|
|
onPullDownRefresh() {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
|
|
*/
|
|
|
|
|
onReachBottom() {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 用户点击右上角分享
|
|
|
|
|
*/
|
|
|
|
|
onShareAppMessage() {
|
|
|
|
|
|
|
|
|
|
}
|
2024-09-13 17:09:25 +08:00
|
|
|
|
})
|