<template>
  <div class="ele-body">
    <el-card shadow="never" v-loading="loading">
      <order-search @search="reload" ref="searchRef"> </order-search>
      <!--      <el-tabs v-model="activeName" type="card">
        <el-tab-pane label="未完成工单" name="first"></el-tab-pane>
        <el-tab-pane label="已完成工单" name="second"></el-tab-pane>
      </el-tabs> -->
      <!-- 数据表格 -->

      <!-- <plan-statistics></plan-statistics> -->

      <ele-pro-table
        ref="table"
        :columns="newColumns"
        :datasource="datasource"
        cache-key="workOrderTable"
        row-key="code"
        @sort-change="onSortChange"
        height="calc(100vh - 380px)"
        autoAmendPage
        :parse-data="parseData"
      >
        <template v-slot:code="{ row }">
          {{ row.code }}
        </template>

        <template v-slot:formingWeight="{ row }">
          {{ row.formingWeight }} {{ row.newWeightUnit }}
        </template>

        <template v-slot:priority="{ row }">
          <div style="display: flex">
            <el-input
              v-model="row.priority"
              type="number"
              size="mini"
              :min="0"
              :max="10"
              @change="priorityChange(row)"
              style="width: 80px"
            ></el-input>
            <el-popover
              placement="right"
              width="200"
              trigger="hover"
              content="数值越大优先级越高（0-3普通, 4-6优先, 7-10紧急）"
            >
              <div class="sort-wrap" slot="reference">
                <i class="el-icon-caret-top" @click="sortTop(row)"></i>
                <i class="el-icon-caret-bottom" @click="sortBottom(row)"></i>
              </div>
            </el-popover>
          </div>
        </template>

        <template v-slot:status="{ row }">
          <span :class="{ 'ele-text-danger': row.status == 3 }">
            {{ statusFormatter(row.status) }}
          </span>
        </template>
        <!-- 操作列 -->
        <template v-slot:action="{ row }">
          <el-link
            type="primary"
            :underline="false"
            icon="el-icon-truck"
            @click="toRelease(row)"
          >
            排程
          </el-link>
        </template>
      </ele-pro-table>
    </el-card>

    <el-dialog
      :title="title"
      :visible.sync="visible"
      width="70%"
      :close-on-click-modal="false"
      modal-append-to-body
    >
      <el-form
        ref="form"
        :model="form"
        :rules="rules"
        label-position="left"
        label-width="100px"
      >
        <!--时间列表
        -->
        <el-row>
          <el-col :span="12">
            <el-form-item label="工艺路线" prop="produceRoutingId" v-if="false">
              <el-input
                v-model="form.produceRoutingId"
                placeholder="请输入工艺路线"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="本次产能" prop="thisCapacity" v-if="false">
              <el-input
                v-model="form.thisCapacity"
                placeholder="请输入本次产能"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="产线" prop="productLineId" v-if="false">
              <el-input v-model="form.productLineId" placeholder="请输入产线" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="工位:" prop="workstationIds">
              <el-select
                class="ele-block"
                v-model="form.workstationIds"
                placeholder="请选择工位"
                size="mini"
                multiple
                filterable
              >
                <el-option
                  v-for="item in stationList"
                  :key="item.id"
                  :label="item.name + '（' + item.code + '）'"
                  :value="item.id"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="本次产能" prop="thisCapacity">
              <el-input
                v-model="form.thisCapacity"
                placeholder="请输入本次产能"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="年份" prop="year">
              <el-select v-model="form.year" placeholder="请选择年份">
                <el-option
                  v-for="item in year_select"
                  :key="item.value"
                  :label="item.value"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="月份" prop="month">
              <el-select
                v-model="form.month"
                placeholder="请选择月份"
                @change="getCapacityList()"
              >
                <el-option
                  v-for="item in month_select"
                  :key="item.value"
                  :label="item.value"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="日期" prop="day">
              <el-input disabled v-model="form.day" placeholder="请输入日期" />
              <div class="bottom">
                <div
                  class="box"
                  v-for="(item, index) in capacityList"
                  :key="index"
                  :class="[(index + 1) % 6 == 0 ? 'margin_0' : '']"
                  @click="checkedChange(index)"
                >
                  <div
                    class="item"
                    :class="[item.checked ? 'item active' : 'item']"
                  >
                    <div class="date">{{
                      item.year + '-' + item.month + '-' + item.day
                    }}</div>
                    <!-- <div class="capacity">{{'总产能' + item.plannedCapacity }}</div>
                      <div class="capacity">{{'已排产能' +item.plannedSumCapacity }}</div> -->
                    <div class="capacity">{{
                      '剩余产能' +
                      (item.plannedCapacity - item.plannedSumCapacity)
                    }}</div>
                    <div v-if="item.checked" class="checked">
                      <img :src="checkImg" alt="" />
                    </div>
                  </div>
                </div>
              </div>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label-width="100px" label="班次" prop="classId">
              <el-select
                v-model="form.classId"
                placeholder="请选择班次"
                @select="getTimesList"
              >
                <el-option
                  v-for="item in timesList"
                  :key="item.value"
                  :label="item.text"
                  :value="item.value"
                ></el-option>
              </el-select>
              <!-- <el-time-picker clearable
                                v-model="form.start"
                                type="datetime"
                                value-format="HH:mm:ss"
                                placeholder="请选择开始时间">
                </el-time-picker> -->
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="报工类型:" prop="singleReport">
              <el-radio-group v-model="form.singleReport">
                <el-radio :label="1" v-if="clientEnvironmentId != 2"
                  >单件报工</el-radio
                >
                <el-radio :label="0">批量报工</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="24">
            <el-form-item label="指定:" prop="assignType">
              <el-radio-group v-model="form.assignType" size="mini">
                <el-radio-button :label="1">人员</el-radio-button>
                <el-radio-button :label="2">物料</el-radio-button>
                <el-radio-button :label="3">设备</el-radio-button>
                <el-radio-button :label="4">工具</el-radio-button>
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item
              label="人员:"
              prop="workstationIds"
              v-if="form.assignType == 1"
            >
              <el-form-item label="班组:" prop="teamId">
                <el-select
                  class="ele-block"
                  v-model="form.teamId"
                  placeholder="请选择班组"
                  size="mini"
                  filterable
                  @change="stationChange"
                >
                  <el-option
                    v-for="item in teamsList"
                    :key="item.id"
                    :label="item.name + '（' + item.code + '）'"
                    :value="item.id"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
              <el-select
                class="ele-block"
                v-model="form.crewIds"
                placeholder="请选择人员"
                size="mini"
                filterable
                multiple
              >
                <el-option
                  v-for="item in crewList"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item
              label="物料:"
              prop="crewIds"
              v-if="form.assignType == 2"
            >
              <!--物料列表
                -->
              <el-table v-loading="loading" :data="materialsList">
                <el-table-column type="selection" width="55" align="center" />
                <el-table-column label="序号" align="center" prop="subCode" />
                <el-table-column
                  label="物料名称"
                  align="center"
                  prop="categoryName"
                />
                <el-table-column label="牌号" align="center" prop="brandNum" />
                <el-table-column label="型号" align="center" prop="modelType" />
                <el-table-column label="数量" align="center" prop="count" />
                <el-table-column label="单位" align="center" prop="unit" />
              </el-table>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item
              label="设备:"
              prop="crewIds"
              v-if="form.assignType == 3"
            >
              <!--设备列表
                -->
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item
              label="工具:"
              prop="crewIds"
              v-if="form.assignType == 4"
            >
              <!--工具列表
                -->
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>

      <div class="footer" slot="footer">
        <el-button @click="visible = false">取消</el-button>
        <el-button type="primary" v-click-once @click="confirm">确定</el-button>
      </div>
    </el-dialog>

    <unpackDialog ref="unpackRef" @success="createSuccess" />
  </div>
