zhaoxiaohai 3 lat temu
rodzic
commit
86ab0ad412

+ 0 - 2
packageA/project/addAndEdit.wxml

@@ -5,8 +5,6 @@
     <van-button custom-class='new-submit query' disabled='{{countDown}}' bindclick='queryRepetition'>{{countDown?countDown+'S':"查重"}}</van-button>
     <van-button custom-class='new-submit query' disabled='{{countDown}}' bindclick='queryRepetition'>{{countDown?countDown+'S':"查重"}}</van-button>
     <van-button custom-class='new-submit' disabled='{{disabled}}' bindclick='submit'>提交</van-button>
     <van-button custom-class='new-submit' disabled='{{disabled}}' bindclick='submit'>提交</van-button>
 </view>
 </view>
-
-
 <!-- 查重 -->
 <!-- 查重 -->
 <van-popup show="{{ repetitionShow }}" custom-class='popup' round position="bottom" custom-style="height: 100%;" bind:close="repClose">
 <van-popup show="{{ repetitionShow }}" custom-class='popup' round position="bottom" custom-style="height: 100%;" bind:close="repClose">
     <view class="title">
     <view class="title">

+ 72 - 7
packageA/target/index.js

@@ -2,6 +2,7 @@ const _Http = getApp().globalData.http;
 
 
 Page({
 Page({
     data: {
     data: {
+        pickerIndex: 0,
         showText: "全部",
         showText: "全部",
         popupShow: false,
         popupShow: false,
         activeId: null,
         activeId: null,
@@ -67,19 +68,54 @@ Page({
                 hrList
                 hrList
             })
             })
         });
         });
