<template>
  <el-select
    v-model="selected"
    v-bind="$attrs"
    :loading="loading"
    v-on="$listeners"
  >
    <el-option
      v-for="item in options"
      :key="item.id"
      :label="item.name"
      :value="item.id"
    >
      <!-- <el-row :gutter="20">
        <el-col :span="12">{{ item.id }}</el-col>
        <el-col :span="12" class="text-right">{{ item.name }}</el-col>
      </el-row> -->
    </el-option>
  </el-select>
</template>

<script>
import { getQueryManage } from "@/api/system/menu";

export default {
  props: {
    value: {
      type: Array,
      default: () => [],
    },
  },
  data() {
    return {
      options: [],
      loading: false,
    };
  },
  computed: {
    selected: {
      get() {
        return this.value;
      },
      set(v) {
        this.$emit("input", v);
      },
    },
  },
  created() {
    this.fetchReportList();
  },
  methods: {
    fetchReportList() {
      this.loading = true;
      const params = {
        pageNo: 1,
        pageSize: 100,
      };
      getQueryManage(params)
        .then((res) => {
          const list = res.data.list || {};
          this.options = [{ id: "", name: "不选择查询页面" }, ...list];
        })
        .finally(() => {
          this.loading = false;
        });
    },
  },
};
</script>

<style></style>
