Merge branch 'main' of http://e19510c831.iok.la/admin/zhyc-sheep-ui
This commit is contained in:
commit
cdbef567d1
44
src/api/feed/FeedList.js
Normal file
44
src/api/feed/FeedList.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询配料清单列表
|
||||||
|
export function listFeedList(query) {
|
||||||
|
return request({
|
||||||
|
url: '/feed/FeedList/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询配料清单详细
|
||||||
|
export function getFeedList(id) {
|
||||||
|
return request({
|
||||||
|
url: '/feed/FeedList/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增配料清单
|
||||||
|
export function addFeedList(data) {
|
||||||
|
return request({
|
||||||
|
url: '/feed/FeedList',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改配料清单
|
||||||
|
export function updateFeedList(data) {
|
||||||
|
return request({
|
||||||
|
url: '/feed/FeedList',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除配料清单
|
||||||
|
export function delFeedList(id) {
|
||||||
|
return request({
|
||||||
|
url: '/feed/FeedList/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
@ -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,17 +51,19 @@
|
|||||||
<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">
|
||||||
<dict-tag :options="pres_status" :value="scope.row.status" />
|
<dict-tag :options="pres_status" :value="scope.row.status" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="300px">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="300px">
|
||||||
<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>
|
||||||
|
292
src/views/feed/FeedList/index.vue
Normal file
292
src/views/feed/FeedList/index.vue
Normal file
@ -0,0 +1,292 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="100px">
|
||||||
|
<el-form-item label="配方编号" prop="formulaId">
|
||||||
|
<el-input v-model="queryParams.formulaId" placeholder="请输入配方编号" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="饲草班人员" prop="zookeeper">
|
||||||
|
<el-input v-model="queryParams.zookeeper" placeholder="请输入饲草班人员" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="配料日期" prop="deployDate">
|
||||||
|
<el-date-picker clearable v-model="queryParams.deployDate" type="date" value-format="YYYY-MM-DD"
|
||||||
|
placeholder="请选择配料日期">
|
||||||
|
</el-date-picker>
|
||||||
|
</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>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['feed:FeedList:add']">新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
|
||||||
|
v-hasPermi="['feed:FeedList:edit']">修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<!-- <el-col :span="1.5">
|
||||||
|
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||||
|
v-hasPermi="['feed:FeedList:remove']">删除</el-button>
|
||||||
|
</el-col> -->
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||||
|
v-hasPermi="['feed:FeedList:export']">导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="FeedListList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<!-- <el-table-column label="序号" type="index" width="60" align="center" prop="id" /> -->
|
||||||
|
<el-table-column label="配方编号" align="center" prop="formulaId" />
|
||||||
|
<el-table-column label="配方批号" align="center" prop="formulaBatchId" />
|
||||||
|
<el-table-column label="饲草班人员" align="center" prop="zookeeper" />
|
||||||
|
<el-table-column label="配料日期" align="center" prop="deployDate" width="180">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ parseTime(scope.row.deployDate, '{y}-{m}-{d}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button link type="primary" icon="View" @click="handleView(scope.row)">详情</el-button>
|
||||||
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['feed:FeedList:edit']">修改</el-button>
|
||||||
|
<!-- <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['feed:FeedList:remove']">删除</el-button> -->
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
||||||
|
v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||||
|
|
||||||
|
<!-- 添加或修改配料清单对话框 -->
|
||||||
|
<el-dialog :title="title" v-model="open" width="500px" append-to-body
|
||||||
|
v-if="openModel === 'add' || openModel === 'edit'">
|
||||||
|
<el-form ref="FeedListRef" :model="form" :rules="rules" label-width="100px">
|
||||||
|
<el-form-item label="饲草班人员" prop="zookeeper">
|
||||||
|
<el-input v-model="form.zookeeper" placeholder="请输入饲草班人员名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="配料日期" prop="deployDate">
|
||||||
|
<el-date-picker clearable v-model="form.deployDate" type="date" value-format="YYYY-MM-DD"
|
||||||
|
placeholder="请选择配料日期">
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 弹框:详情/修改 -->
|
||||||
|
<el-dialog :title="title" v-model="open" width="60%" append-to-body s v-if="openModel === 'view'">
|
||||||
|
<!-- 详情页:只读展示 -->
|
||||||
|
<div style="padding-bottom:20px ;">
|
||||||
|
<el-descriptions :column="2" border>
|
||||||
|
<el-descriptions-item label="配方编号">{{ showFeedList.formulaId }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="配方批号">{{ showFeedList.formulaBatchId }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="饲养阶段">{{ showFeedList.rootFormula.feedStage }}</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
|
||||||
|
<el-divider content-position="left">配料列表</el-divider>
|
||||||
|
|
||||||
|
<el-table :data="showFeedList.formulaList" stripe border style="width: 100%" max-height="300">
|
||||||
|
<el-table-column label="序号" type="index" width="60" align="center" />
|
||||||
|
<!-- <el-table-column label="原料编号" prop="materialId" align="center" /> -->
|
||||||
|
<el-table-column label="原料" align="center">
|
||||||
|
<el-table-column label="名称" prop="materialName" align="center" />
|
||||||
|
<el-table-column label="类型" align="center" prop="isGranular">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options="material_type" :value="scope.row.isGranular" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="配量" align="center" prop="ratio">
|
||||||
|
<el-table-column label="上午" align="center" prop="ratio">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ (scope.row.ratio / 100 * showFeedList.rootPlan.planMorningSize).toFixed(2) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="中午" align="center" prop="ratio">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ (scope.row.ratio / 100 * showFeedList.rootPlan.planNoonSize).toFixed(2) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="下午" align="center" prop="ratio">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ (scope.row.ratio / 100 * showFeedList.rootPlan.planAfternoonSize).toFixed(2) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="类型" prop="isSupplement" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options="materialType" :value="scope.row.isSupplement" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="FeedList">
|
||||||
|
import { listFeedList, getFeedList, delFeedList, addFeedList, updateFeedList } from "@/api/feed/FeedList"
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance()
|
||||||
|
|
||||||
|
const FeedListList = ref([])
|
||||||
|
const open = ref(false)
|
||||||
|
const loading = ref(true)
|
||||||
|
const showSearch = ref(true)
|
||||||
|
const ids = ref([])
|
||||||
|
const single = ref(true)
|
||||||
|
const multiple = ref(true)
|
||||||
|
const total = ref(0)
|
||||||
|
const title = ref("")
|
||||||
|
|
||||||
|
const data = reactive({
|
||||||
|
form: {},
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
formulaId: null,
|
||||||
|
zookeeper: null,
|
||||||
|
deployDate: null
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const { queryParams, form, rules } = toRefs(data)
|
||||||
|
|
||||||
|
const showFeedList = ref({})
|
||||||
|
const openModel = ref("")
|
||||||
|
// 原料类型字典
|
||||||
|
const { material_type } = proxy.useDict('material_type')
|
||||||
|
// 原料类型
|
||||||
|
const materialType = [
|
||||||
|
{ value: '1', label: '补饲原料' },
|
||||||
|
{ value: '0', label: '原料' }
|
||||||
|
]
|
||||||
|
function handleView(row) {
|
||||||
|
showFeedList.value = row
|
||||||
|
open.value = true
|
||||||
|
openModel.value = "view"
|
||||||
|
title.value = "配料清单详情"
|
||||||
|
console.log("查看配料清单", row)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 查询配料清单列表 */
|
||||||
|
function getList() {
|
||||||
|
loading.value = true
|
||||||
|
listFeedList(queryParams.value).then(response => {
|
||||||
|
FeedListList.value = response.rows
|
||||||
|
total.value = response.total
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消按钮
|
||||||
|
function cancel() {
|
||||||
|
open.value = false
|
||||||
|
reset()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表单重置
|
||||||
|
function reset() {
|
||||||
|
form.value = {
|
||||||
|
id: null,
|
||||||
|
formulaId: null,
|
||||||
|
formulaBatchId: null,
|
||||||
|
zookeeper: null,
|
||||||
|
deployDate: null
|
||||||
|
}
|
||||||
|
proxy.resetForm("FeedListRef")
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
function handleQuery() {
|
||||||
|
queryParams.value.pageNum = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
function resetQuery() {
|
||||||
|
proxy.resetForm("queryRef")
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 多选框选中数据
|
||||||
|
function handleSelectionChange(selection) {
|
||||||
|
ids.value = selection.map(item => item.id)
|
||||||
|
single.value = selection.length != 1
|
||||||
|
multiple.value = !selection.length
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
function handleAdd() {
|
||||||
|
reset()
|
||||||
|
open.value = true
|
||||||
|
title.value = "添加配料清单"
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
function handleUpdate(row) {
|
||||||
|
reset()
|
||||||
|
const _id = row.id || ids.value
|
||||||
|
console.log("HandleUpdate => 配料清单ID =>", _id)
|
||||||
|
getFeedList(_id).then(response => {
|
||||||
|
form.value = response.data
|
||||||
|
open.value = true
|
||||||
|
openModel.value = "edit"
|
||||||
|
title.value = "修改配料清单"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交按钮 */
|
||||||
|
function submitForm() {
|
||||||
|
proxy.$refs["FeedListRef"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (form.value.id != null) {
|
||||||
|
updateFeedList(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("修改成功")
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
addFeedList(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("新增成功")
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
function handleDelete(row) {
|
||||||
|
const _ids = row.id || ids.value
|
||||||
|
proxy.$modal.confirm('是否确认删除配料清单编号为"' + _ids + '"的数据项?').then(function () {
|
||||||
|
return delFeedList(_ids)
|
||||||
|
}).then(() => {
|
||||||
|
getList()
|
||||||
|
proxy.$modal.msgSuccess("删除成功")
|
||||||
|
}).catch(() => { })
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
function handleExport() {
|
||||||
|
proxy.download('feed/FeedList/export', {
|
||||||
|
...queryParams.value
|
||||||
|
}, `FeedList_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
|
||||||
|
getList()
|
||||||
|
</script>
|
Loading…
x
Reference in New Issue
Block a user