<template>
  <div class="table-wrap">
    <el-table :data="tableData" ref="tableRef" highlight-current-row size="mini" stripe border>

      <el-table-column type="index" label="序号"  width="60" show-overflow-tooltip>
      </el-table-column>

      <el-table-column v-for="(item, index) in colunms" :key="index"
            :prop="item.prop"
            :label="item.label"
            :fixed="item.fixed"
            :class-name="item.prop =='statusKey'?'c357F':'' "
            :show-overflow-tooltip="item.tooltip"
            :min-width="item.width"
            >
      </el-table-column>

    </el-table>
    <ls-pagination :pager.sync="pager"  @query="doQuery"></ls-pagination>
  </div>
</template>

<script>
  export default {
    name: 'task-table',
    created() {
       this.doQuery();
    },
    mounted() {

    },
    methods: {
     doQuery () {

        let param = {
          currPage: this.pager.curPage,
          pageSize: this.pager.size,
          queryParam: {
            projectCode: this.projectCode,
            extId: this.projectid,
          },
        };

        this.$ajax.post({
          domain: 'crmUrl',
          url: 'task.listPageTaskInfo',
          data: param,
          requestType: 'body',
          showLoad: true,
          success: function (res) {
            if (res.errorCode === 200) {
                this.tableData = res.data.records || [];
                this.pager.totals = res.data.total || 0;
            }
          }.bind(this),
          error: function (res) {
            this.$message({
              type: 'error',
              message: res.body.msg || res.msg
            })
          }.bind(this)
        })
     },

    },
    props: ['projectid'],
    data() {
      return {

        //分页参数
        pager: {
          curPage: 1,
          size: 10,
          pageOptions: [10, 20, 30],
          totals: 0
        },

        tableData: [],
        //表格列
       colunms: [
          { prop: 'taskId', label: '任务ID',   width: 100, fixed: false,  tooltip: true },
          { prop: 'taskSourceKey', label: '任务来源',   width: 100, fixed: false,  tooltip: true },
          { prop: 'customerName', label: '客户',   width: 100, fixed: false,  tooltip: true },
          { prop: 'itemTypeKey', label: '事项类型',   width: 100, fixed: false,  tooltip: true },
          { prop: 'taskContent', label: '事项简述',   width: 100, fixed: false,  tooltip: true },
          { prop: 'taskUser', label: '责任人',   width: 100, fixed: false,  tooltip: true },
          { prop: 'userNamesStr', label: '协同人员',   width: 100, fixed: false,  tooltip: true },
          { prop: 'emergencyDegreeKey', label: '紧要程度',   width: 100, fixed: false,  tooltip: true },
          { prop: 'statusKey', label: '状态',   width: 120, fixed: false,  tooltip: true },
          { prop: 'taskRequestDate', label: '要求时间',   width: 120, fixed: false,  tooltip: true },
          { prop: 'visitReportCode', label: '关联拜访报告',   width: 120, fixed: false,  tooltip: true },
          { prop: 'projectCode', label: '关联项目编',   width: 120, fixed: false,  tooltip: true },

       ],

      }
    },

  }
</script>

<style>
</style>
