<template>
  <div>
    <div class="manager_statistics_box boxMinHeight">
      <el-form :inline="true">
        <el-form-item label="时间">
          <el-date-picker v-model="time" type="daterange" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
        </el-form-item>
      </el-form>

      <el-table :data="list" style="width: 100%;cursor: pointer;" v-loading="loading">
        <el-table-column prop="name" label="操作人员">
          <template slot-scope="scope">
            <userImage class="fl" :id="scope.row.userInfo.id" :user_name="scope.row.userInfo.name" :img_url="scope.row.userInfo.img_url" width="50px" height="50px"></userImage>
            <span style="line-height: 50px; padding-left: 10px;">{{ scope.row.userInfo.name }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="content" min-width="300" label="内容"></el-table-column>
        <el-table-column prop="ct" label="时间"></el-table-column>
        <template slot="empty">
          <NoData></NoData>
        </template>
      </el-table>

      <center style="padding: 20px 0;">
        <el-pagination
          background
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="page"
          :page-sizes="[10, 20, 50, 100]"
          layout="total, sizes, prev, pager, next"
          :page-size="page_size"
          :total="total"
        ></el-pagination>
      </center>
    </div>
  </div>
</template>
<script>
export default {
  name:'Record',
  data() {
    return {
      loading: false,
      loading2: false,
      dept_tree: [],
      page: 1,
      total: 0,
      page_size: 10,
      page2: 1,
      total2: 0,
      page_size2: 10,
      dept_id:0,
      formData: {
        dept_id: 0,
      },
      time: [this.$moment().startOf('month').format('YYYY-MM-DD'),this.$moment().endOf('month').format('YYYY-MM-DD')],
      list: [],

      point:0,
      owner_id:0,
      isShowTable:false,
      tableList:[],
      isShowDetail:false,
      detail:{},
    };
  },
  watch: {
    time(val) {
      this.page = 1;
      this.get_list();
    },
  },
  methods: {
    get_list() {
      this.loading = true;
      let data = {
        page: this.page,
        page_size: this.page_size,
      };
      if(this.time){
        data.start_day= this.time[0];
        data.end_day= this.time[1];
      }
      this.$axiosUser('get', '/api/pro/log',data).then(res => {
          let list = res.data.data.list;
          list.forEach((item,index)=>{
             item.userInfo=this.$getEmployeeMapItem(item.employee_id);
          })
          this.list = list;
          this.total = res.data.data.total;
      }).finally(() => {
        this.loading = false;
      });
    },
    // 页面变更
    handleCurrentChange(val) {
      this.page = val;
      this.get_list();
    },
    handleSizeChange(val) {
      this.page_size = val;
      this.get_list();
    },
  },
  mounted() {
    this.get_list();
  }
};
</script>
<style scoped lang="scss">
  .message-box .label{
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
  }
  .message-box .flex-box-ce{
    margin-bottom:16px ;
  }
  .message-box .fontColorC{
    width: 100px;
  }
.search_box {
  /deep/ button:active {
    background: #409eff;
  }
  /deep/ button:active .el-icon-search {
    color: #fff;
  }
}
.date-picker-width {
  width: 100% !important;
}
.color_green {
  color: #67c23a;
}
.nopoint_box {
  display: inline-block;
  text-align: center;
  width: 100%;
  margin-bottom: 10px;
}
.title {
  display: block;
  text-align: center;
  font-size: 12px !important;
  line-height: 30px;
  color: #909399 !important;
  padding: 0;
}
.nopoint_box a {
  color: #409eff;
}
.chart_content {
  .chart-legend__wrap {
    text-align: right;
    padding: 20px;
    padding-right: 50px;
    & .chart-legend__pink {
      position: relative;
      padding-left: 12px;
      padding-right: 5px;
      &:after {
        content: '';
        position: absolute;
        margin-top: -2px;
        top: 35%;
        left: 0;
        width: 8px;
        height: 8px;
        background: #f56c6c;
        border-radius: 100%;
      }
    }

    & .chart-legend__green {
      position: relative;
      padding-left: 12px;
      &:after {
        content: '';
        position: absolute;
        margin-top: -2px;
        top: 35%;
        left: 0;
        width: 8px;
        height: 8px;
        background: #53b87f;
        border-radius: 100%;
      }
    }
  }
}
.drawer_title {
  font-size: 18px;
  padding: 20px;
}
.manager_statistics_box {
  background-color: #ffffff;
  // padding: 20px;
  /deep/ .el-row .el-checkbox .el-checkbox__label {
    line-height: 20px;
  }
}
.diy_tip_bg {
  background: #f5f6f9;
  overflow: hidden;
  .diy-tip {
    margin-bottom: 10px;
    border: 1px solid #67c23a;
    padding: 20px 16px;
    p {
      color: #67c23a !important;
      font-size: 15px;
      margin: 0 !important;
      padding-bottom: 4px;
    }
  }
}
/deep/ .el-dialog__body {
  padding: 0px 20px 30px;
}
.headLi {
  padding: 4px;
  list-style: disc;
  font-size: 14px;
}
</style>
