<template>
  <div class="app-container">
    <ScrapydServerTool @success="getData" />
    <div style="height:20px"></div>
    <ScrapydServerTable
      :data="list"
      :loading="listLoading"
      @success="getData"
    />
  </div>
</template>


<script setup lang="ts">
import { ref, onMounted } from 'vue';
import ScrapydServerTable from './components/ScrapydServerTable.vue'
import ScrapydServerTool from './components/ScrapydServerTool.vue'
import { getScrapydServerList } from '@/api/system'

const list = ref([])
const listLoading = ref(false)

const getData = async () => {
  listLoading.value = true
  try {
    const res = await getScrapydServerList()
    if (res.code === 0) {
      list.value = res.data.list
    }
  } catch (error) {
    console.error('获取数据失败:', error)
  } finally {
    listLoading.value = false
  }
}

onMounted(() => {
  getData()
})

</script>
