From 144f5ea091329f04149598f7903dc5f7dbfb3c08 Mon Sep 17 00:00:00 2001
From: piaobo <1913856125@qq.com>
Date: Wed, 20 Aug 2025 11:11:18 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E6=AF=92=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/biosafety/disease/index.vue | 7 +-
src/views/biosafety/disinfect/index.vue | 104 ++++++++++++++-------
src/views/biosafety/prescription/index.vue | 6 +-
3 files changed, 78 insertions(+), 39 deletions(-)
diff --git a/src/views/biosafety/disease/index.vue b/src/views/biosafety/disease/index.vue
index 0138522..28a3979 100644
--- a/src/views/biosafety/disease/index.vue
+++ b/src/views/biosafety/disease/index.vue
@@ -82,6 +82,7 @@ const title = ref("")
const isExpandAll = ref(true)
const refreshTable = ref(true)
+
const data = reactive({
form: {},
queryParams: {
@@ -99,6 +100,7 @@ const { queryParams, form, rules } = toRefs(data)
function getList() {
loading.value = true
listDisease(queryParams.value).then(response => {
+
diseaseList.value = proxy.handleTree(response.data, "id", "pid")
loading.value = false
})
@@ -107,10 +109,7 @@ function getList() {
/** 查询疾病下拉树结构 */
function getTreeselect() {
listDisease().then(response => {
- diseaseOptions.value = []
- const data = { id: 0, name: '疾病', children: [] }
- data.children = proxy.handleTree(response.data, "id", "pid")
- diseaseOptions.value.push(data)
+ diseaseOptions.value = response.data.filter(item => item.pid === 0)
})
}
diff --git a/src/views/biosafety/disinfect/index.vue b/src/views/biosafety/disinfect/index.vue
index fe5cabe..fda59c7 100644
--- a/src/views/biosafety/disinfect/index.vue
+++ b/src/views/biosafety/disinfect/index.vue
@@ -2,17 +2,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
@@ -34,13 +43,21 @@
-
- {{ parseTime(scope.row.datetime, '{y}-{m}-{d}') }}
+
+
+ {{ parseTime(scope.row.datetime, '{y}-{m}-{d} {h}:{i}') }}
+
+
-
+
+
+
+
+
+
@@ -66,8 +83,10 @@
+
-
+
@@ -82,7 +101,7 @@
-
+
@@ -90,8 +109,10 @@
-
-
+
+
+
+
@@ -169,8 +190,10 @@
+
-
+
@@ -186,7 +209,9 @@
-
+
+
+
@@ -214,14 +239,14 @@
-
+
-
+
@@ -267,8 +292,9 @@ import request from '@/utils/request'
import { parseTime } from '@/utils/ruoyi'
const { proxy } = getCurrentInstance()
+const { disinfect_type } = proxy.useDict('disinfect_type')
-/* ------------------ 列表 ------------------ */
+/* ---------- 列表 ---------- */
const loading = ref(true)
const showSearch = ref(true)
const total = ref(0)
@@ -318,13 +344,25 @@ function resetQuery() {
handleQuery()
}
-/* ------------------ 新增弹窗 ------------------ */
+/* ---------- 新增弹窗 ---------- */
const openAdd = ref(false)
const titleAdd = ref('新增消毒记录')
+
+// 5️⃣ 默认当前分钟
+const nowMinute = () => {
+ const d = new Date()
+ const Y = d.getFullYear()
+ const M = String(d.getMonth() + 1).padStart(2, '0')
+ const D = String(d.getDate()).padStart(2, '0')
+ const h = String(d.getHours()).padStart(2, '0')
+ const m = String(d.getMinutes()).padStart(2, '0')
+ return `${Y}-${M}-${D} ${h}:${m}`
+}
+
const form = reactive({
id: null,
technician: '',
- datetime: new Date().toISOString().split('T')[0],
+ datetime: nowMinute(), // 精确到分钟
way: '',
ratio: '',
comment: '',
@@ -337,7 +375,7 @@ function resetAdd() {
Object.assign(form, {
id: null,
technician: '',
- datetime: new Date().toISOString().split('T')[0],
+ datetime: nowMinute(),
way: '',
ratio: '',
comment: '',
@@ -372,13 +410,13 @@ function submitAdd() {
})
}
-/* ------------------ 修改弹窗 ------------------ */
+/* ---------- 修改弹窗 ---------- */
const openEdit = ref(false)
const titleEdit = ref('修改消毒记录')
const editForm = reactive({
id: null,
technician: '',
- datetime: new Date().toISOString().split('T')[0],
+ datetime: nowMinute(),
way: '',
ratio: '',
comment: '',
@@ -391,7 +429,7 @@ function resetEdit() {
Object.assign(editForm, {
id: null,
technician: '',
- datetime: new Date().toISOString().split('T')[0],
+ datetime: nowMinute(),
way: '',
ratio: '',
comment: '',
@@ -405,6 +443,8 @@ function handleUpdate(row) {
resetEdit()
const id = row.id || ids.value[0]
getDisinfect(id).then(res => {
+ // 后端返回的是时间戳,转成 YYYY-MM-DD HH:mm 字符串方便 el-date-picker 回显
+ editForm.datetime = parseTime(res.data.datetime, '{y}-{m}-{d} {h}:{i}')
Object.assign(editForm, res.data)
editDetails.value = res.data.usageDetails || []
openEdit.value = true
@@ -431,7 +471,7 @@ function submitEdit() {
})
}
-/* ------------------ 功能 ------------------ */
+/* ---------- 功能 ---------- */
function handleDelete(row) {
const _ids = row.id || ids.value
proxy.$modal.confirm('是否确认删除选中的数据?').then(() => delDisinfect(_ids)).then(() => {
@@ -444,7 +484,7 @@ function handleExport() {
proxy.download('biosafety/disinfect/export', { ...queryParams }, `disinfect_${Date.now()}.xlsx`)
}
-/* ------------------ 下拉数据 ------------------ */
+/* ---------- 下拉数据 ---------- */
const barns = ref([])
const presOptions = ref([])
const units = ref([])
@@ -454,10 +494,12 @@ const medicines = ref([])
/* 校验规则 */
const rules = {
sheepfoldIds: [{ required: true, message: '请选择羊舍', trigger: 'change' }],
+ technician: [{ required: true, message: '请输入技术员', trigger: 'blur' }],
+ way: [{ required: true, message: '请选择消毒方式', trigger: 'change' }],
datetime: [{ required: true, message: '请选择日期', trigger: 'change' }]
}
-/* 处方选择事件 - 新增 */
+/* 处方选择事件 */
function handleSelectPrescription(id) {
if (!id) return
getPrescription(id).then(res => {
@@ -469,8 +511,6 @@ function handleSelectPrescription(id) {
})) || []
})
}
-
-/* 处方选择事件 - 修改 */
function handleSelectPrescriptionEdit(id) {
if (!id) return
getPrescription(id).then(res => {
@@ -483,20 +523,18 @@ function handleSelectPrescriptionEdit(id) {
})
}
-/* 明细添加行 - 新增 */
+/* 明细添加行 */
function handleAddDetail() {
usageDetails.value.push({ mediId: null, dosage: 0, unit: null, usageId: null, manufacturer: null, batchNumber: null })
}
-
-/* 明细添加行 - 修改 */
function handleAddDetailEdit() {
editDetails.value.push({ mediId: null, dosage: 0, unit: null, usageId: null, manufacturer: null, batchNumber: null })
}
-/* ------------------ 初始加载 ------------------ */
+/* ---------- 初始加载 ---------- */
onMounted(() => {
getList()
- /* 加载本地羊舍 */
+ /* 本地羊舍下拉 */
request({ url: '/sheepfold_management/sheepfold_management/list', method: 'get' }).then(res => {
barns.value = res.rows
})
diff --git a/src/views/biosafety/prescription/index.vue b/src/views/biosafety/prescription/index.vue
index 82ac02e..c9c156f 100644
--- a/src/views/biosafety/prescription/index.vue
+++ b/src/views/biosafety/prescription/index.vue
@@ -51,17 +51,19 @@
+
-
+
详情
修改
- {{ scope.row.status?"禁用":"启用" }}
+ {{
+ scope.row.status?"禁用":"启用" }}
删除