<script>
import {mapMutations} from "vuex";
import {
  generateAnimals,
  generateArchives,
  generateBreedingPlans,
  generateHealths,
  generateUsers
} from "@/utils/common.js";

export default {
  name: "ZooData",
  methods: {
    ...mapMutations(['updateUsers', 'updateAnimals', 'updateBreedingPlans', 'updateArchives','updateHealths']),
    usersData() {
      generateUsers()
      return ElMessage({
        message: '成功',
        type: 'success',
      })
    },
    animalsData() {
      generateAnimals()
      return ElMessage({
        message: '成功',
        type: 'success',
      })
    },
    breedingPlansData() {
      generateBreedingPlans()
      return ElMessage({
        message: '成功',
        type: 'success',
      })
    },
    archiveData() {
      generateArchives()
      return ElMessage({
        message: '成功',
        type: 'success',
      })
    },
    healthData() {
      generateHealths()
      return ElMessage({
        message: '成功',
        type: 'success',
      })
    },
  }
}
</script>

<template>
  生成数据，最好先确保数据库中的各表没有数据再使用，使用方法：从左到右依次点击，每点击应该需等到弹出成功提示才继续点击下一个
  <hr />
  <el-button type="primary" @click="usersData">生成用户信息（预计需要5秒左右）</el-button>
  <el-button type="primary" @click="animalsData">生成动物信息（预计需要5秒左右）</el-button>
  <el-button type="primary" @click="breedingPlansData">生成饲养计划信息（预计需要10秒左右）</el-button>
  <el-button type="primary" @click="archiveData">生成档案信息（预计需要5分钟左右）</el-button>
  <el-button type="primary" @click="healthData">生成健康监测信息（预计需要5分钟左右）</el-button>
  <el-button type="primary" @click="$router.push('/login')">跳转登录</el-button>
</template>

<style scoped>

</style>