<!-- 登录日志 -->
<template>
  <div class="app-container">
    <el-container>
      <!-- 侧边栏 -->

      <el-main>
        <!-- 查询 -->
        <Conditions ref="conditions" :search-params.sync="searchParams" @search="search" />
        <!-- 表格 -->
        <Tables ref="dyTable" :tree-ids="treeIds" :search-params="searchParams"/>
        <!-- 弹窗 -->
      </el-main>

    </el-container>
  </div>
</template>

<script>
import Tables from './components/table.vue'
import Conditions from './components/conditions.vue'

export default {
  name: 'ParkMerchant',
  components: { Conditions, Tables },
  data() {
    return {
      global: {
        loading: true,
        companyids: '',
        companyid: '',
        projectid: '',
        dict: {
          type: { 1: '登录系统', 2: '退出系统' }
        },
        parkOptions: []
      },
      treeIds: '', // 侧边栏选中ID
      searchParams: {} // 查询(此处不赋值)
    }
  },
  provide() {
    return {
      global: this.global, // 全局数据对象
      reload: this.reload, // 重置
      refresh: this.refresh // 刷新
    }
  },
  mounted() {
    this.closeGlobalFilter()
  },
  methods: {
    /* common */
    reload() { // 重置搜索 回到第一页
      this.$refs.conditions.reset()
    },
    refresh() { // 不重置搜索 刷新当前页
      this.$refs.dyTable.getList(this.searchParams)
    },
    /* search -> table */
    search(params) { // 搜索
      this.searchParams = params
      this.$refs.dyTable.pageObj.current = 1
      this.$refs.dyTable.getList(this.searchParams)
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