</template>

<script>
  import {
    listProduct_line_capacity_detail,
    listDetail,
    getProduct_line_capacity_detail,
    delProduct_line_capacity_detail,
    addProduct_line_capacity_detail,
    updateProduct_line_capacity_detail
  } from '@/api/aps/product_line_capacity_detail';

  import {
    occupyRes,
    listTimes,
    getBomCategory
  } from '@/api/aps/ws_res_capacity_detail';

  import {
    getList,
    releaseWorkOrder,
    updatePriority
  } from '@/api/workOrder/index.js';
  import {
    teamPage,
    listByFirstTaskId,
    listByWorkCenterId,
    listUserByIds
  } from '@/api/mainData/index.js';
  import OrderSearch from './components/order-search.vue';
  import unpackDialog from './components/unpackDialog.vue';

  import { fieldModel } from '@/api/saleOrder';
  import { getById } from '@/api/productionPlan/index.js';

  import { debounce } from 'lodash';
  import PlanStatistics from '@/components/statistics/PlanStatistics.vue';
  export default {
    components: {
      PlanStatistics,
      OrderSearch,
      unpackDialog
    },
    data() {
      return {
        year_select: [
          { value: 2025 },
          { value: 2026 },
          { value: 2027 },
          { value: 2028 }
        ],
        month_select: [
          { value: 1 },
          { value: 2 },
          { value: 3 },
          { value: 4 },
          { value: 5 },
          { value: 6 },
          { value: 7 },
          { value: 8 },
          { value: 9 },
          { value: 10 },
          { value: 11 },
          { value: 12 }
        ],
        title: '工位名称（工序名称）',
        //日期选择框
        checkImg: require('@/assets/checked.png'),
        capacityList: [],

        visible: false,
        loading: false,

        form: {
          assignType: 1,
          singleReport: this.clientEnvironmentId == 2 ? 0 : 1
        },
        rules: {
          singleReport: [
            {
              required: true,
              message: '请选择报工类型',
              trigger: ['blur', 'change']
            }
          ],
          workstationIds: [
            {
              required: true,
              message: '请选择工位',
              trigger: ['blur']
            }
          ],
          teamId: [
            {
              required: true,
              message: '请选择班组',
              trigger: ['blur', 'change']
            }
          ]
        },

        teamList: [],

        statusOpt: [
          { label: '待生产', value: 4 },
          { label: '生产中', value: 5 },
          { label: '待下达', value: 8 }
        ],
        statusScheduleOpt: [
          { label: '未开始', value: 0 },
          { label: '未排产', value: 1 },
          { label: '已排产', value: 2 }
        ],
        newColumns: [],

        stationList: [],
        teamsList: [],
        crewList: [],
        timesList: [],
        startTime: null,
        endTime: null,
        className: null,
        current: null
      };
    },
    computed: {
      clientEnvironmentId() {
        return this.$store.state.user.info.clientEnvironmentId;
      },
      // 表格列配置
      columns() {
        return [
          {
            columnKey: 'index',
            slot: 'index',
            label: '序号',
            type: 'index',
            width: 55,
            align: 'center',
            showOverflowTooltip: true,
            fixed: 'left'
          },
          {
            slot: 'code',
            label: '生产订单号',
            align: 'center',
            minWidth: 210,
            sortable: true
          },
          {
            prop: 'productionPlanCode',
            label: '计划编号',
            align: 'center',
            minWidth: 150
          },
          {
            prop: 'produceRoutingName',
            label: '工艺路线',
            align: 'center',
            minWidth: 170
          },
          {
            prop: 'productCode',
            label: '编码',
            align: 'center',
            minWidth: 110
          },
          {
            prop: 'productName',
            label: '名称',
            align: 'center',
            minWidth: 110
          },
          {
            prop: 'brandNo',
            label: '牌号',
            align: 'center'
          },

          {
            prop: 'batchNo',
            label: '批次号',
            align: 'center',
            minWidth: 100,
            showOverflowTooltip: true
          },
          {
            prop: 'model',
            label: '型号',
            align: 'center',
            showOverflowTooltip: true
          },

          {
            prop: 'priority',
            label: '优先级',
            align: 'center',
            minWidth: 120,
            slot: 'priority',
            sortable: 'custom'
          },

          {
            prop: 'formingNum',
            label: '要求生产数量',
            align: 'center',
            showOverflowTooltip: true,
            minWidth: 110
          },
          {
            prop: 'formingWeight',
            label: '要求生产重量',
            align: 'center',
            showOverflowTooltip: true,
            minWidth: 110,
            slot: 'formingWeight'
          },
          {
            prop: 'planStartTime',
            label: '计划开始时间',
            align: 'center',
            showOverflowTooltip: true,
            minWidth: 110
          },

          {
            prop: 'planCompleteTime',
            label: '计划结束时间',
            align: 'center',
            showOverflowTooltip: true,
            minWidth: 110
          },

          {
            prop: 'workCenterName',
            label: '工作中心',
            align: 'center',
            minWidth: 110,
            showOverflowTooltip: true
          },

          {
            prop: 'firstTaskName',
            label: '首工序',
            align: 'center',
            minWidth: 110,
            showOverflowTooltip: true
          },

          {
            prop: 'createTime',
            label: '创建时间',
            align: 'center',
            showOverflowTooltip: true,
            minWidth: 110,
            sortable: 'custom'
          },
          {
            slot: 'status',
            label: '状态',
            align: 'center',
            formatter: (row) => {
              const obj = this.statusOpt.find((i) => i.value == row.status);
              return obj && obj.label;
            }
          },
          {
            slot: 'scheduleStatus',
            label: '进度状态',
            align: 'center',
            formatter: (row) => {
              const obj = this.statusScheduleOpt.find(
                (i) => i.value == row.status
              );
              return obj && obj.label;
            }
          },
          {
            prop: 'serialNo',
            label: '客户代号',
            align: 'center',
            showOverflowTooltip: true
          },

          {
            prop: 'simpleName',
            label: '客户简称',
            align: 'center',
            showOverflowTooltip: true
          }
        ];
      }
    },
    created() {
      this.getFieldModel();
      this.listTimes();
    },
    methods: {
      getBomCategory() {
        getBomCategory({ bomCategoryId: this.form.productId }).then(
          (response) => {
            //console.log(response);
            if (
              response.data.data.length > 0 &&
              response.data.data[0].taskParam.length > 0 &&
              response.data.data[0].taskParam[0].materialQuota.length > 0
            )
              //console.log(response.data.data[0].taskParam[0].materialQuota);
              this.materialsList =
                response.data.data[0].taskParam[0].materialQuota.filter(
                  (item) => {
                    if (item.isReworkBom == 0) return true;
                  }
                );
          }
        );
      },

      getTimesList(value) {
        console.log(value);
      },
      listTimes() {
        listTimes({}).then((response) => {
          //console.log(response.data.data.list);
          this.timesList = [];
          var list = response.data.data.list;
          for (var i = 0; i < list.length; i++) {
            this.timesList = this.timesList.concat(list[i].details);
          }
          //console.log(this.timesList);
          this.timesList = this.timesList.map((item) => {
            return {
              value: item.id,
              text:
                item.name + '-[' + item.startTime + '-' + item.endTime + ']',
              name: item.name,
              startTime: item.startTime,
              endTime: item.endTime
            };
          });

          // let newRes = res.map((m) => {
          //   return {
          //     prop: 'extField.' + m.prop,
          //     label: m.label,
          //     align: 'center',
          //     showOverflowTooltip: true
          //   };
          // });
        });
      },
      checkedChange(index) {
        //console.log(this.capacityList[index].day);
        if (!this.capacityList[index].checked) return;
        this.form.day = this.capacityList[index].day;
        this.form.detailId = this.capacityList[index].id;
        this.capacityList = [];
        console.log(this.form.day);
      },
      /** 查询产线月产能详情定义列表 */
      getCapacityList() {
        //this.form.day = "";
        if (
          this.form.produceRoutingId == '' ||
          this.form.produceRoutingId == null
        ) {
          this.$message.warning('需要选择工艺路线！');
          return;
        }
        if (this.form.productLineId == '' || this.form.productLineId == null) {
          this.$message.warning('需要选择产线！');
          return;
        }

        if (this.form.year == '' || this.form.year == null) {
          this.$message.warning('需要选择年份！');
          return;
        }
        if (this.form.month == '' || this.form.month == null) {
          this.$message.warning('需要选择月份！');
          return;
        }
        this.loading = true;
        var node = {
          produceRoutingId: this.form.produceRoutingId,
          productLineId: this.form.productLineId,
          year: this.form.year,
          month: this.form.month
        };

        listProduct_line_capacity_detail(node).then((response) => {
          console.log(response);
          this.capacityList = response.data.data;
          this.capacityList.forEach((item) => {
            item.checked =
              item.plannedCapacity - item.plannedSumCapacity >=
              this.form.thisCapacity;
          });
          this.loading = false;
        });
      },
      statusFormatter(status) {
        const obj = this.statusOpt.find((i) => i.value == status);
        return obj && obj.label;
      },
      /* 表格数据源 */
      datasource({ page, limit, where }) {
        if (where.status) {
          where.statusList = [];
          where.statusList.push(where.status);
        }
        return getList({
          pageNum: page,
          size: limit,
          ...where,
          ...this.sort
        });
      },

      /* 数据转为树形结构 */
      parseData(data) {
        return {
          ...data,
          list: this.$util.toTreeData({
            data: data.list,
            count: data.total,

            idField: 'code',
            parentIdField: 'originalCode'
          })
        };
      },

      getFieldModel() {
        fieldModel({ fieldModel: 't_main_category' }).then((res) => {
          const privateColumn = [
            {
              columnKey: 'action',
              label: '操作',
              width: 120,
              align: 'center',
              resizable: false,
              fixed: 'right',
              slot: 'action'
            }
          ];

          let newRes = res.map((m) => {
            return {
              prop: 'extField.' + m.prop,
              label: m.label,
              align: 'center',
              showOverflowTooltip: true
            };
          });

          this.newColumns = [...this.columns, ...newRes, ...privateColumn];

          this.$forceUpdate();
        });
      },

      // 下达
      toRelease(row) {
        this.current = row;
        this.visible = true;
        //console.log(row);
        this.title = this.current.firstTaskName;
        this.form.produceRoutingId = this.current.produceRoutingId;
        this.form.thisCapacity = this.current.formingWeight;
        // this.form.productLineId = this.getProductionLineId(this.current.productionPlanId[0]);
        this.form.productId = this.current.categoryId;
        this.FirstTaskIdFn();
        this.WorkCenterIdFn();
        this.getBomCategory();
      },
      getProductionLineId(productionPlanId) {
        getById(productionPlanId).then((res) => {
          if (res) {
            return res.productLine;
          } else return '';
        });
      },
      // 下达
      confirm() {
        // console.log(this.timesList);
        for (var i = 0; i < this.timesList.length; i++) {
          console.log(this.timesList[i].value + '=' + this.form.classId);
          if (this.timesList[i].value == this.form.classId) {
            this.startTime = this.timesList[i].startTime;
            this.endTime = this.timesList[i].endTime;
            this.className = this.timesList[i].name;
          }
        }
        this.materialsList.forEach((item) => {
          delete item.bomArtFiles;
          delete item.replaceMaterial;
        });

        // console.log(this.startTime);
        const loading = this.$loading({ text: '加载中...' });
        occupyRes({
          id: this.current.id,
          detailId: this.form.detailId,
          startTime: Date.parse(
            new Date(
              this.form.year +
                '-' +
                this.form.month +
                '-' +
                this.form.day +
                ' ' +
                this.startTime
            )
          ),
          endTime: Date.parse(
            new Date(
              this.form.year +
                '-' +
                this.form.month +
                '-' +
                this.form.day +
                ' ' +
                this.endTime
            )
          ),
          className: this.className,
          materialQuotaVOList: this.materialsList,
          plannedOrder: this.current.code,
          plannedOrderCapacity: this.current.formingWeight,
          workCenterId: this.current.workCenterId,
          ...this.form
        })
          .then((res) => {
            if (res) {
              this.$message.success('成功');
              this.reload();
              this.visible = false;
            }
          })
          .finally(() => {
            loading.close();
          });
      },
      /* 刷新表格 */
      reload(where) {
        this.$nextTick(() => {
          this.$refs.table.reload({ page: 1, where });
        });
      },

      onSortChange(e) {
        let sort = {
          orderBy: e.order,
          sortName: e.prop
        };
        this.sort = sort;
        this.reload();
      },

      sortTop(row) {
        row.priority = Number(row.priority) + 1;
        this.priorityChange(row);
      },
      sortBottom(row) {
        if (row.priority <= 1) {
          return;
        }
        row.priority = Number(row.priority) - 1;
        this.priorityChange(row);
      },

      FirstTaskIdFn() {
        listByFirstTaskId(this.current.firstTaskId).then((res) => {
          this.stationList = res;
        });
      },

      WorkCenterIdFn() {
        listByWorkCenterId(this.current.workCenterId).then((res) => {
          this.teamsList = res;
          //console.log(res[0].productionLineId[0])
          if (
            res &&
            res.length > 0 &&
            res[0].productionLineId &&
            res[0].productionLineId.length > 0
          )
            this.form.productLineId = res[0].productionLineId[0];
        });
      },

      // 拆分
      toUnpack(row) {
        this.$refs.unpackRef.open(row);
      },

      createSuccess() {
        this.reload();
      },

      stationChange() {
        this.crewList = [];
        this.crewIds = [];

        listUserByIds([this.form.teamId]).then((res) => {
          this.crewList = res;
        });
      },

      priorityChange(row) {
        if (row.priority > 10) {
          row.priority = 10; // 如果大于 10，则设置为 10
        } else if (row.priority < 0) {
          row.priority = 0; // 如果小于 0，则设置为 0
        }

        this.priorityFn(row);
      },

      priorityFn: debounce(function (row) {
        let params = {
          id: row.id,
          priority: row.priority
        };
        updatePriority(params).then((res) => {});
      }, 800)
    }
  };
