export const mixin = {
  data() {
    let _self = this
    return {
      btDateShow:false,
      btDate:[],
      dateType:3,
      format:'本月',
      options2: {
        shortcuts: [
          {
            text: '本日',
            onClick(){
              _self.$refs['date-picker'].visible = false
              _self.format = '本日'
              _self.dateType = 1
              _self.getReport()
            }
          },
          {
            text: '本周',
            onClick(){
              _self.$refs['date-picker'].visible = false
              _self.format = '本周'
              _self.dateType = 2
              _self.getReport()
            }
          },
          {
            text: '本月',
            onClick(){
              _self.$refs['date-picker'].visible = false
              _self.format = '本月'
              _self.dateType = 3
              _self.getReport()

            }
          },
          {
            text: '本年',
            onClick(){
              _self.$refs['date-picker'].visible = false
              _self.format = '本年'
              _self.dateType = 5
              _self.getReport()
            }
          },
          {
            text: '区间',
            onClick(){
              _self.$refs['date-picker'].visible = false
              // _self.format = '区间'
              _self.dateType = 6
              _self.btDateShow = true
              // _self.getReport()
            }
          }
        ]
      },
      date:new Date(),
    }
  },
  methods:{
    init(date,dateType,format,staffIds,staffList,orgIds,orgList,btDate){
      this.active = 0
      this.month = date
      this.orgIds = orgIds
      this.orgList = orgList
      this.staffIds = staffIds
      this.staffList = staffList
      this.format = format
      this.dateType = dateType
      this.btDate = btDate
      this.getReport()
      this.$nextTick(()=>{
        if(this.$refs['van-tabs']){
          this.$refs['van-tabs'].resize()
        }
      })
    },
    onChangeDate(){
      this.format = 'yyyy年MM月'
      this.dateType = 0
      // this.getReport()
    },
    changeSearch(){
      // this.getReport()
    },
    btOk(){
      this.format = '区间：'+this.btDate[0].format('yyyy-MM-dd') + '-' + this.btDate[1].format('yyyy-MM-dd')
      this.btDateShow = false
      this.getReport()
    },
    getQjDate(){
      return {beginDate: this.btDate[0].format('yyyy-MM-dd'),endDate: this.btDate[1].format('yyyy-MM-dd')}
    },
  }
}
