<template>
  <div class="box" style="position: relative">
    <el-page-header @back="$router.go(-1)" class="header"></el-page-header>
    <div style="position:absolute;top:23px;left:126px;color:#303133;font-size: 17px;"><WWOpenData type="userName" :openid="dataList.employee_name"></WWOpenData>{{date}}绩效</div>
    <div class="search">
      <el-button type="primary" @click="audit" style="width: 100px;margin-right: 10px;" v-if="dataList.review_performance === 1">审批</el-button>
      <el-date-picker v-model="date" :clearable="false" type="month" placeholder="选择月" value-format="yyyy-MM"></el-date-picker>
    </div>
    <div class="flex-box">
      <div class="flex-1 flex-box flex-v-ce">
        <div class="point">
          <div>{{dataList.base_point}}</div>
          <div>月平衡分</div>
        </div>
        <div class="point" v-if="dataList.status==3">
          <div>{{dataList.review_point}}</div>
          <div>最终得分</div>
        </div>
      </div>

      <div class="flex-box" style="height: 20px;">
        <el-dropdown>
          <span class="el-dropdown-link">终审人<i class="el-icon-arrow-down el-icon--right"></i></span>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item v-if="dataList.reviewer_name"><WWOpenData type="userName" :openid="dataList.reviewer_name"></WWOpenData></el-dropdown-item>
            <el-dropdown-item class="fontColorF" v-else>无数据</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
        <el-dropdown style="margin-left: 20px;">
          <span class="el-dropdown-link">
            <el-tooltip placement="top" style="margin-right: 5px;">
              <div slot="content">发布人可修改/删除绩效</div>
              <span class="tips">?</span>
            </el-tooltip>发布人<i class="el-icon-arrow-down el-icon--right"></i>
          </span>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item v-if="dataList.publisher_name"><WWOpenData type="userName" :openid="dataList.publisher_name"></WWOpenData></el-dropdown-item>
            <el-dropdown-item class="fontColorF" v-else>无数据</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
        <el-dropdown style="margin-left: 20px;">
          <span class="el-dropdown-link">
            <el-tooltip placement="top" style="margin-right: 5px;">
              <div slot="content">监察员可查看次员工的月绩效，参与月终的绩效评审。</div>
              <span class="tips">?</span>
            </el-tooltip>监察员<i class="el-icon-arrow-down el-icon--right"></i>
          </span>
          <el-dropdown-menu slot="dropdown">
            <template v-if="dataList.notice_info.length>0">
              <el-dropdown-item  v-for="(item, index) in dataList.notice_info" :key="index"><WWOpenData type="userName" :openid="item.name"></WWOpenData></el-dropdown-item>
            </template>
            <el-dropdown-item class="fontColorF" v-else>无数据</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </div>
    </div>
    <div class="table_page">
      <el-table :data="dataList.work_list" style="width:100%" ref="dataList" tooltip-effect="dark" v-loading="loading" @row-click="openDetail">
        <el-table-column prop="task_name" label="绩效工作" align="center" width="360px">
          <template slot-scope="scope">
            <div class="flex-box flex-v-ce">
              <el-progress type="circle" :percentage="scope.row.progress" :width="width"></el-progress>
              <span style="margin-left: 10px;">{{ scope.row.task_name }}</span>
            </div>
          </template>
        </el-table-column>
        <el-table-column prop="expire_time" width="140px" label="截止时间" align="center"></el-table-column>
        <el-table-column prop="orderNo" label="权重" align="center">
          <template slot-scope="scope">
            <span>{{ ((scope.row.base_point / dataList.base_point) * 100).toFixed(0) }}%</span>
          </template>
        </el-table-column>
        <el-table-column prop="base_point" label="绩效分" align="center"></el-table-column>
        <el-table-column prop="review_point" label="最终分" align="center"></el-table-column>
        <el-table-column prop="status" label="状态" align="center">
          <template slot-scope="scope">
            <span v-if="scope.row.status==1">待完成</span>
            <span v-if="scope.row.status==2" class="blue" @click.stop="openSp(scope.row)">审批</span>
            <span v-if="scope.row.status==4" class="green">已审批</span>
          </template>
        </el-table-column>
        <template slot="empty"><noData></noData></template>
      </el-table>
    </div>
    <!-- 审批弹窗 -->
    <el-dialog
      title="温馨提示："
      :visible.sync="examineAndApprov"
      top="32vh"
      width="450px"
      :before-close="exhandleClose">
      <span>当前员工还有 {{quantity}} 条绩效工作未评分，建议您先确认每项工作已评分，再对员工做整个月的绩效审批</span>
      <div class="dialog-footer" style="text-align:center;margin-top:25px;">
        <el-button @click="examineAndApprovTrue">已沟通处理，继续审批</el-button>
        <el-button type="primary" @click="examineAndApprov = false">好的，先确认工作评分</el-button>
      </div>
    </el-dialog>
    <!-- 抽屉 -->
    <el-drawer :visible.sync="drawer" :with-header="false" :before-close="handleClose">
      <div class="drawer_title">审批</div>
      <el-form :model="examineItem" ref="examineItem" label-width="100px" class="demo-ruleForm">
          <div class="fontColorF" style="margin-left: 0px;margin-bottom: 20px;">绩效和工资挂钩，通过前务必与相关负责人(人事，财务等人)开会确认
          </div>
          
          <div style="margin:0 0 10px 30px;color:#696969;">月平衡分<b style="padding-left:20px;">{{dataList.base_point}}</b></div>
          <el-form-item label="绩效积分" prop="point" :rules="[{required: true, message: '请输入绩效积分', trigger: 'blur' },{ type: 'number', message: '积分必须为数字值'}]">
              <el-input placeholder="请输入积分" v-model.number="examineItem.point"></el-input>
          </el-form-item>
          <el-form-item label="审批意见" prop="remark" :rules="[{ required: true, message: '请输入审批意见', trigger: 'blur' }]">
            <el-input type="textarea" v-model="examineItem.remark" maxlength="100" show-word-limit></el-input>
          </el-form-item>
          <el-form-item>
             <el-button @click="handleClose()">取消</el-button>
             <el-button :loading="btnLoad" type="primary" @click="submitForm('examineItem')">确定</el-button>
          </el-form-item>
       </el-form>
    </el-drawer>

    <!-- 抽屉2 -->
    <el-drawer :visible.sync="drawer2"  :with-header="false" :before-close="handleClose2">
      <div class="drawer_title">审批</div>

      <el-form :model="examineItem2"  ref="examineItem2" label-width="100px" class="demo-ruleForm">
        <!-- <div class="fontColorF" style="margin-left: 100px;margin-bottom: 20px;">任务100分</div> -->
        <el-form-item label="积分" prop="point" :rules="[{required: true, message: '请输入积分', trigger: 'blur' },{ type: 'number', message: '积分必须为数字值'}]">
           <el-input placeholder="请输入内容" v-model.number="examineItem2.point" class="input-with-select"></el-input>
        </el-form-item>
        <el-form-item label="审批意见">
          <el-input type="textarea" rows="3" v-model="examineItem2.remark" maxlength="50" show-word-limit></el-input>
        </el-form-item>
         <div class="fontColorF" style="margin-left: 100px;margin-bottom: 20px;">奖票用于优秀表现和重要事项的表彰</div>
        <el-form-item label="发放奖票">
          <el-switch v-model="ticket_count"></el-switch>
        </el-form-item>