+        this.getYear(true)
+
+    },
+    getYear(init = false) {
         /* 获取年份 */
         /* 获取年份 */
         _Http.basic({
         _Http.basic({
             "classname": "sysmanage.develop.optiontype.optiontype",
             "classname": "sysmanage.develop.optiontype.optiontype",
             "method": "optiontypeselect",
             "method": "optiontypeselect",
             "content": {
             "content": {
-                pageSize : 999,
+                pageSize: 999,
                 "typename": 'targetyearofpersonal',
                 "typename": 'targetyearofpersonal',
                 "parameter": {
                 "parameter": {
                     "siteid": wx.getStorageSync('siteP').siteid
                     "siteid": wx.getStorageSync('siteP').siteid
                 }
                 }
             }
             }
         }).then(res => {
         }).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() {
     onShow() {
@@ -124,16 +160,15 @@ Page({
     toDetail() {
     toDetail() {
         if (this.data.active == "业绩目标") {
         if (this.data.active == "业绩目标") {
             wx.navigateTo({
             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 {
         } else {
             wx.navigateTo({
             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) {
     getData(e) {
-        console.log(e)
         if (e) this.setData({
         if (e) this.setData({
             showText: this.data.text ? this.data.text : '全部'
             showText: this.data.text ? this.data.text : '全部'
         })
         })
@@ -239,9 +274,12 @@ Page({
     bindDateChange({
     bindDateChange({
         detail
         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({
         this.setData({
-            "content.year": detail.value
+            "content.year": year,
+            pickerIndex: index
         });
         });
         this.getData();
         this.getData();
     },
     },
@@ -249,10 +287,37 @@ Page({
     tabsChange({
     tabsChange({
         detail
         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({
         this.setData({
             "content.targettype": detail.title == '业绩目标' ? '人员目标' : '项目目标',
             "content.targettype": detail.title == '业绩目标' ? '人员目标' : '项目目标',
             active: detail.title
             active: detail.title
         });
         });
+        console.log(123)
         this.getData();
         this.getData();
     },
     },
     onShareAppMessage() {}
     onShareAppMessage() {}

+ 1 - 3
packageA/target/index.wxml

@@ -9,13 +9,11 @@
     <view catchtap="openActions">
     <view catchtap="openActions">
         {{actionSheet}}<text class="iconfont icon-daoruxialajiantou" />
         {{actionSheet}}<text class="iconfont icon-daoruxialajiantou" />
     </view>
     </view>
-    <picker mode="date" value="{{content.year}}" fields='year' bindchange="bindDateChange">
+    <picker bindchange="bindDateChange" value="{{pickerIndex}}" range="{{active=='业绩目标'?userYearList:projectYearList}}">
         <view class="picker"><text class="iconfont icon-niandu" style="margin-right: 10rpx; color: #999;" />{{content.year}}<text class="iconfont icon-daoruxialajiantou" /></view>
         <view class="picker"><text class="iconfont icon-niandu" style="margin-right: 10rpx; color: #999;" />{{content.year}}<text class="iconfont icon-daoruxialajiantou" /></view>
     </picker>
     </picker>
 </view>
 </view>
 <van-action-sheet show="{{ showActions }}" actions="{{ actions }}" bind:select='select' bind:cancel='cancelActions' cancel-text="取消" />
 <van-action-sheet show="{{ showActions }}" actions="{{ actions }}" bind:select='select' bind:cancel='cancelActions' cancel-text="取消" />
-
-
 <van-popup show="{{ popupShow }}" position="bottom" custom-style="height:100%;" round closeable bind:close="onClose">
 <van-popup show="{{ popupShow }}" position="bottom" custom-style="height:100%;" round closeable bind:close="onClose">
     <view class="header">选择分析对象</view>
     <view class="header">选择分析对象</view>
     <view style="height: 90rpx;" />
     <view style="height: 90rpx;" />

+ 8 - 3
packageA/target/person.js

@@ -14,7 +14,9 @@ Page({
      */
      */
     onLoad(options) {
     onLoad(options) {
         this.setData({
         this.setData({
-            year: options.year
+            year: options.year,
+            yearArr: options.yearArr.split(","),
+            pickerIndex: options.pickerIndex
         })
         })
         this.getData();
         this.getData();
     },
     },
@@ -36,13 +38,16 @@ Page({
             })
             })
         })
         })
     },
     },
+
     /* 选择年份 */
     /* 选择年份 */
     bindDateChange({
     bindDateChange({
         detail
         detail
     }) {
     }) {
-        if (this.data.year == detail.value) return;
+        let index = detail.value;
+        if (this.data.pickerIndex == detail.value) return;
         this.setData({
         this.setData({
-            "year": detail.value
+            "year": this.data.yearArr[detail.value],
+            pickerIndex: index
         });
         });
         this.getData();
         this.getData();
     },
     },

+ 1 - 1
packageA/target/person.wxml

@@ -1,4 +1,4 @@
-<picker mode="date" value="{{year}}" fields='year' bindchange="bindDateChange">
+<picker bindchange="bindDateChange" value="{{pickerIndex}}" range="{{yearArr}}">
     <view class="picker"><text class="iconfont icon-niandu" style="margin-right: 10rpx; color: #999;" />{{year}}<text class="iconfont icon-daoruxialajiantou" /></view>
     <view class="picker"><text class="iconfont icon-niandu" style="margin-right: 10rpx; color: #999;" />{{year}}<text class="iconfont icon-daoruxialajiantou" /></view>
 </picker>
 </picker>
 
 

+ 17 - 2
packageA/target/project.js

@@ -18,7 +18,9 @@ Page({
     onLoad(options) {
     onLoad(options) {
         this.setData({
         this.setData({
             year: options.year,
             year: options.year,
-            'content.year': options.year
+            'content.year': options.year,
+            yearArr: options.yearArr.split(","),
+            pickerIndex: options.pickerIndex
         })
         })
         this.getList();
         this.getList();
         this.getProjectList();
         this.getProjectList();
@@ -41,7 +43,7 @@ Page({
             url: './addProject?data=' + JSON.stringify(project) + '&year=' + this.data.year,
             url: './addProject?data=' + JSON.stringify(project) + '&year=' + this.data.year,
         })
         })
     },
     },
-    /* 选择年份 */
+    /* 选择年份 
     bindDateChange({
     bindDateChange({
         detail
         detail
     }) {
     }) {
@@ -51,6 +53,19 @@ Page({
             "content.year": detail.value
             "content.year": detail.value
         });
         });
         this.getList(true);
         this.getList(true);
+    },*/
+    /* 选择年份 */
+    bindDateChange({
+        detail
+    }) {
+        let index = detail.value;
+        if (this.data.pickerIndex == detail.value) return;
+        this.setData({
+            "year": this.data.yearArr[detail.value],
+            "content.year": this.data.yearArr[detail.value],
+            pickerIndex: index
+        });
+        this.getList(true);
     },
     },
     getList(init = false) {
     getList(init = false) {
         //init 用于初始化分页
         //init 用于初始化分页

+ 4 - 1
packageA/target/project.wxml

@@ -1,5 +1,8 @@
 <view class="head">
 <view class="head">
-    <picker mode="date" value="{{year}}" fields='year' bindchange="bindDateChange">
+    <!--   <picker mode="date" value="{{year}}" fields='year' bindchange="bindDateChange">
+        <view class="picker"><text class="iconfont icon-niandu" style="margin-right: 10rpx; color: #999;" />{{year}}<text class="iconfont icon-daoruxialajiantou" /></view>
+    </picker> -->
+    <picker bindchange="bindDateChange" value="{{pickerIndex}}" range="{{yearArr}}">
         <view class="picker"><text class="iconfont icon-niandu" style="margin-right: 10rpx; color: #999;" />{{year}}<text class="iconfont icon-daoruxialajiantou" /></view>
         <view class="picker"><text class="iconfont icon-niandu" style="margin-right: 10rpx; color: #999;" />{{year}}<text class="iconfont icon-daoruxialajiantou" /></view>
     </picker>
     </picker>
     <view>项目共{{total}}个</view>
     <view>项目共{{total}}个</view>

+ 2 - 2
pages/tabbar/home/index.js

@@ -177,12 +177,12 @@ Page({
                     apps: {}
                     apps: {}
                 })
                 })
 
 
-                gridList.push({
+                /* gridList.push({
                     name: "任务",
                     name: "任务",
                     path: "/packageA/work/index",
                     path: "/packageA/work/index",
                     icon: "icon-xiaochengxu_xiaoshouyuce",
                     icon: "icon-xiaochengxu_xiaoshouyuce",
                     apps: {}
                     apps: {}
-                })
+                }) */
             }
             }
             /* 首页小组件查询 */
             /* 首页小组件查询 */
             try {
             try {