<template>
  <div style="padding: 0 20px">
    <lx-header
      icon="md-apps"
      :text="$route.meta.title"
      style="margin-bottom: 10px; border: 0px; margin-top: 15px"
    >
      <div slot="content"></div>
      <slot>
        <span style="padding: 0 6px; word-break: keep-all">关键字</span>
        <span>
          <Input
            v-model="select.keyword"
            placeholder="请输入关键字"
            style="width: 180px"
          ></Input>
        </span>
        <Button type="primary" style="margin-left: 10px" ghost @click=""
          >重置</Button
        >
        <Button type="primary" style="margin-left: 10px" @click="">查询</Button>
        <Button
          v-if="type === 0"
          type="primary"
          style="margin-left: 10px"
          @click="
            $refs['addPropertyPlan'].setType('add'),
              $refs['addPropertyPlan'].show()
          "
          >新增</Button
        >
      </slot>
    </lx-header>

    <xy-table :list="list" :table-item="table" @editor="(e) => {}">
      <template v-if="type !== 0" #btns> </template>
    </xy-table>

    <div style="display: flex; justify-content: flex-end; margin-top: 10px">
      <Page
        :total="total"
        show-elevator
        @on-change="
          (e) => {
            select.page = e;
            getList();
          }
        "
      />
    </div>

    <addPropertyPlan ref="addPropertyPlan"></addPropertyPlan>
  </div>
</template>

<script>
import { index, destroy } from "@/api/propertyPlan";

import addPropertyPlan from "@/views/finance/components/addPropertyPlan.vue";
export default {
  components: {
    addPropertyPlan,
  },
  data() {
    return {
      type: 0,
      select: {
        page: 1,
        page_size: 10,
      },
      list: [],
      table: [
        {
          label: "项目名称",
          width: 220,
          align: "left",
        },
        {
          prop: "",
          label: "计划评审时间",
          width: 200,
        },
        {
          prop: "",
          label: "实际评审时间",
          width: 200,
        },
      ],
      total: 0,
    };
  },
  methods: {
    async getList() {
      const res = await index(this.select);
      this.total = res.total;
      this.list = res.data;
    },
  },
  computed: {},
  beforeRouteEnter(to, from, next) {
    next((vm) => {
      this.type = to.path.split("_")[1];
    });
  },
};
</script>

<style scoped lang="scss"></style>