<!--        <el-form-item label="递交审批">
          <div class="border flex-box flex-v-ce" @click="add_employee_show = true">
            <div class="flex-1 fontColorF" v-if="!selectUser.name">请选择</div>
            <div class="flex-1" v-else>{{selectUser.name}}</div>
            <i class="el-icon-arrow-down"></i>
          </div>
        </el-form-item> -->
        <el-form-item>
          <el-button @click="handleClose2()">取消</el-button>
          <el-button type="primary" @click="submitForm2('examineItem2')">确定</el-button>
        </el-form-item>
      </el-form>
    </el-drawer>

    <!-- 抽屉3 -->
    <el-drawer :visible.sync="drawer3"  :with-header="false" :before-close="handleClose">
      <div class="drawer_title">绩效工作详情</div>
      <div class="drawer_box" style="overflow: auto; height: calc(100vh - 81px);" v-if="workDetailData"  v-loading="loading">
        <div class="flex-box flex-v-ce">
          <userImage class="user_img person_imghead" width="46px" height="46px" :user_name="workDetailData.employee_name" :img_url="workDetailData.img_url"></userImage>
          <div class="d_userMessage">
            <div><WWOpenData type="userName" :openid="workDetailData.employee_name"></WWOpenData></div>
            <div v-if="workDetailData.dept_list[0]"><WWOpenData type="userName" :openid="workDetailData.dept_list[0].dept_name"></WWOpenData></div>
          </div>
        </div>
        <ul>
          <li class="flex-box">
            <div class="label">任务内容</div>
            <div class="content_text">{{workDetailData.task_name}}</div>
          </li>
          <li class="flex-box">
            <div class="label">任务备注</div>
            <textarea class="flex-1" disabled="disabled" v-model="workDetailData.task_remark"  style="border: none;height:100px">
            </textarea>
            <!-- <div class="content_text">{{workDetailData.task_remark}}</div> -->
          </li>
          <li class="flex-box">
            <div class="label">绩效分</div>
            <div class="content_text yellow">{{workDetailData.point_config.base_point}}</div>
          </li>
          <li class="flex-box" v-if="workDetailData.point_config.review_point">
            <div class="label">最终分</div>
            <div class="content_text yellow">{{workDetailData.point_config.review_point}}</div>
          </li>
          <li class="flex-box">
            <div class="label">创建时间</div>
            <div class="content_text">{{workDetailData.create_time}}</div>
          </li>
          <li class="flex-box">
            <div class="label">截止时间</div>
            <div class="content_text">{{workDetailData.expire_time}}</div>
          </li>
          <li class="flex-box" v-if="workDetailData.point_config.timeout_deduction_point>0">
            <div class="label">逾期扣分</div>
            <div class="content_text">{{workDetailData.point_config.timeout_deduction_point}}</div>
          </li>
          <li class="flex-box">
            <div class="label">审批人</div>
            <div class="content_text"><WWOpenData type="userName" :openid="workDetailData.reviewer_name"></WWOpenData></div>
          </li>
          <li class="flex-box">
            <div class="label">积分种类</div>
            <div class="content_text">{{workDetailData.pt_name}}</div>
          </li>
        </ul>
        <div class="d_progress">
          <div class="flex-box">
            <div class="flex-1">工作进度（{{workDetailData.progress}}%）</div>
            <div class="fontColorF addJf" @click="isSlider=true" v-if="workDetailData.employee_id==userId && workDetailData.status==1">+更新进度</div>
          </div>
          <el-progress :percentage="workDetailData.progress"></el-progress>
        </div>
      <el-tabs v-model="activeName" >
        <el-tab-pane label="工作记录" name="work">
          <div class="flex-box">
            <div class="flex-1"></div>
            <div class="fontColorF addJf" @click="isOne=true" v-if="workDetailData.employee_id==userId&&workDetailData.status==1 || workDetailData.employee_id==userId&&workDetailData.status==2">+记一条工作记录</div>
          </div>
          <div class="work_box" style="padding-top:10px">
            <div class="flex-box work_item" v-for="(item,index) in text_list">
                <userImage class="user_img person_imghead" width="40px" height="40px" :user_name="item.recorder" :img_url="item.img_url"></userImage>
                <div class="work_right flex-1">
                  <div class="flex-box">
                    <div class="d_name flex-1"><WWOpenData type="userName" :openid="item.recorder"></WWOpenData></div>
                    <div class="d_date">{{item.time}}</div>
                  </div>
                  <div class="d_content">{{item.remark}}</div>
                </div>
            </div>
            <div v-if="!text_list[0]" class="fontColorF" style="text-align: center;">暂无工作记录</div>
          </div>
        </el-tab-pane>
        <el-tab-pane label="记分记录" name="participation">
          <div class="flex-box" style="padding-bottom: 10px;border-bottom: 1px solid #f1f1f1;">
            <div class="flex-1 fontColorF"><span v-if="point_total>0">合计：{{point_total}}</span> </div>
            <div class="fontColorF addJf" @click="isIntegral=true" v-if="workDetailData.reviewer_id==userId&&workDetailData.status==1 || workDetailData.reviewer_id==userId&&workDetailData.status==2">+记分</div>
          </div>
          <div class="work_box" style="padding-top:10px">
            <div class="flex-box work_item" v-for="(item,index) in point_list">
                <userImage class="user_img person_imghead" width="40px" height="40px" :user_name="item.recorder" :img_url="item.img_url"></userImage>
                <div class="work_right flex-1">
                  <div class="flex-box">
                    <div class="d_name flex-1"><WWOpenData type="userName" :openid="item.recorder"></WWOpenData>
                    <span class="blue" v-if="item.point>0">+{{item.point}}</span>
                    <span class="green" v-if="item.point<0">{{item.point}}</span>
                    </div>
                    <div class="d_date">{{item.time}}</div>
                  </div>
                  <div class="d_content">{{item.remark}}</div>
                </div>
            </div>
            <div v-if="!point_list[0]" class="fontColorF" style="text-align: center;">暂无记分记录</div>
          </div>
        </el-tab-pane>
      </el-tabs>
        <div class="flex-box d_footer" v-if="workDetailData.reviewer_id==userId&&workDetailData.status==2">
          <div class="flex-1"></div>
          <el-button @click="handleClose()">取消</el-button>
          <el-button type="primary" @click="openSp()">审批</el-button>
        </div>
      </div>
    </el-drawer>

    <!-- 添加人员 -->
    <el-dialog title="添加人员" :visible.sync="add_employee_show" :before-close="publicClose"  width="700px">
        <EmployeeSelector1 v-if="add_employee_form" ref="Employee" :isChecKedAll="false" :can_select_dept="false" :multi="false" @confirm="add_employee_confirm"></EmployeeSelector1>
         <span slot="footer">
           <el-button @click="publicClose()">取消</el-button>
           <el-button type="primary" @click="sub_add_employee">完成</el-button>
         </span>
    </el-dialog>
    <!-- 更新进度 -->
    <el-dialog title="更新进度" :visible.sync="isSlider" :before-close="publicClose" width="40%">
        <div class="slider">
           <div class="fontColorF">拖动滑杆更新进度</div>
           <el-slider v-model="progress" :marks="{0:'0%'}"></el-slider>
        </div>
         <span slot="footer">
           <el-button @click="publicClose()">取消</el-button>
           <el-button type="primary" @click="sliderSend">完成</el-button>
         </span>
    </el-dialog>
    <!-- 记一条 -->
    <el-dialog title="记一条" :visible.sync="isOne" :before-close="publicClose" width="40%">
         <div class="flex-box">
           <div style="width: 80px;">工作记录</div>
           <el-input type="textarea" :rows="3" placeholder="请输入内容" v-model="textarea"></el-input>
         </div>
         <span slot="footer">
           <el-button @click="publicClose()">取消</el-button>
           <el-button type="primary" @click="one">完成</el-button>
         </span>
    </el-dialog>
    <!-- 记分记录 -->
    <el-dialog title="记分" :visible.sync="isIntegral" :before-close="publicClose" width="40%">
        <el-form :model="integral" ref="integral" label-width="80px" :rules="formRules">
          <el-form-item label="记录"  prop="text" :rules="[{ required: true, message: '记录不能为空'}]">
            <el-input type="textarea" :rows="3" v-model="integral.text"></el-input>
          </el-form-item>
          <!-- 记分不能为空 -->
          <el-form-item label="记分"  prop="num" >
          <!-- <el-form-item label="记分"  prop="num" :rules="[{ required: false, message: '记分不能为空'},{ type: 'number', message: '积分必须为数字值'}]"> -->
            <div class="num" :class="[integral.type=='1'?'add':'jian']"></div>
             <el-input placeholder="请输入内容" v-model.number="integral.num">
               <el-select v-model="integral.type" slot="prepend" placeholder="请选择" style="width: 80px;">
                 <el-option label="奖分" value="1"></el-option>
                 <el-option label="扣分" value="2"></el-option>
               </el-select>
             </el-input>
          </el-form-item>
        </el-form>
         <span slot="footer">
           <el-button @click="publicClose()">取消</el-button>
           <el-button type="primary" @click="integralSend('integral')">完成</el-button>
         </span>
    </el-dialog>
  </div>

