<template>
  <div
    class="big-dataservice-box"
    style="border-color:#ffe0b2!important"
    :class="{ 'hide-border': shouType == '6' }"
  >
    <div class="tag-title" style="background:#ffe0b2!important">行政数据</div>
    <div class="row q-gutter-md">
      <q-card flat>
        <div class="data-title">员工</div>
        <div class="data-time">{{ formatDate.date }} {{ formatDate.week }}</div>
        <div class="wrapper">
          <div class="col">
            <div class="label">在职员工</div>
            <div class="value">
              {{ d.EmpCount }}
              <span class="unit">人</span>
            </div>
          </div>
          <div>
            <div class="label">兼职员工</div>
            <div class="value">
              {{ d.InactiveEmpCount }}<span class="unit">人</span>
            </div>
          </div>
        </div>
      </q-card>
      <q-card flat>
        <div class="data-title">新增员工</div>
        <div class="data-time">{{ formatDate.date }} {{ formatDate.week }}</div>
        <div class="wrapper">
          <div class="col">
            <div class="label">当日</div>
            <div class="value">
              {{ d.NewEmpCount.split(",")[0] }}
              <span class="unit">人</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当周</div>
            <div class="value samll">
              {{ d.NewEmpCount.split(",")[1] }}<span class="unit">人</span>
            </div>
          </div>
          <div>
            <div class="label big">当月</div>
            <div class="value samll">
              {{ d.NewEmpCount.split(",")[2] }}<span class="unit">人</span>
            </div>
          </div>
        </div>
      </q-card>
      <q-card flat>
        <div class="data-title">离职员工</div>
        <div class="data-time">{{ formatDate.date }} {{ formatDate.week }}</div>
        <div class="wrapper">
          <div class="col">
            <div class="label">当日</div>
            <div class="value">
              {{ d.LeaveEmpCount.split(",")[0] }}
              <span class="unit">人</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当周</div>
            <div class="value samll">
              {{ d.LeaveEmpCount.split(",")[1] }}<span class="unit">人</span>
            </div>
          </div>
          <div>
            <div class="label big">当月</div>
            <div class="value samll">
              {{ d.LeaveEmpCount.split(",")[2] }}<span class="unit">人</span>
            </div>
          </div>
        </div>
      </q-card>
      <q-card flat>
        <div class="data-title">红事件</div>
        <div class="data-time">{{ formatDate.date }} {{ formatDate.week }}</div>
        <div class="wrapper">
          <div class="col">
            <div class="label">当日</div>
            <div class="value">
              {{ d.RedEventCount.split(",")[0] }}
              <span class="unit">次</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当周</div>
            <div class="value samll">
              {{ d.RedEventCount.split(",")[1] }}<span class="unit">次</span>
            </div>
          </div>
          <div>
            <div class="label big">当月</div>
            <div class="value samll">
              {{ d.RedEventCount.split(",")[2] }}<span class="unit">次</span>
            </div>
          </div>
        </div>
      </q-card>
      <q-card flat>
        <div class="data-title">黑事件</div>
        <div class="data-time">{{ formatDate.date }} {{ formatDate.week }}</div>
        <div class="wrapper">
          <div class="col">
            <div class="label">当日</div>
            <div class="value">
              {{ d.BlackEventCount.split(",")[0] }}
              <span class="unit">次</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当周</div>
            <div class="value samll">
              {{ d.BlackEventCount.split(",")[1] }}<span class="unit">次</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当月</div>
            <div class="value samll">
              {{ d.BlackEventCount.split(",")[2] }}<span class="unit">次</span>
            </div>
          </div>
        </div>
      </q-card>
      <q-card flat>
        <div class="data-title">缺勤</div>
        <div class="data-time">{{ formatDate.date }} {{ formatDate.week }}</div>
        <div class="wrapper">
          <div class="col">
            <div class="label">当日</div>
            <div class="value">
              {{ d.AbsenceCount.split(",")[0] }}
              <span class="unit">人</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当周</div>
            <div class="value samll">
              {{ d.AbsenceCount.split(",")[1] }}<span class="unit">人</span>
            </div>
          </div>
          <div>
            <div class="label big">当月</div>
            <div class="value samll">
              {{ d.AbsenceCount.split(",")[2] }}<span class="unit">人</span>
            </div>
          </div>
        </div>
      </q-card>
      <q-card flat>
        <div class="data-title">旷工</div>
        <div class="data-time">{{ formatDate.date }} {{ formatDate.week }}</div>
        <div class="wrapper">
          <div class="col">
            <div class="label">当日</div>
            <div class="value">
              {{ d.AbsenteeismCount.split(",")[0] }}
              <span class="unit">人</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当周</div>
            <div class="value samll">
              {{ d.AbsenteeismCount.split(",")[1] }}<span class="unit">人</span>
            </div>
          </div>
          <div>
            <div class="label big">当月</div>
            <div class="value samll">
              {{ d.AbsenteeismCount.split(",")[2] }}<span class="unit">人</span>
            </div>
          </div>
        </div>
      </q-card>
      <q-card flat>
        <div class="data-title">请假</div>
        <div class="data-time">{{ formatDate.date }} {{ formatDate.week }}</div>
        <div class="wrapper">
          <div class="col">
            <div class="label">当日</div>
            <div class="value">
              {{ d.AFLeaveCount.split(",")[0] }}
              <span class="unit">人</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当周</div>
            <div class="value samll">
              {{ d.AFLeaveCount.split(",")[1] }}<span class="unit">人</span>
            </div>
          </div>
          <div>
            <div class="label big">当月</div>
            <div class="value samll">
              {{ d.AFLeaveCount.split(",")[2] }}<span class="unit">人</span>
            </div>
          </div>
        </div>
      </q-card>
    </div>
  </div>
</template>

<script>
export default {
  props: ["d", "formatDate", "shouType"],
  data() {
    return {};
  },
  methods: {
    numberFormat(value) {
      let param = {};
      let k = 10000;
      let sizes = ["元", "万", "亿", "万亿"];
      let i;
      if (value < k) {
        param.value = parseFloat(value).toFixed(2);
        param.unit = "元";
      } else {
        i = Math.floor(Math.log(value) / Math.log(k));
        param.value = (value / Math.pow(k, i)).toFixed(2);
        param.unit = sizes[i];
      }
      return param;
    }
  }
};
</script>

<style></style>
