<template>
  <div>
    <el-scrollbar >
      <div style="margin: auto;max-height: 200px">
        <el-row>
          <el-col :span="12">
            <span style="font-size: 16px;color: #333">新增项目</span>
          </el-col>
          <el-col :span="12">
            <quickDate @selectQuick="selectQuickAdd"></quickDate>
          </el-col>
        </el-row>
        <tableLayout style="margin-top: 10px" :layout="tablecolsAdd" :data="listAdd" :opwidth="200" :custom="true" :height="tableHieght">
          <template v-slot:customcol="scope">
            <p>{{scope.column.data[scope.column.columnname]?scope.column.data[scope.column.columnname]:'--'}}</p>
          </template>
        </tableLayout>
        <div class="container normal-panel" style="text-align:right">
          <el-pagination
              background
              @size-change="handleSizeChangeAdd"
              @current-change="handleCurrentChangeAdd"
              :current-page="currentPageAdd"
              :page-sizes="[10,20, 50, 100, 200]"
              :page-size="10"
              layout="total,sizes, prev, pager, next, jumper"
              :total="totalAdd">
          </el-pagination>
        </div>
        <el-row>
          <el-col :span="12">
            <span style="font-size: 16px;color: #333">更新项目</span>
          </el-col>
          <el-col :span="12">
            <quickDate @selectQuick="selectQuickUpd"></quickDate>
          </el-col>
        </el-row>
        <tableLayout style="margin-top: 10px" :layout="tablecolsUpdate" :data="listUpdate" :opwidth="200" :custom="true" :height="tableHieght">
          <template v-slot:customcol="scope">
            <p>{{scope.column.data[scope.column.columnname]?scope.column.data[scope.column.columnname]:'--'}}</p>
          </template>
        </tableLayout>
        <div class="container normal-panel" style="text-align:right">
          <el-pagination
              background
              @size-change="handleSizeChangeUpdate"
              @current-change="handleCurrentChangeUpdate"
              :current-page="currentPageUpdate"
              :page-sizes="[10,20, 50, 100, 200]"
              :page-size="10"
              layout="total,sizes, prev, pager, next, jumper"
              :total="totalUpdate">
          </el-pagination>
        </div>
        <el-row>
          <el-col :span="12">
            <span style="font-size: 16px;color: #333">跟进项目</span>
          </el-col>
          <el-col :span="12">
            <quickDate @selectQuick="selectQuickFow"></quickDate>
          </el-col>
        </el-row>
        <tableLayout style="margin-top: 10px" :layout="tablecolsFollow" :data="listFollow" :opwidth="200" :custom="true" :height="tableHieght">
          <template v-slot:customcol="scope">
            <p>{{scope.column.data[scope.column.columnname]?scope.column.data[scope.column.columnname]:'--'}}</p>
          </template>
        </tableLayout>
        <div class="container normal-panel" style="text-align:right">
          <el-pagination
              background
              @size-change="handleSizeChangeFollow"
              @current-change="handleCurrentChangeFollow"
              :current-page="currentPageFollow"
              :page-sizes="[10,20, 50, 100, 200]"
              :page-size="10"
              layout="total,sizes, prev, pager, next, jumper"
              :total="totalFollow">
          </el-pagination>
        </div>
      </div>

    </el-scrollbar>
  </div>
</template>

<script>
import quickDate from "@/HDrpManagement/dataanalysis/components/quickDate";

export default {
  name: "project",
  props:['param','isDep','dataid','isPerson'],
  components:{quickDate},
  data() {
    return {
      listAdd:[],
      tablecolsAdd:[],
      listUpdate:[],
      tablecolsUpdate:[],
      tableHieght:'50px',
      currentPageAdd:0,
      totalAdd:0,
      currentPageUpdate:0,
      totalUpdate:0,
      listFollow:[],
      tablecolsFollow:[],
      currentPageFollow:0,
      totalFollow:0,
      begindate:'',
      enddate:''
    }
  },
  methods:{
    async queryAdd(){
   /*   this.isDep ? this.param.content.type = 1: this.isPerson ? this.param.content.type = 0 : this.param.content.type = ''*/
      this.param.content.dataType = 7
     /* this.param.content.dataid = this.dataid*/
      this.param.content.where.begindate = this.begindate
      this.param.content.where.enddate = this.enddate
      const res = await this.$api.requested(this.param)
      this.listAdd = res.data
      this.currentPageAdd = res.pageNumber
      this.totalAdd = res.total
    },
    handleSizeChangeAdd(val) {
      // console.log(`每页 ${val} 条`);
      this.param.content.pageSize = val
      this.queryAdd()
    },
    handleCurrentChangeAdd(val) {
      // console.log(`当前页: ${val}`);
      this.param.content.pageNumber = val
      this.queryAdd()
    },
    async queryUpdate(){
     /* this.isDep ? this.param.content.type = 1: this.isPerson ? this.param.content.type = 0 : this.param.content.type = ''*/
      this.param.content.dataType = 8
     /* this.param.content.dataid = this.dataid*/
      this.param.content.where.begindate = this.begindate
      this.param.content.where.enddate = this.enddate
      const res = await this.$api.requested(this.param)
      this.listUpdate = res.data
      this.currentPageUpdate = res.pageNumber
      this.totalUpdate = res.total
    },
    handleSizeChangeUpdate(val) {
      // console.log(`每页 ${val} 条`);
      this.param.content.pageSize = val
      this.queryUpdate()
    },
    handleCurrentChangeUpdate(val) {
      // console.log(`当前页: ${val}`);
      this.param.content.pageNumber = val
      this.queryUpdate()
    },
    async queryFollow(){
   /*   this.isDep ? this.param.content.type = 1: this.isPerson ? this.param.content.type = 0 : this.param.content.type = ''*/
      this.param.content.dataType = 9
     /* this.param.content.dataid = this.dataid*/
      this.param.content.where.begindate = this.begindate
      this.param.content.where.enddate = this.enddate
      const res = await this.$api.requested(this.param)
      this.listFollow = res.data
      this.currentPageFollow = res.pageNumber
      this.totalFollow = res.total
    },
    handleSizeChangeFollow(val) {
      // console.log(`每页 ${val} 条`);
      this.param.content.pageSize = val
      this.queryFollow()
    },
    handleCurrentChangeFollow(val) {
      // console.log(`当前页: ${val}`);
      this.param.content.pageNumber = val
      this.queryFollow()
    },
    /*日期筛选*/
    selectQuickAdd(begindate,enddate){
      this.begindate = begindate
      this.enddate = enddate
      this.queryAdd(this.param.content.pageNumber = 1)
    },
    selectQuickUpd(begindate,enddate){
      this.begindate = begindate
      this.enddate = enddate
      this.queryUpdate(this.param.content.pageNumber = 1)
    },
    selectQuickFow(begindate,enddate){
      this.begindate = begindate
      this.enddate = enddate
      this.queryFollow(this.param.content.pageNumber = 1)
    }
  },
  created() {
    this.tablecolsAdd = this.tool.tabelCol(this.$route.name).projectAdd.tablecols
    this.tablecolsUpdate = this.tool.tabelCol(this.$route.name).projectUpdate.tablecols
    this.tablecolsFollow = this.tool.tabelCol(this.$route.name).projectFollow.tablecols
  }
}
</script>

<style scoped>

</style>
