const _Http = getApp().globalData.http;

Page({
    data: {
        year: null
    },
    onLoad(options) {
        this.setData({
            year: options.year,
            yearArr: options.yearArr.split(","),
            pickerIndex: options.pickerIndex,
            YL: JSON.parse(options.UYL)
        })
        this.getData();
        getApp().globalData.Language.getLanguagePackage(this, '人员目标');
    },
    getData() {
        _Http.basic({
            "id": 20220920161302,
            "content": {
                "year": this.data.year,
                "targettype": "人员目标",
                "hrid": wx.getStorageSync('userMsg').hrid
            },
        }).then(res => {
            if (res.code != '1') return wx.showToast({
                title: res.data,
                icon: "none"
            })
            this.setData({
                person: res.data
            })
        })
    },
    /* 选择年份 */
    bindDateChange({
        detail
    }) {
        let index = detail.value;
        if (this.data.pickerIndex == detail.value) return;
        this.setData({
            "year": this.data.yearArr[detail.value],
            pickerIndex: index
        });
        this.getData();
    },
})