|
@@ -9,8 +9,17 @@ Page({
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
- userIndex: 0,
|
|
|
- userArray: ['软件学院计算机系刘天仙', '文学院哲学系陈方明'],
|
|
|
+ userInfo: '',
|
|
|
+ apiTotal: '',
|
|
|
+ listCollege: '',
|
|
|
+ listDept: '',
|
|
|
+ listUser: '',
|
|
|
+ userArray: [
|
|
|
+ [],
|
|
|
+ [],
|
|
|
+ []
|
|
|
+ ],
|
|
|
+ value: [0, 0, 0],
|
|
|
deviceIndex: 2,
|
|
|
deviceArray: [],
|
|
|
deviceList: '',
|
|
@@ -19,10 +28,113 @@ Page({
|
|
|
list: []
|
|
|
},
|
|
|
|
|
|
+ getCollegeInfo: function(e) {
|
|
|
+ const that = this;
|
|
|
+ util.httpRequest(api.getDeptInfo, {
|
|
|
+ companyId: that.data.userInfo.companyId,
|
|
|
+ level: 1
|
|
|
+ }, 'post').then(res => {
|
|
|
+ let arrayCollege = [];
|
|
|
+ if (res.data.length >= 1) {
|
|
|
+ for (let i = 0; i < res.data.length; i++) {
|
|
|
+ arrayCollege.push(res.data[i].deptName)
|
|
|
+ if (i == res.data.length - 1) {
|
|
|
+ let userArray = that.data.userArray;
|
|
|
+ userArray[0] = arrayCollege;
|
|
|
+ that.setData({
|
|
|
+ userArray: userArray,
|
|
|
+ listCollege: res.data
|
|
|
+ })
|
|
|
+ that.getDeptInfo();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ getDeptInfo: function(e) {
|
|
|
+ const that = this;
|
|
|
+ util.httpRequest(api.getDeptInfo, {
|
|
|
+ companyId: that.data.userInfo.companyId,
|
|
|
+ parentId: that.data.listCollege[that.data.value[0]].deptId
|
|
|
+ }, 'post').then(res => {
|
|
|
+ let arrayDept = [];
|
|
|
+ if (res.data.length >= 1) {
|
|
|
+ for (let i = 0; i < res.data.length; i++) {
|
|
|
+ arrayDept.push(res.data[i].deptName)
|
|
|
+ if (i == res.data.length - 1) {
|
|
|
+ let userArray = that.data.userArray
|
|
|
+ userArray[1] = arrayDept
|
|
|
+ that.setData({
|
|
|
+ userArray: userArray,
|
|
|
+ listDept: res.data
|
|
|
+ })
|
|
|
+ that.getRegisterInfo()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ let userArray = that.data.userArray;
|
|
|
+ userArray[1] = arrayDept
|
|
|
+ userArray[2] = []
|
|
|
+ that.setData({
|
|
|
+ userArray: userArray,
|
|
|
+ listDept: '',
|
|
|
+ list: ''
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ getRegisterInfo: function(status = 0) {
|
|
|
+ const that = this;
|
|
|
+ util.httpRequest(api.getRegisterInfo, {
|
|
|
+ deptId: that.data.listDept[that.data.value[1]].deptId,
|
|
|
+ register: status
|
|
|
+ }, 'post').then(res => {
|
|
|
+ let arrayUser = [];
|
|
|
+ if (res.data.data.data.length >= 1) {
|
|
|
+ for (let i = 0; i < res.data.data.data.length; i++) {
|
|
|
+ arrayUser.push(res.data.data.data[i].userName)
|
|
|
+ if (i == res.data.data.data.length - 1) {
|
|
|
+ let userArray = that.data.userArray
|
|
|
+ userArray[2] = arrayUser
|
|
|
+ that.setData({
|
|
|
+ userArray: userArray,
|
|
|
+ listUser: res.data.data.data
|
|
|
+ })
|
|
|
+ that.getPassInfo();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ let userArray = that.data.userArray
|
|
|
+ userArray[2] = arrayUser
|
|
|
+ that.setData({
|
|
|
+ userArray: userArray,
|
|
|
+ listUser: '',
|
|
|
+ list: ''
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
bindUserChange: function(e) {
|
|
|
- this.setData({
|
|
|
- userIndex: e.detail.value
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ columnChange: function(e) {
|
|
|
+ const that = this;
|
|
|
+ let value = that.data.value
|
|
|
+ value[e.detail.column] = e.detail.value
|
|
|
+ that.setData({
|
|
|
+ value: value
|
|
|
})
|
|
|
+ if (e.detail.column == 0) {
|
|
|
+ that.getDeptInfo()
|
|
|
+ } else if (e.detail.column == 1) {
|
|
|
+ that.getRegisterInfo()
|
|
|
+ } else if (e.detail.column == 2) {
|
|
|
+ that.getPassInfo();
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
bindDeviceChange: function(e) {
|
|
@@ -57,7 +169,6 @@ Page({
|
|
|
deviceArray: deviceArray,
|
|
|
deviceList: res.data
|
|
|
})
|
|
|
- that.getPassInfo();
|
|
|
}
|
|
|
}
|
|
|
})
|
|
@@ -66,7 +177,7 @@ Page({
|
|
|
getPassInfo: function(e) {
|
|
|
const that = this;
|
|
|
util.httpRequest(api.getPassInfo, {
|
|
|
- loginId: 15286831873,
|
|
|
+ loginId: that.data.listUser[that.data.value[2]].loginid,
|
|
|
start: that.data.startDate,
|
|
|
end: that.data.endDate,
|
|
|
driviceId: that.data.deviceList[that.data.deviceIndex].id,
|
|
@@ -96,7 +207,6 @@ Page({
|
|
|
minute = minute < 10 ? "0" + minute : minute;
|
|
|
second = second < 10 ? "0" + second : second;
|
|
|
date = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second;
|
|
|
- console.log(date);
|
|
|
return date;
|
|
|
},
|
|
|
|
|
@@ -105,6 +215,11 @@ Page({
|
|
|
*/
|
|
|
onLoad: function(options) {
|
|
|
const that = this;
|
|
|
+ that.setData({
|
|
|
+ apiTotal: api.total.substring(0, api.total.length - 4)
|
|
|
+ })
|
|
|
+ that.data.userInfo = wx.getStorageSync('user');
|
|
|
+ that.getCollegeInfo();
|
|
|
that.getDeviceInfo();
|
|
|
},
|
|
|
|