<template>
  <div>
    <el-drawer size="1200px" :visible.sync="drawer" direction="rtl">
      <div slot="title" class="title flex">
        <span
          >材料列表（共{{
            matterInfo.matterDatumList ? matterInfo.matterDatumList.length : 0
          }}个）</span
        >
        <span class="matter-name flex1 flexwrap"
          >事项全称：<span
            v-html="matterInfo.matterFullName || matterInfo.matterName"
          ></span>
        </span>
      </div>
      <!-- 列表 -->
      <div
        class="matterDatumList-list flex flexwrap jcb"
        v-if="matterInfo.matterDatumList && matterInfo.matterDatumList.length"
      >
        <div
          class="matterDatumList-item flex flexc aic"
          v-for="v in matterInfo.matterDatumList"
          :key="v.id"
          @click="handleCheck(v)"
        >
          <div class="pic-box">
            <div class="pic-img-box">
              <img class="pic" :src="api + v.preViewPath" />
            </div>
          </div>
          <div class="for-short">{{ v.materialName }}</div>
          <div class="matterDatumList-name">
            材料全称：{{ v.materiaFullName }}
          </div>
          <!-- <div class="check-btn" @click.stop>点击查看二维码</div> -->
        </div>
        <div
          class="list"
          v-for="item in row - (matterInfo.matterDatumList.length % row)"
          v-show="matterInfo.matterDatumList.length % row > 0"
          :key="'list' + item"
        ></div>
      </div>
      <!-- <el-empty class="empty" :image-size="200" v-else></el-empty> -->
      <YEmpty v-else width="400"></YEmpty>
    </el-drawer>
  </div>
</template>

<script>
import local from "@/utils/local";
import YEmpty from "@/components/YEmpty.vue";
export default {
  props: {
    visible: {
      type: Boolean,
      required: true,
      default: false,
    },
    matterInfo: {
      type: Object,
      required: true,
      default: () => {
        return {};
      },
    },
  },
  components: {
    YEmpty,
  },
  data() {
    return {
      api: local.getLocal("serverUrl") + "/",
      row: 4,
    };
  },
  computed: {
    drawer: {
      get() {
        return this.visible;
      },
      set(val) {
        this.$emit("update:visible", val);
      },
    },
  },
  methods: {
    handleCheck(row) {
      this.$router.push({
        path: "/showMaterials",
        query: {
          matterName: this.matterInfo.matterName,
          matterId: row.matterId,
          id: row.id,
        },
      });
    },
  },
};
</script>

<style lang="less" scoped>
:deep(.el-drawer__header) {
  margin-bottom: 20px;
}
:deep(.el-drawer__body) {
  border-top: 1px solid #e0e0e0;
  padding: 40px;
  padding-top: 0px;
  position: relative;
  overflow-y: auto;
  &::-webkit-scrollbar {
    width: 3px;
    overflow-y: auto;
  }

  &::-webkit-scrollbar-thumb {
    border-radius: 3px;
    background-color: rgba(144, 147, 153, 0.5);
  }
  &::-webkit-scrollbar-track {
    border-radius: 3px;
    background: #fff;
  }
}
.empty {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
}
.title {
  font-size: 28px;
  font-weight: 500;
  color: #333333;
  .matter-name {
    display: inline-block;
    // width: 1000px;
    font-size: 24px;
    line-height: 34px;
    color: #777777;
    // overflow: hidden;
    // text-overflow: ellipsis;
    // white-space: nowrap;
  }
}
.matterDatumList-list {
  width: 100%;
  height: 100%;
  align-content: flex-start;

  .list {
    content: "";
    width: 236px;
    border: 1px solid transparent;
    padding: 5px;
    overflow: hidden;
  }
}
.matterDatumList-item {
  width: 236px;
  margin-top: 40px;
  // height: 430px;
  .pic-box {
    width: 236px;
    height: 300px;
    padding: 16px 24px;
    background: #f4f6fc;
    border-radius: 16px;
    .pic-img-box {
      width: 100%;
      height: 100%;
      border-radius: 4px;
      overflow: hidden;
    }
    img {
      width: 100%;
      min-height: 100%;
      border-radius: inherit;
    }
  }
  .for-short {
    width: 100%;
    margin-top: 18px;
    margin-bottom: 8px;
    font-size: 28px;
    color: #333333;
    letter-spacing: 1px;
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .matterDatumList-name {
    width: 100%;
    font-size: 22px;
    color: #777777;
    line-height: 30px;
    letter-spacing: 1px;
    text-align: left;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }
  .check-btn {
    width: 185px;
    height: 50px;
    margin-top: 18px;
    background-color: #e6effd;
    border-radius: 8px;
    font-size: 20px;
    color: var(--main-theme-color);
    text-align: center;
    line-height: 50px;
    cursor: pointer;
  }
}
</style>