</script>

<style lang="scss" scoped>
  ::v-deep .el-table__row {
    height: 51px !important;
  }

  .btn_box {
    margin-bottom: 6px;
  }

  .check_box {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }

  .check {
    width: 14px;
    height: 14px;
    border: 1px solid #dddddd;

    display: flex;
    align-items: center;
    justify-content: center;
  }

  .act_check {
    border: 1px solid #409eff;
    background: #409eff;

    .el-icon-check {
      color: #fff;
      font-size: 10px;
    }
  }
  .statistics {
    padding: 10px 10px 20px;
  }
  .cardItem {
    border: 1px solid rgb(225, 225, 225);
    text-align: center;
    color: white;
    background-color: rgba(24, 144, 255, 0.8);
    overflow: hidden;
    padding: 10px;
  }
  .cardText {
    font-size: 16px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
  }
  .cardNum {
    font-size: 32px;
    font-style: italic;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
  }
  @media (max-width: 768px) {
    .cardText {
      font-size: 14px;
    }

    .cardNum {
      font-size: 24px;
    }
  }
  ::v-deep .el-card__body {
    padding: 17px 12px !important;
  }

  .bottom {
    flex: 1;
    width: 100%;
    .box {
      width: 15%;
      height: 69px;
      margin-right: 2%;
      margin-bottom: 10px;
      display: inline-block;
      cursor: pointer;
      .item {
        width: 100%;
        height: 100%;
        position: relative;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        border-radius: 2px;
        border: 1px solid #d9d9d9;
        .date {
          color: #202325;
        }
        .checked {
          position: absolute;
          top: 0;
          right: 0;
          width: 46px;
          height: 46px;
          > img {
            height: 100%;
            width: 100%;
          }
        }
      }
      .active {
        border-color: #2d80ee;
      }
    }
    .margin_0 {
      margin-right: 0;
    }
  }
</style>
