<template>
  <div class="tableBox">
    <div class="top-btn-wrap">
      <el-button
        type="primary"
        @click="showDialog()">修改景区名称</el-button>
    </div>
    <div class="block-title">
      景区信息
    </div>
    <el-table
      :data="tableData"
      style="width: 100%">
      <el-table-column
        prop="projectName"
        label="景区"
      >
      </el-table-column>
      <el-table-column
        prop="projectNickName"
        label="景区名"
      >
      </el-table-column>
    </el-table>

    <ElDialog
      title="修改景区名称"
      width="660px"
      v-model="editVisible">
      <EditDialog
        :project-info="project"
        @updateList="getProject"></EditDialog>
    </ElDialog>
  </div>
</template>

<script>
import { getProject } from '@/api/systemSetting/project'
import ElDialog from '@/components/Dialog'
import EditDialog from './project/EditDialog'

export default {
  components: {
    ElDialog,
    EditDialog
  },
  created () {
    this.getProject()
  },
  data () {
    return {
      loading: false,
      editVisible: false,
      tableData: [],
      project: {
        projectName: 'xxxx',
        projectNickName: 'xxxxxxxxxx'
      }
    }
  },
  methods: {
    showDialog () {
      this.editVisible = true
    },
    getProject () {
      this.loading = true
      getProject().then(res => {
        this.loading = false
        this.project = res.extraInfo
        this.tableData = [res.extraInfo]
      })
    }
  }
}
</script>

<style scoped>

</style>
