2025-07-12 17:52:08 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="app-container">
|
|
|
|
|
|
<!-- 搜索表单 -->
|
2025-10-12 13:16:14 +08:00
|
|
|
|
<el-form ref="queryRef" :model="queryParams" :inline="true" v-show="showSearch" label-width="68px">
|
2026-01-22 20:32:23 +08:00
|
|
|
|
<el-form-item label="羊只耳号" prop="sheepNo">
|
|
|
|
|
|
<el-input v-model="queryParams.sheepNo" placeholder="请输入耳号,多个用空格分隔" clearable @keyup.enter="getList" />
|
|
|
|
|
|
</el-form-item>
|
2025-08-24 00:06:56 +08:00
|
|
|
|
<!-- 使用日期(新增) -->
|
|
|
|
|
|
<el-form-item label="使用日期" style="width: 308px">
|
2025-10-12 13:16:14 +08:00
|
|
|
|
<el-date-picker v-model="daterangeUseTime" type="daterange" range-separator="-" start-placeholder="开始日期"
|
|
|
|
|
|
end-placeholder="结束日期" value-format="YYYY-MM-DD" />
|
2025-08-24 00:06:56 +08:00
|
|
|
|
</el-form-item>
|
2026-01-22 20:32:23 +08:00
|
|
|
|
<el-form-item label="使用名称" prop="name">
|
2025-10-13 13:32:23 +08:00
|
|
|
|
<el-select v-model="queryParams.name" placeholder="请选择使用药品名称" clearable filterable style="width: 100%"
|
|
|
|
|
|
@keyup.enter="handleQuery">
|
|
|
|
|
|
<el-option v-for="item in medicines" :key="item.value" :label="item.label" :value="item.label" />
|
|
|
|
|
|
</el-select>
|
2025-07-12 17:52:08 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
2026-01-22 20:32:23 +08:00
|
|
|
|
<el-form-item label="创建时间" style="width: 308px">
|
|
|
|
|
|
<el-date-picker v-model="daterangeCreateTime" type="daterange" range-separator="-" start-placeholder="开始日期"
|
|
|
|
|
|
end-placeholder="结束日期" value-format="YYYY-MM-DD" />
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
2025-07-12 17:52:08 +08:00
|
|
|
|
<el-form-item label="使用类型" prop="useType">
|
2025-10-12 13:16:14 +08:00
|
|
|
|
<el-select v-model="queryParams.useType" placeholder="请选择使用类型" clearable style="width: 180px">
|
|
|
|
|
|
<el-option v-for="dict in pres_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
2025-07-12 17:52:08 +08:00
|
|
|
|
</el-select>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item>
|
|
|
|
|
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
|
|
|
|
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-form>
|
2025-08-20 17:26:29 +08:00
|
|
|
|
|
2025-07-12 17:52:08 +08:00
|
|
|
|
<!-- 工具栏 -->
|
|
|
|
|
|
<el-row :gutter="10" class="mb8">
|
|
|
|
|
|
<el-col :span="1.5">
|
2025-10-12 13:16:14 +08:00
|
|
|
|
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['biosafety:usage:export']">
|
2025-08-24 00:06:56 +08:00
|
|
|
|
导出
|
|
|
|
|
|
</el-button>
|
2025-07-12 17:52:08 +08:00
|
|
|
|
</el-col>
|
|
|
|
|
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 数据表格 -->
|
2026-01-13 21:45:32 +08:00
|
|
|
|
<el-table v-loading="loading" :data="usageList" @selection-change="handleSelectionChange" max-height="650px">
|
2025-10-12 13:16:14 +08:00
|
|
|
|
<el-table-column label="使用时间" align="center" prop="datetime" width="180">
|
2025-07-12 17:52:08 +08:00
|
|
|
|
<template #default="scope">
|
2025-08-24 00:06:56 +08:00
|
|
|
|
<span>{{ parseTime(scope.row.datetime, '{y}-{m}-{d}') }}</span>
|
2025-07-12 17:52:08 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
2025-08-20 17:26:29 +08:00
|
|
|
|
<el-table-column label="使用名称" align="center" prop="name" />
|
2025-08-24 00:06:56 +08:00
|
|
|
|
<el-table-column label="羊只耳号" align="center" prop="sheepNo" />
|
|
|
|
|
|
<el-table-column label="羊舍" align="center" prop="sheepfoldName" />
|
2025-08-20 17:26:29 +08:00
|
|
|
|
<el-table-column label="使用类型" align="center" prop="useType">
|
2025-07-12 17:52:08 +08:00
|
|
|
|
<template #default="scope">
|
2025-08-20 17:26:29 +08:00
|
|
|
|
<dict-tag :options="pres_type" :value="scope.row.useType" />
|
2025-07-12 17:52:08 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
2025-10-12 13:16:14 +08:00
|
|
|
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
2025-08-24 00:06:56 +08:00
|
|
|
|
<template #default="scope">
|
|
|
|
|
|
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{m}') }}</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
2025-08-20 17:26:29 +08:00
|
|
|
|
|
2025-10-12 13:16:14 +08:00
|
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
2025-07-12 17:52:08 +08:00
|
|
|
|
<template #default="scope">
|
2025-10-12 13:16:14 +08:00
|
|
|
|
<el-button link type="primary" icon="View" @click="handleDetail(scope.row)"
|
|
|
|
|
|
v-hasPermi="['biosafety:usage:query']">
|
2025-08-24 00:06:56 +08:00
|
|
|
|
详情
|
|
|
|
|
|
</el-button>
|
2025-07-12 17:52:08 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 分页 -->
|
2025-10-12 13:16:14 +08:00
|
|
|
|
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
|
|
|
|
|
v-model:limit="queryParams.pageSize" :page-sizes="[20, 50, 100, 200, 500, 1000, 2000]" @pagination="getList" />
|
2025-10-13 13:32:23 +08:00
|
|
|
|
|
2025-08-24 00:06:56 +08:00
|
|
|
|
<!-- 详情弹窗(保持不变) -->
|
2025-10-12 13:16:14 +08:00
|
|
|
|
<el-dialog :title="title" v-model="open" width="680px" top="8vh" append-to-body :close-on-click-modal="false"
|
|
|
|
|
|
class="usage-detail-dialog">
|
2025-07-12 17:52:08 +08:00
|
|
|
|
<!-- 基础信息 -->
|
|
|
|
|
|
<el-card shadow="never" class="detail-card">
|
|
|
|
|
|
<template #header>
|
|
|
|
|
|
<div class="card-header">
|
2025-10-12 13:16:14 +08:00
|
|
|
|
<el-icon>
|
|
|
|
|
|
<Document />
|
|
|
|
|
|
</el-icon> 基本信息
|
2025-07-12 17:52:08 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<el-descriptions :column="2" border>
|
2025-08-24 00:06:56 +08:00
|
|
|
|
<el-descriptions-item label="使用名称">{{ form.name }}</el-descriptions-item>
|
2025-07-12 17:52:08 +08:00
|
|
|
|
<el-descriptions-item label="使用类型">
|
2025-10-12 13:16:14 +08:00
|
|
|
|
<el-tag size="small" :type="form.useType === 1 ? 'primary' : 'success'">
|
2025-08-24 00:06:56 +08:00
|
|
|
|
{{ pres_type.find(it => it.value === form.useType)?.label || '' }}
|
2025-07-12 17:52:08 +08:00
|
|
|
|
</el-tag>
|
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
|
<el-descriptions-item label="使用时间" :span="2">
|
2025-08-20 17:26:29 +08:00
|
|
|
|
{{ parseTime(form.createTime, '{y}-{m}-{d} {h}:{i}') }}
|
2025-07-12 17:52:08 +08:00
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
|
</el-descriptions>
|
|
|
|
|
|
</el-card>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 药品明细 -->
|
2025-08-24 00:06:56 +08:00
|
|
|
|
<el-card shadow="never" class="detail-card" style="margin-top: 16px">
|
2025-07-12 17:52:08 +08:00
|
|
|
|
<template #header>
|
|
|
|
|
|
<div class="card-header">
|
2025-10-12 13:16:14 +08:00
|
|
|
|
<el-icon>
|
|
|
|
|
|
<List />
|
|
|
|
|
|
</el-icon> 药品使用明细
|
2025-07-12 17:52:08 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
2025-10-12 13:16:14 +08:00
|
|
|
|
<el-table :data="swMedicineUsageDetailsList" stripe size="small"
|
|
|
|
|
|
:row-class-name="rowSwMedicineUsageDetailsIndex" style="width: 100%">
|
2025-07-12 17:52:08 +08:00
|
|
|
|
<el-table-column label="药品" prop="mediName" show-overflow-tooltip />
|
|
|
|
|
|
<el-table-column label="用量" prop="dosage" width="80" />
|
|
|
|
|
|
<el-table-column label="单位" prop="unit" align="center" :formatter="formatUnit" />
|
|
|
|
|
|
<el-table-column label="使用方法" align="center" prop="usageId" :formatter="formatUsage" />
|
2025-08-25 14:53:53 +08:00
|
|
|
|
<el-table-column v-if="form.useType==4" label="使用时间" align="center" prop="useTime" width="120">
|
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
|
<span>{{ parseTime(scope.row.usetime, '{y}-{m}-{d}') }}</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
2025-07-12 17:52:08 +08:00
|
|
|
|
<el-table-column label="生产厂家" prop="manufacturer" show-overflow-tooltip />
|
|
|
|
|
|
<el-table-column label="生产批号" prop="batchNumber" width="120" />
|
|
|
|
|
|
</el-table>
|
|
|
|
|
|
</el-card>
|
|
|
|
|
|
|
|
|
|
|
|
<template #footer>
|
|
|
|
|
|
<el-button @click="cancel">关 闭</el-button>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup name="Usage">
|
2025-10-13 13:32:23 +08:00
|
|
|
|
import { listMedicine} from "@/api/biosafety/medicine"
|
2025-08-24 00:06:56 +08:00
|
|
|
|
import { listUsageInfo, getUsageInfo } from '@/api/biosafety/usageInfo'
|
|
|
|
|
|
import { listUnit } from '@/api/biosafety/unit'
|
|
|
|
|
|
import { listUsage } from '@/api/biosafety/usage'
|
2025-07-12 17:52:08 +08:00
|
|
|
|
import { getCurrentInstance, reactive, ref, toRefs } from 'vue'
|
|
|
|
|
|
|
|
|
|
|
|
const { proxy } = getCurrentInstance()
|
|
|
|
|
|
const { pres_type } = proxy.useDict('pres_type')
|
|
|
|
|
|
|
|
|
|
|
|
const usageList = ref([])
|
|
|
|
|
|
const swMedicineUsageDetailsList = ref([])
|
|
|
|
|
|
const open = ref(false)
|
|
|
|
|
|
const loading = ref(true)
|
|
|
|
|
|
const showSearch = ref(true)
|
|
|
|
|
|
const total = ref(0)
|
|
|
|
|
|
const title = ref('')
|
|
|
|
|
|
const daterangeCreateTime = ref([])
|
2025-08-24 00:06:56 +08:00
|
|
|
|
const daterangeUseTime = ref([]) // 新增
|
2025-07-12 17:52:08 +08:00
|
|
|
|
|
|
|
|
|
|
const data = reactive({
|
|
|
|
|
|
form: {},
|
|
|
|
|
|
queryParams: {
|
|
|
|
|
|
pageNum: 1,
|
2025-10-12 13:16:14 +08:00
|
|
|
|
pageSize: 20,
|
2025-07-12 17:52:08 +08:00
|
|
|
|
name: null,
|
|
|
|
|
|
useType: null,
|
|
|
|
|
|
createTime: null
|
|
|
|
|
|
},
|
|
|
|
|
|
rules: {}
|
|
|
|
|
|
})
|
|
|
|
|
|
const { queryParams, form, rules } = toRefs(data)
|
|
|
|
|
|
|
2025-08-24 00:06:56 +08:00
|
|
|
|
const units = ref([])
|
|
|
|
|
|
const usages = ref([])
|
2025-10-13 13:32:23 +08:00
|
|
|
|
const medicines = ref([])
|
2025-07-12 17:52:08 +08:00
|
|
|
|
|
2025-08-24 00:06:56 +08:00
|
|
|
|
/* 获取单位 */
|
2025-07-12 17:52:08 +08:00
|
|
|
|
function getUnit() {
|
2025-08-24 00:06:56 +08:00
|
|
|
|
listUnit().then(res => {
|
|
|
|
|
|
units.value = res.rows.map(item => ({ value: item.id, label: item.name }))
|
2025-07-12 17:52:08 +08:00
|
|
|
|
})
|
|
|
|
|
|
}
|
2025-10-13 13:32:23 +08:00
|
|
|
|
/* 获取药品信息 */
|
|
|
|
|
|
function getMedicineOptions() {
|
|
|
|
|
|
listMedicine().then(res => {
|
|
|
|
|
|
medicines.value = res.rows.map(item => ({ value: item.id, label: item.name }))
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-24 00:06:56 +08:00
|
|
|
|
/* 获取使用方法 */
|
2025-07-12 17:52:08 +08:00
|
|
|
|
function getUsageOptions() {
|
2025-08-24 00:06:56 +08:00
|
|
|
|
listUsage().then(res => {
|
|
|
|
|
|
usages.value = res.rows.map(item => ({ value: item.id, label: item.name }))
|
2025-07-12 17:52:08 +08:00
|
|
|
|
})
|
|
|
|
|
|
}
|
2025-08-24 00:06:56 +08:00
|
|
|
|
/* 格式化单位 */
|
2025-07-12 17:52:08 +08:00
|
|
|
|
function formatUnit(row) {
|
2025-08-24 00:06:56 +08:00
|
|
|
|
const unit = units.value.find(u => String(u.value) === String(row.unit))
|
2025-07-12 17:52:08 +08:00
|
|
|
|
return unit?.label ?? ''
|
|
|
|
|
|
}
|
2025-08-24 00:06:56 +08:00
|
|
|
|
/* 格式化使用方法 */
|
|
|
|
|
|
function formatUsage(row) {
|
|
|
|
|
|
const usage = usages.value.find(u => String(u.value) === String(row.usageId))
|
|
|
|
|
|
return usage?.label ?? ''
|
|
|
|
|
|
}
|
2025-07-12 17:52:08 +08:00
|
|
|
|
|
2025-08-24 00:06:56 +08:00
|
|
|
|
/* 查询列表 */
|
2025-07-12 17:52:08 +08:00
|
|
|
|
function getList() {
|
|
|
|
|
|
loading.value = true
|
|
|
|
|
|
queryParams.value.params = {}
|
2025-08-24 00:06:56 +08:00
|
|
|
|
|
2025-07-12 17:52:08 +08:00
|
|
|
|
if (daterangeCreateTime.value && daterangeCreateTime.value.length === 2) {
|
|
|
|
|
|
queryParams.value.params.beginCreateTime = daterangeCreateTime.value[0]
|
|
|
|
|
|
queryParams.value.params.endCreateTime = daterangeCreateTime.value[1]
|
|
|
|
|
|
}
|
2025-08-24 00:06:56 +08:00
|
|
|
|
if (daterangeUseTime.value && daterangeUseTime.value.length === 2) {
|
|
|
|
|
|
queryParams.value.params.beginUseTime = daterangeUseTime.value[0]
|
|
|
|
|
|
queryParams.value.params.endUseTime = daterangeUseTime.value[1]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-12 17:52:08 +08:00
|
|
|
|
listUsageInfo(queryParams.value).then(res => {
|
|
|
|
|
|
usageList.value = res.rows
|
|
|
|
|
|
total.value = res.total
|
|
|
|
|
|
loading.value = false
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function reset() {
|
|
|
|
|
|
form.value = {
|
|
|
|
|
|
id: null,
|
|
|
|
|
|
name: null,
|
|
|
|
|
|
useType: null,
|
|
|
|
|
|
createBy: null,
|
|
|
|
|
|
createTime: null
|
|
|
|
|
|
}
|
|
|
|
|
|
swMedicineUsageDetailsList.value = []
|
|
|
|
|
|
}
|
|
|
|
|
|
function cancel() {
|
|
|
|
|
|
open.value = false
|
|
|
|
|
|
reset()
|
|
|
|
|
|
}
|
|
|
|
|
|
function handleQuery() {
|
|
|
|
|
|
queryParams.value.pageNum = 1
|
|
|
|
|
|
getList()
|
|
|
|
|
|
}
|
|
|
|
|
|
function resetQuery() {
|
|
|
|
|
|
daterangeCreateTime.value = []
|
2025-08-24 00:06:56 +08:00
|
|
|
|
daterangeUseTime.value = [] // 新增
|
2025-07-12 17:52:08 +08:00
|
|
|
|
proxy.resetForm('queryRef')
|
|
|
|
|
|
handleQuery()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function handleDetail(row) {
|
|
|
|
|
|
reset()
|
|
|
|
|
|
getUsageInfo(row.id).then(res => {
|
|
|
|
|
|
form.value = res.data
|
|
|
|
|
|
swMedicineUsageDetailsList.value = res.data.swMedicineUsageDetailsList || []
|
|
|
|
|
|
open.value = true
|
|
|
|
|
|
title.value = '药品使用记录详情'
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
function handleSelectionChange(selection) {
|
|
|
|
|
|
ids.value = selection.map(item => item.id)
|
|
|
|
|
|
}
|
2025-08-24 00:06:56 +08:00
|
|
|
|
function rowSwMedicineUsageDetailsIndex({ rowIndex }) {
|
|
|
|
|
|
return `row-${rowIndex}`
|
2025-07-12 17:52:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
function handleExport() {
|
2025-08-24 00:06:56 +08:00
|
|
|
|
proxy.download(
|
|
|
|
|
|
'biosafety/usageInfo/export',
|
|
|
|
|
|
{ ...queryParams.value },
|
2025-08-26 17:04:07 +08:00
|
|
|
|
`药品使用记录_${new Date().getTime()}.xlsx`
|
2025-08-24 00:06:56 +08:00
|
|
|
|
)
|
2025-07-12 17:52:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-24 00:06:56 +08:00
|
|
|
|
/* 初始化 */
|
2025-07-12 17:52:08 +08:00
|
|
|
|
getList()
|
2025-08-24 00:06:56 +08:00
|
|
|
|
getUnit()
|
2025-10-13 13:32:23 +08:00
|
|
|
|
getMedicineOptions()
|
2025-08-24 00:06:56 +08:00
|
|
|
|
getUsageOptions()
|
2025-07-12 17:52:08 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
.usage-detail-dialog .detail-card {
|
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
|
margin: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
.usage-detail-dialog .card-header {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
color: #303133;
|
|
|
|
|
|
}
|
|
|
|
|
|
.usage-detail-dialog .card-header .el-icon {
|
|
|
|
|
|
margin-right: 6px;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|