Compare commits
No commits in common. "fdcb6479e7d1be91579b9d6181a26984dfd8169c" and "7e2ae9e56555d8b2a6b5a209a955f22aed9f736b" have entirely different histories.
fdcb6479e7
...
7e2ae9e565
@ -1 +0,0 @@
|
|||||||
VITE_BASE_URL='http://localhost:8888'
|
|
@ -1 +0,0 @@
|
|||||||
VITE_BASE_URL='http://zoo-backend:12321'
|
|
173
README.md
173
README.md
@ -1,40 +1,23 @@
|
|||||||
# 动物信息管理系统说明
|
# zoo-frontend
|
||||||
|
|
||||||
## 简介
|
|
||||||
|
|
||||||
本人负责动物信息管理系统的前端部分,该项目为大作业所作,由于不擅长前端,所以很烂
|
|
||||||
|
|
||||||
加载数据很卡,没做优化,卡住的话耐心等待几秒吧
|
|
||||||
|
|
||||||
## 账户(密码都是123456)
|
|
||||||
|
|
||||||
管理员账户:admin
|
|
||||||
|
|
||||||
饲养员账户:user2
|
|
||||||
|
|
||||||
兽医账户:user4
|
|
||||||
|
|
||||||
|
|
||||||
# zoo-frontend(大报告要求)
|
|
||||||
|
|
||||||
本次建设的动物信息分为以下功能:
|
本次建设的动物信息分为以下功能:
|
||||||
|
|
||||||
1. 数据录入与管理(前端基本完成,已接入后端)
|
1. 数据录入与管理(前端基本完成,未接入后端)
|
||||||
系统应提供数据录入功能,允许用户输入动物的基本信息,如种类、年龄、性别、体重、健康状况等。同时,系统应具备数据管理功能,包括数据的查询、修改、删除等操作,以便用户能够方便地管理和维护动物信息。
|
系统应提供数据录入功能,允许用户输入动物的基本信息,如种类、年龄、性别、体重、健康状况等。同时,系统应具备数据管理功能,包括数据的查询、修改、删除等操作,以便用户能够方便地管理和维护动物信息。
|
||||||
|
|
||||||
2. 动物档案管理(前端基本完成,已接入后端)
|
2. 动物档案管理(前端基本完成,未接入后端)
|
||||||
系统应建立动物档案,记录动物的整个生命周期,包括出生日期、疫苗接种记录、疾病治疗记录、饲养记录等。这有助于跟踪动物的健康状况和饲养情况,为动物提供更好的管理和照顾。
|
系统应建立动物档案,记录动物的整个生命周期,包括出生日期、疫苗接种记录、疾病治疗记录、饲养记录等。这有助于跟踪动物的健康状况和饲养情况,为动物提供更好的管理和照顾。
|
||||||
|
|
||||||
3. 饲养管理(前端基本完成,已接入后端)
|
3. 饲养管理(前端基本完成,未接入后端)
|
||||||
系统应提供饲养管理功能,包括饲养计划的制定、饲养任务的分配、饲养记录的管理等。这有助于确保动物获得适当的饲料和营养,保持健康生长。
|
系统应提供饲养管理功能,包括饲养计划的制定、饲养任务的分配、饲养记录的管理等。这有助于确保动物获得适当的饲料和营养,保持健康生长。
|
||||||
|
|
||||||
4. 健康监测与预警(前端基本完成,已接入后端)
|
4. 健康监测与预警(前端基本完成,未接入后端)
|
||||||
系统应具备健康监测功能,定期收集和分析动物的健康数据,如体温、心率、呼吸频率等。同时,系统应提供预警功能,当动物的健康数据出现异常时,及时提醒管理人员采取相应措施。
|
系统应具备健康监测功能,定期收集和分析动物的健康数据,如体温、心率、呼吸频率等。同时,系统应提供预警功能,当动物的健康数据出现异常时,及时提醒管理人员采取相应措施。
|
||||||
|
|
||||||
5. 统计分析(前端基本完成,无需后端)
|
5. 统计分析(未开始)
|
||||||
系统应提供统计分析功能,对动物信息、饲养记录、健康数据等进行统计分析,生成各类报表和图表。这有助于管理人员了解动物的整体状况和饲养效果,为决策提供支持。
|
系统应提供统计分析功能,对动物信息、饲养记录、健康数据等进行统计分析,生成各类报表和图表。这有助于管理人员了解动物的整体状况和饲养效果,为决策提供支持。
|
||||||
|
|
||||||
6. 用户权限管理(前端基本完成,已接入后端)
|
6. 用户权限管理(前端基本完成,未接入后端)
|
||||||
系统应建立用户权限管理机制,对不同用户设置不同的权限,如管理员、饲养员、兽医等。这有助于确保系统的安全性和数据的保密性。
|
系统应建立用户权限管理机制,对不同用户设置不同的权限,如管理员、饲养员、兽医等。这有助于确保系统的安全性和数据的保密性。
|
||||||
|
|
||||||
使用的技术/资源:
|
使用的技术/资源:
|
||||||
@ -43,25 +26,7 @@
|
|||||||
- ElementUI
|
- ElementUI
|
||||||
- axios
|
- axios
|
||||||
|
|
||||||
# 说明(给使用者看的)
|
# 需要后端提供的数据
|
||||||
|
|
||||||
## 功能说明
|
|
||||||
|
|
||||||
首页统计面板没有对接后端,无法操作,只做观赏作用
|
|
||||||
|
|
||||||
其余界面均实现基本的增删改查,健康监测等复杂的功能没有实现
|
|
||||||
|
|
||||||
## 使用说明
|
|
||||||
|
|
||||||
前端方面:下载zip或通过git拉取文件运行
|
|
||||||
|
|
||||||
后端方面:同上,但是application.yml中的username和password需要改成你自己数据库的用户名和密码,一般只需要改密码就行,还有其他项目配置如jdk,maven需要你自己配置
|
|
||||||
|
|
||||||
数据库方面:先创建一个数据库(无需建表),数据库名字为zoo,然后运行sql文件导入表和数据
|
|
||||||
|
|
||||||
前端需要搞好数据库和运行后端程序,才能正常运行使用
|
|
||||||
|
|
||||||
# 需要后端提供的数据(给后端开发看的)
|
|
||||||
|
|
||||||
一切以最终实现的接口为准,你需要前端提供什么数据就什么数据
|
一切以最终实现的接口为准,你需要前端提供什么数据就什么数据
|
||||||
|
|
||||||
@ -258,4 +223,124 @@ health: {
|
|||||||
|
|
||||||
## 统计分析
|
## 统计分析
|
||||||
---
|
---
|
||||||
无需后端
|
|
||||||
|
|
||||||
|
## 需求分析
|
||||||
|
|
||||||
|
一、引言
|
||||||
|
|
||||||
|
动物园信息管理系统旨在为动物园内部人员(如系统管理员、饲养员、兽医等)提供一个便捷、高效的管理工具,以记录动物数据、提高管理效率、保障动物健康和福利。通过该系统,可以实时监控动物的各项体征数据,判断动物是否健康,并根据数据优化动物的生活环境,确保动物处于相对健康的状态。
|
||||||
|
|
||||||
|
二、系统用户
|
||||||
|
|
||||||
|
1. 系统管理员
|
||||||
|
|
||||||
|
- 用户与权限管理:负责创建、修改和删除用户账户,分配不同角色的权限,确保系统数据的安全性和完整性。(用户管理,重要)
|
||||||
|
- 系统设置与维护:进行系统参数配置,如数据备份策略、系统日志管理等,确保系统的稳定运行。(不重要)
|
||||||
|
- 数据监控与报告:实时监控动物数据异常情况,生成各类统计报告,为动物园管理层提供决策支持。(统计分析,一般)
|
||||||
|
|
||||||
|
3. 饲养员
|
||||||
|
|
||||||
|
- 动物日常饲养记录:录入动物的饮食、行为、活动等日常饲养信息,确保数据的准确性和完整性。(饲养管理,重要)
|
||||||
|
- 饲养计划制定与执行:根据动物种类、年龄、健康状况等因素,制定合理的饲养计划,并监控计划的执行情况。(饲养管理,一般)
|
||||||
|
- 食物库存管理:预估食物库存情况,及时补充库存,避免食物短缺或浪费。(不重要)
|
||||||
|
- 报警系统响应:接收系统发出的异常报警,及时处理异常情况,保障动物健康与安全。(不重要)
|
||||||
|
|
||||||
|
5. 兽医
|
||||||
|
|
||||||
|
- 动物体检数据录入与分析:录入动物的体重、体温、心跳等体征数据,进行健康评估,并生成诊断报告。(动物档案、健康检测,重要)
|
||||||
|
- 疾病治疗与记录:制定治疗方案,记录治疗过程及效果,为动物健康提供有力保障。(动物档案,重要)
|
||||||
|
- 报警系统响应:根据系统发出的异常报警,及时对患病动物进行诊断和治疗。(不重要)
|
||||||
|
|
||||||
|
三、功能需求
|
||||||
|
|
||||||
|
1. 数据管理(重要)
|
||||||
|
|
||||||
|
- 信息录入:动物基本信息的录入和管理,包括种类、年龄、性别、体重、健康状况等。(重要)
|
||||||
|
- 动物日常记录:饲养员可以记录动物的饮食、行为、活动等情况。
|
||||||
|
- 动物体检数据录入:兽医可以实时更新动物的体重、体温、心跳、呼吸等体征数据,并上传相关诊断报告。
|
||||||
|
- 动物档案管理:系统应该能够完整记录动物的生命周期信息,如出生日期、疫苗接种记录、疾病治疗记录、饲养记录等,确保数据的完整性和准确性。
|
||||||
|
|
||||||
|
3. 数据查询与统计(重要)
|
||||||
|
|
||||||
|
- 提供多种查询方式,如按动物种类、年龄、性别等条件查询动物信息。
|
||||||
|
- 统计动物数量、饲养成本、疾病发生率等数据,为动物园管理提供决策支持。
|
||||||
|
|
||||||
|
5. 健康与福利管理(一般)
|
||||||
|
|
||||||
|
- 实时监控动物体征数据,设置异常数据阈值,当数据超过阈值时自动报警。
|
||||||
|
- 提供动物健康评估功能,根据体征数据判断动物健康状态,并给出相应建议。
|
||||||
|
- 记录动物福利措施实施情况,如改善动物生活环境、增加娱乐设施等。
|
||||||
|
|
||||||
|
7. 权限管理(重要)
|
||||||
|
|
||||||
|
- 为不同用户角色分配不同的权限,只有授权的用户能够访问系统的特定功能和数据确保系统数据的安全性和完整性。
|
||||||
|
- 实现用户登录、注销功能,记录用户操作日志,便于追踪和审计。
|
||||||
|
|
||||||
|
9. 系统维护与优化(不重要)
|
||||||
|
|
||||||
|
- 提供数据备份与恢复功能,确保系统数据的安全可靠。定期备份系统数据,以防止数据丢失或系统故障。
|
||||||
|
- 支持系统升级和扩展,以适应动物园管理需求的变化。
|
||||||
|
|
||||||
|
四、报警系统分级(不一定来得及开发)
|
||||||
|
|
||||||
|
报警系统应采用分级制度,根据紧急程度逐级递增决定响应策略。例如,可以设置以下报警级别:
|
||||||
|
|
||||||
|
1. 一级报警:涉及动物生命安全或重大疾病的紧急情况,需立即处理。系统可根据预留手机号拨打电话提醒相关人员。
|
||||||
|
2. 二级报警:动物体征数据异常但未造成严重危害或饲养计划执行不到位等情况,需尽快处理。系统可发送邮件或短信提醒相关人员。
|
||||||
|
3. 三级报警:日常饲养记录缺失或数据录入错误等较小问题,可安排定期处理。
|
||||||
|
|
||||||
|
报警系统闭环管理的流程:
|
||||||
|
|
||||||
|
1.**报警触发:**报警系统根据预设的规则和条件,监测动物的健康状况、饲养记录等信息,当发现异常情况符合报警规则时,自动触发相应级别的报警。
|
||||||
|
|
||||||
|
2.**通知相关人员:**报警系统根据报警级别选择适的通知方式,通知相关责任人员,如饲养管理员、兽医等。通知方式可以包括电话呼叫、短信、邮件等。
|
||||||
|
|
||||||
|
3.**接收报警信息:**相关责任人员接收到报警信息后,需要及时查看并了解报警的具体内容和情况。系统应提供清晰明了的报警信息,包括动物种类、具体问题、位置等。
|
||||||
|
|
||||||
|
4.**处理报警:**相关责任人员根据报警信息采取相应的处理措施,针对不同级别的报警,制定相应的应对策略。一级报警需要立即处理,二级报警需要尽快处理,三级报警可以安排定期处理。
|
||||||
|
|
||||||
|
5.**解决问题:**相关责任人员在处理报警过程中,需要确保问题得到有效解决。对于一级报警和二级报警,需及时采取措施保障动物的健康和安全;对于三级报警,需要及时查明原因并采取相应措施,避免问题的再次发生。
|
||||||
|
|
||||||
|
6.**反馈和记录:**处理报警后,相关责任人员需要向系统反馈处理结果,并在系统中记录处理过程和结果。系统应提供相应的反馈和记录功能,方便责任人员进行操作。
|
||||||
|
|
||||||
|
7.**系统优化:**管理人员定期对报警系统的性能进行评估和分析,根据实际情况和反馈信息,对系统进行优化和改进。可以针对报警规则、通知方式、处理流程等方面进行调整,提高报警系统的准确性和效率。
|
||||||
|
|
||||||
|
五、饲养计划闭环系统(不一定来得及开发)
|
||||||
|
|
||||||
|
饲养计划的闭环是指在动物园信息管理系统中,通过制定、执行、监控和反馈的过程,实现对动物饲养的全面管理和持续优化。以下是饲养计划的闭环流程:
|
||||||
|
|
||||||
|
1. **计划制定:**饲养管理员根据动物的种类、年龄、健康状况等因素,制定饲养计划。计划包括每日、每周或每月的饲养任务安排,确定每种动物的饲料类型、数量和喂养时间等。
|
||||||
|
如果动物患有疾病或健康问题,兽医可以在饲养计划中考虑到这些特殊情况,对饲养计划和管理流程进行调整和优化
|
||||||
|
|
||||||
|
2. **任务分配:**系统根据制定的饲养计划,自动将任务分配给相应的饲养员。任务分配考虑到饲养员的工作时间、技能水平和工作负荷等因素,确保任务合理分配。
|
||||||
|
|
||||||
|
3. **执行监控:**饲养员执行任务时,实时记录饲养过程中的关键信息,如喂养时间、饲料用量、动物反应等。同时,系统监控饲养过程中的异常情况,如动物健康状况异常、饲料不足等。
|
||||||
|
|
||||||
|
4. **数据采集与分析:**系统定期采集和分析动物的健康数据和饲养记录,包括体重变化、食欲情况、疾病发生率等。通过数据分析,及时发现饲养过程中存在的问题和改进空间。
|
||||||
|
|
||||||
|
5. **问题反馈与调整:**根据数据分析结果,系统生成饲养效果报告和健康预警信息。管理人员和饲养员根据报告和预警信息,及时调整饲养计划和执行策略,解决存在的问题,并优化饲养过程。
|
||||||
|
|
||||||
|
六、饲料库存自动化管理系统(不一定来得及开发)
|
||||||
|
|
||||||
|
针对动物园饲料库存管理,建立自动化管理系统同样能够提高效率、降低成本并确保饲料供应的及时性。以下是动物园饲料库存自动化管理的主要内容和流程:
|
||||||
|
|
||||||
|
1. **自动化库存登记:**建立自动化系统,对动物园所有饲料进行自动化登记和识别,包括名称、规格、数量、购买日期、供应商信息等,实现饲料信息的自动采集和录入。
|
||||||
|
|
||||||
|
2. **库存监控:**实时监测饲料库存的数量、质量和保质期等信息。如有即将过期的饲料,系统会自动发送通知提醒相关人员。通过自动化系统,管理人员可以随时查看库存情况,并及时采取补货或调拨等措施。
|
||||||
|
|
||||||
|
3. **智能化补货策略:**根据库存监控数据和需求预测模型,制定智能化的补货策略。系统可以自动分析库存变化趋势和消耗情况,智能生成补货计划,并自动向供应商下订单,实现自动化补货流程。
|
||||||
|
|
||||||
|
4. **库存记录和报告:**系统可以自动生成库存记录和报告,包括库存量、成本、动物饲养需求等数据。管理人员可以通过系统查看和分析库存数据,优化饲料库存结构和管理策略。
|
||||||
|
|
||||||
|
七、非功能需求(略)
|
||||||
|
|
||||||
|
1. 易用性:系统界面简洁明了,操作流程简单易懂,方便用户快速上手。
|
||||||
|
2. 稳定性:系统应具有高可靠性,能够长时间稳定运行,减少故障率。
|
||||||
|
3. 安全性:系统应采取必要的安全措施,保护用户数据和系统免受攻击和破坏。
|
||||||
|
4. 可扩展性:系统应具备良好的可扩展性,以便在未来添加新的功能模块或集成其他系统。
|
||||||
|
|
||||||
|
八、总结(略)
|
||||||
|
|
||||||
|
动物园信息管理系统旨在提高动物园内部人员的管理效率,保障动物健康和福利。通过实现动物数据管理、数据查询与统计、健康与福利管理等功能,可以优化动物园管理流程,提升动物生活质量。同时,系统还应满足易用性、稳定性、安全性和可扩展性等非功能需求,确保系统的稳定运行和持续发展。
|
||||||
|
|
||||||
|
91
package-lock.json
generated
91
package-lock.json
generated
@ -9,7 +9,6 @@
|
|||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@element-plus/icons-vue": "^2.3.1",
|
"@element-plus/icons-vue": "^2.3.1",
|
||||||
"axios": "^1.7.2",
|
|
||||||
"element-plus": "^2.7.3",
|
"element-plus": "^2.7.3",
|
||||||
"unplugin-icons": "^0.19.0",
|
"unplugin-icons": "^0.19.0",
|
||||||
"vite-plugin-inspect": "^0.8.4",
|
"vite-plugin-inspect": "^0.8.4",
|
||||||
@ -992,21 +991,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/async-validator/-/async-validator-4.2.5.tgz",
|
"resolved": "https://registry.npmjs.org/async-validator/-/async-validator-4.2.5.tgz",
|
||||||
"integrity": "sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg=="
|
"integrity": "sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg=="
|
||||||
},
|
},
|
||||||
"node_modules/asynckit": {
|
|
||||||
"version": "0.4.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
|
||||||
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
|
|
||||||
},
|
|
||||||
"node_modules/axios": {
|
|
||||||
"version": "1.7.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.7.2.tgz",
|
|
||||||
"integrity": "sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==",
|
|
||||||
"dependencies": {
|
|
||||||
"follow-redirects": "^1.15.6",
|
|
||||||
"form-data": "^4.0.0",
|
|
||||||
"proxy-from-env": "^1.1.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/balanced-match": {
|
"node_modules/balanced-match": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||||
@ -1086,17 +1070,6 @@
|
|||||||
"fsevents": "~2.3.2"
|
"fsevents": "~2.3.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/combined-stream": {
|
|
||||||
"version": "1.0.8",
|
|
||||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
|
||||||
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
|
||||||
"dependencies": {
|
|
||||||
"delayed-stream": "~1.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/confbox": {
|
"node_modules/confbox": {
|
||||||
"version": "0.1.7",
|
"version": "0.1.7",
|
||||||
"resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.7.tgz",
|
"resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.7.tgz",
|
||||||
@ -1178,14 +1151,6 @@
|
|||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/delayed-stream": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
|
||||||
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=0.4.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/element-plus": {
|
"node_modules/element-plus": {
|
||||||
"version": "2.7.3",
|
"version": "2.7.3",
|
||||||
"resolved": "https://registry.npmjs.org/element-plus/-/element-plus-2.7.3.tgz",
|
"resolved": "https://registry.npmjs.org/element-plus/-/element-plus-2.7.3.tgz",
|
||||||
@ -1362,38 +1327,6 @@
|
|||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/follow-redirects": {
|
|
||||||
"version": "1.15.6",
|
|
||||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz",
|
|
||||||
"integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==",
|
|
||||||
"funding": [
|
|
||||||
{
|
|
||||||
"type": "individual",
|
|
||||||
"url": "https://github.com/sponsors/RubenVerborgh"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">=4.0"
|
|
||||||
},
|
|
||||||
"peerDependenciesMeta": {
|
|
||||||
"debug": {
|
|
||||||
"optional": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/form-data": {
|
|
||||||
"version": "4.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
|
|
||||||
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
|
|
||||||
"dependencies": {
|
|
||||||
"asynckit": "^0.4.0",
|
|
||||||
"combined-stream": "^1.0.8",
|
|
||||||
"mime-types": "^2.1.12"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/fs-extra": {
|
"node_modules/fs-extra": {
|
||||||
"version": "11.2.0",
|
"version": "11.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz",
|
||||||
@ -1692,25 +1625,6 @@
|
|||||||
"node": ">=8.6"
|
"node": ">=8.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/mime-db": {
|
|
||||||
"version": "1.52.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
|
||||||
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/mime-types": {
|
|
||||||
"version": "2.1.35",
|
|
||||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
|
||||||
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
|
||||||
"dependencies": {
|
|
||||||
"mime-db": "1.52.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/mimic-fn": {
|
"node_modules/mimic-fn": {
|
||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
|
||||||
@ -1943,11 +1857,6 @@
|
|||||||
"node": "^10 || ^12 || >=14"
|
"node": "^10 || ^12 || >=14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/proxy-from-env": {
|
|
||||||
"version": "1.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
|
|
||||||
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
|
|
||||||
},
|
|
||||||
"node_modules/queue-microtask": {
|
"node_modules/queue-microtask": {
|
||||||
"version": "1.2.3",
|
"version": "1.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@element-plus/icons-vue": "^2.3.1",
|
"@element-plus/icons-vue": "^2.3.1",
|
||||||
"axios": "^1.7.2",
|
|
||||||
"element-plus": "^2.7.3",
|
"element-plus": "^2.7.3",
|
||||||
"unplugin-icons": "^0.19.0",
|
"unplugin-icons": "^0.19.0",
|
||||||
"vite-plugin-inspect": "^0.8.4",
|
"vite-plugin-inspect": "^0.8.4",
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
/*浏览器默认margin为8px,会出现滚动条的问题,因此此处设置为0*/
|
/*浏览器默认margin为8px,会出现滚动条的问题,因此此处设置为0*/
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
background-color: aliceblue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*相对定位*/
|
/*相对定位*/
|
||||||
@ -42,7 +41,7 @@ body {
|
|||||||
|
|
||||||
/*与pages组件相关的所有样式*/
|
/*与pages组件相关的所有样式*/
|
||||||
.table {
|
.table {
|
||||||
height: 516px;
|
height: 506px;
|
||||||
margin: 0 30px;
|
margin: 0 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
import {copy} from "@/utils/common.js";
|
import {copy} from "@/utils/common.js";
|
||||||
import {mapGetters} from "vuex";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ZooAnimalFormDialog",
|
name: "ZooAnimalFormDialog",
|
||||||
@ -19,102 +18,6 @@ export default {
|
|||||||
features: '',//特征
|
features: '',//特征
|
||||||
phase: '幼年期'//生长阶段
|
phase: '幼年期'//生长阶段
|
||||||
},
|
},
|
||||||
selectSpecies:true,
|
|
||||||
speciesData:[
|
|
||||||
{
|
|
||||||
value: '哺乳动物',
|
|
||||||
label: '哺乳动物',
|
|
||||||
children: [
|
|
||||||
{ value: '老虎', label: '老虎' },
|
|
||||||
{ value: '狮子', label: '狮子' },
|
|
||||||
{ value: '熊', label: '熊' },
|
|
||||||
{ value: '大象', label: '大象' },
|
|
||||||
{ value: '猴子', label: '猴子' },
|
|
||||||
{ value: '长颈鹿', label: '长颈鹿' },
|
|
||||||
{ value: '斑马', label: '斑马' },
|
|
||||||
{ value: '河马', label: '河马' },
|
|
||||||
{ value: '袋鼠', label: '袋鼠' },
|
|
||||||
{ value: '狼', label: '狼' },
|
|
||||||
{ value: '狐猴', label: '狐猴' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: '鸟类',
|
|
||||||
label: '鸟类',
|
|
||||||
children: [
|
|
||||||
{ value: '鸵鸟', label: '鸵鸟' },
|
|
||||||
{ value: '鹦鹉', label: '鹦鹉' },
|
|
||||||
{ value: '企鹅', label: '企鹅' },
|
|
||||||
{ value: '孔雀', label: '孔雀' },
|
|
||||||
{ value: '鹰', label: '鹰' },
|
|
||||||
{ value: '猫头鹰', label: '猫头鹰' },
|
|
||||||
{ value: '火烈鸟', label: '火烈鸟' },
|
|
||||||
{ value: '鹈鹕', label: '鹈鹕' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: '爬行动物',
|
|
||||||
label: '爬行动物',
|
|
||||||
children: [
|
|
||||||
{ value: '龟', label: '龟' },
|
|
||||||
{ value: '蜥蜴', label: '蜥蜴' },
|
|
||||||
{ value: '蛇', label: '蛇' },
|
|
||||||
{ value: '鳄鱼', label: '鳄鱼' },
|
|
||||||
{ value: '变色龙', label: '变色龙' },
|
|
||||||
{ value: '科莫多龙', label: '科莫多龙' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: '两栖动物',
|
|
||||||
label: '两栖动物',
|
|
||||||
children: [
|
|
||||||
{ value: '青蛙', label: '青蛙' },
|
|
||||||
{ value: '蟾蜍', label: '蟾蜍' },
|
|
||||||
{ value: '蝾螈', label: '蝾螈' },
|
|
||||||
{ value: '牛蛙', label: '牛蛙' },
|
|
||||||
{ value: '树蛙', label: '树蛙' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: '鱼类',
|
|
||||||
label: '鱼类',
|
|
||||||
children: [
|
|
||||||
{ value: '鲨鱼', label: '鲨鱼' },
|
|
||||||
{ value: '鳗鱼', label: '鳗鱼' },
|
|
||||||
{ value: '热带鱼', label: '热带鱼' },
|
|
||||||
{ value: '鲸鱼', label: '鲸鱼' },
|
|
||||||
{ value: '海豚', label: '海豚' },
|
|
||||||
{ value: '海马', label: '海马' },
|
|
||||||
{ value: '魔鬼鱼', label: '魔鬼鱼' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: '昆虫',
|
|
||||||
label: '昆虫',
|
|
||||||
children: [
|
|
||||||
{ value: '蝴蝶', label: '蝴蝶' },
|
|
||||||
{ value: '甲虫', label: '甲虫' },
|
|
||||||
{ value: '蜻蜓', label: '蜻蜓' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: '甲壳类',
|
|
||||||
label: '甲壳类',
|
|
||||||
children: [
|
|
||||||
{ value: '螃蟹', label: '螃蟹' },
|
|
||||||
{ value: '龙虾', label: '龙虾' },
|
|
||||||
{ value: '虾', label: '虾' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: '软体动物',
|
|
||||||
label: '软体动物',
|
|
||||||
children: [
|
|
||||||
{ value: '章鱼', label: '章鱼' },
|
|
||||||
{ value: '乌贼', label: '乌贼' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
@ -130,9 +33,6 @@ export default {
|
|||||||
default: false
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed:{
|
|
||||||
...mapGetters(["getKeepers"])
|
|
||||||
},
|
|
||||||
mounted() {
|
mounted() {
|
||||||
// 给表单填充传递的数据
|
// 给表单填充传递的数据
|
||||||
if (this.data) {
|
if (this.data) {
|
||||||
@ -148,7 +48,7 @@ export default {
|
|||||||
<template>
|
<template>
|
||||||
<el-form label-width="auto">
|
<el-form label-width="auto">
|
||||||
<el-form-item label="动物ID">
|
<el-form-item label="动物ID">
|
||||||
<el-input v-model.number="form.id" placeholder="系统自动生成ID" type="number" :disabled="edit || detail || true"/>
|
<el-input v-model.number="form.id" placeholder="请设置动物ID" type="number" :disabled="edit || detail"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="动物名称">
|
<el-form-item label="动物名称">
|
||||||
<el-input v-model="form.name" placeholder="动物名称" :disabled="detail"/>
|
<el-input v-model="form.name" placeholder="动物名称" :disabled="detail"/>
|
||||||
@ -160,25 +60,7 @@ export default {
|
|||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="动物种类">
|
<el-form-item label="动物种类">
|
||||||
|
<el-input v-model="form.species" placeholder="动物种类" :disabled="detail"/>
|
||||||
<el-col :span="16" v-if="selectSpecies">
|
|
||||||
<el-tree-select
|
|
||||||
v-model="form.species"
|
|
||||||
:data="speciesData"
|
|
||||||
:render-after-expand="false"
|
|
||||||
clearable :disabled="detail"
|
|
||||||
/>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="16" v-else>
|
|
||||||
<el-input v-model="form.species" placeholder="动物种类" :disabled="detail"/>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1">
|
|
||||||
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="6" justify="end">
|
|
||||||
<el-button @click="selectSpecies = !selectSpecies" :disabled="detail">自定义种类</el-button>
|
|
||||||
</el-col>
|
|
||||||
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="体重(KG)">
|
<el-form-item label="体重(KG)">
|
||||||
<el-input-number v-model.number="form.weight" :precision="2" :step="0.1" :min="0" :disabled="detail"/>
|
<el-input-number v-model.number="form.weight" :precision="2" :step="0.1" :min="0" :disabled="detail"/>
|
||||||
@ -193,26 +75,7 @@ export default {
|
|||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="饲养员ID">
|
<el-form-item label="饲养员ID">
|
||||||
<!-- <el-input v-model="form.roleId" type="number" placeholder="饲养员ID" :disabled="detail"/>-->
|
<el-input v-model="form.roleId" type="number" placeholder="饲养员ID" :disabled="detail"/>
|
||||||
<el-select v-model="form.roleId" placeholder="饲养员" clearable :disabled="detail">
|
|
||||||
<el-option
|
|
||||||
v-for="item in getKeepers"
|
|
||||||
:key="item.id"
|
|
||||||
|
|
||||||
:value="item.id"
|
|
||||||
>
|
|
||||||
<span style="float: left">{{ item.username }}</span>
|
|
||||||
<span
|
|
||||||
style="
|
|
||||||
float: right;
|
|
||||||
color: var(--el-text-color-secondary);
|
|
||||||
font-size: 13px;
|
|
||||||
"
|
|
||||||
>
|
|
||||||
用户ID :{{ item.id }}
|
|
||||||
</span>
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="动物颜色">
|
<el-form-item label="动物颜色">
|
||||||
<el-color-picker v-model="form.color" :disabled="detail"/>
|
<el-color-picker v-model="form.color" :disabled="detail"/>
|
||||||
@ -222,10 +85,10 @@ export default {
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="生命阶段">
|
<el-form-item label="生命阶段">
|
||||||
<el-select v-model="form.phase" placeholder="生命阶段" :disabled="detail">
|
<el-select v-model="form.phase" placeholder="生命阶段" :disabled="detail">
|
||||||
<el-option label="幼年期" value="幼年期"/>
|
<el-option label="幼年期" :value="0"/>
|
||||||
<el-option label="成长期" value="成长期"/>
|
<el-option label="成长期" :value="1"/>
|
||||||
<el-option label="成年期" value="成年期"/>
|
<el-option label="成年期" :value="2"/>
|
||||||
<el-option label="老年期" value="老年期"/>
|
<el-option label="老年期" :value="3"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
import {copy} from "@/utils/common.js";
|
import {copy} from "@/utils/common.js";
|
||||||
import {mapState, mapGetters} from "vuex";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ZooArchiveFormDialog",
|
name: "ZooArchiveFormDialog",
|
||||||
@ -17,7 +16,6 @@ export default {
|
|||||||
time: '',//字符,档案记录时间
|
time: '',//字符,档案记录时间
|
||||||
roleId: null,//负责录入档案的人的id,身份不限
|
roleId: null,//负责录入档案的人的id,身份不限
|
||||||
description: '',//字符 档案的描述
|
description: '',//字符 档案的描述
|
||||||
breedingId: null
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -34,27 +32,10 @@ export default {
|
|||||||
default: false
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
|
||||||
'form.animalId': {
|
|
||||||
handler(newValue) {
|
|
||||||
// console.log(newValue)
|
|
||||||
this.form.animalName = this.animals.find(e => e.id === this.form.animalId).name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
...mapState(['loginUser', 'animals','breedingPlans']),
|
|
||||||
...mapGetters(['getKeepersAndVeterinary'])
|
|
||||||
},
|
|
||||||
mounted() {
|
mounted() {
|
||||||
// 给表单填充传递的数据
|
// 给表单填充传递的数据
|
||||||
if (this.data) {
|
if (this.data) {
|
||||||
this.form = copy(this.data)
|
this.form = copy(this.data)
|
||||||
} else {
|
|
||||||
const newDate = new Date();
|
|
||||||
this.form.date = newDate.getFullYear() + '-' + (newDate.getMonth() + 1).toString().padStart(2, '0') + '-' + newDate.getDate().toString().padStart(2, '0')
|
|
||||||
this.form.time = newDate.getHours().toString().padStart(2, '0') + ':' + newDate.getMinutes().toString().padStart(2, '0') + ':' + newDate.getSeconds().toString().padStart(2, '0')
|
|
||||||
this.form.roleId = this.loginUser.id
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeUnmount() {
|
beforeUnmount() {
|
||||||
@ -66,39 +47,20 @@ export default {
|
|||||||
<template>
|
<template>
|
||||||
<el-form label-width="auto">
|
<el-form label-width="auto">
|
||||||
<el-form-item label="记录号">
|
<el-form-item label="记录号">
|
||||||
<el-input v-model.number="form.id" type="number" placeholder="系统自动生成记录号"
|
<el-input v-model.number="form.id" type="number" placeholder="记录号" :disabled="edit || detail"/>
|
||||||
:disabled="edit || detail || true"/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="动物ID">
|
<el-form-item label="动物ID">
|
||||||
<!-- <el-input v-model.number="form.animalId" type="number" placeholder="动物ID" :disabled="detail"/>-->
|
<el-input v-model.number="form.animalId" type="number" placeholder="动物ID" :disabled="detail"/>
|
||||||
<el-select v-model="form.animalId" placeholder="动物ID" clearable :disabled="detail">
|
|
||||||
<el-option
|
|
||||||
v-for="item in animals"
|
|
||||||
:key="item.id"
|
|
||||||
:value="item.id"
|
|
||||||
>
|
|
||||||
<span style="float: left">{{ item.name }}</span>
|
|
||||||
<span
|
|
||||||
style="
|
|
||||||
float: right;
|
|
||||||
color: var(--el-text-color-secondary);
|
|
||||||
font-size: 13px;
|
|
||||||
"
|
|
||||||
>
|
|
||||||
动物ID :{{ item.id }}
|
|
||||||
</span>
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="动物名称">
|
<el-form-item label="动物名称">
|
||||||
<el-input v-model="form.animalName" placeholder="动物名称" :disabled="detail"/>
|
<el-input v-model="form.animalName" placeholder="动物名称" :disabled="detail"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="生命阶段">
|
<el-form-item label="生命阶段">
|
||||||
<el-select v-model="form.phase" placeholder="生命阶段" :disabled="detail">
|
<el-select v-model="form.phase" placeholder="生命阶段" :disabled="detail">
|
||||||
<el-option label="幼年期" value="幼年期"/>
|
<el-option label="幼年期" :value="0"/>
|
||||||
<el-option label="成长期" value="成长期"/>
|
<el-option label="成长期" :value="1"/>
|
||||||
<el-option label="成年期" value="成年期"/>
|
<el-option label="成年期" :value="2"/>
|
||||||
<el-option label="老年期" value="老年期"/>
|
<el-option label="老年期" :value="3"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="动物状态">
|
<el-form-item label="动物状态">
|
||||||
@ -115,68 +77,20 @@ export default {
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="记录日期">
|
<el-form-item label="记录日期">
|
||||||
<el-col :span="11">
|
<el-date-picker
|
||||||
<el-date-picker
|
v-model="form.date"
|
||||||
v-model="form.date"
|
type="date"
|
||||||
type="date"
|
placeholder="选择日期"
|
||||||
placeholder="选择日期"
|
value-format="YYYY-MM-DD"
|
||||||
value-format="YYYY-MM-DD"
|
:disabled="detail"
|
||||||
:disabled="detail"
|
/>
|
||||||
style="width: 100%"
|
|
||||||
/>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="2">
|
|
||||||
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="11">
|
|
||||||
<el-time-picker v-model="form.time" type="time" placeholder="选择时间" value-format="HH:mm:ss"
|
|
||||||
:disabled="detail" style="width: 100%"/>
|
|
||||||
</el-col>
|
|
||||||
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- <el-form-item label="记录时间">-->
|
<el-form-item label="记录时间">
|
||||||
<!-- -->
|
<el-time-picker v-model="form.time" type="time" placeholder="选择时间" value-format="HH:mm:ss"
|
||||||
<!-- </el-form-item>-->
|
:disabled="detail"/>
|
||||||
<el-form-item label="关联计划">
|
|
||||||
<el-select v-model="form.breedingId" placeholder="选择关联计划" clearable :disabled="detail">
|
|
||||||
<el-option
|
|
||||||
v-for="item in breedingPlans"
|
|
||||||
:key="item.id"
|
|
||||||
:value="item.id"
|
|
||||||
>
|
|
||||||
<span style="float: left">{{ item.name }}</span>
|
|
||||||
<span
|
|
||||||
style="
|
|
||||||
float: right;
|
|
||||||
color: var(--el-text-color-secondary);
|
|
||||||
font-size: 13px;
|
|
||||||
"
|
|
||||||
>
|
|
||||||
计划ID :{{ item.id }}
|
|
||||||
</span>
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="记录人ID">
|
<el-form-item label="记录人ID">
|
||||||
<!-- <el-input v-model.number="form.roleId" type="number" placeholder="记录人ID" :disabled="detail"/>-->
|
<el-input v-model.number="form.roleId" type="number" placeholder="记录人ID" :disabled="detail"/>
|
||||||
<el-select v-model="form.roleId" placeholder="记录人ID" clearable :disabled="detail">
|
|
||||||
<el-option
|
|
||||||
v-for="item in getKeepersAndVeterinary"
|
|
||||||
:key="item.id"
|
|
||||||
:value="item.id"
|
|
||||||
>
|
|
||||||
<span style="float: left">{{ item.username }} ({{ item.auth === 1 ? '饲养员' : '兽医' }})</span>
|
|
||||||
<span
|
|
||||||
style="
|
|
||||||
float: right;
|
|
||||||
color: var(--el-text-color-secondary);
|
|
||||||
font-size: 13px;
|
|
||||||
"
|
|
||||||
>
|
|
||||||
用户ID :{{ item.id }}
|
|
||||||
</span>
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="记录描述">
|
<el-form-item label="记录描述">
|
||||||
<el-input
|
<el-input
|
||||||
|
@ -9,11 +9,6 @@ export default {
|
|||||||
order:0
|
order:0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch:{
|
|
||||||
order(){
|
|
||||||
this.timeSort()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
props: {
|
props: {
|
||||||
data: {
|
data: {
|
||||||
type: Object,
|
type: Object,
|
||||||
@ -21,24 +16,20 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
//按时间排序
|
sort(){
|
||||||
timeSort() {
|
//降序
|
||||||
//0降序
|
if (this.order===0){
|
||||||
if (this.order === 0) {
|
this.order++
|
||||||
this.archives = sortByDateTime(copy(this.archives))
|
sortByDateTime(this.archives)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//1升序
|
//升序
|
||||||
if (this.order === 1) {
|
if (this.order===1){
|
||||||
this.archives = sortByDateTime(copy(this.archives)).reverse()
|
this.order--
|
||||||
return;
|
sortByDateTime(this.archives)
|
||||||
|
this.archives.reverse()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
changeOrder(){
|
|
||||||
if (this.order===0)
|
|
||||||
this.order++
|
|
||||||
else this.order--
|
|
||||||
},
|
|
||||||
nodeType(type) {
|
nodeType(type) {
|
||||||
if (type === '日常饲养') {
|
if (type === '日常饲养') {
|
||||||
return 'success'
|
return 'success'
|
||||||
@ -59,19 +50,13 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
// 给填充传递的数据
|
// 给表单填充传递的数据
|
||||||
if (this.data) {
|
if (this.data) {
|
||||||
this.archives = copy(this.data)
|
this.archives = copy(this.data)
|
||||||
//默认按照时间降序
|
//默认按照时间降序
|
||||||
this.timeSort()
|
this.sort()
|
||||||
}
|
|
||||||
},
|
|
||||||
updated() {
|
|
||||||
if (this.data) {
|
|
||||||
this.archives = copy(this.data)
|
|
||||||
//默认按照时间降序
|
|
||||||
this.timeSort()
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeUnmount() {
|
beforeUnmount() {
|
||||||
@ -82,7 +67,7 @@ export default {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="relative" style="height: 40px">
|
<div class="relative" style="height: 40px">
|
||||||
<el-button type="primary" class="right" @click="changeOrder()">按时间升 / 降序</el-button>
|
<el-button type="primary" class="right" @click="sort()">按时间升 / 降序</el-button>
|
||||||
</div>
|
</div>
|
||||||
<el-scrollbar height="500px">
|
<el-scrollbar height="500px">
|
||||||
<el-timeline style="max-width: 600px">
|
<el-timeline style="max-width: 600px">
|
||||||
@ -132,10 +117,7 @@ export default {
|
|||||||
{{ a.description }}
|
{{ a.description }}
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
</el-descriptions>
|
</el-descriptions>
|
||||||
<div class="left">
|
<div class="left">记录号:{{ a.id }}</div>
|
||||||
记录号:{{ a.id }} |
|
|
||||||
关联计划:{{ a.breedingId }}
|
|
||||||
</div>
|
|
||||||
<div class="right">{{ a.roleId }} 记录于 {{ a.date }} {{ a.time }}</div>
|
<div class="right">{{ a.roleId }} 记录于 {{ a.date }} {{ a.time }}</div>
|
||||||
</el-timeline-item>
|
</el-timeline-item>
|
||||||
</el-timeline>
|
</el-timeline>
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
<script>
|
<script>
|
||||||
import {mapState} from "vuex";
|
import {mapState} from "vuex";
|
||||||
import {Menu, User} from "@element-plus/icons-vue";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ZooAside",
|
name: "ZooAside",
|
||||||
components: {User, Menu},
|
|
||||||
data() {
|
data() {
|
||||||
return {}
|
return {}
|
||||||
},
|
},
|
||||||
@ -18,9 +16,7 @@ export default {
|
|||||||
this.$router.push(path)
|
this.$router.push(path)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
watch: {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -46,14 +42,30 @@ export default {
|
|||||||
<el-sub-menu index="1">
|
<el-sub-menu index="1">
|
||||||
<template #title="scope">
|
<template #title="scope">
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<Menu/>
|
<location/>
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<span>用户功能</span>
|
<span>管理员</span>
|
||||||
</template>
|
</template>
|
||||||
<el-menu-item index="/panel/home" @click="toPath('/panel/home')">首页</el-menu-item>
|
<el-menu-item index="/panel/home" @click="toPath('/panel/home')">首页</el-menu-item>
|
||||||
<el-menu-item index="/panel/user" @click="toPath('/panel/user')" v-if="loginUser.auth===0">用户管理</el-menu-item>
|
<el-menu-item index="/panel/user" @click="toPath('/panel/user')">用户管理</el-menu-item>
|
||||||
<el-menu-item index="/panel/animal" @click="toPath('/panel/animal')">动物基本数据</el-menu-item>
|
<el-menu-item index="/panel/animal" @click="toPath('/panel/animal')">动物基本数据</el-menu-item>
|
||||||
|
</el-sub-menu>
|
||||||
|
<el-sub-menu index="2">
|
||||||
|
<template #title>
|
||||||
|
<el-icon>
|
||||||
|
<location/>
|
||||||
|
</el-icon>
|
||||||
|
<span>饲养员</span>
|
||||||
|
</template>
|
||||||
<el-menu-item index="/panel/breeding" @click="toPath('/panel/breeding')">饲养计划</el-menu-item>
|
<el-menu-item index="/panel/breeding" @click="toPath('/panel/breeding')">饲养计划</el-menu-item>
|
||||||
|
</el-sub-menu>
|
||||||
|
<el-sub-menu index="3">
|
||||||
|
<template #title>
|
||||||
|
<el-icon>
|
||||||
|
<location/>
|
||||||
|
</el-icon>
|
||||||
|
<span>兽医</span>
|
||||||
|
</template>
|
||||||
<el-menu-item index="/panel/archive" @click="toPath('/panel/archive')">动物档案</el-menu-item>
|
<el-menu-item index="/panel/archive" @click="toPath('/panel/archive')">动物档案</el-menu-item>
|
||||||
<el-menu-item index="/panel/health" @click="toPath('/panel/health')">健康检测</el-menu-item>
|
<el-menu-item index="/panel/health" @click="toPath('/panel/health')">健康检测</el-menu-item>
|
||||||
</el-sub-menu>
|
</el-sub-menu>
|
||||||
@ -63,9 +75,6 @@ export default {
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
#aside{
|
|
||||||
background-color: white;
|
|
||||||
}
|
|
||||||
.aside-icon {
|
.aside-icon {
|
||||||
width: 200px;
|
width: 200px;
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
<script>
|
<script>
|
||||||
import {copy} from "@/utils/common.js";
|
import {copy} from "@/utils/common.js";
|
||||||
import {mapGetters} from "vuex";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ZooBreedingFormDialog",
|
name: "ZooBreedingFormDialog",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
form: {
|
form: {
|
||||||
id: null,//int 饲养计划id
|
id: '',//int 饲养计划id
|
||||||
name: '',//字符 饲养计划名称
|
name: '',//字符 饲养计划名称
|
||||||
species: '',//字符 种类
|
species: '',//字符 种类
|
||||||
sex: '雄性',//字符 饲养动物性别
|
sex: '雄性',//字符 饲养动物性别
|
||||||
@ -31,9 +30,6 @@ export default {
|
|||||||
default: false
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed:{
|
|
||||||
...mapGetters(['getAllSpecies','getKeepers'])
|
|
||||||
},
|
|
||||||
mounted() {
|
mounted() {
|
||||||
// 给表单填充传递的数据
|
// 给表单填充传递的数据
|
||||||
if (this.data) {
|
if (this.data) {
|
||||||
@ -49,21 +45,13 @@ export default {
|
|||||||
<template>
|
<template>
|
||||||
<el-form label-width="auto">
|
<el-form label-width="auto">
|
||||||
<el-form-item label="计划ID">
|
<el-form-item label="计划ID">
|
||||||
<el-input v-model.number="form.id" type="number" placeholder="系统自动生成ID" :disabled="edit || detail || true"/>
|
<el-input v-model.number="form.id" type="number" placeholder="饲养计划ID" :disabled="edit || detail"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="计划名称">
|
<el-form-item label="计划名称">
|
||||||
<el-input v-model="form.name" placeholder="计划名称" :disabled="detail"/>
|
<el-input v-model="form.name" placeholder="计划名称" :disabled="detail"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="动物种类">
|
<el-form-item label="动物种类">
|
||||||
<!-- <el-input v-model="form.species" placeholder="动物种类" :disabled="detail"/>-->
|
<el-input v-model="form.species" placeholder="动物种类" :disabled="detail"/>
|
||||||
<el-select v-model="form.species" placeholder="动物种类" clearable :disabled="detail">
|
|
||||||
<el-option
|
|
||||||
v-for="(item,index) in getAllSpecies"
|
|
||||||
:key="index"
|
|
||||||
:value="item"
|
|
||||||
>
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="性别">
|
<el-form-item label="性别">
|
||||||
<el-radio-group v-model="form.sex" :disabled="detail">
|
<el-radio-group v-model="form.sex" :disabled="detail">
|
||||||
@ -73,10 +61,10 @@ export default {
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="生命阶段">
|
<el-form-item label="生命阶段">
|
||||||
<el-select v-model="form.phase" :disabled="detail">
|
<el-select v-model="form.phase" :disabled="detail">
|
||||||
<el-option label="幼年期" value="幼年期"/>
|
<el-option label="幼年期" :value="0"/>
|
||||||
<el-option label="成长期" value="成长期"/>
|
<el-option label="成长期" :value="1"/>
|
||||||
<el-option label="成年期" value="成年期"/>
|
<el-option label="成年期" :value="2"/>
|
||||||
<el-option label="老年期" value="老年期"/>
|
<el-option label="老年期" :value="3"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="动物状态">
|
<el-form-item label="动物状态">
|
||||||
@ -86,25 +74,7 @@ export default {
|
|||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="执行饲养员">
|
<el-form-item label="执行饲养员">
|
||||||
<!-- <el-input v-model.number="form.roleId" type="number" placeholder="执行饲养员" :disabled="detail"/>-->
|
<el-input v-model.number="form.roleId" type="number" placeholder="执行饲养员" :disabled="detail"/>
|
||||||
<el-select v-model="form.roleId" placeholder="执行饲养员" clearable :disabled="detail">
|
|
||||||
<el-option
|
|
||||||
v-for="item in getKeepers"
|
|
||||||
:key="item.id"
|
|
||||||
:value="item.id"
|
|
||||||
>
|
|
||||||
<span style="float: left">{{ item.username }}</span>
|
|
||||||
<span
|
|
||||||
style="
|
|
||||||
float: right;
|
|
||||||
color: var(--el-text-color-secondary);
|
|
||||||
font-size: 13px;
|
|
||||||
"
|
|
||||||
>
|
|
||||||
用户ID :{{ item.id }}
|
|
||||||
</span>
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="计划描述" >
|
<el-form-item label="计划描述" >
|
||||||
<el-input
|
<el-input
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
import {copy} from "@/utils/common.js";
|
import {copy} from "@/utils/common.js";
|
||||||
import {mapState} from "vuex";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ZooHealthFormDialog",
|
name: "ZooHealthFormDialog",
|
||||||
@ -34,25 +33,10 @@ export default {
|
|||||||
default: false
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed:{
|
|
||||||
...mapState(['animals'])
|
|
||||||
},
|
|
||||||
watch:{
|
|
||||||
'form.animalId':{
|
|
||||||
handler(newValue){
|
|
||||||
// console.log(newValue)
|
|
||||||
this.form.animalName = this.animals.find(e=>e.id===this.form.animalId).name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
mounted() {
|
||||||
// 给表单填充传递的数据
|
// 给表单填充传递的数据
|
||||||
if (this.data) {
|
if (this.data) {
|
||||||
this.form = copy(this.data)
|
this.form = copy(this.data)
|
||||||
}else {
|
|
||||||
const newDate = new Date();
|
|
||||||
this.form.date = newDate.getFullYear() + '-' + (newDate.getMonth()+1).toString().padStart(2, '0') + '-' + newDate.getDate().toString().padStart(2, '0')
|
|
||||||
this.form.time = newDate.getHours().toString().padStart(2, '0') + ':' + newDate.getMinutes().toString().padStart(2, '0') + ':' + newDate.getSeconds().toString().padStart(2, '0')
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeUnmount() {
|
beforeUnmount() {
|
||||||
@ -64,28 +48,10 @@ export default {
|
|||||||
<template>
|
<template>
|
||||||
<el-form label-width="auto">
|
<el-form label-width="auto">
|
||||||
<el-form-item label="监测号">
|
<el-form-item label="监测号">
|
||||||
<el-input v-model.number="form.id" type="number" placeholder="系统自动生成监测号" :disabled="edit || detail || true"/>
|
<el-input v-model.number="form.id" type="number" placeholder="监测号" :disabled="edit || detail"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="动物ID">
|
<el-form-item label="动物ID">
|
||||||
<!-- <el-input v-model.number="form.animalId" type="number" placeholder="动物ID" :disabled="detail"/>-->
|
<el-input v-model.number="form.animalId" type="number" placeholder="动物ID" :disabled="detail"/>
|
||||||
<el-select v-model="form.animalId" placeholder="动物ID" clearable :disabled="detail">
|
|
||||||
<el-option
|
|
||||||
v-for="item in animals"
|
|
||||||
:key="item.id"
|
|
||||||
:value="item.id"
|
|
||||||
>
|
|
||||||
<span style="float: left">{{ item.name }}</span>
|
|
||||||
<span
|
|
||||||
style="
|
|
||||||
float: right;
|
|
||||||
color: var(--el-text-color-secondary);
|
|
||||||
font-size: 13px;
|
|
||||||
"
|
|
||||||
>
|
|
||||||
动物ID :{{ item.id }}
|
|
||||||
</span>
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="动物名称">
|
<el-form-item label="动物名称">
|
||||||
<el-input v-model="form.animalName" placeholder="动物名称" :disabled="detail"/>
|
<el-input v-model="form.animalName" placeholder="动物名称" :disabled="detail"/>
|
||||||
@ -113,35 +79,18 @@ export default {
|
|||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="记录日期">
|
<el-form-item label="记录日期">
|
||||||
<!-- <el-date-picker-->
|
<el-date-picker
|
||||||
<!-- v-model="form.date"-->
|
v-model="form.date"
|
||||||
<!-- type="date"-->
|
type="date"
|
||||||
<!-- placeholder="选择日期"-->
|
placeholder="选择日期"
|
||||||
<!-- value-format="YYYY-MM-DD"-->
|
value-format="YYYY-MM-DD"
|
||||||
<!-- :disabled="detail"-->
|
:disabled="detail"
|
||||||
<!-- />-->
|
/>
|
||||||
<el-col :span="11">
|
</el-form-item>
|
||||||
<el-date-picker
|
<el-form-item label="记录时间">
|
||||||
v-model="form.date"
|
<el-time-picker v-model="form.time" type="time" placeholder="选择时间" value-format="HH:mm:ss"
|
||||||
type="date"
|
:disabled="detail"/>
|
||||||
placeholder="选择日期"
|
|
||||||
value-format="YYYY-MM-DD"
|
|
||||||
:disabled="detail"
|
|
||||||
style="width: 100%"
|
|
||||||
/>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="2">
|
|
||||||
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="11">
|
|
||||||
<el-time-picker v-model="form.time" type="time" placeholder="选择时间" value-format="HH:mm:ss"
|
|
||||||
:disabled="detail" style="width: 100%"/>
|
|
||||||
</el-col>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- <el-form-item label="记录时间">-->
|
|
||||||
<!-- <el-time-picker v-model="form.time" type="time" placeholder="选择时间" value-format="HH:mm:ss"-->
|
|
||||||
<!-- :disabled="detail"/>-->
|
|
||||||
<!-- </el-form-item>-->
|
|
||||||
<el-form-item label="记录描述">
|
<el-form-item label="记录描述">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="form.description"
|
v-model="form.description"
|
||||||
|
@ -9,11 +9,6 @@ export default {
|
|||||||
order: 0
|
order: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch:{
|
|
||||||
order(){
|
|
||||||
this.timeSort()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
props: {
|
props: {
|
||||||
data: {
|
data: {
|
||||||
type: Object,
|
type: Object,
|
||||||
@ -21,24 +16,20 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
//按时间排序
|
sort() {
|
||||||
timeSort() {
|
//降序
|
||||||
//0降序
|
|
||||||
if (this.order === 0) {
|
if (this.order === 0) {
|
||||||
this.healths = sortByDateTime(copy(this.healths))
|
this.order++
|
||||||
|
sortByDateTime(this.healths)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//1升序
|
//升序
|
||||||
if (this.order === 1) {
|
if (this.order === 1) {
|
||||||
this.healths = sortByDateTime(copy(this.healths)).reverse()
|
this.order--
|
||||||
return;
|
sortByDateTime(this.healths)
|
||||||
|
this.healths.reverse()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
changeOrder(){
|
|
||||||
if (this.order===0)
|
|
||||||
this.order++
|
|
||||||
else this.order--
|
|
||||||
},
|
|
||||||
nodeType(type) {
|
nodeType(type) {
|
||||||
if (type === 0) {
|
if (type === 0) {
|
||||||
return 'success'
|
return 'success'
|
||||||
@ -54,15 +45,7 @@ export default {
|
|||||||
if (this.data) {
|
if (this.data) {
|
||||||
this.healths = copy(this.data)
|
this.healths = copy(this.data)
|
||||||
//默认按照时间降序
|
//默认按照时间降序
|
||||||
this.timeSort()
|
this.sort()
|
||||||
}
|
|
||||||
},
|
|
||||||
updated() {
|
|
||||||
// 给表单填充传递的数据
|
|
||||||
if (this.data) {
|
|
||||||
this.healths = copy(this.data)
|
|
||||||
//默认按照时间降序
|
|
||||||
this.timeSort()
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeUnmount() {
|
beforeUnmount() {
|
||||||
@ -73,7 +56,7 @@ export default {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="relative" style="height: 40px">
|
<div class="relative" style="height: 40px">
|
||||||
<el-button type="primary" class="right" @click="changeOrder()">按时间升 / 降序</el-button>
|
<el-button type="primary" class="right" @click="sort()">按时间升 / 降序</el-button>
|
||||||
</div>
|
</div>
|
||||||
<el-scrollbar height="500px">
|
<el-scrollbar height="500px">
|
||||||
<el-timeline style="max-width: 600px">
|
<el-timeline style="max-width: 600px">
|
||||||
|
@ -22,7 +22,7 @@ export default {
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
edit: {
|
edit:{
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
}
|
}
|
||||||
@ -42,8 +42,8 @@ export default {
|
|||||||
<template>
|
<template>
|
||||||
<el-form label-width="auto">
|
<el-form label-width="auto">
|
||||||
<el-form-item label="用户ID">
|
<el-form-item label="用户ID">
|
||||||
<el-input v-model.number="form.id" placeholder="系统自动生成ID" type="number"
|
<el-input v-model.number="form.id" placeholder="请设置用户ID" type="number"
|
||||||
:disabled="edit || detail|| true"/>
|
:disabled="edit || detail"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="用户名">
|
<el-form-item label="用户名">
|
||||||
<el-input v-model="form.username" placeholder="请设置用户名" :disabled="detail"/>
|
<el-input v-model="form.username" placeholder="请设置用户名" :disabled="detail"/>
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
<script>
|
<script>
|
||||||
import {copy, fuzzyMatching, refreshData, splitKeyWords} from "@/utils/common.js";
|
import {copy, fuzzyMatching, splitKeyWords} from "@/utils/common.js";
|
||||||
import {Delete, Document, DocumentAdd, Edit, Search, Tickets} from "@element-plus/icons-vue";
|
import {Delete, Document, DocumentAdd, Edit, Search, Tickets} from "@element-plus/icons-vue";
|
||||||
import ZooAnimalFormDialog from "@/components/ZooAnimalFormDialog.vue";
|
import ZooAnimalFormDialog from "@/components/ZooAnimalFormDialog.vue";
|
||||||
import {mapMutations, mapState} from "vuex";
|
import {mapActions, mapMutations, mapState} from "vuex";
|
||||||
import ZooArchiveTimeline from "@/components/ZooArchiveTimeline.vue";
|
import ZooArchiveTimeline from "@/components/ZooArchiveTimeline.vue";
|
||||||
import request, {frontendAnimal, frontendAnimals, frontendArchives} from "@/utils/request.js";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ZooAnimal",
|
name: "ZooAnimal",
|
||||||
@ -55,10 +54,7 @@ export default {
|
|||||||
return Tickets
|
return Tickets
|
||||||
},
|
},
|
||||||
//endregion
|
//endregion
|
||||||
...mapState(["animals", 'archives', 'animalsTableData','loginUser']),
|
...mapState(["animals", 'archives', 'animalsTableData'])
|
||||||
operateWidth() {
|
|
||||||
return this.loginUser.auth===1?'250':'130'
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
// 搜索框存在输入,自动调用搜索(刷新数据包含搜索)
|
// 搜索框存在输入,自动调用搜索(刷新数据包含搜索)
|
||||||
@ -70,26 +66,19 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapMutations(['updateAnimals','updateAnimalsTableData']),
|
...mapActions(["getAnimals"]),
|
||||||
|
...mapMutations(['updateAnimalsTableData']),
|
||||||
|
|
||||||
// 显示详情弹窗
|
// 显示详情弹窗
|
||||||
showDetail(data) {
|
showDetail(data) {
|
||||||
console.log('显示详情', data)
|
console.log('显示详情', data)
|
||||||
|
|
||||||
//从后端获取需要查询的数据,防止数据前后不一致
|
//从后端获取需要查询的数据,防止数据前后不一致
|
||||||
request.queryAnimalRequest(data.id).then(response => {
|
//这里先用假数据代替一下
|
||||||
if (response.data.data===null){
|
this.dialog.dialogData = this.animals.find(e => e.id === data.id)
|
||||||
this.refresh();
|
|
||||||
return ElMessage({
|
//显示弹窗
|
||||||
message: '该动物不存在,请刷新',
|
this.dialog.detailDialogVisible = true
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.dialog.dialogData = frontendAnimal(response.data.data)
|
|
||||||
//显示弹窗
|
|
||||||
this.dialog.detailDialogVisible = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
//显示编辑弹窗
|
//显示编辑弹窗
|
||||||
@ -97,61 +86,45 @@ export default {
|
|||||||
console.log('显示编辑', data)
|
console.log('显示编辑', data)
|
||||||
|
|
||||||
//从后端获取需要查询的数据,防止数据前后不一致
|
//从后端获取需要查询的数据,防止数据前后不一致
|
||||||
request.queryAnimalRequest(data.id).then(response => {
|
//这里先用假数据代替一下
|
||||||
if (response.data.data===null){
|
this.dialog.dialogData = this.animals.find(e => e.id === data.id)
|
||||||
this.refresh();
|
|
||||||
return ElMessage({
|
//显示弹窗
|
||||||
message: '该动物不存在,请刷新',
|
this.dialog.editDialogVisible = true
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.dialog.dialogData = frontendAnimal(response.data.data)
|
|
||||||
//显示弹窗
|
|
||||||
this.dialog.editDialogVisible = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
edit(data) {
|
edit(data) {
|
||||||
console.log('编辑', data)
|
console.log('编辑', data)
|
||||||
|
|
||||||
//验证是否为空
|
//判断表单是否为空
|
||||||
if (this.isEmpty(data)) {
|
return this.isEmpty(data);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//这里将数据传给后端进行数据更新
|
//这里将数据传给后端进行数据更新
|
||||||
//从后端获取需要查询的数据,防止数据前后不一致
|
//编辑失败
|
||||||
request.queryAnimalRequest(data.id).then(response => {
|
if (false) {
|
||||||
if (response.data.data===null){
|
return ElMessage({
|
||||||
this.refresh();
|
message: '编辑失败',
|
||||||
this.dialog.editDialogVisible = false;
|
type: 'warning',
|
||||||
return ElMessage({
|
})
|
||||||
message: '该动物不存在,请刷新',
|
}
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
request.updateAnimalRequest(data).then(response => {
|
|
||||||
if (response.data.code===1){
|
|
||||||
// 编辑成功
|
|
||||||
// 刷新数据
|
|
||||||
this.refresh()
|
|
||||||
|
|
||||||
this.dialog.editDialogVisible = false//关闭窗口
|
//编辑成功
|
||||||
|
if (false) {
|
||||||
|
return ElMessage({
|
||||||
|
message: '编辑成功',
|
||||||
|
type: 'success',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return ElMessage({
|
// //从后端重新拉取数据
|
||||||
message: '编辑成功',
|
// this.getAnimals()
|
||||||
type: 'success',
|
// this.search()
|
||||||
})
|
|
||||||
}else {
|
// 刷新数据
|
||||||
return ElMessage({
|
this.refresh()
|
||||||
message: '编辑失败',
|
|
||||||
type: 'warning',
|
//关闭窗口
|
||||||
})
|
this.dialog.editDialogVisible = false
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
delete_(data) {
|
delete_(data) {
|
||||||
@ -166,34 +139,19 @@ export default {
|
|||||||
type: 'warning',
|
type: 'warning',
|
||||||
}
|
}
|
||||||
).then(() => {
|
).then(() => {
|
||||||
//从后端获取需要查询的数据,防止数据前后不一致
|
//进行删除操作
|
||||||
request.queryAnimalRequest(data.id).then(response => {
|
|
||||||
if (response.data.data===null){
|
|
||||||
this.refresh();
|
|
||||||
return ElMessage({
|
|
||||||
message: '该动物不存在,请刷新',
|
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
//进行删除操作
|
|
||||||
request.deleteAnimalRequest(data.id).then(response => {
|
|
||||||
if (response.data.code===1){
|
|
||||||
// 刷新数据
|
|
||||||
this.refresh()
|
|
||||||
|
|
||||||
// 返回提示
|
// //从后端重新拉取数据
|
||||||
ElMessage({
|
// this.getAnimals()
|
||||||
type: 'success',
|
// this.search()
|
||||||
message: '删除成功',
|
|
||||||
})
|
// 刷新数据
|
||||||
} else {
|
this.refresh()
|
||||||
ElMessage({
|
|
||||||
type: 'success',
|
// 返回提示
|
||||||
message: '删除失败',
|
ElMessage({
|
||||||
})
|
type: 'success',
|
||||||
}
|
message: '删除成功',
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
@ -207,62 +165,61 @@ export default {
|
|||||||
console.log('添加', data)
|
console.log('添加', data)
|
||||||
|
|
||||||
//验证是否为空
|
//验证是否为空
|
||||||
if (this.isEmpty(data)) {
|
return this.isEmpty(data);
|
||||||
return;
|
|
||||||
|
//先查询用户是否存在
|
||||||
|
|
||||||
|
//添加失败
|
||||||
|
if (false) {
|
||||||
|
return ElMessage({
|
||||||
|
message: '该动物已存在',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
//添加成功
|
||||||
|
if (false) {
|
||||||
|
return ElMessage({
|
||||||
|
message: '添加成功',
|
||||||
|
type: 'success',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// //从后端重新拉取数据
|
||||||
|
// this.getAnimals()
|
||||||
|
// this.search()
|
||||||
|
|
||||||
request.addAnimalRequest(data).then(response => {
|
// 刷新数据
|
||||||
if (response.data.code===1){
|
this.refresh()
|
||||||
// 添加成功
|
|
||||||
// 刷新数据
|
|
||||||
this.refresh()
|
|
||||||
|
|
||||||
this.dialog.addDialogVisible = false//添加成功关闭窗口
|
this.dialog.addDialogVisible = false//添加成功关闭窗口
|
||||||
|
|
||||||
return ElMessage({
|
|
||||||
message: '添加成功',
|
|
||||||
type: 'success',
|
|
||||||
})
|
|
||||||
}else {
|
|
||||||
return ElMessage({
|
|
||||||
message: '添加失败',
|
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
//以时间线的形式查看该动物的所有档案记录
|
//以时间线的形式查看该动物的所有档案记录
|
||||||
showTimeline(data) {
|
showTimeline(data) {
|
||||||
console.log('显示时间线记录', data)
|
console.log('显示时间线记录', data)
|
||||||
|
|
||||||
this.dialog.dialogData = data
|
|
||||||
|
|
||||||
//从后端获取需要查询的数据,防止数据前后不一致
|
//从后端获取需要查询的数据,防止数据前后不一致
|
||||||
request.queryAnimalRequest(data.id).then(response => {
|
//这里先用假数据代替一下
|
||||||
if (response.data.data===null){
|
this.dialog.dialogData = this.animals.find(e => e.id === data.id)
|
||||||
this.refresh();
|
|
||||||
return ElMessage({
|
this.dialog.timelineData = []
|
||||||
message: '该动物不存在,请刷新',
|
//从后端获取需要查询的数据,防止数据前后不一致
|
||||||
type: 'warning',
|
//这里先用假数据代替一下
|
||||||
})
|
this.archives.forEach(e => {
|
||||||
} else {
|
if (e.animalId === data.id) {
|
||||||
request.queryArchiveRequest(null,data.id).then(response => {
|
this.dialog.timelineData.push(copy(e))
|
||||||
if (response.data.code===1){
|
|
||||||
this.dialog.timelineData = frontendArchives(response.data.data)
|
|
||||||
//显示弹窗
|
|
||||||
this.dialog.timelineDialogVisible = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
//显示弹窗
|
||||||
|
this.dialog.timelineDialogVisible = true
|
||||||
},
|
},
|
||||||
|
|
||||||
// 判断表单是否为空
|
// 判断表单是否为空
|
||||||
isEmpty(form) {
|
isEmpty(form) {
|
||||||
if (!form.name) {
|
if (!form.name) {
|
||||||
|
//返回提示
|
||||||
return ElMessage({
|
return ElMessage({
|
||||||
message: '请输入动物名称',
|
message: '动物名不能为空',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -321,22 +278,18 @@ export default {
|
|||||||
console.log('刷新数据')
|
console.log('刷新数据')
|
||||||
|
|
||||||
//先拉取一遍数据
|
//先拉取一遍数据
|
||||||
request.queryAnimalRequest().then(response => {
|
this.getAnimals()
|
||||||
if (response.data.code === 1) {
|
|
||||||
this.updateAnimals(frontendAnimals(response.data.data))
|
|
||||||
}
|
|
||||||
//可能输入了搜索关键字,故执行一次搜索
|
|
||||||
this.search()
|
|
||||||
|
|
||||||
//获取结果的分页
|
//可能输入了搜索关键字,故执行一次搜索
|
||||||
this.getPagesData()
|
this.search()
|
||||||
})
|
|
||||||
|
//获取结果的分页
|
||||||
|
this.getPagesData()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
// 加载完成后拉取数据
|
// 加载完成后拉取数据
|
||||||
this.refresh()
|
this.refresh()
|
||||||
refreshData()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -344,7 +297,7 @@ export default {
|
|||||||
<template>
|
<template>
|
||||||
<div class="animal-root">
|
<div class="animal-root">
|
||||||
<div class="select">
|
<div class="select">
|
||||||
<div class="left" v-if="loginUser.auth===1">
|
<div class="left">
|
||||||
<el-button type="primary" :icon="DocumentAdd" @click="dialog.addDialogVisible = true">添加动物</el-button>
|
<el-button type="primary" :icon="DocumentAdd" @click="dialog.addDialogVisible = true">添加动物</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
@ -393,7 +346,7 @@ export default {
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="features" label="动物特征" width="300"/>
|
<el-table-column prop="features" label="动物特征" width="300"/>
|
||||||
<el-table-column fixed="right" label="操作" :width="operateWidth" >
|
<el-table-column fixed="right" label="操作" width="250">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button link type="success" size="small" :icon="Tickets" @click="showTimeline(scope.row)">
|
<el-button link type="success" size="small" :icon="Tickets" @click="showTimeline(scope.row)">
|
||||||
档案
|
档案
|
||||||
@ -401,10 +354,10 @@ export default {
|
|||||||
<el-button link type="primary" size="small" :icon="Document" @click="showDetail(scope.row)">
|
<el-button link type="primary" size="small" :icon="Document" @click="showDetail(scope.row)">
|
||||||
详情
|
详情
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button link type="primary" size="small" :icon="Edit" @click="showEdit(scope.row)" v-if="loginUser.auth===1">
|
<el-button link type="primary" size="small" :icon="Edit" @click="showEdit(scope.row)">
|
||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button link type="danger" size="small" :icon="Delete" @click="delete_(scope.row)" v-if="loginUser.auth===1">
|
<el-button link type="danger" size="small" :icon="Delete" @click="delete_(scope.row)">
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
@ -422,8 +375,7 @@ export default {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 添加动物对话框-->
|
<!-- 添加动物对话框-->
|
||||||
<el-dialog v-model="dialog.addDialogVisible" title="添加动物" width="500" align-center draggable overflow
|
<el-dialog v-model="dialog.addDialogVisible" title="添加动物" width="500" align-center draggable overflow>
|
||||||
destroy-on-close>
|
|
||||||
<ZooAnimalFormDialog>
|
<ZooAnimalFormDialog>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button @click="dialog.addDialogVisible = false">
|
<el-button @click="dialog.addDialogVisible = false">
|
||||||
@ -464,8 +416,9 @@ export default {
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<!--查看动物所有记录-->
|
<!--查看动物所有记录-->
|
||||||
<el-dialog v-model="dialog.timelineDialogVisible" :title="'生命周期档案:'+dialog.dialogData.id" width="600" align-center
|
<el-dialog v-model="dialog.timelineDialogVisible" :title="'动物档案:'+dialog.dialogData.id" width="600" align-center
|
||||||
draggable overflow destroy-on-close>
|
draggable overflow
|
||||||
|
destroy-on-close>
|
||||||
<ZooArchiveTimeline :data="dialog.timelineData">
|
<ZooArchiveTimeline :data="dialog.timelineData">
|
||||||
<!-- <template #operate="scope">-->
|
<!-- <template #operate="scope">-->
|
||||||
<!-- <el-button type="primary" link @click="showEdit(scope.archive)">编辑</el-button>-->
|
<!-- <el-button type="primary" link @click="showEdit(scope.archive)">编辑</el-button>-->
|
||||||
|
@ -2,9 +2,8 @@
|
|||||||
import ZooArchiveFormDialog from "@/components/ZooArchiveFormDialog.vue";
|
import ZooArchiveFormDialog from "@/components/ZooArchiveFormDialog.vue";
|
||||||
import {Delete, DocumentAdd, Document, Edit, Search, Tickets, Timer} from "@element-plus/icons-vue";
|
import {Delete, DocumentAdd, Document, Edit, Search, Tickets, Timer} from "@element-plus/icons-vue";
|
||||||
import {mapState, mapActions, mapMutations} from "vuex";
|
import {mapState, mapActions, mapMutations} from "vuex";
|
||||||
import {copy, splitKeyWords, fuzzyMatching, sortByDateTime, refreshData} from "@/utils/common.js";
|
import {copy, splitKeyWords, fuzzyMatching, sortByDateTime} from "@/utils/common.js";
|
||||||
import ZooArchiveTimeline from "@/components/ZooArchiveTimeline.vue";
|
import ZooArchiveTimeline from "@/components/ZooArchiveTimeline.vue";
|
||||||
import request, {frontendArchive, frontendArchives} from "@/utils/request.js";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ZooArchive",
|
name: "ZooArchive",
|
||||||
@ -59,10 +58,7 @@ export default {
|
|||||||
return Timer
|
return Timer
|
||||||
},
|
},
|
||||||
//endregion
|
//endregion
|
||||||
...mapState(["archives", 'archivesTableData','loginUser']),
|
...mapState(["archives", 'archivesTableData'])
|
||||||
operateWidth() {
|
|
||||||
return this.loginUser.auth!==0?'250':'130'
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
// 搜索框存在输入,自动调用搜索(刷新数据包含搜索)
|
// 搜索框存在输入,自动调用搜索(刷新数据包含搜索)
|
||||||
@ -78,26 +74,19 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapMutations(['updateArchives','updateArchivesTableData']),
|
...mapActions(["getArchives"]),
|
||||||
|
...mapMutations(['updateArchivesTableData']),
|
||||||
|
|
||||||
// 显示详情弹窗
|
// 显示详情弹窗
|
||||||
showDetail(data) {
|
showDetail(data) {
|
||||||
console.log('显示详情', data)
|
console.log('显示详情', data)
|
||||||
|
|
||||||
//从后端获取需要查询的数据,防止数据前后不一致
|
//从后端获取需要查询的数据,防止数据前后不一致
|
||||||
request.queryArchiveRequest(data.id,null).then(response => {
|
//这里先用假数据代替一下
|
||||||
if (response.data.data === null) {
|
this.dialog.dialogData = this.archives.find(e => e.id === data.id)
|
||||||
this.refresh()
|
|
||||||
return ElMessage({
|
//显示弹窗
|
||||||
message: '该档案记录不存在,请刷新',
|
this.dialog.detailDialogVisible = true
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
}else {
|
|
||||||
this.dialog.dialogData = frontendArchive(response.data.data)
|
|
||||||
//显示弹窗
|
|
||||||
this.dialog.detailDialogVisible = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
//显示编辑弹窗
|
//显示编辑弹窗
|
||||||
@ -105,66 +94,45 @@ export default {
|
|||||||
console.log('显示编辑', data)
|
console.log('显示编辑', data)
|
||||||
|
|
||||||
//从后端获取需要查询的数据,防止数据前后不一致
|
//从后端获取需要查询的数据,防止数据前后不一致
|
||||||
request.queryArchiveRequest(data.id,null).then(response => {
|
//这里先用假数据代替一下
|
||||||
if (response.data.data === null) {
|
this.dialog.dialogData = this.archives.find(e => e.id === data.id)
|
||||||
this.refresh()
|
|
||||||
return ElMessage({
|
//显示弹窗
|
||||||
message: '该记录不存在,请刷新',
|
this.dialog.editDialogVisible = true
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
}else {
|
|
||||||
this.dialog.dialogData = frontendArchive(response.data.data)
|
|
||||||
//显示弹窗
|
|
||||||
this.dialog.editDialogVisible = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
edit(data) {
|
edit(data) {
|
||||||
console.log('编辑', data)
|
console.log('编辑', data)
|
||||||
|
|
||||||
//判断表单是否为空
|
//判断表单是否为空
|
||||||
if (this.isEmpty(data)) {
|
return this.isEmpty(data);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//这里将数据传给后端进行数据更新
|
//这里将数据传给后端进行数据更新
|
||||||
//从后端获取需要查询的数据,防止数据前后不一致
|
//编辑失败
|
||||||
request.queryArchiveRequest(data.id,null).then(response => {
|
if (false) {
|
||||||
if (response.data.data === null) {
|
return ElMessage({
|
||||||
this.refresh()
|
message: '编辑失败',
|
||||||
this.dialog.editDialogVisible = false;
|
type: 'warning',
|
||||||
return ElMessage({
|
})
|
||||||
message: '该档案记录不存在,请刷新',
|
}
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
}else {
|
|
||||||
request.updateArchiveRequest(data).then(response => {
|
|
||||||
if (response.data.code===1){
|
|
||||||
// 编辑成功
|
|
||||||
// 刷新数据
|
|
||||||
this.refresh()
|
|
||||||
request.queryArchiveRequest(null,this.dialog.dialogData.animalId).then(response => {
|
|
||||||
if (response.data.code===1){
|
|
||||||
this.dialog.timelineData = frontendArchives(response.data.data)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
this.dialog.editDialogVisible = false//关闭窗口
|
//编辑成功
|
||||||
|
if (false) {
|
||||||
|
return ElMessage({
|
||||||
|
message: '编辑成功',
|
||||||
|
type: 'success',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return ElMessage({
|
// //从后端重新拉取数据
|
||||||
message: '编辑成功',
|
// this.getArchives()
|
||||||
type: 'success',
|
// this.search()
|
||||||
})
|
|
||||||
}else {
|
// 刷新数据
|
||||||
return ElMessage({
|
this.refresh()
|
||||||
message: '编辑失败',
|
|
||||||
type: 'warning',
|
//关闭窗口
|
||||||
})
|
this.dialog.editDialogVisible = false
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
delete_(data) {
|
delete_(data) {
|
||||||
@ -179,38 +147,19 @@ export default {
|
|||||||
type: 'warning',
|
type: 'warning',
|
||||||
}
|
}
|
||||||
).then(() => {
|
).then(() => {
|
||||||
//从后端获取需要查询的数据,防止数据前后不一致
|
//进行删除操作
|
||||||
request.queryArchiveRequest(data.id,null).then(response => {
|
|
||||||
if (response.data.data === null) {
|
|
||||||
this.refresh()
|
|
||||||
return ElMessage({
|
|
||||||
message: '该档案记录不存在,请刷新',
|
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
}else {
|
|
||||||
//进行删除操作
|
|
||||||
request.deleteArchiveRequest(data.id).then(response => {
|
|
||||||
if (response.data.code===1){
|
|
||||||
// 刷新数据
|
|
||||||
this.refresh()
|
|
||||||
request.queryArchiveRequest(null,this.dialog.dialogData.animalId).then(response => {
|
|
||||||
if (response.data.code===1){
|
|
||||||
this.dialog.timelineData = frontendArchives(response.data.data)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
return ElMessage({
|
// //从后端重新拉取数据
|
||||||
message: '删除成功',
|
// this.getArchives()
|
||||||
type: 'success',
|
// this.search()
|
||||||
})
|
|
||||||
}else {
|
// 刷新数据
|
||||||
return ElMessage({
|
this.refresh()
|
||||||
message: '删除失败',
|
|
||||||
type: 'warning',
|
// 返回提示
|
||||||
})
|
ElMessage({
|
||||||
}
|
type: 'success',
|
||||||
})
|
message: '删除成功',
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
@ -224,53 +173,61 @@ export default {
|
|||||||
console.log('添加', data)
|
console.log('添加', data)
|
||||||
|
|
||||||
//验证是否为空
|
//验证是否为空
|
||||||
if (this.isEmpty(data)) {
|
return this.isEmpty(data);
|
||||||
return;
|
|
||||||
|
//先查询用户是否存在
|
||||||
|
|
||||||
|
//添加失败
|
||||||
|
if (false) {
|
||||||
|
return ElMessage({
|
||||||
|
message: '该记录已存在',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
//添加成功
|
||||||
|
if (false) {
|
||||||
|
return ElMessage({
|
||||||
|
message: '添加成功',
|
||||||
|
type: 'success',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// //从后端重新拉取数据
|
||||||
|
// this.getArchives()
|
||||||
|
// this.search()
|
||||||
|
|
||||||
request.addArchiveRequest(data).then(response => {
|
// 刷新数据
|
||||||
if (response.data.code===1){
|
this.refresh()
|
||||||
// 添加成功
|
|
||||||
// 刷新数据
|
|
||||||
this.refresh()
|
|
||||||
|
|
||||||
this.dialog.addDialogVisible = false//关闭窗口
|
this.dialog.addDialogVisible = false//添加成功关闭窗口
|
||||||
|
|
||||||
return ElMessage({
|
|
||||||
message: '添加成功',
|
|
||||||
type: 'success',
|
|
||||||
})
|
|
||||||
}else {
|
|
||||||
return ElMessage({
|
|
||||||
message: '添加失败',
|
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
//以时间线的形式查看该动物的所有档案记录
|
//以时间线的形式查看该动物的所有档案记录
|
||||||
showTimeline(data) {
|
showTimeline(data) {
|
||||||
console.log('显示时间线记录', data)
|
console.log('显示时间线记录', data)
|
||||||
|
|
||||||
this.dialog.dialogData = data
|
//从后端获取需要查询的数据,防止数据前后不一致
|
||||||
|
//这里先用假数据代替一下
|
||||||
|
this.dialog.dialogData = this.archives.find(e => e.id === data.id)
|
||||||
|
|
||||||
//从后端获取需要查询的数据
|
this.dialog.timelineData = []
|
||||||
request.queryArchiveRequest(null,data.animalId).then(response => {
|
//从后端获取需要查询的数据,防止数据前后不一致
|
||||||
if (response.data.code===1){
|
//这里先用假数据代替一下
|
||||||
this.dialog.timelineData = frontendArchives(response.data.data)
|
this.archives.forEach(e => {
|
||||||
//显示弹窗
|
if (e.animalId === data.animalId) {
|
||||||
this.dialog.timelineDialogVisible = true
|
this.dialog.timelineData.push(copy(e))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
//显示弹窗
|
||||||
|
this.dialog.timelineDialogVisible = true
|
||||||
},
|
},
|
||||||
|
|
||||||
// 判断表单是否为空
|
// 判断表单是否为空
|
||||||
isEmpty(form) {
|
isEmpty(form) {
|
||||||
if (!form.animalId||!form.animalName) {
|
if (!form.animalId) {
|
||||||
//返回提示
|
//返回提示
|
||||||
return ElMessage({
|
return ElMessage({
|
||||||
message: '动物ID或动物名称不能为空',
|
message: '记录的动物ID不能为空',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -353,25 +310,21 @@ export default {
|
|||||||
console.log('刷新数据')
|
console.log('刷新数据')
|
||||||
|
|
||||||
//先拉取一遍数据
|
//先拉取一遍数据
|
||||||
request.queryArchiveRequest().then(response=>{
|
this.getArchives()
|
||||||
if (response.data.code === 1){
|
|
||||||
this.updateArchives(frontendArchives(response.data.data))
|
|
||||||
}
|
|
||||||
//可能输入了搜索关键字,故执行一次搜索
|
|
||||||
this.search()
|
|
||||||
|
|
||||||
//排序
|
//可能输入了搜索关键字,故执行一次搜索
|
||||||
this.timeSort(this.order)
|
this.search()
|
||||||
|
|
||||||
//获取结果的分页
|
//排序
|
||||||
this.getPagesData()
|
this.timeSort(this.order)
|
||||||
})
|
|
||||||
|
//获取结果的分页
|
||||||
|
this.getPagesData()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
// 加载完成后拉取数据
|
// 加载完成后拉取数据
|
||||||
this.refresh()
|
this.refresh()
|
||||||
refreshData()
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -379,7 +332,7 @@ export default {
|
|||||||
<template>
|
<template>
|
||||||
<div class="archive-root">
|
<div class="archive-root">
|
||||||
<div class="select">
|
<div class="select">
|
||||||
<div class="left" v-if="loginUser.auth!==0">
|
<div class="left">
|
||||||
<el-button type="primary" :icon="DocumentAdd" @click="dialog.addDialogVisible = true">添加记录</el-button>
|
<el-button type="primary" :icon="DocumentAdd" @click="dialog.addDialogVisible = true">添加记录</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
@ -421,9 +374,8 @@ export default {
|
|||||||
<el-table-column prop="date" label="记录日期" width="110"/>
|
<el-table-column prop="date" label="记录日期" width="110"/>
|
||||||
<el-table-column prop="time" label="记录时间" width="90"/>
|
<el-table-column prop="time" label="记录时间" width="90"/>
|
||||||
<el-table-column prop="roleId" label="记录人ID" width="90"/>
|
<el-table-column prop="roleId" label="记录人ID" width="90"/>
|
||||||
<el-table-column prop="breedingId" label="关联计划" width="90"/>
|
|
||||||
<el-table-column prop="description" label="记录描述" width="300"/>
|
<el-table-column prop="description" label="记录描述" width="300"/>
|
||||||
<el-table-column fixed="right" label="操作" :width="operateWidth">
|
<el-table-column fixed="right" label="操作" width="250">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button link type="success" size="small" :icon="Tickets" @click="showTimeline(scope.row)">
|
<el-button link type="success" size="small" :icon="Tickets" @click="showTimeline(scope.row)">
|
||||||
档案
|
档案
|
||||||
@ -431,10 +383,10 @@ export default {
|
|||||||
<el-button link type="primary" size="small" :icon="Document" @click="showDetail(scope.row)">
|
<el-button link type="primary" size="small" :icon="Document" @click="showDetail(scope.row)">
|
||||||
详情
|
详情
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button link type="primary" size="small" :icon="Edit" @click="showEdit(scope.row)" v-if="loginUser.auth!==0">
|
<el-button link type="primary" size="small" :icon="Edit" @click="showEdit(scope.row)">
|
||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button link type="danger" size="small" :icon="Delete" @click="delete_(scope.row)" v-if="loginUser.auth!==0">
|
<el-button link type="danger" size="small" :icon="Delete" @click="delete_(scope.row)">
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
@ -452,8 +404,7 @@ export default {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 添加记录对话框-->
|
<!-- 添加记录对话框-->
|
||||||
<el-dialog v-model="dialog.addDialogVisible" title="添加记录" width="500" align-center draggable overflow
|
<el-dialog v-model="dialog.addDialogVisible" title="添加记录" width="500" align-center draggable overflow>
|
||||||
destroy-on-close>
|
|
||||||
<ZooArchiveFormDialog>
|
<ZooArchiveFormDialog>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button @click="dialog.addDialogVisible = false">
|
<el-button @click="dialog.addDialogVisible = false">
|
||||||
@ -495,7 +446,8 @@ export default {
|
|||||||
|
|
||||||
<!--查看动物所有记录-->
|
<!--查看动物所有记录-->
|
||||||
<el-dialog v-model="dialog.timelineDialogVisible" :title="'生命周期档案:'+dialog.dialogData.animalId" width="600"
|
<el-dialog v-model="dialog.timelineDialogVisible" :title="'生命周期档案:'+dialog.dialogData.animalId" width="600"
|
||||||
align-center draggable overflow destroy-on-close>
|
align-center draggable overflow
|
||||||
|
destroy-on-close>
|
||||||
<ZooArchiveTimeline :data="dialog.timelineData">
|
<ZooArchiveTimeline :data="dialog.timelineData">
|
||||||
<template #operate="scope">
|
<template #operate="scope">
|
||||||
<el-button type="primary" link @click="showEdit(scope.archive)">编辑</el-button>
|
<el-button type="primary" link @click="showEdit(scope.archive)">编辑</el-button>
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
<script>
|
<script>
|
||||||
import ZooBreedingPlanFormDialog from "@/components/ZooBreedingPlanFormDialog.vue";
|
import ZooBreedingPlanFormDialog from "@/components/ZooBreedingPlanFormDialog.vue";
|
||||||
import {mapState, mapActions, mapMutations, mapGetters} from "vuex";
|
import {mapState, mapActions, mapMutations} from "vuex";
|
||||||
import {Delete, DocumentAdd, Document, Edit, Search, Tickets} from "@element-plus/icons-vue";
|
import {Delete, DocumentAdd, Document,Edit, Search} from "@element-plus/icons-vue";
|
||||||
import {copy, splitKeyWords, fuzzyMatching, refreshData} from "@/utils/common.js";
|
import {copy, splitKeyWords,fuzzyMatching} from "@/utils/common.js";
|
||||||
import request, {frontendArchives, frontendBreeding, frontendBreedingPlans} from "@/utils/request.js";
|
|
||||||
import ZooArchiveTimeline from "@/components/ZooArchiveTimeline.vue";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ZooBreeding",
|
name: "ZooBreeding",
|
||||||
components: {ZooArchiveTimeline, ZooBreedingPlanFormDialog},
|
components: {ZooBreedingPlanFormDialog},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
//表格分页显示的数据
|
//表格分页显示的数据
|
||||||
@ -27,14 +25,11 @@ export default {
|
|||||||
dialogData: {},
|
dialogData: {},
|
||||||
addDialogVisible: false,//添加饲养计划对话框
|
addDialogVisible: false,//添加饲养计划对话框
|
||||||
editDialogVisible: false,//编辑饲养计划对话框
|
editDialogVisible: false,//编辑饲养计划对话框
|
||||||
detailDialogVisible: false,//查询饲养计划对话框
|
detailDialogVisible:false//查询饲养计划对话框
|
||||||
timelineDialogVisible: false,//时间线对话框
|
|
||||||
timelineData: []//时间线数据
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
||||||
//图标
|
//图标
|
||||||
//region
|
//region
|
||||||
Search() {
|
Search() {
|
||||||
@ -52,72 +47,33 @@ export default {
|
|||||||
Document() {
|
Document() {
|
||||||
return Document
|
return Document
|
||||||
},
|
},
|
||||||
Tickets() {
|
|
||||||
return Tickets
|
|
||||||
},
|
|
||||||
//endregion
|
//endregion
|
||||||
...mapState(["breedingPlans", 'breedingPlansTableData','loginUser']),
|
...mapState(["breedingPlans",'breedingPlansTableData'])
|
||||||
operateWidth() {
|
|
||||||
return this.loginUser.auth===1?'250':'130'
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
// 搜索框存在输入,自动调用搜索(刷新数据包含搜索)
|
// 搜索框存在输入,自动调用搜索(刷新数据包含搜索)
|
||||||
searchInput: {
|
searchInput: {
|
||||||
deep: true,
|
deep: true,
|
||||||
handler(val) {
|
handler(val) {
|
||||||
|
// this.search()
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapMutations(['updateBreedingPlans','updateBreedingPlansTableData']),
|
...mapActions(["getBreedingPlans"]),
|
||||||
|
...mapMutations(['updateBreedingPlansTableData']),
|
||||||
//以时间线的形式查看该动物的所有档案记录
|
|
||||||
showTimeline(data) {
|
|
||||||
console.log('显示时间线记录', data)
|
|
||||||
|
|
||||||
this.dialog.dialogData = data
|
|
||||||
|
|
||||||
//从后端获取需要查询的数据,防止数据前后不一致
|
|
||||||
request.queryBreedingPlanRequest(data.id).then(response => {
|
|
||||||
if (response.data.data===null){
|
|
||||||
this.refresh();
|
|
||||||
return ElMessage({
|
|
||||||
message: '该计划不存在,请刷新',
|
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
request.queryArchiveByBreedingId(data.id).then(response => {
|
|
||||||
if (response.data.code===1){
|
|
||||||
this.dialog.timelineData = frontendArchives(response.data.data)
|
|
||||||
//显示弹窗
|
|
||||||
this.dialog.timelineDialogVisible = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
//显示详情弹窗
|
//显示详情弹窗
|
||||||
showDetail(data) {
|
showDetail(data) {
|
||||||
console.log('显示详情', data)
|
console.log('显示详情', data)
|
||||||
|
|
||||||
//从后端获取需要查询的数据,防止数据前后不一致
|
//从后端获取需要查询的数据,防止数据前后不一致
|
||||||
request.queryBreedingPlanRequest(data.id).then(response => {
|
//这里先用假数据代替一下
|
||||||
if (response.data.data === null) {
|
this.dialog.dialogData = this.breedingPlans.find(e => e.id === data.id)
|
||||||
this.refresh();
|
|
||||||
return ElMessage({
|
//显示弹窗
|
||||||
message: '该计划不存在,请刷新',
|
this.dialog.detailDialogVisible = true
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.dialog.dialogData = frontendBreeding(response.data.data)
|
|
||||||
//显示弹窗
|
|
||||||
this.dialog.detailDialogVisible = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
//显示编辑弹窗
|
//显示编辑弹窗
|
||||||
@ -125,61 +81,45 @@ export default {
|
|||||||
console.log('显示编辑', data)
|
console.log('显示编辑', data)
|
||||||
|
|
||||||
//从后端获取需要查询的数据,防止数据前后不一致
|
//从后端获取需要查询的数据,防止数据前后不一致
|
||||||
request.queryBreedingPlanRequest(data.id).then(response => {
|
//这里先用假数据代替一下
|
||||||
if (response.data.data === null) {
|
this.dialog.dialogData = this.breedingPlans.find(e => e.id === data.id)
|
||||||
this.refresh();
|
|
||||||
return ElMessage({
|
//显示弹窗
|
||||||
message: '该计划不存在,请刷新',
|
this.dialog.editDialogVisible = true
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.dialog.dialogData = frontendBreeding(response.data.data)
|
|
||||||
//显示弹窗
|
|
||||||
this.dialog.editDialogVisible = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
edit(data) {
|
edit(data) {
|
||||||
console.log('编辑', data)
|
console.log('编辑', data)
|
||||||
|
|
||||||
//判断表单是否为空
|
//判断表单是否为空
|
||||||
if (this.isEmpty(data)) {
|
return this.isEmpty(data);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//这里将数据传给后端进行数据更新
|
//这里将数据传给后端进行数据更新
|
||||||
//从后端获取需要查询的数据,防止数据前后不一致
|
//编辑失败
|
||||||
request.queryBreedingPlanRequest(data.id).then(response => {
|
if (false) {
|
||||||
if (response.data.data === null) {
|
return ElMessage({
|
||||||
this.refresh();
|
message: '编辑失败',
|
||||||
this.dialog.editDialogVisible = false;
|
type: 'warning',
|
||||||
return ElMessage({
|
})
|
||||||
message: '该计划不存在,请刷新',
|
}
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
request.updateBreedingPlanRequest(data).then(response => {
|
|
||||||
if (response.data.code === 1) {
|
|
||||||
// 编辑成功
|
|
||||||
// 刷新数据
|
|
||||||
this.refresh()
|
|
||||||
|
|
||||||
this.dialog.editDialogVisible = false//关闭窗口
|
//编辑成功
|
||||||
|
if (false) {
|
||||||
|
return ElMessage({
|
||||||
|
message: '编辑成功',
|
||||||
|
type: 'success',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return ElMessage({
|
// //从后端重新拉取数据
|
||||||
message: '编辑成功',
|
// this.getBreedingPlans()
|
||||||
type: 'success',
|
// this.search()
|
||||||
})
|
|
||||||
} else {
|
// 刷新数据
|
||||||
return ElMessage({
|
this.refresh()
|
||||||
message: '编辑失败',
|
|
||||||
type: 'warning',
|
//关闭窗口
|
||||||
})
|
this.dialog.editDialogVisible = false
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
delete_(data) {
|
delete_(data) {
|
||||||
@ -187,40 +127,26 @@ export default {
|
|||||||
|
|
||||||
return ElMessageBox.confirm(
|
return ElMessageBox.confirm(
|
||||||
'该操作不可撤销,是否继续?',
|
'该操作不可撤销,是否继续?',
|
||||||
'删除计划:' + data.name + '(' + data.id + ')',
|
'删除计划:' + data.name + '('+data.id+')',
|
||||||
{
|
{
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
}
|
}
|
||||||
).then(() => {
|
).then(() => {
|
||||||
//从后端获取需要查询的数据,防止数据前后不一致
|
//进行删除操作
|
||||||
request.queryBreedingPlanRequest(data.id).then(response => {
|
|
||||||
if (response.data.data === null) {
|
|
||||||
this.refresh();
|
|
||||||
return ElMessage({
|
|
||||||
message: '该计划不存在,请刷新',
|
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
//进行删除操作
|
|
||||||
request.deleteBreedingPlanRequest(data.id).then(response => {
|
|
||||||
if (response.data.code === 1) {
|
|
||||||
// 刷新数据
|
|
||||||
this.refresh()
|
|
||||||
|
|
||||||
return ElMessage({
|
// //从后端重新拉取数据
|
||||||
message: '删除成功',
|
// this.getBreedingPlans()
|
||||||
type: 'success',
|
// this.search()
|
||||||
})
|
|
||||||
} else {
|
// 刷新数据
|
||||||
return ElMessage({
|
this.refresh()
|
||||||
message: '删除失败',
|
|
||||||
type: 'warning',
|
// 返回提示
|
||||||
})
|
ElMessage({
|
||||||
}
|
type: 'success',
|
||||||
})
|
message: '删除成功',
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
@ -234,37 +160,40 @@ export default {
|
|||||||
console.log('添加', data)
|
console.log('添加', data)
|
||||||
|
|
||||||
//验证是否为空
|
//验证是否为空
|
||||||
if (this.isEmpty(data)) {
|
return this.isEmpty(data);
|
||||||
return;
|
|
||||||
|
//先查询用户是否存在
|
||||||
|
|
||||||
|
//添加失败
|
||||||
|
if (false) {
|
||||||
|
return ElMessage({
|
||||||
|
message: '该计划已存在',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
//添加成功
|
||||||
|
if (false) {
|
||||||
|
return ElMessage({
|
||||||
|
message: '添加成功',
|
||||||
|
type: 'success',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// //从后端重新拉取数据
|
||||||
|
// this.getBreedingPlans()
|
||||||
|
// this.search()
|
||||||
|
|
||||||
request.addBreedingPlanRequest(data).then(response => {
|
// 刷新数据
|
||||||
if (response.data.code===1){
|
this.refresh()
|
||||||
// 添加成功
|
|
||||||
// 刷新数据
|
|
||||||
this.refresh()
|
|
||||||
|
|
||||||
this.dialog.addDialogVisible = false//添加成功关闭窗口
|
this.dialog.addDialogVisible = false//添加成功关闭窗口
|
||||||
|
|
||||||
return ElMessage({
|
|
||||||
message: '添加成功',
|
|
||||||
type: 'success',
|
|
||||||
})
|
|
||||||
}else {
|
|
||||||
return ElMessage({
|
|
||||||
message: '添加失败',
|
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 判断表单是否为空
|
// 判断表单是否为空
|
||||||
isEmpty(form) {
|
isEmpty(form) {
|
||||||
if (!form.name || !form.species) {
|
if (!form.name) {
|
||||||
//返回提示
|
//返回提示
|
||||||
return ElMessage({
|
return ElMessage({
|
||||||
message: '计划名称或物种不能为空',
|
message: '计划名不能为空',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -307,7 +236,7 @@ export default {
|
|||||||
|
|
||||||
//当前页切换时触发
|
//当前页切换时触发
|
||||||
handleCurrentChange(val) {
|
handleCurrentChange(val) {
|
||||||
console.log('分页被切换', val)
|
console.log('分页被切换',val)
|
||||||
this.currentPage = val
|
this.currentPage = val
|
||||||
this.getPagesData()
|
this.getPagesData()
|
||||||
},
|
},
|
||||||
@ -320,26 +249,28 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
//刷新数据的方法
|
//刷新数据的方法
|
||||||
refresh() {
|
refresh(){
|
||||||
console.log('刷新数据')
|
console.log('刷新数据')
|
||||||
|
|
||||||
//先拉取一遍数据
|
//先拉取一遍数据
|
||||||
request.queryBreedingPlanRequest().then(response => {
|
this.getBreedingPlans()
|
||||||
if (response.data.code === 1) {
|
|
||||||
this.updateBreedingPlans(frontendBreedingPlans(response.data.data))
|
|
||||||
}
|
|
||||||
//可能输入了搜索关键字,故执行一次搜索
|
|
||||||
this.search()
|
|
||||||
|
|
||||||
//获取结果的分页
|
//可能输入了搜索关键字,故执行一次搜索
|
||||||
this.getPagesData()
|
this.search()
|
||||||
})
|
|
||||||
|
//获取结果的分页
|
||||||
|
this.getPagesData()
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
// 加载完成后拉取数据
|
// // 加载完成后拉取数据
|
||||||
|
// this.getBreedingPlans()
|
||||||
|
//
|
||||||
|
// //获取分页后显示的数据
|
||||||
|
// this.getPagesData()
|
||||||
|
|
||||||
this.refresh()
|
this.refresh()
|
||||||
refreshData()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -347,7 +278,7 @@ export default {
|
|||||||
<template>
|
<template>
|
||||||
<div class="breeding-root">
|
<div class="breeding-root">
|
||||||
<div class="select">
|
<div class="select">
|
||||||
<div class="left" v-if="loginUser.auth === 1">
|
<div class="left">
|
||||||
<el-button type="primary" :icon="DocumentAdd" @click="dialog.addDialogVisible = true">添加计划</el-button>
|
<el-button type="primary" :icon="DocumentAdd" @click="dialog.addDialogVisible = true">添加计划</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
@ -371,8 +302,7 @@ export default {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="table">
|
<div class="table">
|
||||||
<el-table :data="pagesData" style="width: 100%;height: 100%" border stripe :row-style="{height: '40px'}"
|
<el-table :data="pagesData" style="width: 100%;height: 100%" border stripe :row-style="{height: '40px'}" :cell-style="{padding:'0'}">
|
||||||
:cell-style="{padding:'0'}">
|
|
||||||
<el-table-column fixed prop="id" label="计划ID" width="70"/>
|
<el-table-column fixed prop="id" label="计划ID" width="70"/>
|
||||||
<el-table-column fixed prop="name" label="计划名称" width="150"/>
|
<el-table-column fixed prop="name" label="计划名称" width="150"/>
|
||||||
<el-table-column prop="roleId" label="执行饲养员" width="100"/>
|
<el-table-column prop="roleId" label="执行饲养员" width="100"/>
|
||||||
@ -387,18 +317,15 @@ export default {
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="description" label="计划描述" width="300"/>
|
<el-table-column prop="description" label="计划描述" width="300"/>
|
||||||
<el-table-column fixed="right" label="操作" :width="operateWidth">
|
<el-table-column fixed="right" label="操作" width="190">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button link type="success" size="small" :icon="Tickets" @click="showTimeline(scope.row)">
|
|
||||||
档案
|
|
||||||
</el-button>
|
|
||||||
<el-button link type="primary" size="small" :icon="Document" @click="showDetail(scope.row)">
|
<el-button link type="primary" size="small" :icon="Document" @click="showDetail(scope.row)">
|
||||||
详情
|
详情
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button link type="primary" size="small" :icon="Edit" @click="showEdit(scope.row)" v-if="loginUser.auth===1">
|
<el-button link type="primary" size="small" :icon="Edit" @click="showEdit(scope.row)">
|
||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button link type="danger" size="small" :icon="Delete" @click="delete_(scope.row)" v-if="loginUser.auth===1">
|
<el-button link type="danger" size="small" :icon="Delete" @click="delete_(scope.row)">
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
@ -416,8 +343,7 @@ export default {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 添加饲养计划对话框-->
|
<!-- 添加饲养计划对话框-->
|
||||||
<el-dialog v-model="dialog.addDialogVisible" title="添加饲养计划" width="500" align-center draggable overflow
|
<el-dialog v-model="dialog.addDialogVisible" title="添加饲养计划" width="500" align-center draggable overflow>
|
||||||
destroy-on-close>
|
|
||||||
<ZooBreedingPlanFormDialog>
|
<ZooBreedingPlanFormDialog>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button @click="dialog.addDialogVisible = false">
|
<el-button @click="dialog.addDialogVisible = false">
|
||||||
@ -456,25 +382,6 @@ export default {
|
|||||||
</template>
|
</template>
|
||||||
</ZooBreedingPlanFormDialog>
|
</ZooBreedingPlanFormDialog>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<!--查看动物所有记录-->
|
|
||||||
<el-dialog v-model="dialog.timelineDialogVisible" :title="'计划相关档案:'+dialog.dialogData.id" width="600" align-center
|
|
||||||
draggable overflow destroy-on-close>
|
|
||||||
<ZooArchiveTimeline :data="dialog.timelineData">
|
|
||||||
<!-- <template #operate="scope">-->
|
|
||||||
<!-- <el-button type="primary" link @click="showEdit(scope.archive)">编辑</el-button>-->
|
|
||||||
<!-- <el-button type="danger" link @click="delete_(scope.archive)">删除</el-button>-->
|
|
||||||
<!-- </template>-->
|
|
||||||
<template #footer>
|
|
||||||
<el-button type="primary" @click="$router.push('/panel/archive')">
|
|
||||||
跳转至动物档案
|
|
||||||
</el-button>
|
|
||||||
<el-button @click="dialog.timelineDialogVisible = false">
|
|
||||||
关闭
|
|
||||||
</el-button>
|
|
||||||
</template>
|
|
||||||
</ZooArchiveTimeline>
|
|
||||||
</el-dialog>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
<script>
|
<script>
|
||||||
import {Delete, DocumentAdd, Document, Edit, Search, Tickets, Timer} from "@element-plus/icons-vue";
|
import {Delete, DocumentAdd, Document, Edit, Search, Tickets, Timer} from "@element-plus/icons-vue";
|
||||||
import {mapActions, mapMutations, mapState} from "vuex";
|
import {mapActions, mapMutations, mapState} from "vuex";
|
||||||
import {copy, fuzzyMatching, refreshData, sortByDateTime, splitKeyWords} from "@/utils/common.js";
|
import {copy, fuzzyMatching, sortByDateTime, splitKeyWords} from "@/utils/common.js";
|
||||||
import ZooHealthFormDialog from "@/components/ZooHealthFormDialog.vue";
|
import ZooHealthFormDialog from "@/components/ZooHealthFormDialog.vue";
|
||||||
import ZooHealthTimeline from "@/components/ZooHealthTimeline.vue";
|
import ZooHealthTimeline from "@/components/ZooHealthTimeline.vue";
|
||||||
import request, {frontendHealth, frontendHealths} from "@/utils/request.js";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ZooHealth",
|
name: "ZooHealth",
|
||||||
@ -59,10 +58,7 @@ export default {
|
|||||||
return Timer
|
return Timer
|
||||||
},
|
},
|
||||||
//endregion
|
//endregion
|
||||||
...mapState(["healths", 'healthsTableData','loginUser']),
|
...mapState(["healths", 'healthsTableData'])
|
||||||
operateWidth() {
|
|
||||||
return this.loginUser.auth===2?'250':'130'
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
// 搜索框存在输入,自动调用搜索(刷新数据包含搜索)
|
// 搜索框存在输入,自动调用搜索(刷新数据包含搜索)
|
||||||
@ -79,26 +75,19 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapMutations(['updateHealths','updateHealthsTableData']),
|
...mapActions(["getHealths"]),
|
||||||
|
...mapMutations(['updateHealthsTableData']),
|
||||||
|
|
||||||
// 显示详情弹窗
|
// 显示详情弹窗
|
||||||
showDetail(data) {
|
showDetail(data) {
|
||||||
console.log('显示详情', data)
|
console.log('显示详情', data)
|
||||||
|
|
||||||
//从后端获取需要查询的数据,防止数据前后不一致
|
//从后端获取需要查询的数据,防止数据前后不一致
|
||||||
request.queryHealthRequest(data.id,null).then(response => {
|
//这里先用假数据代替一下
|
||||||
if (response.data.data === null) {
|
this.dialog.dialogData = this.healths.find(e => e.id === data.id)
|
||||||
this.refresh();
|
|
||||||
return ElMessage({
|
//显示弹窗
|
||||||
message: '该监测记录不存在,请刷新',
|
this.dialog.detailDialogVisible = true
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
}else {
|
|
||||||
this.dialog.dialogData = frontendHealth(response.data.data)
|
|
||||||
//显示弹窗
|
|
||||||
this.dialog.detailDialogVisible = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
//显示编辑弹窗
|
//显示编辑弹窗
|
||||||
@ -106,66 +95,45 @@ export default {
|
|||||||
console.log('显示编辑', data)
|
console.log('显示编辑', data)
|
||||||
|
|
||||||
//从后端获取需要查询的数据,防止数据前后不一致
|
//从后端获取需要查询的数据,防止数据前后不一致
|
||||||
request.queryHealthRequest(data.id,null).then(response => {
|
//这里先用假数据代替一下
|
||||||
if (response.data.data === null) {
|
this.dialog.dialogData = this.healths.find(e => e.id === data.id)
|
||||||
this.refresh();
|
|
||||||
return ElMessage({
|
//显示弹窗
|
||||||
message: '该监测记录不存在,请刷新',
|
this.dialog.editDialogVisible = true
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
}else {
|
|
||||||
this.dialog.dialogData = frontendHealth(response.data.data)
|
|
||||||
//显示弹窗
|
|
||||||
this.dialog.editDialogVisible = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
edit(data) {
|
edit(data) {
|
||||||
console.log('编辑', data)
|
console.log('编辑', data)
|
||||||
|
|
||||||
//判断表单是否为空
|
//判断表单是否为空
|
||||||
if (this.isEmpty(data)) {
|
return this.isEmpty(data);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//这里将数据传给后端进行数据更新
|
//这里将数据传给后端进行数据更新
|
||||||
//从后端获取需要查询的数据,防止数据前后不一致
|
//编辑失败
|
||||||
request.queryHealthRequest(data.id,null).then(response => {
|
if (false) {
|
||||||
if (response.data.data === null) {
|
return ElMessage({
|
||||||
this.refresh();
|
message: '编辑失败',
|
||||||
this.dialog.editDialogVisible = false;
|
type: 'warning',
|
||||||
return ElMessage({
|
})
|
||||||
message: '该监测记录不存在,请刷新',
|
}
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
}else {
|
|
||||||
request.updateHealthRequest(data).then(response => {
|
|
||||||
if (response.data.code === 1) {
|
|
||||||
//编辑成功
|
|
||||||
//刷新数据
|
|
||||||
this.refresh()
|
|
||||||
request.queryHealthRequest(null,this.dialog.dialogData.animalId).then(response => {
|
|
||||||
if (response.data.code===1){
|
|
||||||
this.dialog.timelineData = frontendHealths(response.data.data)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
this.dialog.editDialogVisible = false//关闭窗口
|
//编辑成功
|
||||||
|
if (false) {
|
||||||
|
return ElMessage({
|
||||||
|
message: '编辑成功',
|
||||||
|
type: 'success',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return ElMessage({
|
// //从后端重新拉取数据
|
||||||
message: '编辑成功',
|
// this.getHealths()
|
||||||
type: 'success',
|
// this.search()
|
||||||
})
|
|
||||||
} else {
|
// 刷新数据
|
||||||
return ElMessage({
|
this.refresh()
|
||||||
message: '编辑失败',
|
|
||||||
type: 'warning',
|
//关闭窗口
|
||||||
})
|
this.dialog.editDialogVisible = false
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
delete_(data) {
|
delete_(data) {
|
||||||
@ -181,38 +149,18 @@ export default {
|
|||||||
}
|
}
|
||||||
).then(() => {
|
).then(() => {
|
||||||
//进行删除操作
|
//进行删除操作
|
||||||
//从后端获取需要查询的数据,防止数据前后不一致
|
|
||||||
request.queryHealthRequest(data.id,null).then(response => {
|
|
||||||
if (response.data.data === null) {
|
|
||||||
this.refresh();
|
|
||||||
return ElMessage({
|
|
||||||
message: '该监测记录不存在,请刷新',
|
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
}else {
|
|
||||||
request.deleteHealthRequest(data.id).then(response => {
|
|
||||||
if (response.data.code === 1) {
|
|
||||||
//编辑成功
|
|
||||||
//刷新数据
|
|
||||||
this.refresh()
|
|
||||||
request.queryHealthRequest(null,this.dialog.dialogData.animalId).then(response => {
|
|
||||||
if (response.data.code===1){
|
|
||||||
this.dialog.timelineData = frontendHealths(response.data.data)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
return ElMessage({
|
// //从后端重新拉取数据
|
||||||
message: '删除成功',
|
// this.getHealths()
|
||||||
type: 'success',
|
// this.search()
|
||||||
})
|
|
||||||
} else {
|
// 刷新数据
|
||||||
return ElMessage({
|
this.refresh()
|
||||||
message: '删除失败',
|
|
||||||
type: 'warning',
|
// 返回提示
|
||||||
})
|
ElMessage({
|
||||||
}
|
type: 'success',
|
||||||
})
|
message: '删除成功',
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
@ -226,53 +174,61 @@ export default {
|
|||||||
console.log('添加', data)
|
console.log('添加', data)
|
||||||
|
|
||||||
//验证是否为空
|
//验证是否为空
|
||||||
if (this.isEmpty(data)) {
|
return this.isEmpty(data);
|
||||||
return;
|
|
||||||
|
//先查询用户是否存在
|
||||||
|
|
||||||
|
//添加失败
|
||||||
|
if (false) {
|
||||||
|
return ElMessage({
|
||||||
|
message: '该记录已存在',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
//添加成功
|
||||||
|
if (false) {
|
||||||
|
return ElMessage({
|
||||||
|
message: '添加成功',
|
||||||
|
type: 'success',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// //从后端重新拉取数据
|
||||||
|
// this.getHealths()
|
||||||
|
// this.search()
|
||||||
|
|
||||||
request.addHealthRequest(data).then(response => {
|
// 刷新数据
|
||||||
if (response.data.code === 1) {
|
this.refresh()
|
||||||
//添加成功
|
|
||||||
//刷新数据
|
|
||||||
this.refresh()
|
|
||||||
|
|
||||||
this.dialog.addDialogVisible = false//关闭窗口
|
this.dialog.addDialogVisible = false//添加成功关闭窗口
|
||||||
|
|
||||||
return ElMessage({
|
|
||||||
message: '添加成功',
|
|
||||||
type: 'success',
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
return ElMessage({
|
|
||||||
message: '添加失败',
|
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
//以时间线的形式查看该动物的所有档案记录
|
//以时间线的形式查看该动物的所有档案记录
|
||||||
showTimeline(data) {
|
showTimeline(data) {
|
||||||
console.log('显示时间线记录', data)
|
console.log('显示时间线记录', data)
|
||||||
|
|
||||||
this.dialog.dialogData = data
|
//从后端获取需要查询的数据,防止数据前后不一致
|
||||||
|
//这里先用假数据代替一下
|
||||||
|
this.dialog.dialogData = this.healths.find(e => e.id === data.id)
|
||||||
|
|
||||||
//从后端获取需要查询的数据
|
this.dialog.timelineData = []
|
||||||
request.queryHealthRequest(null,data.animalId).then(response=>{
|
//从后端获取需要查询的数据,防止数据前后不一致
|
||||||
if (response.data.code === 1) {
|
//这里先用假数据代替一下
|
||||||
this.dialog.timelineData = frontendHealths(response.data.data)
|
this.healths.forEach(e => {
|
||||||
//显示弹窗
|
if (e.animalId === data.animalId) {
|
||||||
this.dialog.timelineDialogVisible = true
|
this.dialog.timelineData.push(copy(e))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
//显示弹窗
|
||||||
|
this.dialog.timelineDialogVisible = true
|
||||||
},
|
},
|
||||||
|
|
||||||
// 判断表单是否为空
|
// 判断表单是否为空
|
||||||
isEmpty(form) {
|
isEmpty(form) {
|
||||||
if (!form.animalId||!form.animalName) {
|
if (!form.animalId) {
|
||||||
//返回提示
|
//返回提示
|
||||||
return ElMessage({
|
return ElMessage({
|
||||||
message: '动物ID或动物名称不能为空',
|
message: '记录的动物ID不能为空',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -355,25 +311,21 @@ export default {
|
|||||||
console.log('刷新数据')
|
console.log('刷新数据')
|
||||||
|
|
||||||
//先拉取一遍数据
|
//先拉取一遍数据
|
||||||
request.queryHealthRequest().then(response=>{
|
this.getHealths()
|
||||||
if (response.data.code===1){
|
|
||||||
this.updateHealths(frontendHealths(response.data.data))
|
|
||||||
}
|
|
||||||
//可能输入了搜索关键字,故执行一次搜索
|
|
||||||
this.search()
|
|
||||||
|
|
||||||
//排序
|
//可能输入了搜索关键字,故执行一次搜索
|
||||||
this.timeSort(this.order)
|
this.search()
|
||||||
|
|
||||||
//获取结果的分页
|
//排序
|
||||||
this.getPagesData()
|
this.timeSort(this.order)
|
||||||
})
|
|
||||||
|
//获取结果的分页
|
||||||
|
this.getPagesData()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
// 加载完成后拉取数据
|
// 加载完成后拉取数据
|
||||||
this.refresh()
|
this.refresh()
|
||||||
refreshData()
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -381,7 +333,7 @@ export default {
|
|||||||
<template>
|
<template>
|
||||||
<div class="health-root">
|
<div class="health-root">
|
||||||
<div class="select">
|
<div class="select">
|
||||||
<div class="left" v-if="loginUser.auth===2">
|
<div class="left">
|
||||||
<el-button type="primary" :icon="DocumentAdd" @click="dialog.addDialogVisible = true">添加记录</el-button>
|
<el-button type="primary" :icon="DocumentAdd" @click="dialog.addDialogVisible = true">添加记录</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
@ -449,7 +401,7 @@ export default {
|
|||||||
<el-table-column prop="date" label="记录日期" width="110"/>
|
<el-table-column prop="date" label="记录日期" width="110"/>
|
||||||
<el-table-column prop="time" label="记录时间" width="90"/>
|
<el-table-column prop="time" label="记录时间" width="90"/>
|
||||||
<el-table-column prop="description" label="记录描述" width="300"/>
|
<el-table-column prop="description" label="记录描述" width="300"/>
|
||||||
<el-table-column fixed="right" label="操作" :width="operateWidth">
|
<el-table-column fixed="right" label="操作" width="250">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button link type="success" size="small" :icon="Tickets" @click="showTimeline(scope.row)">
|
<el-button link type="success" size="small" :icon="Tickets" @click="showTimeline(scope.row)">
|
||||||
追踪
|
追踪
|
||||||
@ -457,10 +409,10 @@ export default {
|
|||||||
<el-button link type="primary" size="small" :icon="Document" @click="showDetail(scope.row)">
|
<el-button link type="primary" size="small" :icon="Document" @click="showDetail(scope.row)">
|
||||||
详情
|
详情
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button link type="primary" size="small" :icon="Edit" @click="showEdit(scope.row)" v-if="loginUser.auth===2">
|
<el-button link type="primary" size="small" :icon="Edit" @click="showEdit(scope.row)">
|
||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button link type="danger" size="small" :icon="Delete" @click="delete_(scope.row)" v-if="loginUser.auth===2">
|
<el-button link type="danger" size="small" :icon="Delete" @click="delete_(scope.row)">
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
@ -478,8 +430,7 @@ export default {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 添加记录对话框-->
|
<!-- 添加记录对话框-->
|
||||||
<el-dialog v-model="dialog.addDialogVisible" title="添加记录" width="500" align-center draggable overflow
|
<el-dialog v-model="dialog.addDialogVisible" title="添加记录" width="500" align-center draggable overflow>
|
||||||
destroy-on-close>
|
|
||||||
<ZooHealthFormDialog>
|
<ZooHealthFormDialog>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button @click="dialog.addDialogVisible = false">
|
<el-button @click="dialog.addDialogVisible = false">
|
||||||
@ -520,7 +471,7 @@ export default {
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<!-- 查看动物所有记录-->
|
<!-- 查看动物所有记录-->
|
||||||
<el-dialog v-model="dialog.timelineDialogVisible" :title="'健康监测追踪:'+dialog.dialogData.animalId" width="600" align-center draggable overflow
|
<el-dialog v-model="dialog.timelineDialogVisible" :title="'健康监测档案:'+dialog.dialogData.animalId" width="600" align-center draggable overflow
|
||||||
destroy-on-close>
|
destroy-on-close>
|
||||||
<ZooHealthTimeline :data="dialog.timelineData">
|
<ZooHealthTimeline :data="dialog.timelineData">
|
||||||
<template #operate="scope">
|
<template #operate="scope">
|
||||||
|
@ -1,460 +1,24 @@
|
|||||||
<script>
|
<script>
|
||||||
import {mapState} from "vuex";
|
|
||||||
import {Bell, Minus, Plus} from "@element-plus/icons-vue";
|
|
||||||
import {refreshData} from "@/utils/common.js";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ZooHome",
|
name: "ZooHome",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
adminCount: 0,
|
|
||||||
keeperCount: 0,
|
|
||||||
veterinaryCount: 0,
|
|
||||||
|
|
||||||
speciesCount: 0,
|
|
||||||
normalCount: 0,
|
|
||||||
abnormalCount: 0,
|
|
||||||
|
|
||||||
foodCount: Math.floor((Math.random() * 201)),//当前食物库存
|
|
||||||
foodCapacity: 200,//食物库存
|
|
||||||
|
|
||||||
// breedingAnimalCount: 0,//今日已饲养动物数
|
|
||||||
// healthAnimalCount: 0,//今日已监测动物数
|
|
||||||
// handleAnimalCount: 0,//今日处理异常动物数
|
|
||||||
|
|
||||||
percentageColors: [
|
|
||||||
{color: '#f56c6c', percentage: 30},
|
|
||||||
{color: '#e6a23c', percentage: 60},
|
|
||||||
{color: '#5cb87a', percentage: 90},
|
|
||||||
],
|
|
||||||
|
|
||||||
childhoodCount: 0,//幼年期
|
|
||||||
adolescenceCount: 0,//成长期
|
|
||||||
adulthoodCount: 0,//成年期
|
|
||||||
oldCount: 0,//老年期
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
|
||||||
users: {
|
|
||||||
immediate: true,
|
|
||||||
handler(value) {
|
|
||||||
this.adminCount = 0
|
|
||||||
this.keeperCount = 0
|
|
||||||
this.veterinaryCount = 0
|
|
||||||
this.users.forEach(e => {
|
|
||||||
if (e.auth === 0) {
|
|
||||||
this.adminCount++
|
|
||||||
} else if (e.auth === 1) {
|
|
||||||
this.keeperCount++
|
|
||||||
} else if (e.auth === 2) {
|
|
||||||
this.veterinaryCount++
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
animals: {
|
|
||||||
immediate: true,
|
|
||||||
handler(value) {
|
|
||||||
this.speciesCount = 0
|
|
||||||
const speciesSet = new Set()
|
|
||||||
|
|
||||||
this.normalCount = 0
|
|
||||||
this.abnormalCount = 0
|
|
||||||
|
|
||||||
this.childhoodCount = 0
|
|
||||||
this.adolescenceCount = 0
|
|
||||||
this.adulthoodCount = 0
|
|
||||||
this.oldCount = 0
|
|
||||||
|
|
||||||
this.animals.forEach(e => {
|
|
||||||
speciesSet.add(e.species)
|
|
||||||
if (e.state === 0) {
|
|
||||||
this.normalCount++
|
|
||||||
} else if (e.state === 1) {
|
|
||||||
this.abnormalCount++
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e.phase === '幼年期') {
|
|
||||||
this.childhoodCount++
|
|
||||||
} else if (e.phase === '成长期') {
|
|
||||||
this.adolescenceCount++
|
|
||||||
} else if (e.phase === '成年期') {
|
|
||||||
this.adulthoodCount++
|
|
||||||
} else if (e.phase === '老年期') {
|
|
||||||
this.oldCount++
|
|
||||||
}
|
|
||||||
})
|
|
||||||
this.speciesCount = speciesSet.size
|
|
||||||
|
|
||||||
this.breedingAnimalCount = Number((Math.random() * this.animals.length).toFixed(0))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
Bell() {
|
|
||||||
return Bell
|
|
||||||
},
|
|
||||||
Plus() {
|
|
||||||
return Plus
|
|
||||||
},
|
|
||||||
Minus() {
|
|
||||||
return Minus
|
|
||||||
},
|
|
||||||
breedingAnimalCount(){//今日已饲养动物数
|
|
||||||
let count = 0;
|
|
||||||
const newDate = new Date()
|
|
||||||
this.archives.forEach(e => {
|
|
||||||
if (e.type === '日常饲养' && e.date === (newDate.getFullYear() + '-' + (newDate.getMonth()+1).toString().padStart(2, '0') + '-' + newDate.getDate().toString().padStart(2, '0'))) {
|
|
||||||
count++
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return count;
|
|
||||||
},
|
|
||||||
healthAnimalCount(){
|
|
||||||
let count = 0;
|
|
||||||
const newDate = new Date()
|
|
||||||
this.healths.forEach(e => {
|
|
||||||
if (e.date === (newDate.getFullYear() + '-' + (newDate.getMonth()+1).toString().padStart(2, '0') + '-' + newDate.getDate().toString().padStart(2, '0'))) {
|
|
||||||
count++
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return count;
|
|
||||||
},
|
|
||||||
handleAnimalCount(){
|
|
||||||
let count = 0;
|
|
||||||
const newDate = new Date()
|
|
||||||
this.archives.forEach(e => {
|
|
||||||
if (e.type === '疾病治疗' && e.date === (newDate.getFullYear() + '-' + (newDate.getMonth()+1).toString().padStart(2, '0') + '-' + newDate.getDate().toString().padStart(2, '0'))) {
|
|
||||||
count++
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return count;
|
|
||||||
},
|
|
||||||
...mapState(["users", 'animals', 'loginUser', 'archives','healths']),
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
decreaseFood() {
|
|
||||||
if (this.foodCount > 0) {
|
|
||||||
this.foodCount--
|
|
||||||
}
|
|
||||||
},
|
|
||||||
increaseFood() {
|
|
||||||
if (this.foodCount < this.foodCapacity) {
|
|
||||||
this.foodCount++
|
|
||||||
}
|
|
||||||
},
|
|
||||||
decreaseBreeding(){
|
|
||||||
if (this.breedingAnimalCount > 0) {
|
|
||||||
this.breedingAnimalCount--
|
|
||||||
}
|
|
||||||
},
|
|
||||||
increaseBreeding(){
|
|
||||||
if (this.breedingAnimalCount < this.animals.length) {
|
|
||||||
this.breedingAnimalCount++
|
|
||||||
}
|
|
||||||
},
|
|
||||||
decreaseHealth(){
|
|
||||||
if (this.healthAnimalCount > 0) {
|
|
||||||
this.healthAnimalCount--
|
|
||||||
}
|
|
||||||
},
|
|
||||||
increaseHealth(){
|
|
||||||
if (this.healthAnimalCount < this.animals.length) {
|
|
||||||
this.healthAnimalCount++
|
|
||||||
}
|
|
||||||
},
|
|
||||||
decreaseHandle(){
|
|
||||||
if (this.handleAnimalCount > 0) {
|
|
||||||
this.handleAnimalCount--
|
|
||||||
}
|
|
||||||
},
|
|
||||||
increaseHandle(){
|
|
||||||
if (this.handleAnimalCount < this.abnormalCount) {
|
|
||||||
this.handleAnimalCount++
|
|
||||||
}
|
|
||||||
},
|
|
||||||
notify(msg){
|
|
||||||
return ElMessage({
|
|
||||||
message: '已通知'+msg,
|
|
||||||
type: 'success',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
refreshData()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div id="home-root">
|
<div>
|
||||||
<div class="statistics" style="padding-bottom: 20px">
|
这是home界面
|
||||||
<el-row>
|
|
||||||
<el-col :span="24">
|
|
||||||
<div class="title">用户统计</div>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="6">
|
|
||||||
<el-statistic title="系统用户总数" :value="users.length"/>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="6">
|
|
||||||
<el-statistic :value="adminCount" :value-style="{color:'#409EFF'}">
|
|
||||||
<template #title>
|
|
||||||
<span style="color: #409EFF">管理员数量</span>
|
|
||||||
</template>
|
|
||||||
<template #suffix>
|
|
||||||
<span style="color: #409EFF" v-if="users.length===0">(0%)</span>
|
|
||||||
<span style="color: #409EFF" v-else>
|
|
||||||
({{ (adminCount / users.length * 100).toFixed(1) }}%)
|
|
||||||
</span>
|
|
||||||
</template>
|
|
||||||
</el-statistic>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="6">
|
|
||||||
<el-statistic :value="keeperCount" :value-style="{color:'#67C23A'}">
|
|
||||||
<template #title>
|
|
||||||
<span style="color: #67C23A">饲养员数量</span>
|
|
||||||
</template>
|
|
||||||
<template #suffix>
|
|
||||||
<span style="color: #67C23A" v-if="users.length===0">(0%)</span>
|
|
||||||
<span style="color: #67C23A" v-else>
|
|
||||||
({{ (keeperCount / users.length * 100).toFixed(1) }}%)
|
|
||||||
</span>
|
|
||||||
</template>
|
|
||||||
</el-statistic>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="6">
|
|
||||||
<el-statistic :value="veterinaryCount" :value-style="{color:'#E6A23C'}">
|
|
||||||
<template #title>
|
|
||||||
<span style="color: #E6A23C">兽医数量</span>
|
|
||||||
</template>
|
|
||||||
<template #suffix>
|
|
||||||
<span style="color: #E6A23C" v-if="users.length===0">(0%)</span>
|
|
||||||
<span style="color: #E6A23C" v-else>
|
|
||||||
({{ (veterinaryCount / users.length * 100).toFixed(1) }}%)
|
|
||||||
</span>
|
|
||||||
</template>
|
|
||||||
</el-statistic>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</div>
|
|
||||||
<div class="statistics" style="margin-bottom: 0">
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="24">
|
|
||||||
<div class="title">动物统计</div>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="24">
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="6">
|
|
||||||
<el-statistic title="动物总数" :value="animals.length"/>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="6">
|
|
||||||
<el-statistic :value="speciesCount" title="动物种类"/>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="6">
|
|
||||||
<el-statistic :value="normalCount" :value-style="{color:'#67C23A'}">
|
|
||||||
<template #title>
|
|
||||||
<span style="color: #67C23A">健康动物</span>
|
|
||||||
</template>
|
|
||||||
<template #suffix>
|
|
||||||
<span style="color: #67C23A" v-if="animals.length===0">(0%)</span>
|
|
||||||
<span style="color: #67C23A" v-else>({{ (normalCount / animals.length * 100).toFixed(1) }}%)</span>
|
|
||||||
</template>
|
|
||||||
</el-statistic>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="6">
|
|
||||||
<el-statistic :value="abnormalCount" :value-style="{color:'#f56c6c'}">
|
|
||||||
<template #title>
|
|
||||||
<span style="color: #f56c6c">异常动物</span>
|
|
||||||
</template>
|
|
||||||
<template #suffix>
|
|
||||||
<span style="color: #f56c6c" v-if="animals.length===0">(0%)</span>
|
|
||||||
<span style="color: #f56c6c" v-else>({{ (abnormalCount / animals.length * 100).toFixed(1) }}%)</span>
|
|
||||||
</template>
|
|
||||||
</el-statistic>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="12">
|
|
||||||
<div class="statistics">
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="24">
|
|
||||||
<div class="title">日常统计</div>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-progress type="dashboard" :percentage="Number((breedingAnimalCount/animals.length*100).toFixed(1))"
|
|
||||||
:color="percentageColors">
|
|
||||||
<template #default="{ percentage }">
|
|
||||||
<span class="percentage-label">今日饲养进度</span>
|
|
||||||
<span class="percentage-value" v-if="!percentage">0%</span>
|
|
||||||
<span class="percentage-value" v-else>{{ percentage }}%</span>
|
|
||||||
<span class="percentage-label">{{ breedingAnimalCount }}/{{ animals.length }}</span>
|
|
||||||
<span v-if="percentage>=0 && (loginUser.auth === 0 || loginUser.auth === 1)">
|
|
||||||
<!-- <el-button :icon="Minus" @click="decreaseBreeding" size="small" style="width: 10px"/>-->
|
|
||||||
<!-- <el-button :icon="Plus" @click="increaseBreeding" size="small" style="width: 10px"/>-->
|
|
||||||
<el-button :icon="Bell" @click="notify('饲养员')" size="small" style="width: 80px">通知饲养员</el-button>
|
|
||||||
</span>
|
|
||||||
</template>
|
|
||||||
</el-progress>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-progress type="dashboard" :percentage="Number((foodCount/foodCapacity*100).toFixed(1))"
|
|
||||||
:color="percentageColors">
|
|
||||||
<template #default="{ percentage }">
|
|
||||||
<span class="percentage-label">食物库存</span>
|
|
||||||
<span class="percentage-value">{{ percentage }}%</span>
|
|
||||||
<span class="percentage-label">{{ foodCount }}/{{ foodCapacity }}吨</span>
|
|
||||||
<span v-if="percentage>=0 && (loginUser.auth === 0 || loginUser.auth === 1)">
|
|
||||||
<!-- <el-button :icon="Minus" @click="decreaseFood" size="small" style="width: 10px"/>-->
|
|
||||||
<!-- <el-button :icon="Plus" @click="increaseFood" size="small" style="width: 10px"/>-->
|
|
||||||
<el-button :icon="Bell" @click="notify('饲养员')" size="small" style="width: 80px">通知饲养员</el-button>
|
|
||||||
</span>
|
|
||||||
</template>
|
|
||||||
</el-progress>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-progress type="dashboard" :percentage="Number((healthAnimalCount/animals.length*100).toFixed(1))"
|
|
||||||
:color="percentageColors">
|
|
||||||
<template #default="{ percentage }">
|
|
||||||
<span class="percentage-label">今日监测进度</span>
|
|
||||||
<span class="percentage-value" v-if="!percentage">0%</span>
|
|
||||||
<span class="percentage-value" v-else>{{ percentage }}%</span>
|
|
||||||
<span class="percentage-label">{{ healthAnimalCount }}/{{ animals.length }}</span>
|
|
||||||
<span v-if="percentage>=0 && (loginUser.auth === 0 || loginUser.auth === 2)">
|
|
||||||
<!-- <el-button :icon="Minus" @click="decreaseHealth" size="small" style="width: 10px"/>-->
|
|
||||||
<!-- <el-button :icon="Plus" @click="increaseHealth" size="small" style="width: 10px"/>-->
|
|
||||||
<el-button :icon="Bell" @click="notify('兽医')" size="small" style="width: 80px">通知兽医</el-button>
|
|
||||||
</span>
|
|
||||||
</template>
|
|
||||||
</el-progress>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-progress type="dashboard" :percentage="Number((handleAnimalCount/abnormalCount*100).toFixed(1))"
|
|
||||||
:color="percentageColors">
|
|
||||||
<template #default="{ percentage }">
|
|
||||||
<span class="percentage-label">异常处理进度</span>
|
|
||||||
<span class="percentage-value" v-if="!percentage">0%</span>
|
|
||||||
<span class="percentage-value" v-else>{{ percentage }}%</span>
|
|
||||||
<span class="percentage-label">{{ handleAnimalCount }}/{{ abnormalCount }}</span>
|
|
||||||
<span v-if="percentage>=0 && (loginUser.auth === 0 || loginUser.auth === 2)">
|
|
||||||
<!-- <el-button :icon="Minus" @click="decreaseHandle" size="small" style="width: 10px"/>-->
|
|
||||||
<!-- <el-button :icon="Plus" @click="increaseHandle" size="small" style="width: 10px"/>-->
|
|
||||||
<el-button :icon="Bell" @click="notify('兽医')" size="small" style="width: 80px">通知兽医</el-button>
|
|
||||||
</span>
|
|
||||||
</template>
|
|
||||||
</el-progress>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</div>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<div class="statistics">
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="24">
|
|
||||||
<div class="title">生命阶段统计</div>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row style="padding: 40px 0">
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-statistic :value="childhoodCount" :value-style="{color:'#67C23A'}">
|
|
||||||
<template #title>
|
|
||||||
<span style="color: #67C23A">幼年期</span>
|
|
||||||
</template>
|
|
||||||
<template #suffix>
|
|
||||||
<span style="color: #67C23A" v-if="animals.length===0">(0%)</span>
|
|
||||||
<span style="color: #67C23A" v-else>({{ (childhoodCount / animals.length * 100).toFixed(1) }}%)</span>
|
|
||||||
</template>
|
|
||||||
</el-statistic>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-statistic :value="adolescenceCount" :value-style="{color:'#409EFF'}">
|
|
||||||
<template #title>
|
|
||||||
<span style="color: #409EFF">成长期</span>
|
|
||||||
</template>
|
|
||||||
<template #suffix>
|
|
||||||
<span style="color: #409EFF" v-if="animals.length===0">(0%)</span>
|
|
||||||
<span style="color: #409EFF" v-else>({{ (adolescenceCount / animals.length * 100).toFixed(1) }}%)</span>
|
|
||||||
</template>
|
|
||||||
</el-statistic>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row style="padding: 40px 0">
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-statistic :value="adulthoodCount" :value-style="{color:'#E6A23C'}">
|
|
||||||
<template #title>
|
|
||||||
<span style="color: #E6A23C">成年期</span>
|
|
||||||
</template>
|
|
||||||
<template #suffix>
|
|
||||||
<span style="color: #E6A23C" v-if="animals.length===0">(0%)</span>
|
|
||||||
<span style="color: #E6A23C" v-else>({{ (adulthoodCount / animals.length * 100).toFixed(1) }}%)</span>
|
|
||||||
</template>
|
|
||||||
</el-statistic>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-statistic :value="oldCount" :value-style="{color:'#909399'}">
|
|
||||||
<template #title>
|
|
||||||
<span style="color: #909399">老年期</span>
|
|
||||||
</template>
|
|
||||||
<template #suffix>
|
|
||||||
<span style="color: #909399" v-if="animals.length===0">(0%)</span>
|
|
||||||
<span style="color: #909399" v-else>({{ (oldCount / animals.length * 100).toFixed(1) }}%)</span>
|
|
||||||
</template>
|
|
||||||
</el-statistic>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</div>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
#home-root {
|
|
||||||
margin: 20px;
|
|
||||||
background-color: white;
|
|
||||||
border: gray 1px solid;
|
|
||||||
}
|
|
||||||
|
|
||||||
.statistics {
|
|
||||||
border: darkgray 1px solid;
|
|
||||||
margin: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title {
|
|
||||||
margin-top: 10px;
|
|
||||||
font-size: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.statistics, .title {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.percentage-value {
|
|
||||||
display: block;
|
|
||||||
margin-top: 10px;
|
|
||||||
font-size: 28px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.percentage-label {
|
|
||||||
display: block;
|
|
||||||
margin-top: 10px;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.clear::after {
|
|
||||||
content: "";
|
|
||||||
clear: both;
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
@ -1,6 +1,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import {mapMutations, mapState} from "vuex";
|
|
||||||
import request, {frontendLoginUser} from "@/utils/request.js";
|
import {mapMutations,mapState,mapActions} from "vuex";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ZooContainer",
|
name: "ZooContainer",
|
||||||
@ -8,25 +8,20 @@ export default {
|
|||||||
return {
|
return {
|
||||||
// 登录表单数据
|
// 登录表单数据
|
||||||
form: {
|
form: {
|
||||||
username: 'admin',
|
username: '',
|
||||||
password: '123456',
|
password: '123456',
|
||||||
},
|
}
|
||||||
picture: [
|
|
||||||
'https://www4.bing.com//th?id=OHR.BambooPanda_ZH-CN8455481760_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp',
|
|
||||||
'https://www4.bing.com//th?id=OHR.PolarBearCubs_ZH-CN2913942257_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp',
|
|
||||||
'https://www4.bing.com//th?id=OHR.WhiteEyes_ZH-CN1130380430_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp',
|
|
||||||
'https://www4.bing.com//th?id=OHR.ZebraCousins_ZH-CN8159888859_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp'
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['loginUser'])
|
...mapState(['loginUser'])
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
...mapActions(['getLoginUser']),
|
||||||
...mapMutations(['updateLoginUser']),
|
...mapMutations(['updateLoginUser']),
|
||||||
// 登录
|
// 登录
|
||||||
login() {
|
login() {
|
||||||
console.log('点击登录', this.form)
|
console.log('登录',this.form)
|
||||||
//判断表单是否为空
|
//判断表单是否为空
|
||||||
if (!this.form.username || !this.form.password) {
|
if (!this.form.username || !this.form.password) {
|
||||||
//返回提示
|
//返回提示
|
||||||
@ -36,25 +31,16 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
//此处接入后端登录接口验证登录用户名和密码,验证通过方可通行
|
//此处接入后端登录接口
|
||||||
request.login(this.form).then(response => {
|
this.getLoginUser(this.form)//通过表单获取登录的用户
|
||||||
if (response.data.code === 1) {
|
|
||||||
// 登录成功
|
//能获取到登录后的数据,说明登录成功
|
||||||
this.updateLoginUser(frontendLoginUser(response.data.data))
|
if (this.loginUser) {
|
||||||
localStorage.setItem('username', response.data.data.username);//本地存储登录用户名
|
localStorage.setItem('username', this.loginUser.username);//本地存储登录用户名
|
||||||
// 跳转到面板首页
|
|
||||||
this.$router.push('/panel/home')
|
// 跳转到面板首页
|
||||||
return ElMessage({
|
this.$router.push('/panel/home')
|
||||||
message: '登录成功',
|
}
|
||||||
type: 'success',
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
return ElMessage({
|
|
||||||
message: '用户名不存在或密码错误',
|
|
||||||
type: 'error',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
//重置表单
|
//重置表单
|
||||||
reset() {
|
reset() {
|
||||||
@ -63,34 +49,29 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
//清空退出登录的用户
|
//清空退出登录的用户
|
||||||
// this.updateLoginUser('');
|
this.updateLoginUser('');
|
||||||
|
|
||||||
// //自动填充历史登录的用户
|
//自动填充历史登录的用户
|
||||||
// this.form.username = localStorage.getItem('username');
|
this.form.username = localStorage.getItem('username');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div id="login-root">
|
<div id="login-root">
|
||||||
<!-- 背景图片-->
|
<!-- 背景图片-->
|
||||||
<div>
|
<el-carousel height="400px" motion-blur>
|
||||||
<el-carousel motion-blur height="700px" style="width: auto;">
|
<el-carousel-item v-for="item in 4" :key="item">
|
||||||
<el-carousel-item v-for="(item,index) in picture" :key="index" style="text-align: center">
|
<h3 class="small justify-center" text="2xl">{{ item }}</h3>
|
||||||
<img :src="item" width="auto" height="100%"/>
|
</el-carousel-item>
|
||||||
</el-carousel-item>
|
</el-carousel>
|
||||||
</el-carousel>
|
<!-- 登录表单-->
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 登录表单-->
|
|
||||||
<div class="center">
|
<div class="center">
|
||||||
<el-card style="width: 350px" shadow="always">
|
<el-card style="width: 480px" shadow="always" header="登录">
|
||||||
<template #header>
|
<el-form :model="form" label-width="auto" style="max-width: 600px">
|
||||||
<div style="text-align: center;font-size: 25px">登录</div>
|
|
||||||
</template>
|
|
||||||
<el-form :model="form" label-width="auto" style="width: 400px">
|
|
||||||
<el-form-item label="用户名">
|
<el-form-item label="用户名">
|
||||||
<el-input v-model="form.username" style="width: 240px" placeholder="请输入用户名" id="username"/>
|
<el-input v-model="form.username" style="width: 240px" placeholder="请输入用户名"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="密码">
|
<el-form-item label="密码">
|
||||||
<el-input
|
<el-input
|
||||||
@ -99,11 +80,10 @@ export default {
|
|||||||
type="password"
|
type="password"
|
||||||
placeholder="请输入密码"
|
placeholder="请输入密码"
|
||||||
show-password
|
show-password
|
||||||
id="password"
|
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="login" id="login-button">登录</el-button>
|
<el-button type="primary" @click="login">登录</el-button>
|
||||||
<el-button @click="reset">重置</el-button>
|
<el-button @click="reset">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -117,10 +97,6 @@ export default {
|
|||||||
#login-root {
|
#login-root {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 700px;
|
height: 700px;
|
||||||
background-color: aliceblue;
|
background-color: skyblue;
|
||||||
}
|
|
||||||
|
|
||||||
.center {
|
|
||||||
opacity: 0.95;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
@ -3,8 +3,6 @@ import ZooHeader from "@/components/ZooHeader.vue";
|
|||||||
import ZooAside from "@/components/ZooAside.vue";
|
import ZooAside from "@/components/ZooAside.vue";
|
||||||
import ZooMain from "@/components/ZooMain.vue";
|
import ZooMain from "@/components/ZooMain.vue";
|
||||||
import ZooFooter from "@/components/ZooFooter.vue";
|
import ZooFooter from "@/components/ZooFooter.vue";
|
||||||
import {mapActions} from "vuex";
|
|
||||||
import {refreshData} from "@/utils/common.js";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ZooPanel",
|
name: "ZooPanel",
|
||||||
@ -16,24 +14,15 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['getUsers','getAnimals','getArchives','getBreedingPlans','getHealths'])
|
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
ZooHeader,
|
ZooHeader,
|
||||||
ZooAside,
|
ZooAside,
|
||||||
ZooMain,
|
ZooMain,
|
||||||
ZooFooter
|
ZooFooter
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
console.log("登录用户",this.$store.state.loginUser)
|
|
||||||
//初始化数据
|
|
||||||
// this.getUsers();
|
|
||||||
// this.getAnimals();
|
|
||||||
// this.getBreedingPlans();
|
|
||||||
// this.getArchives();
|
|
||||||
// this.getHealths();
|
|
||||||
refreshData()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -61,15 +50,15 @@ export default {
|
|||||||
top: 0;
|
top: 0;
|
||||||
}
|
}
|
||||||
.footer {
|
.footer {
|
||||||
height: 20px;
|
height: 30px;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
line-height: 20px;
|
line-height: 30px;
|
||||||
background-color: lightgray;
|
background-color: lightgray;
|
||||||
}
|
}
|
||||||
.main {
|
.main {
|
||||||
/*有footer*/
|
/*有footer*/
|
||||||
height: 616px;
|
height: 606px;
|
||||||
|
|
||||||
/*没footer*/
|
/*没footer*/
|
||||||
/*height: 636px;*/
|
/*height: 636px;*/
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
import {Delete, Edit, Search, User, Document} from "@element-plus/icons-vue";
|
import {Delete, Edit, Search, User, Document} from "@element-plus/icons-vue";
|
||||||
import {mapState, mapActions, mapMutations} from "vuex";
|
import {mapState, mapActions, mapMutations} from "vuex";
|
||||||
import ZooUserFormDialog from "@/components/ZooUserFormDialog.vue";
|
import ZooUserFormDialog from "@/components/ZooUserFormDialog.vue";
|
||||||
import {copy, fuzzyMatching, splitKeyWords, showPassword, hidePassword, refreshData} from "@/utils/common.js";
|
import {copy, fuzzyMatching, splitKeyWords, showPassword, hidePassword} from "@/utils/common.js";
|
||||||
import request, {frontendUser, frontendUsers} from "@/utils/request.js";
|
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -28,7 +27,7 @@ export default {
|
|||||||
addDialogVisible: false,//添加弹窗
|
addDialogVisible: false,//添加弹窗
|
||||||
editDialogVisible: false,//编辑弹窗
|
editDialogVisible: false,//编辑弹窗
|
||||||
detailDialogVisible: false,//详情弹窗
|
detailDialogVisible: false,//详情弹窗
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -58,6 +57,7 @@ export default {
|
|||||||
searchInput: {
|
searchInput: {
|
||||||
deep: true,
|
deep: true,
|
||||||
handler(val) {
|
handler(val) {
|
||||||
|
// this.search()
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -66,26 +66,18 @@ export default {
|
|||||||
hidePassword,
|
hidePassword,
|
||||||
showPassword,
|
showPassword,
|
||||||
...mapActions(['getUsers']),
|
...mapActions(['getUsers']),
|
||||||
...mapMutations(['updateUsers','updateUsersTableData']),
|
...mapMutations(['updateUsersTableData']),
|
||||||
|
|
||||||
//显示详情弹窗
|
//显示详情弹窗
|
||||||
showDetail(data) {
|
showDetail(data) {
|
||||||
console.log('显示详情', data)
|
console.log('显示详情', data)
|
||||||
|
|
||||||
//从后端获取需要查询的数据,防止数据前后不一致
|
//从后端获取需要查询的数据,防止数据前后不一致
|
||||||
request.queryUserRequest(data.username).then(response => {
|
//这里先用假数据代替一下
|
||||||
if (response.data.data === null) {
|
this.dialog.dialogData = this.users.find(e => e.username === data.username)
|
||||||
this.refresh()
|
|
||||||
return ElMessage({
|
//显示详情弹窗
|
||||||
message: '该用户不存在,请刷新',
|
this.dialog.detailDialogVisible = true
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
}else {
|
|
||||||
this.dialog.dialogData = frontendUser(response.data.data)
|
|
||||||
// 显示编辑弹窗
|
|
||||||
this.dialog.detailDialogVisible = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 显示编辑弹窗
|
// 显示编辑弹窗
|
||||||
@ -93,61 +85,45 @@ export default {
|
|||||||
console.log('编辑弹窗', data)
|
console.log('编辑弹窗', data)
|
||||||
|
|
||||||
//从后端获取需要查询的数据,防止数据前后不一致
|
//从后端获取需要查询的数据,防止数据前后不一致
|
||||||
request.queryUserRequest(data.username).then(response => {
|
//这里先用假数据代替一下
|
||||||
if (response.data.data === null) {
|
this.dialog.dialogData = this.users.find(e => e.id === data.id)
|
||||||
this.refresh()
|
|
||||||
return ElMessage({
|
// 显示编辑弹窗
|
||||||
message: '该用户不存在,请刷新',
|
this.dialog.editDialogVisible = true
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
}else {
|
|
||||||
this.dialog.dialogData = frontendUser(response.data.data)
|
|
||||||
// 显示编辑弹窗
|
|
||||||
this.dialog.editDialogVisible = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
edit(data) {
|
edit(data) {
|
||||||
console.log('编辑', data)
|
console.log('编辑', data)
|
||||||
|
|
||||||
//判断表单是否为空
|
//判断表单是否为空
|
||||||
if (this.isEmpty(data)) {
|
return this.isEmpty(data);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//这里将数据传给后端进行数据更新
|
//这里将数据传给后端进行数据更新
|
||||||
//从后端获取需要查询的数据,防止数据前后不一致
|
//编辑失败
|
||||||
request.queryUserRequest(data.username).then(response => {
|
if (false) {
|
||||||
if (response.data.data === null) {
|
return ElMessage({
|
||||||
this.refresh()
|
message: '编辑失败',
|
||||||
this.dialog.editDialogVisible = false;
|
type: 'warning',
|
||||||
return ElMessage({
|
})
|
||||||
message: '该用户不存在,请刷新',
|
}
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
}else {
|
|
||||||
request.updateUserRequest(data).then(response => {
|
|
||||||
if (response.data.code===1){
|
|
||||||
// 编辑成功
|
|
||||||
// 刷新数据
|
|
||||||
this.refresh()
|
|
||||||
|
|
||||||
this.dialog.editDialogVisible = false//关闭窗口
|
//编辑成功
|
||||||
|
if (false) {
|
||||||
|
return ElMessage({
|
||||||
|
message: '编辑成功',
|
||||||
|
type: 'success',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return ElMessage({
|
// //从后端重新拉取数据
|
||||||
message: '编辑成功',
|
// this.getUsers()
|
||||||
type: 'success',
|
// this.search()
|
||||||
})
|
|
||||||
}else {
|
// 刷新数据
|
||||||
return ElMessage({
|
this.refresh()
|
||||||
message: '编辑失败,无权限',
|
|
||||||
type: 'warning',
|
//关闭窗口
|
||||||
})
|
this.dialog.editDialogVisible = false
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
delete_(data) {
|
delete_(data) {
|
||||||
@ -162,34 +138,19 @@ export default {
|
|||||||
type: 'warning',
|
type: 'warning',
|
||||||
}
|
}
|
||||||
).then(() => {
|
).then(() => {
|
||||||
//从后端获取需要查询的数据,防止数据前后不一致
|
//进行删除操作
|
||||||
request.queryUserRequest(data.username).then(response => {
|
|
||||||
if (response.data.data===null){
|
|
||||||
this.refresh();
|
|
||||||
return ElMessage({
|
|
||||||
message: '该用户不存在,请刷新',
|
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
}else {
|
|
||||||
//进行删除操作
|
|
||||||
request.deleteUserRequest(data.id).then(response => {
|
|
||||||
if (response.data.code===1){
|
|
||||||
// 刷新数据
|
|
||||||
this.refresh()
|
|
||||||
|
|
||||||
//返回提示
|
// //重新拉取数据
|
||||||
return ElMessage({
|
// this.getUsers()
|
||||||
message: '删除成功',
|
// this.search()
|
||||||
type: 'success',
|
|
||||||
})
|
// 刷新数据
|
||||||
}else {
|
this.refresh()
|
||||||
return ElMessage({
|
|
||||||
message: '删除失败,无权限',
|
// 返回提示
|
||||||
type: 'warning',
|
ElMessage({
|
||||||
})
|
type: 'success',
|
||||||
}
|
message: '删除成功',
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
@ -203,39 +164,33 @@ export default {
|
|||||||
console.log('添加', data)
|
console.log('添加', data)
|
||||||
|
|
||||||
//验证是否为空
|
//验证是否为空
|
||||||
if (this.isEmpty(data)) {
|
return this.isEmpty(data);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//先查询用户是否存在
|
//先查询用户是否存在
|
||||||
request.queryUserRequest(data.username).then(response => {
|
|
||||||
if (response.data.data!==null){
|
|
||||||
return ElMessage({
|
|
||||||
message: '用户名重复',
|
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
}else {
|
|
||||||
//添加成功
|
|
||||||
request.addUserRequest(data).then(response => {
|
|
||||||
if (response.data.code===1){
|
|
||||||
// 刷新数据
|
|
||||||
this.refresh()
|
|
||||||
|
|
||||||
this.dialog.addDialogVisible = false//添加成功关闭窗口
|
//添加失败
|
||||||
|
if (false) {
|
||||||
|
return ElMessage({
|
||||||
|
message: '该用户已存在',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//添加成功
|
||||||
|
if (false) {
|
||||||
|
return ElMessage({
|
||||||
|
message: '添加成功',
|
||||||
|
type: 'success',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return ElMessage({
|
// // 此处重新拉取数据
|
||||||
message: '添加成功',
|
// this.getUsers()
|
||||||
type: 'success',
|
// this.search()
|
||||||
})
|
|
||||||
}else {
|
// 刷新数据
|
||||||
return ElMessage({
|
this.refresh()
|
||||||
message: '添加失败',
|
|
||||||
type: 'warning',
|
this.dialog.addDialogVisible = false//添加成功关闭窗口
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 判断表单是否为空
|
// 判断表单是否为空
|
||||||
@ -303,21 +258,23 @@ export default {
|
|||||||
console.log('刷新数据')
|
console.log('刷新数据')
|
||||||
|
|
||||||
//先拉取一遍数据
|
//先拉取一遍数据
|
||||||
request.queryUserRequest().then(response => {
|
this.getUsers()
|
||||||
if (response.data.code === 1) {
|
|
||||||
this.updateUsers(frontendUsers(response.data.data))
|
|
||||||
}
|
|
||||||
//可能输入了搜索关键字,故执行一次搜索
|
|
||||||
this.search()
|
|
||||||
|
|
||||||
//获取结果的分页
|
//可能输入了搜索关键字,故执行一次搜索
|
||||||
this.getPagesData()
|
this.search()
|
||||||
})
|
|
||||||
|
//获取结果的分页
|
||||||
|
this.getPagesData()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
// // 加载完成后拉取数据
|
||||||
|
// this.getUsers()
|
||||||
|
//
|
||||||
|
// //获取分页后显示的数据
|
||||||
|
// this.getPagesData()
|
||||||
|
|
||||||
this.refresh()
|
this.refresh()
|
||||||
refreshData();
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -384,7 +341,7 @@ export default {
|
|||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 分页-->
|
<!-- 分页-->
|
||||||
<div class="pager relative">
|
<div class="pager relative">
|
||||||
<div class="center">
|
<div class="center">
|
||||||
<el-pagination background layout="total, prev, pager, next, jumper" :total="usersTableData.length"
|
<el-pagination background layout="total, prev, pager, next, jumper" :total="usersTableData.length"
|
||||||
@ -396,8 +353,7 @@ export default {
|
|||||||
|
|
||||||
|
|
||||||
<!-- 添加用户对话框-->
|
<!-- 添加用户对话框-->
|
||||||
<el-dialog v-model="dialog.addDialogVisible" title="添加用户" width="400" align-center draggable overflow
|
<el-dialog v-model="dialog.addDialogVisible" title="添加用户" width="400" align-center draggable overflow>
|
||||||
destroy-on-close>
|
|
||||||
<ZooUserFormDialog>
|
<ZooUserFormDialog>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button @click="dialog.addDialogVisible = false">
|
<el-button @click="dialog.addDialogVisible = false">
|
||||||
|
@ -13,52 +13,50 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
...mapMutations(['updateUsers', 'updateAnimals', 'updateBreedingPlans', 'updateArchives','updateHealths']),
|
...mapMutations(['updateUsers', 'updateAnimals', 'updateBreedingPlans', 'updateArchives','updateHealths']),
|
||||||
usersData() {
|
usersData() {
|
||||||
generateUsers()
|
this.updateUsers(generateUsers())
|
||||||
return ElMessage({
|
return ElMessage({
|
||||||
message: '成功',
|
message: '成功',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
animalsData() {
|
animalsData() {
|
||||||
generateAnimals()
|
this.updateAnimals(generateAnimals())
|
||||||
return ElMessage({
|
return ElMessage({
|
||||||
message: '成功',
|
message: '成功',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
breedingPlansData() {
|
breedingPlansData() {
|
||||||
generateBreedingPlans()
|
this.updateBreedingPlans(generateBreedingPlans())
|
||||||
return ElMessage({
|
return ElMessage({
|
||||||
message: '成功',
|
message: '成功',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
archiveData() {
|
archiveData() {
|
||||||
generateArchives()
|
this.updateArchives(generateArchives())
|
||||||
return ElMessage({
|
return ElMessage({
|
||||||
message: '成功',
|
message: '成功',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
healthData() {
|
healthData() {
|
||||||
generateHealths()
|
this.updateHealths(generateHealths())
|
||||||
return ElMessage({
|
return ElMessage({
|
||||||
message: '成功',
|
message: '成功',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
})
|
})
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
生成数据,最好先确保数据库中的各表没有数据再使用,使用方法:从左到右依次点击,每点击应该需等到弹出成功提示才继续点击下一个
|
<el-button type="primary" @click="usersData">生成用户信息</el-button>
|
||||||
<hr />
|
<el-button type="primary" @click="animalsData">生成动物信息</el-button>
|
||||||
<el-button type="primary" @click="usersData">生成用户信息(预计需要5秒左右)</el-button>
|
<el-button type="primary" @click="breedingPlansData">生成饲养计划信息</el-button>
|
||||||
<el-button type="primary" @click="animalsData">生成动物信息(预计需要5秒左右)</el-button>
|
<el-button type="primary" @click="archiveData">生成档案信息</el-button>
|
||||||
<el-button type="primary" @click="breedingPlansData">生成饲养计划信息(预计需要10秒左右)</el-button>
|
<el-button type="primary" @click="healthData">生成健康监测信息</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>
|
<el-button type="primary" @click="$router.push('/login')">跳转登录</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -76,9 +76,7 @@ router.beforeEach((to, from, next) => {
|
|||||||
//不是登录界面都需要权限。。。
|
//不是登录界面都需要权限。。。
|
||||||
// console.log(to, from, next);
|
// console.log(to, from, next);
|
||||||
if (to.path !== '/login') {
|
if (to.path !== '/login') {
|
||||||
if (to.path==='/data'){
|
if (!store.state.loginUser) {
|
||||||
next()
|
|
||||||
}else if (!store.state.loginUser.username) {
|
|
||||||
router.replace({
|
router.replace({
|
||||||
path: '/login',
|
path: '/login',
|
||||||
})
|
})
|
||||||
|
@ -1,64 +1,55 @@
|
|||||||
import {createStore} from "vuex";
|
import {createStore} from "vuex";
|
||||||
import {copy} from "@/utils/common.js";
|
import {copy, generateAnimals, generateArchives, generateBreedingPlans, generateUsers} from "@/utils/common.js";
|
||||||
import request, {
|
|
||||||
frontendAnimals,
|
|
||||||
frontendArchives,
|
|
||||||
frontendBreedingPlans,
|
|
||||||
frontendHealths,
|
|
||||||
frontendUsers
|
|
||||||
} from "@/utils/request.js";
|
|
||||||
|
|
||||||
const actions = {
|
const actions = {
|
||||||
|
//获取登录用户
|
||||||
|
getLoginUser(context, user) {
|
||||||
|
//此处接入后端登录接口验证登录用户名和密码,验证通过方可通行
|
||||||
|
//密码错误
|
||||||
|
if (false) {
|
||||||
|
return ElMessage({
|
||||||
|
message: '用户名不存在或密码错误',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//登录成功
|
||||||
|
context.commit('updateLoginUser', user);//存储登录用户,这里拉取远程登录的用户作为参数
|
||||||
|
},
|
||||||
//获取用户数据
|
//获取用户数据
|
||||||
getUsers(context) {
|
getUsers(context) {
|
||||||
console.log('getUsers')
|
console.log('getUsers')
|
||||||
//通过后端获取数据
|
//通过后端获取数据
|
||||||
request.queryUserRequest().then(response => {
|
// context.commit('updateUsers', generateUsers())
|
||||||
if (response.data.code === 1) {
|
context.commit('updateUsers', context.state.users);
|
||||||
context.commit('updateUsers', frontendUsers(response.data.data));
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
//获取动物数据
|
//获取动物数据
|
||||||
getAnimals(context) {
|
getAnimals(context) {
|
||||||
console.log('getAnimals')
|
console.log('getAnimals')
|
||||||
// 通过后端获取数据
|
// 通过后端获取数据
|
||||||
request.queryAnimalRequest().then(response => {
|
// context.commit('updateAnimals', generateAnimals())
|
||||||
if (response.data.code === 1) {
|
context.commit('updateAnimals', context.state.animals);
|
||||||
context.commit('updateAnimals', frontendAnimals(response.data.data));
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
//获取饲养计划
|
//获取饲养计划
|
||||||
getBreedingPlans(context) {
|
getBreedingPlans(context) {
|
||||||
console.log('getBreedingPlans')
|
console.log('getBreedingPlans')
|
||||||
// 通过后端获取数据
|
// 通过后端获取数据
|
||||||
request.queryBreedingPlanRequest().then(response => {
|
// context.commit('updateBreedingPlans',generateBreedingPlans())
|
||||||
if (response.data.code === 1) {
|
context.commit('updateBreedingPlans',context.state.breedingPlans);
|
||||||
context.commit('updateBreedingPlans',frontendBreedingPlans(response.data.data));
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
//获取动物档案
|
//获取动物档案
|
||||||
getArchives(context) {
|
getArchives(context) {
|
||||||
console.log('getArchives')
|
console.log('getArchives')
|
||||||
// 通过后端获取数据
|
// 通过后端获取数据
|
||||||
request.queryArchiveRequest().then(response => {
|
// context.commit('updateArchives', generateArchives())
|
||||||
if (response.data.code === 1) {
|
context.commit('updateArchives',context.state.archives);
|
||||||
context.commit('updateArchives',frontendArchives(response.data.data));
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
//获取监控检测数据
|
//获取监控检测数据
|
||||||
getHealths(context) {
|
getHealths(context) {
|
||||||
console.log('getHealths')
|
console.log('getHealths')
|
||||||
// 通过后端获取数据
|
// 通过后端获取数据
|
||||||
request.queryHealthRequest().then(response => {
|
// context.commit('updateHealths', generateHealths())
|
||||||
if (response.data.code === 1) {
|
context.commit('updateHealths',context.state.healths);
|
||||||
context.commit('updateHealths',frontendHealths(response.data.data));
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,9 +118,17 @@ const state = {
|
|||||||
//登录用户数据
|
//登录用户数据
|
||||||
loginUser: {
|
loginUser: {
|
||||||
id:0,
|
id:0,
|
||||||
username: '',
|
username: 'user1',
|
||||||
auth: 0
|
auth: 0
|
||||||
},
|
},
|
||||||
|
// //用户数据
|
||||||
|
// users: [],
|
||||||
|
// //动物数据
|
||||||
|
// animals: [],
|
||||||
|
// //饲养计划
|
||||||
|
// breedingPlans:[],
|
||||||
|
// //动物档案
|
||||||
|
// archives:[],
|
||||||
//用户数据
|
//用户数据
|
||||||
users: [],
|
users: [],
|
||||||
usersTableData:[],//用户表格数据
|
usersTableData:[],//用户表格数据
|
||||||
@ -147,37 +146,8 @@ const state = {
|
|||||||
healthsTableData:[],//健康检测表格数据
|
healthsTableData:[],//健康检测表格数据
|
||||||
}
|
}
|
||||||
|
|
||||||
const getters = {
|
|
||||||
getKeepers() {
|
|
||||||
const k = []
|
|
||||||
state.users.forEach(user => {
|
|
||||||
if (user.auth === 1){
|
|
||||||
k.push(copy(user))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return k;
|
|
||||||
},
|
|
||||||
getAllSpecies() {
|
|
||||||
const set = new Set
|
|
||||||
state.animals.forEach(e => {
|
|
||||||
set.add(e.species)
|
|
||||||
})
|
|
||||||
return set
|
|
||||||
},
|
|
||||||
getKeepersAndVeterinary() {
|
|
||||||
const ka = []
|
|
||||||
state.users.forEach(user => {
|
|
||||||
if (user.auth === 1 || user.auth === 2){
|
|
||||||
ka.push(copy(user))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return ka
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default createStore({
|
export default createStore({
|
||||||
actions,
|
actions,
|
||||||
mutations,
|
mutations,
|
||||||
state,
|
state
|
||||||
getters
|
|
||||||
})
|
})
|
@ -1,30 +1,20 @@
|
|||||||
//生成用户数据
|
//生成用户数据
|
||||||
import store from "@/store/index.js";
|
import store from "@/store/index.js";
|
||||||
import request from "@/utils/request.js";
|
|
||||||
|
|
||||||
export function refreshData() {
|
|
||||||
store.dispatch('getUsers');
|
|
||||||
store.dispatch('getAnimals');
|
|
||||||
store.dispatch('getBreedingPlans');
|
|
||||||
store.dispatch('getArchives');
|
|
||||||
store.dispatch('getHealths');
|
|
||||||
}
|
|
||||||
|
|
||||||
// 生成用户数据
|
// 生成用户数据
|
||||||
export function generateUsers() {
|
export function generateUsers() {
|
||||||
const users = []
|
const users = []
|
||||||
// 随机生成20-40条用户数据
|
// 随机生成40-100条用户数据
|
||||||
const n = Math.floor(Math.random() * 20) + 20;
|
const n = Math.floor(Math.random() * 60) + 40;
|
||||||
for (let i = 0; i < n; i++) {
|
for (let i = 0; i < n; i++) {
|
||||||
const a = generateAuth()
|
const a = generateAuth()
|
||||||
let user = {
|
let user = {
|
||||||
id: i + 2,
|
id: i,
|
||||||
username: 'user' + (i + 2),
|
username: 'user' + (i + 1),
|
||||||
password: '123456',
|
password: '123456',
|
||||||
auth: a,
|
auth: a,
|
||||||
}
|
}
|
||||||
users.push(user)
|
users.push(user)
|
||||||
request.addUserRequest(user)
|
|
||||||
if (a === 1) {
|
if (a === 1) {
|
||||||
keeper.push(user)
|
keeper.push(user)
|
||||||
} else if (a === 2) {
|
} else if (a === 2) {
|
||||||
@ -52,11 +42,11 @@ function generateAuth() {
|
|||||||
//生成动物数据
|
//生成动物数据
|
||||||
export function generateAnimals() {
|
export function generateAnimals() {
|
||||||
const animals = []
|
const animals = []
|
||||||
//随机生成40-60只动物
|
//随机生成100-200只动物
|
||||||
const n = Math.floor(Math.random() * 20) + 40;
|
const n = Math.floor(Math.random() * 100) + 100;
|
||||||
for (let i = 0; i < n; i++) {
|
for (let i = 0; i < n; i++) {
|
||||||
let animal = {
|
let animal = {
|
||||||
id: i + 3,
|
id: i,
|
||||||
name: 'animal' + (i + 1),
|
name: 'animal' + (i + 1),
|
||||||
sex: Math.floor(Math.random() * 2) === 0 ? '雌性' : '雄性',
|
sex: Math.floor(Math.random() * 2) === 0 ? '雌性' : '雄性',
|
||||||
species: '种类' + Math.ceil(Math.random() * 20).toString(),//种类
|
species: '种类' + Math.ceil(Math.random() * 20).toString(),//种类
|
||||||
@ -68,11 +58,9 @@ export function generateAnimals() {
|
|||||||
features: 'test animal' + (i + 1) + ' features',//特征
|
features: 'test animal' + (i + 1) + ' features',//特征
|
||||||
phase: generatePhase()
|
phase: generatePhase()
|
||||||
}
|
}
|
||||||
request.addAnimalRequest(animal)
|
|
||||||
animals.push(animal)
|
animals.push(animal)
|
||||||
}
|
}
|
||||||
console.log('动物', animals)
|
console.log('动物', animals)
|
||||||
store.state.animals = animals
|
|
||||||
return animals
|
return animals
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,8 +129,8 @@ function generateNewColor() {
|
|||||||
export function generateBreedingPlans() {
|
export function generateBreedingPlans() {
|
||||||
const breedingPlans = []
|
const breedingPlans = []
|
||||||
|
|
||||||
//随机生成5种类动物的饲养计划
|
//随机生成20种类动物的饲养计划
|
||||||
const n = 5;
|
const n = 20;
|
||||||
for (let i = 0; i < n; i++) {
|
for (let i = 0; i < n; i++) {
|
||||||
//分别生成2种性别的
|
//分别生成2种性别的
|
||||||
for (let j = 0; j < 2; j++) {
|
for (let j = 0; j < 2; j++) {
|
||||||
@ -151,7 +139,7 @@ export function generateBreedingPlans() {
|
|||||||
//分别生成2种状态的
|
//分别生成2种状态的
|
||||||
for (let l = 0; l < 2; l++) {
|
for (let l = 0; l < 2; l++) {
|
||||||
let breedingPlan = {
|
let breedingPlan = {
|
||||||
// id: i + '' + j + '' + k + '' + l,
|
id: i + '' + j + '' + k + '' + l,
|
||||||
name: 'breeding' + (i + 1),
|
name: 'breeding' + (i + 1),
|
||||||
species: '种类' + i.toString(),
|
species: '种类' + i.toString(),
|
||||||
sex: j === 0 ? '雌性' : '雄性',
|
sex: j === 0 ? '雌性' : '雄性',
|
||||||
@ -160,7 +148,6 @@ export function generateBreedingPlans() {
|
|||||||
roleId: generateKeeperId(),
|
roleId: generateKeeperId(),
|
||||||
description: 'test breeding' + i + '' + j + '' + k + '' + l + ' description',
|
description: 'test breeding' + i + '' + j + '' + k + '' + l + ' description',
|
||||||
}
|
}
|
||||||
request.addBreedingPlanRequest(breedingPlan)
|
|
||||||
breedingPlans.push(breedingPlan)
|
breedingPlans.push(breedingPlan)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -184,30 +171,30 @@ function generatePhase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//生成档案
|
//生成档案
|
||||||
export async function generateArchives() {
|
export function generateArchives() {
|
||||||
const archives = []
|
const archives = []
|
||||||
|
|
||||||
let aid = 0
|
let aid=0
|
||||||
for (const e of store.state.animals) {
|
store.state.animals.forEach(e => {
|
||||||
//分为四个周期的档案
|
//分为四个周期的档案
|
||||||
for (let i = 0; i < 4; i++) {
|
for (let i = 0; i < 4; i++) {
|
||||||
let n;
|
let n;
|
||||||
if (i === 0) {
|
if (i === 0) {
|
||||||
//幼年期5条档案
|
//幼年期5-10条档案
|
||||||
n = 5
|
n = Math.floor(Math.random() * 5) + 5
|
||||||
} else if (i === 1) {
|
} else if (i === 1) {
|
||||||
//成长期10条档案
|
//成长期10-20条档案
|
||||||
n = 10
|
n = Math.floor(Math.random() * 10) + 10
|
||||||
} else if (i === 2) {
|
} else if (i === 2) {
|
||||||
//成年期30条档案
|
//成年期30-60条档案
|
||||||
n = 30
|
n = Math.floor(Math.random() * 30) + 30
|
||||||
} else {
|
} else {
|
||||||
//老年期5条档案
|
//老年期5-10条档案
|
||||||
n = 5
|
n = Math.floor(Math.random() * 5) + 5
|
||||||
}
|
}
|
||||||
for (let j = 0; j < n; j++) {
|
for (let j = 0; j < n; j++) {
|
||||||
let archive = {
|
let archive = {
|
||||||
// id: aid,//档案号
|
id: aid,//档案号
|
||||||
animalId: e.id,//该档案记录的动物id
|
animalId: e.id,//该档案记录的动物id
|
||||||
animalName: e.name,//该档案记录的动物名称
|
animalName: e.name,//该档案记录的动物名称
|
||||||
phase: i === 0 ? '幼年期' : i === 1 ? '成长期' : i === 2 ? '成年期' : '老年期',
|
phase: i === 0 ? '幼年期' : i === 1 ? '成长期' : i === 2 ? '成年期' : '老年期',
|
||||||
@ -218,17 +205,16 @@ export async function generateArchives() {
|
|||||||
roleId: generateVeterinaryId(),//负责录入档案的人的id,身份不限
|
roleId: generateVeterinaryId(),//负责录入档案的人的id,身份不限
|
||||||
description: 'test archive' + i + '' + j + ' description',
|
description: 'test archive' + i + '' + j + ' description',
|
||||||
}
|
}
|
||||||
request.addArchiveRequest(archive)
|
|
||||||
archives.push(archive)
|
archives.push(archive)
|
||||||
|
|
||||||
//同时获取一条健康记录
|
//同时获取一条健康记录
|
||||||
let health = {
|
let health = {
|
||||||
// id: aid,//int 健康检测数据号
|
id: aid,//int 健康检测数据号
|
||||||
animalId: archive.animalId,//int 记录的动物id
|
animalId: archive.animalId,//int 记录的动物id
|
||||||
animalName: archive.animalName,//字符 记录的动物名称
|
animalName: archive.animalName,//字符 记录的动物名称
|
||||||
state: archive.state,//int 动物状态 0正常,1异常
|
state: archive.state,//int 动物状态 0正常,1异常
|
||||||
temperature: Number((35 + Math.random() * 7).toFixed(1)),//double 体温
|
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 心跳频率
|
heartRate: Math.floor(Math.random() * 130) + 10,//int 心跳频率
|
||||||
bloodPressure: Math.floor(Math.random() * 110) + 70,//int // 血压
|
bloodPressure: Math.floor(Math.random() * 110) + 70,//int // 血压
|
||||||
date: archive.date,//字符 记录日期
|
date: archive.date,//字符 记录日期
|
||||||
@ -236,35 +222,28 @@ export async function generateArchives() {
|
|||||||
description: 'test health' + i + '' + j + ' description',//字符 检测的描述,比如动物的症状
|
description: 'test health' + i + '' + j + ' description',//字符 检测的描述,比如动物的症状
|
||||||
}
|
}
|
||||||
//异常的记录要修改一下监测数据
|
//异常的记录要修改一下监测数据
|
||||||
if (health.state === 1) {
|
if (health.state===1){
|
||||||
health.temperature += Math.random() * 2 > 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)):
|
||||||
-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.temperature = Number(health.temperature.toFixed(1))
|
||||||
health.breathRate += Math.random() * 2 > 1 ?
|
health.breathRate += Math.random()*2>1?
|
||||||
Math.floor(Math.random() * health.breathRate * 0.5) : -Math.floor(Math.random() * health.breathRate * 0.5)
|
Math.floor(Math.random()*health.breathRate*0.5):-Math.floor(Math.random()*health.breathRate*0.5)
|
||||||
health.heartRate += health.heartRate += Math.random() * 2 > 1 ?
|
health.heartRate += health.heartRate += Math.random()*2>1?
|
||||||
Math.floor(Math.random() * health.heartRate * 0.5) : -Math.floor(Math.random() * health.heartRate * 0.5)
|
Math.floor(Math.random()*health.heartRate*0.5):-Math.floor(Math.random()*health.heartRate*0.5)
|
||||||
health.bloodPressure += health.bloodPressure += Math.random() * 2 > 1 ?
|
health.bloodPressure += health.bloodPressure += Math.random()*2>1?
|
||||||
Math.floor(Math.random() * health.bloodPressure * 0.5) : -Math.floor(Math.random() * health.bloodPressure * 0.5)
|
Math.floor(Math.random()*health.bloodPressure*0.5):-Math.floor(Math.random()*health.bloodPressure*0.5)
|
||||||
|
|
||||||
}
|
}
|
||||||
request.addHealthRequest(health)
|
|
||||||
healths.push(health)
|
healths.push(health)
|
||||||
aid++
|
aid++
|
||||||
await sleep(50)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
console.log('档案', archives)
|
console.log('档案', archives)
|
||||||
return archives
|
return archives
|
||||||
}
|
}
|
||||||
|
|
||||||
function sleep(time){
|
|
||||||
return new Promise((resolve) => setTimeout(resolve, time));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const healths = []
|
const healths = []
|
||||||
|
|
||||||
export function generateHealths() {
|
export function generateHealths() {
|
||||||
@ -311,7 +290,7 @@ export function hidePassword(event) {
|
|||||||
export function splitKeyWords(keyword) {
|
export function splitKeyWords(keyword) {
|
||||||
let keyset = keyword.split(' ')//提取关键字
|
let keyset = keyword.split(' ')//提取关键字
|
||||||
keyset = Array.from(new Set(keyset))//关键字去重
|
keyset = Array.from(new Set(keyset))//关键字去重
|
||||||
// console.log('切割去重好的关键字', keyset)
|
console.log('切割去重好的关键字', keyset)
|
||||||
|
|
||||||
return keyset;
|
return keyset;
|
||||||
}
|
}
|
||||||
@ -328,7 +307,7 @@ export function fuzzyMatching(object, keyset) {
|
|||||||
function keywordMatching(object, keyword) {
|
function keywordMatching(object, keyword) {
|
||||||
//该关键字为空,肯定能匹配上
|
//该关键字为空,肯定能匹配上
|
||||||
if (keyword === '') {
|
if (keyword === '') {
|
||||||
// console.log('keywordMatching关键字为空', object, keyword, true)
|
console.log('keywordMatching关键字为空', object, keyword, true)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
//只要对象的任意属性能匹配一次关键字就返回true,some():遇到true就返回true,所有false就返回false
|
//只要对象的任意属性能匹配一次关键字就返回true,some():遇到true就返回true,所有false就返回false
|
||||||
|
@ -1,278 +1,7 @@
|
|||||||
import axios from "axios";
|
import store from "@/store/index.js";
|
||||||
|
|
||||||
const instance = axios.create({
|
export function getUserById(id) {
|
||||||
// baseURL : `${window.location.origin}/api/zoo`,
|
const data = store.state.users.find(e => e.id === id);
|
||||||
baseURL : `${window.location.origin}/api/zoo`,
|
|
||||||
})
|
|
||||||
|
|
||||||
export default {
|
return data;
|
||||||
login(form) {
|
|
||||||
const formData = new FormData();
|
|
||||||
formData.append('username', form.username);
|
|
||||||
formData.append('password', form.password);
|
|
||||||
return instance.post("/login/login", formData);
|
|
||||||
},
|
|
||||||
|
|
||||||
//用户请求
|
|
||||||
addUserRequest(user) {
|
|
||||||
return instance.post("/account/save", backendUser(user));
|
|
||||||
},
|
|
||||||
deleteUserRequest(id) {
|
|
||||||
return instance.get("/account/delete", {params: {id}});
|
|
||||||
},
|
|
||||||
updateUserRequest(user) {
|
|
||||||
return instance.post("/account/update", backendUser(user));
|
|
||||||
},
|
|
||||||
queryUserRequest(username) {
|
|
||||||
return instance.get("/account/info", {params: {username}})
|
|
||||||
},
|
|
||||||
|
|
||||||
//动物请求
|
|
||||||
addAnimalRequest(animal) {
|
|
||||||
return instance.post("/animal/add", backendAnimal(animal));
|
|
||||||
},
|
|
||||||
deleteAnimalRequest(aid) {
|
|
||||||
return instance.get("/animal/delete", {params: {aid}});
|
|
||||||
},
|
|
||||||
updateAnimalRequest(animal) {
|
|
||||||
return instance.post("/animal/update", backendAnimal(animal));
|
|
||||||
},
|
|
||||||
queryAnimalRequest(aid) {
|
|
||||||
return instance.get("/animal/info", {params: {aid}})
|
|
||||||
},
|
|
||||||
|
|
||||||
//饲养计划请求
|
|
||||||
addBreedingPlanRequest(breedingPlan) {
|
|
||||||
return instance.post("/plan/add", backendBreeding(breedingPlan));
|
|
||||||
},
|
|
||||||
deleteBreedingPlanRequest(id) {
|
|
||||||
return instance.get("/plan/delete", {params: {id}})
|
|
||||||
},
|
|
||||||
updateBreedingPlanRequest(breedingPlan) {
|
|
||||||
return instance.post("/plan/update", backendBreeding(breedingPlan));
|
|
||||||
},
|
|
||||||
queryBreedingPlanRequest(id) {
|
|
||||||
return instance.get("/plan/info", {params: {id}})
|
|
||||||
},
|
|
||||||
|
|
||||||
//档案请求
|
|
||||||
addArchiveRequest(archive) {
|
|
||||||
return instance.post("/archive/add", backendArchive(archive));
|
|
||||||
},
|
|
||||||
deleteArchiveRequest(id) {
|
|
||||||
return instance.get("/archive/delete", {params: {id}})
|
|
||||||
},
|
|
||||||
updateArchiveRequest(archive) {
|
|
||||||
return instance.post("/archive/update", backendArchive(archive));
|
|
||||||
},
|
|
||||||
queryArchiveRequest(id, animallId) {
|
|
||||||
return instance.get("/archive/info", {params: {id, animallId}})
|
|
||||||
},
|
|
||||||
queryArchiveByBreedingId(breedingId) {
|
|
||||||
return instance.get("/archive/selectByBreedingId", {params: {breedingId}})
|
|
||||||
},
|
|
||||||
|
|
||||||
//健康记录请求
|
|
||||||
addHealthRequest(health) {
|
|
||||||
return instance.post("/health/add", backendHealth(health));
|
|
||||||
},
|
|
||||||
deleteHealthRequest(id) {
|
|
||||||
return instance.get("/health/delete", {params: {id}})
|
|
||||||
},
|
|
||||||
updateHealthRequest(health) {
|
|
||||||
return instance.post("/health/update", backendHealth(health));
|
|
||||||
},
|
|
||||||
queryHealthRequest(id,animalId) {
|
|
||||||
return instance.get("/health/info", {params: {id,animalId}})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 将后端对象转化为符合前端需求的对象
|
|
||||||
export function frontendLoginUser(data) {
|
|
||||||
return {
|
|
||||||
id: data.id,
|
|
||||||
username: data.username,
|
|
||||||
auth: data.permissions
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function frontendUsers(users) {
|
|
||||||
const newUsers = []
|
|
||||||
users.forEach(user => {
|
|
||||||
newUsers.push(frontendUser(user));
|
|
||||||
})
|
|
||||||
return newUsers
|
|
||||||
}
|
|
||||||
|
|
||||||
export function frontendUser(user) {
|
|
||||||
return {
|
|
||||||
id: user.id,
|
|
||||||
username: user.username,
|
|
||||||
password: user.password,
|
|
||||||
auth: user.permissions
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function frontendAnimals(animals) {
|
|
||||||
const newAnimals = []
|
|
||||||
animals.forEach((element) => {
|
|
||||||
newAnimals.push(frontendAnimal(element))
|
|
||||||
})
|
|
||||||
return newAnimals
|
|
||||||
}
|
|
||||||
|
|
||||||
export function frontendAnimal(animal) {
|
|
||||||
return {
|
|
||||||
id: animal.aId,
|
|
||||||
name: animal.name,
|
|
||||||
sex: animal.sex,
|
|
||||||
species: animal.species,//种类
|
|
||||||
weight: animal.weight,
|
|
||||||
height: animal.height,
|
|
||||||
state: animal.state,//状态(0正常 1异常)
|
|
||||||
roleId: animal.roleid,//饲养员id
|
|
||||||
color: animal.color,//颜色
|
|
||||||
features: animal.features,//特征
|
|
||||||
phase: animal.phase//生长阶段
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function frontendBreedingPlans(breedings) {
|
|
||||||
const newBreedingPlans = []
|
|
||||||
breedings.forEach(breedingPlan => {
|
|
||||||
newBreedingPlans.push(frontendBreeding(breedingPlan))
|
|
||||||
})
|
|
||||||
return newBreedingPlans
|
|
||||||
}
|
|
||||||
|
|
||||||
export function frontendBreeding(breeding) {
|
|
||||||
return {
|
|
||||||
id: breeding.id,
|
|
||||||
name: breeding.name,
|
|
||||||
species: breeding.species,
|
|
||||||
sex: breeding.sex,
|
|
||||||
phase: breeding.phase,
|
|
||||||
state: breeding.state,
|
|
||||||
roleId: breeding.roleid,
|
|
||||||
description: breeding.describe1,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function frontendArchives(archives) {
|
|
||||||
const newArchives = []
|
|
||||||
archives.forEach(a => {
|
|
||||||
newArchives.push(frontendArchive(a))
|
|
||||||
})
|
|
||||||
return newArchives
|
|
||||||
}
|
|
||||||
|
|
||||||
export function frontendArchive(archive) {
|
|
||||||
return {
|
|
||||||
id: archive.id,
|
|
||||||
animalId: archive.animallId,
|
|
||||||
animalName: archive.animalName,
|
|
||||||
phase: archive.phase,
|
|
||||||
state: archive.state,
|
|
||||||
type: archive.type,
|
|
||||||
date: archive.date,
|
|
||||||
time: archive.time,
|
|
||||||
roleId: archive.roleId,
|
|
||||||
description: archive.description,
|
|
||||||
breedingId:archive.breedingId
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function frontendHealths(healths) {
|
|
||||||
const newHealths = []
|
|
||||||
healths.forEach(h => {
|
|
||||||
newHealths.push(frontendHealth(h))
|
|
||||||
})
|
|
||||||
return newHealths
|
|
||||||
}
|
|
||||||
|
|
||||||
export function frontendHealth(health) {
|
|
||||||
return {
|
|
||||||
id: health.id,
|
|
||||||
animalId: health.animalId,
|
|
||||||
animalName: health.animalName,
|
|
||||||
state: health.state,
|
|
||||||
temperature: health.temperature,
|
|
||||||
breathRate: health.breathRete,
|
|
||||||
heartRate: health.heartRete,
|
|
||||||
bloodPressure: health.bloodPressure,
|
|
||||||
date: health.date,
|
|
||||||
time: health.time,
|
|
||||||
description: health.description
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 将前端对象的属性转为能和后端对应上属性的对象
|
|
||||||
export function backendUser(user) {
|
|
||||||
return {
|
|
||||||
id: user.id,
|
|
||||||
username: user.username,
|
|
||||||
password: user.password,
|
|
||||||
permissions: user.auth
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function backendAnimal(animal) {
|
|
||||||
return {
|
|
||||||
aId: animal.id,
|
|
||||||
name: animal.name,
|
|
||||||
sex: animal.sex,
|
|
||||||
species: animal.species,
|
|
||||||
weight: animal.weight,
|
|
||||||
height: animal.height,
|
|
||||||
state: animal.state,
|
|
||||||
roleid: animal.roleId,
|
|
||||||
color: animal.color,
|
|
||||||
features: animal.features,
|
|
||||||
phase: animal.phase
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function backendBreeding(breeding) {
|
|
||||||
return {
|
|
||||||
id: breeding.id,
|
|
||||||
name: breeding.name,
|
|
||||||
species: breeding.species,
|
|
||||||
sex: breeding.sex,
|
|
||||||
phase: breeding.phase,
|
|
||||||
state: breeding.state,
|
|
||||||
roleid: breeding.roleId,
|
|
||||||
describe1: breeding.description,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function backendArchive(archive) {
|
|
||||||
return {
|
|
||||||
id: archive.id,
|
|
||||||
animallId: archive.animalId,
|
|
||||||
animalName: archive.animalName,
|
|
||||||
phase: archive.phase,
|
|
||||||
state: archive.state,
|
|
||||||
type: archive.type,
|
|
||||||
date: archive.date,
|
|
||||||
time: archive.time,
|
|
||||||
roleId: archive.roleId,
|
|
||||||
description: archive.description,
|
|
||||||
breedingId:archive.breedingId
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function backendHealth(health) {
|
|
||||||
return {
|
|
||||||
id: health.id,
|
|
||||||
animalId: health.animalId,
|
|
||||||
animalName: health.animalName,
|
|
||||||
state: health.state,
|
|
||||||
temperature: health.temperature,
|
|
||||||
breathRete: health.breathRate,
|
|
||||||
heartRete: health.heartRate,
|
|
||||||
bloodPressure: health.bloodPressure,
|
|
||||||
date: health.date,
|
|
||||||
time: health.time,
|
|
||||||
description: health.description
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,35 +1,26 @@
|
|||||||
import {fileURLToPath, URL} from 'node:url'
|
import { fileURLToPath, URL } from 'node:url'
|
||||||
|
|
||||||
import {defineConfig} from 'vite'
|
import { defineConfig } from 'vite'
|
||||||
import vue from '@vitejs/plugin-vue'
|
import vue from '@vitejs/plugin-vue'
|
||||||
|
|
||||||
import AutoImport from 'unplugin-auto-import/vite'
|
import AutoImport from 'unplugin-auto-import/vite'
|
||||||
import Components from 'unplugin-vue-components/vite'
|
import Components from 'unplugin-vue-components/vite'
|
||||||
import {ElementPlusResolver} from 'unplugin-vue-components/resolvers'
|
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [
|
plugins: [
|
||||||
vue(),
|
vue(),
|
||||||
AutoImport({
|
AutoImport({
|
||||||
resolvers: [ElementPlusResolver()],
|
resolvers: [ElementPlusResolver()],
|
||||||
}),
|
}),
|
||||||
Components({
|
Components({
|
||||||
resolvers: [ElementPlusResolver()],
|
resolvers: [ElementPlusResolver()],
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'@': fileURLToPath(new URL('./src', import.meta.url))
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
server: {
|
|
||||||
port: 5000,
|
|
||||||
proxy: {
|
|
||||||
'/api': {
|
|
||||||
target: 'http://localhost:8888',
|
|
||||||
rewrite: (path) => path.replace(/^\/api/, '')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user