|
|
@@ -2,6 +2,7 @@ const _Http = getApp().globalData.http;
|
|
|
|
|
|
Page({
|
|
|
data: {
|
|
|
+ pickerIndex: 0,
|
|
|
showText: "全部",
|
|
|
popupShow: false,
|
|
|
activeId: null,
|
|
|
@@ -67,19 +68,54 @@ Page({
|
|
|
hrList
|
|
|
})
|
|
|
});
|
|
|
+ this.getYear(true)
|
|
|
+
|
|
|
+ },
|
|
|
+ getYear(init = false) {
|
|
|
/* 获取年份 */
|
|
|
_Http.basic({
|
|
|
"classname": "sysmanage.develop.optiontype.optiontype",
|
|
|
"method": "optiontypeselect",
|
|
|
"content": {
|
|
|
- pageSize : 999,
|
|
|
+ pageSize: 999,
|
|
|
"typename": 'targetyearofpersonal',
|
|
|
"parameter": {
|
|
|
"siteid": wx.getStorageSync('siteP').siteid
|
|
|
}
|
|
|
}
|
|
|
}).then(res => {
|
|
|
- console.log('人员分类', res)
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ userYearList: res.data.map(v => v.year),
|
|
|
+ "content.year": res.data.length ? res.data[res.data.length - 1].year : this.data.content.year,
|
|
|
+ year: res.data.length ? res.data[res.data.length - 1].year : this.data.year,
|
|
|
+ pickerIndex: res.data.length - 1
|
|
|
+ })
|
|
|
+ if (init) this.getData();
|
|
|
+ })
|
|
|
+ /* 获取年份 */
|
|
|
+ _Http.basic({
|
|
|
+ "classname": "sysmanage.develop.optiontype.optiontype",
|
|
|
+ "method": "optiontypeselect",
|
|
|
+ "content": {
|
|
|
+ pageSize: 999,
|
|
|
+ "typename": 'targetyearofproject',
|
|
|
+ "parameter": {
|
|
|
+ "siteid": wx.getStorageSync('siteP').siteid
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.log('项目分类', res)
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ projectYearList: res.data.map(v => v.year)
|
|
|
+ })
|
|
|
})
|
|
|
},
|
|
|
onShow() {
|
|
|
@@ -124,16 +160,15 @@ Page({
|
|
|
toDetail() {
|
|
|
if (this.data.active == "业绩目标") {
|
|
|
wx.navigateTo({
|
|
|
- url: './person?year=' + this.data.content.year
|
|
|
+ url: `./person?year=${this.data.content.year}&yearArr=${this.data.userYearList}&pickerIndex=${this.data.pickerIndex}`
|
|
|
})
|
|
|
} else {
|
|
|
wx.navigateTo({
|
|
|
- url: './project?year=' + this.data.content.year
|
|
|
+ url: `./project?year=${this.data.content.year}&yearArr=${this.data.projectYearList}&pickerIndex=${this.data.pickerIndex}`
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
getData(e) {
|
|
|
- console.log(e)
|
|
|
if (e) this.setData({
|
|
|
showText: this.data.text ? this.data.text : '全部'
|
|
|
})
|
|
|
@@ -239,9 +274,12 @@ Page({
|
|
|
bindDateChange({
|
|
|
detail
|
|
|
}) {
|
|
|
- if (this.data.content.year == detail.value) return;
|
|
|
+ let index = detail.value;
|
|
|
+ let year = this.data.active == '业绩目标' ? this.data.userYearList[index] : this.data.projectYearList[index];
|
|
|
+ if (year == detail.value) return;
|
|
|
this.setData({
|
|
|
- "content.year": detail.value
|
|
|
+ "content.year": year,
|
|
|
+ pickerIndex: index
|
|
|
});
|
|
|
this.getData();
|
|
|
},
|
|
|
@@ -249,10 +287,37 @@ Page({
|
|
|
tabsChange({
|
|
|
detail
|
|
|
}) {
|
|
|
+ let year = this.data.content.year;
|
|
|
+ if (detail.title == '业绩目标') {
|
|
|
+ let i = this.data.userYearList.findIndex(v => year == v)
|
|
|
+ if (i == -1) {
|
|
|
+ this.setData({
|
|
|
+ "content.year": this.data.userYearList[this.data.userYearList.length - 1],
|
|
|
+ pickerIndex: this.data.userYearList.length - 1
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.setData({
|
|
|
+ pickerIndex: i
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ let i = this.data.projectYearList.findIndex(v => year == v);
|
|
|
+ if (i == -1) {
|
|
|
+ this.setData({
|
|
|
+ "content.year": this.data.projectYearList[this.data.projectYearList.length - 1],
|
|
|
+ pickerIndex: this.data.projectYearList.length - 1
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.setData({
|
|
|
+ pickerIndex: i
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
this.setData({
|
|
|
"content.targettype": detail.title == '业绩目标' ? '人员目标' : '项目目标',
|
|
|
active: detail.title
|
|
|
});
|
|
|
+ console.log(123)
|
|
|
this.getData();
|
|
|
},
|
|
|
onShareAppMessage() {}
|