Browse Source

获取开启年度更改接口

xiaohaizhao 2 years ago
parent
commit
7bbce11fcc
1 changed files with 18 additions and 22 deletions
  1. 18 22
      packageA/target/index.js

+ 18 - 22
packageA/target/index.js

@@ -56,7 +56,13 @@ Page({
                     id: v.departmentid,
                     id: v.departmentid,
                     text: v.depname,
                     text: v.depname,
                     children: v.hr.map(value => {
                     children: v.hr.map(value => {
-                        const text = value.position ? value.name + ` (${value.position})` : value.name
+                        const text = value.position ? value.name + ` (${value.position})` : value.name;
+                        if (value.hrid == wx.getStorageSync('userMsg').hrid) this.setData({
+                            hrid: value.hrid,
+                            activeId: value.hrid,
+                            text: value.name,
+                            showText: value.name
+                        })
                         return {
                         return {
                             id: value.hrid,
                             id: value.hrid,
                             text
                             text
@@ -73,16 +79,12 @@ Page({
     getYear(init = false) {
     getYear(init = false) {
         /* 获取年份 */
         /* 获取年份 */
         _Http.basic({
         _Http.basic({
-            "classname": "sysmanage.develop.optiontype.optiontype",
-            "method": "optiontypeselect",
+            "id": 20230728090204,
             "content": {
             "content": {
-                pageSize: 999,
-                "typename": 'targetyearofpersonal',
-                "parameter": {
-                    "siteid": wx.getStorageSync('siteP').siteid
-                }
+                "targettype": "人员目标"
             }
             }
         }).then(res => {
         }).then(res => {
+            console.log("人员开启年度", res)
             if (res.msg != '成功') return wx.showToast({
             if (res.msg != '成功') return wx.showToast({
                 title: res.msg,
                 title: res.msg,
                 icon: "none"
                 icon: "none"
@@ -96,17 +98,12 @@ Page({
         })
         })
         /* 获取年份 */
         /* 获取年份 */
         _Http.basic({
         _Http.basic({
-            "classname": "sysmanage.develop.optiontype.optiontype",
-            "method": "optiontypeselect",
+            "id": 20230728090204,
             "content": {
             "content": {
-                pageSize: 999,
-                "typename": 'targetyearofproject',
-                "parameter": {
-                    "siteid": wx.getStorageSync('siteP').siteid
-                }
+                "targettype": "项目目标"
             }
             }
         }).then(res => {
         }).then(res => {
-            console.log('项目分类', res)
+            console.log('项目开启年度', res)
             if (res.msg != '成功') return wx.showToast({
             if (res.msg != '成功') return wx.showToast({
                 title: res.msg,
                 title: res.msg,
                 icon: "none"
                 icon: "none"
@@ -216,12 +213,13 @@ Page({
             //绘制线图
             //绘制线图
             this.selectComponent("#line").render(lineData);
             this.selectComponent("#line").render(lineData);
             // this.selectComponent("#histogram").render(histogram);
             // this.selectComponent("#histogram").render(histogram);
+
             this.setData({
             this.setData({
                 targetYear: {
                 targetYear: {
                     yl: res.data.y1l,
                     yl: res.data.y1l,
                     yh: res.data.y1h,
                     yh: res.data.y1h,
                     ya: res.data.y1a,
                     ya: res.data.y1a,
-                    jl: (res.data.y1a == 0 && res.data.y1l == 0) ? '0.00%' : res.data.y1l == 0 ? res.data.y1a + '%' : (res.data.y1a / res.data.y1l * 100).toFixed(2) + '%'
+                    jl: (res.data.y1a == 0 || res.data.y1l == 0) ? '0.00%' : res.data.y1l == 0 ? res.data.y1a + '%' : (res.data.y1a / res.data.y1l * 100).toFixed(2) + '%'
                 }
                 }
             });
             });
             if (this.data.year == this.data.content.year) {
             if (this.data.year == this.data.content.year) {
@@ -237,13 +235,13 @@ Page({
                         sl: res.data[`s${s}l`],
                         sl: res.data[`s${s}l`],
                         sh: res.data[`s${s}h`],
                         sh: res.data[`s${s}h`],
                         sa: res.data[`s${s}a`],
                         sa: res.data[`s${s}a`],
-                        jl: (res.data[`s${s}a`] == 0 && res.data[`s${s}l`] == 0) ? '0.00%' : res.data[`s${s}l`] == 0 ? res.data[`s${s}a`] + '%' : (res.data[`s${s}a`] / res.data[`s${s}l`] * 100).toFixed(2) + '%'
+                        jl: (res.data[`s${s}a`] == 0 || res.data[`s${s}l`] == 0) ? '0.00%' : res.data[`s${s}l`] == 0 ? res.data[`s${s}a`] + '%' : (res.data[`s${s}a`] / res.data[`s${s}l`] * 100).toFixed(2) + '%'
                     },
                     },
                     targetMonth: {
                     targetMonth: {
                         ml: res.data[`m${m}l`],
                         ml: res.data[`m${m}l`],
                         mh: res.data[`m${m}h`],
                         mh: res.data[`m${m}h`],
                         ma: res.data[`m${m}a`],
                         ma: res.data[`m${m}a`],
-                        jl: (res.data[`m${m}a`] == 0 && res.data[`m${m}l`] == 0) ? '0.00%' : res.data[`m${m}l`] == 0 ? res.data[`m${m}a`] + '%' : (res.data[`m${m}a`] / res.data[`m${m}l`] * 100).toFixed(2) + '%'
+                        jl: (res.data[`m${m}a`] == 0 || res.data[`m${m}l`] == 0) ? '0.00%' : res.data[`m${m}l`] == 0 ? res.data[`m${m}a`] + '%' : (res.data[`m${m}a`] / res.data[`m${m}l`] * 100).toFixed(2) + '%'
                     }
                     }
                 })
                 })
             }
             }
@@ -318,8 +316,6 @@ Page({
             "content.targettype": detail.title == '业绩目标' ? '人员目标' : '项目目标',
             "content.targettype": detail.title == '业绩目标' ? '人员目标' : '项目目标',
             active: detail.title
             active: detail.title
         });
         });
-        console.log(123)
         this.getData();
         this.getData();
-    },
-    onShareAppMessage() {}
+    }
 })
 })