消毒修改
This commit is contained in:
parent
5f289eaadb
commit
144f5ea091
@ -82,6 +82,7 @@ const title = ref("")
|
|||||||
const isExpandAll = ref(true)
|
const isExpandAll = ref(true)
|
||||||
const refreshTable = ref(true)
|
const refreshTable = ref(true)
|
||||||
|
|
||||||
|
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
form: {},
|
form: {},
|
||||||
queryParams: {
|
queryParams: {
|
||||||
@ -99,6 +100,7 @@ const { queryParams, form, rules } = toRefs(data)
|
|||||||
function getList() {
|
function getList() {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
listDisease(queryParams.value).then(response => {
|
listDisease(queryParams.value).then(response => {
|
||||||
|
|
||||||
diseaseList.value = proxy.handleTree(response.data, "id", "pid")
|
diseaseList.value = proxy.handleTree(response.data, "id", "pid")
|
||||||
loading.value = false
|
loading.value = false
|
||||||
})
|
})
|
||||||
@ -107,10 +109,7 @@ function getList() {
|
|||||||
/** 查询疾病下拉树结构 */
|
/** 查询疾病下拉树结构 */
|
||||||
function getTreeselect() {
|
function getTreeselect() {
|
||||||
listDisease().then(response => {
|
listDisease().then(response => {
|
||||||
diseaseOptions.value = []
|
diseaseOptions.value = response.data.filter(item => item.pid === 0)
|
||||||
const data = { id: 0, name: '疾病', children: [] }
|
|
||||||
data.children = proxy.handleTree(response.data, "id", "pid")
|
|
||||||
diseaseOptions.value.push(data)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,17 +2,26 @@
|
|||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<!-- 搜索栏 -->
|
<!-- 搜索栏 -->
|
||||||
<el-form :model="queryParams" ref="queryRef" inline v-show="showSearch" label-width="80px">
|
<el-form :model="queryParams" ref="queryRef" inline v-show="showSearch" label-width="80px">
|
||||||
|
<el-form-item label="消毒日期">
|
||||||
|
<!-- 1️⃣ 改为 datetimerange -->
|
||||||
|
<el-date-picker v-model="daterangeDatetime" type="datetimerange" range-separator="-" start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期" value-format="YYYY-MM-DD HH:mm" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="消毒方式" prop="way">
|
||||||
|
<el-select v-model="queryParams.way" clearable placeholder="请选择消毒方式" filterable style="width: 200px">
|
||||||
|
<el-option v-for="item in disinfect_type" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="药品名称" prop="mediName">
|
||||||
|
<el-input v-model="queryParams.mediName" placeholder="请输入药品" clearable />
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="羊舍" prop="sheepfoldId">
|
<el-form-item label="羊舍" prop="sheepfoldId">
|
||||||
<el-select v-model="queryParams.sheepfoldId" clearable placeholder="请选择羊舍" filterable style="width: 200px">
|
<el-select v-model="queryParams.sheepfoldId" clearable placeholder="请选择羊舍" filterable style="width: 200px">
|
||||||
<el-option v-for="b in barns" :key="b.id" :label="b.sheepfoldName" :value="b.id" />
|
<el-option v-for="b in barns" :key="b.id" :label="b.sheepfoldName" :value="b.id" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="消毒日期">
|
|
||||||
<el-date-picker v-model="daterangeDatetime" value-format="YYYY-MM-DD" type="daterange" range-separator="-"
|
|
||||||
start-placeholder="开始日期" end-placeholder="结束日期" />
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="技术员" prop="technician">
|
<el-form-item label="技术员" prop="technician">
|
||||||
<el-input v-model="queryParams.technician" placeholder="请输入技术员" clearable />
|
<el-input v-model="queryParams.technician" placeholder="请输入技术员" clearable />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -34,13 +43,21 @@
|
|||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<el-table v-loading="loading" :data="disinfectList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="disinfectList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="羊舍" align="center" prop="sheepfoldName" />
|
|
||||||
<el-table-column label="消毒日期" align="center" prop="datetime" width="180">
|
<el-table-column label="消毒日期" align="center" prop="datetime" width="180">
|
||||||
<template #default="scope">{{ parseTime(scope.row.datetime, '{y}-{m}-{d}') }}</template>
|
<!-- 2️⃣ 显示格式含时分 -->
|
||||||
|
<template #default="scope">
|
||||||
|
{{ parseTime(scope.row.datetime, '{y}-{m}-{d} {h}:{i}') }}
|
||||||
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="羊舍" align="center" prop="sheepfoldName" />
|
||||||
<el-table-column label="技术员" align="center" prop="technician" />
|
<el-table-column label="技术员" align="center" prop="technician" />
|
||||||
<el-table-column label="消毒方式" align="center" prop="way" />
|
<el-table-column label="消毒方式" align="center" prop="way">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options="disinfect_type" :value="scope.row.way" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="比例" align="center" prop="ratio" />
|
<el-table-column label="比例" align="center" prop="ratio" />
|
||||||
|
<el-table-column label="创建人" align="center" prop="createBy" />
|
||||||
<el-table-column label="备注" align="center" prop="comment" />
|
<el-table-column label="备注" align="center" prop="comment" />
|
||||||
<el-table-column label="操作" align="center" width="200">
|
<el-table-column label="操作" align="center" width="200">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
@ -66,8 +83,10 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
|
<!-- 3️⃣ type=datetime -->
|
||||||
<el-form-item label="消毒日期" prop="datetime">
|
<el-form-item label="消毒日期" prop="datetime">
|
||||||
<el-date-picker v-model="form.datetime" type="date" value-format="YYYY-MM-DD" style="width: 100%" />
|
<el-date-picker v-model="form.datetime" type="datetime" value-format="YYYY-MM-DD HH:mm"
|
||||||
|
style="width: 100%" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -82,7 +101,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="技术员">
|
<el-form-item label="技术员" prop="technician">
|
||||||
<el-input v-model="form.technician" placeholder="请输入技术员姓名" />
|
<el-input v-model="form.technician" placeholder="请输入技术员姓名" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -90,8 +109,10 @@
|
|||||||
|
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="消毒方式">
|
<el-form-item label="消毒方式" prop="way">
|
||||||
<el-input v-model="form.way" placeholder="请输入消毒方式" />
|
<el-select v-model="form.way" clearable placeholder="请选择消毒方式" filterable>
|
||||||
|
<el-option v-for="item in disinfect_type" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
@ -169,8 +190,10 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
|
<!-- 4️⃣ 同样 type=datetime -->
|
||||||
<el-form-item label="消毒日期" prop="datetime">
|
<el-form-item label="消毒日期" prop="datetime">
|
||||||
<el-date-picker v-model="editForm.datetime" type="date" value-format="YYYY-MM-DD" style="width: 100%" />
|
<el-date-picker v-model="editForm.datetime" type="datetime" value-format="YYYY-MM-DD HH:mm"
|
||||||
|
style="width: 100%" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -186,7 +209,9 @@
|
|||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="消毒方式">
|
<el-form-item label="消毒方式">
|
||||||
<el-input v-model="editForm.way" placeholder="请输入消毒方式" />
|
<el-select v-model="editForm.way" clearable placeholder="请选择消毒方式" filterable>
|
||||||
|
<el-option v-for="item in disinfect_type" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
@ -214,14 +239,14 @@
|
|||||||
<el-table-column label="单位" width="120">
|
<el-table-column label="单位" width="120">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-select v-model="scope.row.unit" placeholder="单位">
|
<el-select v-model="scope.row.unit" placeholder="单位">
|
||||||
<el-option v-for="u in units" :key="u.value" :label="u.label" :value="u.value" />
|
<el-option v-for="u in units" :key="u.value" :label="u.label" :value="u.value+''" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="用法" width="120">
|
<el-table-column label="用法" width="120">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-select v-model="scope.row.usageId" placeholder="用法">
|
<el-select v-model="scope.row.usageId" placeholder="用法">
|
||||||
<el-option v-for="u in usages" :key="u.value" :label="u.label" :value="u.value" />
|
<el-option v-for="u in usages" :key="u.value" :label="u.label" :value="u.value+''" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@ -267,8 +292,9 @@ import request from '@/utils/request'
|
|||||||
import { parseTime } from '@/utils/ruoyi'
|
import { parseTime } from '@/utils/ruoyi'
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance()
|
const { proxy } = getCurrentInstance()
|
||||||
|
const { disinfect_type } = proxy.useDict('disinfect_type')
|
||||||
|
|
||||||
/* ------------------ 列表 ------------------ */
|
/* ---------- 列表 ---------- */
|
||||||
const loading = ref(true)
|
const loading = ref(true)
|
||||||
const showSearch = ref(true)
|
const showSearch = ref(true)
|
||||||
const total = ref(0)
|
const total = ref(0)
|
||||||
@ -318,13 +344,25 @@ function resetQuery() {
|
|||||||
handleQuery()
|
handleQuery()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------ 新增弹窗 ------------------ */
|
/* ---------- 新增弹窗 ---------- */
|
||||||
const openAdd = ref(false)
|
const openAdd = ref(false)
|
||||||
const titleAdd = ref('新增消毒记录')
|
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({
|
const form = reactive({
|
||||||
id: null,
|
id: null,
|
||||||
technician: '',
|
technician: '',
|
||||||
datetime: new Date().toISOString().split('T')[0],
|
datetime: nowMinute(), // 精确到分钟
|
||||||
way: '',
|
way: '',
|
||||||
ratio: '',
|
ratio: '',
|
||||||
comment: '',
|
comment: '',
|
||||||
@ -337,7 +375,7 @@ function resetAdd() {
|
|||||||
Object.assign(form, {
|
Object.assign(form, {
|
||||||
id: null,
|
id: null,
|
||||||
technician: '',
|
technician: '',
|
||||||
datetime: new Date().toISOString().split('T')[0],
|
datetime: nowMinute(),
|
||||||
way: '',
|
way: '',
|
||||||
ratio: '',
|
ratio: '',
|
||||||
comment: '',
|
comment: '',
|
||||||
@ -372,13 +410,13 @@ function submitAdd() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------ 修改弹窗 ------------------ */
|
/* ---------- 修改弹窗 ---------- */
|
||||||
const openEdit = ref(false)
|
const openEdit = ref(false)
|
||||||
const titleEdit = ref('修改消毒记录')
|
const titleEdit = ref('修改消毒记录')
|
||||||
const editForm = reactive({
|
const editForm = reactive({
|
||||||
id: null,
|
id: null,
|
||||||
technician: '',
|
technician: '',
|
||||||
datetime: new Date().toISOString().split('T')[0],
|
datetime: nowMinute(),
|
||||||
way: '',
|
way: '',
|
||||||
ratio: '',
|
ratio: '',
|
||||||
comment: '',
|
comment: '',
|
||||||
@ -391,7 +429,7 @@ function resetEdit() {
|
|||||||
Object.assign(editForm, {
|
Object.assign(editForm, {
|
||||||
id: null,
|
id: null,
|
||||||
technician: '',
|
technician: '',
|
||||||
datetime: new Date().toISOString().split('T')[0],
|
datetime: nowMinute(),
|
||||||
way: '',
|
way: '',
|
||||||
ratio: '',
|
ratio: '',
|
||||||
comment: '',
|
comment: '',
|
||||||
@ -405,6 +443,8 @@ function handleUpdate(row) {
|
|||||||
resetEdit()
|
resetEdit()
|
||||||
const id = row.id || ids.value[0]
|
const id = row.id || ids.value[0]
|
||||||
getDisinfect(id).then(res => {
|
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)
|
Object.assign(editForm, res.data)
|
||||||
editDetails.value = res.data.usageDetails || []
|
editDetails.value = res.data.usageDetails || []
|
||||||
openEdit.value = true
|
openEdit.value = true
|
||||||
@ -431,7 +471,7 @@ function submitEdit() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------ 功能 ------------------ */
|
/* ---------- 功能 ---------- */
|
||||||
function handleDelete(row) {
|
function handleDelete(row) {
|
||||||
const _ids = row.id || ids.value
|
const _ids = row.id || ids.value
|
||||||
proxy.$modal.confirm('是否确认删除选中的数据?').then(() => delDisinfect(_ids)).then(() => {
|
proxy.$modal.confirm('是否确认删除选中的数据?').then(() => delDisinfect(_ids)).then(() => {
|
||||||
@ -444,7 +484,7 @@ function handleExport() {
|
|||||||
proxy.download('biosafety/disinfect/export', { ...queryParams }, `disinfect_${Date.now()}.xlsx`)
|
proxy.download('biosafety/disinfect/export', { ...queryParams }, `disinfect_${Date.now()}.xlsx`)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------ 下拉数据 ------------------ */
|
/* ---------- 下拉数据 ---------- */
|
||||||
const barns = ref([])
|
const barns = ref([])
|
||||||
const presOptions = ref([])
|
const presOptions = ref([])
|
||||||
const units = ref([])
|
const units = ref([])
|
||||||
@ -454,10 +494,12 @@ const medicines = ref([])
|
|||||||
/* 校验规则 */
|
/* 校验规则 */
|
||||||
const rules = {
|
const rules = {
|
||||||
sheepfoldIds: [{ required: true, message: '请选择羊舍', trigger: 'change' }],
|
sheepfoldIds: [{ required: true, message: '请选择羊舍', trigger: 'change' }],
|
||||||
|
technician: [{ required: true, message: '请输入技术员', trigger: 'blur' }],
|
||||||
|
way: [{ required: true, message: '请选择消毒方式', trigger: 'change' }],
|
||||||
datetime: [{ required: true, message: '请选择日期', trigger: 'change' }]
|
datetime: [{ required: true, message: '请选择日期', trigger: 'change' }]
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 处方选择事件 - 新增 */
|
/* 处方选择事件 */
|
||||||
function handleSelectPrescription(id) {
|
function handleSelectPrescription(id) {
|
||||||
if (!id) return
|
if (!id) return
|
||||||
getPrescription(id).then(res => {
|
getPrescription(id).then(res => {
|
||||||
@ -469,8 +511,6 @@ function handleSelectPrescription(id) {
|
|||||||
})) || []
|
})) || []
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 处方选择事件 - 修改 */
|
|
||||||
function handleSelectPrescriptionEdit(id) {
|
function handleSelectPrescriptionEdit(id) {
|
||||||
if (!id) return
|
if (!id) return
|
||||||
getPrescription(id).then(res => {
|
getPrescription(id).then(res => {
|
||||||
@ -483,20 +523,18 @@ function handleSelectPrescriptionEdit(id) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 明细添加行 - 新增 */
|
/* 明细添加行 */
|
||||||
function handleAddDetail() {
|
function handleAddDetail() {
|
||||||
usageDetails.value.push({ mediId: null, dosage: 0, unit: null, usageId: null, manufacturer: null, batchNumber: null })
|
usageDetails.value.push({ mediId: null, dosage: 0, unit: null, usageId: null, manufacturer: null, batchNumber: null })
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 明细添加行 - 修改 */
|
|
||||||
function handleAddDetailEdit() {
|
function handleAddDetailEdit() {
|
||||||
editDetails.value.push({ mediId: null, dosage: 0, unit: null, usageId: null, manufacturer: null, batchNumber: null })
|
editDetails.value.push({ mediId: null, dosage: 0, unit: null, usageId: null, manufacturer: null, batchNumber: null })
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------ 初始加载 ------------------ */
|
/* ---------- 初始加载 ---------- */
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getList()
|
getList()
|
||||||
/* 加载本地羊舍 */
|
/* 本地羊舍下拉 */
|
||||||
request({ url: '/sheepfold_management/sheepfold_management/list', method: 'get' }).then(res => {
|
request({ url: '/sheepfold_management/sheepfold_management/list', method: 'get' }).then(res => {
|
||||||
barns.value = res.rows
|
barns.value = res.rows
|
||||||
})
|
})
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
<dict-tag :options="pres_type" :value="scope.row.persType" />
|
<dict-tag :options="pres_type" :value="scope.row.persType" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="创建人" align="center" prop="createBy" />
|
||||||
<el-table-column label="备注" align="center" prop="comment" />
|
<el-table-column label="备注" align="center" prop="comment" />
|
||||||
<el-table-column label="状态" align="center" prop="status">
|
<el-table-column label="状态" align="center" prop="status">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
@ -61,7 +62,8 @@
|
|||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button link type="primary" icon="View" @click="handleView(scope.row)">详情</el-button>
|
<el-button link type="primary" icon="View" @click="handleView(scope.row)">详情</el-button>
|
||||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button>
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button>
|
||||||
<el-button link :type="scope.row.status ? 'warning' : 'primary'" @click="handleStatus(scope.row)">{{ scope.row.status?"禁用":"启用" }}</el-button>
|
<el-button link :type="scope.row.status ? 'warning' : 'primary'" @click="handleStatus(scope.row)">{{
|
||||||
|
scope.row.status?"禁用":"启用" }}</el-button>
|
||||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user