</template>

<script>
  import EmployeeSelector1 from '@/views/common/EmployeeSelector1'
  import noData from '@/components/noData'
  const validatorNoZero = (rule, value, callback) => {//设置记分的验证
    if (value === 0) {
      return callback(new Error("记分不能为0"));
    } else if (value === '') {
      return callback(new Error("记分不能为空"));
    }else if (isNaN(value)){
      return callback(new Error("积分必须为数字值"));
    }else{
      callback();
    }
  };
  export default {
  name: 'examine_unit',
  components: {EmployeeSelector1,noData},
  data() {
    return {
      quantity:0,
      examineAndApprov:false,
      formRules:{//记分验证
        num: [
          {
            required: true,
            validator: validatorNoZero,
            trigger: "blur"
          }
        ],
      },
      width: 46,
      page: 1,
      perPage: 10,
      total: 0,
      loading: false,
      btnLoad:false,
      userId:this.$store.getters.user_info.id,
      employee_id:'',
      date: this.$moment().format('YYYY-MM'),
      dataList: {
        notice_info:[]
      },
      ticket_count:false,//是否奖票

      drawer: false,
      examineItem:{//审批实例
        package_id: 0,
        point:'',
        remark:''
      },

      drawer2: false,
      examineItem2: {//审批实例
        review_id: 0,
        action: 'complete',
        rule_id: 0,
        item_id: 0,
        point: 0,
        reviewer_id: 0,
        remark: '',
        ticket_count: 0
      },
      //人员选择
      add_employee_show:false,
      add_employee_form:{
        employee_ids:[]
      },
      //工作详情相关
      workDetail:'',
      workDetailData:'',
      drawer3: false,
      activeName: '',
      isSlider:false,
      isOne:false,
      isIntegral:false,
      textarea:'',//记录一条内容
      integral:{
        text:'',
        num:0,
        type:"1",
      },
      text_list:[],
      point_list:[],
      point_total:0,
      progress:0,

      selectUser:{},
      parameter:{},//参数
    };
  },
  watch:{
    "date"(){
      this.getData();
    },
    "ticket_count"(val){
      if(val){
        this.examineItem2.ticket_count=1;
      }else{
        this.examineItem2.ticket_count=0;
      }
    }
  },
  mounted() {
    if(this.$route.query.date&&this.$route.query.employee_id){
       this.employee_id=this.$route.query.employee_id;
       this.date=this.$route.query.date;
       this.getData();
    }
  },
  methods: {
    examineAndApprovTrue(){
      this.examineAndApprov = false
      this.drawer = true
    },
    audit(){
      let work_list = this.dataList.work_list
      let list = []
      let num = 0
      for(let i in work_list){
        num+=Number(work_list[i].review_point)
        if(work_list[i].status==1 || work_list[i].status==2){
          list.push(work_list[i])
        }
      }
      if(num==0){
        this.examineItem.point = ''
      }else{
        this.examineItem.point = num
      }
      if(list.length>0){
        this.quantity = list.length
        this.examineAndApprov = true
      }else{
        this.drawer=true
      }
    },
    exhandleClose(done){
      done();
    },
    one(){
        if(!this.textarea){
           this.$message.error("请输入备注内容");
           return
        }
        var self=this;
        var items=this.workDetailData.process.list;
        var process={
            img_url: this.$store.getters.user_info.img_url,
            point: 0,
            recorder_id: this.$store.getters.user_info.id,
            recorder: this.$store.getters.user_info.name,
            remark: this.textarea,
            time: this.$moment().format('YYYY-MM-DD HH:mm')
          }
        var data={
          work_id:this.workDetail.id,
          process:[],
        }
       items.unshift(process);
       data.process=items;
       self.$http('post','/api/integral/work',data).then(res => {
           if (res.data.code == 1) {
             self.publicClose();
               self.openDetail();
           } else {
            self.$message.error(res.data.msg);
           }
       })
    },
    integralSend(formName){
       var self=this;
       var items=this.workDetailData.process.list||[];
       var process={
            img_url: this.$store.getters.user_info.img_url,
            point:this.integral.type=="1" ?this.integral.num:'-'+this.integral.num,
            recorder_id: this.$store.getters.user_info.id,
            recorder: this.$store.getters.user_info.name,
            remark: this.integral.text,
            time: this.$moment().format('YYYY-MM-DD HH:mm')
          }
      var data={
          work_id:this.workDetail.id,
          process:[],
        }
      items.unshift(process);
      data.process=items;
      this.$refs[formName].validate((valid) => {
        if (valid) {
          self.$http('post','/api/integral/work',data).then(res => {
              if (res.data.code == 1) {
                self.openDetail();
                self.publicClose();
              } else {
               self.$message.error(res.data.msg);
              }
          }).finally(() => {

          });
        }
        })
    },

    //更新进度
    sliderSend(){
        var self=this;
        let data = {
          work_id: self.workDetailData.id,
          progress: self.progress,
        }
        self.$http('post','/api/integral/work',data).then(res => {
             if (res.data.code == 1) {
               self.openDetail();
               self.isSlider=false;
             }else{
               self.$message.error(res.data.msg);
             }
         })
    },
    //打开工作详情
    openDetail(item){
      var self=this;
      self.drawer3=true;
      self.loading = true;
      if(item){this.workDetail=item;}
      self.$http('get',`/api/integral/work?work_id=${this.workDetail.id}`).then(res => {
          if (res.data.code == 1) {
            self.loading = false;
            self.workDetailData=res.data.data;
            self.progress=self.workDetailData.progress;
            self.text_list = []
            self.point_list = []
            self.point_total = 0
            if (self.workDetailData.process.list && self.workDetailData.process.list.length > 0) {
              for (let i in self.workDetailData.process.list) {

                self.point_total += self.workDetailData.process.list[i].point * 1

                if (self.workDetailData.process.list[i].point != 0) {

                  self.point_list.push(self.workDetailData.process.list[i])
                } else {

                  self.text_list.push(self.workDetailData.process.list[i])
                }
              }
            }
           setTimeout(function(){
              self.activeName="work"
           },400)
          }else{
            self.loading = false;
            self.$message.error(res.data.msg);
          }
      })
    },
    //人员确定
    sub_add_employee(item){
      this.$refs.Employee.confirm();//调用组件的confirm（）；
      this.add_employee_show=false;
    },
    //人员选择
    add_employee_confirm(val){
      this.selectUser=val.employee[0];
    },
    //弹窗关闭公共方法
    publicClose(){
      this.isIntegral=false;
      this.isOne=false;
      this.isSlider=false;
      this.textarea='',//记录一条内容
      this.integral={
        text:'',
        num:0,
        type:"1",
      }
      this.add_employee_show=false;
    },
    //绩效包审批
    submitForm(formName) {
      var self=this;
      this.$refs[formName].validate((valid) => {
        if (valid) {
          self.examineItem.package_id=self.dataList.id;
          self.btnLoad = true;
          self.$http('put','/api/integral/performance',self.examineItem).then(res => {
              if (res.data.code == 1) {
               self.$message.success('已审批');
               self.handleClose();
              } else {
               self.$message.error(res.data.msg);
              }
          }).finally(() => {
                self.btnLoad = false;
          });
        } else {
          return false;
        }
      });
    },
    //绩效包工作任务审批
    submitForm2(formName) {
      var self=this;
      this.$refs[formName].validate((valid) => {
        if (valid) {
         self.examineItem2.review_id=self.workDetailData.review_id;
         self.examineItem2.reviewer_id=self.selectUser.id? self.selectUser.id:0;
         self.$http('post','/api/integral/review',self.examineItem2).then(res => {
             if (res.data.code == 1) {
               self.$message.success('已审批');
               self.openDetail();
               self.handleClose2();
             } else {
               self.$message.error(res.data.msg);
             }
         })
        }
      });
    },
    handleClose() {
      this.examineItem.point="";
      this.examineItem.remark="";
      this.drawer=false;
      this.activeName="";
      this.drawer3=false;
      this.getData();
    },
    handleClose2() {
      this.selectUser={};
      this.examineItem2={//审批实例
        review_id: 0,
        action: 'complete',
        rule_id: 0,
        item_id: 0,
        point: 0,
        reviewer_id: 0,
        remark: '',
        ticket_count: 0
      };
      this.ticket_count=false;//是否奖票
      this.drawer2=false;
      this.getData();
    },
    openSp(item){
      var self=this;
      if(item){
        this.workDetail=item;
        self.$http('get',`/api/integral/work?work_id=${item.id}`).then(res => {
            if (res.data.code == 1) {
              if(res.data.data.reviewer_id!=self.userId){
                self.$message.error("当前登录者不是该任务终审人!");
              }else{
                self.workDetailData=res.data.data;
                this.drawer2=true;
              }
            }else{
              self.$message.error(res.data.msg);
            }
        })
      }else{
          this.drawer2=true;
      }
    },

    getData() {
      let self = this;
      self.loading = true;
      self.$http('get','/api/integral/performance/info',{employee_id: self.employee_id, month: self.date })
        .then(res => {
          if (res.data.code == 1) {
            self.dataList = res.data.data||[]
            self.total = res.data.data.work_count;
          } else {
            self.$message.error(res.data.data.msg);
          }
        })
        .finally(() => {
          self.loading = false;
        });
    },
    //页码变更
    handleCurrentChange: function(val) {
      this.page = val;
      this.getData(this.page, this.perPage);
    }
  }
};
</script>

