收尾工作

This commit is contained in:
bicey 2024-06-10 12:32:27 +08:00
parent 3a1fac9100
commit 0f5cc52614
3 changed files with 47 additions and 25 deletions

View File

@ -1,4 +1,4 @@
# zoo-frontend
# zoo-frontend(大报告要求)
本次建设的动物信息分为以下功能:
@ -26,11 +26,25 @@
- ElementUI
- axios
# 说明
# 说明(给使用者看的)
## 功能说明
首页统计面板没有对接后端,无法操作,只做观赏作用
其余界面均实现基本的增删改查,健康监测等复杂的功能没有实现
# 需要后端提供的数据
## 使用说明
前端方面下载zip或通过git拉取文件运行
后端方面同上但是application.yml中的username和password需要改成你自己数据库的用户名和密码一般只需要改密码就行还有其他项目配置如jdkmaven需要你自己配置
数据库方面先创建一个数据库无需建表数据库名字为zoo然后运行sql文件导入表和数据
前端需要搞好数据库和运行后端程序,才能正常运行使用
# 需要后端提供的数据(给后端开发看的)
一切以最终实现的接口为准,你需要前端提供什么数据就什么数据

View File

@ -52,11 +52,13 @@ export default {
</script>
<template>
<el-button type="primary" @click="usersData">生成用户信息</el-button>
<el-button type="primary" @click="animalsData">生成动物信息</el-button>
<el-button type="primary" @click="breedingPlansData">生成饲养计划信息</el-button>
<el-button type="primary" @click="archiveData">生成档案信息</el-button>
<el-button type="primary" @click="healthData">生成健康监测信息</el-button>
生成数据最好先确保数据库中的各表没有数据再使用使用方法从左到右依次点击每点击应该需等到弹出成功提示才继续点击下一个
<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>

View File

@ -10,7 +10,7 @@ export function generateUsers() {
for (let i = 0; i < n; i++) {
const a = generateAuth()
let user = {
id: i+2,
id: i + 2,
username: 'user' + (i + 2),
password: '123456',
auth: a,
@ -48,7 +48,7 @@ export function generateAnimals() {
const n = Math.floor(Math.random() * 20) + 40;
for (let i = 0; i < n; i++) {
let animal = {
id: i+3,
id: i + 3,
name: 'animal' + (i + 1),
sex: Math.floor(Math.random() * 2) === 0 ? '雌性' : '雄性',
species: '种类' + Math.ceil(Math.random() * 20).toString(),//种类
@ -176,11 +176,11 @@ function generatePhase() {
}
//生成档案
export function generateArchives() {
export async function generateArchives() {
const archives = []
let aid=0
store.state.animals.forEach(e => {
let aid = 0
for (const e of store.state.animals) {
//分为四个周期的档案
for (let i = 0; i < 4; i++) {
let n;
@ -220,7 +220,7 @@ export function generateArchives() {
animalName: archive.animalName,//字符 记录的动物名称
state: archive.state,//int 动物状态 0正常1异常
temperature: Number((35 + Math.random() * 7).toFixed(1)),//double 体温
breathRate: Math.floor(Math.random() * 90) + 10 ,//int 呼吸频率
breathRate: Math.floor(Math.random() * 90) + 10,//int 呼吸频率
heartRate: Math.floor(Math.random() * 130) + 10,//int 心跳频率
bloodPressure: Math.floor(Math.random() * 110) + 70,//int // 血压
date: archive.date,//字符 记录日期
@ -228,29 +228,35 @@ export function generateArchives() {
description: 'test health' + i + '' + j + ' description',//字符 检测的描述,比如动物的症状
}
//异常的记录要修改一下监测数据
if (health.state===1){
health.temperature += Math.random()*2>1?
Number((Math.random()*health.temperature*0.5).toFixed(1)):
-Number((Math.random()*health.temperature*0.5).toFixed(1))
if (health.state === 1) {
health.temperature += Math.random() * 2 > 1 ?
Number((Math.random() * health.temperature * 0.5).toFixed(1)) :
-Number((Math.random() * health.temperature * 0.5).toFixed(1))
health.temperature = Number(health.temperature.toFixed(1))
health.breathRate += Math.random()*2>1?
Math.floor(Math.random()*health.breathRate*0.5):-Math.floor(Math.random()*health.breathRate*0.5)
health.heartRate += health.heartRate += Math.random()*2>1?
Math.floor(Math.random()*health.heartRate*0.5):-Math.floor(Math.random()*health.heartRate*0.5)
health.bloodPressure += health.bloodPressure += Math.random()*2>1?
Math.floor(Math.random()*health.bloodPressure*0.5):-Math.floor(Math.random()*health.bloodPressure*0.5)
health.breathRate += Math.random() * 2 > 1 ?
Math.floor(Math.random() * health.breathRate * 0.5) : -Math.floor(Math.random() * health.breathRate * 0.5)
health.heartRate += health.heartRate += Math.random() * 2 > 1 ?
Math.floor(Math.random() * health.heartRate * 0.5) : -Math.floor(Math.random() * health.heartRate * 0.5)
health.bloodPressure += health.bloodPressure += Math.random() * 2 > 1 ?
Math.floor(Math.random() * health.bloodPressure * 0.5) : -Math.floor(Math.random() * health.bloodPressure * 0.5)
}
request.addHealthRequest(health)
healths.push(health)
aid++
await sleep(50)
}
}
})
}
console.log('档案', archives)
return archives
}
function sleep(time){
return new Promise((resolve) => setTimeout(resolve, time));
}
const healths = []
export function generateHealths() {