<template>
  <div class="home-cell" id="quickSearch">
    <CellHeaderVue title="快速查询"> </CellHeaderVue>

    <el-scrollbar :style="{ height: cellScrollHeight + 'px' }">
      <div class="cell-content">
        <router-link
          v-for="(item, index) in options"
          :key="index"
          :to="item.url"
        >
          <div
            class="content-wrapper"
            :style="{ height: Math.floor(cellScrollHeight * 0.3) + 'px' }"
          >
            <div class="search-item-wrapper">
              <div class="search-item">
                <img :src="item.icon" alt="" />
                <span>{{ item.name }}</span>
              </div>
            </div>
          </div>
        </router-link>
      </div>
    </el-scrollbar>
  </div>
</template>

<script>
import CellHeaderVue from "./CellHeader.vue";

export default {
  name: "QuickSearch",
  components: { CellHeaderVue },
  props: {
    cellScrollHeight: {
      type: Number,
      required: true,
    },
  },
  data() {
    return {
      // options: [
      //   {
      //     name: "报文查询",
      //     icon: require("~/assets/icons/报文查询.svg"),
      //     url: "",
      //   },
      //   {
      //     name: "银行查询",
      //     icon: require("~/assets/icons/银行查询.svg"),
      //     url: "",
      //   },
      //   {
      //     name: "公司查询",
      //     icon: require("~/assets/icons/公司查询.svg"),
      //     url: "",
      //   },
      //   {
      //     name: "交易查询",
      //     icon: require("~/assets/icons/交易查询.svg"),
      //     url: "",
      //   },
      //   {
      //     name: "序号查询",
      //     icon: require("~/assets/icons/序号查询.svg"),
      //     url: "",
      //   },
      //   {
      //     name: "企业分类信息查询",
      //     icon: require("~/assets/icons/企业分类信息查询.svg"),
      //     url: "",
      //   },
      //   {
      //     name: "电子数据查询",
      //     icon: require("~/assets/icons/电子数据查询.svg"),
      //     url: "",
      //   },
      //   {
      //     name: "账务查看",
      //     icon: require("~/assets/icons/账务查看.svg"),
      //     url: "",
      //   },
      //   {
      //     name: "添加",
      //     icon: require("~/assets/icons/添加.svg"),
      //     url: "",
      //   },
      // ],
      options: [],
      all: {
        admin: [
          {
            name: "买方信用证交易查询",
            icon: require("~/assets/icons/交易查询.svg"),
            url: "/business/infdid",
          },
          {
            name: " 买方信用证单据查询",
            icon: require("~/assets/icons/单据查询.svg"),
            url: "/business/infbdd",
          },
          {
            name: "卖方信用证交易查询",
            icon: require("~/assets/icons/交易查询.svg"),
            url: "/business/infdet",
          },
          {
            name: "卖方信用证单据查询",
            icon: require("~/assets/icons/单据查询.svg"),
            url: "/business/infbfd",
          },
          {
            name: "出口信用证查询",
            icon: require("~/assets/icons/进出口查询.svg"),
            url: "/business/letsel",
          },
          {
            name: "出口信用证单据查询",
            icon: require("~/assets/icons/单据查询.svg"),
            url: "/business/infbed",
          },
          {
            name: "进口信用证查询",
            icon: require("~/assets/icons/进出口查询.svg"),
            url: "/business/inflid",
          },
          {
            name: "进口信用证单据查询",
            icon: require("~/assets/icons/单据查询.svg"),
            url: "/business/infbpd",
          },
          {
            name: "进口代收查询",
            icon: require("~/assets/icons/进口代收查询.svg"),
            url: "/business/infbcd",
          },
        ],
        normal: [
          {
            name: "买方信用证交易查询",
            icon: require("~/assets/icons/交易查询.svg"),
            url: "/business/infdid",
          },
          {
            name: " 买方信用证单据查询",
            icon: require("~/assets/icons/单据查询.svg"),
            url: "/business/infbdd",
          },
          {
            name: "卖方信用证交易查询",
            icon: require("~/assets/icons/交易查询.svg"),
            url: "/business/infdet",
          },
          {
            name: "卖方信用证单据查询",
            icon: require("~/assets/icons/单据查询.svg"),
            url: "/business/infbfd",
          },
          {
            name: "出口信用证查询",
            icon: require("~/assets/icons/进出口查询.svg"),
            url: "/business/letsel",
          },
          {
            name: "进口信用证查询",
            icon: require("~/assets/icons/进出口查询.svg"),
            url: "/business/inflid",
          },
          {
            name: "进口信用证单据查询",
            icon: require("~/assets/icons/单据查询.svg"),
            url: "/business/infbpd",
          },
        ],
      },
    };
  },
  mounted() {
    this.genItems()
  },
  methods: {
    genItems () {
      const userId = this.$store.state.UserContext.userId;
      if (userId.toLowerCase() === "zl") {
        this.options = this.all.admin;
      } else {
        this.options = this.all.normal;
      }
    }
  }
};
</script>

<style scoped>
#quickSearch .cell-content {
  /* display: flex;
  flex-wrap: wrap; */
}
#quickSearch .content-wrapper {
  display: inline-block;
  width: 33%;
  height: 30%;
  cursor: pointer;
}
#quickSearch .cell-content .search-item-wrapper {
  display: flex;
  height: 100%;
  justify-content: center;
  align-items: center;
}
#quickSearch .cell-content .search-item {
  /* padding-bottom: 16px; */
  display: flex;
  flex-direction: column;
  align-items: center;
  /* cursor: pointer; */
}
#quickSearch .cell-content .search-item i {
  color: #0088ff;
  font-size: 36px;
}
#quickSearch .cell-content .search-item span {
  color: #303133;
  font-size: 14px;
  margin-top: 10px;
}
/* #quickSearch .cell-content .search-item:hover i {
  color: var(--themecolor);
} */
/* #quickSearch .cell-content .search-item:hover span { */
#quickSearch .cell-content .content-wrapper:hover span {
  color: var(--themecolor);
}
</style>
