<template>
  <div class="app-container">
    <el-row :gutter="12">
      <el-col :xs="24" :lg="19" class="mb8">
        <el-row :gutter="12" class="mb8">
          <el-col :xs="24" :lg="6">
            <notice-panel/>
          </el-col>
          <el-col :xs="24" :lg="18">
            <panel-group />
          </el-col>
        </el-row>
        <el-card>
          <el-tabs >
            <el-tab-pane label="项目列表" lazy v-if="checkPermi(['bst:project:list'])">
              <project :hide-columns="projectHideColumns" :init-show-search="false"/>
            </el-tab-pane>
            <el-tab-pane label="任务列表" lazy v-if="checkPermi(['bst:task:list'])">
              <task :hide-columns="taskHideColumns" :init-show-search="false"/>
            </el-tab-pane>
            <el-tab-pane label="今日完成任务" lazy v-if="checkPermi(['bst:task:list'])">
              <task :hide-columns="taskHideColumns" :query="{passDateRange: [today, today], status: TaskStatus.PASS}" :init-show-search="false"/>
            </el-tab-pane>
            <el-tab-pane label="今日新增客户" lazy v-if="checkPermi(['bst:customer:list'])">
              <customer :hide-columns="customerHideColumns" :query="{createDate: today}" :init-show-search="false"/>
            </el-tab-pane>
          </el-tabs>
        </el-card>
        <!-- <project-list-panel/> -->
      </el-col>
      <el-col :xs="24" :lg="5">
        <el-card class="card-box">
          <project-rate-chart/>
        </el-card>
        <el-card class="card-box">
          <month-project-chart height="180px" bar-width="50%"/>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import PanelGroup from '@/views/dashboard/PanelGroup.vue';
import NoticePanel from '@/views/bst/index/components/NoticePanel.vue';
import MonthProjectChart from '@/views/dashboard/MonthProjectChart.vue';
import ProjectRateChart from '@/views/dashboard/ProjectRateChart.vue';
import ProjectListPanel from './components/ProjectListPanel.vue';
import Project from '@/views/bst/project/index.vue';
import Task from '@/views/bst/task/index.vue';
import Customer from '@/views/bst/customer/index.vue';
import { checkPermi } from '@/utils/permission';
import { parseTime } from '@/utils/ruoyi';
import { TaskStatus } from '@/utils/enums';

export default {
  name: 'Index',
  components: { PanelGroup, NoticePanel, MonthProjectChart, ProjectRateChart, ProjectListPanel, Project, Task, Customer },
  data() {
    return {
      TaskStatus,
      today: parseTime(new Date(), '{y}-{m}-{d}'),
      projectHideColumns: [
        'id',
        'no', 
        'status',
        'customerName',
        'expireTime',
        'expectedCompleteDate',
        'maintenanceEndDate',
        'ownerName',
        'followName',
        'amount',
        'receivedAmount',
        'operationAmount',
        'remark',
        'createTime'
      ],
      taskHideColumns: [
        'id',
        'no',
        'status',
        'level',
        'type',
        'createId',
        'createName',
        'createTime',
        'remark',
        'submitCount',
        'passCount',
      ],
      customerHideColumns: [
        'id',
        'code',
        'source',
        'followName',
        'remark',
        'createName',
        'createTime'
      ],
    }
  },
  methods: {
    checkPermi,
  }
}
</script>