<style lang="scss" scoped="scoped">
  $blue: #26a2ff;
  $red: #f56c6c;
  $yellow: #e6a23c;
  $green: #67c23a;
  $fontColorZ: #303133;
  $fontColorF: #909399;
  $fontColorT: #c0c4cc;
  .green{
   color: #67c23a;
  }
  .blue{
    color:#26a2ff;
    cursor: pointer;
  }
  .fontColorF{
    color:#909399;
  }
  .yellow{color: #e6a23c;}
  .drawer_box{
    padding:0 20px;
    .d_userMessage{
      margin-left: 10px;
    }
    .d_userMessage div:nth-child(1){
      font-size: 16px;
      margin-bottom: 8px;
    }
    .d_userMessage div:nth-child(2){
      font-size: 12px;
      color: $fontColorF;
    }
    ul{
      padding: 12px 0;
      border-bottom: 1px solid #f1f1f1;
    }
    li{
      padding: 6px 0;
    }
    li .label{
      width: 80px;
      text-align: left;
      color: $fontColorF;
    }
    .content_text{
      flex:1
    }
    .d_progress{
      padding: 12px 0;
      border-bottom: 1px solid #f1f1f1;
      margin-bottom: 10px;
    }
    .work_box{}
    .d_footer{
      position: fixed;
      bottom: 20px;
      right: 20px;
    }
    .work_right{
      margin-top: 10px;
      margin-left: 10px;
      padding-bottom: 10px;
      border-bottom: 1px solid #f1f1f1;
    }
    .d_name{
      color: $fontColorZ;
      margin-bottom: 10px;
    }
    .d_date{
      color: $fontColorF;
    }
    .work_item{
       margin-bottom: 10px;
    }
    .addJf{
      font-size: 13px;
      cursor: pointer;
      margin-bottom: 5px;
      padding: 5px;
    }
    .addJf:hover{
      color: $blue;
    }
  }
  .slider{
    padding: 30px 20px;
  }
  .num{
    position: absolute;
    height: 20px;
    width: 20px;
    z-index: 999;
    left: 85px;
  }
  .add:before{
    position: absolute;
    content: "+";
    color: $red;
  }
  .jian:before{
    position: absolute;
    content: "-";
    color: $green;
  }

  .border{
    -webkit-appearance: none;
    background-color: #FFF;
    background-image: none;
    border-radius: 4px;
    border: 1px solid #DCDFE6;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    color: #606266;
    font-size: inherit;
    height: 40px;
    line-height: 40px;
    outline: 0;
    padding: 0 15px;
    width: 100%;
    cursor: pointer;
  }
	.drawer_title{
		font-size: 18px;
		padding: 20px;
    border-bottom:1px #efefef solid;
    margin-bottom: 20px;
  }
  .box {
  overflow: hidden;
  padding: 20px;
  .header {
    padding-bottom: 20px;
    border-bottom: 1px solid #f1f1f1;
  }
  .search {
    padding: 20px 0;
  }
  .point{
    margin-right: 20px;
  }
  .point div:nth-child(1) {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
  }
  .point div:nth-child(2) {
   color: $fontColorF;
  }
  .page {
    text-align: center;
    padding: 20px 0;
  }
  .tips {
    background: $fontColorF;
    border-radius: 50%;
    width: 14px;
    height: 14px;
    color: #fff;
    display: inline-block;
    font-size: 12px;
    line-height: 14px;
    text-align: center;
  }
  .demo-ruleForm{
    padding: 0 20px;
  }
}
   /deep/ .el-table tr:hover{
    cursor:pointer
  }
  
/deep/ .el-dialog__body{
  padding:15px 20px 30px;
}
</style>
