|
@@ -2,8 +2,14 @@ const _Http = getApp().globalData.http;
|
|
|
|
|
|
Page({
|
|
Page({
|
|
data: {
|
|
data: {
|
|
|
|
+ showText: "全部",
|
|
|
|
+ popupShow: false,
|
|
|
|
+ activeId: null,
|
|
|
|
+ mainActiveIndex: 0,
|
|
active: "业绩目标",
|
|
active: "业绩目标",
|
|
targetYear: null,
|
|
targetYear: null,
|
|
|
|
+ hrid: null,
|
|
|
|
+ departmentid: null,
|
|
"year": new Date().getFullYear().toString(),
|
|
"year": new Date().getFullYear().toString(),
|
|
"content": {
|
|
"content": {
|
|
"nocache": true,
|
|
"nocache": true,
|
|
@@ -29,10 +35,77 @@ Page({
|
|
}],
|
|
}],
|
|
},
|
|
},
|
|
onLoad(options) {
|
|
onLoad(options) {
|
|
- this.getData();
|
|
|
|
|
|
+ /* 获取部门列表 */
|
|
|
|
+ _Http.basic({
|
|
|
|
+ "id": 20220922113302,
|
|
|
|
+ "content": {
|
|
|
|
+ pageSize: 9999
|
|
|
|
+ }
|
|
|
|
+ }).then(res => {
|
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
|
+ title: res.msg,
|
|
|
|
+ icon: "none"
|
|
|
|
+ })
|
|
|
|
+ let hrList = res.data.map(v => {
|
|
|
|
+ v.hr.unshift({
|
|
|
|
+ name: v.depname + ' (包含所有下级)',
|
|
|
|
+ hrid: v.departmentid
|
|
|
|
+ })
|
|
|
|
+ return {
|
|
|
|
+ id: v.departmentid,
|
|
|
|
+ text: v.depname,
|
|
|
|
+ children: v.hr.map(value => {
|
|
|
|
+ const text = value.position ? value.name + ` (${value.position})` : value.name
|
|
|
|
+ return {
|
|
|
|
+ id: value.hrid,
|
|
|
|
+ text
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ this.setData({
|
|
|
|
+ hrList
|
|
|
|
+ })
|
|
|
|
+ });
|
|
},
|
|
},
|
|
onShow() {
|
|
onShow() {
|
|
- console.log(123123)
|
|
|
|
|
|
+ this.getData();
|
|
|
|
+ },
|
|
|
|
+ onClickNav({
|
|
|
|
+ detail
|
|
|
|
+ }) {
|
|
|
|
+ this.setData({
|
|
|
|
+ mainActiveIndex: detail.index
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ onClickItem({
|
|
|
|
+ detail
|
|
|
|
+ }) {
|
|
|
|
+ let hrid = null,
|
|
|
|
+ departmentid = null;
|
|
|
|
+ if (detail.text.includes('包含所有下级')) {
|
|
|
|
+ departmentid = detail.id
|
|
|
|
+ } else {
|
|
|
|
+ hrid = detail.id
|
|
|
|
+ };
|
|
|
|
+ let text = detail.text.split("(")[0];
|
|
|
|
+ this.setData({
|
|
|
|
+ hrid,
|
|
|
|
+ departmentid,
|
|
|
|
+ activeId: detail.id,
|
|
|
|
+ text
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ /* 切换分析对象 */
|
|
|
|
+ openPupop() {
|
|
|
|
+ this.setData({
|
|
|
|
+ popupShow: true
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ onClose() {
|
|
|
|
+ this.setData({
|
|
|
|
+ popupShow: false
|
|
|
|
+ })
|
|
},
|
|
},
|
|
toDetail() {
|
|
toDetail() {
|
|
if (this.data.active == "业绩目标") {
|
|
if (this.data.active == "业绩目标") {
|
|
@@ -45,12 +118,19 @@ Page({
|
|
})
|
|
})
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- getData() {
|
|
|
|
|
|
+ getData(e) {
|
|
|
|
+ console.log(e)
|
|
|
|
+ if (e) this.setData({
|
|
|
|
+ showText: this.data.text ? this.data.text : '全部'
|
|
|
|
+ })
|
|
|
|
+ let content = this.data.content;
|
|
|
|
+ if (this.data.hrid) content.hrid = this.data.hrid;
|
|
|
|
+ if (this.data.departmentid) content.departmentid = this.data.departmentid;
|
|
_Http.basic({
|
|
_Http.basic({
|
|
"id": 20220920133102,
|
|
"id": 20220920133102,
|
|
- "content": this.data.content
|
|
|
|
|
|
+ content
|
|
}).then(res => {
|
|
}).then(res => {
|
|
- console.log(res)
|
|
|
|
|
|
+ this.onClose()
|
|
if (res.msg != '成功') return wx.showToast({
|
|
if (res.msg != '成功') return wx.showToast({
|
|
title: res.data,
|
|
title: res.data,
|
|
icon: "none"
|
|
icon: "none"
|