|
@@ -10,11 +10,17 @@ Page({
|
|
* 页面的初始数据
|
|
* 页面的初始数据
|
|
*/
|
|
*/
|
|
data: {
|
|
data: {
|
|
|
|
+ userInfo: '',
|
|
totalInfo: '',
|
|
totalInfo: '',
|
|
startDate: '2019-10-29',
|
|
startDate: '2019-10-29',
|
|
endDate: '2019-10-29',
|
|
endDate: '2019-10-29',
|
|
- scopeIndex: 0,
|
|
|
|
- scopeArray: ['全部人员'],
|
|
|
|
|
|
+ listCollege: '',
|
|
|
|
+ listDept: '',
|
|
|
|
+ userArray: [
|
|
|
|
+ [],
|
|
|
|
+ []
|
|
|
|
+ ],
|
|
|
|
+ value: [0, 0],
|
|
weiguiList: []
|
|
weiguiList: []
|
|
},
|
|
},
|
|
|
|
|
|
@@ -30,12 +36,80 @@ Page({
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
|
|
- bindScopeChange: function(e) {
|
|
|
|
- this.setData({
|
|
|
|
- scopeIndex: e.detail.value
|
|
|
|
|
|
+ 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.getStatisticsInfo();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ let userArray = that.data.userArray;
|
|
|
|
+ userArray[1] = arrayDept
|
|
|
|
+ that.setData({
|
|
|
|
+ userArray: userArray,
|
|
|
|
+ listDept: '',
|
|
|
|
+ list: ''
|
|
|
|
+ })
|
|
|
|
+ }
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ bindUserChange: function(e) {
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ 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.getStatisticsInfo();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+
|
|
getChart: function(e) {
|
|
getChart: function(e) {
|
|
const that = this;
|
|
const that = this;
|
|
ringChart = new wxCharts({
|
|
ringChart = new wxCharts({
|
|
@@ -91,9 +165,16 @@ Page({
|
|
|
|
|
|
getStatisticsInfo: function(e) {
|
|
getStatisticsInfo: function(e) {
|
|
const that = this;
|
|
const that = this;
|
|
|
|
+ let deptId;
|
|
|
|
+ if (that.data.listDept != '') {
|
|
|
|
+ deptId = that.data.listDept[that.data.value[1]].deptId
|
|
|
|
+ } else {
|
|
|
|
+ deptId = that.data.listCollege[that.data.value[0]].deptId
|
|
|
|
+ }
|
|
util.httpRequest(api.getStatisticsInfo, {
|
|
util.httpRequest(api.getStatisticsInfo, {
|
|
start: that.data.startDate,
|
|
start: that.data.startDate,
|
|
- end: that.data.endDate
|
|
|
|
|
|
+ end: that.data.endDate,
|
|
|
|
+ deptId: deptId
|
|
}, 'post').then(res => {
|
|
}, 'post').then(res => {
|
|
that.setData({
|
|
that.setData({
|
|
totalInfo: res.data.data
|
|
totalInfo: res.data.data
|
|
@@ -133,7 +214,8 @@ Page({
|
|
*/
|
|
*/
|
|
onLoad: function(options) {
|
|
onLoad: function(options) {
|
|
const that = this;
|
|
const that = this;
|
|
- that.getStatisticsInfo();
|
|
|
|
|
|
+ that.data.userInfo = wx.getStorageSync('user');
|
|
|
|
+ that.getCollegeInfo();
|
|
that.getUnInInfo();
|
|
that.getUnInInfo();
|
|
that.getOutAndInInfo();
|
|
that.getOutAndInInfo();
|
|
},
|
|
},
|