<template>
  <div class="home-cell" id="quickSearch">
    <CellHeaderVue title="快速查询">
      <span class="el-icon-setting" title="设置" @click="openSetting"></span>
    </CellHeaderVue>

    <quick
      ref="quick"
      :cellScrollHeight="cellScrollHeight"
      quickType="search"
    ></quick>
  </div>
</template>

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

import defaultQuickSearchItems from "./common/defaultQuickSearchItems.js";

export default {
  name: "QuickSearch",
  components: { CellHeaderVue, quick },
  props: {
    cellScrollHeight: {
      type: Number,
      required: true,
    },
  },
  created() {
    const admin = localStorage.getItem("quick-search-admin");
    if (!admin) {
      localStorage.setItem(
        "quick-search-admin",
        JSON.stringify(defaultQuickSearchItems.admin)
      );
    }
    const normal = localStorage.getItem("quick-search-normal");
    if (!normal) {
      localStorage.setItem(
        "quick-search-normal",
        JSON.stringify(defaultQuickSearchItems.normal)
      );
    }
  },
  methods: {
    openSetting() {
      this.$refs.quick.openSetting();
    },
  },
};
</script>

<style scoped></style>
